summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/sftp-server.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2008-06-26 06:10:10 +0000
committerDamien Miller <djm@cvs.openbsd.org>2008-06-26 06:10:10 +0000
commitcbd1742983ddae83f909df1c23efb2712702ab51 (patch)
treeaf3b6456b8c38540266a690d38429ae2c25341fd /usr.bin/ssh/sftp-server.c
parentb36cfd95f93973638a8501314e4da095c0d0d9f5 (diff)
allow the sftp chmod(2)-equivalent operation to set set[ug]id/sticky
bits. Note that this only affects explicit setting of modes (e.g. via sftp(1)'s chmod command) and not file transfers. (bz#1310) ok deraadt@ at c2k8
Diffstat (limited to 'usr.bin/ssh/sftp-server.c')
-rw-r--r--usr.bin/ssh/sftp-server.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/ssh/sftp-server.c b/usr.bin/ssh/sftp-server.c
index cfab230cb8b..0328b18d15a 100644
--- a/usr.bin/ssh/sftp-server.c
+++ b/usr.bin/ssh/sftp-server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp-server.c,v 1.83 2008/06/09 13:02:39 dtucker Exp $ */
+/* $OpenBSD: sftp-server.c,v 1.84 2008/06/26 06:10:09 djm Exp $ */
/*
* Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
*
@@ -754,7 +754,7 @@ process_setstat(void)
}
if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) {
logit("set \"%s\" mode %04o", name, a->perm);
- ret = chmod(name, a->perm & 0777);
+ ret = chmod(name, a->perm & 07777);
if (ret == -1)
status = errno_to_portable(errno);
}
@@ -807,7 +807,7 @@ process_fsetstat(void)
}
if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) {
logit("set \"%s\" mode %04o", name, a->perm);
- ret = fchmod(fd, a->perm & 0777);
+ ret = fchmod(fd, a->perm & 07777);
if (ret == -1)
status = errno_to_portable(errno);
}
@@ -949,7 +949,7 @@ process_mkdir(void)
name = get_string(NULL);
a = get_attrib();
mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ?
- a->perm & 0777 : 0777;
+ a->perm & 07777 : 0777;
debug3("request %u: mkdir", id);
logit("mkdir name \"%s\" mode 0%o", name, mode);
ret = mkdir(name, mode);