[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openvas-cvs
Subject:    [Openvas-commits] r22656 - in trunk/openvas-libraries: . nasl
From:       scm-commit () wald ! intevation ! org
Date:       2015-06-18 10:32:34
Message-ID: 20150618103234.543AF9A194DA () wald ! intevation ! org
[Download RAW message or body]

Author: kroosec
Date: 2015-06-18 12:32:34 +0200 (Thu, 18 Jun 2015)
New Revision: 22656

Modified:
   trunk/openvas-libraries/ChangeLog
   trunk/openvas-libraries/nasl/nasl_ssh.c
Log:
* nasl/nasl_ssh.c (nasl_ssh_set_login): Check that username is not
empty.
(nasl_ssh_userauth): Return on nasl_ssh_set_login() error.

Modified: trunk/openvas-libraries/ChangeLog
===================================================================
--- trunk/openvas-libraries/ChangeLog	2015-06-17 15:20:22 UTC (rev 22655)
+++ trunk/openvas-libraries/ChangeLog	2015-06-18 10:32:34 UTC (rev 22656)
@@ -1,3 +1,9 @@
+2015-06-18  Hani Benhabiles <hani.benhabiles@greenbone.net>
+
+	* nasl/nasl_ssh.c (nasl_ssh_set_login): Check that username is not
+	empty.
+	(nasl_ssh_userauth): Return on nasl_ssh_set_login() error.
+
 2015-06-17  Hani Benhabiles <hani.benhabiles@greenbone.net>
 
 	* nasl/nasl_ssh.c (exec_ssh_cmd): Zero buffer, reset retry counter on

Modified: trunk/openvas-libraries/nasl/nasl_ssh.c
===================================================================
--- trunk/openvas-libraries/nasl/nasl_ssh.c	2015-06-17 15:20:22 UTC (rev 22655)
+++ trunk/openvas-libraries/nasl/nasl_ssh.c	2015-06-18 10:32:34 UTC (rev 22656)
@@ -939,7 +939,8 @@
           kb = plug_get_kb (lexic->script_infos);
           username = kb_item_get_str (kb, "Secret/SSH/login");
         }
-      if (username && ssh_options_set (session, SSH_OPTIONS_USER, username))
+      if (username && *username &&
+          ssh_options_set (session, SSH_OPTIONS_USER, username))
         {
           log_legacy_write ("Failed to set SSH username '%s': %s\n",
                             username, ssh_get_error (session));
@@ -1032,8 +1033,8 @@
 
   /* Check if we need to set the user.  This is done only once per
      session.  */
-  if (!session_table[tbl_slot].user_set)
-    nasl_ssh_set_login (lexic);
+  if (!session_table[tbl_slot].user_set && !nasl_ssh_set_login (lexic))
+    return NULL;
 
   kb = plug_get_kb (lexic->script_infos);
   password = get_str_local_var_by_name (lexic, "password");
@@ -1456,8 +1457,8 @@
 
   /* We need to make sure that we got the auth methods so that libssh
      has the banner.  */
-  if (!session_table[tbl_slot].user_set)
-    nasl_ssh_set_login (lexic);
+  if (!session_table[tbl_slot].user_set && !nasl_ssh_set_login (lexic))
+    return NULL;
   if (!session_table[tbl_slot].authmethods_valid)
     get_authmethods (tbl_slot);
 
@@ -1550,8 +1551,8 @@
   if (!find_session_id (lexic, "ssh_get_auth_methods", &tbl_slot))
     return NULL;
 
-  if (!session_table[tbl_slot].user_set)
-    nasl_ssh_set_login (lexic);
+  if (!session_table[tbl_slot].user_set && !nasl_ssh_set_login (lexic))
+    return NULL;
   if (!session_table[tbl_slot].authmethods_valid)
     get_authmethods (tbl_slot);
 

_______________________________________________
Openvas-commits mailing list
Openvas-commits@wald.intevation.org
https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic