summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2018-06-01 04:31:49 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2018-06-01 04:31:49 +0000
commiteacf3be342f31bffd2d6c1886f73afb2803a2d2c (patch)
treee4d227ad1fb8fa9aed8253703950cf6b98e2b573
parent9d63904e70a02faa75dc588392ecb9f8bbf5d90f (diff)
Apply umask to all incoming files and directories not just files.
This makes sure it gets applied to directories too, and prevents a race where files get chmodded after creation. bz#2839, ok djm@
-rw-r--r--usr.bin/ssh/scp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/ssh/scp.c b/usr.bin/ssh/scp.c
index e3af4bbf942..68aed643abf 100644
--- a/usr.bin/ssh/scp.c
+++ b/usr.bin/ssh/scp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.196 2018/04/10 00:10:49 djm Exp $ */
+/* $OpenBSD: scp.c,v 1.197 2018/06/01 04:31:48 dtucker Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
@@ -1069,6 +1069,8 @@ sink(int argc, char **argv)
SCREWUP("bad mode");
mode = (mode << 3) | (*cp - '0');
}
+ if (!pflag)
+ mode &= ~mask;
if (*cp++ != ' ')
SCREWUP("mode not delimited");