=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/Attic/sftp-int.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- src/usr.bin/ssh/Attic/sftp-int.c 2001/02/06 05:22:02 1.8 +++ src/usr.bin/ssh/Attic/sftp-int.c 2001/02/06 22:18:16 1.9 @@ -27,7 +27,7 @@ /* XXX: recursive operations */ #include "includes.h" -RCSID("$OpenBSD: sftp-int.c,v 1.8 2001/02/06 05:22:02 provos Exp $"); +RCSID("$OpenBSD: sftp-int.c,v 1.9 2001/02/06 22:18:16 djm Exp $"); #include "buffer.h" #include "xmalloc.h" @@ -477,6 +477,18 @@ case I_CHDIR: path1 = make_absolute(path1, *pwd); tmp = do_realpath(in, out, path1); + aa = do_stat(in, out, tmp); + if (!(aa->flags & SSH2_FILEXFER_ATTR_PERMISSIONS)) { + error("Can't change directory: Can't check target"); + xfree(tmp); + break; + } + if (!S_ISDIR(aa->perm)) { + error("Can't change directory: \"%s\" is not " + "a directory", tmp); + xfree(tmp); + break; + } if (tmp) { xfree(*pwd); *pwd = tmp;