[Openvas-commits] r5562 - in trunk/openvas-client: . openvas

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Oct 15 17:46:24 CEST 2009


Author: mattm
Date: 2009-10-15 17:46:22 +0200 (Thu, 15 Oct 2009)
New Revision: 5562

Modified:
   trunk/openvas-client/ChangeLog
   trunk/openvas-client/openvas/attack.c
   trunk/openvas-client/openvas/monitor_dialog.c
Log:
	* openvas/monitor_dialog.c (idle_socket): Give up gracefully if getting
	the status fails.  Close the server when removing the idle.  Reformat
	three lines.

	* openvas/attack.c (attack_host): Add error messages to fail cases.

Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog	2009-10-15 15:04:00 UTC (rev 5561)
+++ trunk/openvas-client/ChangeLog	2009-10-15 15:46:22 UTC (rev 5562)
@@ -1,5 +1,13 @@
 2009-10-15  Matthew Mundell <matthew.mundell at intevation.de>
 
+	* openvas/monitor_dialog.c (idle_socket): Give up gracefully if getting
+	the status fails.  Close the server when removing the idle.  Reformat
+	three lines.
+
+	* openvas/attack.c (attack_host): Add error messages to fail cases.
+
+2009-10-15  Matthew Mundell <matthew.mundell at intevation.de>
+
 	* src/omp-cli.c (main): Add --delete-report.
 
 2009-10-15  Matthew Mundell <matthew.mundell at intevation.de>

Modified: trunk/openvas-client/openvas/attack.c
===================================================================
--- trunk/openvas-client/openvas/attack.c	2009-10-15 15:04:00 UTC (rev 5561)
+++ trunk/openvas-client/openvas/attack.c	2009-10-15 15:46:22 UTC (rev 5562)
@@ -133,11 +133,16 @@
       password = manager->passwd;
 
       socket = openvas_server_open (&session, hostname, port);
-      if (socket == -1) return 0;
+      if (socket == -1)
+        {
+          show_error (_("Failed to connect to manager"));
+          return 0;
+        }
 
       if (omp_authenticate (&session, login, password))
         {
           openvas_server_close (socket, session);
+          show_error (_("Failed to authenticate as %s with manager"), login);
           return 0;
         }
 
@@ -155,6 +160,8 @@
           {
             g_error_free (error);
             openvas_server_close (socket, session);
+            show_error (_("Failed to authenticate read in RC file %s"),
+                        rcfile);
             return 0;
           }
 
@@ -162,11 +169,13 @@
                              rc, NULL, NULL))
           {
             openvas_server_close (socket, session);
+            show_error (_("Failed to set RC file on manager task"));
             return 0;
           }
       }
 
       /* Send files, in case they are newer. */
+
       if (omp_send_files (context, socket, session) == FALSE)
         return 0;
 

Modified: trunk/openvas-client/openvas/monitor_dialog.c
===================================================================
--- trunk/openvas-client/openvas/monitor_dialog.c	2009-10-15 15:04:00 UTC (rev 5561)
+++ trunk/openvas-client/openvas/monitor_dialog.c	2009-10-15 15:46:22 UTC (rev 5562)
@@ -34,6 +34,7 @@
 #include <assert.h>
 #include <openvas/omp/omp.h>
 #include <openvas/omp/xml.h>
+#include <openvas/openvas_server.h>
 #endif
 
 #ifdef USE_GTK
@@ -132,18 +133,31 @@
       if (omp_get_status (&context->session,
                           prefs_get_string (context, "id"),
                           0,
-                          &response))
-        abort (); // FIX
-      status = omp_task_status (response);
-      if (status == NULL) abort (); // FIX
+                          &response)
+          || ((status = omp_task_status (response)) == NULL))
+        {
+          /* Give up. */
+          gtk_widget_hide (arg_get_value (ctrls, "WINDOW"));
+          gtk_idle_remove (GPOINTER_TO_SIZE (arg_get_value (ctrls, "TAG")));
+          gtk_widget_destroy (arg_get_value (ctrls, "WINDOW"));
+          openvas_server_close (context->socket, context->session);
+          context->socket = 0;
+          show_error (_("Failed to get the task status"));
+          context->action = CONTEXT_IDLE;
+          prefs_context_update (context);
+          return TRUE;
+        }
+
       if (strcmp (status, "Requested")
           && strcmp (status, "Running"))
         {
           /* The task is over. */
-          gtk_widget_hide (arg_get_value(ctrls, "WINDOW"));
-          gtk_idle_remove (GPOINTER_TO_SIZE(arg_get_value(ctrls, "TAG")));
-          gtk_widget_destroy (arg_get_value(ctrls, "WINDOW"));
+          gtk_widget_hide (arg_get_value (ctrls, "WINDOW"));
+          gtk_idle_remove (GPOINTER_TO_SIZE (arg_get_value (ctrls, "TAG")));
+          gtk_widget_destroy (arg_get_value (ctrls, "WINDOW"));
           scopetree_refresh_reports (context);
+          openvas_server_close (context->socket, context->session);
+          context->socket = 0;
           context->action = CONTEXT_IDLE;
           prefs_context_update (context);
         }



More information about the Openvas-commits mailing list