OpenVAS Scanner
7.0.1~git
|
Network Functions. More...
#include "../nasl/nasl_debug.h"
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <glib.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include <gvm/base/logging.h>
#include <gvm/base/networking.h>
#include <gvm/base/prefs.h>
#include <gvm/util/kb.h>
#include <gvm/util/serverutils.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include "network.h"
#include "plugutils.h"
#include "support.h"
Go to the source code of this file.
Data Structures | |
struct | openvas_connection |
struct | csc_hook_s |
Object to store a list of hooks for close_stream_connection. More... | |
Macros | |
#define | TIMEOUT 20 |
#define | INADDR_NONE 0xffffffff |
#define | G_LOG_DOMAIN "lib misc" |
GLib logging domain. More... | |
#define | OPENVAS_FD_MAX 1024 |
#define | OPENVAS_FD_OFF 1000000 |
#define | OPENVAS_STREAM(x) (((x - OPENVAS_FD_OFF) < OPENVAS_FD_MAX) && ((x - OPENVAS_FD_OFF) >= 0)) |
#define | OVAS_CONNECTION_FROM_FD(fd) (connections + ((fd) -OPENVAS_FD_OFF)) |
#define | INCR_TIMEOUT 1 |
Functions | |
static int | pid_perror (const char *error) |
int | stream_get_err (int fd) |
static int | get_connection_fd (void) |
Returns a free file descriptor. More... | |
static int | release_connection_fd (int fd, int already_closed) |
int | openvas_register_connection (int soc, void *ssl, gnutls_certificate_credentials_t certcred, openvas_encaps_t encaps) |
int | openvas_deregister_connection (int fd) |
static int | unblock_socket (int soc) |
static int | block_socket (int soc) |
void | tlserror (char *txt, int err) |
static void | log_message_gnutls (int level, const char *msg) |
int | openvas_SSL_init () |
Initializes SSL support. More... | |
int | openvas_get_socket_from_connection (int fd) |
gnutls_session_t | ovas_get_tlssession_from_connection (int fd) |
static int | set_gnutls_protocol (gnutls_session_t session, openvas_encaps_t encaps, const char *priority) |
static int | load_cert_and_key (gnutls_certificate_credentials_t xcred, const char *cert, const char *key, const char *passwd) |
Loads a certificate and the corresponding private key from PEM files. More... | |
static int | is_ip_address (const char *str) |
static int | open_SSL_connection (openvas_connection *fp, const char *cert, const char *key, const char *passwd, const char *cafile, const char *hostname) |
int | socket_negotiate_ssl (int fd, openvas_encaps_t transport, struct script_infos *args) |
void | socket_get_cert (int fd, void **cert, int *certlen) |
int | socket_get_ssl_version (int fd) |
void | socket_get_ssl_session_id (int fd, void **sid, size_t *ssize) |
int | socket_get_ssl_ciphersuite (int fd) |
int | open_stream_connection_ext (struct script_infos *args, unsigned int port, int transport, int timeout, const char *priority) |
int | open_stream_connection (struct script_infos *args, unsigned int port, int transport, int timeout) |
int | open_stream_auto_encaps_ext (struct script_infos *args, unsigned int port, int timeout, int force) |
int | stream_set_timeout (int fd, int timeout) |
static int | read_stream_connection_unbuffered (int fd, void *buf0, int min_len, int max_len) |
int | read_stream_connection_min (int fd, void *buf0, int min_len, int max_len) |
int | read_stream_connection (int fd, void *buf0, int len) |
static int | write_stream_connection4 (int fd, void *buf0, int n, int i_opt) |
int | write_stream_connection (int fd, void *buf0, int n) |
int | nsend (int fd, void *data, int length, int i_opt) |
int | nrecv (int fd, void *data, int length, int i_opt) |
void | add_close_stream_connection_hook (int(*fnc)(int fd)) |
Register a hook function for close_stream_connection. More... | |
static int | run_csc_hooks (int fd) |
Run the hooks for close_stream_connection. More... | |
int | close_stream_connection (int fd) |
const char * | get_encaps_name (openvas_encaps_t code) |
const char * | get_encaps_through (openvas_encaps_t code) |
static int | open_socket (struct sockaddr *paddr, int type, int protocol, int timeout, int len) |
int | open_sock_opt_hn (const char *hostname, unsigned int port, int type, int protocol, int timeout) |
int | open_sock_tcp (struct script_infos *args, unsigned int port, int timeout) |
int | open_sock_option (struct script_infos *args, unsigned int port, int type, int protocol, int timeout) |
int | recv_line (int soc, char *buf, size_t bufsiz) |
Reads a text from the socket stream into the argument buffer, always. More... | |
int | socket_close (int soc) |
int | fd_is_stream (int fd) |
int | stream_get_buffer_sz (int fd) |
int | stream_set_buffer (int fd, int sz) |
int | os_send (int soc, void *buf, int len, int opt) |
int | os_recv (int soc, void *buf, int len, int opt) |
int | get_sock_infos (int sock, int *r_transport, void **r_tls_session) |
static int | qsort_compar (const void *a, const void *b) |
unsigned short * | getpts (char *origexpr, int *len) |
Converts a string like "-100,200-1024,3000-4000,60000-" into an array. More... | |
Variables | |
static openvas_connection | connections [OPENVAS_FD_MAX] |
static struct csc_hook_s * | csc_hooks |
Linked list of hooks to be run by close_stream_connection. More... | |
static int | __port_closed |
Network Functions.
Definition in file network.c.
#define INCR_TIMEOUT 1 |
Referenced by read_stream_connection_unbuffered().
#define OPENVAS_FD_MAX 1024 |
The role of this offset is:
Definition at line 104 of file network.c.
Referenced by get_connection_fd().
#define OPENVAS_FD_OFF 1000000 |
Definition at line 105 of file network.c.
Referenced by get_connection_fd(), get_sock_infos(), nrecv(), nsend(), openvas_deregister_connection(), openvas_get_socket_from_connection(), and ovas_get_tlssession_from_connection().
#define OPENVAS_STREAM | ( | x | ) | (((x - OPENVAS_FD_OFF) < OPENVAS_FD_MAX) && ((x - OPENVAS_FD_OFF) >= 0)) |
OPENVAS_STREAM(x) is TRUE if <x> is a OpenVAS-ified fd
Definition at line 126 of file network.c.
Referenced by close_stream_connection(), fd_is_stream(), get_sock_infos(), nrecv(), nsend(), openvas_deregister_connection(), openvas_get_socket_from_connection(), ovas_get_tlssession_from_connection(), read_stream_connection_min(), read_stream_connection_unbuffered(), recv_line(), release_connection_fd(), stream_get_buffer_sz(), stream_get_err(), stream_set_buffer(), stream_set_timeout(), and write_stream_connection4().
#define OVAS_CONNECTION_FROM_FD | ( | fd | ) | (connections + ((fd) -OPENVAS_FD_OFF)) |
determine the openvas_connection* from the openvas fd
Definition at line 132 of file network.c.
Referenced by close_stream_connection(), open_stream_connection_ext(), openvas_register_connection(), read_stream_connection_min(), read_stream_connection_unbuffered(), release_connection_fd(), socket_negotiate_ssl(), stream_get_buffer_sz(), stream_get_err(), stream_set_buffer(), stream_set_timeout(), and write_stream_connection4().
#define TIMEOUT 20 |
Definition at line 58 of file network.c.
Referenced by open_socket(), open_stream_connection_ext(), openvas_register_connection(), read_stream_connection_unbuffered(), and write_stream_connection4().
void add_close_stream_connection_hook | ( | int(*)(int fd) | fnc | ) |
Register a hook function for close_stream_connection.
The function adds the given hook function to the list of hooks to be run by close_stream_connection. These hooks are intended to test whether they need to close the stream them self. See argument to the hook function is the file descriptor of the stream. The hook shall return 0 if it has taken over control of that file descriptor. The same function is only aded once to the list of hooks.
fnc | The hook function. See above for details. |
Definition at line 1479 of file network.c.
References csc_hooks, csc_hook_s::fnc, and csc_hook_s::next.
Referenced by next_session_id().
|
static |
Definition at line 313 of file network.c.
References pid_perror().
Referenced by nrecv(), nsend(), and open_socket().
int close_stream_connection | ( | int | fd | ) |
Definition at line 1518 of file network.c.
References OPENVAS_STREAM, OVAS_CONNECTION_FROM_FD, openvas_connection::port, release_connection_fd(), run_csc_hooks(), and socket_close().
Referenced by nasl_close_socket(), nasl_end_denial(), nasl_start_denial(), and plugin_do_run().
int fd_is_stream | ( | int | fd | ) |
Definition at line 1959 of file network.c.
References OPENVAS_STREAM.
Referenced by nasl_close_socket(), nasl_get_source_port(), nasl_recv(), nasl_recv_line(), nasl_send(), nasl_socket_get_error(), socket_get_cert(), socket_get_ssl_ciphersuite(), socket_get_ssl_session_id(), socket_get_ssl_version(), and socket_negotiate_ssl().
|
static |
Returns a free file descriptor.
Definition at line 163 of file network.c.
References connections, OPENVAS_FD_MAX, OPENVAS_FD_OFF, openvas_connection::pid, and pid.
Referenced by open_stream_connection_ext(), and openvas_register_connection().
const char* get_encaps_name | ( | openvas_encaps_t | code | ) |
Definition at line 1546 of file network.c.
References code, OPENVAS_ENCAPS_AUTO, OPENVAS_ENCAPS_IP, OPENVAS_ENCAPS_SSLv2, OPENVAS_ENCAPS_SSLv23, OPENVAS_ENCAPS_SSLv3, OPENVAS_ENCAPS_TLScustom, OPENVAS_ENCAPS_TLSv1, OPENVAS_ENCAPS_TLSv11, and OPENVAS_ENCAPS_TLSv12.
Referenced by get_port_transport(), nasl_get_sock_info(), and plugin_do_run().
const char* get_encaps_through | ( | openvas_encaps_t | code | ) |
Definition at line 1577 of file network.c.
References code, OPENVAS_ENCAPS_IP, OPENVAS_ENCAPS_SSLv2, OPENVAS_ENCAPS_SSLv23, OPENVAS_ENCAPS_SSLv3, OPENVAS_ENCAPS_TLScustom, OPENVAS_ENCAPS_TLSv1, OPENVAS_ENCAPS_TLSv11, and OPENVAS_ENCAPS_TLSv12.
Referenced by mark_acap_server(), mark_adsgone(), mark_avotus_mm_server(), mark_BitTorrent_server(), mark_citrix_server(), mark_dameware_server(), mark_dictd_server(), mark_direct_connect_hub(), mark_eggdrop_server(), mark_ens_server(), mark_exchg_routing_server(), mark_finger_server(), mark_fssniffer(), mark_ftp_server(), mark_fw1(), mark_giop_server(), mark_gnocatan_server(), mark_gnome14_server(), mark_http_proxy(), mark_http_server(), mark_imap_server(), mark_interscan_viruswall(), mark_ircxpro_admin_server(), mark_jabber_server(), mark_LISa_server(), mark_listserv_server(), mark_locked_adsubtract_server(), mark_lpd_server(), mark_lyskom_server(), mark_mon_server(), mark_nagiosd_server(), mark_nntp_server(), mark_ofa_express_server(), mark_pblocald_server(), mark_pbmaster_server(), mark_ph_server(), mark_pnsclient(), mark_pop3pw_server(), mark_ppp_daemon(), mark_psybnc(), mark_quicktime_streaming_server(), mark_remote_nc_server(), mark_rmserver(), mark_shoutcast_server(), mark_smppd_server(), mark_smtp_server(), mark_smux_server(), mark_snpp_server(), mark_spamd_server(), mark_stonegate_auth_server(), mark_sub7_server(), mark_tcpmux_server(), mark_teamspeak2_server(), mark_telnet_server(), mark_time_server(), mark_unknown_svc(), mark_upsmon_server(), mark_uucp_server(), mark_veritas_backup(), mark_vmware_auth(), mark_vtun_server(), mark_websm_server(), mark_whois_plus2_server(), and mark_zebra_server().
int get_sock_infos | ( | int | sock, |
int * | r_transport, | ||
void ** | r_tls_session | ||
) |
Definition at line 2063 of file network.c.
References connections, OPENVAS_FD_OFF, OPENVAS_STREAM, openvas_connection::tls_session, and openvas_connection::transport.
Referenced by nasl_get_sock_info(), and nasl_socket_cert_verify().
unsigned short* getpts | ( | char * | origexpr, |
int * | len | ||
) |
Converts a string like "-100,200-1024,3000-4000,60000-" into an array.
of port numbers
This function is (c) Fyodor fyodo and was taken from his excellent and outstanding scanner Nmap See r@dh p.comhttp://www.insecure.org/nmap/ for details about Nmap
Definition at line 2103 of file network.c.
References qsort_compar().
Referenced by nasl_scanner_get_port(), and scan().
|
static |
Definition at line 549 of file network.c.
Referenced by open_SSL_connection().
|
static |
Loads a certificate and the corresponding private key from PEM files.
The private key may be encrypted, in which case the password to decrypt the key should be given as the passwd parameter.
Definition at line 457 of file network.c.
References tlserror().
Referenced by open_SSL_connection().
|
static |
Definition at line 342 of file network.c.
Referenced by openvas_SSL_init().
int nrecv | ( | int | fd, |
void * | data, | ||
int | length, | ||
int | i_opt | ||
) |
Definition at line 1441 of file network.c.
References block_socket(), connections, OPENVAS_FD_OFF, OPENVAS_STREAM, and read_stream_connection().
int nsend | ( | int | fd, |
void * | data, | ||
int | length, | ||
int | i_opt | ||
) |
Definition at line 1402 of file network.c.
References block_socket(), connections, OPENVAS_FD_OFF, OPENVAS_STREAM, os_send(), timeval(), and write_stream_connection4().
Referenced by nasl_end_denial(), and nasl_send().
int open_sock_opt_hn | ( | const char * | hostname, |
unsigned int | port, | ||
int | type, | ||
int | protocol, | ||
int | timeout | ||
) |
Definition at line 1700 of file network.c.
References hostname, and open_socket().
Referenced by nasl_open_sock_kdc().
int open_sock_option | ( | struct script_infos * | args, |
unsigned int | port, | ||
int | type, | ||
int | protocol, | ||
int | timeout | ||
) |
Definition at line 1802 of file network.c.
References open_socket(), and plug_get_host_ip().
Referenced by open_sock_tcp().
int open_sock_tcp | ( | struct script_infos * | args, |
unsigned int | port, | ||
int | timeout | ||
) |
Definition at line 1729 of file network.c.
References host_get_port_state(), script_infos::ip, script_infos::key, open_sock_option(), plug_current_vhost(), plug_get_host_ip_str(), and plug_get_kb().
Referenced by open_stream_connection_ext().
|
static |
Definition at line 1601 of file network.c.
References __port_closed, block_socket(), pid_perror(), socket_close(), TIMEOUT, timeval(), and unblock_socket().
Referenced by open_sock_opt_hn(), and open_sock_option().
|
static |
Definition at line 561 of file network.c.
References openvas_connection::fd, hostname, is_ip_address(), openvas_connection::last_err, load_cert_and_key(), pid_perror(), openvas_connection::priority, set_gnutls_protocol(), openvas_connection::timeout, timeval(), openvas_connection::tls_cred, openvas_connection::tls_session, tlserror(), openvas_connection::transport, and unblock_socket().
Referenced by open_stream_connection_ext(), and socket_negotiate_ssl().
int open_stream_auto_encaps_ext | ( | struct script_infos * | args, |
unsigned int | port, | ||
int | timeout, | ||
int | force | ||
) |
Definition at line 1002 of file network.c.
References open_stream_connection(), OPENVAS_ENCAPS_IP, OPENVAS_ENCAPS_TLScustom, plug_get_port_transport(), and plug_set_port_transport().
Referenced by nasl_open_sock_tcp_bufsz().
int open_stream_connection | ( | struct script_infos * | args, |
unsigned int | port, | ||
int | transport, | ||
int | timeout | ||
) |
Definition at line 992 of file network.c.
References open_stream_connection_ext().
Referenced by nasl_end_denial(), nasl_start_denial(), open_stream_auto_encaps_ext(), and plugin_do_run().
int open_stream_connection_ext | ( | struct script_infos * | args, |
unsigned int | port, | ||
int | transport, | ||
int | timeout, | ||
const char * | priority | ||
) |
Definition at line 886 of file network.c.
References openvas_connection::fd, get_connection_fd(), hostname, openvas_connection::last_err, script_infos::name, open_sock_tcp(), open_SSL_connection(), OPENVAS_ENCAPS_IP, OPENVAS_ENCAPS_SSLv2, OPENVAS_ENCAPS_SSLv23, OPENVAS_ENCAPS_SSLv3, OPENVAS_ENCAPS_TLScustom, OPENVAS_ENCAPS_TLSv1, OPENVAS_ENCAPS_TLSv11, OPENVAS_ENCAPS_TLSv12, OVAS_CONNECTION_FROM_FD, plug_get_host_fqdn(), plug_get_kb(), openvas_connection::port, openvas_connection::priority, release_connection_fd(), TIMEOUT, openvas_connection::timeout, and openvas_connection::transport.
Referenced by nasl_open_sock_tcp_bufsz(), and open_stream_connection().
int openvas_deregister_connection | ( | int | fd | ) |
Definition at line 269 of file network.c.
References connections, OPENVAS_FD_OFF, OPENVAS_STREAM, openvas_connection::priority, and openvas_connection::transport.
int openvas_get_socket_from_connection | ( | int | fd | ) |
Definition at line 367 of file network.c.
References connections, openvas_connection::fd, OPENVAS_FD_OFF, OPENVAS_STREAM, and openvas_connection::transport.
Referenced by nasl_get_source_port(), nasl_ssh_connect(), and plugin_do_run().
int openvas_register_connection | ( | int | soc, |
void * | ssl, | ||
gnutls_certificate_credentials_t | certcred, | ||
openvas_encaps_t | encaps | ||
) |
soc | Socket to use. |
Definition at line 244 of file network.c.
References openvas_connection::fd, get_connection_fd(), openvas_connection::last_err, OVAS_CONNECTION_FROM_FD, openvas_connection::port, openvas_connection::priority, TIMEOUT, openvas_connection::timeout, openvas_connection::tls_cred, openvas_connection::tls_session, and openvas_connection::transport.
Referenced by nasl_open_privileged_socket().
int openvas_SSL_init | ( | void | ) |
Initializes SSL support.
Definition at line 351 of file network.c.
References log_message_gnutls(), and tlserror().
Referenced by main(), openvas(), and start_single_task_scan().
int os_recv | ( | int | soc, |
void * | buf, | ||
int | len, | ||
int | opt | ||
) |
int os_send | ( | int | soc, |
void * | buf, | ||
int | len, | ||
int | opt | ||
) |
gnutls_session_t ovas_get_tlssession_from_connection | ( | int | fd | ) |
Definition at line 387 of file network.c.
References connections, OPENVAS_FD_OFF, OPENVAS_STREAM, and openvas_connection::tls_session.
Referenced by socket_get_cert(), socket_get_ssl_ciphersuite(), socket_get_ssl_session_id(), and socket_get_ssl_version().
|
static |
Same as perror(), but prefixes the data by our pid.
Definition at line 138 of file network.c.
Referenced by block_socket(), open_socket(), open_SSL_connection(), read_stream_connection_unbuffered(), release_connection_fd(), unblock_socket(), and write_stream_connection4().
|
static |
int read_stream_connection | ( | int | fd, |
void * | buf0, | ||
int | len | ||
) |
Definition at line 1272 of file network.c.
References read_stream_connection_min().
Referenced by nasl_telnet_init(), nrecv(), and plugin_do_run().
int read_stream_connection_min | ( | int | fd, |
void * | buf0, | ||
int | min_len, | ||
int | max_len | ||
) |
Definition at line 1212 of file network.c.
References openvas_connection::buf, openvas_connection::bufcnt, openvas_connection::bufptr, openvas_connection::bufsz, OPENVAS_STREAM, OVAS_CONNECTION_FROM_FD, and read_stream_connection_unbuffered().
Referenced by nasl_recv(), nasl_recv_line(), nasl_telnet_init(), plugin_do_run(), read_stream_connection(), and recv_line().
|
static |
Definition at line 1049 of file network.c.
References openvas_connection::fd, INCR_TIMEOUT, openvas_connection::last_err, nasl_get_function_name(), nasl_get_plugin_filename(), OPENVAS_ENCAPS_IP, OPENVAS_ENCAPS_SSLv2, OPENVAS_ENCAPS_SSLv23, OPENVAS_ENCAPS_SSLv3, OPENVAS_ENCAPS_TLScustom, OPENVAS_ENCAPS_TLSv1, OPENVAS_ENCAPS_TLSv11, OPENVAS_ENCAPS_TLSv12, OPENVAS_STREAM, OVAS_CONNECTION_FROM_FD, openvas_connection::pid, pid_perror(), TIMEOUT, openvas_connection::timeout, timeval(), openvas_connection::tls_session, and openvas_connection::transport.
Referenced by read_stream_connection_min().
int recv_line | ( | int | soc, |
char * | buf, | ||
size_t | bufsiz | ||
) |
Reads a text from the socket stream into the argument buffer, always.
appending a '\0' byte.
buf | Buffer to read into. |
Definition at line 1846 of file network.c.
References OPENVAS_STREAM, and read_stream_connection_min().
Referenced by ftp_get_pasv_address(), and ftp_log_in().
|
static |
Definition at line 183 of file network.c.
References openvas_connection::buf, openvas_connection::fd, OPENVAS_STREAM, OVAS_CONNECTION_FROM_FD, openvas_connection::pid, pid_perror(), openvas_connection::priority, socket_close(), openvas_connection::tls_cred, openvas_connection::tls_session, and openvas_connection::transport.
Referenced by close_stream_connection(), open_stream_connection_ext(), and socket_negotiate_ssl().
|
static |
Run the hooks for close_stream_connection.
The function runs all registered hooks until the first hook returns with zero to indicate that it has taken over control of the socket. Further hooks are then not anymore run because the file descriptor is not anymore valid.
fd | The file descriptor of the stream. |
Definition at line 1507 of file network.c.
References csc_hooks, csc_hook_s::fnc, and csc_hook_s::next.
Referenced by close_stream_connection().
|
static |
Sets the priorities for the GnuTLS session according to encaps. PRIORITY is used to convey custom priorities; it is only used if ENCAPS is set to OPENVAS_ENCAPS_TLScustom.
Definition at line 404 of file network.c.
References OPENVAS_ENCAPS_SSLv23, OPENVAS_ENCAPS_SSLv3, OPENVAS_ENCAPS_TLScustom, OPENVAS_ENCAPS_TLSv1, OPENVAS_ENCAPS_TLSv11, and OPENVAS_ENCAPS_TLSv12.
Referenced by open_SSL_connection().
int socket_close | ( | int | soc | ) |
Definition at line 1949 of file network.c.
Referenced by close_stream_connection(), open_socket(), and release_connection_fd().
void socket_get_cert | ( | int | fd, |
void ** | cert, | ||
int * | certlen | ||
) |
Definition at line 730 of file network.c.
References fd_is_stream(), and ovas_get_tlssession_from_connection().
Referenced by nasl_socket_get_cert().
int socket_get_ssl_ciphersuite | ( | int | fd | ) |
Definition at line 847 of file network.c.
References fd_is_stream(), and ovas_get_tlssession_from_connection().
Referenced by nasl_socket_get_ssl_ciphersuite().
void socket_get_ssl_session_id | ( | int | fd, |
void ** | sid, | ||
size_t * | ssize | ||
) |
Definition at line 807 of file network.c.
References fd_is_stream(), ovas_get_tlssession_from_connection(), and tlserror().
Referenced by nasl_socket_get_ssl_session_id().
int socket_get_ssl_version | ( | int | fd | ) |
Definition at line 766 of file network.c.
References fd_is_stream(), OPENVAS_ENCAPS_SSLv3, OPENVAS_ENCAPS_TLSv1, OPENVAS_ENCAPS_TLSv11, OPENVAS_ENCAPS_TLSv12, and ovas_get_tlssession_from_connection().
Referenced by nasl_socket_get_ssl_version().
int socket_negotiate_ssl | ( | int | fd, |
openvas_encaps_t | transport, | ||
struct script_infos * | args | ||
) |
Definition at line 683 of file network.c.
References fd_is_stream(), hostname, nasl_get_plugin_filename(), open_SSL_connection(), OVAS_CONNECTION_FROM_FD, plug_get_host_fqdn(), plug_get_kb(), openvas_connection::port, openvas_connection::priority, release_connection_fd(), and openvas_connection::transport.
Referenced by nasl_socket_negotiate_ssl().
int stream_get_buffer_sz | ( | int | fd | ) |
Definition at line 1965 of file network.c.
References openvas_connection::bufsz, OPENVAS_STREAM, and OVAS_CONNECTION_FROM_FD.
Referenced by nasl_recv_line().
int stream_get_err | ( | int | fd | ) |
Definition at line 145 of file network.c.
References openvas_connection::last_err, OPENVAS_STREAM, and OVAS_CONNECTION_FROM_FD.
Referenced by nasl_socket_get_error().
int stream_set_buffer | ( | int | fd, |
int | sz | ||
) |
Definition at line 1975 of file network.c.
References openvas_connection::buf, openvas_connection::bufcnt, openvas_connection::bufptr, openvas_connection::bufsz, OPENVAS_STREAM, and OVAS_CONNECTION_FROM_FD.
Referenced by nasl_open_sock_tcp_bufsz(), and nasl_recv_line().
int stream_set_timeout | ( | int | fd, |
int | timeout | ||
) |
Definition at line 1033 of file network.c.
References OPENVAS_STREAM, OVAS_CONNECTION_FROM_FD, and openvas_connection::timeout.
Referenced by nasl_recv(), and plugin_do_run().
void tlserror | ( | char * | txt, |
int | err | ||
) |
Definition at line 336 of file network.c.
Referenced by load_cert_and_key(), open_SSL_connection(), openvas_SSL_init(), and socket_get_ssl_session_id().
|
static |
Definition at line 296 of file network.c.
References pid_perror().
Referenced by open_socket(), and open_SSL_connection().
int write_stream_connection | ( | int | fd, |
void * | buf0, | ||
int | n | ||
) |
Definition at line 1396 of file network.c.
References write_stream_connection4().
Referenced by ftp_get_pasv_address(), ftp_log_in(), nasl_telnet_init(), and plugin_do_run().
|
static |
Definition at line 1278 of file network.c.
References openvas_connection::fd, openvas_connection::last_err, nasl_get_function_name(), nasl_get_plugin_filename(), OPENVAS_ENCAPS_IP, OPENVAS_ENCAPS_SSLv2, OPENVAS_ENCAPS_SSLv23, OPENVAS_ENCAPS_SSLv3, OPENVAS_ENCAPS_TLScustom, OPENVAS_ENCAPS_TLSv1, OPENVAS_ENCAPS_TLSv11, OPENVAS_ENCAPS_TLSv12, OPENVAS_STREAM, OVAS_CONNECTION_FROM_FD, pid_perror(), TIMEOUT, openvas_connection::timeout, timeval(), openvas_connection::tls_session, and openvas_connection::transport.
Referenced by nsend(), and write_stream_connection().
|
static |
Definition at line 293 of file network.c.
Referenced by open_socket().
|
static |
Definition at line 107 of file network.c.
Referenced by get_connection_fd(), get_sock_infos(), nrecv(), nsend(), openvas_deregister_connection(), openvas_get_socket_from_connection(), and ovas_get_tlssession_from_connection().
|
static |
Linked list of hooks to be run by close_stream_connection.
Definition at line 121 of file network.c.
Referenced by add_close_stream_connection_hook(), and run_csc_hooks().