rcolebaugh / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone

Blame SOURCES/pam_ssh_agent_auth-0.10.2-dereference.patch

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