[openssh-commits] [openssh] 04/12: upstream: when downloading files as root in legacy (-O) mode and

git+noreply at mindrot.org git+noreply at mindrot.org
Thu Apr 2 20:26:19 AEDT 2026


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch V_10_3
in repository openssh.

commit 487e8ac146f7d6616f65c125d5edb210519b833a
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Thu Apr 2 07:42:16 2026 +0000

    upstream: when downloading files as root in legacy (-O) mode and
    
    without the -p (preserve modes) flag set, clear setuid/setgid bits from
    downloaded files as one might expect.
    
    AFAIK this bug dates back to the original Berkeley rcp program.
    
    Reported by Christos Papakonstantinou of Cantina and Spearbit.
    
    OpenBSD-Commit-ID: 49e902fca8dd933a92a9b547ab31f63e86729fa1
---
 scp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scp.c b/scp.c
index e46daef90..1faa9a555 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.272 2026/02/08 19:54:31 dtucker Exp $ */
+/* $OpenBSD: scp.c,v 1.273 2026/04/02 07:42:16 djm Exp $ */
 /*
  * scp - secure remote copy.  This is basically patched BSD rcp which
  * uses ssh to do the data transfer (instead of using rcmd).
@@ -1678,8 +1678,10 @@ sink(int argc, char **argv, const char *src)
 
 	setimes = targisdir = 0;
 	mask = umask(0);
-	if (!pflag)
+	if (!pflag) {
+		mask |= 07000;
 		(void) umask(mask);
+	}
 	if (argc != 1) {
 		run_err("ambiguous target");
 		exit(1);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list