summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-06-29 22:46:35 +1000
committerDamien Miller <djm@mindrot.org>2008-06-29 22:46:35 +1000
commit9e720284fe63aa8e59983b880447ed4ae768387c (patch)
tree42a27c06c3ffd9bba4dafca6eb617059a85e9bad
parent007132a7c92e603ffb76862cedb28f3165582731 (diff)
- djm@cvs.openbsd.org 2008/06/26 06:10:09
[sftp-client.c sftp-server.c] 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
-rw-r--r--ChangeLog8
-rw-r--r--sftp-client.c4
-rw-r--r--sftp-server.c10
3 files changed, 14 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 5cde1b698..ce856bc7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,12 @@
8 [key.c] 8 [key.c]
9 add key length to visual fingerprint; zap magical constants; 9 add key length to visual fingerprint; zap magical constants;
10 ok grunk@ djm@ 10 ok grunk@ djm@
11 - djm@cvs.openbsd.org 2008/06/26 06:10:09
12 [sftp-client.c sftp-server.c]
13 allow the sftp chmod(2)-equivalent operation to set set[ug]id/sticky
14 bits. Note that this only affects explicit setting of modes (e.g. via
15 sftp(1)'s chmod command) and not file transfers. (bz#1310)
16 ok deraadt@ at c2k8
11 17
1220080628 1820080628
13 - (djm) [RFC.nroff contrib/cygwin/Makefile contrib/suse/openssh.spec] 19 - (djm) [RFC.nroff contrib/cygwin/Makefile contrib/suse/openssh.spec]
@@ -4428,4 +4434,4 @@
4428 OpenServer 6 and add osr5bigcrypt support so when someone migrates 4434 OpenServer 6 and add osr5bigcrypt support so when someone migrates
4429 passwords between UnixWare and OpenServer they will still work. OK dtucker@ 4435 passwords between UnixWare and OpenServer they will still work. OK dtucker@
4430 4436
4431$Id: ChangeLog,v 1.5026 2008/06/29 12:45:37 djm Exp $ 4437$Id: ChangeLog,v 1.5027 2008/06/29 12:46:35 djm Exp $
diff --git a/sftp-client.c b/sftp-client.c
index 2565a704d..42bf0c813 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-client.c,v 1.85 2008/06/12 20:47:04 djm Exp $ */ 1/* $OpenBSD: sftp-client.c,v 1.86 2008/06/26 06:10:09 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -920,7 +920,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
920 if (a == NULL) 920 if (a == NULL)
921 return(-1); 921 return(-1);
922 922
923 /* XXX: should we preserve set[ug]id? */ 923 /* Do not preserve set[ug]id here, as we do not preserve ownership */
924 if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) 924 if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS)
925 mode = a->perm & 0777; 925 mode = a->perm & 0777;
926 else 926 else
diff --git a/sftp-server.c b/sftp-server.c
index 4022b93b6..a4c4f168f 100644
--- a/sftp-server.c
+++ b/sftp-server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-server.c,v 1.83 2008/06/09 13:02:39 dtucker Exp $ */ 1/* $OpenBSD: sftp-server.c,v 1.84 2008/06/26 06:10:09 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000-2004 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000-2004 Markus Friedl. All rights reserved.
4 * 4 *
@@ -763,7 +763,7 @@ process_setstat(void)
763 } 763 }
764 if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { 764 if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) {
765 logit("set \"%s\" mode %04o", name, a->perm); 765 logit("set \"%s\" mode %04o", name, a->perm);
766 ret = chmod(name, a->perm & 0777); 766 ret = chmod(name, a->perm & 07777);
767 if (ret == -1) 767 if (ret == -1)
768 status = errno_to_portable(errno); 768 status = errno_to_portable(errno);
769 } 769 }
@@ -817,9 +817,9 @@ process_fsetstat(void)
817 if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { 817 if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) {
818 logit("set \"%s\" mode %04o", name, a->perm); 818 logit("set \"%s\" mode %04o", name, a->perm);
819#ifdef HAVE_FCHMOD 819#ifdef HAVE_FCHMOD
820 ret = fchmod(fd, a->perm & 0777); 820 ret = fchmod(fd, a->perm & 07777);
821#else 821#else
822 ret = chmod(name, a->perm & 0777); 822 ret = chmod(name, a->perm & 07777);
823#endif 823#endif
824 if (ret == -1) 824 if (ret == -1)
825 status = errno_to_portable(errno); 825 status = errno_to_portable(errno);
@@ -970,7 +970,7 @@ process_mkdir(void)
970 name = get_string(NULL); 970 name = get_string(NULL);
971 a = get_attrib(); 971 a = get_attrib();
972 mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? 972 mode = (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ?
973 a->perm & 0777 : 0777; 973 a->perm & 07777 : 0777;
974 debug3("request %u: mkdir", id); 974 debug3("request %u: mkdir", id);
975 logit("mkdir name \"%s\" mode 0%o", name, mode); 975 logit("mkdir name \"%s\" mode 0%o", name, mode);
976 ret = mkdir(name, mode); 976 ret = mkdir(name, mode);