vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Jakub Jelen ea9421
Jakub Jelen ea9421
--- openssh-6.6p1/pam_ssh_agent_auth-0.9.3/pam_user_authorized_keys.c.psaa-command	2016-04-20 09:31:32.164686370 +0200
Jakub Jelen ea9421
+++ openssh-6.6p1/pam_ssh_agent_auth-0.9.3/pam_user_authorized_keys.c	2016-04-20 09:35:49.778344576 +0200
Jakub Jelen ea9421
@@ -145,11 +145,14 @@
Jakub Jelen ea9421
 int
Jakub Jelen ea9421
 pam_user_key_allowed(const char *ruser, Key * key)
Jakub Jelen ea9421
 {
Jakub Jelen ea9421
-    return
Jakub Jelen ea9421
-        pamsshagentauth_user_key_allowed2(getpwuid(authorized_keys_file_allowed_owner_uid),
Jakub Jelen ea9421
-                                          key, authorized_keys_file)
Jakub Jelen ea9421
-        || pamsshagentauth_user_key_allowed2(getpwuid(0), key,
Jakub Jelen ea9421
-                                             authorized_keys_file)
Jakub Jelen ea9421
+    struct passwd *file_pw, *root_pw;
Jakub Jelen ea9421
+    file_pw = getpwuid(authorized_keys_file_allowed_owner_uid);
Jakub Jelen ea9421
+    root_pw = getpwuid(0);
Jakub Jelen ea9421
+    return
Jakub Jelen ea9421
+        (file_pw != NULL &&
Jakub Jelen ea9421
+            pamsshagentauth_user_key_allowed2(file_pw, key, authorized_keys_file))
Jakub Jelen ea9421
+        || (root_pw != NULL &&
Jakub Jelen ea9421
+            pamsshagentauth_user_key_allowed2(root_pw, key, authorized_keys_file))
Jakub Jelen ea9421
         || pamsshagentauth_user_key_command_allowed2(authorized_keys_command,
Jakub Jelen ea9421
                                                      authorized_keys_command_user,
Jakub Jelen ea9421
                                                      getpwnam(ruser), key);