OpenVAS Scanner 23.23.1
exec.c File Reference
#include "exec.h"
#include "../misc/plugutils.h"
#include "lint.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 <errno.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.

Functions

int naslparse (naslctxt *, int *)
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.
int exec_nasl_script (struct script_infos *script_infos, int mode)
 Execute a NASL script.

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()

tree_cell * bool2cell ( long int x)
static

◆ cell2atom()

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

◆ cell2bool()

int cell2bool ( lex_ctxt * lexic,
tree_cell * c )
static

◆ cell2int()

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

◆ cell2int3()

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

◆ cell2intW()

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

◆ cell2str()

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()

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

◆ int2cell()

tree_cell * int2cell ( long int x)
static

◆ nasl_dump_expr()

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_short_dump()

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

◆ naslparse()

int naslparse ( naslctxt * ,
int *  )
extern

Variable Documentation

◆ nasl_trace_fp

FILE* nasl_trace_fp = NULL

◆ truc

lex_ctxt* truc = NULL