summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2014-02-09 16:09:58 +0000
committerColin Watson <cjwatson@debian.org>2014-02-09 16:18:08 +0000
commit7016a7e8a6b854833132db253fd5e392984bd4ea (patch)
treee678b1f8ad646f806a81ca506c123ad4e106c543 /readconf.c
parentcfae2bfa1e95cbb6c7a9799f13b82e8e804ca869 (diff)
Allow harmless group-writability
Allow secure files (~/.ssh/config, ~/.ssh/authorized_keys, etc.) to be group-writable, provided that the group in question contains only the file's owner. Rejected upstream for IMO incorrect reasons (e.g. a misunderstanding about the contents of gr->gr_mem). Given that per-user groups and umask 002 are the default setup in Debian (for good reasons - this makes operating in setgid directories with other groups much easier), we need to permit this by default. Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1060 Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=314347 Last-Update: 2013-09-14 Patch-Name: user-group-modes.patch
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/readconf.c b/readconf.c
index 2dcbf3187..389de7d60 100644
--- a/readconf.c
+++ b/readconf.c
@@ -30,6 +30,8 @@
30#include <stdio.h> 30#include <stdio.h>
31#include <string.h> 31#include <string.h>
32#include <unistd.h> 32#include <unistd.h>
33#include <pwd.h>
34#include <grp.h>
33#ifdef HAVE_UTIL_H 35#ifdef HAVE_UTIL_H
34#include <util.h> 36#include <util.h>
35#endif 37#endif
@@ -1160,8 +1162,7 @@ read_config_file(const char *filename, const char *host, Options *options,
1160 1162
1161 if (fstat(fileno(f), &sb) == -1) 1163 if (fstat(fileno(f), &sb) == -1)
1162 fatal("fstat %s: %s", filename, strerror(errno)); 1164 fatal("fstat %s: %s", filename, strerror(errno));
1163 if (((sb.st_uid != 0 && sb.st_uid != getuid()) || 1165 if (!secure_permissions(&sb, getuid()))
1164 (sb.st_mode & 022) != 0))
1165 fatal("Bad owner or permissions on %s", filename); 1166 fatal("Bad owner or permissions on %s", filename);
1166 } 1167 }
1167 1168