[Openvas-commits] r12056 - in trunk/gsa: . src src/html
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Nov 8 19:28:42 CET 2011
Author: mattm
Date: 2011-11-08 19:28:33 +0100 (Tue, 08 Nov 2011)
New Revision: 12056
Modified:
trunk/gsa/ChangeLog
trunk/gsa/src/gsad.c
trunk/gsa/src/gsad_omp.c
trunk/gsa/src/html/omp.xsl
Log:
* src/gsad.c (init_validator): Add active and days.
* src/gsad_omp.c (create_override_omp, save_override_omp): Pass active
state through.
* src/html/omp.xsl (html-create-override-form)
(html-edit-override-form): Add active field.
(override [details]): Check the length of the end_time because it's always
present.
(override-detailed): Lowlight the box when the override is off. Add
active status above modification time.
Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog 2011-11-08 18:22:55 UTC (rev 12055)
+++ trunk/gsa/ChangeLog 2011-11-08 18:28:33 UTC (rev 12056)
@@ -1,5 +1,19 @@
2011-11-08 Matthew Mundell <matthew.mundell at greenbone.net>
+ * src/gsad.c (init_validator): Add active and days.
+
+ * src/gsad_omp.c (create_override_omp, save_override_omp): Pass active
+ state through.
+
+ * src/html/omp.xsl (html-create-override-form)
+ (html-edit-override-form): Add active field.
+ (override [details]): Check the length of the end_time because it's always
+ present.
+ (override-detailed): Lowlight the box when the override is off. Add
+ active status above modification time.
+
+2011-11-08 Matthew Mundell <matthew.mundell at greenbone.net>
+
* src/html/omp.xsl (cve-detail, cpe-details): Add last SCAP update time.
2011-11-04 Matthew Mundell <matthew.mundell at greenbone.net>
Modified: trunk/gsa/src/gsad.c
===================================================================
--- trunk/gsa/src/gsad.c 2011-11-08 18:22:55 UTC (rev 12055)
+++ trunk/gsa/src/gsad.c 2011-11-08 18:28:33 UTC (rev 12056)
@@ -616,6 +616,7 @@
"|(verify_report_format)$");
+ openvas_validator_add (validator, "active", "^(-1|-2|[0-9]+)$");
openvas_validator_add (validator, "agent_format", "^(installer)$");
openvas_validator_add (validator, "agent_id", "^[a-z0-9\\-]+$");
/* Defined in RFC 2253. */
@@ -632,6 +633,7 @@
openvas_validator_add (validator, "condition_data:value", "(?s)^.*$");
openvas_validator_add (validator, "min_cvss_base", "^(|10.0|[0-9].[0-9])$");
openvas_validator_add (validator, "day_of_month", "^((0|1|2)[0-9]{1,1})|30|31$");
+ openvas_validator_add (validator, "days", "^(-1|[0-9]+)$");
openvas_validator_add (validator, "delta_states", "^(c|g|n|s){0,4}$");
openvas_validator_add (validator, "domain", "^[-[:alnum:]\\.]{1,80}$");
openvas_validator_add (validator, "email", "^[^@ ]{1,150}@[^@ ]{1,150}$");
Modified: trunk/gsa/src/gsad_omp.c
===================================================================
--- trunk/gsa/src/gsad_omp.c 2011-11-08 18:22:55 UTC (rev 12055)
+++ trunk/gsa/src/gsad_omp.c 2011-11-08 18:28:33 UTC (rev 12056)
@@ -10542,7 +10542,8 @@
const char *min_cvss_base, *text, *task_id;
/* For get_report. */
const char *levels, *result_hosts_only, *notes, *overrides, *report_id;
- const char *first_result, *max_results, *sort_order, *sort_field;
+ const char *first_result, *max_results, *sort_order, *sort_field, *active;
+ const char *days;
next = params_value (params, "next");
search_phrase = params_value (params, "search_phrase");
@@ -10623,7 +10624,9 @@
"Diagnostics: OID was NULL.",
"/omp?cmd=get_overrides");
- if (threat == NULL || port == NULL || hosts == NULL)
+ active = params_value (params, "active");
+
+ if (threat == NULL || port == NULL || hosts == NULL || active == NULL)
return gsad_message (credentials,
"Internal error", __FUNCTION__, __LINE__,
"An internal error occurred while creating a new override. "
@@ -10640,8 +10643,10 @@
"/omp?cmd=get_overrides");
text = params_value (params, "text");
+ days = params_value (params, "days");
create_override = g_strdup_printf ("<create_override>"
+ "<active>%s</active>"
"<nvt oid=\"%s\"/>"
"<hosts>%s</hosts>"
"<port>%s</port>"
@@ -10651,6 +10656,9 @@
"<task id=\"%s\"/>"
"<result id=\"%s\"/>"
"</create_override>",
+ strcmp (active, "1")
+ ? active
+ : (days ? days : "-1"),
oid,
hosts,
port,
@@ -11436,7 +11444,7 @@
unsigned int first_result, max_results;
const char *sort_field, *sort_order, *levels, *notes, *overrides;
const char *result_hosts_only, *search_phrase, *min_cvss_base;
- const char *oid, *task_id, *task_name, *result_id;
+ const char *oid, *task_id, *task_name, *result_id, *active, *days;
override_id = params_value (params, "override_id");
@@ -11490,9 +11498,10 @@
task_id = params_value (params, "task_id");
task_name = params_value (params, "name");
result_id = params_value (params, "result_id");
+ active = params_value (params, "active");
if (next == NULL || override_task_id == NULL || override_result_id == NULL
- || new_threat == NULL)
+ || new_threat == NULL || active == NULL)
return gsad_message (credentials,
"Internal error", __FUNCTION__, __LINE__,
"An internal error occurred while saving an override. "
@@ -11606,7 +11615,10 @@
"/omp?cmd=get_overrides");
}
+ days = params_value (params, "days");
+
modify_override = g_strdup_printf ("<modify_override override_id=\"%s\">"
+ "<active>%s</active>"
"<hosts>%s</hosts>"
"<port>%s</port>"
"<threat>%s</threat>"
@@ -11616,6 +11628,9 @@
"<result id=\"%s\"/>"
"</modify_override>",
override_id,
+ strcmp (active, "1")
+ ? active
+ : (days ? days : "-1"),
hosts ? hosts : "",
port ? port : "",
threat ? threat : "",
Modified: trunk/gsa/src/html/omp.xsl
===================================================================
--- trunk/gsa/src/html/omp.xsl 2011-11-08 18:22:55 UTC (rev 12055)
+++ trunk/gsa/src/html/omp.xsl 2011-11-08 18:28:33 UTC (rev 12056)
@@ -9574,6 +9574,27 @@
</xsl:choose>
<table border="0" cellspacing="0" cellpadding="3" width="100%">
<tr>
+ <td valign="center" width="125">
+ Active
+ </td>
+ <td>
+ <div>
+ <input type="radio" name="active" value="-1" checked="1"/>
+ yes, always
+ </div>
+ <div>
+ <input type="radio" name="active" value="1"/>
+ yes, for the next
+ <input type="text" name="days" size="3" maxlength="7" value="30"/>
+ days
+ </div>
+ <div>
+ <input type="radio" name="active" value="0"/>
+ no
+ </div>
+ </td>
+ </tr>
+ <tr>
<td valign="top" width="125">
Hosts
</td>
@@ -9743,6 +9764,66 @@
</td>
</tr>
<tr>
+ <td valign="center">Active</td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="get_overrides_response/override/active='1' and string-length(get_overrides_response/override/end_time) > 0">
+ <div>
+ <input type="radio" name="active" value="-1"/>
+ yes, always
+ </div>
+ <div>
+ <input type="radio" name="active" value="-2" checked="1"/>
+ yes, until
+ <xsl:value-of select="get_overrides_response/override/end_time"/>
+ </div>
+ <div>
+ <input type="radio" name="active" value="1"/>
+ yes, for the next
+ <input type="text" name="days" size="3" maxlength="7" value="30"/>
+ days
+ </div>
+ <div>
+ <input type="radio" name="active" value="0"/>
+ no
+ </div>
+ </xsl:when>
+ <xsl:when test="get_overrides_response/override/active='1'">
+ <div>
+ <input type="radio" name="active" value="-1" checked="1"/>
+ yes, always
+ </div>
+ <div>
+ <input type="radio" name="active" value="1"/>
+ yes, for the next
+ <input type="text" name="days" size="3" maxlength="7" value="30"/>
+ days
+ </div>
+ <div>
+ <input type="radio" name="active" value="0"/>
+ no
+ </div>
+ </xsl:when>
+ <xsl:otherwise>
+ <div>
+ <input type="radio" name="active" value="-1"/>
+ yes, always
+ </div>
+ <div>
+ <input type="radio" name="active" value="1"/>
+ yes, for the next
+ <input type="text" name="days" size="3" maxlength="7" value="30"/>
+ days
+ </div>
+ <div>
+ <input type="radio" name="active" value="0" checked="1"/>
+ no
+ </div>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ </tr>
+ <tr>
<td valign="top" width="125">
Hosts
</td>
@@ -10124,8 +10205,8 @@
<xsl:when test="active='0'">
no
</xsl:when>
- <xsl:when test="active='1' and end_time">
- yes
+ <xsl:when test="active='1' and string-length (end_time) > 0">
+ yes, until
<xsl:value-of select="end_time"/>
</xsl:when>
<xsl:otherwise>
@@ -11388,7 +11469,13 @@
<xsl:param name="override-buttons">1</xsl:param>
<xsl:param name="delta"/>
<xsl:param name="next">get_report</xsl:param>
- <div class="override_box_box">
+ <xsl:variable name="class">
+ <xsl:choose>
+ <xsl:when test="active='0'">issue_box_box</xsl:when>
+ <xsl:otherwise>override_box_box</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <div class="{$class}">
<b>
Override from
<xsl:choose>
@@ -11405,6 +11492,21 @@
<xsl:with-param name="string"><xsl:value-of select="text"/></xsl:with-param>
</xsl:call-template>
</pre>
+ <div>
+ Active:
+ <xsl:choose>
+ <xsl:when test="active='0'">
+ no.
+ </xsl:when>
+ <xsl:when test="active='1' and string-length (end_time) > 0">
+ yes, until
+ <xsl:value-of select="end_time"/>.
+ </xsl:when>
+ <xsl:otherwise>
+ yes.
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
<xsl:if test="$override-buttons = 1">
<div class="float_right" style="text-align:right">
<div style="display: inline">
@@ -11480,7 +11582,7 @@
</a>
</div>
</xsl:if>
- Last modified: <xsl:value-of select="modification_time"/>.
+ <div>Last modified: <xsl:value-of select="modification_time"/>.</div>
</div>
</xsl:template>
More information about the Openvas-commits
mailing list