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-03-19 16:40:05 +0000
commit0879622ccc5a92902c6ffd88391824cfb2d27924 (patch)
tree890714d8d78e9a1776e72d12b0f7c59988e0e57f /readconf.c
parentf4858fd1a10d1621e5e3ad5f2400dd17d156ced7 (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 e79e355dc..273552d7c 100644
--- a/readconf.c
+++ b/readconf.c
@@ -36,6 +36,8 @@
36#include <stdio.h> 36#include <stdio.h>
37#include <string.h> 37#include <string.h>
38#include <unistd.h> 38#include <unistd.h>
39#include <pwd.h>
40#include <grp.h>
39#ifdef HAVE_UTIL_H 41#ifdef HAVE_UTIL_H
40#include <util.h> 42#include <util.h>
41#endif 43#endif
@@ -1475,8 +1477,7 @@ read_config_file(const char *filename, struct passwd *pw, const char *host,
1475 1477
1476 if (fstat(fileno(f), &sb) == -1) 1478 if (fstat(fileno(f), &sb) == -1)
1477 fatal("fstat %s: %s", filename, strerror(errno)); 1479 fatal("fstat %s: %s", filename, strerror(errno));
1478 if (((sb.st_uid != 0 && sb.st_uid != getuid()) || 1480 if (!secure_permissions(&sb, getuid()))
1479 (sb.st_mode & 022) != 0))
1480 fatal("Bad owner or permissions on %s", filename); 1481 fatal("Bad owner or permissions on %s", filename);
1481 } 1482 }
1482 1483