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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Oct 20 09:42:27 CEST 2009


Author: felix
Date: 2009-10-20 09:42:26 +0200 (Tue, 20 Oct 2009)
New Revision: 5636

Modified:
   trunk/openvas-client/openvas/plugin_infos.c
   trunk/openvas-client/openvas/prefs_dialog/prefs_dialog_auth.c
   trunk/openvas-client/openvas/report.c
Log:
* openvas/plugin_infos.c: Cosmetics.
(spin_to_timeout): Changed type of local variable to gchar, added todo
about mem leak.
	
* openvas/report.c (report_save): Major reformatting.
	
* openvas/prefs_dialog/prefs_dialog_auth.c: Documentation.


Modified: trunk/openvas-client/openvas/plugin_infos.c
===================================================================
--- trunk/openvas-client/openvas/plugin_infos.c	2009-10-19 22:25:34 UTC (rev 5635)
+++ trunk/openvas-client/openvas/plugin_infos.c	2009-10-20 07:42:26 UTC (rev 5636)
@@ -89,9 +89,9 @@
     gtk_widget_show(w);
   }
 
-  while(deps && deps->next)
+  while (deps && deps->next)
   {
-    struct openvas_plugin * p = openvas_plugin_get_by_name(Context->plugins, deps->name);
+    struct openvas_plugin * p = openvas_plugin_get_by_name (Context->plugins, deps->name);
 
     if(p == NULL)
       p = openvas_plugin_get_by_name(Context->scanners, deps->name);
@@ -123,10 +123,10 @@
 /**
  * @brief Sets a timeout value to the server preferences in the currently
  *        selected context.
- * 
+ *
  * @param oid     OID of NVT to set timeout for.
  * @param timeout Ideally, timeout in seconds (string will be copied).
- * 
+ *
  * A timeout value is a key/value ['timeout.OID'/'5'] pair.
  */
 static void 
@@ -159,22 +159,23 @@
 static void
 spin_to_timeout (GtkSpinButton * spinner, const char * oid)
 {
- struct arglist * serv_prefs = arg_get_value(Context->prefs, "SERVER_PREFS");
- char * name = g_strdup_printf ("timeout.%s", oid);
- char* timeout = NULL;
+  struct arglist * serv_prefs = arg_get_value (Context->prefs, "SERVER_PREFS");
+  gchar * name = g_strdup_printf ("timeout.%s", oid);
+  char * timeout = NULL;
 
- if (arg_get_type(serv_prefs,  name) == ARG_STRING)
-  {
-    timeout = arg_get_value (serv_prefs, name);
-    gtk_spin_button_set_value (spinner, atoi(timeout));
-  }
+  if (arg_get_type (serv_prefs, name) == ARG_STRING)
+    {
+      timeout = arg_get_value (serv_prefs, name);
+      gtk_spin_button_set_value (spinner, atoi(timeout));
+    }
+  /** @todo free name */
 }
 
 
 /**
  * Callback for button click on "Show", bound to one certificate.
  * Shows a dialog with a text area (displays a public key) and a close button.
- * 
+ *
  * @param fpr Fingerprint of certificate, used to retrieve the certificate from
  *            the contexts signer_fp_certificates hashtable.
  */
@@ -228,9 +229,9 @@
 
 /**
  * @brief Creates an untrusted certificate of owner "Unknown" with fingerprint fpr.
- * 
+ *
  * @param fpr Fingerprint of certificate.
- * 
+ *
  * @return Fresh underspecified certificate.
  */
 static certificate_t*
@@ -243,7 +244,7 @@
 /**
  * @brief Retrieves certificate_ts from the Contexts index and returns
  *        a list of these.
- * 
+ *
  * @param txt Comma-separated list of fingerprints.
  *
  * @return A list of certificates, as found in the Contexts 
@@ -291,12 +292,13 @@
   return certlist;
 }
 
+
 /**
  * @brief Callback, shows info dialog, using current Context as plugin source.
- * 
+ *
  * If either no plugin list in current context is found or no name is provided,
  * does nothing.
- * 
+ *
  * @param emitter ignored (callback)
  * @param name    Name of plugin to show info of.
  */
@@ -307,9 +309,10 @@
     plugin_info_window_setup (Context->plugins, name);
 }
 
+
 /**
  * @brief Draws the window which contains information about a plugin.
- * 
+ *
  * @param res  Pointer to a openvas_plugin struct (list).
  * @param name The plugins name.
  */
@@ -444,7 +447,7 @@
     gtk_label_set_selectable (GTK_LABEL(label), TRUE);
     gtk_widget_show(label);
   }
-  
+
   /* Script Tags */
   txt = nvti_tag(plugin->ni);
   if(txt != NULL && txt[0] != '\0' && strcmp(txt, "NOTAG") != 0)
@@ -494,7 +497,7 @@
   hbox = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE,FALSE, 0);
   gtk_widget_show(hbox);
-  
+
   /* Server trust level information */
   txt = nvti_sign_key_ids(plugin->ni);
   if(txt && strcmp(txt, "NOSIGNKEYS") == 0)
@@ -553,7 +556,7 @@
     gtk_label_set_markup(GTK_LABEL(label), buf);
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
     gtk_widget_show(label);
-    
+
     // Button to view Certificate
     if (strcmp(cert->owner, _("Unknown")) != 0)
       {
@@ -565,7 +568,7 @@
       }
     certificates = g_slist_next (certificates);
     }
-    
+
   /* Add Separator */
   separator = gtk_hseparator_new();
   gtk_box_pack_start(GTK_BOX(vbox), separator, FALSE, FALSE, 0);
@@ -606,4 +609,5 @@
   do_set_timeout (plugin->oid, gtk_entry_get_text (GTK_ENTRY(timeoutspin)));
   gtk_widget_destroy(dialog);
 }
+
 #endif

Modified: trunk/openvas-client/openvas/prefs_dialog/prefs_dialog_auth.c
===================================================================
--- trunk/openvas-client/openvas/prefs_dialog/prefs_dialog_auth.c	2009-10-19 22:25:34 UTC (rev 5635)
+++ trunk/openvas-client/openvas/prefs_dialog/prefs_dialog_auth.c	2009-10-20 07:42:26 UTC (rev 5636)
@@ -52,6 +52,13 @@
   struct auth_fileselect *key_file;
 };
 
+/**
+ * @brief Returns the hostname specified by the user or NULL if none entered.
+ *
+ * If the corresponding entry widget is empty, an error message will be shown.
+ *
+ * @return Hostname entered by the user or NULL if empty.
+ */
 const gchar *
 prefs_dialog_auth_hostname (struct auth_dialog *auth)
 {
@@ -67,6 +74,14 @@
   return text;
 }
 
+
+/**
+ * @brief Returns the user-selected port or -1 if out of range.
+ *
+ * If the selected port is <0 || > 65536 an error message will be shown.
+ *
+ * @return Port number selected by user or -1 if out of range.
+ */
 int
 prefs_dialog_auth_port (struct auth_dialog *auth)
 {
@@ -327,6 +342,10 @@
   gtk_widget_set_sensitive(auth->key_file->box, use_ssl && use_client_cert);
 }
 
+
+/**
+ * @brief Creates the dialog with details with which to connect.
+ */
 void
 prefs_dialog_auth_create_dialog (struct context *context, struct auth_dialog *auth)
 {
@@ -638,10 +657,10 @@
 gboolean
 prefs_dialog_auth_connection (struct context *context)
 {
-  if(context->socket >= 0)
+  if (context->socket >= 0)
     return TRUE;
 
-  if(!context->passwd ||
+  if (!context->passwd ||
      !prefs_get_int(Global, "nessusd_autoconnect") ||
       prefs_dialog_auth_do_connect(context, MainDialog))
     return prefs_dialog_auth_connect_dialog(context, MainDialog);

Modified: trunk/openvas-client/openvas/report.c
===================================================================
--- trunk/openvas-client/openvas/report.c	2009-10-19 22:25:34 UTC (rev 5635)
+++ trunk/openvas-client/openvas/report.c	2009-10-20 07:42:26 UTC (rev 5636)
@@ -144,35 +144,35 @@
 {
   struct context *report_context;
   gchar *report_filename;
-  int report_len = strlen("Report YYYYMMDD-HHMMSS") + 1;
+  int report_len = strlen ("Report YYYYMMDD-HHMMSS") + 1;
   time_t t;
   int error;
 
-  context = context_by_type(context, CONTEXT_SCOPE);
-  if(!context)
-  {
-    show_error(_("report_save() called with illegal type"));
-    return;
-  }
+  context = context_by_type (context, CONTEXT_SCOPE);
+  if (!context)
+    {
+      show_error (_("report_save() called with illegal type"));
+      return;
+    }
 
-  if(name)
-    report_context = scopetree_new_with_parent(context, CONTEXT_REPORT,
-	name, "");
+  if (name)
+    report_context = scopetree_new_with_parent (context, CONTEXT_REPORT,
+                                                name, "");
   else
-  {
-    char* report_name = emalloc(report_len);
-    t = time(NULL);
-    strftime(report_name, report_len, "Report %Y%m%d-%H%M%S", localtime(&t));
-    report_context = scopetree_new_with_parent(context, CONTEXT_REPORT,
-	report_name, NULL);
-    efree(&report_name);
-  }
+    {
+      char* report_name = emalloc (report_len);
+      t = time (NULL);
+      strftime (report_name, report_len, "Report %Y%m%d-%H%M%S", localtime (&t));
+      report_context = scopetree_new_with_parent (context, CONTEXT_REPORT,
+                                                  report_name, NULL);
+      efree (&report_name);
+    }
 
-  if(!report_context)
-  {
-    show_error(_("report_save() couldn't create context"));
-    return;
-  }
+  if (!report_context)
+    {
+      show_error (_("report_save() couldn't create context"));
+      return;
+    }
   report_filename = report_get_filename (report_context);
   if(!report_filename)
   {



More information about the Openvas-commits mailing list