#include <glib.h>
#include "../misc/arglists.h"
Go to the source code of this file.
#define NASL_ALWAYS_SIGNED (1 << 3) |
#define NASL_COMMAND_LINE (1 << 4) |
#define NASL_ERR_ECONNRESET 2 |
#define NASL_ERR_ETIMEDOUT 1 |
#define NASL_ERR_EUNKNOWN 99 |
#define NASL_ERR_EUNREACH 3 |
#define NASL_EXEC_DESCR (1 << 0) |
#define NASL_EXEC_DONT_CLEANUP (1 << 2) |
#define NASL_EXEC_PARSE_ONLY (1 << 1) |
#define NASL_LINT (1 << 5) |
int add_nasl_inc_dir |
( |
const char * |
dir | ) |
|
Adds the given string as directory for searching for includes.
- Parameters
-
dir | A 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.
int exec_nasl_script |
( |
struct arglist * |
script_infos, |
|
|
const char * |
name, |
|
|
int |
mode |
|
) |
| |
Execute a NASL script.
"mode" is a bit field: bit #0 (1) is "description" Bit #1 (2) is "parse only"
- Parameters
-
script_infos | The plugin as arglist. Has to be allocated, and at least "preferences" sould be set. |
name | Filename. |
mode | Bit 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.
int execute_preparsed_nasl_script |
( |
struct arglist * |
, |
|
|
char * |
, |
|
|
char * |
, |
|
|
int |
, |
|
|
int |
|
|
) |
| |
char* nasl_extract_signature_fprs |
( |
const char * |
filename | ) |
|
Extracts fingerprints of signing public keys in a given signature file.
Works like nasl_verify_signature, but always returns a string with the fingerprints in it (NULL if error), even if the keys are not trusted.
- Parameters
-
filename | Path to the signed file (e.g. /../check_killerapp.nasl). |
- Returns
- A string with comma- separated fingerprints or NULL if error.
- See Also
- nasl_verify_signature( const char* filename )
- Todo:
- Once there was a size limitation for the cache. It was removed since OpenVAS > 2.0 and this fixed size here should eventually be replaced by dynamic solution.
GSList* nasl_get_all_certificates |
( |
| ) |
|
Creates certificate_ts for all certificates found in the.
(custom) gpg home directory and returns a pointer to a GSList containing (pointers to) them.
Creation has to be done in two steps: First retrieve info like ownername and trust level and then read in the full public key. The two steps have to be done seperately because the two gpgme listing operations are exclusive.
- Returns
- Pointer to a GSList containing pointers to certificate structs.
- Todo:
- consider using the certificates_t type from base/certificates.c
- Todo:
- base/certificate.c offers certificates (list) functionality
void nasl_server_recompile |
( |
char * |
, |
|
|
char * |
|
|
) |
| |
pid_t nasl_server_start |
( |
char * |
, |
|
|
char * |
|
|
) |
| |
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
-
filename | Filename (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.