OpenVAS Libraries  9.0.1
Macros | Functions
nasl.h File Reference
#include <glib.h>
#include "../misc/arglists.h"

Go to the source code of this file.

Macros

#define NASL_EXEC_DESCR   (1 << 0)
 
#define NASL_EXEC_PARSE_ONLY   (1 << 1)
 
#define NASL_ALWAYS_SIGNED   (1 << 2)
 
#define NASL_COMMAND_LINE   (1 << 3)
 
#define NASL_LINT   (1 << 4)
 
#define NASL_ERR_NOERR   0
 
#define NASL_ERR_ETIMEDOUT   1
 
#define NASL_ERR_ECONNRESET   2
 
#define NASL_ERR_EUNREACH   3
 
#define NASL_ERR_EUNKNOWN   99
 

Functions

int nasl_verify_signature (const char *filename)
 
char * nasl_extract_signature_fprs (const char *filename)
 
GSList * nasl_get_all_certificates (void)
 
int add_nasl_inc_dir (const char *)
 Adds the given string as directory for searching for includes. More...
 
int exec_nasl_script (struct arglist *, const char *, const char *, int)
 Execute a NASL script. More...
 
int execute_preparsed_nasl_script (struct arglist *, char *, char *, int, int)
 
char * nasl_version (void)
 
pid_t nasl_server_start (char *, char *)
 
void nasl_server_recompile (char *, char *)
 

Macro Definition Documentation

◆ NASL_ALWAYS_SIGNED

#define NASL_ALWAYS_SIGNED   (1 << 2)

◆ NASL_COMMAND_LINE

#define NASL_COMMAND_LINE   (1 << 3)

◆ NASL_ERR_ECONNRESET

#define NASL_ERR_ECONNRESET   2

◆ NASL_ERR_ETIMEDOUT

#define NASL_ERR_ETIMEDOUT   1

◆ NASL_ERR_EUNKNOWN

#define NASL_ERR_EUNKNOWN   99

◆ NASL_ERR_EUNREACH

#define NASL_ERR_EUNREACH   3

◆ NASL_ERR_NOERR

#define NASL_ERR_NOERR   0

◆ NASL_EXEC_DESCR

#define NASL_EXEC_DESCR   (1 << 0)

◆ NASL_EXEC_PARSE_ONLY

#define NASL_EXEC_PARSE_ONLY   (1 << 1)

◆ NASL_LINT

#define NASL_LINT   (1 << 4)

Function Documentation

◆ add_nasl_inc_dir()

int add_nasl_inc_dir ( const char *  dir)

Adds the given string as directory for searching for includes.

Parameters
dirA directory path. This function will add a copy of this parameter to the list of include folders. This means the parameter can be freed elsewhere without affecting the list.
Returns
0 in case of success. -1 if the stat on the given directory path was unsuccessful. -2 if the given directory path was not a directory.

◆ exec_nasl_script()

int exec_nasl_script ( struct arglist script_infos,
const char *  name,
const char *  oid,
int  mode 
)

Execute a NASL script.

"mode" is a bit field: bit #0 (1) is "description" Bit #1 (2) is "parse only"

Parameters
script_infosThe plugin as arglist. Has to be allocated.
nameFilename.
modeBit field describing launch mode (description, parse always signed).
Returns
0 if the script was executed successfully, negative values if an error occurred.
Todo:
Initialization of the library seems intuitively be necessary only once (involves "linking" the nasl functions to c code). Consider a "prototype" context that has to be created only once and of which copies are made when needed.

◆ execute_preparsed_nasl_script()

int execute_preparsed_nasl_script ( struct arglist ,
char *  ,
char *  ,
int  ,
int   
)

◆ nasl_extract_signature_fprs()

char* nasl_extract_signature_fprs ( const char *  filename)

◆ nasl_get_all_certificates()

GSList* nasl_get_all_certificates ( void  )

◆ nasl_server_recompile()

void nasl_server_recompile ( char *  ,
char *   
)

◆ nasl_server_start()

pid_t nasl_server_start ( char *  ,
char *   
)

◆ nasl_verify_signature()

int nasl_verify_signature ( const char *  filename)

Checks the detached OpenPGP signature of the file given by FILENAME. The name of the signature file is derived from FILENAME by appending ".asc".

If a signature file exists and it contains only fully valid signatures, the function returns 0. If any of the signatures is not valid or was made by an unknown or untrusted key, the function returns 1. If an error occurs or the file does not have a corresponding detached signature the function returns -1.

Parameters
filenameFilename (e.g. 1.txt) for which to check signature (e.g. 1.txt.asc).
Returns
Zero, if files exists and all signatures are fully trusted. 1 if at least one signature from invalid or untrusted key. -1 on missing file or error.

◆ nasl_version()

char* nasl_version ( void  )