diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2017-04-04 00:24:57 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2017-04-04 00:24:57 +0000 |
commit | 7d8b90c52c996f6711efed3a7ae98a68235eef1c (patch) | |
tree | 54798b09ca9024f540a4bf44c9cc4faf869e9c5e /usr.bin/ssh | |
parent | 905c7a019d973a445ff109521defb71ceb4bb00e (diff) |
disallow creation (of empty files) in read-only mode; reported by
Michal Zalewski, feedback & ok deraadt@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/sftp-server.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/ssh/sftp-server.c b/usr.bin/ssh/sftp-server.c index 2510d234a3a..42249ebd60d 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.110 2016/09/12 01:22:38 deraadt Exp $ */ +/* $OpenBSD: sftp-server.c,v 1.111 2017/04/04 00:24:56 djm Exp $ */ /* * Copyright (c) 2000-2004 Markus Friedl. All rights reserved. * @@ -683,8 +683,8 @@ process_open(u_int32_t id) logit("open \"%s\" flags %s mode 0%o", name, string_from_portable(pflags), mode); if (readonly && - ((flags & O_ACCMODE) == O_WRONLY || - (flags & O_ACCMODE) == O_RDWR)) { + ((flags & O_ACCMODE) != O_RDONLY || + (flags & (O_CREAT|O_TRUNC)) != 0)) { verbose("Refusing open request in read-only mode"); status = SSH2_FX_PERMISSION_DENIED; } else { |