Skip to content

Commit c75f34d

Browse files
mattmundellbjoernricks
authored andcommitted
Change: move manage_check_alerts out of manage_sql.c
1 parent 6a0d1f6 commit c75f34d

File tree

4 files changed

+38
-37
lines changed

4 files changed

+38
-37
lines changed

src/manage.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,9 +523,6 @@ set_resource_id_deprecated (const char *, const char *, gboolean);
523523
"Please contact your local system administrator if you think it\n" \
524524
"was created or assigned erroneously.\n"
525525

526-
int
527-
manage_check_alerts (GSList *, const db_conn_info_t *);
528-
529526
int
530527
create_alert (const char*, const char*, const char*, const char*, event_t,
531528
GPtrArray*, alert_condition_t, GPtrArray*, alert_method_t,

src/manage_alerts.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,3 +372,37 @@ manage_test_alert (const char *alert_id, gchar **script_message)
372372
free (report_id);
373373
return ret;
374374
}
375+
376+
/**
377+
* @brief Check if any SecInfo alerts are due.
378+
*
379+
* @param[in] log_config Log configuration.
380+
* @param[in] database Location of manage database.
381+
*
382+
* @return 0 success, -1 error,
383+
* -2 database is too old, -3 database needs to be initialised
384+
* from server, -5 database is too new.
385+
*/
386+
int
387+
manage_check_alerts (GSList *log_config, const db_conn_info_t *database)
388+
{
389+
int ret;
390+
391+
g_info (" Checking alerts.");
392+
393+
ret = manage_option_setup (log_config, database,
394+
0 /* avoid_db_check_inserts */);
395+
if (ret)
396+
return ret;
397+
398+
/* Setup a dummy user, so that create_user will work. */
399+
current_credentials.uuid = "";
400+
401+
check_alerts ();
402+
403+
current_credentials.uuid = NULL;
404+
405+
manage_option_cleanup ();
406+
407+
return ret;
408+
}

src/manage_alerts.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "iterator.h"
2323
#include "manage_get.h"
2424
#include "manage_tasks.h"
25+
#include "sql.h"
2526

2627
#include <glib.h>
2728

@@ -172,4 +173,7 @@ alert_task_iterator_uuid (iterator_t*);
172173
int
173174
alert_task_iterator_readable (iterator_t*);
174175

176+
int
177+
manage_check_alerts (GSList *, const db_conn_info_t *);
178+
175179
#endif /* not _GVMD_MANAGE_ALERTS_H */

src/manage_sql.c

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6638,40 +6638,6 @@ DEF_ACCESS (task_role_iterator_uuid, 4);
66386638

66396639
/* Events and Alerts. */
66406640

6641-
/**
6642-
* @brief Check if any SecInfo alerts are due.
6643-
*
6644-
* @param[in] log_config Log configuration.
6645-
* @param[in] database Location of manage database.
6646-
*
6647-
* @return 0 success, -1 error,
6648-
* -2 database is too old, -3 database needs to be initialised
6649-
* from server, -5 database is too new.
6650-
*/
6651-
int
6652-
manage_check_alerts (GSList *log_config, const db_conn_info_t *database)
6653-
{
6654-
int ret;
6655-
6656-
g_info (" Checking alerts.");
6657-
6658-
ret = manage_option_setup (log_config, database,
6659-
0 /* avoid_db_check_inserts */);
6660-
if (ret)
6661-
return ret;
6662-
6663-
/* Setup a dummy user, so that create_user will work. */
6664-
current_credentials.uuid = "";
6665-
6666-
check_alerts ();
6667-
6668-
current_credentials.uuid = NULL;
6669-
6670-
manage_option_cleanup ();
6671-
6672-
return ret;
6673-
}
6674-
66756641
/**
66766642
* @brief Validate an email address.
66776643
*

0 commit comments

Comments
 (0)