Blame SOURCES/pam_ssh_agent_auth-0.10.2-dereference.patch

aedd00
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
aedd00
--- a/pam_ssh_agent_auth-0.10.2/pam_user_authorized_keys.c
aedd00
+++ b/pam_ssh_agent_auth-0.10.2/pam_user_authorized_keys.c
aedd00
@@ -158,11 +158,12 @@ parse_authorized_key_file(const char *user,
aedd00
 int
aedd00
 pam_user_key_allowed(const char *ruser, struct sshkey * key)
aedd00
 {
aedd00
+    struct passwd *pw;
aedd00
     return
aedd00
-        pamsshagentauth_user_key_allowed2(getpwuid(authorized_keys_file_allowed_owner_uid),
aedd00
-                                          key, authorized_keys_file)
aedd00
-        || pamsshagentauth_user_key_allowed2(getpwuid(0), key,
aedd00
-                                             authorized_keys_file)
aedd00
+        ( (pw = getpwuid(authorized_keys_file_allowed_owner_uid)) &&
aedd00
+            pamsshagentauth_user_key_allowed2(pw, key, authorized_keys_file))
aedd00
+        || ((pw = getpwuid(0)) &&
aedd00
+            pamsshagentauth_user_key_allowed2(pw, key, authorized_keys_file))
aedd00
         || pamsshagentauth_user_key_command_allowed2(authorized_keys_command,
aedd00
                                                      authorized_keys_command_user,
aedd00
                                                      getpwnam(ruser), key);