OpenVAS Scanner  21.4.1
Macros | Functions | Variables
nasl_cmd_exec.c File Reference

This file contains all the "unsafe" functions found in NASL. More...

#include "nasl_cmd_exec.h"
#include "../misc/plugutils.h"
#include "nasl_debug.h"
#include "nasl_func.h"
#include "nasl_global_ctxt.h"
#include "nasl_lex_ctxt.h"
#include "nasl_tree.h"
#include "nasl_var.h"
#include <errno.h>
#include <fcntl.h>
#include <glib.h>
#include <gvm/base/drop_privileges.h>
#include <gvm/base/prefs.h>
#include <signal.h>
#include <string.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>

Macros

#define MAXPATHLEN   4096
 

Functions

static char * pread_streams (int fdout, int fderr)
 
tree_cellnasl_pread (lex_ctxt *lexic)
 Spawn a process. More...
 
tree_cellnasl_find_in_path (lex_ctxt *lexic)
 
tree_cellnasl_fread (lex_ctxt *lexic)
 Read file. More...
 
tree_cellnasl_unlink (lex_ctxt *lexic)
 Unlink file. More...
 
tree_cellnasl_fwrite (lex_ctxt *lexic)
 Write file. More...
 
tree_cellnasl_get_tmp_dir (lex_ctxt *lexic)
 
tree_cellnasl_file_stat (lex_ctxt *lexic)
 Stat file. More...
 
tree_cellnasl_file_open (lex_ctxt *lexic)
 Open file. More...
 
tree_cellnasl_file_close (lex_ctxt *lexic)
 Close file. More...
 
tree_cellnasl_file_read (lex_ctxt *lexic)
 Read file. More...
 
tree_cellnasl_file_write (lex_ctxt *lexic)
 Write file. More...
 
tree_cellnasl_file_seek (lex_ctxt *lexic)
 Seek in file. More...
 

Variables

static pid_t pid = 0
 

Detailed Description

This file contains all the "unsafe" functions found in NASL.

Macro Definition Documentation

◆ MAXPATHLEN

#define MAXPATHLEN   4096

Function Documentation

◆ nasl_file_close()

tree_cell* nasl_file_close ( lex_ctxt lexic)

Close file.

◆ nasl_file_open()

tree_cell* nasl_file_open ( lex_ctxt lexic)

Open file.

◆ nasl_file_read()

tree_cell* nasl_file_read ( lex_ctxt lexic)

Read file.

◆ nasl_file_seek()

tree_cell* nasl_file_seek ( lex_ctxt lexic)

Seek in file.

◆ nasl_file_stat()

tree_cell* nasl_file_stat ( lex_ctxt lexic)

Stat file.

◆ nasl_file_write()

tree_cell* nasl_file_write ( lex_ctxt lexic)

Write file.

◆ nasl_find_in_path()

tree_cell* nasl_find_in_path ( lex_ctxt lexic)

◆ nasl_fread()

tree_cell* nasl_fread ( lex_ctxt lexic)

Read file.

◆ nasl_fwrite()

tree_cell* nasl_fwrite ( lex_ctxt lexic)

Write file.

◆ nasl_get_tmp_dir()

tree_cell* nasl_get_tmp_dir ( lex_ctxt lexic)

◆ nasl_pread()

tree_cell* nasl_pread ( lex_ctxt lexic)

Spawn a process.

Todo:
Suspects to glib replacements, all path related stuff.
Parameters
[in]lexicLexical context of NASL interpreter.
[in]cmdCommand to run.
[in]argvList of arguments.
[in]cdIf set to TRUE the scanner will change it's current directory to the directory where the command was found.
[in]drop_privileges_userOwner of the spawned process.
Returns
The content of stderr or stdout written by the spawn process or NULL.

◆ nasl_unlink()

tree_cell* nasl_unlink ( lex_ctxt lexic)

Unlink file.

◆ pread_streams()

static char* pread_streams ( int  fdout,
int  fderr 
)
static

Variable Documentation

◆ pid

pid_t pid = 0
static