[Openvas-commits] r11717 - in trunk/gsa: . src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Sep 29 15:16:32 CEST 2011
Author: mattm
Date: 2011-09-29 15:16:31 +0200 (Thu, 29 Sep 2011)
New Revision: 11717
Modified:
trunk/gsa/ChangeLog
trunk/gsa/src/gsad.c
trunk/gsa/src/gsad_omp.c
trunk/gsa/src/gsad_omp.h
Log:
* src/gsad_omp.c (save_my_settings): Ensure that timezone return arg is
always set. If timezone param is "" return "UTC" instead of "".
* src/gsad_omp.h: Update header accordingly.
* src/gsad.c (exec_omp_post): Free timezone.
Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog 2011-09-29 13:12:42 UTC (rev 11716)
+++ trunk/gsa/ChangeLog 2011-09-29 13:16:31 UTC (rev 11717)
@@ -1,5 +1,14 @@
2011-09-29 Matthew Mundell <matthew.mundell at greenbone.net>
+ * src/gsad_omp.c (save_my_settings): Ensure that timezone return arg is
+ always set. If timezone param is "" return "UTC" instead of "".
+
+ * src/gsad_omp.h: Update header accordingly.
+
+ * src/gsad.c (exec_omp_post): Free timezone.
+
+2011-09-29 Matthew Mundell <matthew.mundell at greenbone.net>
+
* src/gsad.c (user_set_timezone): New function.
(exec_omp_post): Update timezone after save_my_settings.
Modified: trunk/gsa/src/gsad.c
===================================================================
--- trunk/gsa/src/gsad.c 2011-09-29 13:12:42 UTC (rev 11716)
+++ trunk/gsa/src/gsad.c 2011-09-29 13:16:31 UTC (rev 11717)
@@ -1368,12 +1368,13 @@
ELSE (save_lsc_credential)
else if (!strcmp (cmd, "save_my_settings"))
{
- const char *timezone;
+ char *timezone;
con_info->response = save_my_settings_omp (credentials, con_info->params,
&timezone);
if (timezone)
/* credentials->timezone set in save_my_settings_omp before XSLT. */
user_set_timezone (credentials->username, timezone);
+ g_free (timezone);
}
ELSE (save_note)
ELSE (save_override)
Modified: trunk/gsa/src/gsad_omp.c
===================================================================
--- trunk/gsa/src/gsad_omp.c 2011-09-29 13:12:42 UTC (rev 11716)
+++ trunk/gsa/src/gsad_omp.c 2011-09-29 13:16:31 UTC (rev 11717)
@@ -13865,13 +13865,13 @@
*
* @param[in] credentials Credentials of user issuing the action.
* @param[in] params Request parameters.
- * @param[out] timezone Timezone.
+ * @param[out] timezone Timezone. Caller must free.
*
* @return Result of XSL transformation.
*/
char *
save_my_settings_omp (credentials_t * credentials, params_t *params,
- const char **timezone)
+ char **timezone)
{
int socket;
gnutls_session_t session;
@@ -13881,6 +13881,8 @@
GString *xml;
entity_t entity;
+ *timezone = NULL;
+
if (params_value (params, "text") == NULL)
return edit_my_settings (credentials, params,
GSAD_MESSAGE_INVALID_PARAM
@@ -13904,14 +13906,14 @@
}
text = params_value (params, "text");
- text_64 = text ? g_base64_encode ((guchar*) text, strlen (text)) : g_strdup ("");
+ text_64 = (text ? g_base64_encode ((guchar*) text, strlen (text)) : g_strdup (""));
if (openvas_server_sendf (&session,
"<modify_setting>"
"<name>Timezone</name>"
"<value>%s</value>"
"</modify_setting>",
- text_64)
+ text_64 ? text_64 : "")
== -1)
{
g_free (text_64);
@@ -13943,11 +13945,9 @@
if (status && (strlen (status) > 0) && (status[0] == '2'))
{
g_free (credentials->timezone);
- credentials->timezone = g_strdup (text);
- *timezone = text;
+ credentials->timezone = g_strdup (strlen (text) ? text : "UTC");
+ *timezone = g_strdup (strlen (text) ? text : "UTC");
}
- else
- *timezone = NULL;
free_entity (entity);
openvas_server_close (socket, session);
Modified: trunk/gsa/src/gsad_omp.h
===================================================================
--- trunk/gsa/src/gsad_omp.h 2011-09-29 13:12:42 UTC (rev 11716)
+++ trunk/gsa/src/gsad_omp.h 2011-09-29 13:16:31 UTC (rev 11717)
@@ -161,7 +161,7 @@
char * edit_my_settings_omp (credentials_t *, params_t *);
char * get_my_settings_omp (credentials_t *, params_t *);
-char * save_my_settings_omp (credentials_t *, params_t *, const char **);
+char * save_my_settings_omp (credentials_t *, params_t *, char **);
int authenticate_omp (const gchar *, const gchar *, gchar **, gchar **);
More information about the Openvas-commits
mailing list