From c276c1208e43ed4305d723004ddf602fbe99513b Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Mon, 23 Dec 2002 02:14:51 +0000 Subject: [PATCH] - markus@cvs.openbsd.org 2002/11/27 17:53:35 [scp.c sftp.c ssh.c] allow usernames with embedded '@', e.g. scp user@vhost@realhost:file /tmp; http://bugzilla.mindrot.org/show_bug.cgi?id=447; ok mouring@, millert@ --- ChangeLog | 6 +++++- scp.c | 10 +++++----- sftp.c | 4 ++-- ssh.c | 6 +++--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index f9e7fa386..1745e7c99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,6 +36,10 @@ - stevesk@cvs.openbsd.org 2002/11/26 02:38:54 [canohost.c] KNF, comment and error message repair; ok markus@ + - markus@cvs.openbsd.org 2002/11/27 17:53:35 + [scp.c sftp.c ssh.c] + allow usernames with embedded '@', e.g. scp user@vhost@realhost:file /tmp; + http://bugzilla.mindrot.org/show_bug.cgi?id=447; ok mouring@, millert@ 20021205 - (djm) PERL-free fixpaths from stuge-openssh-unix-dev@cdy.org @@ -871,4 +875,4 @@ save auth method before monitor_reset_key_state(); bugzilla bug #284; ok provos@ -$Id: ChangeLog,v 1.2525 2002/12/23 02:13:37 mouring Exp $ +$Id: ChangeLog,v 1.2526 2002/12/23 02:14:51 mouring Exp $ diff --git a/scp.c b/scp.c index 73ab0de81..4214e0c53 100644 --- a/scp.c +++ b/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" @@ -370,7 +370,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]; @@ -391,7 +391,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) + @@ -470,7 +470,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 { @@ -1036,7 +1036,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/sftp.c b/sftp.c index c4055b91e..c173e58cb 100644 --- a/sftp.c +++ b/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') */ @@ -197,7 +197,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/ssh.c b/ssh.c index ac1c1db4a..c6beb1bcf 100644 --- a/ssh.c +++ b/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 #include @@ -495,9 +495,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;