OpenVAS Scanner  6.0.0~git
Macros | Functions
ntp.c File Reference

OpenVAS Transfer Protocol handling. More...

#include "ntp.h"
#include "../misc/network.h"
#include "comm.h"
#include "hosts.h"
#include "otp.h"
#include "utils.h"
#include <glib.h>
#include <gvm/base/prefs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Macros

#define MIN(x, y)   ((x) < (y) ? (x) : (y))
 
#define G_LOG_DOMAIN   "sd main"
 GLib log domain. More...
 

Functions

static int ntp_read_prefs (int soc)
 Reads in "server" prefs sent by client. More...
 
static int ntp_long_attack (int)
 
static int ntp_recv_file (struct scan_globals *globals)
 Receive a file sent by the client. More...
 
int ntp_parse_input (struct scan_globals *globals, char *input)
 Parses the input sent by the client before the NEW_ATTACK message. More...
 
static void files_add_translation (struct scan_globals *globals, const char *remotename, char *contents)
 Adds a 'translation' entry for a file sent by the client. More...
 
static void files_add_size_translation (struct scan_globals *globals, const char *remotename, const long filesize)
 Adds a 'content size' entry for a file sent by the client. More...
 
static int __ntp_timestamp_scan (int soc, char *msg)
 
static int __ntp_timestamp_scan_host (int soc, kb_t kb, char *msg, char *host)
 
int ntp_timestamp_scan_starts (int soc)
 
int ntp_timestamp_scan_ends (int soc)
 
int ntp_timestamp_host_scan_starts (int soc, kb_t kb, char *host)
 
int ntp_timestamp_host_scan_ends (int soc, kb_t kb, char *host)
 

Detailed Description

OpenVAS Transfer Protocol handling.

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "sd main"

GLib log domain.

◆ MIN

#define MIN (   x,
 
)    ((x) < (y) ? (x) : (y))

Function Documentation

◆ __ntp_timestamp_scan()

static int __ntp_timestamp_scan ( int  soc,
char *  msg 
)
static

◆ __ntp_timestamp_scan_host()

static int __ntp_timestamp_scan_host ( int  soc,
kb_t  kb,
char *  msg,
char *  host 
)
static

◆ files_add_size_translation()

static void files_add_size_translation ( struct scan_globals globals,
const char *  remotename,
const long  filesize 
)
static

Adds a 'content size' entry for a file sent by the client.

Files sent by the client are stored in memory on the server side. Because they may be binary we need to store the size of the uploaded file as well. This function sets up a mapping from the original name sent by the client to the file size.

Parameters
globalsGlobal struct.
remotenameName of the file as referenced by the client.
filesizeSize of the file in bytes.

◆ files_add_translation()

static void files_add_translation ( struct scan_globals globals,
const char *  remotename,
char *  contents 
)
static

Adds a 'translation' entry for a file sent by the client.

Files sent by the client are stored in memory on the server side. In order to access these files, their original name ('local' to the client) can be 'translated' into the file contents of the in-memory copy of the file on the server side.

Parameters
globalsGlobal struct.
remotenameName of the file as referenced by the client.
contentsContents of the file.

◆ ntp_long_attack()

static int ntp_long_attack ( int  soc)
static

◆ ntp_parse_input()

int ntp_parse_input ( struct scan_globals globals,
char *  input 
)

Parses the input sent by the client before the NEW_ATTACK message.

◆ ntp_read_prefs()

static int ntp_read_prefs ( int  soc)
static

Reads in "server" prefs sent by client.

Parameters
socSocket to read from.
Returns
Always 0.

◆ ntp_recv_file()

int ntp_recv_file ( struct scan_globals globals)
static

Receive a file sent by the client.

Returns
0 if successful, -1 in case of errors.

◆ ntp_timestamp_host_scan_ends()

int ntp_timestamp_host_scan_ends ( int  soc,
kb_t  kb,
char *  host 
)

◆ ntp_timestamp_host_scan_starts()

int ntp_timestamp_host_scan_starts ( int  soc,
kb_t  kb,
char *  host 
)

◆ ntp_timestamp_scan_ends()

int ntp_timestamp_scan_ends ( int  soc)

◆ ntp_timestamp_scan_starts()

int ntp_timestamp_scan_starts ( int  soc)