OpenVAS Scanner 21.4.1
Macros | Functions | Variables
exec.c File Reference
#include "exec.h"
#include "../misc/plugutils.h"
#include "nasl.h"
#include "nasl_debug.h"
#include "nasl_func.h"
#include "nasl_global_ctxt.h"
#include "nasl_init.h"
#include "nasl_lex_ctxt.h"
#include "nasl_tree.h"
#include "nasl_var.h"
#include <glib.h>
#include <glib/gstdio.h>
#include <gvm/base/logging.h>
#include <gvm/base/prefs.h>
#include <gvm/util/nvticache.h>
#include <regex.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

Macros

#define _GNU_SOURCE
 
#define G_LOG_DOMAIN   "lib nasl"
 GLib logging domain. More...
 

Functions

int naslparse (naslctxt *)
 
static int cell2bool (lex_ctxt *lexic, tree_cell *c)
 
static long int cell2int3 (lex_ctxt *lexic, tree_cell *c, int warn, named_nasl_var *v)
 
static long int cell2int (lex_ctxt *lexic, tree_cell *c)
 
static long int cell2intW (lex_ctxt *lexic, tree_cell *c)
 
static tree_cellint2cell (long int x)
 
static tree_cellbool2cell (long int x)
 
static char * cell2str (lex_ctxt *lexic, tree_cell *c)
 
tree_cellcell2atom (lex_ctxt *lexic, tree_cell *c1)
 
long int cell_cmp (lex_ctxt *lexic, tree_cell *c1, tree_cell *c2)
 
static void nasl_dump_expr (FILE *fp, const tree_cell *c)
 
static void nasl_short_dump (FILE *fp, const tree_cell *c)
 
static long int expo (long int x, long int y)
 
tree_cellnasl_exec (lex_ctxt *lexic, tree_cell *st)
 Execute a parse tree. More...
 
tree_cellnasl_lint (lex_ctxt *, tree_cell *)
 Search for errors in a nasl script. More...
 
int exec_nasl_script (struct script_infos *script_infos, int mode)
 Execute a NASL script. More...
 

Variables

FILE * nasl_trace_fp = NULL
 
lex_ctxttruc = NULL
 

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "lib nasl"

GLib logging domain.

Function Documentation

◆ bool2cell()

static tree_cell * bool2cell ( long int  x)
static

◆ cell2atom()

tree_cell * cell2atom ( lex_ctxt lexic,
tree_cell c1 
)
Returns
A 'referenced' cell.

◆ cell2bool()

static int cell2bool ( lex_ctxt lexic,
tree_cell c 
)
static

◆ cell2int()

static long int cell2int ( lex_ctxt lexic,
tree_cell c 
)
static

◆ cell2int3()

static long int cell2int3 ( lex_ctxt lexic,
tree_cell c,
int  warn,
named_nasl_var v 
)
static

◆ cell2intW()

static long int cell2intW ( lex_ctxt lexic,
tree_cell c 
)
static

◆ cell2str()

static char * cell2str ( lex_ctxt lexic,
tree_cell c 
)
static

◆ cell_cmp()

long int cell_cmp ( lex_ctxt lexic,
tree_cell c1,
tree_cell c2 
)

◆ exec_nasl_script()

int exec_nasl_script ( struct script_infos script_infos,
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 script_infos. #param mode Flags for different execution modes (Description, parse-only, always-signed, command-line, lint)
Returns
0 if the script was executed successfully, negative values if an error occurred. Return number of errors if mode is NASL_LINT and no none linting errors occurred.

◆ expo()

static long int expo ( long int  x,
long int  y 
)
static
Todo:
This is an algorithm for calculating x^y, replace it if possible.

◆ int2cell()

static tree_cell * int2cell ( long int  x)
static

◆ nasl_dump_expr()

static void nasl_dump_expr ( FILE *  fp,
const tree_cell c 
)
static
Todo:
Refactor, remove upcoming code duplicates.

◆ nasl_exec()

tree_cell * nasl_exec ( lex_ctxt lexic,
tree_cell st 
)

Execute a parse tree.

Todo:
There is a lot of duplicated code in following cases, could be refactored.

◆ nasl_lint()

tree_cell * nasl_lint ( lex_ctxt lexic,
tree_cell st 
)

Search for errors in a nasl script.

Parameters
[in]lexicnasl context.
[in]ststructure tree of a nasl script.
Returns
FAKE_CELL if no error was found, otherwise NULL or tree_cell which has number of errors as x.i_val.

◆ nasl_short_dump()

static void nasl_short_dump ( FILE *  fp,
const tree_cell c 
)
static

◆ naslparse()

int naslparse ( naslctxt )

Variable Documentation

◆ nasl_trace_fp

FILE* nasl_trace_fp = NULL

◆ truc

lex_ctxt* truc = NULL