Commit 5c94b692 authored by SZ Lin (林上智)'s avatar SZ Lin (林上智)

Update upstream source from tag 'upstream/9.0.3'

Update to upstream version '9.0.3'
with Debian dir 7c7437ceedc235791ec155df1a0d1a808a29e8d8
parents aad76f3e 56aeeaf7
......@@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: wiegandm/openvas-libraries-9.0-core-debian-jessie
- image: greenbone/build-env-gvm-libs-openvas-libraries-9.0-debian-jessie-gcc-core
steps:
- checkout
- run:
......
SUMMARY OF RELEASE CHANGES FOR OPENVAS-LIBRARIES 9.0
====================================================
For detailed code changes, please visit
https://github.com/greenbone/gvm-libs/commits/openvas-libraries-9.0
or get the entire source code repository and view log history:
$ git clone https://github.com/greenbone/gvm-libs.git
$ cd gvm-libs && git checkout openvas-libraries-9.0 && git log
openvas-libraries 9.0.3 (2018-08-29)
This is the third maintenance release of the openvas-libraries 9.0
module for the Open Vulnerability Assessment System 9 (OpenVAS-9).
Many thanks to everyone who contributed to this release:
Hani Benhabiles, Christian Fischer, Matt Mundell, Juan Jose Nicola,
Timo Pollmeier and Michael Wiegand.
Main changes compared to 9.0.2:
* Minimum required openvas-smb version to have WMI support has been raised
to 1.0.4.
* An issue related to a value inserted in nvticache has been addressed.
* Support to specify a regex-based mandatory key has been added.
* Nvticache cleanup has been improved.
* Handling of duplicate nvt warning has been improved.
* An issue related to the support for radcli library has been addressed.
openvas-libraries 9.0.2 (2018-03-07)
This is the second maintenance release of the openvas-libraries 9.0
......
......@@ -96,7 +96,7 @@ set (CPACK_PACKAGE_VERSION_MAJOR "9")
set (CPACK_PACKAGE_VERSION_MINOR "0")
# Use this scheme for stable releases:
set (CPACK_PACKAGE_VERSION_PATCH "2${SVN_REVISION}")
set (CPACK_PACKAGE_VERSION_PATCH "3${SVN_REVISION}")
set (CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
# Use this scheme for +betaN and +rcN releases:
#set (CPACK_PACKAGE_VERSION_PATCH "+beta1${SVN_REVISION}")
......@@ -190,8 +190,8 @@ message ("-- Install prefix: ${CMAKE_INSTALL_PREFIX}")
pkg_check_modules (GNUTLS REQUIRED gnutls>=3.2.15)
pkg_check_modules (GLIB REQUIRED glib-2.0>=2.32)
if (NOT OPENVAS_OMP_ONLY)
pkg_check_modules (OPENVAS_WMICLIENT libopenvas_wmiclient>=1.0.1)
pkg_check_modules (OPENVAS_WINCMD libopenvas_wincmd>=1.0.1)
pkg_check_modules (OPENVAS_WMICLIENT libopenvas_wmiclient>=1.0.4)
pkg_check_modules (OPENVAS_WINCMD libopenvas_wincmd>=1.0.4)
pkg_check_modules (LIBSSH REQUIRED libssh>=0.5.0)
message (STATUS "Looking for pcap...")
......@@ -258,6 +258,13 @@ if (NOT MINGW)
execute_process (COMMAND libgcrypt-config --cflags
OUTPUT_VARIABLE GCRYPT_CFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process (COMMAND libgcrypt-config --version
OUTPUT_VARIABLE GCRYPT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
message (STATUS " found libgcrypt, version ${GCRYPT_VERSION}")
if (GCRYPT_VERSION VERSION_LESS "1.6")
message (SEND_ERROR "libgcrypt 1.6 or greater is required")
endif (GCRYPT_VERSION VERSION_LESS "1.6")
endif (NOT GCRYPT)
endif (NOT MINGW)
......
......@@ -22,7 +22,7 @@ General build environment:
Specific development libraries:
* libglib >= 2.32
* libgnutls >= 3.2.15
* libgcrypt
* libgcrypt >= 1.6
* zlib
* libpcap
* libgpgme >= 1.1.2
......@@ -37,7 +37,7 @@ Prerequisites for building documentation:
* sqlfairy (optional, for producing database diagram)
Recommended to have WMI support:
* openvas-smb >= 1.0.1
* openvas-smb >= 1.0.4
Recommended to have improved SNMP support:
* netsnmp
......
......@@ -129,6 +129,7 @@ struct kb_operations
char *(*kb_get_nvt) (kb_t, const char *, enum kb_nvt_pos);
struct kb_item * (*kb_get_all) (kb_t, const char *);
struct kb_item * (*kb_get_pattern) (kb_t, const char *);
size_t (*kb_count) (kb_t, const char *);
int (*kb_add_str) (kb_t, const char *, const char *);
int (*kb_set_str) (kb_t, const char *, const char *);
int (*kb_add_int) (kb_t, const char *, int);
......@@ -318,6 +319,24 @@ kb_item_get_pattern (kb_t kb, const char *pattern)
return kb->kb_ops->kb_get_pattern (kb, pattern);
}
/**
* @brief Count all items stored under a given pattern.
*
* @param[in] kb KB handle where to count the items.
* @param[in] pattern '*' pattern of the elements to count.
*
* @return Count of items.
*/
static inline size_t
kb_item_count (kb_t kb, const char *pattern)
{
assert (kb);
assert (kb->kb_ops);
assert (kb->kb_ops->kb_count);
return kb->kb_ops->kb_count (kb, pattern);
}
/**
* @brief Insert (append) a new entry under a given name.
* @param[in] kb KB handle where to store the item.
......
......@@ -895,6 +895,30 @@ next:
return kbi;
}
static size_t
redis_count (kb_t kb, const char *pattern)
{
struct kb_redis *kbr;
redisReply *rep;
size_t count;
kbr = redis_kb (kb);
rep = redis_cmd (kbr, "KEYS %s", pattern);
if (rep == NULL)
return 0;
if (rep->type != REDIS_REPLY_ARRAY)
{
freeReplyObject (rep);
return 0;
}
count = rep->elements;
freeReplyObject (rep);
return count;
}
static int
redis_del_items (kb_t kb, const char *name)
{
......@@ -1044,7 +1068,7 @@ redis_add_nvt (kb_t kb, const nvti_t *nvt, const char *filename)
nvti_mandatory_keys (nvt) ?: "",
nvti_excluded_keys (nvt) ?: "",
nvti_required_udp_ports (nvt) ?: "",
nvti_required_keys (nvt) ?: "",
nvti_required_ports (nvt) ?: "",
nvti_dependencies (nvt) ?: "", nvti_tag (nvt) ?: "",
nvti_cve (nvt) ?: "", nvti_bid (nvt) ?: "",
nvti_xref (nvt) ?: "", nvti_category (nvt),
......@@ -1190,6 +1214,7 @@ static const struct kb_operations KBRedisOperations = {
.kb_get_nvt = redis_get_nvt,
.kb_get_all = redis_get_all,
.kb_get_pattern = redis_get_pattern,
.kb_count = redis_count,
.kb_add_str = redis_add_str,
.kb_set_str = redis_set_str,
.kb_add_int = redis_add_int,
......
......@@ -165,13 +165,18 @@ nvticache_add (const nvti_t *nvti, const char *filename)
oid = nvti_oid (nvti);
dummy = nvticache_get_filename (oid);
if (dummy && strcmp (filename, dummy))
g_warning ("NVT %s with duplicate OID %s will be replaced with %s",
dummy, oid, filename);
if (dummy)
{
g_snprintf (pattern, sizeof (pattern), "nvt:%s", oid);
kb_del_items (cache_kb, pattern);
struct stat src_stat;
char *src_file = g_build_filename (src_path, dummy, NULL);
/* If .nasl file was duplicated, not moved. */
if (src_file && stat (src_file, &src_stat) >= 0)
g_warning ("NVT %s with duplicate OID %s will be replaced with %s",
src_file, oid, filename);
g_free (src_file);
}
if (dummy)
nvticache_delete (oid);
g_free (dummy);
if (kb_nvt_add (cache_kb, nvti, filename))
......@@ -564,3 +569,41 @@ nvticache_get_oids ()
kb_item_free (kbi);
return list;
}
/**
* @brief Get the number of nvt's in the cache.
*
* @return Number of nvt's.
*/
size_t
nvticache_count ()
{
assert (cache_kb);
return kb_item_count (cache_kb, "nvt:*");
}
void
nvticache_delete (const char *oid)
{
char pattern[4096];
char *filename;
assert (cache_kb);
assert (oid);
filename = nvticache_get_filename (oid);
g_snprintf (pattern, sizeof (pattern), "oid:%s:prefs", oid);
kb_del_items (cache_kb, pattern);
g_snprintf (pattern, sizeof (pattern), "nvt:%s", oid);
kb_del_items (cache_kb, pattern);
if (filename)
{
g_snprintf (pattern, sizeof (pattern), "filename:%s:timestamp", filename);
kb_del_items (cache_kb, pattern);
g_snprintf (pattern, sizeof (pattern), "filename:%s:oid", filename);
kb_del_items (cache_kb, pattern);
}
g_free (filename);
}
......@@ -133,4 +133,10 @@ nvticache_get_names (void);
GSList *
nvticache_get_oids (void);
size_t
nvticache_count (void);
void
nvticache_delete (const char *);
#endif /* not _NVTICACHE_H */
......@@ -75,7 +75,7 @@ Set KB key to vaue. Can be used multiple times.
NASL comes from a private project called 'pkt_forge', which was written in late 1998 by Renaud Deraison and which was an interactive shell to forge and send raw IP packets (this pre-dates Perl's Net::RawIP by a couple of weeks). It was then extended to do a wide range of network-related operations and integrated into Nessus as 'NASL'.
The parser was completely hand-written and a pain to work with. In Mid-2002, Michel Arboi wrote a bison parser for NASL, and he and Renaud Deraison re-wrote NASL from scratch. Although the "new" NASL was nearly working as early as
August 2002, Michel's lazyness made us wait for early 2003 to have it working completely.
August 2002, Michel's laziness made us wait for early 2003 to have it working completely.
.SH AUTHOR
Most of the engine is (C) 2003 Michel Arboi, most of the built-in functions
......
......@@ -27,8 +27,15 @@
#if defined(RADIUS_AUTH_FREERADIUS)
#include <freeradius-client.h>
#ifndef RC_CONFIG_FILE
#define RC_DICTIONARY_FILE "/etc/radiusclient/dictionary"
#endif
#elif defined(RADIUS_AUTH_RADCLI)
#include <unistd.h>
#include <radcli/radcli.h>
#ifndef RC_CONFIG_FILE
#define RC_DICTIONARY_FILE "/etc/radcli/dictionary"
#endif
#endif
#include "../base/openvas_networking.h"
......@@ -38,10 +45,6 @@
#define PW_MAX_MSG_SIZE 4096
#endif
#ifndef RC_CONFIG_FILE
#define RC_DICTIONARY_FILE "/etc/radiusclient/dictionary"
#endif
/**
* Initialize the Radius client configuration.
*
......@@ -57,6 +60,67 @@ radius_init (const char *hostname, const char *secret)
char authserver[4096];
struct sockaddr_in6 ip6;
rh = NULL;
if (inet_pton (AF_INET6, hostname, &(ip6.sin6_addr)) == 1)
snprintf (authserver, sizeof (authserver), "[%s]::%s", hostname, secret);
else
snprintf (authserver, sizeof (authserver), "%s::%s", hostname, secret);
#if defined(RADIUS_AUTH_RADCLI)
// Create config from file for older radcli versions
FILE *config_file = NULL;
char config_filename[35] = "/tmp/openvas_radius_conf_XXXXXX";
int config_fd = mkstemp (config_filename);
if (config_fd == -1)
{
g_warning ("%s: Couldn't create temp radius config file: %s\n",
__FUNCTION__, strerror (errno));
goto radius_init_fail;
}
config_file = fdopen (config_fd, "w");
if (config_file == NULL)
{
close (config_fd);
g_warning ("%s: Couldn't open temp radius config file %s: %s\n",
__FUNCTION__, config_filename, strerror (errno));
goto radius_init_fail;
}
if (fprintf (config_file,
"auth_order radius\n"
"login_tries 4\n"
"dictionary %s\n"
"seqfile /var/run/radius.seq\n"
"radius_retries 3\n"
"radius_timeout 5\n"
"radius_deadtime 0\n"
"authserver %s\n"
"acctserver %s\n",
RC_DICTIONARY_FILE,
authserver,
authserver) < 0)
{
fclose (config_file);
g_warning ("%s: Couldn't write to temp radius config file %s:%s\n",
__FUNCTION__, config_filename, strerror (errno));
unlink (config_filename);
goto radius_init_fail;
}
fclose (config_file);
rh = rc_read_config (config_filename);
if (rh == NULL)
{
g_warning ("%s: Couldn't read temp radius config file %s\n",
__FUNCTION__, config_filename);
unlink (config_filename);
goto radius_init_fail;
}
unlink (config_filename);
#else // defined(RADIUS_AUTH_RADCLI)
if ((rh = rc_new ()) == NULL)
{
g_warning ("radius_init: Couldn't allocate memory");
......@@ -104,11 +168,6 @@ radius_init (const char *hostname, const char *secret)
g_warning("radius_init: Couldn't set radius_deadtime");
goto radius_init_fail;
}
if (inet_pton (AF_INET6, hostname, &(ip6.sin6_addr)) == 1)
snprintf (authserver, sizeof (authserver), "[%s]::%s", hostname, secret);
else
snprintf (authserver, sizeof (authserver), "%s::%s", hostname, secret);
if (rc_add_config (rh, "authserver", authserver, "config", 0) != 0)
{
g_warning ("radius_init: Couldn't set authserver %s", authserver);
......@@ -116,10 +175,12 @@ radius_init (const char *hostname, const char *secret)
}
if (rc_read_dictionary (rh, RC_DICTIONARY_FILE) != 0)
{
g_warning ("radius_init: Couldn't read the dictionnary file %s",
g_warning ("radius_init: Couldn't read the dictionary file %s",
RC_DICTIONARY_FILE);
goto radius_init_fail;
}
#endif // defined(RADIUS_AUTH_RADCLI)
return rh;
radius_init_fail:
......
......@@ -236,7 +236,7 @@ cell2atom (lex_ctxt * lexic, tree_cell * c1)
}
}
int
long int
cell_cmp (lex_ctxt * lexic, tree_cell * c1, tree_cell * c2)
{
int flag, typ, typ1, typ2;
......
......@@ -20,6 +20,6 @@
#define EXEC_H_INCLUDED
tree_cell *nasl_exec (lex_ctxt *, tree_cell *);
int cell_cmp (lex_ctxt *, tree_cell *, tree_cell *);
long int cell_cmp (lex_ctxt *, tree_cell *, tree_cell *);
tree_cell *cell2atom (lex_ctxt *, tree_cell *);
#endif
......@@ -42,6 +42,9 @@ GSList *nasl_get_all_certificates (void);
int add_nasl_inc_dir (const char *);
void
nasl_clean_inc (void);
int
exec_nasl_script (struct arglist *, const char *, const char *, int);
int
......
......@@ -40,6 +40,9 @@
#include "nasl_signature.h"
static void naslerror(naslctxt *, const char *);
GHashTable *includes_hash = NULL;
#define YYERROR_VERBOSE
%}
......@@ -290,28 +293,43 @@ inc: INCLUDE '(' string ')'
{
char *tmp;
naslctxt subctx;
int x;
bzero (&subctx, sizeof (subctx));
subctx.always_authenticated = ((naslctxt*)parm)->always_authenticated;
subctx.kb = ((naslctxt *) parm)->kb;
x = init_nasl_ctx(&subctx, $3);
subctx.tree = ((naslctxt *) parm)->tree;
$$ = NULL;
tmp = g_strdup (nasl_get_filename (NULL));
nasl_set_filename ($3);
if (x >= 0)
if (!includes_hash)
includes_hash = g_hash_table_new_full
(g_str_hash, g_str_equal, g_free,
(GDestroyNotify) deref_cell);
if ((subctx.tree = g_hash_table_lookup (includes_hash, $3)))
{
$$ = subctx.tree;
ref_cell ($$);
g_free ($3);
}
else if (init_nasl_ctx (&subctx, $3) >= 0)
{
if (! naslparse(&subctx))
if (!naslparse (&subctx))
{
$$ = subctx.tree;
g_hash_table_insert (includes_hash, $3, $$);
ref_cell ($$);
}
else
nasl_perror(NULL, "%s: Parse error at or near line %d\n",
$3, subctx.line_nb);
{
nasl_perror (NULL, "%s: Parse error at or near line %d\n",
$3, subctx.line_nb);
g_free ($3);
}
g_free(subctx.buffer);
subctx.buffer = NULL;
fclose(subctx.fp);
subctx.fp = NULL;
g_free($3);
}
else
{
......@@ -671,7 +689,7 @@ load_checksums (kb_t kb)
int
init_nasl_ctx(naslctxt* pc, const char* name)
{
char *full_name = NULL, key_path[2048], *checksum, *filename;
char *full_name = NULL, key_path[2048], *checksum, *filename, *check = NULL;
GSList * inc_dir = inc_dirs; // iterator for include directories
// initialize if not yet done (for openvas-server < 2.0.1)
......@@ -715,16 +733,34 @@ init_nasl_ctx(naslctxt* pc, const char* name)
init_checksum_algorithm ();
if (checksum_algorithm == GCRY_MD_NONE)
return -1;
else if (checksum_algorithm == GCRY_MD_MD5)
snprintf (key_path, sizeof (key_path), "checksum:%s", filename);
checksum = kb_item_get_str (pc->kb, key_path);
if (checksum)
{
int ret;
check = file_checksum (full_name, checksum_algorithm);
ret = strcmp (check, checksum);
if (!ret)
{
/* Already checked. No need to check again. */
g_free (full_name);
g_free (checksum);
g_free (check);
return 0;
}
g_free (checksum);
g_free (check);
}
load_checksums (pc->kb);
if (checksum_algorithm == GCRY_MD_MD5)
snprintf (key_path, sizeof (key_path), "md5sums:%s", filename);
else if (checksum_algorithm == GCRY_MD_SHA256)
snprintf (key_path, sizeof (key_path), "sha256sums:%s", filename);
else
abort ();
checksum = kb_item_get_str (pc->kb, key_path);
if (!checksum)
load_checksums (pc->kb);
checksum = kb_item_get_str (pc->kb, key_path);
if (!checksum)
{
log_legacy_write ("No checksum for %s", full_name);
......@@ -734,10 +770,16 @@ init_nasl_ctx(naslctxt* pc, const char* name)
else
{
int ret;
char *check = file_checksum (full_name, checksum_algorithm);
check = file_checksum (full_name, checksum_algorithm);
ret = strcmp (check, checksum);
if (ret)
log_legacy_write ("checksum for %s not matching", full_name);
else
{
snprintf (key_path, sizeof (key_path), "checksum:%s", filename);
kb_item_set_str (pc->kb, key_path, check);
}
g_free (full_name);
g_free (checksum);
g_free (check);
......@@ -761,6 +803,15 @@ nasl_clean_ctx(naslctxt* c)
}
}
void
nasl_clean_inc (void)
{
if (!includes_hash)
return;
g_hash_table_destroy (includes_hash);
includes_hash = NULL;
}
enum lex_state {
ST_START = 0,
ST_SPACE,
......
......@@ -73,10 +73,10 @@ tree_cell *decl_global_variables (lex_ctxt *, tree_cell *);
tree_cell *cell2atom (lex_ctxt *, tree_cell *);
int get_int_var_by_num (lex_ctxt *, int, int);
long int get_int_var_by_num (lex_ctxt *, int, int);
char *get_str_var_by_num (lex_ctxt *, int);
int get_int_var_by_name (lex_ctxt *, const char *, int);
int get_int_local_var_by_name (lex_ctxt *, const char *, int);
long int get_int_var_by_name (lex_ctxt *, const char *, int);
long int get_int_local_var_by_name (lex_ctxt *, const char *, int);
char *get_str_var_by_name (lex_ctxt *, const char *);
char *get_str_local_var_by_name (lex_ctxt *, const char *);
......
......@@ -363,6 +363,7 @@ tree_cell *
script_mandatory_keys (lex_ctxt * lexic)
{
char *keys = get_str_var_by_num (lexic, 0);
char **splits = NULL, *re = get_str_var_by_name (lexic, "re");
int i;
if (keys == NULL)
......@@ -375,12 +376,34 @@ script_mandatory_keys (lex_ctxt * lexic)
return FAKE_CELL;
}
if (re)
{
splits = g_strsplit (re, "=", 0);
if (!splits[0] || !splits[1] || !*splits[1] || splits[2])
{
nasl_perror (lexic, "Erroneous re argument");
return FAKE_CELL;
}
}
for (i = 0; keys != NULL; i++)
{
keys = get_str_var_by_num (lexic, i);
nvti_add_mandatory_keys (arg_get_value (lexic->script_infos, "NVTI"), keys);
if (splits && keys && !strcmp (keys, splits[0]))
{
nvti_add_mandatory_keys (arg_get_value (lexic->script_infos, "NVTI"),
re);
re = NULL;
}
else
nvti_add_mandatory_keys (arg_get_value (lexic->script_infos, "NVTI"),
keys);
}
if (re)
nvti_add_mandatory_keys (arg_get_value (lexic->script_infos, "NVTI"), re);
g_strfreev (splits);
return FAKE_CELL;
}
......
......@@ -43,6 +43,8 @@
#include <netinet/in.h> /* for sockaddr_in */
#include <string.h> /* for bzero */
#include <unistd.h> /* for close */
#include <stdlib.h> /* for atoi() */
#include <sys/time.h> /* for gettimeofday and timeval */
#include <gnutls/gnutls.h>
......@@ -50,6 +52,7 @@
#include "../base/openvas_networking.h" /* for openvas_source_set_socket */
#include "../misc/plugutils.h" /* for plug_get_host_ip */
#include "../misc/openvas_logging.h"
#include "../misc/prefs.h" /* for prefs_get */
#include "nasl.h"
......@@ -102,6 +105,49 @@ block_socket (int soc)
return 0;
}
static void
wait_before_next_probe ()
{
const char *time_between_request;
int minwaittime = 0;
time_between_request = prefs_get ("time_between_request");
if (time_between_request)
minwaittime = atoi (time_between_request);
if (minwaittime > 0)
{
static double lastprobesec = 0;
static double lastprobeusec = 0;
struct timeval tvnow, tvdiff;
double diff_msec;
int time2wait = 0;
gettimeofday (&tvnow, NULL);
if (lastprobesec <= 0)
{
lastprobesec = tvnow.tv_sec - 10;
lastprobeusec = tvnow.tv_usec;
}
tvdiff.tv_sec = tvnow.tv_sec - lastprobesec;
tvdiff.tv_usec = tvnow.tv_usec - lastprobeusec;
if (tvdiff.tv_usec <= 0)
{
tvdiff.tv_sec += 1;
tvdiff.tv_usec *= -1;
}
diff_msec = tvdiff.tv_sec * 1000 + tvdiff.tv_usec / 1000;
time2wait = (minwaittime - diff_msec) * 1000;
if (time2wait > 0)
usleep (time2wait);
gettimeofday (&tvnow, NULL);
lastprobesec = tvnow.tv_sec;
lastprobeusec = tvnow.tv_usec;
}
}
/*
* NASL automatically re-send data when a recv() on a UDP packet
......@@ -211,6 +257,8 @@ nasl_open_privileged_socket (lex_ctxt * lexic, int proto)
restart:
if (proto == IPPROTO_TCP)
wait_before_next_probe ();
p = plug_get_host_ip (script_infos);
if (IN6_IS_ADDR_V4MAPPED (p))
{
......@@ -410,6 +458,8 @@ nasl_open_sock_tcp_bufsz (lex_ctxt * lexic, int bufsz)
if (port < 0)
return NULL;
wait_before_next_probe ();
/* If "transport" has not been given, use auto detection if enabled
in the KB. if "transport" has been given with a value of 0 force
autodetection reagardless of what the KB tells. */
......@@ -879,7 +929,10 @@ nasl_send (lex_ctxt * lexic)
add_udp_data (lexic->script_infos, soc, data, length);
}
else
n = nsend (soc, data, length, option);
{
wait_before_next_probe ();
n = nsend (soc, data, length, option);
}
retc = alloc_tree_cell (0, NULL);
retc->type = CONST_INT;
......@@ -900,8 +953,10 @@ nasl_close_socket (lex_ctxt * lexic)
soc = get_int_var_by_num (lexic, 0, -1);
if (fd_is_stream (soc))
return close_stream_connection (soc) < 0 ? NULL : FAKE_CELL;
{
wait_before_next_probe ();
return close_stream_connection (soc) < 0 ? NULL : FAKE_CELL;
}
if (lowest_socket == 0 || soc < lowest_socket)
{
nasl_perror (lexic, "close(%d): Invalid socket value\n", soc);
......
......@@ -1089,7 +1089,7 @@ nasl_incr_variable (lex_ctxt * lexic, tree_cell * tc, int pre, int val)
}
static int
static long int
var2int (anon_nasl_var * v, int defval)
{
if (v == NULL)
......@@ -1222,21 +1222,21 @@ var2str (const anon_nasl_var * v)
}
}
int
long int
get_int_var_by_num (lex_ctxt * lexic, int num, int defval)
{
anon_nasl_var *v = get_var_ref_by_num (lexic, num);
return var2int (v, defval);
}
int
long int
get_int_var_by_name (lex_ctxt * lexic, const char *name, int defval)
{
named_nasl_var *v = get_var_ref_by_name (lexic, name, 1);
return var2int (&v->u, defval);
}
int
long int
get_int_local_var_by_name (lex_ctxt * lexic, const char *name, int defval)
{
named_nasl_var *v = get_var_ref_by_name (lexic, name, 0);
......
......@@ -160,7 +160,7 @@ nasl_wmi_connect (lex_ctxt * lexic)
char *argv[max];
WMI_HANDLE handle;
int argc = 5, value;
int argc = 5;
char *argv1 = "wmic";
char *argv2 = "-U";
......@@ -199,14 +199,14 @@ nasl_wmi_connect (lex_ctxt * lexic)