diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2002-11-27 17:53:36 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2002-11-27 17:53:36 +0000 |
commit | ffa9a0ea76b607337beefe8bc976e40197aab0d8 (patch) | |
tree | 6cd74ad45fb671c7fb310f2e9a4b5322aabce927 /usr.bin | |
parent | 6cdaa5c51edf97e51a0586e3a8d9f810573233fb (diff) |
allow usernames with embedded '@', e.g. scp user@vhost@realhost:file /tmp;
http://bugzilla.mindrot.org/show_bug.cgi?id=447; ok mouring@, millert@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/scp.c | 10 | ||||
-rw-r--r-- | usr.bin/ssh/sftp.c | 4 | ||||
-rw-r--r-- | usr.bin/ssh/ssh.c | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c index 254b9e2d688..151e982a839 100644 --- a/usr.bin/ssh/scp.c +++ b/usr.bin/ssh/scp.c @@ -75,7 +75,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: scp.c,v 1.93 2002/11/26 00:45:03 wcobb Exp $"); +RCSID("$OpenBSD: scp.c,v 1.94 2002/11/27 17:53:35 markus Exp $"); #include "xmalloc.h" #include "atomicio.h" @@ -359,7 +359,7 @@ toremote(targ, argc, argv) if (*targ == 0) targ = "."; - if ((thost = strchr(argv[argc - 1], '@'))) { + if ((thost = strrchr(argv[argc - 1], '@'))) { /* user@host */ *thost++ = 0; tuser = argv[argc - 1]; @@ -380,7 +380,7 @@ toremote(targ, argc, argv) *src++ = 0; if (*src == 0) src = "."; - host = strchr(argv[i], '@'); + host = strrchr(argv[i], '@'); len = strlen(ssh_program) + strlen(argv[i]) + strlen(src) + (tuser ? strlen(tuser) : 0) + strlen(thost) + strlen(targ) + @@ -459,7 +459,7 @@ tolocal(argc, argv) *src++ = 0; if (*src == 0) src = "."; - if ((host = strchr(argv[i], '@')) == NULL) { + if ((host = strrchr(argv[i], '@')) == NULL) { host = argv[i]; suser = NULL; } else { @@ -1010,7 +1010,7 @@ okname(cp0) if (c & 0200) goto bad; if (!isalpha(c) && !isdigit(c) && - c != '_' && c != '-' && c != '.' && c != '+') + c != '@' && c != '_' && c != '-' && c != '.' && c != '+') goto bad; } while (*++cp); return (1); diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c index 221098777c6..7fb4f04b080 100644 --- a/usr.bin/ssh/sftp.c +++ b/usr.bin/ssh/sftp.c @@ -24,7 +24,7 @@ #include "includes.h" -RCSID("$OpenBSD: sftp.c,v 1.31 2002/07/25 01:16:59 mouring Exp $"); +RCSID("$OpenBSD: sftp.c,v 1.32 2002/11/27 17:53:35 markus Exp $"); /* XXX: short-form remote directory listings (like 'ls -C') */ @@ -190,7 +190,7 @@ main(int argc, char **argv) file1 = cp; } - if ((host = strchr(userhost, '@')) == NULL) + if ((host = strrchr(userhost, '@')) == NULL) host = userhost; else { *host++ = '\0'; diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index c516f6350d0..dc795d72db9 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/ssh.c @@ -40,7 +40,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh.c,v 1.187 2002/11/21 23:04:33 markus Exp $"); +RCSID("$OpenBSD: ssh.c,v 1.188 2002/11/27 17:53:35 markus Exp $"); #include <openssl/evp.h> #include <openssl/err.h> @@ -482,9 +482,9 @@ again: av += optind; if (ac > 0 && !host && **av != '-') { - if (strchr(*av, '@')) { + if (strrchr(*av, '@')) { p = xstrdup(*av); - cp = strchr(p, '@'); + cp = strrchr(p, '@'); if (cp == NULL || cp == p) usage(); options.user = p; |