bmh10 / rpms / openssh

Forked from rpms/openssh 2 days ago
Clone

Blame SOURCES/openssh-8.0p1-ipv6-process.patch

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