[Openvas-commits] r11724 - in trunk/gsa: . src src/html
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Oct 4 14:41:13 CEST 2011
Author: hdoreau
Date: 2011-10-04 14:41:06 +0200 (Tue, 04 Oct 2011)
New Revision: 11724
Added:
trunk/gsa/src/html/dialog.xsl
Modified:
trunk/gsa/CMakeLists.txt
trunk/gsa/ChangeLog
trunk/gsa/src/CMakeLists.txt
trunk/gsa/src/gsad.c
trunk/gsa/src/html/gsad.xsl
Log:
Add a form for security information lookup.
* src/gsad.c (request_handler): Handle /dialog/<filename> URLs.
* src/html/dialog.xsl: New. Handle intermediate pages that don't
directly issue OMP commands.
* src/html/gsad.xsl: Include dialog.xsl
(html-gsa-navigation): Add a link to the new form.
* src/CMakeLists.txt: Add syntax check for dialog.xsl
* CMakeLists.txt: Update install procedure accordingly (handle dialog.xsl).
Modified: trunk/gsa/CMakeLists.txt
===================================================================
--- trunk/gsa/CMakeLists.txt 2011-09-30 14:02:57 UTC (rev 11723)
+++ trunk/gsa/CMakeLists.txt 2011-10-04 12:41:06 UTC (rev 11724)
@@ -286,7 +286,7 @@
install (FILES src/html/favicon.gif src/html/gsad.xsl src/html/gsa-style.css
src/html/help.xsl src/html/oap.xsl src/html/omp.xsl
- src/html/IE6fixes.css src/html/os.xml
+ src/html/IE6fixes.css src/html/os.xml src/html/dialog.xsl
DESTINATION ${GSA_DATA_DIR})
install (FILES src/html/login/login.html src/html/gsa-style.css
Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog 2011-09-30 14:02:57 UTC (rev 11723)
+++ trunk/gsa/ChangeLog 2011-10-04 12:41:06 UTC (rev 11724)
@@ -1,3 +1,19 @@
+2011-10-04 Henri Doreau <henri.doreau at gmail.com>
+
+ Add a form for security information lookup.
+
+ * src/gsad.c (request_handler): Handle /dialog/<filename> URLs.
+
+ * src/html/dialog.xsl: New. Handle intermediate pages that don't
+ directly issue OMP commands.
+
+ * src/html/gsad.xsl: Include dialog.xsl
+ (html-gsa-navigation): Add a link to the new form.
+
+ * src/CMakeLists.txt: Add syntax check for dialog.xsl
+
+ * CMakeLists.txt: Update install procedure accordingly (handle dialog.xsl).
+
2011-09-29 Matthew Mundell <matthew.mundell at greenbone.net>
Set the timezone early, so that it's in effect for the entire page
Modified: trunk/gsa/src/CMakeLists.txt
===================================================================
--- trunk/gsa/src/CMakeLists.txt 2011-09-30 14:02:57 UTC (rev 11723)
+++ trunk/gsa/src/CMakeLists.txt 2011-10-04 12:41:06 UTC (rev 11724)
@@ -139,6 +139,10 @@
COMMENT "Checking syntax of gsad.xsl"
COMMAND xsltproc html/gsad.xsl
DEPENDS html/gsad.xsl)
+ add_custom_target (dialog-xsl-syntax ALL
+ COMMENT "Checking syntax of dialog.xsl"
+ COMMAND xsltproc html/dialog.xsl
+ DEPENDS html/dialog.xsl)
add_custom_target (help-xsl-syntax ALL
COMMENT "Checking syntax of help.xsl"
COMMAND xsltproc html/help.xsl
Modified: trunk/gsa/src/gsad.c
===================================================================
--- trunk/gsa/src/gsad.c 2011-09-30 14:02:57 UTC (rev 11723)
+++ trunk/gsa/src/gsad.c 2011-10-04 12:41:06 UTC (rev 11724)
@@ -120,9 +120,9 @@
#define POST_BUFFER_SIZE 500000
/**
- * @brief Maximum length of "file name" for /help/ URLs.
+ * @brief Maximum length of "file name" for /help/ or /dialog/ URLs.
*/
-#define MAX_HELP_NAME_SIZE 128
+#define MAX_FILE_NAME_SIZE 128
/**
* @brief Max number of minutes between activity in a session.
@@ -2659,6 +2659,48 @@
response = MHD_create_response_from_data ((unsigned int) res_len,
res, MHD_NO, MHD_YES);
}
+ else if (!strncmp (&url[0], "/dialog/",
+ strlen ("/dialog/"))) /* flawfinder: ignore,
+ it is a const str */
+ {
+ if (! g_ascii_isalpha (url[8]))
+ {
+ res = gsad_message (credentials,
+ "Invalid request", __FUNCTION__, __LINE__,
+ "The requested dialog page does not exist.",
+ "/dialog/contents.html");
+ }
+ else
+ {
+ gchar *page = g_strndup ((gchar *) &url[8], MAX_FILE_NAME_SIZE);
+ // XXX: url subsearch could be nicer and xsl transform could
+ // be generalized with the other transforms.
+ time_t now;
+ char ctime_now[200];
+ gchar *xml;
+
+ assert (credentials->token);
+
+ now = time (NULL);
+ ctime_r_strip_newline (&now, ctime_now);
+
+ xml = g_markup_printf_escaped ("<envelope>"
+ "<token>%s</token>"
+ "<time>%s</time>"
+ "<login>%s</login>"
+ "<dialog><%s/></dialog>"
+ "</envelope>",
+ credentials->token,
+ ctime_now,
+ credentials->username,
+ page);
+
+ g_free (page);
+ res = xsl_transform (xml);
+ }
+ response = MHD_create_response_from_data (strlen (res), res,
+ MHD_NO, MHD_YES);
+ }
else if (!strncmp (&url[0], "/help/",
strlen ("/help/"))) /* flawfinder: ignore,
it is a const str */
@@ -2672,7 +2714,7 @@
}
else
{
- gchar *page = g_strndup ((gchar *) &url[6], MAX_HELP_NAME_SIZE);
+ gchar *page = g_strndup ((gchar *) &url[6], MAX_FILE_NAME_SIZE);
// XXX: url subsearch could be nicer and xsl transform could
// be generalized with the other transforms.
time_t now;
Added: trunk/gsa/src/html/dialog.xsl
===================================================================
--- trunk/gsa/src/html/dialog.xsl 2011-09-30 14:02:57 UTC (rev 11723)
+++ trunk/gsa/src/html/dialog.xsl 2011-10-04 12:41:06 UTC (rev 11724)
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output
+ method="html"
+ doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+ doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
+ encoding="UTF-8"/>
+
+<!--
+Greenbone Security Assistant
+$Id$
+Description: Non-OMP dialog pages for GSA.
+
+Authors:
+Henri Doreau <henri.doreau at greenbone.net>
+
+Copyright:
+Copyright (C) 2011 Greenbone Networks GmbH
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 2,
+or, at your option, any later version as published by the Free
+Software Foundation
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+-->
+
+<xsl:template match="dialog">
+ <div class="gb_window">
+ <div class="gb_window_part_left"></div>
+ <div class="gb_window_part_right"></div>
+ <xsl:apply-templates mode="dialog"/>
+ </div>
+</xsl:template>
+
+<xsl:template mode="dialog" match="*">
+ <div class="gb_window_part_center">Page Not Found</div>
+ <div class="gb_window_part_content">
+ <div style="text-align:left">
+ <h1>Page Not Found</h1>
+
+ <p>
+ We apologize for any inconvenience.
+ </p>
+ </div>
+ </div>
+</xsl:template>
+
+<xsl:template mode="dialog" match="browse_infosec.html">
+ <div class="gb_window_part_center">Security Information Management</div>
+ <div class="gb_window_part_content">
+ <div style="text-align:left">
+ <h1>Security Information browser</h1>
+ <table>
+ <tr>
+ <td>
+ <h2>CVE Lookup</h2>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <form name="input"
+ action="/omp"
+ method="get">
+ <input type="text" name="info_name" value="CVE-"/>
+ <input type="hidden" name="cmd" value="get_info"/>
+ <input type="hidden" name="info_type" value="CVE"/>
+ <input type="hidden" name="token" value="{/envelope/token}"/>
+ <input type="submit" value="Search"/>
+ </form>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <h2>CPE Lookup</h2>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <form name="input"
+ action="/omp"
+ method="get">
+ <input type="text" name="info_name" value="cpe:/a:"/>
+ <input type="hidden" name="cmd" value="get_info"/>
+ <input type="hidden" name="info_type" value="CPE"/>
+ <input type="hidden" name="token" value="{/envelope/token}"/>
+ <input type="submit" value="Search"/>
+ </form>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+</xsl:template>
+
+</xsl:stylesheet>
Property changes on: trunk/gsa/src/html/dialog.xsl
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Modified: trunk/gsa/src/html/gsad.xsl
===================================================================
--- trunk/gsa/src/html/gsad.xsl 2011-09-30 14:02:57 UTC (rev 11723)
+++ trunk/gsa/src/html/gsad.xsl 2011-10-04 12:41:06 UTC (rev 11724)
@@ -792,6 +792,7 @@
<li><a href="/omp?cmd=get_trash&token={/envelope/token}">Trashcan</a></li>
<li><a href="/omp?cmd=get_my_settings&token={/envelope/token}">My Settings</a></li>
<li class="last"><a href="/omp?cmd=get_system_reports&duration=86400&slave_id=0&token={/envelope/token}">Performance</a></li>
+ <li><a href="/dialog/browse_infosec.html?token={/envelope/token}">SecInfo Management</a></li>
</ul>
</li>
<li>
@@ -958,6 +959,10 @@
<xsl:include href="oap.xsl"/>
+<!-- Dialog -->
+
+<xsl:include href="dialog.xsl"/>
+
<!-- Help -->
<xsl:include href="help.xsl"/>
More information about the Openvas-commits
mailing list