kentpeacock / rpms / openssh

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