Greenbone Vulnerability Manager  8.0.1~git
manage.h
1 /* Copyright (C) 2009-2018 Greenbone Networks GmbH
2  *
3  * SPDX-License-Identifier: GPL-2.0-or-later
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 /*
21  * @file manage.h
22  * @brief Headers for Greenbone Vulnerability Manager: the Manage library.
23  */
24 
25 #ifndef _GVMD_MANAGE_H
26 #define _GVMD_MANAGE_H
27 
28 #include "iterator.h"
29 
30 #include <glib.h>
31 #include <gnutls/gnutls.h>
32 #include <gvm/base/array.h> /* for array_t */
33 #include <gvm/base/credentials.h> /* for credentials_t */
34 #include <gvm/base/networking.h> /* for port_protocol_t */
35 #include <gvm/base/nvti.h> /* for nvti_t */
36 #include <gvm/osp/osp.h> /* for osp_connection_t */
37 #include <gvm/util/authutils.h> /* for auth_method_t */
38 #include <gvm/util/serverutils.h> /* for gvm_connection_t */
39 #include <stdio.h>
40 
44 #define ALL_LOG_LEVELS \
45  (G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION)
46 
50 #ifndef g_info
51 #define g_info(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__)
52 #endif /* g_info not defined */
53 
57 typedef struct
58 {
59  gchar *name;
60  gchar *value;
61 } name_value_t;
62 
66 typedef int (*manage_connection_forker_t) (gvm_connection_t *conn,
67  const gchar *uuid);
68 
69 int
70 init_manage (GSList *,
71  int,
72  const gchar *,
73  int,
74  int,
75  int,
76  int,
77  manage_connection_forker_t,
78  int);
79 
80 int
81 init_manage_helper (GSList *, const gchar *, int);
82 
83 void
84 init_manage_process (int, const gchar *);
85 
86 void cleanup_manage_process (gboolean);
87 
88 void
90 
91 void
93 
94 /* Commands. */
95 
99 typedef struct
100 {
101  gchar *name;
102  gchar *summary;
103 } command_t;
104 
108 extern command_t gmp_commands[];
109 
110 /* Certificate and key management. */
111 
112 gchar *
113 truncate_certificate (const gchar *);
114 
115 gchar *
116 truncate_private_key (const gchar *);
117 
118 int
119 get_certificate_info (const gchar *, time_t *, time_t *, gchar **, gchar **);
120 
121 gchar *certificate_iso_time (time_t);
122 
123 const gchar *certificate_time_status (time_t, time_t);
124 
125 /* Credentials. */
126 
127 extern credentials_t current_credentials;
128 
129 int
130 authenticate (credentials_t *);
131 
132 /* Database. */
133 
134 int
135 manage_backup_db (const gchar *);
136 
137 int
139 
140 int
142 
143 int
145 
146 int
148 
149 int
151 
152 int
154 
155 char *
156 port_name_formatted (const char *);
157 
158 void
159 set_db_version (int version);
160 
161 char *
162 manage_port_name (int, const char *);
163 
164 int
165 manage_migrate (GSList *, const gchar *);
166 
167 int
168 manage_encrypt_all_credentials (GSList *, const gchar *);
169 
170 int
171 manage_decrypt_all_credentials (GSList *, const gchar *);
172 
173 void
174 manage_session_set_timezone (const char *);
175 
176 void
178 
179 void manage_transaction_stop (gboolean);
180 
181 /* Task structures. */
182 
183 extern short scanner_active;
184 
189 typedef struct
190 {
191  unsigned int number;
192  port_protocol_t protocol;
193  char *string;
194 } port_t;
195 
200 typedef struct
201 {
202  char *host;
203  char *hostname;
205  char *description;
206  char *oid;
207 } message_t;
208 
215 typedef enum
216 {
217  TASK_STATUS_DELETE_REQUESTED = 0,
218  TASK_STATUS_DONE = 1,
219  TASK_STATUS_NEW = 2,
220  TASK_STATUS_REQUESTED = 3,
221  TASK_STATUS_RUNNING = 4,
222  TASK_STATUS_STOP_REQUESTED = 10,
223  TASK_STATUS_STOP_WAITING = 11,
224  TASK_STATUS_STOPPED = 12,
225  TASK_STATUS_INTERRUPTED = 13,
226  TASK_STATUS_DELETE_ULTIMATE_REQUESTED = 14,
227  TASK_STATUS_STOP_REQUESTED_GIVEUP = 15,
228  TASK_STATUS_DELETE_WAITING = 16,
229  TASK_STATUS_DELETE_ULTIMATE_WAITING = 17
230 } task_status_t;
231 
235 #define AUTO_DELETE_KEEP_MIN 2
236 
240 #define AUTO_DELETE_KEEP_MAX 1200
241 
248 typedef enum
249 {
250  ALIVE_TEST_TCP_ACK_SERVICE = 1,
251  ALIVE_TEST_ICMP = 2,
252  ALIVE_TEST_ARP = 4,
253  ALIVE_TEST_CONSIDER_ALIVE = 8,
254  ALIVE_TEST_TCP_SYN_SERVICE = 16
255 } alive_test_t;
256 
263 typedef enum scanner_type
264 {
265  SCANNER_TYPE_NONE = 0,
266  SCANNER_TYPE_OSP,
267  SCANNER_TYPE_OPENVAS,
268  SCANNER_TYPE_CVE,
269  SCANNER_TYPE_GMP,
270  SCANNER_TYPE_MAX,
271 } scanner_type_t;
272 
273 typedef long long int agent_t;
274 typedef long long int config_t;
275 typedef long long int credential_t;
276 typedef long long int alert_t;
277 typedef long long int filter_t;
278 typedef long long int group_t;
279 typedef long long int host_t;
280 typedef long long int tag_t;
281 typedef long long int target_t;
282 typedef long long int task_t;
283 typedef long long int ticket_t;
284 typedef long long int result_t;
285 typedef long long int report_t;
286 typedef long long int report_host_t;
287 typedef long long int report_format_t;
288 typedef long long int report_format_param_t;
289 typedef long long int role_t;
290 typedef long long int note_t;
291 typedef long long int nvt_t;
292 typedef long long int override_t;
293 typedef long long int permission_t;
294 typedef long long int port_list_t;
295 typedef long long int port_range_t;
296 typedef long long int schedule_t;
297 typedef long long int scanner_t;
298 typedef long long int setting_t;
299 typedef long long int user_t;
300 
301 /* GMP GET. */
302 
306 #define FILT_ID_NONE "0"
307 
311 #define FILT_ID_USER_SETTING "-2"
312 
316 typedef struct
317 {
318  int details;
319  char *filt_id;
320  char *filter;
323  char *id;
324  int trash;
325  gchar *type;
326  gchar *subtype;
328  int ignore_pagination;
330  int minimal;
331 } get_data_t;
332 
333 void
335 
338 
339 const char *
340 get_iterator_uuid (iterator_t *);
341 
342 const char *
343 get_iterator_name (iterator_t *);
344 
345 const char *
347 
348 const char *
349 get_iterator_creation_time (iterator_t *);
350 
351 const char *
352 get_iterator_modification_time (iterator_t *);
353 
354 const char *
355 get_iterator_owner_name (iterator_t *);
356 
357 user_t
359 
360 /* Resources. */
361 
362 int
363 manage_resource_name (const char *, const char *, char **);
364 
365 int
366 manage_trash_resource_name (const char *, const char *, char **);
367 
368 int
369 resource_count (const char *, const get_data_t *);
370 
371 int
372 resource_id_exists (const char *, const char *);
373 
374 int
375 trash_id_exists (const char *, const char *);
376 
377 gboolean
378 find_resource (const char *, const char *, resource_t *);
379 
380 const char *
381 type_name_plural (const char *);
382 
383 const char *
384 type_name (const char *);
385 
386 int
387 type_is_scap (const char *);
388 
389 int
390 delete_resource (const char *, const char *, int);
391 
392 /* Events and Alerts. */
393 
397 typedef struct
398 {
399  gchar *local_filename;
401  gchar *content_type;
404 
405 void
407 
408 void
410 
414 #define ALERT_MESSAGE_INCLUDE \
415  "Task '$n': $e\n" \
416  "\n" \
417  "After the event $e,\n" \
418  "the following condition was met: $c\n" \
419  "\n" \
420  "This email escalation is configured to apply report format '$r'.\n" \
421  "Full details and other report formats are available on the scan engine.\n" \
422  "\n" \
423  "$t" \
424  "\n" \
425  "$i" \
426  "\n" \
427  "\n" \
428  "Note:\n" \
429  "This email was sent to you as a configured security scan escalation.\n" \
430  "Please contact your local system administrator if you think you\n" \
431  "should not have received it.\n"
432 
436 #define SECINFO_ALERT_MESSAGE_INCLUDE \
437  "Task '$n': $e\n" \
438  "\n" \
439  "After the event $e,\n" \
440  "the following condition was met: $c\n" \
441  "\n" \
442  "This email escalation is configured to apply report format '$r'.\n" \
443  "Full details and other report formats are available on the scan engine.\n" \
444  "\n" \
445  "$t" \
446  "\n" \
447  "$i" \
448  "\n" \
449  "\n" \
450  "Note:\n" \
451  "This email was sent to you as a configured security scan escalation.\n" \
452  "Please contact your local system administrator if you think you\n" \
453  "should not have received it.\n"
454 
458 #define ALERT_MESSAGE_ATTACH \
459  "Task '$n': $e\n" \
460  "\n" \
461  "After the event $e,\n" \
462  "the following condition was met: $c\n" \
463  "\n" \
464  "This email escalation is configured to attach report format '$r'.\n" \
465  "Full details and other report formats are available on the scan engine.\n" \
466  "\n" \
467  "$t" \
468  "\n" \
469  "Note:\n" \
470  "This email was sent to you as a configured security scan escalation.\n" \
471  "Please contact your local system administrator if you think you\n" \
472  "should not have received it.\n"
473 
477 #define SECINFO_ALERT_MESSAGE_ATTACH \
478  "Task '$n': $e\n" \
479  "\n" \
480  "After the event $e,\n" \
481  "the following condition was met: $c\n" \
482  "\n" \
483  "This email escalation is configured to attach report format '$r'.\n" \
484  "Full details and other report formats are available on the scan engine.\n" \
485  "\n" \
486  "$t" \
487  "\n" \
488  "Note:\n" \
489  "This email was sent to you as a configured security scan escalation.\n" \
490  "Please contact your local system administrator if you think you\n" \
491  "should not have received it.\n"
492 
496 #define ALERT_VFIRE_CALL_DESCRIPTION \
497  "GVM Task '$n': $e\n" \
498  "\n" \
499  "After the event $e,\n" \
500  "the following condition was met: $c\n" \
501  "\n" \
502  "This ticket includes reports in the following format(s):\n" \
503  "$r.\n" \
504  "Full details and other report formats are available on the scan engine.\n" \
505  "\n" \
506  "$t" \
507  "\n" \
508  "Note:\n" \
509  "This ticket was created automatically as a security scan escalation.\n" \
510  "Please contact your local system administrator if you think it\n" \
511  "was created or assigned erroneously.\n"
512 
516 typedef enum
517 {
518  EVENT_ERROR,
519  EVENT_TASK_RUN_STATUS_CHANGED,
520  EVENT_NEW_SECINFO,
521  EVENT_UPDATED_SECINFO,
522  EVENT_TICKET_RECEIVED,
523  EVENT_ASSIGNED_TICKET_CHANGED,
524  EVENT_OWNED_TICKET_CHANGED
525 } event_t;
526 
530 typedef enum
531 {
532  ALERT_METHOD_ERROR,
533  ALERT_METHOD_EMAIL,
534  ALERT_METHOD_HTTP_GET,
535  ALERT_METHOD_SOURCEFIRE,
536  ALERT_METHOD_START_TASK,
537  ALERT_METHOD_SYSLOG,
538  ALERT_METHOD_VERINICE,
539  ALERT_METHOD_SEND,
540  ALERT_METHOD_SCP,
541  ALERT_METHOD_SNMP,
542  ALERT_METHOD_SMB,
543  ALERT_METHOD_TIPPINGPOINT,
544  ALERT_METHOD_VFIRE,
545 } alert_method_t;
546 
550 typedef enum
551 {
552  ALERT_CONDITION_ERROR,
553  ALERT_CONDITION_ALWAYS,
554  ALERT_CONDITION_SEVERITY_AT_LEAST,
555  ALERT_CONDITION_SEVERITY_CHANGED,
556  ALERT_CONDITION_FILTER_COUNT_AT_LEAST,
557  ALERT_CONDITION_FILTER_COUNT_CHANGED
558 } alert_condition_t;
559 
560 int
561 manage_check_alerts (GSList *, const gchar *);
562 
563 int
564 create_alert (const char *,
565  const char *,
566  const char *,
567  const char *,
568  event_t,
569  GPtrArray *,
570  alert_condition_t,
571  GPtrArray *,
572  alert_method_t,
573  GPtrArray *,
574  alert_t *);
575 
576 int
577 copy_alert (const char *, const char *, const char *, alert_t *);
578 
579 int
580 modify_alert (const char *,
581  const char *,
582  const char *,
583  const char *,
584  const char *,
585  event_t,
586  GPtrArray *,
587  alert_condition_t,
588  GPtrArray *,
589  alert_method_t,
590  GPtrArray *);
591 
592 int
593 delete_alert (const char *, int);
594 
595 char *alert_uuid (alert_t);
596 
597 gboolean
598 find_alert_with_permission (const char *, alert_t *, const char *);
599 
600 int
601 manage_alert (const char *, const char *, event_t, const void *, gchar **);
602 
603 int
604 manage_test_alert (const char *, gchar **);
605 
606 int alert_in_use (alert_t);
607 
608 int trash_alert_in_use (alert_t);
609 
610 int alert_writable (alert_t);
611 
612 int trash_alert_writable (alert_t);
613 
614 int
615 alert_count (const get_data_t *);
616 
617 int
619 
620 int
622 
623 int
625 
626 int
628 
629 char *
631 
632 char *
634 
635 int
637 
638 int
640 
641 int
643 
644 const char *alert_condition_name (alert_condition_t);
645 
646 gchar *alert_condition_description (alert_condition_t, alert_t);
647 
648 const char *event_name (event_t);
649 
650 gchar *
651 event_description (event_t, const void *, const char *);
652 
653 const char *alert_method_name (alert_method_t);
654 
655 alert_condition_t
656 alert_condition_from_name (const char *);
657 
658 event_t
659 event_from_name (const char *);
660 
661 alert_method_t
662 alert_method_from_name (const char *);
663 
664 void
665 init_alert_data_iterator (iterator_t *, alert_t, int, const char *);
666 
667 const char *
669 
670 const char *
672 
673 void
674 init_alert_task_iterator (iterator_t *, alert_t, int);
675 
676 const char *
678 
679 const char *
681 
682 int
684 
685 void
687 
688 const char *
689 task_alert_iterator_uuid (iterator_t *);
690 
691 const char *
692 task_alert_iterator_name (iterator_t *);
693 
694 /* Task global variables and preprocessor variables. */
695 
699 extern task_t current_scanner_task;
700 
701 extern report_t global_current_report;
702 
703 /* Task code specific to the representation of tasks. */
704 
705 unsigned int
706 task_count (const get_data_t *);
707 
708 int
710 
711 task_status_t
713 
714 const char *
716 
717 int
719 
720 int
722 
723 const char *
725 
726 const char *
728 
729 report_t
731 
732 const char *
734 
735 scanner_t
737 
738 int
739 task_uuid (task_t, char **);
740 
741 int task_in_trash (task_t);
742 
743 int
744 task_in_trash_id (const gchar *);
745 
746 int task_in_use (task_t);
747 
748 int trash_task_in_use (task_t);
749 
750 int task_writable (task_t);
751 
752 int task_alterable (task_t);
753 
754 int trash_task_writable (task_t);
755 
756 int task_average_scan_duration (task_t);
757 
758 char *task_owner_name (task_t);
759 
760 char *task_name (task_t);
761 
762 char *task_comment (task_t);
763 
764 char *task_hosts_ordering (task_t);
765 
766 scanner_t task_scanner (task_t);
767 
768 int task_scanner_in_trash (task_t);
769 
770 config_t task_config (task_t);
771 
772 char *task_config_uuid (task_t);
773 
774 char *task_config_name (task_t);
775 
776 int task_config_in_trash (task_t);
777 
778 void set_task_config (task_t, config_t);
779 
780 target_t task_target (task_t);
781 
782 int task_target_in_trash (task_t);
783 
784 void set_task_target (task_t, target_t);
785 
786 void
787 set_task_hosts_ordering (task_t, const char *);
788 
789 void set_task_scanner (task_t, scanner_t);
790 
791 char *task_description (task_t);
792 
793 void
794 set_task_description (task_t, char *, gsize);
795 
796 task_status_t task_run_status (task_t);
797 
798 void set_task_run_status (task_t, task_status_t);
799 
800 int
801 task_result_count (task_t, int);
802 
803 report_t task_running_report (task_t);
804 
805 int task_upload_progress (task_t);
806 
807 void
808 set_task_start_time_epoch (task_t, int);
809 
810 void
811 set_task_start_time_otp (task_t, char *);
812 
813 void
814 set_task_end_time (task_t task, char *time);
815 
816 void set_task_end_time_epoch (task_t, time_t);
817 
818 void add_task_alert (task_t, alert_t);
819 
820 void
821 set_task_alterable (task_t, int);
822 
823 int
824 set_task_groups (task_t, array_t *, gchar **);
825 
826 int
827 set_task_schedule (task_t, schedule_t, int);
828 
829 int
830 set_task_schedule_periods (const gchar *, int);
831 
832 int
833 set_task_schedule_periods_id (task_t, int);
834 
835 unsigned int task_report_count (task_t);
836 
837 int
838 task_last_report (task_t, report_t *);
839 
840 const char *
842  int,
843  int,
844  int,
845  double,
846  int,
847  int,
848  int,
849  double);
850 
851 const char *
852 task_trend (task_t, int, int);
853 
854 int task_schedule_periods (task_t);
855 
856 int
857 task_schedule_periods_uuid (const gchar *);
858 
859 schedule_t task_schedule (task_t);
860 
861 schedule_t
862 task_schedule_uuid (const gchar *);
863 
864 int task_schedule_in_trash (task_t);
865 
866 time_t
867 task_schedule_next_time_uuid (const gchar *);
868 
869 int task_schedule_next_time (task_t);
870 
871 char *
872 task_severity (task_t, int, int, int);
873 
874 int task_debugs_size (task_t);
875 
876 int task_holes_size (task_t);
877 
878 int task_infos_size (task_t);
879 
880 int task_logs_size (task_t);
881 
882 int task_warnings_size (task_t);
883 
884 int task_false_positive_size (task_t);
885 
886 task_t
887 make_task (char *, char *, int, int);
888 
889 void make_task_complete (task_t);
890 
891 int
892 copy_task (const char *, const char *, const char *, int, task_t *);
893 
894 void
895 set_task_name (task_t, const char *);
896 
897 gboolean
898 find_task_with_permission (const char *, task_t *, const char *);
899 
900 gboolean
901 find_trash_task_with_permission (const char *, task_t *, const char *);
902 
903 void reset_task (task_t);
904 
905 int
906 set_task_parameter (task_t, const char *, char *);
907 
908 char *task_observers (task_t);
909 
910 int
911 set_task_observers (task_t, const gchar *);
912 
913 int
914 request_delete_task_uuid (const char *, int);
915 
916 int
917 request_delete_task (task_t *);
918 
919 int
920 delete_task (task_t, int);
921 
922 /* For otp.c. */
923 int
924 delete_task_lock (task_t, int);
925 
926 void
927 append_to_task_comment (task_t, const char *, int);
928 
929 void
930 add_task_description_line (task_t, const char *, size_t);
931 
932 void
933 set_scan_ports (report_t, const char *, unsigned int, unsigned int);
934 
935 void
936 append_task_open_port (task_t task, const char *, const char *);
937 
938 int
939 manage_task_update_file (const gchar *, const char *, const void *);
940 
941 int
942 manage_task_remove_file (const gchar *, const char *);
943 
944 int
945 modify_task (const gchar *,
946  const gchar *,
947  const gchar *,
948  const gchar *,
949  const gchar *,
950  const gchar *,
951  const gchar *,
952  array_t *,
953  const gchar *,
954  array_t *,
955  const gchar *,
956  const gchar *,
957  array_t *,
958  const gchar *,
959  gchar **,
960  gchar **);
961 
962 void
963 init_config_file_iterator (iterator_t *, const char *, const char *);
964 
965 const char *
966 config_file_iterator_content (iterator_t *);
967 
968 int
969 config_file_iterator_length (iterator_t *);
970 
971 void
972 init_config_task_iterator (iterator_t *, config_t, int);
973 
974 const char *
975 config_task_iterator_name (iterator_t *);
976 
977 const char *
978 config_task_iterator_uuid (iterator_t *);
979 
980 int
982 
983 /* General severity related facilities. */
984 
985 int
986 severity_in_level (double, const char *);
987 
988 int
989 severity_matches_ov (double, double);
990 
991 const char *
992 severity_to_level (double, int);
993 
994 const char *
995 severity_to_type (double);
996 
1000 typedef struct
1001 {
1002  int *counts;
1003  int total;
1004  double max;
1005 } severity_data_t;
1006 
1007 double
1008 severity_data_value (int);
1009 
1010 void
1012 
1013 void
1015 
1016 void
1018 
1019 void
1020 severity_data_add_count (severity_data_t *, double, int);
1021 
1022 void
1024  const gchar *,
1025  int *,
1026  int *,
1027  int *,
1028  int *,
1029  int *,
1030  int *,
1031  int *);
1032 
1033 /* General task facilities. */
1034 
1035 const char *run_status_name (task_status_t);
1036 
1037 int
1038 start_task (const char *, char **);
1039 
1040 int
1041 stop_task (const char *);
1042 
1043 int
1044 resume_task (const char *, char **);
1045 
1046 int
1047 move_task (const char *, const char *);
1048 
1049 /* Access control. */
1050 
1051 int
1052 user_may (const char *);
1053 
1054 extern int
1055 user_can_everything (const char *);
1056 
1057 extern int
1058 user_can_super_everyone (const char *);
1059 
1060 extern int
1061 user_has_super (const char *, user_t);
1062 
1063 /* Results. */
1064 
1068 #define LSC_FAMILY_LIST \
1069  "'AIX Local Security Checks'," \
1070  " 'CentOS Local Security Checks'," \
1071  " 'Debian Local Security Checks'," \
1072  " 'Fedora Local Security Checks'," \
1073  " 'FreeBSD Local Security Checks'," \
1074  " 'Gentoo Local Security Checks'," \
1075  " 'HP-UX Local Security Checks'," \
1076  " 'Mac OS X Local Security Checks'," \
1077  " 'Mandrake Local Security Checks'," \
1078  " 'Red Hat Local Security Checks'," \
1079  " 'Solaris Local Security Checks'," \
1080  " 'SuSE Local Security Checks'," \
1081  " 'Ubuntu Local Security Checks'," \
1082  " 'Windows : Microsoft Bulletins'," \
1083  " 'Privilege escalation'"
1084 
1085 gboolean
1086 find_result_with_permission (const char *, result_t *, const char *);
1087 
1088 int
1089 result_uuid (result_t, char **);
1090 
1091 int
1092 result_detection_reference (result_t,
1093  report_t,
1094  const char *,
1095  const char *,
1096  char **,
1097  char **,
1098  char **,
1099  char **);
1100 
1101 /* Reports. */
1102 
1104 #define OVAS_MANAGE_REPORT_ID_LENGTH UUID_LEN_STR
1105 
1109 #define APPLY_OVERRIDES_DEFAULT 0
1110 
1114 #define QOD_DEFAULT 75
1115 
1119 #define MIN_QOD_DEFAULT 70
1120 
1121 void
1122 reports_clear_count_cache (int);
1123 
1124 void
1125 reports_clear_count_cache_for_override (override_t, int);
1126 
1127 void
1129  report_t,
1130  int,
1131  int,
1132  const char *);
1133 
1134 double
1135 report_severity (report_t, int, int);
1136 
1137 int report_host_count (report_t);
1138 
1139 int
1140 report_result_host_count (report_t, int);
1141 
1142 gboolean
1143 find_report_with_permission (const char *, report_t *, const char *);
1144 
1145 report_t
1146 make_report (task_t, const char *, task_status_t);
1147 
1148 int
1149 qod_from_type (const char *);
1150 
1151 result_t
1152 make_result (task_t,
1153  const char *,
1154  const char *,
1155  const char *,
1156  const char *,
1157  const char *,
1158  const char *);
1159 
1160 result_t
1161 make_osp_result (task_t,
1162  const char *,
1163  const char *,
1164  const char *,
1165  const char *,
1166  const char *,
1167  const char *,
1168  int);
1169 
1170 result_t
1171 make_cve_result (task_t, const char *, const char *, double, const char *);
1172 
1176 typedef struct
1177 {
1178  char *description;
1179  char *host;
1180  char *hostname;
1181  char *nvt_oid;
1183  char *port;
1184  char *qod;
1185  char *qod_type;
1186  char *severity;
1187  char *threat;
1189 
1193 typedef struct
1194 {
1195  char *ip;
1196  char *name;
1197  char *source_desc;
1198  char *source_name;
1199  char *source_type;
1200  char *value;
1201 } host_detail_t;
1202 
1203 void
1205 
1206 void
1207 insert_report_host_detail (report_t,
1208  const char *,
1209  const char *,
1210  const char *,
1211  const char *,
1212  const char *,
1213  const char *);
1214 
1215 int
1216 manage_report_host_detail (report_t, const char *, const char *);
1217 
1218 void hosts_set_identifiers (report_t);
1219 
1220 void
1221 hosts_set_max_severity (report_t, int *, int *);
1222 
1223 void
1224 hosts_set_details (report_t report);
1225 
1226 void clear_duration_schedules (task_t);
1227 
1228 void update_duration_schedule_periods (task_t);
1229 
1230 int
1231 create_report (array_t *,
1232  const char *,
1233  const char *,
1234  const char *,
1235  const char *,
1236  const char *,
1237  const char *,
1238  array_t *,
1239  array_t *,
1240  array_t *,
1241  char **);
1242 
1243 void report_add_result (report_t, result_t);
1244 
1245 char *report_uuid (report_t);
1246 
1247 void
1248 report_set_slave_uuid (report_t, const gchar *);
1249 
1250 void
1251 report_set_slave_name (report_t, const gchar *);
1252 
1253 void
1254 report_set_slave_host (report_t, const gchar *);
1255 
1256 void
1257 report_set_slave_port (report_t, int);
1258 
1259 void
1260 report_set_slave_username (report_t, const gchar *);
1261 
1262 void
1263 report_set_slave_password (report_t, const gchar *);
1264 
1265 void
1266 report_set_source_iface (report_t, const gchar *);
1267 
1268 int
1269 task_last_resumable_report (task_t, report_t *);
1270 
1271 gchar *task_second_last_report_id (task_t);
1272 
1273 gchar *
1274 report_path_task_uuid (gchar *);
1275 
1276 gboolean
1277 report_task (report_t, task_t *);
1278 
1279 char *report_slave_task_uuid (report_t);
1280 
1281 int
1282 report_scan_result_count (report_t,
1283  const char *,
1284  const char *,
1285  int,
1286  const char *,
1287  const char *,
1288  int,
1289  int,
1290  int *);
1291 
1292 int
1293 report_counts (const char *,
1294  int *,
1295  int *,
1296  int *,
1297  int *,
1298  int *,
1299  int *,
1300  double *,
1301  int,
1302  int,
1303  int);
1304 
1305 int
1306 report_counts_id (report_t,
1307  int *,
1308  int *,
1309  int *,
1310  int *,
1311  int *,
1312  int *,
1313  double *,
1314  const get_data_t *,
1315  const char *);
1316 
1317 int
1318 report_counts_id_no_filt (report_t,
1319  int *,
1320  int *,
1321  int *,
1322  int *,
1323  int *,
1324  int *,
1325  double *,
1326  const get_data_t *,
1327  const char *);
1328 
1329 get_data_t *
1330 report_results_get_data (int, int, int, int, int);
1331 
1332 int scan_start_time_epoch (report_t);
1333 
1334 char *
1335 scan_start_time_uuid (const char *);
1336 
1337 char *
1338 scan_end_time_uuid (const char *);
1339 
1340 void
1341 set_scan_start_time_otp (report_t, const char *);
1342 
1343 void set_scan_start_time_epoch (report_t, time_t);
1344 
1345 void
1346 set_scan_end_time (report_t, const char *);
1347 
1348 void
1349 set_scan_end_time_otp (report_t, const char *);
1350 
1351 void set_scan_end_time_epoch (report_t, time_t);
1352 
1353 void
1354 set_scan_host_start_time_otp (report_t, const char *, const char *);
1355 
1356 int
1357 scan_host_end_time (report_t, const char *);
1358 
1359 void
1360 set_scan_host_end_time (report_t, const char *, const char *);
1361 
1362 void
1363 set_scan_host_end_time_otp (report_t, const char *, const char *);
1364 
1365 int
1366 report_timestamp (const char *, gchar **);
1367 
1368 int
1369 modify_report (const char *, const char *);
1370 
1371 int
1372 delete_report (const char *, int);
1373 
1374 int
1375 report_count (const get_data_t *);
1376 
1377 int
1379 
1380 void
1382 
1383 void
1385 
1386 const char *
1387 report_iterator_uuid (iterator_t *);
1388 
1389 int
1390 result_count (const get_data_t *, report_t, const char *);
1391 
1392 int
1394  const get_data_t *,
1395  report_t,
1396  const char *,
1397  const gchar *);
1398 
1399 gboolean
1400 next_report (iterator_t *, report_t *);
1401 
1402 result_t
1404 
1405 const char *
1406 result_iterator_host (iterator_t *);
1407 
1408 const char *
1409 result_iterator_port (iterator_t *);
1410 
1411 const char *
1412 result_iterator_nvt_oid (iterator_t *);
1413 
1414 const char *
1416 
1417 const char *
1419 
1420 const char *
1422 
1423 const char *
1425 
1426 const char *
1428 
1429 const char *
1431 
1432 const char *
1434 
1435 const char *
1436 result_iterator_descr (iterator_t *);
1437 
1438 task_t
1440 
1441 report_t
1443 
1444 const char *
1446 
1447 const char *
1449 
1450 double
1452 
1453 const char *
1455 
1456 const char *
1458 
1459 const char *
1460 result_iterator_solution_type (iterator_t *);
1461 
1462 const char *
1463 result_iterator_qod (iterator_t *);
1464 
1465 const char *
1466 result_iterator_qod_type (iterator_t *);
1467 
1468 const char *
1469 result_iterator_hostname (iterator_t *);
1470 
1471 const char *
1472 result_iterator_date (iterator_t *);
1473 
1474 const char *
1475 result_iterator_detected_by_oid (iterator_t *);
1476 
1477 const char *
1478 result_iterator_asset_host_id (iterator_t *);
1479 
1480 int
1482 
1483 int
1485 
1486 int
1488 
1489 int
1491 
1492 int
1494 
1495 void
1496 init_report_host_iterator (iterator_t *, report_t, const char *, report_host_t);
1497 
1498 const char *
1499 host_iterator_host (iterator_t *);
1500 
1501 const char *
1502 host_iterator_start_time (iterator_t *);
1503 
1504 const char *
1505 host_iterator_end_time (iterator_t *);
1506 
1507 int
1509 
1510 int
1512 
1513 int
1514 collate_message_type (void *data, int, const void *, int, const void *);
1515 
1516 void trim_partial_report (report_t);
1517 
1518 int
1519 report_progress (report_t, task_t, gchar **);
1520 
1521 gchar *
1522 manage_report (report_t,
1523  report_t,
1524  const get_data_t *,
1525  report_format_t,
1526  int,
1527  int,
1528  const char *,
1529  gsize *,
1530  gchar **,
1531  gchar **,
1532  gchar **,
1533  gchar **,
1534  gchar **);
1535 
1536 int
1537 manage_send_report (report_t,
1538  report_t,
1539  report_format_t,
1540  const get_data_t *,
1541  int,
1542  int,
1543  int,
1544  int,
1545  int,
1546  gboolean (*) (const char *,
1547  int (*) (const char *, void *),
1548  void *),
1549  int (*) (const char *, void *),
1550  void *,
1551  const char *,
1552  const char *,
1553  const char *,
1554  int,
1555  const char *,
1556  const char *,
1557  int,
1558  int,
1559  const gchar *);
1560 
1561 /* Reports. */
1562 
1563 gchar *
1564 app_location (report_host_t, const gchar *);
1565 
1566 void
1568  report_host_t,
1569  int,
1570  int,
1571  const char *,
1572  const char *,
1573  int,
1574  const char *);
1575 
1576 double
1578 
1579 const char *
1580 prognosis_iterator_cpe (iterator_t *);
1581 
1582 const char *
1583 prognosis_iterator_cve (iterator_t *);
1584 
1585 const char *
1586 prognosis_iterator_description (iterator_t *);
1587 
1588 /* Targets. */
1589 
1595 #define MANAGE_ABSOLUTE_MAX_IPS_PER_TARGET 70000
1596 
1600 #define MANAGE_MAX_HOSTS 4095
1601 
1605 #define MANAGE_USER_MAX_HOSTS 16777216
1606 
1607 int
1608 manage_max_hosts ();
1609 
1610 void
1611 manage_filter_controls (const gchar *, int *, int *, gchar **, int *);
1612 
1613 void
1614 manage_report_filter_controls (const gchar *,
1615  int *,
1616  int *,
1617  gchar **,
1618  int *,
1619  int *,
1620  gchar **,
1621  gchar **,
1622  gchar **,
1623  gchar **,
1624  int *,
1625  int *,
1626  int *,
1627  int *,
1628  int *,
1629  gchar **);
1630 
1631 gchar *
1632 manage_clean_filter (const gchar *);
1633 
1634 gchar *
1635 manage_clean_filter_remove (const gchar *, const gchar *);
1636 
1637 int
1638 manage_count_hosts (const char *, const char *);
1639 
1640 gboolean
1641 find_target_with_permission (const char *, target_t *, const char *);
1642 
1643 int
1644 create_target (const char *,
1645  const char *,
1646  const char *,
1647  const char *,
1648  const char *,
1649  const char *,
1650  const char *,
1651  credential_t,
1652  const char *,
1653  credential_t,
1654  credential_t,
1655  credential_t,
1656  const char *,
1657  const char *,
1658  const char *,
1659  target_t *);
1660 
1661 int
1662 copy_target (const char *, const char *, const char *, target_t *);
1663 
1664 int
1665 modify_target (const char *,
1666  const char *,
1667  const char *,
1668  const char *,
1669  const char *,
1670  const char *,
1671  const char *,
1672  const char *,
1673  const char *,
1674  const char *,
1675  const char *,
1676  const char *,
1677  const char *,
1678  const char *);
1679 
1680 int
1681 delete_target (const char *, int);
1682 
1683 int
1684 target_count (const get_data_t *);
1685 
1686 void
1687 init_user_target_iterator (iterator_t *, target_t);
1688 
1689 void
1690 init_target_iterator_one (iterator_t *, target_t);
1691 
1692 int
1694 
1695 const char *
1696 target_iterator_hosts (iterator_t *);
1697 
1698 const char *
1699 target_iterator_exclude_hosts (iterator_t *);
1700 
1701 const char *
1702 target_iterator_reverse_lookup_only (iterator_t *);
1703 
1704 const char *
1705 target_iterator_reverse_lookup_unify (iterator_t *);
1706 
1707 const char *
1708 target_iterator_comment (iterator_t *);
1709 
1710 int
1712 
1713 const char *
1714 target_iterator_ssh_port (iterator_t *);
1715 
1716 int
1718 
1719 int
1721 
1722 int
1724 
1725 int
1727 
1728 int
1730 
1731 int
1733 
1734 int
1736 
1737 const char *
1738 target_iterator_port_list_uuid (iterator_t *);
1739 
1740 const char *
1741 target_iterator_port_list_name (iterator_t *);
1742 
1743 int
1745 
1746 const char *
1748 
1749 char *target_uuid (target_t);
1750 
1751 char *trash_target_uuid (target_t);
1752 
1753 char *target_name (target_t);
1754 
1755 char *trash_target_name (target_t);
1756 
1757 int trash_target_readable (target_t);
1758 
1759 char *target_hosts (target_t);
1760 
1761 char *target_exclude_hosts (target_t);
1762 
1763 char *target_reverse_lookup_only (target_t);
1764 
1765 char *target_reverse_lookup_unify (target_t);
1766 
1767 char *target_port_range (target_t);
1768 
1769 char *target_ssh_port (target_t);
1770 
1771 int target_in_use (target_t);
1772 
1773 int trash_target_in_use (target_t);
1774 
1775 int target_writable (target_t);
1776 
1777 int trash_target_writable (target_t);
1778 
1779 char *
1780 target_ssh_credential_name (const char *);
1781 
1782 void
1784 
1785 const char *
1786 target_task_iterator_name (iterator_t *);
1787 
1788 const char *
1789 target_task_iterator_uuid (iterator_t *);
1790 
1791 int
1793 
1794 credential_t
1795 target_credential (target_t, const char *);
1796 
1797 credential_t
1798 trash_target_credential (target_t, const char *);
1799 
1800 int
1801 trash_target_credential_location (target_t, const char *);
1802 
1803 int
1804 target_login_port (target_t, const char *);
1805 
1806 int
1807 trash_target_login_port (target_t, const char *);
1808 
1809 /* Configs. */
1810 
1814 typedef struct
1815 {
1816  char *name;
1817  char *type;
1818  char *value;
1819  char *nvt_name;
1820  char *nvt_oid;
1821  array_t *alts;
1823  char *hr_name;
1824 } preference_t;
1825 
1829 typedef struct
1830 {
1831  char *name;
1832  char *type;
1833  int include;
1835 } nvt_selector_t;
1836 
1837 int
1838 create_config (const char *,
1839  const char *,
1840  const array_t *,
1841  const array_t *,
1842  const char *,
1843  config_t *,
1844  char **);
1845 
1846 int
1847 create_config_from_scanner (const char *, const char *, const char *, char **);
1848 
1849 int
1850 copy_config (const char *, const char *, const char *, config_t *);
1851 
1852 int
1853 delete_config (const char *, int);
1854 
1855 int
1856 sync_config (const char *);
1857 
1858 gboolean
1859 find_config_with_permission (const char *, config_t *, const char *);
1860 
1861 char *config_uuid (config_t);
1862 
1863 int config_type (config_t);
1864 
1865 char *
1866 config_nvt_timeout (config_t, const char *);
1867 
1868 void
1869 init_user_config_iterator (iterator_t *, config_t, int, int, const char *);
1870 
1871 int
1873 
1874 const char *
1875 config_iterator_nvt_selector (iterator_t *);
1876 
1877 int
1879 
1880 int
1882 
1883 int
1885 
1886 int
1888 
1889 int
1891 
1892 scanner_t
1894 
1895 int
1897 
1898 char *config_nvt_selector (config_t);
1899 
1900 int config_in_use (config_t);
1901 
1902 int config_writable (config_t);
1903 
1904 int
1905 config_count (const get_data_t *);
1906 
1907 int trash_config_in_use (config_t);
1908 
1909 int trash_config_writable (config_t);
1910 
1911 int
1912 trash_config_readable_uuid (const gchar *);
1913 
1914 int config_families_growing (config_t);
1915 
1916 int config_nvts_growing (config_t);
1917 
1918 int create_task_check_config_scanner (config_t, scanner_t);
1919 
1920 int
1921 modify_task_check_config_scanner (task_t, const char *, const char *);
1922 
1923 int
1924 manage_set_config_preference (const gchar *,
1925  const char *,
1926  const char *,
1927  const char *);
1928 
1929 void
1930 init_preference_iterator (iterator_t *, config_t);
1931 
1932 const char *
1933 preference_iterator_name (iterator_t *);
1934 
1935 const char *
1936 preference_iterator_value (iterator_t *);
1937 
1938 const char *
1939 preference_iterator_type (iterator_t *);
1940 
1941 const char *
1942 preference_iterator_default (iterator_t *);
1943 
1944 const char *
1945 preference_iterator_hr_name (iterator_t *);
1946 
1947 int
1948 manage_set_config (const gchar *, const char *, const char *, const char *);
1949 
1950 int
1951 manage_set_config_nvts (const gchar *, const char *, GPtrArray *);
1952 
1953 int
1954 manage_set_config_families (const gchar *,
1955  GPtrArray *,
1956  GPtrArray *,
1957  GPtrArray *,
1958  int);
1959 
1960 void
1962 
1963 const char *
1964 config_timeout_iterator_oid (iterator_t *);
1965 
1966 const char *
1967 config_timeout_iterator_nvt_name (iterator_t *);
1968 
1969 const char *
1970 config_timeout_iterator_value (iterator_t *);
1971 
1972 void update_config_preference (const char *, const char *, const char *,
1973  const char *, gboolean);
1974 
1975 /* NVT's. */
1976 
1977 char *manage_nvt_name (nvt_t);
1978 
1979 char *
1980 nvt_oid (const char *);
1981 
1982 char *
1984 
1985 void
1986 set_nvts_feed_version (const char *);
1987 
1988 gboolean
1989 find_nvt (const char *, nvt_t *);
1990 
1991 int
1992 init_nvt_info_iterator (iterator_t *, get_data_t *, const char *);
1993 
1994 int
1995 nvt_info_count (const get_data_t *);
1996 
1997 void
1999  nvt_t,
2000  config_t,
2001  const char *,
2002  const char *,
2003  int,
2004  const char *);
2005 
2006 void
2007 init_cve_nvt_iterator (iterator_t *, const char *, int, const char *);
2008 
2009 const char *
2010 nvt_iterator_oid (iterator_t *);
2011 
2012 const char *
2013 nvt_iterator_version (iterator_t *);
2014 
2015 const char *
2016 nvt_iterator_name (iterator_t *);
2017 
2018 const char *
2019 nvt_iterator_description (iterator_t *);
2020 
2021 const char *
2022 nvt_iterator_copyright (iterator_t *);
2023 
2024 const char *
2025 nvt_iterator_cve (iterator_t *);
2026 
2027 const char *
2028 nvt_iterator_bid (iterator_t *);
2029 
2030 const char *
2031 nvt_iterator_xref (iterator_t *);
2032 
2033 const char *
2034 nvt_iterator_tag (iterator_t *);
2035 
2036 int
2038 
2039 const char *
2040 nvt_iterator_family (iterator_t *);
2041 
2042 const char *
2043 nvt_iterator_cvss_base (iterator_t *);
2044 
2045 const char *
2046 nvt_iterator_qod (iterator_t *);
2047 
2048 const char *
2049 nvt_iterator_qod_type (iterator_t *iterator);
2050 
2051 const char *
2052 nvt_iterator_solution_type (iterator_t *);
2053 
2054 char *
2055 nvt_default_timeout (const char *);
2056 
2057 int
2058 family_nvt_count (const char *);
2059 
2060 void
2061 manage_complete_nvt_cache_update (GList *, GList *);
2062 
2063 /* NVT selectors. */
2064 
2068 #define NVT_SELECTOR_TYPE_ALL 0
2069 
2073 #define NVT_SELECTOR_TYPE_FAMILY 1
2074 
2078 #define NVT_SELECTOR_TYPE_NVT 2
2079 
2083 #define NVT_SELECTOR_TYPE_ANY 999
2084 
2085 void
2086 init_family_iterator (iterator_t *, int, const char *, int);
2087 
2088 const char *
2089 family_iterator_name (iterator_t *);
2090 
2091 int
2092 nvt_selector_family_growing (const char *, const char *, int);
2093 
2094 int
2095 nvt_selector_family_count (const char *, int);
2096 
2097 int
2098 nvt_selector_nvt_count (const char *, const char *, int);
2099 
2100 void
2101 init_nvt_selector_iterator (iterator_t *, const char *, config_t, int);
2102 
2103 const char *
2104 nvt_selector_iterator_nvt (iterator_t *);
2105 
2106 const char *
2107 nvt_selector_iterator_name (iterator_t *);
2108 
2109 int
2111 
2112 int
2114 
2115 /* NVT preferences. */
2116 
2117 void
2118 manage_nvt_preference_add (const char *, const char *);
2119 
2120 void
2122 
2123 void
2124 init_nvt_preference_iterator (iterator_t *, const char *);
2125 
2126 const char *
2127 nvt_preference_iterator_name (iterator_t *);
2128 
2129 const char *
2130 nvt_preference_iterator_value (iterator_t *);
2131 
2132 char *
2134 
2135 char *
2137 
2138 char *
2140 
2141 char *
2143 
2144 int
2145 nvt_preference_count (const char *);
2146 
2147 gchar *
2148 get_nvti_xml (iterator_t *, int, int, int, const char *, config_t, int);
2149 
2150 char *
2151 task_preference_value (task_t, const char *);
2152 
2153 int
2154 set_task_preferences (task_t, array_t *);
2155 
2156 void
2158 
2159 const char *
2160 task_group_iterator_name (iterator_t *);
2161 
2162 const char *
2163 task_group_iterator_uuid (iterator_t *);
2164 
2165 void
2167 
2168 const char *
2169 task_role_iterator_name (iterator_t *);
2170 
2171 const char *
2172 task_role_iterator_uuid (iterator_t *);
2173 
2174 /* Credentials. */
2175 
2179 typedef enum
2180 {
2181  CREDENTIAL_FORMAT_NONE = 0,
2182  CREDENTIAL_FORMAT_KEY = 1,
2183  CREDENTIAL_FORMAT_RPM = 2,
2184  CREDENTIAL_FORMAT_DEB = 3,
2185  CREDENTIAL_FORMAT_EXE = 4,
2186  CREDENTIAL_FORMAT_PEM = 5,
2187  CREDENTIAL_FORMAT_ERROR = -1
2188 } credential_format_t;
2189 
2190 gboolean
2191 find_credential_with_permission (const char *, credential_t *, const char *);
2192 
2193 int
2194 create_credential (const char *,
2195  const char *,
2196  const char *,
2197  const char *,
2198  const char *,
2199  const char *,
2200  const char *,
2201  const char *,
2202  const char *,
2203  const char *,
2204  const char *,
2205  const char *,
2206  const char *,
2207  credential_t *);
2208 
2209 int
2210 copy_credential (const char *, const char *, const char *, credential_t *);
2211 
2212 int
2213 modify_credential (const char *,
2214  const char *,
2215  const char *,
2216  const char *,
2217  const char *,
2218  const char *,
2219  const char *,
2220  const char *,
2221  const char *,
2222  const char *,
2223  const char *,
2224  const char *,
2225  const char *);
2226 
2227 int
2228 delete_credential (const char *, int);
2229 
2230 int
2231 credential_count (const get_data_t *);
2232 
2233 void
2234 set_credential_privacy_algorithm (credential_t, const char *);
2235 
2236 void
2237 set_credential_public_key (credential_t, const char *);
2238 
2239 void
2240 init_credential_iterator_one (iterator_t *, credential_t);
2241 
2242 int
2244 
2245 const char *
2246 credential_iterator_login (iterator_t *);
2247 
2248 const char *
2249 credential_iterator_auth_algorithm (iterator_t *);
2250 
2251 const char *
2252 credential_iterator_privacy_algorithm (iterator_t *);
2253 
2254 const char *
2256 
2257 const char *
2259 
2260 const char *
2262 
2263 const char *
2264 credential_iterator_public_key (iterator_t *);
2265 
2266 const char *
2268 
2269 const char *
2270 credential_iterator_type (iterator_t *);
2271 
2272 int
2274 
2275 const char *
2276 credential_full_type (const char *);
2277 
2278 char *
2280 
2281 char *
2283 
2284 char *
2286 
2287 const char *
2288 credential_iterator_certificate (iterator_t *);
2289 
2290 gboolean
2291 credential_iterator_format_available (iterator_t *, credential_format_t);
2292 
2293 gchar *
2295 
2296 char *credential_uuid (credential_t);
2297 
2298 char *trash_credential_uuid (credential_t);
2299 
2300 char *credential_name (credential_t);
2301 
2302 char *trash_credential_name (credential_t);
2303 
2304 char *credential_type (credential_t);
2305 
2306 void
2307 init_credential_target_iterator (iterator_t *, credential_t, int);
2308 
2309 const char *
2310 credential_target_iterator_uuid (iterator_t *);
2311 
2312 const char *
2313 credential_target_iterator_name (iterator_t *);
2314 
2315 int
2317 
2318 void
2319 init_credential_scanner_iterator (iterator_t *, credential_t, int);
2320 
2321 const char *
2322 credential_scanner_iterator_uuid (iterator_t *);
2323 
2324 const char *
2325 credential_scanner_iterator_name (iterator_t *);
2326 
2327 int
2329 
2330 int trash_credential_in_use (credential_t);
2331 
2332 int credential_in_use (credential_t);
2333 
2334 int trash_credential_writable (credential_t);
2335 
2336 int credential_writable (credential_t);
2337 
2338 int trash_credential_readable (credential_t);
2339 
2340 gchar *
2341 credential_value (credential_t, const char *);
2342 
2343 gchar *
2344 credential_encrypted_value (credential_t, const char *);
2345 
2346 /* Agents. */
2347 
2348 int
2349 create_agent (const char *,
2350  const char *,
2351  const char *,
2352  const char *,
2353  const char *,
2354  const char *,
2355  const char *,
2356  agent_t *);
2357 
2358 int
2359 copy_agent (const char *, const char *, const char *, agent_t *);
2360 
2361 int
2362 modify_agent (const char *, const char *, const char *);
2363 
2364 int
2365 delete_agent (const char *, int);
2366 
2367 int agent_in_use (agent_t);
2368 
2369 int trash_agent_in_use (agent_t);
2370 
2371 int trash_agent_writable (agent_t);
2372 
2373 int agent_writable (agent_t);
2374 
2375 int
2376 verify_agent (const char *);
2377 
2378 char *agent_uuid (agent_t);
2379 
2380 int
2381 agent_count (const get_data_t *);
2382 
2383 int
2385 
2386 const char *
2387 agent_iterator_installer_64 (iterator_t *);
2388 
2389 const char *
2390 agent_iterator_installer_filename (iterator_t *);
2391 
2392 const char *
2394 
2395 time_t
2397 
2398 const char *
2399 agent_iterator_howto_install (iterator_t *);
2400 
2401 const char *
2402 agent_iterator_howto_use (iterator_t *);
2403 
2404 /* Assets. */
2405 
2406 char *
2407 result_host_asset_id (const char *, result_t);
2408 
2409 char *host_uuid (resource_t);
2410 
2411 host_t
2412 host_notice (const char *,
2413  const char *,
2414  const char *,
2415  const char *,
2416  const char *,
2417  int,
2418  int);
2419 
2420 void
2421 init_host_identifier_iterator (iterator_t *, host_t, int, const char *);
2422 
2423 const char *
2424 host_identifier_iterator_value (iterator_t *);
2425 
2426 const char *
2427 host_identifier_iterator_source_type (iterator_t *);
2428 
2429 const char *
2430 host_identifier_iterator_source_id (iterator_t *);
2431 
2432 const char *
2433 host_identifier_iterator_source_data (iterator_t *);
2434 
2435 int
2436 host_identifier_iterator_source_orphan (iterator_t *);
2437 
2438 const char *
2439 host_identifier_iterator_os_id (iterator_t *);
2440 
2441 const char *
2442 host_identifier_iterator_os_title (iterator_t *);
2443 
2444 int
2445 init_asset_host_iterator (iterator_t *, const get_data_t *);
2446 
2447 int
2448 asset_iterator_writable (iterator_t *);
2449 
2450 int
2451 asset_iterator_in_use (iterator_t *);
2452 
2453 const char *
2454 asset_host_iterator_severity (iterator_t *);
2455 
2456 int
2457 asset_host_count (const get_data_t *);
2458 
2459 int
2460 init_asset_os_iterator (iterator_t *, const get_data_t *);
2461 
2462 const char *
2463 asset_os_iterator_title (iterator_t *);
2464 
2465 int
2466 asset_os_iterator_installs (iterator_t *);
2467 
2468 const char *
2469 asset_os_iterator_latest_severity (iterator_t *);
2470 
2471 const char *
2472 asset_os_iterator_highest_severity (iterator_t *);
2473 
2474 const char *
2475 asset_os_iterator_average_severity (iterator_t *);
2476 
2477 int
2478 asset_os_count (const get_data_t *);
2479 
2480 int
2481 total_asset_count (const get_data_t *);
2482 
2483 void
2484 init_os_host_iterator (iterator_t *, resource_t);
2485 
2486 const char *
2487 os_host_iterator_severity (iterator_t *);
2488 
2489 void
2490 init_host_detail_iterator (iterator_t *, resource_t);
2491 
2492 const char *
2493 host_detail_iterator_name (iterator_t *);
2494 
2495 const char *
2496 host_detail_iterator_value (iterator_t *);
2497 
2498 const char *
2499 host_detail_iterator_source_type (iterator_t *);
2500 
2501 const char *
2502 host_detail_iterator_source_id (iterator_t *);
2503 
2504 int
2505 modify_asset (const char *, const char *);
2506 
2507 int
2508 delete_asset (const char *, const char *, int);
2509 
2510 int
2511 create_asset_report (const char *, const char *);
2512 
2513 int
2514 create_asset_host (const char *, const char *, resource_t *);
2515 
2516 /* Notes. */
2517 
2518 gboolean
2519 find_note_with_permission (const char *, note_t *, const char *);
2520 
2521 int
2522 create_note (const char *,
2523  const char *,
2524  const char *,
2525  const char *,
2526  const char *,
2527  const char *,
2528  const char *,
2529  task_t,
2530  result_t,
2531  note_t *);
2532 
2533 int
2534 copy_note (const char *, note_t *);
2535 
2536 int
2537 delete_note (const char *, int);
2538 
2539 int
2540 note_uuid (note_t, char **);
2541 
2542 int
2543 modify_note (const gchar *,
2544  const char *,
2545  const char *,
2546  const char *,
2547  const char *,
2548  const char *,
2549  const char *,
2550  const char *,
2551  const gchar *,
2552  const gchar *);
2553 
2554 int
2555 note_count (const get_data_t *, nvt_t, result_t, task_t);
2556 
2557 int
2558 init_note_iterator (iterator_t *, const get_data_t *, nvt_t, result_t, task_t);
2559 
2560 const char *
2561 note_iterator_nvt_oid (iterator_t *);
2562 
2563 time_t
2564 note_iterator_creation_time (iterator_t *);
2565 
2566 time_t
2567 note_iterator_modification_time (iterator_t *);
2568 
2569 const char *
2570 note_iterator_text (iterator_t *);
2571 
2572 const char *
2573 note_iterator_hosts (iterator_t *);
2574 
2575 const char *
2576 note_iterator_port (iterator_t *);
2577 
2578 const char *
2580 
2581 task_t
2583 
2584 result_t
2586 
2587 time_t
2589 
2590 int
2592 
2593 const char *
2594 note_iterator_nvt_name (iterator_t *);
2595 
2596 const char *
2598 
2599 const char *
2600 note_iterator_severity (iterator_t *);
2601 
2602 /* Overrides. */
2603 
2604 gboolean
2605 find_override_with_permission (const char *, override_t *, const char *);
2606 
2607 int
2608 create_override (const char *,
2609  const char *,
2610  const char *,
2611  const char *,
2612  const char *,
2613  const char *,
2614  const char *,
2615  const char *,
2616  const char *,
2617  task_t,
2618  result_t,
2619  override_t *);
2620 
2621 int
2622 override_uuid (override_t, char **);
2623 
2624 int
2625 copy_override (const char *, override_t *);
2626 
2627 int
2628 delete_override (const char *, int);
2629 
2630 int
2631 modify_override (const gchar *,
2632  const char *,
2633  const char *,
2634  const char *,
2635  const char *,
2636  const char *,
2637  const char *,
2638  const char *,
2639  const char *,
2640  const char *,
2641  const gchar *,
2642  const gchar *);
2643 
2644 int
2645 override_count (const get_data_t *, nvt_t, result_t, task_t);
2646 
2647 int
2649  const get_data_t *,
2650  nvt_t,
2651  result_t,
2652  task_t);
2653 
2654 const char *
2655 override_iterator_nvt_oid (iterator_t *);
2656 
2657 time_t
2658 override_iterator_creation_time (iterator_t *);
2659 
2660 time_t
2661 override_iterator_modification_time (iterator_t *);
2662 
2663 const char *
2664 override_iterator_text (iterator_t *);
2665 
2666 const char *
2667 override_iterator_hosts (iterator_t *);
2668 
2669 const char *
2670 override_iterator_port (iterator_t *);
2671 
2672 const char *
2674 
2675 const char *
2677 
2678 task_t
2680 
2681 result_t
2683 
2684 time_t
2686 
2687 int
2689 
2690 const char *
2691 override_iterator_nvt_name (iterator_t *);
2692 
2693 const char *
2695 
2696 const char *
2697 override_iterator_severity (iterator_t *);
2698 
2699 const char *
2700 override_iterator_new_severity (iterator_t *);
2701 
2702 /* Scanner messaging. */
2703 
2704 int
2705 acknowledge_bye ();
2706 
2707 int
2709 
2710 int
2712 
2713 /* System reports. */
2714 
2718 typedef struct
2719 {
2720  gchar **start;
2721  gchar **current;
2723 
2724 int
2726  const char *,
2727  const char *);
2728 
2729 void
2731 
2732 gboolean
2734 
2735 const char *
2737 
2738 const char *
2740 
2741 int
2742 manage_system_report (const char *,
2743  const char *,
2744  const char *,
2745  const char *,
2746  const char *,
2747  char **);
2748 
2749 int
2750 manage_slave_check_period ();
2751 
2752 
2753 /* Scanners. */
2754 
2758 #define SLAVE_COMMIT_SIZE_DEFAULT 0
2759 
2760 int
2761 manage_create_scanner (GSList *,
2762  const char *,
2763  const char *,
2764  const char *,
2765  const char *,
2766  const char *,
2767  const char *,
2768  const char *,
2769  const char *);
2770 
2771 int
2772 manage_modify_scanner (GSList *,
2773  const gchar *,
2774  const char *,
2775  const char *,
2776  const char *,
2777  const char *,
2778  const char *,
2779  const char *,
2780  const char *,
2781  const char *);
2782 
2783 int
2784 manage_delete_scanner (GSList *, const gchar *, const gchar *);
2785 
2786 int
2787 manage_verify_scanner (GSList *, const gchar *, const gchar *);
2788 
2789 int
2790 manage_get_scanners (GSList *, const gchar *);
2791 
2792 int
2793 create_scanner (const char *,
2794  const char *,
2795  const char *,
2796  const char *,
2797  const char *,
2798  scanner_t *,
2799  const char *,
2800  const char *);
2801 
2802 int
2803 copy_scanner (const char *, const char *, const char *, scanner_t *);
2804 
2805 int
2806 modify_scanner (const char *,
2807  const char *,
2808  const char *,
2809  const char *,
2810  const char *,
2811  const char *,
2812  const char *,
2813  const char *);
2814 
2815 int
2816 delete_scanner (const char *, int);
2817 
2818 gboolean
2819 find_scanner_with_permission (const char *, scanner_t *, const char *);
2820 
2821 int scanner_in_use (scanner_t);
2822 
2823 int trash_scanner_readable (scanner_t);
2824 
2825 int trash_scanner_in_use (scanner_t);
2826 
2827 int trash_scanner_writable (scanner_t);
2828 
2829 int scanner_writable (scanner_t);
2830 
2831 const char *
2833 
2834 char *scanner_host (scanner_t);
2835 
2836 int scanner_port (scanner_t);
2837 
2838 int scanner_type (scanner_t);
2839 
2840 char *scanner_ca_pub (scanner_t);
2841 
2842 char *scanner_key_pub (scanner_t);
2843 
2844 char *scanner_key_priv (scanner_t);
2845 
2846 char *scanner_login (scanner_t);
2847 
2848 char *scanner_password (scanner_t);
2849 
2850 int
2851 scanner_count (const get_data_t *);
2852 
2853 int
2855 
2856 const char *
2857 scanner_iterator_host (iterator_t *);
2858 
2859 int
2861 
2862 int
2864 
2865 const char *
2866 scanner_iterator_credential_name (iterator_t *);
2867 
2868 credential_t
2870 
2871 int
2873 
2874 const char *
2875 scanner_iterator_ca_pub (iterator_t *);
2876 
2877 const char *
2878 scanner_iterator_key_pub (iterator_t *);
2879 
2880 const char *
2881 scanner_iterator_credential_type (iterator_t *);
2882 
2883 void
2885 
2886 const char *
2887 scanner_config_iterator_uuid (iterator_t *);
2888 
2889 const char *
2890 scanner_config_iterator_name (iterator_t *);
2891 
2892 int
2894 
2895 void
2896 init_scanner_task_iterator (iterator_t *, scanner_t);
2897 
2898 const char *
2899 scanner_task_iterator_uuid (iterator_t *);
2900 
2901 const char *
2902 scanner_task_iterator_name (iterator_t *);
2903 
2904 int
2906 
2907 char *scanner_name (scanner_t);
2908 
2909 char *scanner_uuid (scanner_t);
2910 
2911 char *trash_scanner_name (scanner_t);
2912 
2913 char *trash_scanner_uuid (scanner_t);
2914 
2915 int
2917  char **,
2918  char **,
2919  char **,
2920  char **,
2921  char **,
2922  char **);
2923 
2924 int
2925 osp_get_details_from_iterator (iterator_t *, char **, GSList **);
2926 
2927 osp_connection_t *osp_scanner_connect (scanner_t);
2928 
2929 int
2930 verify_scanner (const char *, char **);
2931 
2932 void
2933 set_slave_commit_size (int);
2934 
2935 /* Scheduling. */
2936 
2940 #define SCHEDULE_PERIOD 10
2941 
2946 #define SCHEDULE_TIMEOUT_MIN_SECS 20
2947 
2951 #define SCHEDULE_TIMEOUT_DEFAULT 60
2952 
2953 gboolean
2954 find_schedule_with_permission (const char *, schedule_t *, const char *);
2955 
2956 int
2957 create_schedule (const char *,
2958  const char *,
2959  const char *,
2960  time_t,
2961  time_t,
2962  time_t,
2963  const char *,
2964  time_t,
2965  const char *,
2966  schedule_t *,
2967  gchar **);
2968 
2969 int
2970 copy_schedule (const char *, const char *, const char *, schedule_t *);
2971 
2972 int
2973 delete_schedule (const char *, int);
2974 
2975 void
2976 manage_auth_allow_all (int);
2977 
2978 const gchar *
2980 
2981 void
2982 set_scheduled_user_uuid (const gchar *uuid);
2983 
2984 void
2985 manage_sync (sigset_t *, int (*fork_update_nvt_cache) ());
2986 
2987 int
2988 manage_schedule (manage_connection_forker_t, gboolean, sigset_t *);
2989 
2990 char *schedule_uuid (schedule_t);
2991 
2992 char *trash_schedule_uuid (schedule_t);
2993 
2994 char *schedule_name (schedule_t);
2995 
2996 char *trash_schedule_name (schedule_t);
2997 
2998 int schedule_duration (schedule_t);
2999 
3000 int schedule_period (schedule_t);
3001 
3002 int
3003 schedule_info (schedule_t,
3004  int,
3005  time_t *,
3006  time_t *,
3007  int *,
3008  int *,
3009  int *,
3010  gchar **,
3011  gchar **);
3012 
3013 int
3015 
3016 time_t
3018 
3019 time_t
3021 
3022 time_t
3024 
3025 time_t
3027 
3028 time_t
3030 
3031 int
3032 schedule_iterator_byday (iterator_t *);
3033 
3034 gchar *
3036 
3037 const char *
3038 schedule_iterator_timezone (iterator_t *);
3039 
3040 time_t
3041 schedule_iterator_initial_offset (iterator_t *);
3042 
3043 const char *
3044 schedule_iterator_icalendar (iterator_t *);
3045 
3046 int trash_schedule_in_use (schedule_t);
3047 
3048 int schedule_in_use (schedule_t);
3049 
3050 int trash_schedule_writable (schedule_t);
3051 
3052 int trash_schedule_readable (schedule_t);
3053 
3054 int schedule_writable (schedule_t);
3055 
3056 int
3057 schedule_count (const get_data_t *);
3058 
3059 void
3060 init_schedule_task_iterator (iterator_t *, schedule_t);
3061 
3062 const char *
3063 schedule_task_iterator_uuid (iterator_t *);
3064 
3065 const char *
3066 schedule_task_iterator_name (iterator_t *);
3067 
3068 int
3070 
3071 int
3072 modify_schedule (const char *,
3073  const char *,
3074  const char *,
3075  const char *,
3076  time_t,
3077  time_t,
3078  time_t,
3079  const char *,
3080  time_t,
3081  const char *,
3082  gchar **);
3083 
3084 int
3086 
3087 void
3088 set_schedule_timeout (int);
3089 
3090 /* Report Formats. */
3091 
3092 gboolean
3094  report_format_t *,
3095  const char *);
3096 
3100 typedef struct
3101 {
3102  gchar *fallback;
3103  gchar *name;
3104  gchar *type;
3105  gchar *type_max;
3106  gchar *type_min;
3107  gchar *value;
3109 
3110 int
3111 create_report_format (const char *,
3112  const char *,
3113  const char *,
3114  const char *,
3115  const char *,
3116  const char *,
3117  int,
3118  array_t *,
3119  array_t *,
3120  array_t *,
3121  const char *,
3122  report_format_t *);
3123 
3124 int
3125 copy_report_format (const char *, const char *, report_format_t *);
3126 
3127 int
3128 modify_report_format (const char *,
3129  const char *,
3130  const char *,
3131  const char *,
3132  const char *,
3133  const char *,
3134  const char *);
3135 
3136 int
3137 delete_report_format (const char *, int);
3138 
3139 int
3140 verify_report_format (const char *);
3141 
3142 char *report_format_uuid (report_format_t);
3143 
3144 char *report_format_owner_uuid (report_format_t);
3145 
3146 char *report_format_name (report_format_t);
3147 
3148 char *report_format_content_type (report_format_t);
3149 
3150 char *report_format_extension (report_format_t);
3151 
3152 int report_format_global (report_format_t);
3153 
3154 int trash_report_format_global (report_format_t);
3155 
3156 int report_format_predefined (report_format_t);
3157 
3158 int report_format_active (report_format_t);
3159 
3160 int report_format_trust (report_format_t);
3161 
3162 int report_format_in_use (report_format_t);
3163 
3164 int trash_report_format_in_use (report_format_t);
3165 
3166 int trash_report_format_writable (report_format_t);
3167 
3168 int report_format_writable (report_format_t);
3169 
3170 int
3171 report_format_count (const get_data_t *);
3172 
3173 int
3174 init_report_format_iterator (iterator_t *, const get_data_t *);
3175 
3176 const char *
3177 report_format_iterator_extension (iterator_t *);
3178 
3179 const char *
3180 report_format_iterator_content_type (iterator_t *);
3181 
3182 const char *
3183 report_format_iterator_description (iterator_t *);
3184 
3185 int
3186 report_format_iterator_active (iterator_t *);
3187 
3188 const char *
3189 report_format_iterator_signature (iterator_t *);
3190 
3191 const char *
3192 report_format_iterator_trust (iterator_t *);
3193 
3194 const char *
3195 report_format_iterator_summary (iterator_t *);
3196 
3197 time_t
3198 report_format_iterator_trust_time (iterator_t *);
3199 
3200 void
3201 init_report_format_alert_iterator (iterator_t *, report_format_t);
3202 
3203 const char *
3204 report_format_alert_iterator_name (iterator_t *);
3205 
3206 const char *
3207 report_format_alert_iterator_uuid (iterator_t *);
3208 
3209 int
3210 report_format_alert_iterator_readable (iterator_t *);
3211 
3215 typedef struct
3216 {
3217  GPtrArray *start;
3218  gpointer *current;
3219  gchar *dir_name;
3220 } file_iterator_t;
3221 
3222 int
3224 
3225 void
3227 
3228 gboolean
3230 
3231 const char *
3233 
3234 gchar *
3236 
3243 typedef enum
3244 {
3245  REPORT_FORMAT_PARAM_TYPE_BOOLEAN = 0,
3246  REPORT_FORMAT_PARAM_TYPE_INTEGER = 1,
3247  REPORT_FORMAT_PARAM_TYPE_SELECTION = 2,
3248  REPORT_FORMAT_PARAM_TYPE_STRING = 3,
3249  REPORT_FORMAT_PARAM_TYPE_TEXT = 4,
3250  REPORT_FORMAT_PARAM_TYPE_REPORT_FORMAT_LIST = 5,
3251  REPORT_FORMAT_PARAM_TYPE_ERROR = 100
3252 } report_format_param_type_t;
3253 
3254 const char *report_format_param_type_name (report_format_param_type_t);
3255 
3256 report_format_param_type_t
3257 report_format_param_type_from_name (const char *);
3258 
3259 void
3260 init_report_format_param_iterator (iterator_t *,
3261  report_format_t,
3262  int,
3263  int,
3264  const char *);
3265 
3266 report_format_param_t
3267 report_format_param_iterator_param (iterator_t *);
3268 
3269 const char *
3270 report_format_param_iterator_name (iterator_t *);
3271 
3272 const char *
3273 report_format_param_iterator_value (iterator_t *);
3274 
3275 const char *
3276 report_format_param_iterator_type_name (iterator_t *);
3277 
3278 report_format_param_type_t
3279 report_format_param_iterator_type (iterator_t *);
3280 
3281 long long int
3282 report_format_param_iterator_type_min (iterator_t *);
3283 
3284 long long int
3285 report_format_param_iterator_type_max (iterator_t *);
3286 
3287 const char *
3288 report_format_param_iterator_fallback (iterator_t *);
3289 
3290 void
3291 init_param_option_iterator (iterator_t *,
3292  report_format_param_t,
3293  int,
3294  const char *);
3295 
3296 const char *
3297 param_option_iterator_value (iterator_t *);
3298 
3299 /* Groups. */
3300 
3301 int
3302 init_group_iterator (iterator_t *, const get_data_t *);
3303 
3304 int
3305 copy_group (const char *, const char *, const char *, group_t *);
3306 
3307 int
3308 create_group (const char *, const char *, const char *, int, group_t *);
3309 
3310 int
3311 delete_group (const char *, int);
3312 
3313 char *group_uuid (group_t);
3314 
3315 gchar *group_users (group_t);
3316 
3317 int trash_group_in_use (group_t);
3318 
3319 int group_in_use (group_t);
3320 
3321 int trash_group_writable (group_t);
3322 
3323 int group_writable (group_t);
3324 
3325 int
3326 group_count (const get_data_t *);
3327 
3328 int
3329 modify_group (const char *, const char *, const char *, const char *);
3330 
3331 /* Permissions. */
3332 
3333 int
3334 create_permission (const char *,
3335  const char *,
3336  const char *,
3337  const char *,
3338  const char *,
3339  const char *,
3340  permission_t *);
3341 
3342 int
3343 copy_permission (const char *, const char *, permission_t *);
3344 
3345 char *permission_uuid (permission_t);
3346 
3347 int
3348 permission_is_admin (const char *);
3349 
3350 int permission_in_use (permission_t);
3351 
3352 int trash_permission_in_use (permission_t);
3353 
3354 int permission_writable (permission_t);
3355 
3356 int trash_permission_writable (permission_t);
3357 
3358 int
3359 permission_count (const get_data_t *);
3360 
3361 int
3362 init_permission_iterator (iterator_t *, const get_data_t *);
3363 
3364 const char *
3365 permission_iterator_resource_type (iterator_t *);
3366 
3367 const char *
3368 permission_iterator_resource_uuid (iterator_t *);
3369 
3370 const char *
3371 permission_iterator_resource_name (iterator_t *);
3372 
3373 int
3374 permission_iterator_resource_in_trash (iterator_t *);
3375 
3376 int
3377 permission_iterator_resource_orphan (iterator_t *);
3378 
3379 int
3380 permission_iterator_resource_readable (iterator_t *);
3381 
3382 const char *
3383 permission_iterator_subject_type (iterator_t *);
3384 
3385 const char *
3386 permission_iterator_subject_uuid (iterator_t *);
3387 
3388 const char *
3389 permission_iterator_subject_name (iterator_t *);
3390 
3391 int
3392 permission_iterator_subject_in_trash (iterator_t *);
3393 
3394 int
3395 permission_iterator_subject_readable (iterator_t *);
3396 
3397 int
3398 delete_permission (const char *, int);
3399 
3400 int
3401 modify_permission (const char *,
3402  const char *,
3403  const char *,
3404  const char *,
3405  const char *,
3406  const char *,
3407  const char *);
3408 
3409 /* Permission caching */
3410 
3411 void
3412 delete_permissions_cache_for_resource (const char *, resource_t);
3413 
3414 void delete_permissions_cache_for_user (user_t);
3415 
3416 /* Port lists. */
3417 
3418 gboolean
3419 find_port_list (const char *, port_list_t *);
3420 
3421 gboolean
3422 find_port_list_with_permission (const char *, port_list_t *, const char *);
3423 
3424 gboolean
3425 find_port_range (const char *, port_list_t *);
3426 
3427 int
3428 create_port_list (const char *,
3429  const char *,
3430  const char *,
3431  const char *,
3432  array_t *,
3433  port_list_t *);
3434 
3435 int
3436 copy_port_list (const char *, const char *, const char *, port_list_t *);
3437 
3438 int
3439 modify_port_list (const char *, const char *, const char *);
3440 
3441 int
3442 create_port_range (const char *,
3443  const char *,
3444  const char *,
3445  const char *,
3446  const char *,
3447  port_range_t *);
3448 
3449 int
3450 delete_port_list (const char *, int);
3451 
3452 int
3453 delete_port_range (const char *, int);
3454 
3455 int
3456 port_list_count (const get_data_t *);
3457 
3458 int
3459 init_port_list_iterator (iterator_t *, const get_data_t *);
3460 
3461 int
3462 port_list_iterator_count_all (iterator_t *);
3463 
3464 int
3465 port_list_iterator_count_tcp (iterator_t *);
3466 
3467 int
3468 port_list_iterator_count_udp (iterator_t *);
3469 
3470 char *port_list_uuid (port_list_t);
3471 
3472 char *port_range_uuid (port_range_t);
3473 
3474 int port_list_in_use (port_list_t);
3475 
3476 int trash_port_list_in_use (port_list_t);
3477 
3478 int trash_port_list_writable (port_list_t);
3479 
3480 int port_list_writable (port_list_t);
3481 
3482 #if 0
3483 int
3484 trash_port_list_in_use (port_list_t);
3485 #endif
3486 
3487 int
3488 trash_port_list_readable_uuid (const gchar *);
3489 
3490 void
3491 init_port_range_iterator (iterator_t *, port_range_t, int, int, const char *);
3492 
3493 const char *
3494 port_range_iterator_uuid (iterator_t *);
3495 
3496 const char *
3497 port_range_iterator_comment (iterator_t *);
3498 
3499 const char *
3500 port_range_iterator_start (iterator_t *);
3501 
3502 const char *
3503 port_range_iterator_end (iterator_t *);
3504 
3505 const char *
3506 port_range_iterator_type (iterator_t *);
3507 
3508 void
3509 init_port_list_target_iterator (iterator_t *, port_list_t, int);
3510 
3511 const char *
3512 port_list_target_iterator_uuid (iterator_t *);
3513 
3514 const char *
3515 port_list_target_iterator_name (iterator_t *);
3516 
3517 int
3518 port_list_target_iterator_readable (iterator_t *);
3519 
3520 /* Roles. */
3521 
3522 int
3523 init_role_iterator (iterator_t *, const get_data_t *);
3524 
3525 int
3526 copy_role (const char *, const char *, const char *, role_t *);
3527 
3528 int
3529 create_role (const char *, const char *, const char *, role_t *);
3530 
3531 int
3532 delete_role (const char *, int);
3533 
3534 char *role_uuid (role_t);
3535 
3536 gchar *role_users (role_t);
3537 
3538 int trash_role_in_use (role_t);
3539 
3540 int role_in_use (role_t);
3541 
3542 int trash_role_writable (role_t);
3543 
3544 int role_writable (role_t);
3545 
3546 int
3547 role_count (const get_data_t *);
3548 
3549 int
3550 modify_role (const char *, const char *, const char *, const char *);
3551 
3552 /* Filter Utilities. */
3553 
3557 typedef enum
3558 {
3559  KEYWORD_TYPE_UNKNOWN,
3560  KEYWORD_TYPE_INTEGER,
3561  KEYWORD_TYPE_DOUBLE,
3562  KEYWORD_TYPE_STRING
3563 } keyword_type_t;
3564 
3568 typedef enum
3569 {
3570  KEYWORD_RELATION_APPROX,
3571  KEYWORD_RELATION_COLUMN_ABOVE,
3572  KEYWORD_RELATION_COLUMN_APPROX,
3573  KEYWORD_RELATION_COLUMN_EQUAL,
3574  KEYWORD_RELATION_COLUMN_BELOW,
3575  KEYWORD_RELATION_COLUMN_REGEXP
3576 } keyword_relation_t;
3577 
3581 struct keyword
3582 {
3583  gchar *column;
3584  int equal;
3586  double double_value;
3587  int quoted;
3588  gchar *string;
3589  keyword_type_t type;
3590  keyword_relation_t relation;
3591 };
3592 
3596 typedef struct keyword keyword_t;
3597 
3598 int
3600 
3601 const char *keyword_relation_symbol (keyword_relation_t);
3602 
3603 void
3604 filter_free (array_t *);
3605 
3606 array_t *
3607 split_filter (const gchar *);
3608 
3609 /* Filters. */
3610 
3611 gboolean
3612 find_filter (const char *, filter_t *);
3613 
3614 gboolean
3615 find_filter_with_permission (const char *, filter_t *, const char *);
3616 
3617 char *filter_uuid (filter_t);
3618 
3619 char *filter_name (filter_t);
3620 
3621 gchar *
3622 filter_term (const char *);
3623 
3624 gchar *
3625 filter_term_value (const char *, const char *);
3626 
3627 int
3628 filter_term_apply_overrides (const char *);
3629 
3630 int
3631 filter_term_autofp (const char *);
3632 
3633 int
3634 filter_term_min_qod (const char *);
3635 
3636 int
3637 create_filter (const char *,
3638  const char *,
3639  const char *,
3640  const char *,
3641  filter_t *);
3642 
3643 int
3644 copy_filter (const char *, const char *, const char *, filter_t *);
3645 
3646 int
3647 delete_filter (const char *, int);
3648 
3649 int trash_filter_in_use (filter_t);
3650 
3651 int filter_in_use (filter_t);
3652 
3653 int trash_filter_writable (filter_t);
3654 
3655 int filter_writable (filter_t);
3656 
3657 int
3658 filter_count (const get_data_t *);
3659 
3660 int
3661 init_filter_iterator (iterator_t *, const get_data_t *);
3662 
3663 const char *
3664 filter_iterator_type (iterator_t *);
3665 
3666 const char *
3667 filter_iterator_term (iterator_t *);
3668 
3669 void
3670 init_filter_alert_iterator (iterator_t *, filter_t);
3671 
3672 const char *
3673 filter_alert_iterator_name (iterator_t *);
3674 
3675 const char *
3676 filter_alert_iterator_uuid (iterator_t *);
3677 
3678 int
3679 filter_alert_iterator_readable (iterator_t *);
3680 
3681 int
3682 modify_filter (const char *,
3683  const char *,
3684  const char *,
3685  const char *,
3686  const char *);
3687 
3688 /* Schema. */
3689 
3690 int
3691 manage_schema (gchar *, gchar **, gsize *, gchar **, gchar **);
3692 
3693 /* Trashcan. */
3694 
3695 int
3696 manage_restore (const char *);
3697 
3698 int
3699 manage_empty_trashcan ();
3700 
3701 /* Scanner tags. */
3702 
3703 void
3704 parse_tags (const char *, gchar **, gchar **);
3705 
3706 /* SecInfo */
3707 
3708 int
3709 manage_read_info (gchar *, gchar *, gchar *, gchar **);
3710 
3711 int
3712 info_name_count (const gchar *, const gchar *);
3713 
3714 /* SCAP. */
3715 
3716 int
3718 
3719 const char *
3721 
3722 /* CPE. */
3723 
3724 void
3725 init_cpe_cve_iterator (iterator_t *, const char *, int, const char *);
3726 
3727 int
3728 init_cpe_info_iterator (iterator_t *, get_data_t *, const char *);
3729 
3730 int
3731 cpe_info_count (const get_data_t *get);
3732 
3733 const char *
3734 cpe_info_iterator_title (iterator_t *);
3735 
3736 const char *
3737 cpe_info_iterator_status (iterator_t *);
3738 
3739 const char *
3740 cpe_info_iterator_max_cvss (iterator_t *);
3741 
3742 const char *
3743 cpe_info_iterator_deprecated_by_id (iterator_t *);
3744 
3745 const char *
3746 cpe_info_iterator_cve_refs (iterator_t *);
3747 
3748 const char *
3749 cpe_info_iterator_nvd_id (iterator_t *);
3750 
3751 /* CVE. */
3752 
3753 const char *
3754 cve_iterator_name (iterator_t *);
3755 
3756 const char *
3757 cve_iterator_cvss (iterator_t *);
3758 
3759 const char *
3760 cve_info_iterator_cvss (iterator_t *);
3761 
3762 const char *
3763 cve_info_iterator_vector (iterator_t *);
3764 
3765 const char *
3766 cve_info_iterator_complexity (iterator_t *);
3767 
3768 const char *
3769 cve_info_iterator_authentication (iterator_t *);
3770 
3771 const char *
3772 cve_info_iterator_confidentiality_impact (iterator_t *);
3773 
3774 const char *
3775 cve_info_iterator_integrity_impact (iterator_t *);
3776 
3777 const char *
3778 cve_info_iterator_availability_impact (iterator_t *);
3779 
3780 const char *
3781 cve_info_iterator_description (iterator_t *);
3782 
3783 const char *
3784 cve_info_iterator_products (iterator_t *);
3785 
3786 int
3787 init_cve_info_iterator (iterator_t *, get_data_t *, const char *);
3788 
3789 int
3790 cve_info_count (const get_data_t *get);
3791 
3792 gchar *
3793 cve_cvss_base (const gchar *);
3794 
3795 /* OVAL definitions */
3796 int
3797 init_ovaldef_info_iterator (iterator_t *, get_data_t *, const char *);
3798 
3799 int
3800 ovaldef_info_count (const get_data_t *get);
3801 
3802 const char *
3803 ovaldef_info_iterator_version (iterator_t *);
3804 
3805 const char *
3806 ovaldef_info_iterator_deprecated (iterator_t *);
3807 
3808 const char *
3809 ovaldef_info_iterator_class (iterator_t *);
3810 
3811 const char *
3812 ovaldef_info_iterator_title (iterator_t *);
3813 
3814 const char *
3815 ovaldef_info_iterator_description (iterator_t *);
3816 
3817 const char *
3818 ovaldef_info_iterator_file (iterator_t *);
3819 
3820 const char *
3821 ovaldef_info_iterator_status (iterator_t *);
3822 
3823 const char *
3824 ovaldef_info_iterator_max_cvss (iterator_t *);
3825 
3826 const char *
3827 ovaldef_info_iterator_cve_refs (iterator_t *);
3828 
3829 char *
3830 ovaldef_severity (const char *);
3831 
3832 char *
3833 ovaldef_version (const char *);
3834 
3835 char *
3836 ovaldef_uuid (const char *, const char *);
3837 
3838 char *
3839 ovaldef_cves (const char *);
3840 
3841 /* CERT data */
3842 int
3844 
3845 /* CERT-Bund */
3846 
3847 int
3849 
3850 int
3852 
3853 const char *
3854 cert_bund_adv_info_iterator_title (iterator_t *);
3855 
3856 const char *
3857 cert_bund_adv_info_iterator_summary (iterator_t *);
3858 
3859 const char *
3860 cert_bund_adv_info_iterator_cve_refs (iterator_t *);
3861 
3862 const char *
3863 cert_bund_adv_info_iterator_max_cvss (iterator_t *);
3864 
3865 void
3866 init_cve_cert_bund_adv_iterator (iterator_t *, const char *, int, const char *);
3867 
3868 void
3869 init_nvt_cert_bund_adv_iterator (iterator_t *, const char *, int, const char *);
3870 
3871 /* DFN-CERT */
3872 
3873 int
3875 
3876 int
3877 dfn_cert_adv_info_count (const get_data_t *get);
3878 
3879 const char *
3880 dfn_cert_adv_info_iterator_title (iterator_t *);
3881 
3882 const char *
3883 dfn_cert_adv_info_iterator_summary (iterator_t *);
3884 
3885 const char *
3886 dfn_cert_adv_info_iterator_cve_refs (iterator_t *);
3887 
3888 const char *
3889 dfn_cert_adv_info_iterator_max_cvss (iterator_t *);
3890 
3891 void
3892 init_cve_dfn_cert_adv_iterator (iterator_t *, const char *, int, const char *);
3893 
3894 void
3895 init_nvt_dfn_cert_adv_iterator (iterator_t *, const char *, int, const char *);
3896 
3897 /* All SecInfo Data */
3898 
3899 int
3900 all_info_count (const get_data_t *);
3901 
3902 int
3903 total_info_count (const get_data_t *, int);
3904 
3905 int
3906 init_all_info_iterator (iterator_t *, get_data_t *, const char *);
3907 
3908 const char *
3909 all_info_iterator_type (iterator_t *);
3910 
3911 const char *
3912 all_info_iterator_extra (iterator_t *);
3913 
3914 const char *
3915 all_info_iterator_severity (iterator_t *);
3916 
3917 void
3919 
3920 const char *
3921 ovaldi_file_iterator_name (iterator_t *);
3922 
3923 /* Settings. */
3924 
3925 int
3926 manage_max_rows (int);
3927 
3928 int
3929 setting_count (const char *);
3930 
3931 int
3932 setting_is_default_ca_cert (const gchar *);
3933 
3934 char *
3935 setting_filter (const char *);
3936 
3937 const char *
3938 setting_severity ();
3939 
3940 void
3941 init_setting_iterator (iterator_t *,
3942  const char *,
3943  const char *,
3944  int,
3945  int,
3946  int,
3947  const char *);
3948 
3949 const char *
3950 setting_iterator_uuid (iterator_t *);
3951 
3952 const char *
3953 setting_iterator_name (iterator_t *);
3954 
3955 const char *
3956 setting_iterator_comment (iterator_t *);
3957 
3958 const char *
3959 setting_iterator_value (iterator_t *);
3960 
3961 int
3962 modify_setting (const gchar *, const gchar *, const gchar *, gchar **);
3963 
3964 int
3965 manage_modify_setting (GSList *,
3966  const gchar *,
3967  const gchar *,
3968  const gchar *,
3969  const char *);
3970 
3971 char *
3972 manage_default_ca_cert ();
3973 
3974 /* Users. */
3975 
3976 gboolean
3977 find_user_by_name_with_permission (const char *, user_t *, const char *);
3978 
3979 int
3980 manage_create_user (GSList *,
3981  const gchar *,
3982  const gchar *,
3983  const gchar *,
3984  const gchar *);
3985 
3986 int
3987 manage_delete_user (GSList *, const gchar *, const gchar *, const gchar *);
3988 
3989 int
3990 manage_get_users (GSList *, const gchar *, const gchar *);
3991 
3992 report_host_t
3993 manage_report_host_add (report_t, const char *, time_t, time_t);
3994 
3995 int
3996 report_host_noticeable (report_t, const gchar *);
3997 
3998 void report_host_set_end_time (report_host_t, time_t);
3999 
4000 gchar *host_routes_xml (host_t);
4001 
4002 int
4003 manage_set_password (GSList *, const gchar *, const gchar *, const gchar *);
4004 
4005 gchar *
4006 manage_user_hash (const gchar *);
4007 
4008 gchar *
4009 manage_user_uuid (const gchar *, auth_method_t);
4010 
4011 int
4012 manage_user_exists (const gchar *, auth_method_t);
4013 
4014 int
4016 
4017 int
4018 copy_user (const char *, const char *, const char *, user_t *);
4019 
4020 gchar *
4021 keyfile_to_auth_conf_settings_xml (const gchar *);
4022 
4023 int
4024 init_user_iterator (iterator_t *, const get_data_t *);
4025 
4026 const char *
4027 user_iterator_role (iterator_t *);
4028 
4029 const char *
4030 user_iterator_method (iterator_t *);
4031 
4032 const char *
4033 user_iterator_hosts (iterator_t *);
4034 
4035 int
4036 user_iterator_hosts_allow (iterator_t *);
4037 
4038 const char *
4039 user_iterator_ifaces (iterator_t *);
4040 
4041 int
4042 user_iterator_ifaces_allow (iterator_t *);
4043 
4044 void
4045 init_user_group_iterator (iterator_t *, user_t);
4046 
4047 const char *
4048 user_group_iterator_uuid (iterator_t *);
4049 
4050 const char *
4051 user_group_iterator_name (iterator_t *);
4052 
4053 int
4054 user_group_iterator_readable (iterator_t *);
4055 
4056 void
4057 init_user_role_iterator (iterator_t *, user_t);
4058 
4059 const char *
4060 user_role_iterator_uuid (iterator_t *);
4061 
4062 const char *
4063 user_role_iterator_name (iterator_t *);
4064 
4065 int
4066 user_role_iterator_readable (iterator_t *);
4067 
4068 int
4069 create_user (const gchar *,
4070  const gchar *,
4071  const gchar *,
4072  const gchar *,
4073  int,
4074  const gchar *,
4075  int,
4076  const array_t *,
4077  array_t *,
4078  gchar **,
4079  array_t *,
4080  gchar **,
4081  gchar **,
4082  user_t *,
4083  int);
4084 
4085 int
4086 delete_user (const char *, const char *, int, int, const char *, const char *);
4087 
4088 int
4089 modify_user (const gchar *,
4090  gchar **,
4091  const gchar *,
4092  const gchar *,
4093  const gchar *,
4094  const gchar *,
4095  int,
4096  const gchar *,
4097  int,
4098  const array_t *,
4099  array_t *,
4100  gchar **,
4101  array_t *,
4102  gchar **,
4103  gchar **);
4104 
4105 int user_in_use (user_t);
4106 
4107 int trash_user_in_use (user_t);
4108 
4109 int user_writable (user_t);
4110 
4111 int trash_user_writable (user_t);
4112 
4113 int
4114 user_count (const get_data_t *);
4115 
4116 gchar *
4117 user_name (const char *);
4118 
4119 char *user_uuid (user_t);
4120 
4121 gchar *
4122 user_ifaces (const char *);
4123 
4124 int
4125 user_ifaces_allow (const char *);
4126 
4127 gchar *
4128 user_hosts (const char *);
4129 
4130 int
4131 user_hosts_allow (const char *);
4132 
4133 int
4134 init_vuln_iterator (iterator_t *, const get_data_t *);
4135 
4136 int
4137 vuln_iterator_results (iterator_t *);
4138 
4139 const char *
4140 vuln_iterator_oldest (iterator_t *);
4141 
4142 const char *
4143 vuln_iterator_newest (iterator_t *);
4144 
4145 const char *
4146 vuln_iterator_type (iterator_t *);
4147 
4148 int
4149 vuln_iterator_hosts (iterator_t *);
4150 
4151 double
4152 vuln_iterator_severity (iterator_t *);
4153 
4154 int
4155 vuln_iterator_qod (iterator_t *);
4156 
4157 int
4158 vuln_count (const get_data_t *);
4159 
4160 void
4161 manage_get_ldap_info (int *, gchar **, gchar **, int *, gchar **);
4162 
4163 void
4164 manage_set_ldap_info (int, gchar *, gchar *, int, gchar *);
4165 
4166 void
4167 manage_get_radius_info (int *, char **, char **);
4168 
4169 void
4170 manage_set_radius_info (int, gchar *, gchar *);
4171 
4172 /* Tags */
4173 
4174 char *tag_uuid (target_t);
4175 
4176 int
4177 copy_tag (const char *, const char *, const char *, tag_t *);
4178 
4179 int
4180 create_tag (const char *,
4181  const char *,
4182  const char *,
4183  const char *,
4184  array_t *,
4185  const char *,
4186  const char *,
4187  tag_t *,
4188  gchar **);
4189 
4190 int
4191 delete_tag (const char *, int);
4192 
4193 int
4194 modify_tag (const char *,
4195  const char *,
4196  const char *,
4197  const char *,
4198  const char *,
4199  array_t *,
4200  const char *,
4201  const char *,
4202  const char *,
4203  gchar **);
4204 
4205 int
4206 init_tag_iterator (iterator_t *, const get_data_t *);
4207 
4208 int
4209 tag_count (const get_data_t *get);
4210 
4211 const char *
4212 tag_iterator_resource_type (iterator_t *);
4213 
4214 int
4215 tag_iterator_active (iterator_t *);
4216 
4217 const char *
4218 tag_iterator_value (iterator_t *);
4219 
4220 int
4221 tag_iterator_resources (iterator_t *);
4222 
4223 resource_t
4224 tag_resource_iterator_id (iterator_t *);
4225 
4226 const char *
4227 tag_resource_iterator_uuid (iterator_t *);
4228 
4229 int
4230 tag_resource_iterator_location (iterator_t *);
4231 
4232 const char *
4233 tag_resource_iterator_name (iterator_t *);
4234 
4235 int
4236 tag_resource_iterator_readable (iterator_t *);
4237 
4238 int
4239 init_tag_name_iterator (iterator_t *, const get_data_t *);
4240 
4241 const char *
4242 tag_name_iterator_name (iterator_t *);
4243 
4244 int
4245 init_resource_tag_iterator (iterator_t *,
4246  const char *,
4247  resource_t,
4248  int,
4249  const char *,
4250  int);
4251 
4252 const char *
4253 resource_tag_iterator_uuid (iterator_t *);
4254 
4255 const char *
4256 resource_tag_iterator_name (iterator_t *);
4257 
4258 const char *
4259 resource_tag_iterator_value (iterator_t *);
4260 
4261 const char *
4262 resource_tag_iterator_comment (iterator_t *);
4263 
4264 int
4265 resource_tag_exists (const char *, resource_t, int);
4266 
4267 int
4268 resource_tag_count (const char *, resource_t, int);
4269 
4270 int tag_in_use (tag_t);
4271 
4272 int trash_tag_in_use (tag_t);
4273 
4274 int tag_writable (tag_t);
4275 
4276 int trash_tag_writable (tag_t);
4277 
4278 /* Resource aggregates */
4279 
4283 typedef struct
4284 {
4285  gchar *field;
4286  gchar *stat;
4287  int order;
4288 } sort_data_t;
4289 
4290 void
4291 sort_data_free (sort_data_t *);
4292 
4293 int
4295  const char *,
4296  const get_data_t *,
4297  int,
4298  GArray *,
4299  const char *,
4300  const char *,
4301  GArray *,
4302  GArray *,
4303  int,
4304  int,
4305  const char *,
4306  const char *);
4307 
4308 int
4310 
4311 double
4313 
4314 double
4316 
4317 double
4319 
4320 double
4322 
4323 const char *
4324 aggregate_iterator_text (iterator_t *, int, int);
4325 
4326 const char *
4328 
4329 const char *
4331 
4332 /* Feeds. */
4333 
4334 #define NVT_FEED 1
4335 #define SCAP_FEED 2
4336 #define CERT_FEED 3
4337 
4338 int
4339 gvm_migrate_secinfo (int);
4340 
4341 gboolean
4342 gvm_sync_script_perform_selftest (const gchar *, gchar **);
4343 
4344 gboolean
4345 gvm_get_sync_script_identification (const gchar *, gchar **, int);
4346 
4347 gboolean
4348 gvm_get_sync_script_description (const gchar *, gchar **);
4349 
4350 gboolean
4351 gvm_get_sync_script_feed_version (const gchar *, gchar **);
4352 
4353 /* Wizards. */
4354 
4355 int
4356 manage_run_wizard (const gchar *,
4357  int (*) (void *, gchar *, gchar **),
4358  void *,
4359  array_t *,
4360  int,
4361  const char *,
4362  gchar **,
4363  gchar **,
4364  gchar **);
4365 
4366 /* Helpers. */
4367 
4368 gchar *
4369 xml_escape_text_truncated (const char *, size_t, const char *);
4370 
4371 int
4372 column_is_timestamp (const char *);
4373 
4374 char *
4375 type_columns (const char *);
4376 
4377 char *
4378 type_trash_columns (const char *);
4379 
4380 gboolean
4381 manage_migrate_needs_timezone (GSList *, const gchar *);
4382 
4383 /* Optimize. */
4384 
4385 int
4386 manage_optimize (GSList *, const gchar *, const gchar *);
4387 
4388 /* Signal management */
4389 
4390 int
4391 get_termination_signal ();
4392 
4393 int
4394 sql_cancel ();
4395 
4396 #endif /* not _GVMD_MANAGE_H */
int move_task(const char *task_id, const char *slave_id)
Reassign a task to another slave.
Definition: manage.c:5997
const char * override_iterator_new_threat(iterator_t *iterator)
Get the threat from an override iterator.
Definition: manage_sql.c:47438
void severity_data_add_count(severity_data_t *severity_data, double severity, int count)
Add a multiple severity occurrences to the counts of a severity_data_t.
Definition: manage.c:1051
int target_iterator_esxi_credential(iterator_t *iterator)
Get the ESXi LSC credential from a target iterator.
Definition: manage_sql.c:36015
double aggregate_iterator_max(iterator_t *iterator, int data_column_index)
Get the maximum from an aggregate iterator.
Definition: manage_sql.c:5993
int modify_scanner(const char *scanner_id, const char *name, const char *comment, const char *host, const char *port, const char *type, const char *ca_pub, const char *credential_id)
Modify an scanner.
Definition: manage_sql.c:48257
int init_aggregate_iterator(iterator_t *iterator, const char *type, const get_data_t *get, int distinct, GArray *data_columns, const char *group_column, const char *subgroup_column, GArray *text_columns, GArray *sort_data, int first_group, int max_groups, const char *extra_tables, const char *given_extra_where)
Initialise a GET_AGGREGATES iterator, including observed resources.
Definition: manage_sql.c:5546
time_t agent_iterator_trust_time(iterator_t *iterator)
Get the installer trust time from a agent iterator.
Definition: manage_sql.c:45028
double result_iterator_severity_double(iterator_t *iterator)
Get the severity from a result iterator as double.
Definition: manage_sql.c:24951
const char * result_iterator_level(iterator_t *iterator)
Get the severity/threat level from a result iterator.
Definition: manage_sql.c:25003
int report_progress(report_t report, task_t task, gchar **hosts_xml)
Calculate the progress of a report.
Definition: manage_sql.c:29342
void init_nvt_iterator(iterator_t *iterator, nvt_t nvt, config_t config, const char *family, const char *category, int ascending, const char *sort_field)
Initialise an NVT iterator.
Definition: manage_sql_nvts.c:696
int start_task(const char *task_id, char **report_id)
Start a task.
Definition: manage.c:5813
int delete_report(const char *report_id, int dummy)
Delete a report.
Definition: manage_sql.c:27002
int details
Boolean. Whether to include full details.
Definition: manage.h:318
const char * alert_data_iterator_name(iterator_t *iterator)
Return the name from an alert data iterator.
Definition: manage_sql.c:8921
void init_manage_process(int update_nvt_cache, const gchar *database)
Initialize the manage library for a process.
Definition: manage_sql.c:15386
int result_iterator_has_dfn_certs(iterator_t *iterator)
Get whether DFN-CERTs may exist from a result iterator.
Definition: manage_sql.c:25149
void manage_nvt_preferences_enable()
Enable the NVT preferences.
Definition: manage_sql.c:41285
int manage_count_hosts(const char *given_hosts, const char *exclude_hosts)
Return number of hosts described by a hosts string.
Definition: manage_sql.c:34202
const char * aggregate_iterator_subgroup_value(iterator_t *iterator)
Get the value of the subgroup column from an aggregate iterator.
Definition: manage_sql.c:6082
char * scanner_uuid(scanner_t scanner)
Return the UUID of a scanner.
Definition: manage_sql.c:49026
char * port
Port.
Definition: manage.h:1183
int delete_task(task_t task, int ultimate)
Complete deletion of a task.
Definition: manage_sql.c:33419
char * credential_iterator_deb(iterator_t *iterator)
Get the deb from a Credential iterator.
Definition: manage_sql.c:43591
void set_scan_start_time_otp(report_t report, const char *timestamp)
Set the start time of a scan.
Definition: manage_sql.c:25964
int trash
Boolean. Whether to return from trashcan.
Definition: manage.h:324
int target_iterator_ssh_credential(iterator_t *iterator)
Get the SSH LSC credential from a target iterator.
Definition: manage_sql.c:35840
char * ip
IP.
Definition: manage.h:1195
char * default_value
Default value of preference.
Definition: manage.h:1822
char * string
Original string describing port.
Definition: manage.h:193
int init_cve_info_iterator(iterator_t *iterator, get_data_t *get, const char *name)
Initialise a info iterator.
Definition: manage_sql_secinfo.c:333
alert_condition_t alert_condition_from_name(const char *name)
Get an alert condition from a name.
Definition: manage.c:1399
int config_writable(config_t config)
Return whether a config can be modified.
Definition: manage_sql.c:37846
gchar * manage_clean_filter(const gchar *filter)
Clean a filter.
Definition: manage_sql.c:2760
char * task_config_uuid(task_t task)
Return the UUID of the config of a task.
Definition: manage_sql.c:19214
int credential_iterator_allow_insecure(iterator_t *iterator)
Get the login from a Credential iterator.
Definition: manage_sql.c:43422
char * host
Host.
Definition: manage.h:1179
int resume_task(const char *task_id, char **report_id)
Resume a task.
Definition: manage.c:5963
int order
The sort order.
Definition: manage.h:4287
int manage_verify_scanner(GSList *log_config, const gchar *database, const gchar *uuid)
Verify the given scanner.
Definition: manage_sql.c:48011
char * agent_uuid(agent_t agent)
Return the UUID of an agent.
Definition: manage_sql.c:44746
int nvt_selector_family_count(const char *quoted_selector, int families_growing)
Get the number of families selected by an NVT selector.
Definition: manage_sql.c:39838
const char * type_name_plural(const char *type)
Return the plural name of a resource type.
Definition: manage.c:562
gchar * file_iterator_content_64(file_iterator_t *iterator)
Return the file contents from a file iterator.
Definition: manage.c:7665
int create_override(const char *active, const char *nvt, const char *text, const char *hosts, const char *port, const char *threat, const char *new_threat, const char *severity, const char *new_severity, task_t task, result_t result, override_t *override)
Create an override.
Definition: manage_sql.c:46279
char * name
Name of preference.
Definition: manage.h:1816
char * ovaldef_uuid(const char *name, const char *fname)
Get the uuid for an OVALDEF from a name and file name.
Definition: manage_sql_secinfo.c:656
int info_name_count(const char *type, const char *name)
Count number of info of a given subtype with a given name.
Definition: manage_sql.c:6225
void reset_task(task_t task)
Reset all running information for a task.
Definition: manage_sql.c:33759
void manage_session_set_timezone(const char *zone)
Setup session timezone.
Definition: manage_pg.c:67
Severity data for result count cache.
Definition: manage.h:1000
int scanner_iterator_port(iterator_t *iterator)
Get the port from an scanner iterator.
Definition: manage_sql.c:48659
char * name
Detail name.
Definition: manage.h:1196
void init_alert_data_iterator(iterator_t *iterator, alert_t alert, int trash, const char *table)
Initialise an alert data iterator.
Definition: manage_sql.c:8902
int init_manage_helper(GSList *log_config, const gchar *database, int max_ips_per_target)
Initialize the manage library for a helper program.
Definition: manage_sql.c:18308
int create_schedule(const char *name, const char *comment, const char *ical_string, time_t first_time, time_t period, time_t period_months, const char *byday, time_t duration, const char *zone, schedule_t *schedule, gchar **error_out)
Create a schedule.
Definition: manage_sql.c:49665
int report_counts_id(report_t report, int *debugs, int *holes, int *infos, int *logs, int *warnings, int *false_positives, double *severity, const get_data_t *get, const char *host)
Get only the filtered message counts for a report.
Definition: manage_sql.c:26734
char * report_format_uuid(report_format_t report_format)
Return the UUID of a report format.
Definition: manage_sql.c:52423
const char * result_iterator_nvt_family(iterator_t *iterator)
Get the NVT family from a result iterator.
Definition: manage_sql.c:24697
char * scanner_key_priv(scanner_t scanner)
Return the private key of a scanner.
Definition: manage_sql.c:49137
int get_certificate_info(const gchar *certificate, time_t *activation_time, time_t *expiration_time, gchar **fingerprint, gchar **issuer)
Gathers info from a certificate.
Definition: manage.c:304
char * credential_type(credential_t credential)
Get the type of a Credential.
Definition: manage_sql.c:43819
gchar * stat
The statistic to sort by.
Definition: manage.h:4286
Data about a report sent by an alert.
Definition: manage.h:397
int create_note(const char *active, const char *nvt, const char *text, const char *hosts, const char *port, const char *severity, const char *threat, task_t task, result_t result, note_t *note)
Create a note.
Definition: manage_sql.c:45284
int delete_config(const char *config_id, int ultimate)
Delete a config.
Definition: manage_sql.c:37276
int modify_report_format(const char *report_format_id, const char *name, const char *summary, const char *active, const char *param_name, const char *param_value, const char *predefined)
Modify a report format.
Definition: manage_sql.c:51967
int create_credential(const char *name, const char *comment, const char *login, const char *given_password, const char *key_private, const char *key_public, const char *certificate, const char *community, const char *auth_algorithm, const char *privacy_password, const char *privacy_algorithm, const char *given_type, const char *allow_insecure, credential_t *credential)
Create a Credential.
Definition: manage_sql.c:41839
void parse_tags(const char *scanner_tags, gchar **tags, gchar **cvss_base)
Split up the tags received from the scanner.
Definition: manage.c:7715
char * scanner_login(scanner_t scanner)
Return the login associated with a scanner.
Definition: manage_sql.c:49176
int create_scanner(const char *name, const char *comment, const char *host, const char *port, const char *type, scanner_t *new_scanner, const char *ca_pub, const char *credential_id)
Create a scanner.
Definition: manage_sql.c:48129
char * report_format_owner_uuid(report_format_t report_format)
Return the UUID of the owner of a report format.
Definition: manage_sql.c:52437
gpointer * current
Current file.
Definition: manage.h:3218
port_protocol_t protocol
Port protocol (TCP, UDP, ...).
Definition: manage.h:192
int modify_schedule(const char *schedule_id, const char *name, const char *comment, const char *ical_string, time_t first_time, time_t period, time_t period_months, const char *byday, time_t duration, const char *zone, gchar **error_out)
Modify a schedule.
Definition: manage_sql.c:50717
int manage_check_alerts(GSList *log_config, const gchar *database)
Check if any SecInfo alerts are due.
Definition: manage_sql.c:6920
int task_last_report(task_t task, report_t *report)
Get the report from the most recently completed invocation of task.
Definition: manage_sql.c:19792
int manage_cert_loaded()
Check whether CERT is available.
Definition: manage_pg.c:3671
int credential_target_iterator_readable(iterator_t *iterator)
Get the read permission status from a GET iterator.
Definition: manage_sql.c:43921
char * nvt_preference_iterator_nvt(iterator_t *iterator)
Get the NVT from an NVT preference iterator.
Definition: manage_sql.c:41427
int config_iterator_families_growing(iterator_t *iterator)
Get the families growing state from a config iterator.
Definition: manage_sql.c:37747
void init_nvt_preference_iterator(iterator_t *iterator, const char *name)
Initialise an NVT preference iterator.
Definition: manage_sql.c:41301
void manage_nvt_preference_add(const char *name, const char *value)
Add an NVT preference.
Definition: manage_sql.c:41254
const char * manage_scap_update_time()
GET SCAP update time, as a string.
Definition: manage.c:8315
char * scanner_password(scanner_t scanner)
Return the password associated with a scanner.
Definition: manage_sql.c:49194
void set_scan_host_start_time_otp(report_t report, const char *host, const char *timestamp)
Set the start time of a scanned host.
Definition: manage_sql.c:26156
int delete_scanner(const char *scanner_id, int ultimate)
Delete a scanner.
Definition: manage_sql.c:48425
const char * event_name(event_t event)
Get the name of an alert event.
Definition: manage.c:1239
gchar * remote_filename
Path or filename to send to / as.
Definition: manage.h:400
const char * severity_to_type(double severity)
Get the message type matching a severity score.
Definition: manage.c:838
int scanner_type(scanner_t scanner)
Return the type of a scanner.
Definition: manage_sql.c:49084
char * report_uuid(report_t report)
Return the UUID of a report.
Definition: manage_sql.c:22791
gboolean next_report(iterator_t *iterator, report_t *report)
Read the next report from an iterator.
Definition: manage_sql.c:23462
int trash_config_in_use(config_t config)
Return whether a trashcan config is referenced by a task.
Definition: manage_sql.c:37872
char * qod
QoD (quality of detection).
Definition: manage.h:1184
int alert_iterator_condition(iterator_t *iterator)
Return the condition from an alert iterator.
Definition: manage_sql.c:8736
char * task_hosts_ordering(task_t task)
Return the hosts ordering of a task.
Definition: manage_sql.c:19144
gchar * credential_iterator_formats_xml(iterator_t *iterator)
Get XML of available formats for a credential iterator.
Definition: manage_sql.c:43722
void cleanup_report_type_iterator(report_type_iterator_t *iterator)
Cleanup a report type iterator.
Definition: manage.c:6488
int report_format_writable(report_format_t report_format)
Return whether a report format is writable.
Definition: manage_sql.c:52554
int scanner_count(const get_data_t *get)
Count number of scanners.
Definition: manage_sql.c:49264
int target_in_use(target_t target)
Return whether a target is in use by a task.
Definition: manage_sql.c:36449
void init_task_group_iterator(iterator_t *iterator, task_t task)
Initialise a task group iterator.
Definition: manage_sql.c:6778
void init_cpe_cve_iterator(iterator_t *iterator, const char *cve, int ascending, const char *sort_field)
Initialise an CVE iterator, for CVEs reported for a certain CPE.
Definition: manage_sql_secinfo.c:249
int set_task_observers(task_t task, const gchar *observers)
Set the observers of a task.
Definition: manage_sql.c:20437
int alert_iterator_active(iterator_t *iterator)
Return the active state from an alert.
Definition: manage_sql.c:8883
const char * alert_task_iterator_name(iterator_t *iterator)
Return the name from an alert task iterator.
Definition: manage_sql.c:14716
A report format file iterator.
Definition: manage.h:3215
void set_task_target(task_t task, target_t target)
Set the target of a task.
Definition: manage_sql.c:19308
char * nvt_preference_iterator_real_name(iterator_t *iterator)
Get the real name from an NVT preference iterator.
Definition: manage_sql.c:41372
void init_severity_data(severity_data_t *data)
Initialize a severity data structure.
Definition: manage.c:1003
int config_in_use(config_t config)
Return whether a config is referenced by a task.
Definition: manage_sql.c:37829
int init_system_report_type_iterator(report_type_iterator_t *iterator, const char *type, const char *slave_id)
Initialise a system report type iterator.
Definition: manage.c:6463
int task_schedule_in_trash(task_t task)
Get whether the task schedule is in the trash.
Definition: manage_sql.c:20256
char * target_exclude_hosts(target_t target)
Return the excluded hosts associated with a target.
Definition: manage_sql.c:36218
void init_target_iterator_one(iterator_t *iterator, target_t target)
Initialise a target iterator, given a single target.
Definition: manage_sql.c:35779
int manage_scap_db_version()
Return the database version of the actual database.
Definition: manage_sql.c:6346
void set_scan_host_end_time(report_t report, const char *host, const char *timestamp)
Set the end time of a scanned host.
Definition: manage_sql.c:26084
void trim_partial_report(report_t report)
Prepare a partial report for resumption of the scan.
Definition: manage_sql.c:27165
int task_in_trash_id(const gchar *task_id)
Return whether a task is in the trashcan.
Definition: manage_sql.c:19071
int manage_max_hosts()
Get the maximum allowed number of hosts per target.
Definition: manage_sql.c:34161
const char * alert_task_iterator_uuid(iterator_t *iterator)
Return the uuid from an alert task iterator.
Definition: manage_sql.c:14732
const char * note_iterator_threat(iterator_t *iterator)
Get the threat from a note iterator.
Definition: manage_sql.c:46122
int result_iterator_may_have_overrides(iterator_t *iterator)
Get whether overrides may exist from a result iterator.
Definition: manage_sql.c:25107
int report_format_active(report_format_t report_format)
Return whether a report format is active.
Definition: manage_sql.c:52625
gchar * alert_condition_description(alert_condition_t condition, alert_t alert)
Get a description of an alert condition.
Definition: manage.c:1269
int init_agent_iterator(iterator_t *iterator, const get_data_t *get)
Initialise an agent iterator.
Definition: manage_sql.c:44913
gchar * credential_encrypted_value(credential_t credential, const char *value_name)
Get a possibly encrypted credential value in decrypted form.
Definition: manage_sql.c:43018
int integer_value
Integer value of the keyword.
Definition: manage.h:3585
int manage_set_config_nvts(const gchar *config_id, const char *family, GPtrArray *selected_nvts)
Set the NVT's selected for a single family of a config.
Definition: manage_sql.c:38357
const char * result_iterator_nvt_xref(iterator_t *iterator)
Get the NVT XREF from a result iterator.
Definition: manage_sql.c:24769
int manage_task_update_file(const gchar *task_id, const char *name, const void *content)
Add a file to a task, or update the file on the task.
Definition: manage_sql.c:33778
const char * result_iterator_original_level(iterator_t *iterator)
Get the original severity/threat level from a result iterator.
Definition: manage_sql.c:24974
int task_last_resumable_report(task_t task, report_t *report)
Get the report from the most recently stopped invocation of task.
Definition: manage_sql.c:19889
char * task_owner_name(task_t task)
Return the name of the owner of a task.
Definition: manage_sql.c:19086
int create_task_check_config_scanner(config_t config, scanner_t scanner)
Check scanner and config values match for a task.
Definition: manage_sql.c:37091
gchar * value
Value of param.
Definition: manage.h:3107
gboolean find_scanner_with_permission(const char *uuid, scanner_t *scanner, const char *permission)
Find a scanner for a specific permission, given a UUID.
Definition: manage_sql.c:48060
void add_task_alert(task_t task, alert_t alert)
Add an alert to a task.
Definition: manage_sql.c:19939
char * target_name(target_t target)
Return the name of a target.
Definition: manage_sql.c:36121
int init_report_iterator(iterator_t *iterator, const get_data_t *get)
Initialise a report iterator, including observed reports.
Definition: manage_sql.c:23364
void insert_report_host_detail(report_t report, const char *host, const char *s_type, const char *s_name, const char *s_desc, const char *name, const char *value)
Insert a host detail into a report.
Definition: manage_sql.c:22293
int report_counts(const char *report_id, int *debugs, int *holes, int *infos, int *logs, int *warnings, int *false_positives, double *severity, int override, int autofp, int min_qod)
Get the message counts for a report given the UUID.
Definition: manage_sql.c:26345
report_t result_iterator_report(iterator_t *iterator)
Get the report from a result iterator.
Definition: manage_sql.c:24863
char * trash_credential_uuid(credential_t credential)
Get the UUID of a Credential in the trashcan.
Definition: manage_sql.c:43775
gchar * truncate_certificate(const gchar *certificate)
Truncate a certificate, removing extra data.
Definition: manage.c:180
int alert_writable(alert_t alert)
Return whether a alert is writable.
Definition: manage_sql.c:8666
int trash_task_writable(task_t task)
Return whether a trashcan task is writable.
Definition: manage_sql.c:15352
scanner_t config_iterator_scanner(iterator_t *iterator)
Get the scanner from a config iterator.
Definition: manage_sql.c:37795
int target_iterator_snmp_credential(iterator_t *iterator)
Get the SNMP LSC credential from a target iterator.
Definition: manage_sql.c:36047
gboolean find_resource(const char *type, const char *uuid, resource_t *resource)
Find a resource given a UUID.
Definition: manage_sql.c:4568
int trash_agent_in_use(agent_t agent)
Check whether a trashcan agent is writable.
Definition: manage_sql.c:44707
void set_task_end_time_epoch(task_t task, time_t time)
Set the end time of a task.
Definition: manage_sql.c:25874
A port.
Definition: manage.h:189
gboolean find_note_with_permission(const char *uuid, note_t *note, const char *permission)
Find a note for a specific permission, given a UUID.
Definition: manage_sql.c:45226
int config_type(config_t config)
Return the type of a config.
Definition: manage_sql.c:37024
void set_db_version(int version)
Set the database version of the actual database.
Definition: manage_sql.c:6463
int create_report_format(const char *uuid, const char *name, const char *content_type, const char *extension, const char *summary, const char *description, int global, array_t *files, array_t *params, array_t *params_options, const char *signature, report_format_t *report_format)
Create a report format.
Definition: manage_sql.c:51130
void set_scan_ports(report_t report, const char *host, unsigned int current, unsigned int max)
Set the ports for a particular host in a scan.
Definition: manage_sql.c:33643
scanner_t task_scanner(task_t task)
Return the scanner of a task.
Definition: manage_sql.c:19354
A generic SQL iterator structure.
Definition: iterator.h:50
const char * result_iterator_original_severity(iterator_t *iterator)
Get the original severity from a result iterator.
Definition: manage_sql.c:24901
int trash_credential_writable(credential_t credential)
Check whether a trashcan Credential is writable.
Definition: manage_sql.c:42984
const char * result_iterator_nvt_name(iterator_t *iterator)
Get the NVT name from a result iterator.
Definition: manage_sql.c:24679
char * nvt_oid
OID of NVT preference affects.
Definition: manage.h:1820
char * hr_name
Extended, more human-readable name used by OSP.
Definition: manage.h:1823
const char * alert_data_iterator_data(iterator_t *iterator)
Return the data from an alert data iterator.
Definition: manage_sql.c:8938
int init_result_get_iterator(iterator_t *iterator, const get_data_t *get, report_t report, const char *host, const gchar *extra_order)
Initialise a result iterator.
Definition: manage_sql.c:24517
int trash_agent_writable(agent_t agent)
Check whether a trashcan agent is writable.
Definition: manage_sql.c:44733
gchar * column
The column prefix, or NULL.
Definition: manage.h:3583
result_t result_iterator_result(iterator_t *iterator)
Get the result from a result iterator.
Definition: manage_sql.c:24635
int result_uuid(result_t result, char **id)
Return the UUID of a result.
Definition: manage_sql.c:21349
gchar * summary
Summary of command.
Definition: manage.h:102
gchar * get_nvti_xml(iterator_t *nvts, int details, int pref_count, int preferences, const char *timeout, config_t config, int close_tag)
Create and return XML description for an NVT.
Definition: manage.c:8113
int target_iterator_ssh_trash(iterator_t *iterator)
Get the location of the SSH LSC credential from a target iterator.
Definition: manage_sql.c:35881
int schedule_writable(schedule_t schedule)
Return whether a schedule is writable.
Definition: manage_sql.c:49966
const char * override_iterator_threat(iterator_t *iterator)
Get the threat from a override iterator.
Definition: manage_sql.c:47422
gchar * name
Name.
Definition: manage.h:59
int * counts
Counts.
Definition: manage.h:1002
int init_task_iterator(iterator_t *iterator, const get_data_t *get)
Initialise a task iterator.
Definition: manage_sql.c:15113
int trash_report_format_in_use(report_format_t report_format)
Return whether a report format in trash is referenced by an alert.
Definition: manage_sql.c:52531
int trash_config_writable(config_t config)
Return whether a trashcan config is writable.
Definition: manage_sql.c:37888
time_t schedule_iterator_first_time(iterator_t *iterator)
Get the first time from a schedule iterator.
Definition: manage_sql.c:50240
int modify_agent(const char *agent_id, const char *name, const char *comment)
Modify an agent.
Definition: manage_sql.c:44544
gchar * manage_user_hash(const gchar *username)
Get user hash.
Definition: manage_sql.c:18409
int delete_alert(const char *alert_id, int ultimate)
Delete an alert.
Definition: manage_sql.c:8309
task_t make_task(char *name, char *comment, int in_assets, int event)
Make a task.
Definition: manage_sql.c:33029
task_t current_scanner_task
The task currently running on the scanner.
Definition: manage.c:1161
void set_nvts_feed_version(const char *feed_version)
Set the feed version of the plugins in the plugin cache.
Definition: manage_sql_nvts.c:128
gboolean find_trash_task_with_permission(const char *uuid, task_t *task, const char *permission)
Find a task in the trashcan for a specific permission, given a UUID.
Definition: manage_sql.c:33677
void append_to_task_comment(task_t task, const char *text, int length)
Append text to the comment associated with a task.
Definition: manage_sql.c:33629
gchar * type_max
Maximum value for integer type.
Definition: manage.h:3105
int report_result_host_count(report_t report, int min_qod)
Count a report's total number of hosts with results.
Definition: manage_sql.c:28528
char * credential_name(credential_t credential)
Get the name of an LSC credential.
Definition: manage_sql.c:43790
int config_nvts_growing(config_t config)
Get the NVT growth status of a config.
Definition: manage_sql.c:39948
char * alert_iterator_filter_name(iterator_t *iterator)
Return the filter name from an alert iterator.
Definition: manage_sql.c:8807
void init_preference_iterator(iterator_t *iterator, config_t config)
Initialise a preference iterator.
Definition: manage_sql.c:37920
void filter_free(array_t *split)
Free a split filter.
Definition: manage_sql.c:1959
int trash_target_writable(target_t target)
Return whether a trashcan target is writable.
Definition: manage_sql.c:36495
int modify_note(const gchar *note_id, const char *active, const char *nvt, const char *text, const char *hosts, const char *port, const char *severity, const char *threat, const gchar *task_id, const gchar *result_id)
Modify a note.
Definition: manage_sql.c:45518
char * task_config_name(task_t task)
Return the name of the config of a task.
Definition: manage_sql.c:19233
gchar * type_min
Minimum value for integer type.
Definition: manage.h:3106
int trash_scanner_writable(scanner_t scanner)
Check whether a trashcan scanner is writable.
Definition: manage_sql.c:48974
const char * alert_method_name(alert_method_t method)
Get the name of an alert method.
Definition: manage.c:1358
int manage_set_config(const gchar *config_id, const char *name, const char *comment, const char *scanner_id)
Set the name, comment and scanner of a config.
Definition: manage_sql.c:38284
void manage_auth_allow_all(int scheduled)
Ensure that any subsequent authentications succeed.
Definition: manage.c:6854
char * filt_id
Filter ID. Overrides "filter".
Definition: manage.h:319
gchar * app_location(report_host_t report_host, const gchar *app)
Get the location of an App for a report's host.
Definition: manage_sql.c:21569
int host_iterator_max_port(iterator_t *iterator)
Get the max port from a host iterator.
Definition: manage_sql.c:25313
int note_iterator_active(iterator_t *iterator)
Get the active status from an note iterator.
Definition: manage_sql.c:46184
char * type
Type of preference (radio, password, ...).
Definition: manage.h:1817
void init_user_config_iterator(iterator_t *iterator, config_t config, int trash, int ascending, const char *sort_field)
Initialise a config iterator, limited to user's configs.
Definition: manage_sql.c:37632
void init_config_task_iterator(iterator_t *iterator, config_t config, int ascending)
Initialise a config task iterator.
Definition: manage_sql.c:38630
int trash_schedule_writable(schedule_t schedule)
Return whether a trashcan schedule is writable.
Definition: manage_sql.c:49979
gchar * certificate_iso_time(time_t time)
Converts a certificate time to an ISO time string.
Definition: manage.c:405
char * threat
Threat.
Definition: manage.h:1187
int override_uuid(override_t override, char **id)
Return the UUID of an override.
Definition: manage_sql.c:46461
char * description
Description of the message.
Definition: manage.h:205
void manage_sync(sigset_t *sigmask_current, int(*fork_update_nvt_cache)())
Perform any syncing that is due.
Definition: manage.c:7209
char * scanner_host(scanner_t scanner)
Return the host of a scanner.
Definition: manage_sql.c:49051
char * trash_schedule_uuid(schedule_t schedule)
Return the UUID of a trash schedule.
Definition: manage_sql.c:50031
int alert_iterator_filter_trash(iterator_t *iterator)
Return the location of an alert iterator filter.
Definition: manage_sql.c:8832
int init_schedule_iterator(iterator_t *iterator, const get_data_t *get)
Initialise a schedule iterator.
Definition: manage_sql.c:50214
report_t global_current_report
The report of the current task.
Definition: manage.c:1166
double max
Max.
Definition: manage.h:1004
int nvt_iterator_category(iterator_t *iterator)
Get the category from an NVT iterator.
Definition: manage_sql_nvts.c:866
gboolean find_report_with_permission(const char *uuid, report_t *report, const char *permission)
Find a report for a specific permission, given a UUID.
Definition: manage_sql.c:33730
int manage_scap_db_supported_version()
Return the database version supported by this manager.
Definition: manage_sql.c:6335
report_t task_iterator_current_report(iterator_t *iterator)
Return the current report of a task.
Definition: manage_sql.c:19628
void init_scanner_task_iterator(iterator_t *iterator, scanner_t scanner)
Initialise a scanner task iterator.
Definition: manage_sql.c:48857
char * report_format_extension(report_format_t report_format)
Return the extension of a report format.
Definition: manage_sql.c:52581
int task_schedule_next_time(task_t task)
Get next time a scheduled task will run, following schedule timezone.
Definition: manage_sql.c:20306
keyword_type_t type
Type of keyword.
Definition: manage.h:3589
int trash_credential_in_use(credential_t credential)
Check whether a trashcan Credential is in use.
Definition: manage_sql.c:42934
char * tag_uuid(tag_t tag)
Return the UUID of a tag.
Definition: manage_sql.c:36079
int total
Total.
Definition: manage.h:1003
int host_iterator_current_port(iterator_t *iterator)
Get the current port from a host iterator.
Definition: manage_sql.c:25297
int severity_matches_ov(double severity, double ov_severity)
Check whether a severity matches an override's severity.
Definition: manage.c:782
void manage_transaction_stop(gboolean force_commit)
Commit the current transaction, if any.
Definition: manage_sql.c:34329
gchar * manage_report(report_t report, report_t delta_report, const get_data_t *get, const report_format_t report_format, int notes_details, int overrides_details, const char *type, gsize *output_length, gchar **extension, gchar **content_type, gchar **filter_term_return, gchar **zone_return, gchar **host_summary)
Generate a report.
Definition: manage_sql.c:31690
int init_override_iterator(iterator_t *iterator, const get_data_t *get, nvt_t nvt, result_t result, task_t task)
Initialise an override iterator.
Definition: manage_sql.c:47249
const gchar * get_scheduled_user_uuid()
Access UUID of user that scheduled the current task.
Definition: manage.c:6865
char * scanner_name(scanner_t scanner)
Return the name of a scanner.
Definition: manage_sql.c:49012
int family_nvt_count(const char *family)
Get the number of NVTs in one or all families.
Definition: manage_sql_nvts.c:940
GPtrArray * start
Array of files.
Definition: manage.h:3217
char * report_slave_task_uuid(report_t report)
Return the UUID of the task on the slave.
Definition: manage_sql.c:27100
char * ovaldef_version(const char *id)
Get the version of an OVALDEF using an ID.
Definition: manage_sql_secinfo.c:703
gboolean report_task(report_t report, task_t *task)
Return the task of a report.
Definition: manage_sql.c:22806
int manage_db_version()
Return the database version of the actual database.
Definition: manage_sql.c:6309
A command.
Definition: manage.h:99
gchar * name
Name.
Definition: manage.h:3103
char * report_format_name(report_format_t report_format)
Return the name of a report format.
Definition: manage_sql.c:52480
int init_scanner_iterator(iterator_t *iterator, const get_data_t *get)
Initialise an scanner iterator.
Definition: manage_sql.c:48631
time_t override_iterator_end_time(iterator_t *iterator)
Get the end time from an override iterator.
Definition: manage_sql.c:47483
void init_report_errors_iterator(iterator_t *iterator, report_t report)
Initialise a report errors iterator.
Definition: manage_sql.c:25364
const char * credential_iterator_private_key(iterator_t *iterator)
Get the private_key from a Credential iterator.
Definition: manage_sql.c:43503
gboolean find_credential_with_permission(const char *uuid, credential_t *credential, const char *permission)
Find a credential for a specific permission, given a UUID.
Definition: manage_sql.c:41659
int init_ovaldef_info_iterator(iterator_t *iterator, get_data_t *get, const char *name)
Initialise an OVAL definition (ovaldef) info iterator.
Definition: manage_sql_secinfo.c:477
int init_all_info_iterator(iterator_t *iterator, get_data_t *get, const char *name)
Initialise an info iterator.
Definition: manage_sql_secinfo.c:1198
const char * task_iterator_first_report(iterator_t *iterator)
Get the first report UUID from a task iterator.
Definition: manage_sql.c:15202
void clear_duration_schedules(task_t task)
Clear once-off schedules from tasks where the duration has passed.
Definition: manage_sql.c:20577
int manage_task_remove_file(const gchar *task_id, const char *name)
Remove a file on a task.
Definition: manage_sql.c:33835
int schedule_period(schedule_t schedule)
Return the period of a schedule.
Definition: manage_sql.c:50073
int trash_config_readable_uuid(const gchar *config_id)
Return whether a trashcan config is readable.
Definition: manage_sql.c:37901
report_format_param_type_t report_format_param_type_from_name(const char *name)
Get a report format param type from a name.
Definition: manage.c:7465
void set_task_scanner(task_t task, scanner_t scanner)
Set the scanner of a task.
Definition: manage_sql.c:19379
void init_ovaldi_file_iterator(iterator_t *iterator)
Initialise an ovaldi file iterator.
Definition: manage_sql_secinfo.c:1413
gchar * name
Command name.
Definition: manage.h:101
int copy_agent(const char *name, const char *comment, const char *agent_id, agent_t *new_agent)
Create an agent from an existing agent.
Definition: manage_sql.c:44523
const char * override_iterator_nvt_type(iterator_t *iterator)
Get the NVT type from a override iterator.
Definition: manage_sql.c:47525
const char * credential_full_type(const char *abbreviation)
Get the written-out name of an LSC Credential type.
Definition: manage.c:6215
int trash_scanner_in_use(scanner_t scanner)
Check whether a trashcan scanner is writable.
Definition: manage_sql.c:48941
time_t schedule_iterator_next_time(iterator_t *iterator)
Get the next time a schedule could be schedulable.
Definition: manage_sql.c:50353
int modify_override(const gchar *override_id, const char *active, const char *nvt, const char *text, const char *hosts, const char *port, const char *threat, const char *new_threat, const char *severity, const char *new_severity, const gchar *task_id, const gchar *result_id)
Modify an override.
Definition: manage_sql.c:46618
int scanner_task_iterator_readable(iterator_t *iterator)
Get the read permission status from a GET iterator.
Definition: manage_sql.c:48911
int alert_task_iterator_readable(iterator_t *iterator)
Get the read permission status from a GET iterator.
Definition: manage_sql.c:14748
char * alert_iterator_filter_uuid(iterator_t *iterator)
Return the filter UUID from an alert iterator.
Definition: manage_sql.c:8782
int get_schedule_timeout()
Get the current schedule timeout.
Definition: manage.c:7405
int osp_get_details_from_iterator(iterator_t *iterator, char **desc, GSList **params)
Get an OSP Scanner's get_scanner_details info.
Definition: manage_sql.c:49347
void alert_report_data_free(alert_report_data_t *data)
Frees a alert_report_data_t struct, including contained data.
Definition: manage.c:1176
int target_iterator_snmp_trash(iterator_t *iterator)
Get the SNMP LSC credential location from a target iterator.
Definition: manage_sql.c:36063
time_t note_iterator_end_time(iterator_t *iterator)
Get the end time from an note iterator.
Definition: manage_sql.c:46168
char * target_reverse_lookup_only(target_t target)
Return the reverse_lookup_only value of a target.
Definition: manage_sql.c:36232
char * description
Description of NVT.
Definition: manage.h:1178
int credential_scanner_iterator_readable(iterator_t *iterator)
Get the read permission status from a Credential Scanner iterator.
Definition: manage_sql.c:43996
int authenticate(credentials_t *credentials)
Authenticate credentials.
Definition: manage_sql.c:18855
int report_host_noticeable(report_t report, const gchar *host)
Check if a report host is alive and has at least one result.
Definition: manage_sql.c:32651
int modify_task_check_config_scanner(task_t task, const char *config_id, const char *scanner_id)
Check scanner and config values match for a task.
Definition: manage_sql.c:37122
int scanner_iterator_type(iterator_t *iterator)
Get the type from an scanner iterator.
Definition: manage_sql.c:48675
const char * result_iterator_nvt_cve(iterator_t *iterator)
Get the NVT CVE from a result iterator.
Definition: manage_sql.c:24733
int target_iterator_port_list_trash(iterator_t *iterator)
Get the location of the port list from a target iterator.
Definition: manage_sql.c:35931
char * trash_scanner_name(scanner_t scanner)
Return the name of a scanner in the trashcan.
Definition: manage_sql.c:49236
gchar * subtype
Subtype, or NULL.
Definition: manage.h:326
task_status_t task_iterator_run_status(iterator_t *iterator)
Get the run status from a task iterator.
Definition: manage_sql.c:15172
char * ovaldef_cves(const char *id)
Get the CVE names of an OVALDEF as ", " separated str.
Definition: manage_sql_secinfo.c:724
A CREATE_REPORT result.
Definition: manage.h:1176
void set_scan_start_time_epoch(report_t report, time_t timestamp)
Set the start time of a scan.
Definition: manage_sql.c:25951
int agent_count(const get_data_t *get)
Count number of agents.
Definition: manage_sql.c:45064
gchar * field
The field to sort by.
Definition: manage.h:4285
result_t make_result(task_t task, const char *host, const char *hostname, const char *port, const char *nvt, const char *type, const char *description)
Make a result.
Definition: manage_sql.c:21220
void init_target_task_iterator(iterator_t *iterator, target_t target)
Initialise a target task iterator.
Definition: manage_sql.c:36509
char * source_type
Source type.
Definition: manage.h:1199
int schedule_task_iterator_readable(iterator_t *iterator)
Get the read permission status from a GET iterator.
Definition: manage_sql.c:50687
char * value
Value of preference.
Definition: manage.h:1818
char * scanner_ca_pub(scanner_t scanner)
Return the CA Certificate of a scanner.
Definition: manage_sql.c:49104
void host_detail_free(host_detail_t *detail)
Free a host detail.
Definition: manage_sql.c:22271
gboolean find_task_with_permission(const char *uuid, task_t *task, const char *permission)
Find a task for a specific permission, given a UUID.
Definition: manage_sql.c:33661
void set_task_alterable(task_t task, int alterable)
Set the alterable state of a task.
Definition: manage_sql.c:20005
gchar * type
Type (boolean, string, integer, ...).
Definition: manage.h:3104
int scan_host_end_time(report_t report, const char *host)
Get the end time of a scanned host.
Definition: manage_sql.c:26063
int equal
Whether the keyword is like "=example".
Definition: manage.h:3584
int init_config_iterator(iterator_t *iterator, const get_data_t *get)
Initialise a scan config iterator.
Definition: manage_sql.c:37679
void init_cve_dfn_cert_adv_iterator(iterator_t *iterator, const char *cve, int ascending, const char *sort_field)
Initialise CVE iterator, for CVEs referenced by a DFN-CERT advisory.
Definition: manage_sql_secinfo.c:1060
command_t gmp_commands[]
The GMP command list.
Definition: manage_sql.c:566
void set_task_start_time_epoch(task_t task, int time)
Set the start time of a task.
Definition: manage_sql.c:19721
Command data for a get command.
Definition: manage.h:316
int manage_decrypt_all_credentials(GSList *log_config, const gchar *database)
Decrypt all credentials.
Definition: manage_sql.c:6646
char * schedule_uuid(schedule_t schedule)
Return the UUID of a schedule.
Definition: manage_sql.c:50017
const char * agent_iterator_trust(iterator_t *iterator)
Get the trust value from an agent iterator.
Definition: manage_sql.c:45008
void init_report_host_iterator(iterator_t *iterator, report_t report, const char *host, report_host_t report_host)
Initialise a host iterator.
Definition: manage_sql.c:25164
const char * keyword_relation_symbol(keyword_relation_t relation)
Get the symbol of a keyword relation.
Definition: manage_sql.c:1431
gboolean find_override_with_permission(const char *uuid, override_t *override, const char *permission)
Find a override for a specific permission, given a UUID.
Definition: manage_sql.c:46252
gchar * event_description(event_t event, const void *event_data, const char *task_name)
Get a description of an alert event.
Definition: manage.c:1317
double aggregate_iterator_min(iterator_t *iterator, int data_column_index)
Get the minimum from an aggregate iterator.
Definition: manage_sql.c:5977
credential_t trash_target_credential(target_t target, const char *type)
Get a credential from a target in the trashcan.
Definition: manage_sql.c:34562
void manage_report_filter_controls(const gchar *filter, int *first, int *max, gchar **sort_field, int *sort_order, int *result_hosts_only, gchar **min_qod, gchar **levels, gchar **delta_states, gchar **search_phrase, int *search_phrase_exact, int *autofp, int *notes, int *overrides, int *apply_overrides, gchar **zone)
Get info from a filter for report.
Definition: manage_sql.c:2416
gboolean find_nvt(const char *oid, nvt_t *nvt)
Find an NVT given an identifier.
Definition: manage_sql_nvts.c:148
An NVT selector.
Definition: manage.h:1829
const char * result_iterator_nvt_cvss_base(iterator_t *iterator)
Get the NVT CVSS base value from a result iterator.
Definition: manage_sql.c:24715
void set_credential_privacy_algorithm(credential_t credential, const char *algorithm)
Set the privacy_algorithm of a Credential.
Definition: manage_sql.c:43138
time_t schedule_iterator_period(iterator_t *iterator)
Get the period from a schedule iterator.
Definition: manage_sql.c:50256
void cleanup_manage_process(gboolean cleanup)
Cleanup the manage library.
Definition: manage_sql.c:18334
void init_scanner_config_iterator(iterator_t *iterator, scanner_t scanner)
Initialise a scanner config iterator.
Definition: manage_sql.c:48790
int manage_set_config_families(const gchar *config_id, GPtrArray *growing_all_families, GPtrArray *static_all_families, GPtrArray *growing_families, int grow_families)
Refresh NVT selection of a config from given families.
Definition: manage_sql.c:40471
int cve_info_count(const get_data_t *get)
Count number of cve.
Definition: manage_sql_secinfo.c:315
const char * result_iterator_nvt_bid(iterator_t *iterator)
Get the NVT BID from a result iterator.
Definition: manage_sql.c:24751
task_t note_iterator_task(iterator_t *iterator)
Get the task from a note iterator.
Definition: manage_sql.c:46139
void update_duration_schedule_periods(task_t task)
Update tasks with limited run schedules which have durations.
Definition: manage_sql.c:20622
int create_alert(const char *name, const char *comment, const char *filter_id, const char *active, event_t event, GPtrArray *event_data, alert_condition_t condition, GPtrArray *condition_data, alert_method_t method, GPtrArray *method_data, alert_t *alert)
Create an alert.
Definition: manage_sql.c:7672
int manage_set_config_preference(const gchar *config_id, const char *nvt, const char *name, const char *value_64)
Set a preference of a config.
Definition: manage_sql.c:38086
int cert_bund_adv_info_count(const get_data_t *get)
Count number of cert_bund_adv.
Definition: manage_sql_secinfo.c:812
const char * credential_iterator_privacy_password(iterator_t *iterator)
Get the privacy password from a Credential iterator.
Definition: manage_sql.c:43533
int set_task_preferences(task_t task, array_t *preferences)
Set the preferences of a task.
Definition: manage_sql.c:41544
Struct for defining a report format param.
Definition: manage.h:3100
int manage_backup_db(const gchar *database)
Backup the database to a file.
Definition: manage_pg.c:3707
gboolean find_config_with_permission(const char *uuid, config_t *config, const char *permission)
Find a config for a set of permissions, given a UUID.
Definition: manage_sql.c:36586
gchar * content_type
The MIME content type of the report.
Definition: manage.h:401
void set_task_start_time_otp(task_t task, char *time)
Set the start time of a task.
Definition: manage_sql.c:19736
gboolean find_target_with_permission(const char *uuid, target_t *target, const char *permission)
Find a target for a specific permission, given a UUID.
Definition: manage_sql.c:34187
int modify_alert(const char *alert_id, const char *name, const char *comment, const char *filter_id, const char *active, event_t event, GPtrArray *event_data, alert_condition_t condition, GPtrArray *condition_data, alert_method_t method, GPtrArray *method_data)
Modify an alert.
Definition: manage_sql.c:8015
int task_iterator_total_reports(iterator_t *iterator)
Get the number of reports of a task iterator.
Definition: manage_sql.c:15188
double aggregate_iterator_mean(iterator_t *iterator, int data_column_index)
Get the mean from an aggregate iterator.
Definition: manage_sql.c:6009
gboolean find_schedule_with_permission(const char *uuid, schedule_t *schedule, const char *permission)
Find a schedule for a specific permission, given a UUID.
Definition: manage_sql.c:49588
int manage_trash_resource_name(const char *type, const char *uuid, char **name)
Get the name of a trashcan resource.
Definition: manage_sql.c:5114
int report_format_predefined(report_format_t report_format)
Return whether a report format is predefined.
Definition: manage_sql.c:52612
int nvt_selector_family_growing(const char *selector, const char *family, int all)
Get whether an NVT selector family is growing.
Definition: manage_sql.c:40141
void init_schedule_task_iterator(iterator_t *iterator, schedule_t schedule)
Initialise a schedule task iterator.
Definition: manage_sql.c:50632
double report_severity(report_t report, int overrides, int min_qod)
Get the maximum severity of a report.
Definition: manage_sql.c:26755
result_t note_iterator_result(iterator_t *iterator)
Get the result from a note iterator.
Definition: manage_sql.c:46153
int nvt_selector_nvt_count(const char *selector, const char *family, int growing)
Get the number of NVTs selected by an NVT selector.
Definition: manage_sql.c:40201
keyword_relation_t relation
The relation.
Definition: manage.h:3590
int manage_delete_scanner(GSList *log_config, const gchar *database, const gchar *uuid)
Delete the given scanner.
Definition: manage_sql.c:47740
char * task_severity(task_t task, int overrides, int min_qod, int offset)
Return the severity score of a task, taking overrides into account.
Definition: manage_sql.c:20383
int ignore_max_rows_per_page
Definition: manage.h:327
int set_task_schedule_periods_id(task_t task, int periods)
Set the schedule periods of a task, given an ID.
Definition: manage_sql.c:20179
task_status_t task_run_status(task_t task)
Return the run state of a task.
Definition: manage_sql.c:19409
char * nvt_preference_iterator_config_value(iterator_t *iterator, config_t config)
Get the config value from an NVT preference iterator.
Definition: manage_sql.c:41454
gchar * string
The keyword string, outer quotes removed.
Definition: manage.h:3588
char * trash_scanner_uuid(scanner_t scanner)
Return the UUID of a scanner in the trashcan.
Definition: manage_sql.c:49250
int trash_target_in_use(target_t target)
Return whether a trashcan target is referenced by a task.
Definition: manage_sql.c:36466
char * severity
Severity score.
Definition: manage.h:1186
void init_report_iterator_task(iterator_t *iterator, task_t task)
Initialise a report iterator.
Definition: manage_sql.c:23423
char * hostname
Hostname message describes.
Definition: manage.h:203
int task_alterable(task_t task)
Return whether a task is an Alterable Task.
Definition: manage_sql.c:15322
void cleanup_severity_data(severity_data_t *data)
Clean up a severity data structure.
Definition: manage.c:1020
credential_t scanner_iterator_credential(iterator_t *iterator)
Get the credential of the scanner from a scanner iterator.
Definition: manage_sql.c:48711
gchar * xml_escape_text_truncated(const char *string, size_t max_len, const char *suffix)
XML escapes text truncating to a maximum length with a suffix.
Definition: manage.c:513
int init_report_format_file_iterator(file_iterator_t *iterator, report_format_t report_format)
Initialise a report format file iterator.
Definition: manage.c:7577
char * value
Detail value.
Definition: manage.h:1200
int task_in_trash(task_t task)
Return whether a task is in the trashcan.
Definition: manage_sql.c:19054
int override_count(const get_data_t *get, nvt_t nvt, result_t result, task_t task)
Count number of overrides.
Definition: manage_sql.c:47118
int result_iterator_may_have_tickets(iterator_t *iterator)
Get whether tickets may exist from a result iterator.
Definition: manage_sql.c:25121
int config_count(const get_data_t *get)
Count the number of scan configs.
Definition: manage_sql.c:37613
int trash_scanner_readable(scanner_t scanner)
Return whether a trashcan scanner is readable.
Definition: manage_sql.c:48987
int copy_schedule(const char *name, const char *comment, const char *schedule_id, schedule_t *new_schedule)
Create a schedule from an existing schedule.
Definition: manage_sql.c:49796
char * trash_target_name(target_t target)
Return the name of a trashcan target.
Definition: manage_sql.c:36135
int trash_target_credential_location(target_t target, const char *type)
Get whether a credential of a trash target is in trashcan.
Definition: manage_sql.c:34603
gchar * type
Type of resource.
Definition: manage.h:325
void set_task_end_time(task_t task, char *time)
Set the end time of a task.
Definition: manage_sql.c:25853
int init_cpe_info_iterator(iterator_t *iterator, get_data_t *get, const char *name)
Initialise a info iterator.
Definition: manage_sql_secinfo.c:149
int all_info_count(const get_data_t *get)
Count number of SecInfo entries.
Definition: manage_sql_secinfo.c:1129
int total_info_count(const get_data_t *get, int filtered)
Count number of all SecInfo entries.
Definition: manage_sql_secinfo.c:1143
int manage_create_scanner(GSList *log_config, const gchar *database, const char *name, const char *host, const char *port, const char *type, const char *ca_pub_path, const char *key_pub_path, const char *key_priv_path)
Create the given scanner.
Definition: manage_sql.c:47582
char * type
Name of NVT selector.
Definition: manage.h:1832
int task_uuid(task_t task, char **id)
Return the UUID of a task.
Definition: manage_sql.c:19039
int trash_target_login_port(target_t target, const char *type)
Get a port from a target in the trashcan.
Definition: manage_sql.c:34681
void init_config_timeout_iterator(iterator_t *iterator, config_t config)
Initialise a config timeout iterator.
Definition: manage_sql.c:38704
void set_schedule_timeout(int new_timeout)
Set the schedule timeout.
Definition: manage.c:7416
const char * aggregate_iterator_value(iterator_t *iterator)
Get the value of the group column from a statistics iterator.
Definition: manage_sql.c:6065
int alert_in_use(alert_t alert)
Return whether a alert is in use by a task.
Definition: manage_sql.c:8636
int scanner_iterator_credential_trash(iterator_t *iterator)
Get the credential location of the scanner from a scanner iterator.
Definition: manage_sql.c:48727
char * trash_target_uuid(target_t target)
Return the UUID of a trashcan target.
Definition: manage_sql.c:36107
int trash_alert_writable(alert_t alert)
Return whether a trashcan alert is writable.
Definition: manage_sql.c:8679
static int fork_update_nvt_cache()
Update the NVT cache in a child process.
Definition: gvmd.c:1217
int request_delete_task(task_t *task_pointer)
Request deletion of a task.
Definition: manage_sql.c:33227
char * task_comment(task_t task)
Return the comment of a task.
Definition: manage_sql.c:19130
int agent_in_use(agent_t agent)
Check whether an agent is in use.
Definition: manage_sql.c:44694
gboolean credential_iterator_format_available(iterator_t *iterator, credential_format_t format)
Test if a credential format is available for an iterator.
Definition: manage_sql.c:43678
int verify_agent(const char *agent_id)
Verify an agent.
Definition: manage_sql.c:45082
const gchar * certificate_time_status(time_t activates, time_t expires)
Tests the activation and expiration time of a certificate.
Definition: manage.c:424
char * nvt_oid(const char *name)
Guess the OID of an NVT given a name.
Definition: manage_sql_nvts.c:98
int init_note_iterator(iterator_t *iterator, const get_data_t *get, nvt_t nvt, result_t result, task_t task)
Initialise a note iterator.
Definition: manage_sql.c:45950
int resource_count(const char *type, const get_data_t *get)
Return number of resources of a certain type for current user.
Definition: manage_sql.c:18928
int modify_report(const char *report_id, const char *comment)
Modify a report.
Definition: manage_sql.c:26944
int alert_iterator_filter_readable(iterator_t *iterator)
Return the filter readable state from an alert iterator.
Definition: manage_sql.c:8850
void init_cve_cert_bund_adv_iterator(iterator_t *iterator, const char *cve, int ascending, const char *sort_field)
Initialise CVE iterator, for CVEs referenced by a CERT-Bund advisory.
Definition: manage_sql_secinfo.c:876
const char * scanner_uuid_default()
Return the UUID of the default scanner.
Definition: manage_sql.c:49038
gboolean find_alert_with_permission(const char *uuid, alert_t *alert, const char *permission)
Find a alert for a specific permission, given a UUID.
Definition: manage_sql.c:6952
char * manage_nvt_name(nvt_t nvt)
Get the name of an NVT.
Definition: manage_sql_nvts.c:85
const char * credential_iterator_password(iterator_t *iterator)
Get the password from a Credential iterator.
Definition: manage_sql.c:43488
void set_scheduled_user_uuid(const gchar *user_uuid)
Set UUID of user that scheduled the current task. The previous value is freed and a copy of the UUID ...
Definition: manage.c:6877
int task_target_in_trash(task_t task)
Return whether the target of a task is in the trashcan.
Definition: manage_sql.c:19339
void severity_data_level_counts(const severity_data_t *severity_data, const gchar *severity_class, int *errors, int *debugs, int *false_positives, int *logs, int *lows, int *mediums, int *highs)
Count the occurrences of severities in the levels.
Definition: manage.c:1103
void severity_data_add(severity_data_t *severity_data, double severity)
Add a severity occurrence to the counts of a severity_data_t.
Definition: manage.c:1032
char * scan_end_time_uuid(const char *uuid)
Get the end time of a scan.
Definition: manage_sql.c:25995
char * nvt_name
Name of NVT preference affects.
Definition: manage.h:1819
const char * run_status_name(task_status_t status)
Get the name of a run status.
Definition: manage.c:1486
int set_task_groups(task_t task, array_t *groups, gchar **group_id_return)
Set observer groups on a task, removing any previous groups.
Definition: manage_sql.c:20022
int delete_task_lock(task_t task, int ultimate)
Complete deletion of a task.
Definition: manage_sql.c:33518
void alert_report_data_reset(alert_report_data_t *data)
Frees content of an alert_report_data_t, but not the struct itself.
Definition: manage.c:1191
int target_count(const get_data_t *get)
Count number of targets.
Definition: manage_sql.c:35763
void report_set_slave_name(report_t report, const gchar *name)
Set the name of the slave on a report.
Definition: manage_sql.c:22934
const char * report_format_param_type_name(report_format_param_type_t type)
Get the name of a report format param type.
Definition: manage.c:7434
int report_count(const get_data_t *get)
Count number of reports.
Definition: manage_sql.c:23328
int trash_alert_in_use(alert_t alert)
Return whether a trashcan alert is in use by a task.
Definition: manage_sql.c:8650
int copy_alert(const char *name, const char *comment, const char *alert_id, alert_t *new_alert)
Create an alert from an existing alert.
Definition: manage_sql.c:7930
const char * type_name(const char *type)
Return the name of a resource type.
Definition: manage.c:591
task_t result_iterator_task(iterator_t *iterator)
Get the task from a result iterator.
Definition: manage_sql.c:24849
int set_task_schedule_periods(const gchar *task_id, int periods)
Set the schedule periods of a task, given a UUID.
Definition: manage_sql.c:20154
int schedule_in_use(schedule_t schedule)
Return whether a schedule is in use by a task.
Definition: manage_sql.c:49936
Keyword.
Definition: manage.h:3581
gboolean find_report_format_with_permission(const char *uuid, report_format_t *report_format, const char *permission)
Find a reportformat for a specific permission, given a UUID.
Definition: manage_sql.c:51017
const char * task_iterator_trend_counts(iterator_t *iterator, int holes_a, int warns_a, int infos_a, double severity_a, int holes_b, int warns_b, int infos_b, double severity_b)
Return the trend of a task, given counts.
Definition: manage_sql.c:32921
void update_config_preference(const char *config_id, const char *type, const char *preference_name, const char *new_value, gboolean insert)
Update or optionally insert a NVT preference.
Definition: manage_sql.c:38761
int agent_writable(agent_t agent)
Check whether a agent is writable.
Definition: manage_sql.c:44720
time_t task_schedule_next_time_uuid(const gchar *task_id)
Get the next time a scheduled task will be due.
Definition: manage_sql.c:20325
gboolean next_file(file_iterator_t *iterator)
Increment a report type iterator.
Definition: manage.c:7636
gchar * truncate_private_key(const gchar *private_key)
Truncate a private key, removing extra data.
Definition: manage.c:240
char * id
ID of single item to get.
Definition: manage.h:323
int init_alert_iterator(iterator_t *iterator, const get_data_t *get)
Initialise an alert iterator, including observed alerts.
Definition: manage_sql.c:8694
int delete_override(const char *override_id, int ultimate)
Delete a override.
Definition: manage_sql.c:46495
int credential_writable(credential_t credential)
Check whether a Credential is writable.
Definition: manage_sql.c:42971
void init_alert_task_iterator(iterator_t *iterator, alert_t alert, int ascending)
Initialise an alert task iterator.
Definition: manage_sql.c:14676
int manage_send_report(report_t report, report_t delta_report, report_format_t report_format, const get_data_t *get, int notes_details, int overrides_details, int result_tags, int ignore_pagination, int base64, gboolean(*send)(const char *, int(*)(const char *, void *), void *), int(*send_data_1)(const char *, void *), void *send_data_2, const char *alert_id, const char *type, const char *host, int pos, const char *host_search_phrase, const char *host_levels, int host_first_result, int host_max_results, const gchar *prefix)
Generate a report.
Definition: manage_sql.c:32415
char * source_name
Source name.
Definition: manage.h:1198
const char * file_iterator_name(file_iterator_t *iterator)
Return the name from a file iterator.
Definition: manage.c:7652
int manage_scanner_set_default()
Set the default scanner as the scanner to connect to.
Definition: manage_sql.c:18664
void get_data_reset(get_data_t *data)
Reset command data.
Definition: gmp.c:2167
void init_cve_nvt_iterator(iterator_t *iterator, const char *cve, int ascending, const char *sort_field)
Initialise an NVT iterator, for NVTs of a certain CVE.
Definition: manage_sql_nvts.c:781
gchar ** current
Current type.
Definition: manage.h:2721
int report_format_in_use(report_format_t report_format)
Return whether a report format is referenced by an alert.
Definition: manage_sql.c:52509
int override_iterator_active(iterator_t *iterator)
Get the active status from an override iterator.
Definition: manage_sql.c:47499
char * filter_replacement
Filter term to replace the one in filt_id.
Definition: manage.h:322
double severity_data_value(int index)
Convert an index in the counts array to a severity value.
Definition: manage.c:983
char * nvts_feed_version()
Return feed version of the plugins in the plugin cache.
Definition: manage_sql_nvts.c:113
int aggregate_iterator_count(iterator_t *iterator)
Get the count from an aggregate iterator.
Definition: manage_sql.c:5963
int config_iterator_family_count(iterator_t *iterator)
Get the family count from a config iterator.
Definition: manage_sql.c:37715
int scanner_config_iterator_readable(iterator_t *iterator)
Get the read permission status from a GET iterator.
Definition: manage_sql.c:48844
void init_host_prognosis_iterator(iterator_t *iterator, report_host_t report_host, int first_result, int max_results, const char *levels, const char *search_phrase, int sort_order, const char *sort_field)
Initialise a report host prognosis iterator.
Definition: manage_sql.c:21745
int manage_get_scanners(GSList *log_config, const gchar *database)
List scanners.
Definition: manage_sql.c:49552
int nvt_selector_iterator_include(iterator_t *iterator)
Get whether the selector rule is an include rule.
Definition: manage_sql.c:40021
void init_task_role_iterator(iterator_t *iterator, task_t task)
Initialise a task role iterator.
Definition: manage_sql.c:6807
char * oid
NVT identifier.
Definition: manage.h:206
int scanner_in_use(scanner_t scanner)
Check whether an scanner is in use.
Definition: manage_sql.c:48925
int task_iterator_finished_reports(iterator_t *iterator)
Get the number of reports of a task iterator.
Definition: manage_sql.c:15244
char * task_name(task_t task)
Return the name of a task.
Definition: manage_sql.c:19116
int manage_schedule(manage_connection_forker_t fork_connection, gboolean run_tasks, sigset_t *sigmask_current)
Schedule any actions that are due.
Definition: manage.c:7230
osp_connection_t * osp_scanner_connect(scanner_t scanner)
Create a new connection to an OSP scanner.
Definition: manage_sql.c:49282
int manage_resource_name(const char *type, const char *uuid, char **name)
Get the name of a resource.
Definition: manage_sql.c:5099
gchar * fallback
Fallback value.
Definition: manage.h:3102
char * qod_type
QoD type.
Definition: manage.h:1185
int config_iterator_nvt_count(iterator_t *iterator)
Get the nvt count from a config iterator.
Definition: manage_sql.c:37731
int trash_report_format_writable(report_format_t report_format)
Return whether a trashcan report_format is writable.
Definition: manage_sql.c:52568
int config_iterator_scanner_trash(iterator_t *iterator)
Get whether scanner is in trash from a config iterator.
Definition: manage_sql.c:37811
int init_nvt_info_iterator(iterator_t *iterator, get_data_t *get, const char *name)
Initialise an NVT iterator.
Definition: manage_sql_nvts.c:389
gchar * local_filename
Path to the local report file.
Definition: manage.h:399
void init_nvt_selector_iterator(iterator_t *iterator, const char *selector, config_t config, int type)
Initialise an NVT selector iterator.
Definition: manage_sql.c:39979
int delete_note(const char *note_id, int ultimate)
Delete a note.
Definition: manage_sql.c:45407
int create_config_from_scanner(const char *scanner_id, const char *name, const char *comment, char **uuid)
Create a config from an OSP scanner.
Definition: manage_sql.c:36933
void init_family_iterator(iterator_t *iterator, int all, const char *selector, int ascending)
Initialise an NVT selector family iterator.
Definition: manage_sql.c:40073
int init_cert_bund_adv_info_iterator(iterator_t *iterator, get_data_t *get, const char *name)
Initialise an CERT-Bund advisory (cert_bund_adv) info iterator.
Definition: manage_sql_secinfo.c:762
int manage_check_current_task()
Handle state changes to current task made by other processes.
Definition: manage.c:6153
char * credential_uuid(credential_t credential)
Get the UUID of a Credential.
Definition: manage_sql.c:43761
const char * task_iterator_run_status_name(iterator_t *iterator)
Get the run status name from a task iterator.
Definition: manage_sql.c:15216
int task_upload_progress(task_t task)
Return the upload progress of a task.
Definition: manage_sql.c:19672
char * scan_start_time_uuid(const char *uuid)
Get the start time of a scan.
Definition: manage_sql.c:25920
int copy_override(const char *override_id, override_t *new_override)
Create a override from an existing override.
Definition: manage_sql.c:46478
void set_scan_end_time_otp(report_t report, const char *timestamp)
Set the end time of a scan.
Definition: manage_sql.c:26044
int task_config_in_trash(task_t task)
Return whether the config of a task is in the trashcan.
Definition: manage_sql.c:19252
gchar * cve_cvss_base(const gchar *cve)
Get the short file name for an OVALDEF.
Definition: manage_sql_secinfo.c:298
char * config_nvt_timeout(config_t config, const char *oid)
Get the timeout value for an NVT in a config.
Definition: manage_sql.c:37072
int request_delete_task_uuid(const char *task_id, int ultimate)
Request deletion of a task.
Definition: manage_sql.c:33280
void init_credential_iterator_one(iterator_t *iterator, credential_t credential)
Initialise a Credential iterator, given a single Credential.
Definition: manage_sql.c:43309
int result_iterator_has_cert_bunds(iterator_t *iterator)
Get whether CERT-Bunds may exist from a result iterator.
Definition: manage_sql.c:25135
scanner_t task_iterator_scanner(iterator_t *iterator)
Get the UUID of task scanner from a task iterator.
Definition: manage_sql.c:15272
char * scan_nvt_version
Version of NVT used at scan time.
Definition: manage.h:1182
int manage_cert_db_version()
Return the database version of the actual database.
Definition: manage_sql.c:6380
schedule_t task_schedule_uuid(const gchar *task_id)
Return the schedule of a task.
Definition: manage_sql.c:20223
resource_t get_iterator_resource(iterator_t *iterator)
Get the resource from a GET iterator.
Definition: manage_sql.c:44822
const char * report_type_iterator_title(report_type_iterator_t *iterator)
Return the title from a report type iterator.
Definition: manage.c:6532
char * config_uuid(config_t config)
Return the UUID of a config.
Definition: manage_sql.c:37011
int verify_scanner(const char *scanner_id, char **version)
Verify a scanner.
Definition: manage_sql.c:49443
void report_set_source_iface(report_t report, const gchar *iface)
Set the source interface of a report.
Definition: manage_sql.c:22982
int create_agent(const char *name, const char *comment, const char *installer_64, const char *installer_filename, const char *installer_signature_64, const char *howto_install, const char *howto_use, agent_t *agent)
Create an agent entry.
Definition: manage_sql.c:44313
char * host
Host message describes.
Definition: manage.h:202
const char * get_iterator_comment(iterator_t *iterator)
Get the comment from a GET iterator.
Definition: manage_sql.c:44854
void make_task_complete(task_t task)
Complete the creation of a task.
Definition: manage_sql.c:33079
An NVT preference.
Definition: manage.h:1814
int copy_note(const char *note_id, note_t *new_note)
Create a note from an existing note.
Definition: manage_sql.c:45390
gchar * manage_clean_filter_remove(const gchar *filter, const gchar *column)
Clean a filter, removing a keyword in the process.
Definition: manage_sql.c:2685
char * alert_uuid(alert_t alert)
Return the UUID of an alert.
Definition: manage_sql.c:8462
void set_task_hosts_ordering(task_t task, const char *ordering)
Set the hosts ordering of a task.
Definition: manage_sql.c:19323
int nvt_selector_iterator_type(iterator_t *iterator)
Get the type from an NVT selector.
Definition: manage_sql.c:40055
char * target_ssh_port(target_t target)
Return the SSH LSC port of a target.
Definition: manage_sql.c:36291
int create_report(array_t *results, const char *task_id, const char *task_name, const char *task_comment, const char *in_assets, const char *scan_start, const char *scan_end, array_t *host_starts, array_t *host_ends, array_t *details, char **report_id)
Create a report from an array of results.
Definition: manage_sql.c:22362
int report_timestamp(const char *report_id, gchar **timestamp)
Get the timestamp of a report.
Definition: manage_sql.c:26185
gchar * port_name_formatted(const char *field)
Returns formatted port number, protocol and iana name from.
Definition: manage_sql.c:6425
void report_set_slave_host(report_t report, const gchar *host)
Set the host of the slave of a report.
Definition: manage_sql.c:22951
int manage_migrate(GSList *log_config, const gchar *database)
Migrate database to version supported by this manager.
Definition: manage_migrators.c:15544
const char * alert_condition_name(alert_condition_t condition)
Get the name of an alert condition.
Definition: manage.c:1212
credentials_t current_credentials
Current credentials during any GMP command.
Definition: manage.c:863
result_t override_iterator_result(iterator_t *iterator)
Get the result from a override iterator.
Definition: manage_sql.c:47468
gchar * report_format_name
Name of the report format used.
Definition: manage.h:402
int manage_test_alert(const char *alert_id, gchar **script_message)
Test an alert.
Definition: manage_sql.c:14157
unsigned int number
Port number.
Definition: manage.h:191
int config_families_growing(config_t config)
Get the family growth status of a config.
Definition: manage_sql.c:39963
int result_iterator_may_have_notes(iterator_t *iterator)
Get whether notes may exist from a result iterator.
Definition: manage_sql.c:25093
void cleanup_file_iterator(file_iterator_t *iterator)
Cleanup a report type iterator.
Definition: manage.c:7620
const char * result_iterator_nvt_tag(iterator_t *iterator)
Get the NVT tags from a result iterator.
Definition: manage_sql.c:24787
int manage_modify_scanner(GSList *log_config, const gchar *database, const char *scanner_id, const char *name, const char *host, const char *port, const char *type, const char *ca_pub_path, const char *key_pub_path, const char *key_priv_path)
Modify the given scanner.
Definition: manage_sql.c:47811
void manage_complete_nvt_cache_update(GList *nvts_list, GList *nvt_preferences_list)
Complete an update of the NVT cache.
Definition: manage_sql_nvts.c:1112
int task_result_count(task_t task, int min_qod)
Return number of results in a task.
Definition: manage_sql.c:19587
int schedule_info(schedule_t schedule, int trash, time_t *first_time, time_t *next_time, int *period, int *period_months, int *duration, gchar **icalendar, gchar **zone)
Return info about a schedule.
Definition: manage_sql.c:50109
int scanner_writable(scanner_t scanner)
Check whether a scanner is writable.
Definition: manage_sql.c:48961
int schedule_count(const get_data_t *get)
Count the number of schedules.
Definition: manage_sql.c:50195
int cpe_info_count(const get_data_t *get)
Count number of cpe.
Definition: manage_sql_secinfo.c:131
int init_target_iterator(iterator_t *iterator, const get_data_t *get)
Initialise a target iterator, including observed targets.
Definition: manage_sql.c:35805
config_t task_config(task_t task)
Return the config of a task.
Definition: manage_sql.c:19187
const char * task_iterator_hosts_ordering(iterator_t *iterator)
Get the hosts ordering value from a task iterator.
Definition: manage_sql.c:15258
int trash_schedule_readable(schedule_t schedule)
Return whether a trashcan schedule is readable.
Definition: manage_sql.c:49992
char * trash_credential_name(credential_t credential)
Get the name of an LSC credential in the trashcan.
Definition: manage_sql.c:43804
credential_t target_credential(target_t target, const char *type)
Get a credential from a target.
Definition: manage_sql.c:34521
int config_task_iterator_readable(iterator_t *iterator)
Get the read permission status from a GET iterator.
Definition: manage_sql.c:38689
const char * credential_iterator_community(iterator_t *iterator)
Get the SNMP community from a Credential iterator.
Definition: manage_sql.c:43518
int alert_count(const get_data_t *get)
Count the number of alerts.
Definition: manage_sql.c:8619
int copy_config(const char *name, const char *comment, const char *config_id, config_t *new_config)
Create a config from an existing config.
Definition: manage_sql.c:37200
int scan_start_time_epoch(report_t report)
Get the start time of a scan, in seconds since the epoch.
Definition: manage_sql.c:25906
target_t task_target(task_t task)
Return the target of a task.
Definition: manage_sql.c:19282
int target_iterator_smb_credential(iterator_t *iterator)
Get the SMB LSC credential from a target iterator.
Definition: manage_sql.c:35865
char * ovaldef_severity(const char *id)
Get the severity of an OVALDEF using an ID.
Definition: manage_sql_secinfo.c:682
int nvt_preference_count(const char *name)
Get the number preferences available for an NVT.
Definition: manage_sql.c:41486
void manage_cleanup_process_error(int signal)
Cleanup as immediately as possible.
Definition: manage_sql.c:18371
int target_login_port(target_t target, const char *type)
Get a login port from a target.
Definition: manage_sql.c:34641
char * target_uuid(target_t target)
Return the UUID of a target.
Definition: manage_sql.c:36093
int acknowledge_bye()
Acknowledge a scanner BYE.
Definition: manage.c:6125
unsigned int task_count(const get_data_t *get)
Return the number of tasks associated with the current user.
Definition: manage_sql.c:18988
double prognosis_iterator_cvss_double(iterator_t *iterator)
Get the CVSS from a result iterator as a double.
Definition: manage_sql.c:21554
void init_credential_scanner_iterator(iterator_t *iterator, credential_t credential, int ascending)
Initialise a Credential scanner iterator.
Definition: manage_sql.c:43937
int note_count(const get_data_t *get, nvt_t nvt, result_t result, task_t task)
Count number of notes.
Definition: manage_sql.c:45820
void set_task_config(task_t task, config_t config)
Set the config of a task.
Definition: manage_sql.c:19266
result_t make_cve_result(task_t task, const char *host, const char *nvt, double cvss, const char *description)
Make a CVE result.
Definition: manage_sql.c:21320
void init_nvt_dfn_cert_adv_iterator(iterator_t *iterator, const char *oid, int ascending, const char *sort_field)
Initialise an DFN-CERT iterator, for advisories relevant to a NVT.
Definition: manage_sql_secinfo.c:1093
int manage_db_supported_version()
Return the database version supported by this manager.
Definition: manage_sql.c:6297
gboolean find_result_with_permission(const char *uuid, result_t *result, const char *permission)
Find a result for a set of permissions, given a UUID.
Definition: manage_sql.c:20821
void set_scan_host_end_time_otp(report_t report, const char *host, const char *timestamp)
Set the end time of a scanned host.
Definition: manage_sql.c:26108
int modify_task(const gchar *task_id, const gchar *name, const gchar *comment, const gchar *scanner_id, const gchar *target_id, const gchar *config_id, const gchar *observers, array_t *alerts, const gchar *alterable, array_t *groups, const gchar *schedule_id, const gchar *schedule_periods, array_t *preferences, const gchar *hosts_ordering, gchar **fail_alert_id, gchar **fail_group_id)
Modify a task.
Definition: manage_sql.c:33941
char * nvt_default_timeout(const char *oid)
Get the default timeout of an NVT.
Definition: manage_sql_nvts.c:923
void set_scan_end_time(report_t report, const char *timestamp)
Set the end time of a scan.
Definition: manage_sql.c:26026
char * schedule_name(schedule_t schedule)
Return the name of a schedule.
Definition: manage_sql.c:50045
int manage_cert_db_supported_version()
Return the database version supported by this manager.
Definition: manage_sql.c:6369
int copy_target(const char *name, const char *comment, const char *target_id, target_t *new_target)
Create a target from an existing target.
Definition: manage_sql.c:34995
gchar * credential_value(credential_t credential, const char *value_name)
Get a value from a credential.
Definition: manage_sql.c:42998
void manage_filter_controls(const gchar *filter, int *first, int *max, gchar **sort_field, int *sort_order)
Get info from a filter.
Definition: manage_sql.c:2231
int config_iterator_type(iterator_t *iterator)
Get the type from a config iterator.
Definition: manage_sql.c:37779
char * credential_iterator_rpm(iterator_t *iterator)
Get the rpm from a Credential iterator.
Definition: manage_sql.c:43547
gchar * task_second_last_report_id(task_t task)
Get report ID from second most recently completed invocation of task.
Definition: manage_sql.c:19923
int quoted
Whether the keyword was quoted.
Definition: manage.h:3587
void set_scan_end_time_epoch(report_t report, time_t timestamp)
Set the end time of a scan.
Definition: manage_sql.c:26012
report_t make_report(task_t task, const char *uuid, task_status_t status)
Make a report.
Definition: manage_sql.c:22219
char * nvt_oid
OID of NVT.
Definition: manage.h:1181
const char * note_iterator_nvt_type(iterator_t *iterator)
Get the NVT type from a note iterator.
Definition: manage_sql.c:46210
char * source_desc
Source description.
Definition: manage.h:1197
char * config_nvt_selector(config_t config)
Return the NVT selector associated with a config.
Definition: manage_sql.c:38066
A system report type iterator.
Definition: manage.h:2718
const char * result_iterator_scan_nvt_version(iterator_t *iterator)
Get the NVT version used during the scan from a result iterator.
Definition: manage_sql.c:24878
int manage_alert(const char *alert_id, const char *task_id, event_t event, const void *event_data, gchar **script_message)
Escalate an alert with task and event data.
Definition: manage_sql.c:14057
void init_nvt_cert_bund_adv_iterator(iterator_t *iterator, const char *oid, int ascending, const char *sort_field)
Initialise an CERT-Bund iterator, for advisories relevant to a NVT.
Definition: manage_sql_secinfo.c:909
int trash_schedule_in_use(schedule_t schedule)
Return whether a trashcan schedule is in use by a task.
Definition: manage_sql.c:49950
static PGconn * conn
Handle on the database.
Definition: sql_pg.c:81
int copy_credential(const char *name, const char *comment, const char *credential_id, credential_t *new_credential)
Create an LSC Credential from an existing one.
Definition: manage_sql.c:42283
int credential_count(const get_data_t *get)
Count number of LSC Credentials.
Definition: manage_sql.c:42884
char * manage_port_name(int number, const char *protocol)
Returns associated name for a tcp/ip port.
Definition: manage_sql.c:6406
alert_method_t alert_method_from_name(const char *name)
Get an alert method from a name.
Definition: manage.c:1447
int schedule_duration(schedule_t schedule)
Return the duration of a schedule.
Definition: manage_sql.c:50087
int init_dfn_cert_adv_info_iterator(iterator_t *iterator, get_data_t *get, const char *name)
Initialise an DFN-CERT advisory (dfn_cert_adv) info iterator.
Definition: manage_sql_secinfo.c:948
int copy_report_format(const char *name, const char *source_uuid, report_format_t *new_report_format)
Create Report Format from an existing Report Format.
Definition: manage_sql.c:51745
int delete_schedule(const char *schedule_id, int ultimate)
Delete a schedule.
Definition: manage_sql.c:49815
host_t host_notice(const char *host_name, const char *identifier_type, const char *identifier_value, const char *source_type, const char *source_id, int check_add_to_assets, int check_for_existing_identifier)
Notice a host.
Definition: manage_sql.c:21092
time_t schedule_iterator_period_months(iterator_t *iterator)
Get the period months from a schedule iterator.
Definition: manage_sql.c:50272
port_t port
The port.
Definition: manage.h:204
int modify_target(const char *target_id, const char *name, const char *hosts, const char *exclude_hosts, const char *comment, const char *port_list_id, const char *ssh_credential_id, const char *ssh_port, const char *smb_credential_id, const char *esxi_credential_id, const char *snmp_credential_id, const char *reverse_lookup_only, const char *reverse_lookup_unify, const char *alive_tests)
Modify a target.
Definition: manage_sql.c:35188
user_t get_iterator_owner(iterator_t *iterator)
Get the owner from a GET iterator.
Definition: manage_sql.c:44897
The record of a message.
Definition: manage.h:200
char * name
Name of NVT selector.
Definition: manage.h:1831
int config_iterator_nvts_growing(iterator_t *iterator)
Get the NVTs growing state from a config iterator.
Definition: manage_sql.c:37763
int credential_in_use(credential_t credential)
Check whether a Credential is in use.
Definition: manage_sql.c:42901
void init_task_alert_iterator(iterator_t *iterator, task_t task)
Initialise a task alert iterator.
Definition: manage_sql.c:9000
int dfn_cert_adv_info_count(const get_data_t *get)
Count number of dfn_cert_adv.
Definition: manage_sql_secinfo.c:998
gchar * schedule_iterator_byday_string(iterator_t *iterator)
Get the byday string from a schedule iterator.
Definition: manage_sql.c:50288
int note_uuid(note_t note, char **id)
Return the UUID of a note.
Definition: manage_sql.c:45490
char * credential_iterator_exe(iterator_t *iterator)
Get the exe from a Credential iterator.
Definition: manage_sql.c:43643
Headers for Iterators.
int delete_report_format(const char *report_format_id, int ultimate)
Delete a report format.
Definition: manage_sql.c:52151
char * task_preference_value(task_t task, const char *name)
Get the value of a task preference.
Definition: manage_sql.c:41508
int manage_system_report(const char *name, const char *duration, const char *start_time, const char *end_time, const char *slave_id, char **report)
Get a system report.
Definition: manage.c:6672
char * task_observers(task_t task)
Return the observers of a task.
Definition: manage_sql.c:19158
char * target_hosts(target_t target)
Return the hosts associated with a target.
Definition: manage_sql.c:36203
const char * severity_to_level(double severity, int mode)
Get the threat level matching a severity score.
Definition: manage.c:799
time_t schedule_iterator_duration(iterator_t *iterator)
Get the duration from a schedule iterator.
Definition: manage_sql.c:50317
int sync_config(const char *config_id)
Synchronize a config.
Definition: manage_sql.c:37510
char * scanner_key_pub(scanner_t scanner)
Return the Certificate of a scanner.
Definition: manage_sql.c:49117
gboolean next_report_type(report_type_iterator_t *iterator)
Increment a report type iterator.
Definition: manage.c:6503
int delete_agent(const char *agent_id, int ultimate)
Delete an agent.
Definition: manage_sql.c:44608
array_t * alts
Array of gchar's. Alternate values for radio type.
Definition: manage.h:1821
int type_is_scap(const char *type)
Check if a type is a SCAP type.
Definition: manage.c:620
array_t * split_filter(const gchar *given_filter)
Split the filter term into parts.
Definition: manage_sql.c:2050
int delete_target(const char *target_id, int ultimate)
Delete a target.
Definition: manage_sql.c:35029
void set_task_run_status(task_t task, task_status_t status)
Set the run state of a task.
Definition: manage_sql.c:19480
int task_schedule_periods(task_t task)
Get the number of times the period schedule should run on the task.
Definition: manage_sql.c:20272
char * family_or_nvt
Family or NVT that this selector selects.
Definition: manage.h:1834
void init_credential_target_iterator(iterator_t *iterator, credential_t credential, int ascending)
Initialise a Credential target iterator.
Definition: manage_sql.c:43860
int set_task_schedule(task_t task, schedule_t schedule, int periods)
Set the schedule of a task.
Definition: manage_sql.c:20091
Sort data for aggregates commands.
Definition: manage.h:4283
void report_add_result(report_t report, result_t result)
Add a result to a report.
Definition: manage_sql.c:23131
gchar ** start
First type.
Definition: manage.h:2720
get_data_t * report_results_get_data(int first, int rows, int apply_overrides, int autofp, int min_qod)
Create a new basic get_data_t struct to get report results.
Definition: manage.c:932
int acknowledge_feed_version_info()
Acknowledge scanner PLUGINS_FEED_VERSION message,.
Definition: manage.c:6139
int alert_iterator_event(iterator_t *iterator)
Return the event from an alert iterator.
Definition: manage_sql.c:8720
int trash_task_in_use(task_t task)
Return whether a trashcan task is referenced by a task.
Definition: manage_sql.c:15309
const char * report_type_iterator_name(report_type_iterator_t *iterator)
Return the name from a report type iterator.
Definition: manage.c:6519
int trash_target_readable(target_t target)
Return whether a trashcan target is readable.
Definition: manage_sql.c:36177
int target_iterator_esxi_trash(iterator_t *iterator)
Get the ESXi LSC credential from a target iterator.
Definition: manage_sql.c:36031
int stop_task(const char *task_id)
Initiate stopping a task.
Definition: manage.c:5934
int alert_iterator_method(iterator_t *iterator)
Return the method from an alert iterator.
Definition: manage_sql.c:8752
char * target_reverse_lookup_unify(target_t target)
Return the reverse_lookup_unify value of a target.
Definition: manage_sql.c:36246
event_t event_from_name(const char *name)
Get an event from a name.
Definition: manage.c:1422
char * target_port_range(target_t target)
Return the port range of a target, in OTP format.
Definition: manage_sql.c:36378
void init_report_counts_build_iterator(iterator_t *iterator, report_t report, int min_qod_limit, int add_defaults, const char *users_where)
Initializes an iterator for updating the report cache.
Definition: manage_sql.c:21986
int report_host_count(report_t report)
Count a report's total number of hosts.
Definition: manage_sql.c:28512
result_t make_osp_result(task_t task, const char *host, const char *nvt, const char *type, const char *description, const char *port, const char *severity, int qod)
Make an OSP result.
Definition: manage_sql.c:20891
int task_writable(task_t task)
Return whether a task is writable.
Definition: manage_sql.c:15337
int target_writable(target_t target)
Return whether a target is writable.
Definition: manage_sql.c:36482
int init_credential_iterator(iterator_t *iterator, const get_data_t *get)
Initialise a Credential iterator.
Definition: manage_sql.c:43336
int target_iterator_smb_trash(iterator_t *iterator)
Get the location of the SMB LSC credential from a target iterator.
Definition: manage_sql.c:35897
int task_average_scan_duration(task_t task)
Get the average duration of all finished reports of a task.
Definition: manage_sql.c:15367
void set_task_name(task_t task, const char *name)
Set the name of a task.
Definition: manage_sql.c:33094
int include
Whether family/NVT is included or excluded.
Definition: manage.h:1833
int scanner_port(scanner_t scanner)
Return the port of a scanner.
Definition: manage_sql.c:49064
int create_target(const char *name, const char *asset_hosts_filter, const char *hosts, const char *exclude_hosts, const char *comment, const char *port_list_id, const char *port_range, credential_t ssh_credential, const char *ssh_port, credential_t smb_credential, credential_t esxi_credential, credential_t snmp_credential, const char *reverse_lookup_only, const char *reverse_lookup_unify, const char *alive_tests, target_t *target)
Create a target.
Definition: manage_sql.c:34738
int copy_scanner(const char *name, const char *comment, const char *scanner_id, scanner_t *new_scanner)
Create a scanner from an existing scanner.
Definition: manage_sql.c:48227
gchar * dir_name
Dir holding files.
Definition: manage.h:3219
int severity_in_level(double severity, const char *level)
Check whether a severity falls within a threat level.
Definition: manage.c:728
int manage_scap_loaded()
Check whether SCAP is available.
Definition: manage_pg.c:3687
const char * target_iterator_alive_tests(iterator_t *iterator)
Get the alive test description from a target iterator.
Definition: manage_sql.c:35976
char * filter_replace
Column to replace in filter.
Definition: manage.h:321
const char * aggregate_iterator_text(iterator_t *iterator, int text_column_index, int data_columns)
Get the value of a text column from an aggregate iterator.
Definition: manage_sql.c:6043
report_t task_running_report(task_t task)
Return the running report of a task.
Definition: manage_sql.c:19605
Name value pair.
Definition: manage.h:57
int modify_credential(const char *credential_id, const char *name, const char *comment, const char *login, const char *password, const char *key_private, const char *key_public, const char *certificate, const char *community, const char *auth_algorithm, const char *privacy_password, const char *privacy_algorithm, const char *allow_insecure)
Modify a Credential.
Definition: manage_sql.c:42332
int result_detection_reference(result_t result, report_t report, const gchar *host, const char *oid, char **ref, char **product, char **location, char **name)
Get product detection results corresponding to a given vulnerability detection result.
Definition: manage_sql.c:21372
A host detail for create_report.
Definition: manage.h:1193
schedule_t task_schedule(task_t task)
Return the schedule of a task.
Definition: manage_sql.c:20196
void set_credential_public_key(credential_t credential, const char *public_key)
Set the public key of a Credential.
Definition: manage_sql.c:43243
const char * task_iterator_last_report(iterator_t *iterator)
Get the last report UUID from a task iterator.
Definition: manage_sql.c:15230
int task_in_use(task_t task)
Return whether a task is in use by a task.
Definition: manage_sql.c:15286
int keyword_special(keyword_t *keyword)
Get whether a keyword is special (like "and").
Definition: manage_sql.c:1465
int copy_task(const char *name, const char *comment, const char *task_id, int alterable, task_t *new_task)
Create a task from an existing task.
Definition: manage_sql.c:33136
int task_schedule_periods_uuid(const gchar *task_id)
Set the next time a scheduled task will be due.
Definition: manage_sql.c:20285
void manage_reset_currents()
Cleanup as immediately as possible.
Definition: manage_sql.c:18392
int trash_credential_readable(credential_t credential)
Return whether a trashcan credential is readable.
Definition: manage_sql.c:43833
const char * task_trend(task_t task, int override, int min_qod)
Return the trend of a task.
Definition: manage_sql.c:32950
int manage_encrypt_all_credentials(GSList *log_config, const gchar *database)
Encrypt or re-encrypt all credentials.
Definition: manage_sql.c:6614
int minimal
Whether to respond with minimal information.
Definition: manage.h:330
int qod_from_type(const char *qod_type)
Get QoD percentage for a qod_type string.
Definition: manage_sql.c:20965
int nvt_info_count(const get_data_t *get)
Count number of nvt.
Definition: manage_sql_nvts.c:468
char * hostname
Hostname.
Definition: manage.h:1180
double aggregate_iterator_sum(iterator_t *iterator, int data_column_index)
Get the sum from a statistics iterator.
Definition: manage_sql.c:6025
int task_scanner_in_trash(task_t task)
Return whether the scanner of a task is in the trashcan.
Definition: manage_sql.c:19395
int result_count(const get_data_t *get, report_t report, const char *host)
Count the number of results.
Definition: manage_sql.c:24584
char * trash_schedule_name(schedule_t schedule)
Return the name of a trash schedule.
Definition: manage_sql.c:50059
int delete_credential(const char *credential_id, int ultimate)
Delete a Credential.
Definition: manage_sql.c:42636
gboolean manage_migrate_needs_timezone(GSList *log_config, const gchar *database)
Check whether the migration needs the real timezone.
Definition: manage_migrators.c:15495
void manage_transaction_start()
Start a new IMMEDIATE transaction.
Definition: manage_sql.c:34309
gchar * value
Param value.
Definition: manage.h:60
double double_value
Floating point value of the keyword.
Definition: manage.h:3586
int ovaldef_info_count(const get_data_t *get)
Count number of ovaldef.
Definition: manage_sql_secinfo.c:526
char * filter
Filter term.
Definition: manage.h:320
int target_task_iterator_readable(iterator_t *iterator)
Get the read permission status from a GET iterator.
Definition: manage_sql.c:36566
void report_set_slave_port(report_t report, int port)
Set the port of the slave of a report.
Definition: manage_sql.c:22968
int osp_get_version_from_iterator(iterator_t *iterator, char **s_name, char **s_ver, char **d_name, char **d_ver, char **p_name, char **p_ver)
Get an OSP Scanner's get_version info.
Definition: manage_sql.c:49317
long long int resource_t
A resource, like a task or target.
Definition: iterator.h:40
int manage_read_info(gchar *type, gchar *uid, gchar *name, gchar **result)
Read raw information.
Definition: manage.c:8362
task_t override_iterator_task(iterator_t *iterator)
Get the task from a override iterator.
Definition: manage_sql.c:47454
char * report_format_content_type(report_format_t report_format)
Return the content type of a report format.
Definition: manage_sql.c:52494
int init_manage(GSList *log_config, int nvt_cache_mode, const gchar *database, int max_ips_per_target, int max_email_attachment_size, int max_email_include_size, int max_email_message_size, manage_connection_forker_t fork_connection, int skip_db_check)
Initialize the manage library.
Definition: manage_sql.c:18274
char * nvt_preference_iterator_type(iterator_t *iterator)
Get the type from an NVT preference iterator.
Definition: manage_sql.c:41400
int create_config(const char *proposed_name, const char *comment, const array_t *selectors, const array_t *preferences, const char *config_type, config_t *config, char **name)
Create a config.
Definition: manage_sql.c:36747
void report_set_slave_uuid(report_t report, const gchar *uuid)
Set the UUID of the slave on a report.
Definition: manage_sql.c:22917