Why does the local scp determine what characters are valid in a remote
host userid?
A friend of mine just had his ISP convert him to using a userid of the
form 'user#isp-acct' (eg, "ssh -l 'joe#foo.org'
foo.org" is used to
login).
The OpenSSH ssh and sftp commands both allow this form of userid.
However, it seems that scp has its very own idea of what characters
are legal on a remote userid and does not like the '#' character at
all giving the error:
% scp test-file 'joe#foo.org at foo.org:.
joe#foo.org: invalid user name
%
(Note: foo.org is just an example for the purpose of this message)
As the ssh command allows him to login and the sftp command may be
used to work around the problem it is not critical that this be fixed,
but it seems like a bad idea for scp to restrict the characters
allowed in a remote userid.
The following patch allows a '#' to be in the user name. However, I
suggest that there really should be no arbitrary restriction on
possible userids for scp that differs from ssh or sftp.
Thanks,
-- Mark
Index: scp.c
==================================================================RCS file:
/cvs/openssh/scp.c,v
retrieving revision 1.94
diff -u -p -r1.94 scp.c
--- scp.c 6 Apr 2002 18:30:00 -0000 1.94
+++ scp.c 12 Apr 2002 02:13:22 -0000
@@ -1016,7 +1016,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);