Update PAM password change to new opts API.

This commit is contained in:
Darren Tucker 2018-03-03 16:21:20 +11:00
parent 33561e68e0
commit 13ef4cf53f
1 changed files with 15 additions and 6 deletions

View File

@ -287,18 +287,27 @@ sshpam_chauthtok_ruid(pam_handle_t *pamh, int flags)
void void
sshpam_password_change_required(int reqd) sshpam_password_change_required(int reqd)
{ {
extern struct sshauthopt *auth_opts;
static int saved_port, saved_agent, saved_x11;
debug3("%s %d", __func__, reqd); debug3("%s %d", __func__, reqd);
if (sshpam_authctxt == NULL) if (sshpam_authctxt == NULL)
fatal("%s: PAM authctxt not initialized", __func__); fatal("%s: PAM authctxt not initialized", __func__);
sshpam_authctxt->force_pwchange = reqd; sshpam_authctxt->force_pwchange = reqd;
if (reqd) { if (reqd) {
no_port_forwarding_flag |= 2; saved_port = auth_opts->permit_port_forwarding_flag;
no_agent_forwarding_flag |= 2; saved_agent = auth_opts->permit_agent_forwarding_flag;
no_x11_forwarding_flag |= 2; saved_x11 = auth_opts->permit_x11_forwarding_flag;
auth_opts->permit_port_forwarding_flag = 0;
auth_opts->permit_agent_forwarding_flag = 0;
auth_opts->permit_x11_forwarding_flag = 0;
} else { } else {
no_port_forwarding_flag &= ~2; if (saved_port)
no_agent_forwarding_flag &= ~2; auth_opts->permit_port_forwarding_flag = saved_port;
no_x11_forwarding_flag &= ~2; if (saved_agent)
auth_opts->permit_agent_forwarding_flag = saved_agent;
if (saved_x11)
auth_opts->permit_x11_forwarding_flag = saved_x11;
} }
} }