- djm@cvs.openbsd.org 2004/01/27 10:08:10
[sftp.c]
reorder parsing so user:skey@host:file works (bugzilla #777)
patch from admorten AT umich.edu; ok markus@
diff --git a/sftp.c b/sftp.c
index 0be2788..fef28c3 100644
--- a/sftp.c
+++ b/sftp.c
@@ -24,7 +24,7 @@
#include "includes.h"
-RCSID("$OpenBSD: sftp.c,v 1.40 2004/01/21 03:07:59 djm Exp $");
+RCSID("$OpenBSD: sftp.c,v 1.41 2004/01/27 10:08:10 djm Exp $");
#include "buffer.h"
#include "xmalloc.h"
@@ -212,11 +212,6 @@
userhost = xstrdup(argv[optind]);
file2 = argv[optind+1];
- if ((cp = colon(userhost)) != NULL) {
- *cp++ = '\0';
- file1 = cp;
- }
-
if ((host = strrchr(userhost, '@')) == NULL)
host = userhost;
else {
@@ -228,6 +223,11 @@
addargs(&args, "-l%s",userhost);
}
+ if ((cp = colon(host)) != NULL) {
+ *cp++ = '\0';
+ file1 = cp;
+ }
+
host = cleanhostname(host);
if (!*host) {
fprintf(stderr, "Missing hostname\n");