[Openvas-commits] r11720 - in trunk/openvas-manager: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Sep 29 18:38:14 CEST 2011


Author: mattm
Date: 2011-09-29 18:38:11 +0200 (Thu, 29 Sep 2011)
New Revision: 11720

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/omp.c
Log:
	* src/omp.c (omp_xml_handle_end_element): Set the timezone to the user's
	timezone when authentication succeeds, so that all commands use it.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2011-09-29 13:38:39 UTC (rev 11719)
+++ trunk/openvas-manager/ChangeLog	2011-09-29 16:38:11 UTC (rev 11720)
@@ -1,5 +1,10 @@
 2011-09-29  Matthew Mundell <matthew.mundell at greenbone.net>
 
+	* src/omp.c (omp_xml_handle_end_element): Set the timezone to the user's
+	timezone when authentication succeeds, so that all commands use it.
+
+2011-09-29  Matthew Mundell <matthew.mundell at greenbone.net>
+
 	* src/omp.c (omp_xml_handle_end_element): In the authentication response
 	if the timezone is empty send UTC.
 

Modified: trunk/openvas-manager/src/omp.c
===================================================================
--- trunk/openvas-manager/src/omp.c	2011-09-29 13:38:39 UTC (rev 11719)
+++ trunk/openvas-manager/src/omp.c	2011-09-29 16:38:11 UTC (rev 11720)
@@ -9012,6 +9012,23 @@
                 }
               else
                 {
+                  const char *timezone;
+
+                  timezone = (current_credentials.timezone
+                              && strlen (current_credentials.timezone))
+                               ? current_credentials.timezone
+                               : "UTC";
+
+                  if (setenv ("TZ", timezone, 1) == -1)
+                    {
+                      free_credentials (&current_credentials);
+                      SEND_TO_CLIENT_OR_FAIL
+                       (XML_INTERNAL_ERROR ("authenticate"));
+                      set_client_state (CLIENT_TOP);
+                      break;
+                    }
+                  tzset ();
+
                   SENDF_TO_CLIENT_OR_FAIL
                    ("<authenticate_response"
                     " status=\"" STATUS_OK "\""
@@ -9022,10 +9039,8 @@
                     current_credentials.role
                       ? current_credentials.role
                       : "",
-                    (current_credentials.timezone
-                      && strlen (current_credentials.timezone))
-                      ? current_credentials.timezone
-                      : "UTC");
+                    timezone);
+
                   set_client_state (CLIENT_AUTHENTIC);
                 }
               break;



More information about the Openvas-commits mailing list