Bug 1655

Summary: sftp is unhappy with asterisks in filenames
Product: Portable OpenSSH Reporter: Disco Vince Giffin <vgiffin>
Component: sftpAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: normal CC: djm
Priority: P2    
Version: 5.2p1   
Hardware: Other   
OS: Mac OS X   
Bug Depends on:    
Bug Blocks: 1708    
Attachments:
Description Flags
/home/djm/sftp-unbreak-ls-of-glob.diff none

Description Disco Vince Giffin 2009-09-30 06:22:25 AEST
$ mkdir 'example *' 'example _'
$ sftp localhost
Connecting to localhost...
sftp> cd 'example *'
sftp> ls
                         /private/example _/         
sftp> pwd
Remote working directory: /private/tmp/example *
sftp>
Comment 1 Damien Miller 2010-04-09 12:05:58 AEST
The problem is here:


  1344        case I_LS:
  1345                if (!path1) {
  1346                        do_globbed_ls(conn, *pwd, *pwd, lflag);
  1347                        break;
  1348                }
  1349  
  1350                /* Strip pwd off beginning of non-absolute paths */
  1351                tmp = NULL;
  1352                if (*path1 != '/')
  1353                        tmp = *pwd;
  1354  
  1355                path1 = make_absolute(path1, *pwd);
  1356                err = do_globbed_ls(conn, path1, tmp, lflag);
  1357                break;

I think we need to glob-escape the pwd before calling do_globbed_ls(). There might be other instances of this bug in sftp too.
Comment 2 Damien Miller 2010-06-18 10:57:16 AEST
Created attachment 1865 [details]
/home/djm/sftp-unbreak-ls-of-glob.diff

don't try to glob ls of cwd
Comment 3 Damien Miller 2010-06-18 10:59:08 AEST
Fix applied - this will be in openssh-5.6. Thanks for the nice testcase.
Comment 4 Damien Miller 2011-01-24 12:33:47 AEDT
Move resolved bugs to CLOSED after 5.7 release