pam_ssh_agent_auth: Fix conflict bewteen two getpwuid() calls (#1349551)

This commit is contained in:
Jakub Jelen 2016-06-24 11:41:45 +02:00
parent d8ffa911e3
commit 8cf031f736

View File

@ -1,23 +1,20 @@
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
--- openssh-6.6p1/pam_ssh_agent_auth-0.9.3/pam_user_authorized_keys.c.psaa-command 2016-04-20 09:31:32.164686370 +0200 --- a/pam_ssh_agent_auth-0.10.2/pam_user_authorized_keys.c
+++ openssh-6.6p1/pam_ssh_agent_auth-0.9.3/pam_user_authorized_keys.c 2016-04-20 09:35:49.778344576 +0200 +++ b/pam_ssh_agent_auth-0.10.2/pam_user_authorized_keys.c
@@ -145,11 +145,14 @@ @@ -158,11 +158,12 @@ parse_authorized_key_file(const char *user,
int int
pam_user_key_allowed(const char *ruser, Key * key) pam_user_key_allowed(const char *ruser, Key * key)
{ {
- return + struct passwd *pw;
return
- pamsshagentauth_user_key_allowed2(getpwuid(authorized_keys_file_allowed_owner_uid), - pamsshagentauth_user_key_allowed2(getpwuid(authorized_keys_file_allowed_owner_uid),
- key, authorized_keys_file) - key, authorized_keys_file)
- || pamsshagentauth_user_key_allowed2(getpwuid(0), key, - || pamsshagentauth_user_key_allowed2(getpwuid(0), key,
- authorized_keys_file) - authorized_keys_file)
+ struct passwd *file_pw, *root_pw; + ( (pw = getpwuid(authorized_keys_file_allowed_owner_uid)) &&
+ file_pw = getpwuid(authorized_keys_file_allowed_owner_uid); + pamsshagentauth_user_key_allowed2(pw, key, authorized_keys_file))
+ root_pw = getpwuid(0); + || ((pw = getpwuid(0)) &&
+ return + pamsshagentauth_user_key_allowed2(pw, key, authorized_keys_file))
+ (file_pw != NULL &&
+ pamsshagentauth_user_key_allowed2(file_pw, key, authorized_keys_file))
+ || (root_pw != NULL &&
+ pamsshagentauth_user_key_allowed2(root_pw, key, authorized_keys_file))
|| pamsshagentauth_user_key_command_allowed2(authorized_keys_command, || pamsshagentauth_user_key_command_allowed2(authorized_keys_command,
authorized_keys_command_user, authorized_keys_command_user,
getpwnam(ruser), key); getpwnam(ruser), key);