Blame pam_ssh_agent_auth-0.10.2-dereference.patch

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