Skip to content

Commit

Permalink
Merge pull request #2203 from greenbone/get-notes-with-get-next
Browse files Browse the repository at this point in the history
Fix: iterate with get_next in handle_get_notes and handle_get_overrides
  • Loading branch information
a-h-abdelsalam authored Jun 14, 2024
2 parents f4a566a + 26d9b4d commit 7e50546
Show file tree
Hide file tree
Showing 17 changed files with 610 additions and 556 deletions.
1,086 changes: 570 additions & 516 deletions src/gmp.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/gmp_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ init_get (gchar *command, get_data_t * get, const gchar *setting_name,
*/
int
get_next (iterator_t *resources, get_data_t *get, int *first, int *count,
int (*init) (iterator_t*, const get_data_t *))
int (*init) (iterator_t*, get_data_t *))
{
if (next (resources) == FALSE)
{
Expand Down
2 changes: 1 addition & 1 deletion src/gmp_get.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ init_get (gchar *, get_data_t *, const gchar *, int *);

int
get_next (iterator_t *, get_data_t *, int *, int *,
int (*) (iterator_t *, const get_data_t *));
int (*) (iterator_t *, get_data_t *));

int
send_get_start (const char *, int (*) (const char *, void *), void *);
Expand Down
26 changes: 13 additions & 13 deletions src/manage.h
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ int
alert_count (const get_data_t *);

int
init_alert_iterator (iterator_t*, const get_data_t*);
init_alert_iterator (iterator_t*, get_data_t*);

int
alert_iterator_event (iterator_t*);
Expand Down Expand Up @@ -730,7 +730,7 @@ unsigned int
task_count (const get_data_t *);

int
init_task_iterator (iterator_t*, const get_data_t *);
init_task_iterator (iterator_t*, get_data_t *);

task_status_t
task_iterator_run_status (iterator_t*);
Expand Down Expand Up @@ -1743,7 +1743,7 @@ void
init_target_iterator_one (iterator_t*, target_t);

int
init_target_iterator (iterator_t*, const get_data_t *);
init_target_iterator (iterator_t*, get_data_t *);

const char*
target_iterator_hosts (iterator_t*);
Expand Down Expand Up @@ -2212,7 +2212,7 @@ void
init_credential_iterator_one (iterator_t*, credential_t);

int
init_credential_iterator (iterator_t*, const get_data_t *);
init_credential_iterator (iterator_t*, get_data_t *);

const char*
credential_iterator_login (iterator_t*);
Expand Down Expand Up @@ -2730,7 +2730,7 @@ char *
openvas_default_scanner_host ();

int
init_scanner_iterator (iterator_t*, const get_data_t *);
init_scanner_iterator (iterator_t*, get_data_t *);

const char*
scanner_iterator_host (iterator_t*);
Expand Down Expand Up @@ -2915,7 +2915,7 @@ int
schedule_info (schedule_t, int, gchar **, gchar **);

int
init_schedule_iterator (iterator_t*, const get_data_t *);
init_schedule_iterator (iterator_t*, get_data_t *);

const char*
schedule_iterator_timezone (iterator_t *);
Expand Down Expand Up @@ -2967,7 +2967,7 @@ set_schedule_timeout (int);
/* Groups. */

int
init_group_iterator (iterator_t *, const get_data_t *);
init_group_iterator (iterator_t *, get_data_t *);

int
copy_group (const char *, const char *, const char *, group_t *);
Expand Down Expand Up @@ -3034,7 +3034,7 @@ int
permission_count (const get_data_t *);

int
init_permission_iterator (iterator_t*, const get_data_t *);
init_permission_iterator (iterator_t*, get_data_t *);

const char*
permission_iterator_resource_type (iterator_t*);
Expand Down Expand Up @@ -3091,7 +3091,7 @@ int
manage_get_roles (GSList *, const db_conn_info_t *, int);

int
init_role_iterator (iterator_t *, const get_data_t *);
init_role_iterator (iterator_t *, get_data_t *);

int
copy_role (const char *, const char *, const char *, role_t *);
Expand Down Expand Up @@ -3248,7 +3248,7 @@ int
filter_count (const get_data_t*);

int
init_filter_iterator (iterator_t*, const get_data_t*);
init_filter_iterator (iterator_t*, get_data_t*);

const char*
filter_iterator_type (iterator_t*);
Expand Down Expand Up @@ -3546,7 +3546,7 @@ gchar *
keyfile_to_auth_conf_settings_xml (const gchar *);

int
init_user_iterator (iterator_t*, const get_data_t*);
init_user_iterator (iterator_t*, get_data_t*);

const char*
user_iterator_role (iterator_t*);
Expand Down Expand Up @@ -3692,7 +3692,7 @@ modify_tag (const char *, const char *, const char *, const char *,
gchar **);

int
init_tag_iterator (iterator_t*, const get_data_t*);
init_tag_iterator (iterator_t*, get_data_t*);

int
tag_count (const get_data_t *get);
Expand Down Expand Up @@ -3725,7 +3725,7 @@ int
tag_resource_iterator_readable (iterator_t*);

int
init_tag_name_iterator (iterator_t*, const get_data_t*);
init_tag_name_iterator (iterator_t*, get_data_t*);

const char*
tag_name_iterator_name (iterator_t*);
Expand Down
2 changes: 1 addition & 1 deletion src/manage_configs.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void
init_user_config_iterator (iterator_t*, config_t, int, int, const char*);

int
init_config_iterator (iterator_t*, const get_data_t*);
init_config_iterator (iterator_t*, get_data_t*);

const char*
config_iterator_nvt_selector (iterator_t*);
Expand Down
2 changes: 1 addition & 1 deletion src/manage_port_lists.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int
port_list_count (const get_data_t *);

int
init_port_list_iterator (iterator_t *, const get_data_t *);
init_port_list_iterator (iterator_t *, get_data_t *);

int
port_list_iterator_count_all (iterator_t *);
Expand Down
2 changes: 1 addition & 1 deletion src/manage_report_configs.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ report_config_count (const get_data_t *);


int
init_report_config_iterator (iterator_t*, const get_data_t *);
init_report_config_iterator (iterator_t*, get_data_t *);

const char*
report_config_iterator_report_format_id (iterator_t *);
Expand Down
2 changes: 1 addition & 1 deletion src/manage_report_formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ int
report_format_count (const get_data_t *);

int
init_report_format_iterator (iterator_t*, const get_data_t *);
init_report_format_iterator (iterator_t*, get_data_t *);

const char*
report_format_iterator_extension (iterator_t *);
Expand Down
26 changes: 13 additions & 13 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -8505,7 +8505,7 @@ trash_alert_writable (alert_t alert)
* -1 error.
*/
int
init_alert_iterator (iterator_t* iterator, const get_data_t *get)
init_alert_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = ALERT_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = ALERT_ITERATOR_COLUMNS;
Expand Down Expand Up @@ -15366,7 +15366,7 @@ init_user_task_iterator (iterator_t* iterator, int trash, int ignore_severity)
* -1 error.
*/
int
init_task_iterator (iterator_t* iterator, const get_data_t *get)
init_task_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = TASK_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = TASK_ITERATOR_COLUMNS;
Expand Down Expand Up @@ -34214,7 +34214,7 @@ init_target_iterator_one (iterator_t* iterator, target_t target)
* -1 error.
*/
int
init_target_iterator (iterator_t* iterator, const get_data_t *get)
init_target_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = TARGET_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = TARGET_ITERATOR_COLUMNS;
Expand Down Expand Up @@ -37559,7 +37559,7 @@ init_credential_iterator_one (iterator_t* iterator,
* filter (filt_id), -1 error.
*/
int
init_credential_iterator (iterator_t* iterator, const get_data_t *get)
init_credential_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = CREDENTIAL_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = CREDENTIAL_ITERATOR_COLUMNS;
Expand Down Expand Up @@ -41675,7 +41675,7 @@ delete_scanner (const char *scanner_id, int ultimate)
* @return 0 success, 1 failed to find scanner, 2 failed to find filter, -1 error.
*/
int
init_scanner_iterator (iterator_t* iterator, const get_data_t *get)
init_scanner_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = SCANNER_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = SCANNER_ITERATOR_COLUMNS;
Expand Down Expand Up @@ -43157,7 +43157,7 @@ schedule_count (const get_data_t *get)
* filter (filt_id), -1 error.
*/
int
init_schedule_iterator (iterator_t* iterator, const get_data_t *get)
init_schedule_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = SCHEDULE_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = SCHEDULE_ITERATOR_COLUMNS;
Expand Down Expand Up @@ -44273,7 +44273,7 @@ group_count (const get_data_t *get)
* -1 error.
*/
int
init_group_iterator (iterator_t* iterator, const get_data_t *get)
init_group_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = GROUP_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = GROUP_ITERATOR_COLUMNS;
Expand Down Expand Up @@ -45521,7 +45521,7 @@ permission_count (const get_data_t *get)
* -1 error.
*/
int
init_permission_iterator (iterator_t* iterator, const get_data_t *get)
init_permission_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = PERMISSION_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = PERMISSION_ITERATOR_COLUMNS;
Expand Down Expand Up @@ -47141,7 +47141,7 @@ role_count (const get_data_t *get)
* -1 error.
*/
int
init_role_iterator (iterator_t* iterator, const get_data_t *get)
init_role_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = ROLE_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = ROLE_ITERATOR_COLUMNS;
Expand Down Expand Up @@ -47820,7 +47820,7 @@ filter_count (const get_data_t *get)
* -1 error.
*/
int
init_filter_iterator (iterator_t* iterator, const get_data_t *get)
init_filter_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = FILTER_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = FILTER_ITERATOR_COLUMNS;
Expand Down Expand Up @@ -55240,7 +55240,7 @@ user_count (const get_data_t *get)
* -1 error.
*/
int
init_user_iterator (iterator_t* iterator, const get_data_t *get)
init_user_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = USER_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = USER_ITERATOR_COLUMNS;
Expand Down Expand Up @@ -57148,7 +57148,7 @@ modify_tag (const char *tag_id, const char *name, const char *comment,
* -1 error.
*/
int
init_tag_iterator (iterator_t* iterator, const get_data_t *get)
init_tag_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = TAG_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = TAG_ITERATOR_COLUMNS;
Expand Down Expand Up @@ -57243,7 +57243,7 @@ tag_iterator_resources (iterator_t* iterator)
* @return 0 success, -1 error.
*/
int
init_tag_name_iterator (iterator_t* iterator, const get_data_t *get)
init_tag_name_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = TAG_NAME_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = TAG_NAME_ITERATOR_COLUMNS;
Expand Down
2 changes: 1 addition & 1 deletion src/manage_sql_configs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3176,7 +3176,7 @@ init_user_config_iterator (iterator_t* iterator, config_t config, int trash,
* -1 error.
*/
int
init_config_iterator (iterator_t* iterator, const get_data_t *get)
init_config_iterator (iterator_t* iterator, get_data_t *get)
{
int rc;
static const char *filter_columns[] = CONFIG_ITERATOR_FILTER_COLUMNS;
Expand Down
2 changes: 1 addition & 1 deletion src/manage_sql_port_lists.c
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,7 @@ port_list_count (const get_data_t *get)
* -1 error.
*/
int
init_port_list_iterator (iterator_t* iterator, const get_data_t *get)
init_port_list_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = PORT_LIST_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = PORT_LIST_ITERATOR_COLUMNS;
Expand Down
2 changes: 1 addition & 1 deletion src/manage_sql_report_configs.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ report_config_count (const get_data_t *get)
* -1 error.
*/
int
init_report_config_iterator (iterator_t* iterator, const get_data_t *get)
init_report_config_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = REPORT_CONFIG_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = REPORT_CONFIG_ITERATOR_COLUMNS;
Expand Down
2 changes: 1 addition & 1 deletion src/manage_sql_report_formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -2872,7 +2872,7 @@ report_format_count (const get_data_t *get)
* -1 error.
*/
int
init_report_format_iterator (iterator_t* iterator, const get_data_t *get)
init_report_format_iterator (iterator_t* iterator, get_data_t *get)
{
static const char *filter_columns[] = REPORT_FORMAT_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = REPORT_FORMAT_ITERATOR_COLUMNS;
Expand Down
2 changes: 1 addition & 1 deletion src/manage_sql_tickets.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ ticket_count (const get_data_t *get)
* -1 error.
*/
int
init_ticket_iterator (iterator_t *iterator, const get_data_t *get)
init_ticket_iterator (iterator_t *iterator, get_data_t *get)
{
static const char *filter_columns[] = TICKET_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = TICKET_ITERATOR_COLUMNS;
Expand Down
2 changes: 1 addition & 1 deletion src/manage_sql_tls_certificates.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ tls_certificate_count (const get_data_t *get)
* 2 failed to find filter, -1 error.
*/
int
init_tls_certificate_iterator (iterator_t *iterator, const get_data_t *get)
init_tls_certificate_iterator (iterator_t *iterator, get_data_t *get)
{
static const char *filter_columns[] = TLS_CERTIFICATE_ITERATOR_FILTER_COLUMNS;
static column_t columns[] = TLS_CERTIFICATE_ITERATOR_COLUMNS;
Expand Down
2 changes: 1 addition & 1 deletion src/manage_tickets.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int
ticket_count (const get_data_t *);

int
init_ticket_iterator (iterator_t *, const get_data_t *);
init_ticket_iterator (iterator_t *, get_data_t *);

const char*
ticket_iterator_user_id (iterator_t*);
Expand Down
2 changes: 1 addition & 1 deletion src/manage_tls_certificates.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int
tls_certificate_count (const get_data_t *);

int
init_tls_certificate_iterator (iterator_t *, const get_data_t *);
init_tls_certificate_iterator (iterator_t *, get_data_t *);

const char*
tls_certificate_iterator_certificate (iterator_t*);
Expand Down

0 comments on commit 7e50546

Please sign in to comment.