[Openvas-commits] r11552 - in trunk/gsa: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Sep 2 20:51:59 CEST 2011


Author: mattm
Date: 2011-09-02 20:51:57 +0200 (Fri, 02 Sep 2011)
New Revision: 11552

Modified:
   trunk/gsa/ChangeLog
   trunk/gsa/src/gsad.c
   trunk/gsa/src/gsad_omp.c
   trunk/gsa/src/gsad_omp.h
Log:
	Convert more pages to new param mechanism.

	* src/gsad.c (exec_omp_get): Pass single param instead of many.

	* src/gsad_omp.c (get_result): New function.  Body from get_result_omp.
	(get_result_omp): Call through to get_result.  Update callers to call
	get_result.
	(get_notes_omp, get_overrides_omp): Add params arg.

	* src/gsad_omp.h: Update headers accordingly.

Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog	2011-09-02 16:59:16 UTC (rev 11551)
+++ trunk/gsa/ChangeLog	2011-09-02 18:51:57 UTC (rev 11552)
@@ -1,3 +1,16 @@
+2011-09-02  Matthew Mundell <matthew.mundell at greenbone.net>
+
+	Convert more pages to new param mechanism.
+
+	* src/gsad.c (exec_omp_get): Pass single param instead of many.
+
+	* src/gsad_omp.c (get_result): New function.  Body from get_result_omp.
+	(get_result_omp): Call through to get_result.  Update callers to call
+	get_result.
+	(get_notes_omp, get_overrides_omp): Add params arg.
+
+	* src/gsad_omp.h: Update headers accordingly.
+
 2011-09-01  Matthew Mundell <matthew.mundell at greenbone.net>
 
 	Convert more pages to new param mechanism.

Modified: trunk/gsa/src/gsad.c
===================================================================
--- trunk/gsa/src/gsad.c	2011-09-02 16:59:16 UTC (rev 11551)
+++ trunk/gsa/src/gsad.c	2011-09-02 18:51:57 UTC (rev 11552)
@@ -3204,30 +3204,14 @@
     }
 
   ELSE (get_escalator)
-
-  else if ((!strcmp (cmd, "get_result")) && (result_id != NULL)
-           && (task_id != NULL))
-    return get_result_omp (credentials, result_id, task_id, name,
-                           apply_overrides, NULL, report_id, first_result,
-                           max_results, levels, search_phrase, notes, overrides,
-                           min_cvss_base, result_hosts_only, sort_field,
-                           sort_order, delta_report_id, delta_states);
-
   ELSE (get_escalators)
   ELSE (get_lsc_credential)
   ELSE (get_lsc_credentials)
   ELSE (get_note)
+  ELSE (get_notes)
+  ELSE (get_override)
+  ELSE (get_overrides)
 
-  else if (!strcmp (cmd, "get_notes"))
-    return get_notes_omp (credentials);
-
-  else if ((!strcmp (cmd, "get_override"))
-           && (override_id != NULL))
-    return get_override_omp (credentials, override_id);
-
-  else if (!strcmp (cmd, "get_overrides"))
-    return get_overrides_omp (credentials);
-
   else if (!strcmp (cmd, "get_report"))
     {
       char *ret;
@@ -3247,6 +3231,8 @@
       return ret;
     }
 
+  ELSE (get_result)
+
   else if ((!strcmp (cmd, "get_report_format")) && (report_format_id != NULL))
     return get_report_format_omp (credentials, report_format_id, sort_field,
                                   sort_order);

Modified: trunk/gsa/src/gsad_omp.c
===================================================================
--- trunk/gsa/src/gsad_omp.c	2011-09-02 16:59:16 UTC (rev 11551)
+++ trunk/gsa/src/gsad_omp.c	2011-09-02 18:51:57 UTC (rev 11552)
@@ -7889,17 +7889,17 @@
  *
  * @return Result of XSL transformation.
  */
-char *
-get_result_omp (credentials_t *credentials, const char *result_id,
-                const char *task_id, const char *task_name,
-                const char *apply_overrides, const char *commands,
-                const char *report_id, const char *first_result,
-                const char *max_results, const char *levels,
-                const char *search_phrase, const char *notes,
-                const char *overrides, const char *min_cvss_base,
-                const char *result_hosts_only, const char *sort_field,
-                const char *sort_order, const char *delta_report_id,
-                const char *delta_states)
+static char *
+get_result (credentials_t *credentials, const char *result_id,
+            const char *task_id, const char *task_name,
+            const char *apply_overrides, const char *commands,
+            const char *report_id, const char *first_result,
+            const char *max_results, const char *levels,
+            const char *search_phrase, const char *notes,
+            const char *overrides, const char *min_cvss_base,
+            const char *result_hosts_only, const char *sort_field,
+            const char *sort_order, const char *delta_report_id,
+            const char *delta_states)
 {
   GString *xml;
   gnutls_session_t session;
@@ -8032,6 +8032,38 @@
 }
 
 /**
+ * @brief Get one result, XSL transform the result.
+ *
+ * @param[in]  credentials  Username and password for authentication.
+ * @param[in]  params       Request parameters.
+ *
+ * @return Result of XSL transformation.
+ */
+char *
+get_result_omp (credentials_t *credentials, params_t *params)
+{
+  return get_result (credentials,
+                     params_value (params, "result_id"),
+                     params_value (params, "task_id"),
+                     params_value (params, "name"),
+                     params_value (params, "apply_overrides"),
+                     NULL,
+                     params_value (params, "report_id"),
+                     params_value (params, "first_result"),
+                     params_value (params, "max_results"),
+                     params_value (params, "levels"),
+                     params_value (params, "search_phrase"),
+                     params_value (params, "notes"),
+                     params_value (params, "overrides"),
+                     params_value (params, "min_cvss_base"),
+                     params_value (params, "result_hosts_only"),
+                     params_value (params, "sort_field"),
+                     params_value (params, "sort_order"),
+                     params_value (params, "delta_report_id"),
+                     params_value (params, "delta_states"));
+}
+
+/**
  * @brief Get all notes, XSL transform the result.
  *
  * @param[in]  credentials  Username and password for authentication.
@@ -8113,7 +8145,7 @@
  * @return Result of XSL transformation.
  */
 char *
-get_notes_omp (credentials_t *credentials)
+get_notes_omp (credentials_t *credentials, params_t *params)
 {
   return get_notes (credentials, NULL);
 }
@@ -8525,24 +8557,24 @@
 
   if (next && (strcmp (next, "get_result") == 0))
     {
-      char *ret = get_result_omp (credentials,
-                                  params_value (params, "result_id"),
-                                  params_value (params, "result_task_id"),
-                                  params_value (params, "name"),
-                                  params_value (params, "overrides"),
-                                  create_note,
-                                  params_value (params, "report_id"),
-                                  first_result,
-                                  max_results,
-                                  params_value (params, "levels"),
-                                  search_phrase,
-                                  params_value (params, "notes"),
-                                  params_value (params, "overrides"),
-                                  min_cvss_base,
-                                  params_value (params, "result_hosts_only"),
-                                  params_value (params, "sort_field"),
-                                  params_value (params, "sort_order"),
-                                  NULL, NULL);
+      char *ret = get_result (credentials,
+                              params_value (params, "result_id"),
+                              params_value (params, "result_task_id"),
+                              params_value (params, "name"),
+                              params_value (params, "overrides"),
+                              create_note,
+                              params_value (params, "report_id"),
+                              first_result,
+                              max_results,
+                              params_value (params, "levels"),
+                              search_phrase,
+                              params_value (params, "notes"),
+                              params_value (params, "overrides"),
+                              min_cvss_base,
+                              params_value (params, "result_hosts_only"),
+                              params_value (params, "sort_field"),
+                              params_value (params, "sort_order"),
+                              NULL, NULL);
       g_free (create_note);
       return ret;
     }
@@ -8930,11 +8962,11 @@
                              "/omp?cmd=get_notes");
 
       extra = g_strdup_printf ("<delete_note note_id=\"%s\"/>", note_id);
-      ret = get_result_omp (credentials, result_id, task_id, task_name,
-                            overrides, extra, report_id, first_result,
-                            max_results, levels, search_phrase, notes,
-                            overrides, min_cvss_base, result_hosts_only,
-                            sort_field, sort_order, NULL, NULL);
+      ret = get_result (credentials, result_id, task_id, task_name,
+                        overrides, extra, report_id, first_result,
+                        max_results, levels, search_phrase, notes,
+                        overrides, min_cvss_base, result_hosts_only,
+                        sort_field, sort_order, NULL, NULL);
       g_free (extra);
       return ret;
     }
@@ -9500,11 +9532,11 @@
     {
       gchar *first = g_strdup_printf ("%u", first_result);
       gchar *max = g_strdup_printf ("%u", max_results);
-      char *ret = get_result_omp (credentials, result_id, task_id,
-                                  task_name, overrides, modify_note, report_id,
-                                  first, max, levels, search_phrase, notes,
-                                  overrides, min_cvss_base, result_hosts_only,
-                                  sort_field, sort_order, NULL, NULL);
+      char *ret = get_result (credentials, result_id, task_id,
+                              task_name, overrides, modify_note, report_id,
+                              first, max, levels, search_phrase, notes,
+                              overrides, min_cvss_base, result_hosts_only,
+                              sort_field, sort_order, NULL, NULL);
       g_free (modify_note);
       g_free (first);
       g_free (max);
@@ -9728,7 +9760,7 @@
  * @return Result of XSL transformation.
  */
 char *
-get_overrides_omp (credentials_t *credentials)
+get_overrides_omp (credentials_t *credentials, params_t *params)
 {
   return get_overrides (credentials, NULL);
 }
@@ -9818,9 +9850,9 @@
  * @return Result of XSL transformation.
  */
 char *
-get_override_omp (credentials_t *credentials, const char *override_id)
+get_override_omp (credentials_t *credentials, params_t *params)
 {
-  return get_override (credentials, override_id, NULL);
+  return get_override (credentials, params_value (params, "override_id"), NULL);
 }
 
 /**
@@ -10126,24 +10158,24 @@
 
   if (next && (strcmp (next, "get_result") == 0))
     {
-      char *ret = get_result_omp (credentials,
-                                  params_value (params, "result_id"),
-                                  params_value (params, "result_task_id"),
-                                  params_value (params, "name"),
-                                  params_value (params, "overrides"),
-                                  create_override,
-                                  params_value (params, "report_id"),
-                                  first_result,
-                                  max_results,
-                                  params_value (params, "levels"),
-                                  search_phrase,
-                                  params_value (params, "notes"),
-                                  params_value (params, "overrides"),
-                                  min_cvss_base,
-                                  params_value (params, "result_hosts_only"),
-                                  params_value (params, "sort_field"),
-                                  params_value (params, "sort_order"),
-                                  NULL, NULL);
+      char *ret = get_result (credentials,
+                              params_value (params, "result_id"),
+                              params_value (params, "result_task_id"),
+                              params_value (params, "name"),
+                              params_value (params, "overrides"),
+                              create_override,
+                              params_value (params, "report_id"),
+                              first_result,
+                              max_results,
+                              params_value (params, "levels"),
+                              search_phrase,
+                              params_value (params, "notes"),
+                              params_value (params, "overrides"),
+                              min_cvss_base,
+                              params_value (params, "result_hosts_only"),
+                              params_value (params, "sort_field"),
+                              params_value (params, "sort_order"),
+                              NULL, NULL);
       g_free (create_override);
       return ret;
     }
@@ -10551,11 +10583,11 @@
 
       extra = g_strdup_printf ("<delete_override override_id=\"%s\"/>",
                                       override_id);
-      ret = get_result_omp (credentials, result_id, task_id, task_name,
-                            overrides, extra, report_id, first_result,
-                            max_results, levels, search_phrase, notes,
-                            overrides, min_cvss_base, result_hosts_only,
-                            sort_field, sort_order, NULL, NULL);
+      ret = get_result (credentials, result_id, task_id, task_name,
+                        overrides, extra, report_id, first_result,
+                        max_results, levels, search_phrase, notes,
+                        overrides, min_cvss_base, result_hosts_only,
+                        sort_field, sort_order, NULL, NULL);
       g_free (extra);
       return ret;
     }
@@ -11125,11 +11157,11 @@
     {
       gchar *first = g_strdup_printf ("%u", first_result);
       gchar *max = g_strdup_printf ("%u", max_results);
-      char *ret = get_result_omp (credentials, result_id, task_id, task_name,
-                                  overrides, modify_override, report_id,
-                                  first, max, levels, search_phrase, notes,
-                                  overrides, min_cvss_base, result_hosts_only,
-                                  sort_field, sort_order, NULL, NULL);
+      char *ret = get_result (credentials, result_id, task_id, task_name,
+                              overrides, modify_override, report_id,
+                              first, max, levels, search_phrase, notes,
+                              overrides, min_cvss_base, result_hosts_only,
+                              sort_field, sort_order, NULL, NULL);
       g_free (modify_override);
       g_free (first);
       g_free (max);

Modified: trunk/gsa/src/gsad_omp.h
===================================================================
--- trunk/gsa/src/gsad_omp.h	2011-09-02 16:59:16 UTC (rev 11551)
+++ trunk/gsa/src/gsad_omp.h	2011-09-02 18:51:57 UTC (rev 11552)
@@ -58,13 +58,7 @@
 char * delete_report_omp (credentials_t *, params_t *);
 char * get_report_omp (credentials_t *, params_t *, gsize *, gchar **, char **);
 
-char * get_result_omp (credentials_t *, const char *, const char *,
-                       const char *, const char *, const char *,
-                       const char *, const char *, const char *,
-                       const char *, const char *, const char *,
-                       const char *, const char *, const char *,
-                       const char *, const char *, const char *,
-                       const char *);
+char * get_result_omp (credentials_t *, params_t *);
 
 char * create_escalator_omp (credentials_t *, params_t *);
 char * delete_escalator_omp (credentials_t *, params_t *);
@@ -127,7 +121,7 @@
 char * export_report_format_omp (credentials_t *, params_t *,
                                  enum content_type *, char **, gsize *);
 
-char * get_notes_omp (credentials_t *);
+char * get_notes_omp (credentials_t *, params_t *);
 char * get_note_omp (credentials_t *, params_t *);
 char * new_note_omp (credentials_t *, params_t *);
 char * create_note_omp (credentials_t *, params_t *);
@@ -135,8 +129,8 @@
 char * edit_note_omp (credentials_t *, params_t *);
 char * save_note_omp (credentials_t *, params_t *);
 
-char * get_overrides_omp (credentials_t *);
-char * get_override_omp (credentials_t *, const char *);
+char * get_overrides_omp (credentials_t *, params_t *);
+char * get_override_omp (credentials_t *, params_t *);
 char * new_override_omp (credentials_t *, params_t *);
 char * create_override_omp (credentials_t *, params_t *);
 char * delete_override_omp (credentials_t *, params_t *);



More information about the Openvas-commits mailing list