36 #define G_LOG_DOMAIN "md main"
53 sql (
"INSERT into configs (uuid, name, owner, nvt_selector, comment,"
54 " family_count, nvt_count, nvts_growing, families_growing,"
55 " type, creation_time, modification_time)"
56 " VALUES ('%s', 'Host Discovery', NULL,"
57 " '%s', 'Network Host Discovery scan configuration.',"
58 " 0, 0, 0, 0, 0, m_now (), m_now ());",
66 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)"
68 " '1.3.6.1.4.1.25623.1.0.100315', 'Port scanners');",
74 " SET family_count = %i, nvt_count = %i,"
75 " modification_time = m_now ()"
83 sql (
"INSERT INTO config_preferences (config, type, name, value)"
86 " 'Ping Host[checkbox]:Mark unrechable Hosts as dead (not scanning)',"
90 sql (
"INSERT INTO config_preferences (config, type, name, value)"
93 " 'Ping Host[checkbox]:Report about reachable Hosts',"
97 sql (
"INSERT INTO config_preferences (config, type, name, value)"
100 " 'Ping Host[checkbox]:Report about unrechable Hosts',"
108 #define NAME "Global variable settings[checkbox]:Strictly unauthenticated"
126 if (
sql_int (
"SELECT count (*) FROM config_preferences"
127 " WHERE config = (SELECT id FROM configs WHERE uuid = '%s')"
128 " AND type = 'PLUGINS_PREFS'"
129 " AND name = '" NAME "';",
133 sql (
"INSERT INTO config_preferences (config, type, name, value)"
134 " VALUES ((SELECT id FROM configs WHERE uuid = '%s'),"
144 if (
sql_int (
"SELECT count (*) FROM nvt_selectors"
145 " WHERE name = (SELECT nvt_selector FROM configs"
146 " WHERE uuid = '%s')"
147 " AND family_or_nvt = '1.3.6.1.4.1.25623.1.0.12288';",
151 sql (
"INSERT INTO nvt_selectors (name, exclude, type, family_or_nvt, family)"
152 " VALUES ((SELECT nvt_selector FROM configs WHERE uuid = '%s'), 0,"
154 " '1.3.6.1.4.1.25623.1.0.12288', 'Settings');",
void make_config_host_discovery(char *const uuid, char *const selector_name)
Make Host Discovery Scan Config.
int sql_int(char *sql,...)
Get a particular cell from a SQL query, as an int.
resource_t sql_last_insert_id()
Get the ID of the last inserted row.
void sql(char *sql,...)
Perform an SQL statement, retrying if database is busy or locked.
#define NVT_SELECTOR_TYPE_NVT
NVT selector type for "NVT" rule.
int check_config_host_discovery(const char *uuid)
Ensure the Host Discovery config is up to date.
#define NAME
Preference name.
int nvt_selector_nvt_count(const char *, const char *, int)
Get the number of NVTs selected by an NVT selector.
int nvt_selector_family_count(const char *, int)
Get the number of families selected by an NVT selector.
void update_config_cache_init(const char *uuid)
Update count and growing info in config, without checking user.