kentpeacock / rpms / openssh

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