vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Jan F 1ddd0e
diff -up openssh-5.8p1/authfile.c.keyperm openssh-5.8p1/authfile.c
Jan F 1ddd0e
--- openssh-5.8p1/authfile.c.keyperm	2010-12-01 02:03:39.000000000 +0100
Jan F 1ddd0e
+++ openssh-5.8p1/authfile.c	2011-04-21 16:43:36.859648916 +0200
Jan F 1ddd0e
@@ -57,6 +57,7 @@
Jan F 1ddd0e
 #include <stdlib.h>
Jan F 1ddd0e
 #include <string.h>
Jan F 1ddd0e
 #include <unistd.h>
Jan F 1ddd0e
+#include <grp.h>
Jan F 1ddd0e
 
Jan F 1ddd0e
 #include "xmalloc.h"
Jan F 1ddd0e
 #include "cipher.h"
Jan F 1ddd0e
@@ -600,6 +612,13 @@ key_perm_ok(int fd, const char *filename
Jan F 1ddd0e
 #ifdef HAVE_CYGWIN
Jan F 1ddd0e
 	if (check_ntsec(filename))
Jan F 1ddd0e
 #endif
Jan F 1ddd0e
+	if (st.st_mode & 040) {
Jan F 1ddd0e
+		struct group *gr;
Jan F 1ddd0e
+
Jan F 1ddd0e
+		if ((gr = getgrnam("ssh_keys")) && (st.st_gid == gr->gr_gid))
Jan F a8dc50
+			st.st-mode &= ~040;
Jan F 1ddd0e
+	}
Jan F 1ddd0e
+
Jan F 1ddd0e
 	if ((st.st_uid == getuid()) && (st.st_mode & 077) != 0) {
Jan F 1ddd0e
 		error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
Jan F 1ddd0e
 		error("@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @");