bmh10 / rpms / openssh

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