[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openvas-cvs
Subject:    [Openvas-commits] r22665 - in trunk/openvas-manager: . src
From:       scm-commit () wald ! intevation ! org
Date:       2015-06-19 17:47:28
Message-ID: 20150619174728.AD1149A194C7 () wald ! intevation ! org
[Download RAW message or body]

Author: kroosec
Date: 2015-06-19 19:47:28 +0200 (Fri, 19 Jun 2015)
New Revision: 22665

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/manage.c
   trunk/openvas-manager/src/manage.h
   trunk/openvas-manager/src/manage_sql.c
Log:
* src/manage.c (parse_osp_report): Handle result qod value.
(fork_osp_scan_handler): Adjust make_osp_result() call.

* src/manage.h: Modify function prototype.

* src/manage_sql.c (make_osp_result): Add qod function argument.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2015-06-19 17:30:35 UTC (rev 22664)
+++ trunk/openvas-manager/ChangeLog	2015-06-19 17:47:28 UTC (rev 22665)
@@ -1,3 +1,12 @@
+2015-06-19  Hani Benhabiles <hani.benhabiles@greenbone.net>
+
+	* src/manage.c (parse_osp_report): Handle result qod value.
+	(fork_osp_scan_handler): Adjust make_osp_result() call.
+
+	* src/manage.h: Modify function prototype.
+
+	* src/manage_sql.c (make_osp_result): Add qod function argument.
+
 2015-06-18  Hani Benhabiles <hani.benhabiles@greenbone.net>
 
 	* src/manage_sql.c (init_task_schedule_iterator): Remove unused schedule

Modified: trunk/openvas-manager/src/manage.c
===================================================================
--- trunk/openvas-manager/src/manage.c	2015-06-19 17:30:35 UTC (rev 22664)
+++ trunk/openvas-manager/src/manage.c	2015-06-19 17:47:28 UTC (rev 22665)
@@ -2766,9 +2766,10 @@
   while (results)
     {
       result_t result;
-      const char *type, *name, *severity, *host, *test_id, *port;
+      const char *type, *name, *severity, *host, *test_id, *port, *qod;
       char *desc = NULL, *nvt_id = NULL, *severity_str = NULL;
       entity_t r_entity = results->data;
+      int qod_int;
 
       type = entity_attribute (r_entity, "type");
       name = entity_attribute (r_entity, "name");
@@ -2776,11 +2777,14 @@
       test_id = entity_attribute (r_entity, "test_id");
       host = entity_attribute (r_entity, "host");
       port = entity_attribute (r_entity, "port");
+      qod = entity_attribute (r_entity, "qod");
       assert (name);
       assert (type);
       assert (severity);
       assert (test_id);
       assert (host);
+      assert (port);
+      assert (qod);
 
       /* Add report host if it doesn't exist. */
       manage_report_host_add (report, host, start_time, end_time);
@@ -2801,8 +2805,12 @@
           nvt_id = g_strdup (name);
           desc = g_strdup (entity_text (r_entity));
         }
-      result = make_osp_result (task, host, nvt_id, type, desc,
-                                port ?: "", severity_str ?: severity);
+
+      qod_int = atoi (qod);
+      if (atoi (qod) <= 0 || atoi (qod) > 100)
+        qod_int = QOD_DEFAULT;
+      result = make_osp_result (task, host, nvt_id, type, desc, port ?: "",
+                                severity_str ?: severity, qod_int);
       report_add_result (report, result);
       g_free (nvt_id);
       g_free (desc);
@@ -3034,7 +3042,8 @@
       type = threat_message_type ("Error");
       if (scan_id == NULL)
         scan_id = g_strdup ("Couldn't connect to the scanner");
-      result = make_osp_result (task, "", "", type, scan_id, "", "");
+      result = make_osp_result (task, "", "", type, scan_id, "", "",
+                                QOD_DEFAULT);
       report_add_result (current_report, result);
       g_free (scan_id);
 

Modified: trunk/openvas-manager/src/manage.h
===================================================================
--- trunk/openvas-manager/src/manage.h	2015-06-19 17:30:35 UTC (rev 22664)
+++ trunk/openvas-manager/src/manage.h	2015-06-19 17:47:28 UTC (rev 22665)
@@ -945,7 +945,7 @@
 
 result_t
 make_osp_result (task_t, const char*, const char*, const char*, const char*,
-                 const char *, const char *);
+                 const char *, const char *, int);
 
 result_t
 make_cve_result (task_t, const char*, const char*, double, const char*);

Modified: trunk/openvas-manager/src/manage_sql.c
===================================================================
--- trunk/openvas-manager/src/manage_sql.c	2015-06-19 17:30:35 UTC (rev 22664)
+++ trunk/openvas-manager/src/manage_sql.c	2015-06-19 17:47:28 UTC (rev 22665)
@@ -14602,7 +14602,7 @@
 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)
+                 const char *port, const char *severity, int qod)
 {
   char *nvt_revision = NULL, *quoted_desc, *quoted_nvt, *result_severity;
   char *quoted_port;
@@ -14633,9 +14633,9 @@
        " (owner, date, task, host, port, nvt, nvt_version, severity, type,"
        "  qod, qod_type, description, uuid)"
        " VALUES (NULL, m_now(), %llu, '%s', '%s', '%s', '%s', '%s', '%s',"
-       "         '%s', '', '%s', make_uuid ());",
+       "         %d, '', '%s', make_uuid ());",
        task, host ?: "", quoted_port, quoted_nvt, nvt_revision ?: "",
-       result_severity ?: "0", type, G_STRINGIFY (QOD_DEFAULT), quoted_desc);
+       result_severity ?: "0", type, qod, quoted_desc);
   g_free (result_severity);
   g_free (nvt_revision);
   g_free (quoted_desc);

_______________________________________________
Openvas-commits mailing list
Openvas-commits@wald.intevation.org
https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic