[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@
This commit is contained in:
Ben Lindstrom 2002-12-23 02:14:51 +00:00
parent acaac975ca
commit c276c1208e
4 changed files with 15 additions and 11 deletions

View File

@ -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 $

10
scp.c
View File

@ -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);

4
sftp.c
View File

@ -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';

6
ssh.c
View File

@ -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>
@ -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;