Bug 1655 - sftp is unhappy with asterisks in filenames
Summary: sftp is unhappy with asterisks in filenames
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp (show other bugs)
Version: 5.2p1
Hardware: Other Mac OS X
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_5_6
  Show dependency treegraph
 
Reported: 2009-09-30 06:22 AEST by Disco Vince Giffin
Modified: 2011-01-24 12:33 AEDT (History)
1 user (show)

See Also:


Attachments
/home/djm/sftp-unbreak-ls-of-glob.diff (460 bytes, patch)
2010-06-18 10:57 AEST, Damien Miller
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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