[Openvas-commits] r13756 - in trunk/openvas-manager: . src
scm-commit at wald.intevation.org
scm-commit at wald.intevation.org
Thu Jul 19 20:28:48 CEST 2012
Author: mattm
Date: 2012-07-19 20:28:48 +0200 (Thu, 19 Jul 2012)
New Revision: 13756
Modified:
trunk/openvas-manager/ChangeLog
trunk/openvas-manager/src/manage_sql.c
Log:
* src/manage_sql.c (split_filter, manage_filter_controls): When "rows" is
left out, include all rows instead of including "Rows Per Page" rows.
This keeps OMP backwards compatibility.
(append_relation): New function.
(manage_clean_filter): Append with append_relation, which converts the
"rows" value to "Rows Per Page" if "rows" is -2. This is convenient for
client because they can request Rows Per Page and still get the actual
value back in the filter. Previous they just left out "rows" and this
would happen.
Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog 2012-07-19 17:55:14 UTC (rev 13755)
+++ trunk/openvas-manager/ChangeLog 2012-07-19 18:28:48 UTC (rev 13756)
@@ -1,5 +1,17 @@
2012-07-19 Matthew Mundell <matthew.mundell at greenbone.net>
+ * src/manage_sql.c (split_filter, manage_filter_controls): When "rows" is
+ left out, include all rows instead of including "Rows Per Page" rows.
+ This keeps OMP backwards compatibility.
+ (append_relation): New function.
+ (manage_clean_filter): Append with append_relation, which converts the
+ "rows" value to "Rows Per Page" if "rows" is -2. This is convenient for
+ client because they can request Rows Per Page and still get the actual
+ value back in the filter. Previous they just left out "rows" and this
+ would happen.
+
+2012-07-19 Matthew Mundell <matthew.mundell at greenbone.net>
+
Add OTP 1.1 handling.
* src/ompd.c (write_to_scanner): Send OTP/1.1 for normal mode, OTP/1.0 for
Modified: trunk/openvas-manager/src/manage_sql.c
===================================================================
--- trunk/openvas-manager/src/manage_sql.c 2012-07-19 17:55:14 UTC (rev 13755)
+++ trunk/openvas-manager/src/manage_sql.c 2012-07-19 18:28:48 UTC (rev 13756)
@@ -24150,11 +24150,9 @@
if (max == 0)
{
- int max;
keyword = g_malloc0 (sizeof (keyword_t));
keyword->column = g_strdup ("rows");
- setting_value_int ("5f5a8712-8017-11e1-8556-406186ea4fc5", &max);
- keyword->string = g_strdup_printf ("%i", max);
+ keyword->string = g_strdup ("-1");
keyword->type = KEYWORD_TYPE_STRING;
keyword->relation = KEYWORD_RELATION_COLUMN_EQUAL;
array_add (parts, keyword);
@@ -24197,7 +24195,7 @@
if (first)
*first = 1;
if (max)
- setting_value_int ("5f5a8712-8017-11e1-8556-406186ea4fc5", max);
+ *max = -1;
if (sort_field)
*sort_field = g_strdup ("name");
if (sort_order)
@@ -24229,7 +24227,7 @@
point = (keyword_t**) split->pdata;
if (max)
{
- setting_value_int ("5f5a8712-8017-11e1-8556-406186ea4fc5", max);
+ *max = -1;
while (*point)
{
keyword_t *keyword;
@@ -24284,6 +24282,36 @@
}
/**
+ * @brief Append relation to filter.
+ *
+ * @param[in] clean Filter.
+ * @param[in] keyword Keyword
+ * @param[in] relation Relation char.
+ */
+static void
+append_relation (GString *clean, keyword_t *keyword, const char relation)
+{
+ if ((strcmp (keyword->column, "rows") == 0)
+ && (strcmp (keyword->string, "-2") == 0))
+ {
+ int max;
+ setting_value_int ("5f5a8712-8017-11e1-8556-406186ea4fc5",
+ &max);
+ g_string_append_printf (clean,
+ " %s%c%i",
+ keyword->column,
+ relation,
+ max);
+ }
+ else
+ g_string_append_printf (clean,
+ " %s%c%s",
+ keyword->column,
+ relation,
+ keyword->string);
+}
+
+/**
* @brief Clean a filter.
*
* @param[in] filter Filter.
@@ -24312,28 +24340,16 @@
switch (keyword->relation)
{
case KEYWORD_RELATION_COLUMN_EQUAL:
- g_string_append_printf (clean,
- " %s=%s",
- keyword->column,
- keyword->string);
+ append_relation (clean, keyword, '=');
break;
case KEYWORD_RELATION_COLUMN_APPROX:
- g_string_append_printf (clean,
- " %s~%s",
- keyword->column,
- keyword->string);
+ append_relation (clean, keyword, '~');
break;
case KEYWORD_RELATION_COLUMN_ABOVE:
- g_string_append_printf (clean,
- " %s>%s",
- keyword->column,
- keyword->string);
+ append_relation (clean, keyword, '>');
break;
case KEYWORD_RELATION_COLUMN_BELOW:
- g_string_append_printf (clean,
- " %s<%s",
- keyword->column,
- keyword->string);
+ append_relation (clean, keyword, '<');
break;
case KEYWORD_RELATION_APPROX:
More information about the Openvas-commits
mailing list