kentpeacock / rpms / openssh

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