vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Petr Lautrbach 190035
diff --git a/authfile.c b/authfile.c
Petr Lautrbach 190035
index e93d867..4fc5b3d 100644
Petr Lautrbach 190035
--- a/authfile.c
Petr Lautrbach 190035
+++ b/authfile.c
Petr Lautrbach 190035
@@ -32,6 +32,7 @@
Jan F 1ddd0e
 
Petr Lautrbach 94c6f8
 #include <errno.h>
Petr Lautrbach 94c6f8
 #include <fcntl.h>
Petr Lautrbach 94c6f8
+#include <grp.h>
Petr Lautrbach 94c6f8
 #include <stdio.h>
Petr Lautrbach 190035
 #include <stdarg.h>
Petr Lautrbach 94c6f8
 #include <stdlib.h>
Petr Lautrbach 190035
@@ -207,6 +208,13 @@ sshkey_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 0ecc97
+			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!          @");