summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-01-08 14:04:53 +1100
committerDamien Miller <djm@mindrot.org>2003-01-08 14:04:53 +1100
commit770b374a68fdb27de2c6314f154db57067875ff8 (patch)
treefbe074d4b2d41e5311154c3e088efe5b55103ae2
parent275295eb41278ccb0bf652271c33d656f2dc0de3 (diff)
- djm@cvs.openbsd.org 2003/01/06 23:51:22
[sftp-client.c] Fix "get -p" download to not add user-write perm. mindrot bug #426 reported by gfernandez@livevault.com; ok markus@
-rw-r--r--ChangeLog6
-rw-r--r--sftp-client.c7
2 files changed, 9 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 35b35c1d2..3d489ed24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@
5 - markus@cvs.openbsd.org 2003/01/01 18:08:52 5 - markus@cvs.openbsd.org 2003/01/01 18:08:52
6 [channels.c] 6 [channels.c]
7 move big output buffer messages to debug2 7 move big output buffer messages to debug2
8 - djm@cvs.openbsd.org 2003/01/06 23:51:22
9 [sftp-client.c]
10 Fix "get -p" download to not add user-write perm. mindrot bug #426
11 reported by gfernandez@livevault.com; ok markus@
8 12
920030107 1320030107
10 - (djm) Bug #401: Work around Linux breakage with IPv6 mapped addresses. 14 - (djm) Bug #401: Work around Linux breakage with IPv6 mapped addresses.
@@ -950,4 +954,4 @@
950 save auth method before monitor_reset_key_state(); bugzilla bug #284; 954 save auth method before monitor_reset_key_state(); bugzilla bug #284;
951 ok provos@ 955 ok provos@
952 956
953$Id: ChangeLog,v 1.2551 2003/01/08 03:04:09 djm Exp $ 957$Id: ChangeLog,v 1.2552 2003/01/08 03:04:53 djm Exp $
diff --git a/sftp-client.c b/sftp-client.c
index df9838648..bff37073c 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -28,7 +28,7 @@
28/* XXX: copy between two remote sites */ 28/* XXX: copy between two remote sites */
29 29
30#include "includes.h" 30#include "includes.h"
31RCSID("$OpenBSD: sftp-client.c,v 1.37 2002/11/21 23:03:51 deraadt Exp $"); 31RCSID("$OpenBSD: sftp-client.c,v 1.38 2003/01/06 23:51:22 djm Exp $");
32 32
33#include "openbsd-compat/sys-queue.h" 33#include "openbsd-compat/sys-queue.h"
34 34
@@ -758,7 +758,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
758 758
759 /* XXX: should we preserve set[ug]id? */ 759 /* XXX: should we preserve set[ug]id? */
760 if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) 760 if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS)
761 mode = S_IWRITE | (a->perm & 0777); 761 mode = a->perm & 0777;
762 else 762 else
763 mode = 0666; 763 mode = 0666;
764 764
@@ -793,7 +793,8 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
793 return(-1); 793 return(-1);
794 } 794 }
795 795
796 local_fd = open(local_path, O_WRONLY | O_CREAT | O_TRUNC, mode); 796 local_fd = open(local_path, O_WRONLY | O_CREAT | O_TRUNC,
797 mode | S_IWRITE);
797 if (local_fd == -1) { 798 if (local_fd == -1) {
798 error("Couldn't open local file \"%s\" for writing: %s", 799 error("Couldn't open local file \"%s\" for writing: %s",
799 local_path, strerror(errno)); 800 local_path, strerror(errno));