Blame openssh-6.6p1-keyperm.patch
|
Petr Lautrbach |
94c6f8 |
diff -up openssh-6.6p1/authfile.c.keyperm openssh-6.6p1/authfile.c
|
|
Petr Lautrbach |
94c6f8 |
--- openssh-6.6p1/authfile.c.keyperm 2014-02-04 01:20:15.000000000 +0100
|
|
Petr Lautrbach |
94c6f8 |
+++ openssh-6.6p1/authfile.c 2014-05-05 15:20:43.075246776 +0200
|
|
Petr Lautrbach |
94c6f8 |
@@ -54,6 +54,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 <stdarg.h>
|
|
Petr Lautrbach |
94c6f8 |
#include <stdio.h>
|
|
Petr Lautrbach |
94c6f8 |
#include <stdlib.h>
|
|
Petr Lautrbach |
94c6f8 |
@@ -979,6 +980,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 |
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! @");
|