jonathancammack / rpms / openssh

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