scp (4.3p2) no longer allows a space in the userid. - SSH

This is a discussion on scp (4.3p2) no longer allows a space in the userid. - SSH ; Prior to upgrading to 4.3p2 (4.2p1 and before) I was able to do the following: scp foo "MY USERID"@myputer.net:tmp With the userid having a space in it. Now when I issue the command I get an error message "MY USERID: ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: scp (4.3p2) no longer allows a space in the userid.

  1. scp (4.3p2) no longer allows a space in the userid.

    Prior to upgrading to 4.3p2 (4.2p1 and before) I was able to do the
    following:
    scp foo "MY USERID"@myputer.net:tmp
    With the userid having a space in it. Now when I issue
    the command I get an error message "MY USERID: invalid user name".
    The machines with a space in the username are WinDoze.
    I have searched the ChangeLog and can't find any mention of this.
    In addition, I searched the archives and didn't see where someone
    else was having this same problem. I compiled openssh on Solaris 9.
    I have also noted this same behavior within Cygwin as well.

    Was this change intentional?

    Chris


  2. Re: scp (4.3p2) no longer allows a space in the userid.

    On 2006-02-22, MeeAGhost@gmail.com wrote:
    > Prior to upgrading to 4.3p2 (4.2p1 and before) I was able to do the
    > following:
    > scp foo "MY USERID"@myputer.net:tmp
    > With the userid having a space in it. Now when I issue
    > the command I get an error message "MY USERID: invalid user name".
    > The machines with a space in the username are WinDoze.
    > I have searched the ChangeLog and can't find any mention of this.
    > In addition, I searched the archives and didn't see where someone
    > else was having this same problem. I compiled openssh on Solaris 9.
    > I have also noted this same behavior within Cygwin as well.
    >
    > Was this change intentional?


    No, it was a side effect of fixing a bug in scp's handling of shell
    metacharacters. On the other hand, the fact that it worked at all was
    also unintentional (scp's okname() has checked for spaces for at least
    a couple of years.

    None of that is likely to be a consolation, however since scp now
    processes its own arguments rather than letting system() do it,
    having spaces in the username might not be a problem any more.

    Try this patch, which seems to do the trick. Not sure if it has any
    other side effects, though.

    As an aside, we need to make the ssh_config parser understand quotes so
    you can do things like

    User 'foo bar'

    in ssh_config files or

    scp "-oUser='foo bar'" foo bar:

    There's a bug in bugzilla for this but the patch needs a bit of work.

    Index: scp.c
    ================================================== =================
    RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/scp.c,v
    retrieving revision 1.144
    diff -u -p -r1.144 scp.c
    --- scp.c 31 Jan 2006 11:11:38 -0000 1.144
    +++ scp.c 23 Feb 2006 13:00:19 -0000
    @@ -1145,7 +1145,6 @@ okname(char *cp0)
    case '\'':
    case '"':
    case '`':
    - case ' ':
    case '#':
    goto bad;
    default:

    --
    Darren Tucker (dtucker at zip.com.au)
    GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
    usually comes from bad judgement.

  3. Re: scp (4.3p2) no longer allows a space in the userid.

    Thanks Darren.

    As a quick fix in I had commented out the check for white space in the
    okname function but before I made the change across my entire
    environment I wanted a sanity check. You proved me sane. Do you think
    the patch will make in the next release of openssh or will I have to
    apply it to furture versions?

    -- Chris


  4. Re: scp (4.3p2) no longer allows a space in the userid.

    On 2006-02-23, MeeAGhost@gmail.com wrote:
    > As a quick fix in I had commented out the check for white space in the
    > okname function but before I made the change across my entire
    > environment I wanted a sanity check. You proved me sane. Do you think
    > the patch will make in the next release of openssh or will I have to
    > apply it to furture versions?


    Looking at it, the patch isn't right. It allows spaces in the usernames
    for remote-to-remote copies, which it shouldn't.

    I've opened a bug and attached a better patch:
    http://bugzilla.mindrot.org/show_bug.cgi?id=1164

    Testing would be appreciated.

    --
    Darren Tucker (dtucker at zip.com.au)
    GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
    usually comes from bad judgement.

  5. Re: scp (4.3p2) no longer allows a space in the userid.

    >Looking at it, the patch isn't right. It allows spaces in the usernames
    >for remote-to-remote copies, which it shouldn't.


    >I've opened a bug and attached a better patch:
    >http://bugzilla.mindrot.org/show_bug.cgi?id=1164


    >Testing would be appreciated.


    Installed the patch (from bugzilla) and all is working well. Thanks.


  6. Re: scp (4.3p2) no longer allows a space in the userid.

    On 2006-02-28, MeeAGhost@gmail.com wrote:
    >>Looking at it, the patch isn't right. It allows spaces in the usernames
    >>for remote-to-remote copies, which it shouldn't.

    >
    >>I've opened a bug and attached a better patch:
    >>http://bugzilla.mindrot.org/show_bug.cgi?id=1164

    >
    >>Testing would be appreciated.

    >
    > Installed the patch (from bugzilla) and all is working well. Thanks.


    Further to this: the ability to enclose whitespace in config directives
    was just added and will be in 4.4 and up, so in future this will also work:

    $ scp -o 'User="John Smith"' source dest:

    or its equivalent entries in ssh_config or ~/.ssh/config.

    I need to get back to the scp patch too...

    --
    Darren Tucker (dtucker at zip.com.au)
    GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
    usually comes from bad judgement.

+ Reply to Thread