plugs_req.c header.
More...
#include <gvm/util/kb.h>
Go to the source code of this file.
plugs_req.c header.
Definition in file plugs_req.h.
◆ mandatory_requirements_met()
int mandatory_requirements_met |
( |
kb_t |
kb, |
|
|
nvti_t * |
nvti |
|
) |
| |
Check whether mandatory requirements for plugin are met.
- Parameters
-
kb | The knowledge base with all keys. |
plugin | The scheduler plugin. |
- Returns
- 1 if all mandatory requirements for the plugin are met. 0 if it is not the case.
Definition at line 247 of file plugs_req.c.
References check_mandatory_keys().
Referenced by launch_plugin().
static int check_mandatory_keys(kb_t kb, char *keys)
Checks mandatory keys presence and value in the KB.
◆ requirements_plugin()
char* requirements_plugin |
( |
kb_t |
kb, |
|
|
nvti_t * |
nvti |
|
) |
| |
Determine if the plugin requirements are met.
- Returns
- Returns NULL is everything is ok, else an error message.
Definition at line 264 of file plugs_req.c.
References get_closed_ports(), kb_missing_keyname_of_namelist(), and kb_present_keyname_of_namelist().
Referenced by launch_plugin().
266 static char error[64];
267 char *errkey = NULL, *keys, *tcp, *udp;
268 const char *opti = prefs_get (
"optimization_level");
273 error[
sizeof (error) - 1] =
'\0';
274 tcp = nvti_required_ports (nvti);
277 strncpy (error,
"none of the required tcp ports are open",
282 udp = nvti_required_udp_ports (nvti);
285 strncpy (error,
"none of the required udp ports are open",
290 if (opti != NULL && (strcmp (opti,
"open_ports") == 0 || atoi (opti) == 1))
296 keys = nvti_required_keys (nvti);
299 snprintf (error,
sizeof (error),
"because the key %s is missing", errkey);
304 if (opti != NULL && (strcmp (opti,
"required_keys") == 0 || atoi (opti) == 2))
310 keys = nvti_excluded_keys (nvti);
313 snprintf (error,
sizeof (error),
"because the key %s is present", errkey);
static int kb_missing_keyname_of_namelist(kb_t kb, char *keys, char **keyname)
Returns the name of the first key which is not present in the kb.
static int kb_present_keyname_of_namelist(kb_t kb, char *keys, char **keyname)
Returns the name of the first key which is present in the kb.
static int get_closed_ports(kb_t kb, char *ports_list, char *proto)
Returns whether a port in a port list is closed or not.