From 5444cc4e7ed8ea0c063110f3b78f360d91b0b0a5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 23 Jan 2018 23:10:42 +0100 Subject: [PATCH] winbindd: complete WBFLAG_PAM_AUTH_PAC handling in winbindd_pam_auth_crap_send() winbindd_pam_auth_crap_recv() should not have any real logic. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13262 Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- source3/winbindd/winbindd_pam_auth_crap.c | 64 ++++++++++++++++--------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/source3/winbindd/winbindd_pam_auth_crap.c b/source3/winbindd/winbindd_pam_auth_crap.c index fe0ce4ade62..afcce03172e 100644 --- a/source3/winbindd/winbindd_pam_auth_crap.c +++ b/source3/winbindd/winbindd_pam_auth_crap.c @@ -24,7 +24,6 @@ struct winbindd_pam_auth_crap_state { struct winbindd_response *response; - struct netr_SamInfo3 *info3; uint32_t flags; }; @@ -50,16 +49,44 @@ struct tevent_req *winbindd_pam_auth_crap_send( state->flags = request->flags; if (state->flags & WBFLAG_PAM_AUTH_PAC) { + struct netr_SamInfo3 *info3 = NULL; + uint16_t validation_level; + union netr_Validation *validation = NULL; NTSTATUS status; - status = winbindd_pam_auth_pac_send(cli, &state->info3); - if (NT_STATUS_IS_OK(status)) { - /* Defer filling out response to recv */ - tevent_req_done(req); - } else { - tevent_req_nterror(req, status); + status = winbindd_pam_auth_pac_send(cli, &info3); + if (tevent_req_nterror(req, status)) { + return tevent_req_post(req, ev); + } + + state->response = talloc_zero(state, + struct winbindd_response); + if (tevent_req_nomem(state->response, req)) { + return tevent_req_post(req, ev); } + state->response->result = WINBINDD_PENDING; + state->response->length = sizeof(struct winbindd_response); + status = map_info3_to_validation(talloc_tos(), + info3, + &validation_level, + &validation); + if (tevent_req_nterror(req, status)) { + return tevent_req_post(req, ev); + } + + status = append_auth_data(state->response, + state->response, + state->flags, + validation_level, + validation, + NULL, NULL); + TALLOC_FREE(validation); + if (tevent_req_nterror(req, status)) { + return tevent_req_post(req, ev); + } + + tevent_req_done(req); return tevent_req_post(req, ev); } @@ -151,29 +178,6 @@ NTSTATUS winbindd_pam_auth_crap_recv(struct tevent_req *req, return status; } - if (state->flags & WBFLAG_PAM_AUTH_PAC) { - uint16_t validation_level; - union netr_Validation *validation = NULL; - - status = map_info3_to_validation(talloc_tos(), - state->info3, - &validation_level, - &validation); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - - status = append_auth_data(response, - response, - state->flags, - validation_level, - validation, - NULL, NULL); - TALLOC_FREE(validation); - return status; - - } - *response = *state->response; response->result = WINBINDD_PENDING; state->response = talloc_move(response, &state->response); -- 2.11.4.GIT