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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 25 15:56:32 CET 2009


Author: mattm
Date: 2009-11-25 15:56:30 +0100 (Wed, 25 Nov 2009)
New Revision: 5970

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/manage.c
Log:
	* src/manage.c (start_task): Only do the credential iteration if the
	target has a credential.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-11-25 14:07:58 UTC (rev 5969)
+++ trunk/openvas-manager/ChangeLog	2009-11-25 14:56:30 UTC (rev 5970)
@@ -1,5 +1,10 @@
 2009-11-25  Matthew Mundell <matthew.mundell at intevation.de>
 
+	* src/manage.c (start_task): Only do the credential iteration if the
+	target has a credential.
+
+2009-11-25  Matthew Mundell <matthew.mundell at intevation.de>
+
 	Add support for per-NVT timeout preferences.
 
 	* src/omp.c (send_nvt): Add timeout arg.  Update callers.

Modified: trunk/openvas-manager/src/manage.c
===================================================================
--- trunk/openvas-manager/src/manage.c	2009-11-25 14:07:58 UTC (rev 5969)
+++ trunk/openvas-manager/src/manage.c	2009-11-25 14:56:30 UTC (rev 5970)
@@ -798,35 +798,38 @@
     iterator_t credentials;
     char *credential = target_lsc_credential_name (target);
 
-    init_lsc_credential_iterator (&credentials, credential, 1, NULL);
-    if (next (&credentials))
+    if (credential)
       {
-        const char *user = lsc_credential_iterator_name (&credentials);
-        const char *password = lsc_credential_iterator_password (&credentials);
+        init_lsc_credential_iterator (&credentials, credential, 1, NULL);
+        if (next (&credentials))
+          {
+            const char *user = lsc_credential_iterator_name (&credentials);
+            const char *password = lsc_credential_iterator_password (&credentials);
 
-        if (sendf_to_server ("SMB Authorization[entry]:SMB login: <|> %s\n",
-                             user)
-            || sendf_to_server ("SMB Authorization[password]:SMB password:"
-                                " <|> %s\n",
-                                password)
-            || sendf_to_server ("SSH Authorization[entry]:SSH login name:"
-                                " <|> %s\n",
-                                user)
-            || sendf_to_server ("SSH Authorization[password]:"
-                                "SSH password (unsafe!):"
-                                " <|> %s\n",
-                                password))
-          {
-            free (credential);
-            free (target);
-            free (hosts);
-            free (config);
-            cleanup_iterator (&credentials);
-            return -1;
+            if (sendf_to_server ("SMB Authorization[entry]:SMB login: <|> %s\n",
+                                 user)
+                || sendf_to_server ("SMB Authorization[password]:SMB password:"
+                                    " <|> %s\n",
+                                    password)
+                || sendf_to_server ("SSH Authorization[entry]:SSH login name:"
+                                    " <|> %s\n",
+                                    user)
+                || sendf_to_server ("SSH Authorization[password]:"
+                                    "SSH password (unsafe!):"
+                                    " <|> %s\n",
+                                    password))
+              {
+                free (credential);
+                free (target);
+                free (hosts);
+                free (config);
+                cleanup_iterator (&credentials);
+                return -1;
+              }
           }
+        cleanup_iterator (&credentials);
+        free (credential);
       }
-    cleanup_iterator (&credentials);
-    free (credential);
   }
 
   free (target);



More information about the Openvas-commits mailing list