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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Dec 16 11:33:06 CET 2008


Author: felix
Date: 2008-12-16 11:33:06 +0100 (Tue, 16 Dec 2008)
New Revision: 2009

Modified:
   trunk/openvas-client/ChangeLog
   trunk/openvas-client/nessus/prefs_dialog/prefs_dialog_plugins_prefs.c
   trunk/openvas-client/nessus/prefs_dialog/prefs_dialog_plugins_prefs.h
Log:
Function to update existing comboboxes showing ssh keys, can be used 
when a new key is created, so that the keys to select are always up to
date.

* nessus/prefs_dialog/prefs_dialog_plugins_prefs.h
(prefs_dialog_plugins_prefs_update_ssh_comboboxes) : Added proto.

* nessus/prefs_dialog/prefs_dialog_plugins_prefs.c 
(prefs_dialog_plugins_prefs_update_ssh_comboboxes) : Implemented, adds
a text entry item to all sshkey comboboxes.


Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog	2008-12-16 10:31:19 UTC (rev 2008)
+++ trunk/openvas-client/ChangeLog	2008-12-16 10:33:06 UTC (rev 2009)
@@ -1,11 +1,23 @@
 2008-12-16  Felix Wolfsteller <felix.wolfsteller at intevation.de>
 
+	Function to update existing comboboxes showing ssh keys, can be used 
+	when a new key is created, so that the keys to select are always up to
+	date.
+
+	* nessus/prefs_dialog/prefs_dialog_plugins_prefs.h
+	(prefs_dialog_plugins_prefs_update_ssh_comboboxes) : Added proto.
+	
+	* nessus/prefs_dialog/prefs_dialog_plugins_prefs.c 
+	(prefs_dialog_plugins_prefs_update_ssh_comboboxes) : Implemented, adds
+	a text entry item to all sshkey comboboxes.
+
+2008-12-16  Felix Wolfsteller <felix.wolfsteller at intevation.de>
+
 	Fixed free-function for ssh_key_info_form.
 
 	* src/gui/ssh_key_info_form.c (ssh_key_info_form_free ): Added missing
 	references.
 
-
 2008-12-16  Felix Wolfsteller <felix.wolfsteller at intevation.de>
 
 	Free-function for ssh_key_info_form.

Modified: trunk/openvas-client/nessus/prefs_dialog/prefs_dialog_plugins_prefs.c
===================================================================
--- trunk/openvas-client/nessus/prefs_dialog/prefs_dialog_plugins_prefs.c	2008-12-16 10:31:19 UTC (rev 2008)
+++ trunk/openvas-client/nessus/prefs_dialog/prefs_dialog_plugins_prefs.c	2008-12-16 10:33:06 UTC (rev 2009)
@@ -426,7 +426,60 @@
  return value;
 }
 
+
 /**
+ * Adds an entry to all the Comboboxes showing SSH keys.
+ * To do this, all "next" and child contextes of ctx are recursively searched 
+ * for plugins that have a ssh_credentials preferences, their combobox is 
+ * unpacked and the new entry appended.
+ * @param ctx Context to start looking for plugins with ssh_credentials preference.
+ * @param newentry Text to add (should be key of ctx's sshkeys hash table).
+ * @see context.sshkeys
+ */
+void
+prefs_dialog_plugins_prefs_update_ssh_comboboxes(struct context* ctx,
+                                                 char* newentry)
+{
+  if(ctx == NULL || newentry == NULL)
+    return;
+  
+  struct nessus_plugin* plugins;
+  struct arglist* pref;
+  char* type;
+
+  // Look in all Scopes + Global
+  while(ctx && ctx->type < CONTEXT_REPORT)
+  {
+    prefs_dialog_plugins_prefs_update_ssh_comboboxes(ctx->children, newentry);
+    if(ctx->type == CONTEXT_SCOPE || ctx->type == CONTEXT_GLOBAL)
+    {
+      // Look in all plugins for a SSH_LOGIN preference
+      plugins = ctx->plugins;
+      while(plugins != NULL)
+      {
+        pref = plugins->plugin_prefs;
+        while(pref && pref->next)
+        {
+          type = (char *)arg_get_value(pref->value, "type");
+          if(type != NULL && !strcmp(type, PREF_SSH_CREDENTIALS))
+          {
+            GtkWidget* combobox = arg_get_value(pref->value, "COMBOBOX");
+            gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), newentry);
+            printf("BUGME: scope or global\n");
+          }
+          pref = pref->next;
+        }
+        plugins = plugins->next;
+      }
+    }
+    ctx = ctx->next;
+  }
+
+  return;
+}
+
+
+/**
  * Helper function to set the active text of a combobox that has been 
  * initialized with gtk_combobox_new_text().
  * If value is not in the list of combobox entries, the first entry will be

Modified: trunk/openvas-client/nessus/prefs_dialog/prefs_dialog_plugins_prefs.h
===================================================================
--- trunk/openvas-client/nessus/prefs_dialog/prefs_dialog_plugins_prefs.h	2008-12-16 10:31:19 UTC (rev 2008)
+++ trunk/openvas-client/nessus/prefs_dialog/prefs_dialog_plugins_prefs.h	2008-12-16 10:33:06 UTC (rev 2009)
@@ -6,4 +6,6 @@
 struct arglist *prefs_dialog_plugins_prefs();
 void prefs_plugins_prefs_redraw(struct context *, struct arglist *);
 void prefs_dialog_plugins_prefs_read_only(struct arglist *, gboolean);
+void prefs_dialog_plugins_prefs_update_ssh_comboboxes(struct context* ctx,
+                                                      char* newentry);
 #endif



More information about the Openvas-commits mailing list