rutwa189 / rpms / openssh

Forked from rpms/openssh a year ago
Clone

Blame SOURCES/pam_ssh_agent_auth-0.10.2-dereference.patch

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