jonathancammack / rpms / openssh

Forked from rpms/openssh 9 months ago
Clone
b3b6ef
diff --git a/sftp.c b/sftp.c
b3b6ef
index 04881c83..03c7a5c7 100644
b3b6ef
--- a/sftp.c
b3b6ef
+++ b/sftp.c
b3b6ef
@@ -2527,12 +2527,17 @@ main(int argc, char **argv)
b3b6ef
 				port = tmp;
b3b6ef
 			break;
b3b6ef
 		default:
b3b6ef
+			/* Try with user, host and path. */
b3b6ef
 			if (parse_user_host_path(*argv, &user, &host,
b3b6ef
-			    &file1) == -1) {
b3b6ef
-				/* Treat as a plain hostname. */
b3b6ef
-				host = xstrdup(*argv);
b3b6ef
-				host = cleanhostname(host);
b3b6ef
-			}
b3b6ef
+			    &file1) == 0)
b3b6ef
+				break;
b3b6ef
+			/* Try with user and host. */
b3b6ef
+			if (parse_user_host_port(*argv, &user, &host, NULL)
b3b6ef
+			    == 0)
b3b6ef
+				break;
b3b6ef
+			/* Treat as a plain hostname. */
b3b6ef
+			host = xstrdup(*argv);
b3b6ef
+			host = cleanhostname(host);
b3b6ef
 			break;
b3b6ef
 		}
b3b6ef
 		file2 = *(argv + 1);