summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2001-02-09 11:46:25 +0000
committerDamien Miller <djm@cvs.openbsd.org>2001-02-09 11:46:25 +0000
commit010599737aad23904b988d180e4528a4c317604c (patch)
treeb7f2921983ac1456a8634283d74848776ca64c86 /usr.bin
parent96a3609eeee00df7d8357cc1e1925b033eeb5436 (diff)
Check for NULL attribs for chown, chmod & chgrp operations, only send
relevant attribs back to server; ok markus@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/sftp-int.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/ssh/sftp-int.c b/usr.bin/ssh/sftp-int.c
index fba1756fc46..94132f64b50 100644
--- a/usr.bin/ssh/sftp-int.c
+++ b/usr.bin/ssh/sftp-int.c
@@ -28,7 +28,7 @@
/* XXX: recursive operations */
#include "includes.h"
-RCSID("$OpenBSD: sftp-int.c,v 1.18 2001/02/08 22:28:07 stevesk Exp $");
+RCSID("$OpenBSD: sftp-int.c,v 1.19 2001/02/09 11:46:24 djm Exp $");
#include "buffer.h"
#include "xmalloc.h"
@@ -540,23 +540,27 @@ parse_dispatch_command(int in, int out, const char *cmd, char **pwd)
break;
case I_CHOWN:
path1 = make_absolute(path1, *pwd);
- aa = do_stat(in, out, path1);
+ if (!(aa = do_stat(in, out, path1)))
+ break;
if (!(aa->flags & SSH2_FILEXFER_ATTR_UIDGID)) {
error("Can't get current ownership of "
"remote file \"%s\"", path1);
break;
}
+ aa->flags &= SSH2_FILEXFER_ATTR_UIDGID;
aa->uid = n_arg;
do_setstat(in, out, path1, aa);
break;
case I_CHGRP:
path1 = make_absolute(path1, *pwd);
- aa = do_stat(in, out, path1);
+ if (!(aa = do_stat(in, out, path1)))
+ break;
if (!(aa->flags & SSH2_FILEXFER_ATTR_UIDGID)) {
error("Can't get current ownership of "
"remote file \"%s\"", path1);
break;
}
+ aa->flags &= SSH2_FILEXFER_ATTR_UIDGID;
aa->gid = n_arg;
do_setstat(in, out, path1, aa);
break;