summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2003-01-06 23:51:23 +0000
committerDamien Miller <djm@cvs.openbsd.org>2003-01-06 23:51:23 +0000
commit5524baf6b6a7ca4e2975e0b682eee60b76261eb8 (patch)
tree2143e730f93132e7d9ee8c035308e961ab11aa17 /usr.bin
parentb9a34c5667d63a7c1002cfd7bffb55f36dbdb15d (diff)
Fix "get -p" download to not add user-write perm. mindrot bug #426 reported
by gfernandez@livevault.com; ok markus@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/sftp-client.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/ssh/sftp-client.c b/usr.bin/ssh/sftp-client.c
index bc7fcb4b963..3152577690b 100644
--- a/usr.bin/ssh/sftp-client.c
+++ b/usr.bin/ssh/sftp-client.c
@@ -28,7 +28,7 @@
/* XXX: copy between two remote sites */
#include "includes.h"
-RCSID("$OpenBSD: sftp-client.c,v 1.37 2002/11/21 23:03:51 deraadt Exp $");
+RCSID("$OpenBSD: sftp-client.c,v 1.38 2003/01/06 23:51:22 djm Exp $");
#include <sys/queue.h>
@@ -758,7 +758,7 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
/* XXX: should we preserve set[ug]id? */
if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS)
- mode = S_IWRITE | (a->perm & 0777);
+ mode = a->perm & 0777;
else
mode = 0666;
@@ -793,7 +793,8 @@ do_download(struct sftp_conn *conn, char *remote_path, char *local_path,
return(-1);
}
- local_fd = open(local_path, O_WRONLY | O_CREAT | O_TRUNC, mode);
+ local_fd = open(local_path, O_WRONLY | O_CREAT | O_TRUNC,
+ mode | S_IWRITE);
if (local_fd == -1) {
error("Couldn't open local file \"%s\" for writing: %s",
local_path, strerror(errno));