[Openvas-commits] r2462 - in trunk/openvas-server: . openvasd

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 12 14:41:08 CET 2009


Author: felix
Date: 2009-02-12 14:41:05 +0100 (Thu, 12 Feb 2009)
New Revision: 2462

Modified:
   trunk/openvas-server/ChangeLog
   trunk/openvas-server/openvasd/ntp_11.c
Log:
Resolved bug when per-target ssh login information was already added in
an arglist, has to be set be become replaced.

* openvasd/ntp_11.c (build_global_sshlogin_info_map,
build_global_host_sshlogins_map): If value alread found in arglist
replace it.


Modified: trunk/openvas-server/ChangeLog
===================================================================
--- trunk/openvas-server/ChangeLog	2009-02-12 13:33:12 UTC (rev 2461)
+++ trunk/openvas-server/ChangeLog	2009-02-12 13:41:05 UTC (rev 2462)
@@ -1,3 +1,12 @@
+2009-02-12  Felix Wolfsteller <felix.wolfsteller at intevation.de>
+
+	Resolved bug when per-target ssh login information was already added in
+	an arglist, has to be set be become replaced.
+
+	* openvasd/ntp_11.c (build_global_sshlogin_info_map,
+	build_global_host_sshlogins_map): If value alread found in arglist
+	replace it.
+
 2009-02-10  Michael Wiegand <michael.wiegand at intevation.de>
 
 	* openvasd/pluginload.c (plugins_reload_from_dir): Add support for

Modified: trunk/openvas-server/openvasd/ntp_11.c
===================================================================
--- trunk/openvas-server/openvasd/ntp_11.c	2009-02-12 13:33:12 UTC (rev 2461)
+++ trunk/openvas-server/openvasd/ntp_11.c	2009-02-12 13:41:05 UTC (rev 2462)
@@ -439,9 +439,12 @@
 {
   // Deserialize the hashtable that mapped login-account names to host names.
   GHashTable* map_host_sshlogin_name = hash_table_file_read (filepath);
-  // Index it in the arglist
-  if (map_host_sshlogin_name!= NULL)
+  // Add or replace it in the arglist
+  if (map_host_sshlogin_name!= NULL
+      && arg_get_value (globals, "MAP_HOST_SSHLOGIN_NAME") == NULL)
     arg_add_value (globals, "MAP_HOST_SSHLOGIN_NAME", ARG_PTR, -1, map_host_sshlogin_name);
+  else if (map_host_sshlogin_name!= NULL)
+    arg_set_value (globals, "MAP_HOST_SSHLOGIN_NAME", -1, map_host_sshlogin_name);
 }
 
 /**
@@ -462,9 +465,11 @@
 {
   // Read the file, build map of names->structs
   GHashTable* ssh_logins = openvas_ssh_login_file_read (filepath, FALSE);
-  // Add, if not-empty
-  if (ssh_logins != NULL)
+  // Add/ Replace, if not-empty
+  if (ssh_logins != NULL && arg_get_value (globals, "MAP_NAME_SSHLOGIN") == NULL)
     arg_add_value (globals, "MAP_NAME_SSHLOGIN", ARG_PTR, -1, ssh_logins);
+  else if (ssh_logins != NULL)
+    arg_set_value (globals, "MAP_NAME_SSHLOGIN", -1, ssh_logins);
 }
 
 



More information about the Openvas-commits mailing list