-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,

I'd like to report a possible regression in sftp(1).  In earlier
OpenSSH versions, when doing 'symlink' over sftp, the system will
create a symbolic link with relative path, and now it creates a
symbolic link with absolute path.  When doing chroot, this would make
an unusable symbolic link.

The behavior change was introduced in OpenBSD src/usr.bin/ssh/sftp.c,v
1.132 and based on my understanding of the commit log, this is not
intentional.

How to reproduce:

# sftp dtest
sftp> symlink ./l1 22
sftp> ^D

# ssh dtest "ls -l 22"
lrwxr-xr-x  1 delphij  delphij  23 Jun 21 17:28 22@ -> /home/delphij/l1

What's expected:

lrwxr-xr-x  1 delphij  delphij  4 Jun 21 17:25 22@ -> ./l1

The attached patch should fix this.

Thanks for your consideration.

Cheers,
- -- 
Xin LI <[email protected]>    https://www.delphij.net/
FreeBSD - The Power to Serve!           Live free or die
-----BEGIN PGP SIGNATURE-----

iQEcBAEBCgAGBQJR4H0rAAoJEG80Jeu8UPuzR18IALvSLSBjL7gh1KZsiT9ReNjG
CRsUve0Sk3NG5R+B3p7bgyIV996SB77xVe6wkQPCs3N0ArAoVPyDvT4oOjOQKaH/
a0mklhRUb90m//Ur4GNAyEJM/bcAK08HavIBwCq+mXuYtbhMdKRn9l3Ty6Rbh/UA
OyV2stMN6q+Yl+32jJ/BdSLnDt8QPaZjerUb57FopXSrHwEL1zNTIND8u0kfs976
827hWWK6VYadrar3njwC89Eg09ASa1XnX36BkS8SouK6J59GP4/2HqjfZqqky1Aw
ZePoejxYFEs4hvpGR+puUlG/LTKwimLKHJzOrghd1KTXhhDTQoXdc+TGJYNA3Cg=
=l46F
-----END PGP SIGNATURE-----
Index: usr.bin/ssh/sftp.c
===================================================================
RCS file: /home/openbsd/src/usr.bin/ssh/sftp.c,v
retrieving revision 1.143
diff -u -p -u -r1.143 sftp.c
--- usr.bin/ssh/sftp.c  18 Apr 2013 02:16:07 -0000      1.143
+++ usr.bin/ssh/sftp.c  22 Jun 2013 00:26:00 -0000
@@ -1313,7 +1313,6 @@ parse_dispatch_command(struct sftp_conn 
        case I_SYMLINK:
                sflag = 1;
        case I_LINK:
-               path1 = make_absolute(path1, *pwd);
                path2 = make_absolute(path2, *pwd);
                err = (sflag ? do_symlink : do_hardlink)(conn, path1, path2);
                break;

Reply via email to