Hi, I made this simple path to make sftp-server restricted to a basepath! This was done because use sshfs [wich base is sftp-server] to allow people access medias [ cdrom,dvdrom, floppy, usb] from x-terms. Those x-terms [ diskless] does not have all users, so we share a single user and a DSA empty passphrase, with some acl scipts at .ssh/authorized keys. Main usage of this patch is to NOT allow a user who mounted a floppy access other mounted media from another user. Usage: sftp-server -b <path> My page includes this path: http://www.inf.ufpr.br/ribas/sshfs_help/ And it is attached too. Thanks for atention Bruno Ribas -- Bruno Ribas - ribas at c3sl.ufpr.br http://web.inf.ufpr.br/ribas C3SL: http://www.c3sl.ufpr.br -------------- next part -------------- A non-text attachment was scrubbed... Name: sftp-server.c.patch Type: text/x-diff Size: 1369 bytes Desc: not available Url : http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20070901/52e85af4/attachment.bin
On Sat, Sep 01, 2007 at 05:22:11PM -0300, Bruno Cesar Ribas wrote:> I made this simple path to make sftp-server restricted to a basepath![...]> + if(strncmp(basepath,realpath(path,NULL),strlen(basepath))==0) {Passing a NULL as the second argument to realpath is a) nonstandard and b) makes it malloc the returned string, so this leaks memory. Also, realpath can fail and return NULL, in which case this would segfault. -- 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.
I made some changes [as attached]. For some reason i did not receive Darren Tucker mail, saw his mail at archive searching for other problem. well.. that's it On Sat, Sep 01, 2007 at 05:22:11PM -0300, Bruno Cesar Ribas wrote:> Hi, > > I made this simple path to make sftp-server restricted to a basepath! > > This was done because use sshfs [wich base is sftp-server] to allow people > access medias [ cdrom,dvdrom, floppy, usb] from x-terms. > > Those x-terms [ diskless] does not have all users, so we share a single user > and a DSA empty passphrase, with some acl scipts at .ssh/authorized keys. > > Main usage of this patch is to NOT allow a user who mounted a floppy access > other mounted media from another user. > > Usage: > sftp-server -b <path> > > My page includes this path: http://www.inf.ufpr.br/ribas/sshfs_help/ > > And it is attached too. > > Thanks for atention > > Bruno Ribas > -- > Bruno Ribas - ribas at c3sl.ufpr.br > http://web.inf.ufpr.br/ribas > C3SL: http://www.c3sl.ufpr.br> _______________________________________________ > openssh-unix-dev mailing list > openssh-unix-dev at mindrot.org > https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev-- Bruno Ribas - ribas at c3sl.ufpr.br http://web.inf.ufpr.br/ribas C3SL: http://www.c3sl.ufpr.br -------------- next part -------------- A non-text attachment was scrubbed... Name: sftp-server.c.patch Type: text/x-diff Size: 2163 bytes Desc: not available Url : http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20070910/3259733e/attachment.bin