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-10-07 14:27:20 +0100
commit28ea747089f695e58a476a2849133402d4f86b92 (patch)
treefe010fa255dcd25e221fe76ef552aad3eb5da760 /readconf.c
parentf51fe0c55e54c12db952624e980d18f39c41e581 (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 337818c63..0648867e8 100644
--- a/readconf.c
+++ b/readconf.c
@@ -38,6 +38,8 @@
38#include <stdio.h> 38#include <stdio.h>
39#include <string.h> 39#include <string.h>
40#include <unistd.h> 40#include <unistd.h>
41#include <pwd.h>
42#include <grp.h>
41#ifdef HAVE_UTIL_H 43#ifdef HAVE_UTIL_H
42#include <util.h> 44#include <util.h>
43#endif 45#endif
@@ -1516,8 +1518,7 @@ read_config_file(const char *filename, struct passwd *pw, const char *host,
1516 1518
1517 if (fstat(fileno(f), &sb) == -1) 1519 if (fstat(fileno(f), &sb) == -1)
1518 fatal("fstat %s: %s", filename, strerror(errno)); 1520 fatal("fstat %s: %s", filename, strerror(errno));
1519 if (((sb.st_uid != 0 && sb.st_uid != getuid()) || 1521 if (!secure_permissions(&sb, getuid()))
1520 (sb.st_mode & 022) != 0))
1521 fatal("Bad owner or permissions on %s", filename); 1522 fatal("Bad owner or permissions on %s", filename);
1522 } 1523 }
1523 1524