kentpeacock / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone
943807
diff --git a/pam_ssh_agent_auth-0.10.2/pam_user_authorized_keys.c b/pam_ssh_agent_auth-0.10.2/pam_user_authorized_keys.c
943807
--- a/pam_ssh_agent_auth-0.10.2/pam_user_authorized_keys.c
943807
+++ b/pam_ssh_agent_auth-0.10.2/pam_user_authorized_keys.c
943807
@@ -158,11 +158,12 @@ parse_authorized_key_file(const char *user,
943807
 int
943807
 pam_user_key_allowed(const char *ruser, struct sshkey * key)
943807
 {
943807
+    struct passwd *pw;
943807
     return
943807
-        pamsshagentauth_user_key_allowed2(getpwuid(authorized_keys_file_allowed_owner_uid),
943807
-                                          key, authorized_keys_file)
943807
-        || pamsshagentauth_user_key_allowed2(getpwuid(0), key,
943807
-                                             authorized_keys_file)
943807
+        ( (pw = getpwuid(authorized_keys_file_allowed_owner_uid)) &&
943807
+            pamsshagentauth_user_key_allowed2(pw, key, authorized_keys_file))
943807
+        || ((pw = getpwuid(0)) &&
943807
+            pamsshagentauth_user_key_allowed2(pw, key, authorized_keys_file))
943807
         || pamsshagentauth_user_key_command_allowed2(authorized_keys_command,
943807
                                                      authorized_keys_command_user,
943807
                                                      getpwnam(ruser), key);