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

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Thu Apr 12 17:16:10 CEST 2012


Author: mattm
Date: 2012-04-12 17:16:10 +0200 (Thu, 12 Apr 2012)
New Revision: 13229

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/manage_sql.c
Log:
	* src/manage_sql.c (modify_target): Only validate port when there's an SSH
	credential.  Add 0 tests for credentials.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2012-04-12 15:14:38 UTC (rev 13228)
+++ trunk/openvas-manager/ChangeLog	2012-04-12 15:16:10 UTC (rev 13229)
@@ -1,5 +1,10 @@
 2012-04-11  Matthew Mundell <matthew.mundell at greenbone.net>
 
+	* src/manage_sql.c (modify_target): Only validate port when there's an SSH
+	credential.  Add 0 tests for credentials.
+
+2012-04-11  Matthew Mundell <matthew.mundell at greenbone.net>
+
 	Add IP count to GET_TARGETS filtering.  Also better control which database
 	columns are searched.
 

Modified: trunk/openvas-manager/src/manage_sql.c
===================================================================
--- trunk/openvas-manager/src/manage_sql.c	2012-04-12 15:14:38 UTC (rev 13228)
+++ trunk/openvas-manager/src/manage_sql.c	2012-04-12 15:16:10 UTC (rev 13229)
@@ -22654,9 +22654,6 @@
   target_t target;
   lsc_credential_t ssh_lsc_credential, smb_lsc_credential;
 
-  if (ssh_port && validate_port (ssh_port))
-    return 5;
-
   sql ("BEGIN IMMEDIATE;");
 
   assert (current_credentials.uuid);
@@ -22683,31 +22680,41 @@
     }
 
   ssh_lsc_credential = 0;
-  if (ssh_lsc_credential_id
-      && find_lsc_credential (ssh_lsc_credential_id, &ssh_lsc_credential))
+  if (ssh_lsc_credential_id && strcmp (ssh_lsc_credential_id, "0"))
     {
-      sql ("ROLLBACK;");
-      return -1;
-    }
+      if (find_lsc_credential (ssh_lsc_credential_id, &ssh_lsc_credential))
+        {
+          sql ("ROLLBACK;");
+          return -1;
+        }
 
-  if (ssh_lsc_credential_id && ssh_lsc_credential == 0)
-    {
-      sql ("ROLLBACK;");
-      return 7;
+      if (ssh_lsc_credential == 0)
+        {
+          sql ("ROLLBACK;");
+          return 7;
+        }
+
+      if (ssh_port && validate_port (ssh_port))
+        {
+          sql ("ROLLBACK;");
+          return 5;
+        }
     }
 
   smb_lsc_credential = 0;
-  if (smb_lsc_credential_id
-      && find_lsc_credential (smb_lsc_credential_id, &smb_lsc_credential))
+  if (smb_lsc_credential_id && strcmp (smb_lsc_credential_id, "0"))
     {
-      sql ("ROLLBACK;");
-      return -1;
-    }
+      if (find_lsc_credential (smb_lsc_credential_id, &smb_lsc_credential))
+        {
+          sql ("ROLLBACK;");
+          return -1;
+        }
 
-  if (smb_lsc_credential_id && smb_lsc_credential == 0)
-    {
-      sql ("ROLLBACK;");
-      return 8;
+      if (smb_lsc_credential == 0)
+        {
+          sql ("ROLLBACK;");
+          return 7;
+        }
     }
 
   /* Check whether a target with the same name exists already. */



More information about the Openvas-commits mailing list