From: Stefan Metzmacher Date: Mon, 15 May 2017 12:02:07 +0000 (+0200) Subject: s4:rpc_server: make use of dcesrv_auth_prepare_bind_ack() in dcesrv_bind() X-Git-Tag: ldb-1.1.30~133 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7274dffa75c63620ee02ad6cc750876ef0885ceb;p=thirdparty%2Fsamba.git s4:rpc_server: make use of dcesrv_auth_prepare_bind_ack() in dcesrv_bind() It means we also need to call gensec_update_ev() and dcesrv_auth_complete() directly in dcesrv_bind(). Doing that will make it easier to make dcesrv_bind() async in the next commits. Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index c2b531fa7ab..2f322ceadb6 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -782,6 +782,7 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) uint16_t max_rep = 0; const char *ep_prefix = ""; const char *endpoint = NULL; + struct dcesrv_auth *auth = &call->conn->auth_state; struct dcerpc_ack_ctx *ack_ctx_list = NULL; struct dcerpc_ack_ctx *ack_features = NULL; size_t i; @@ -964,7 +965,6 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) * is being requested. */ if (!dcesrv_auth_bind(call)) { - struct dcesrv_auth *auth = &call->conn->auth_state; if (auth->auth_level == DCERPC_AUTH_LEVEL_NONE) { /* @@ -1019,7 +1019,21 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) pkt->u.bind_ack.ctx_list = ack_ctx_list; pkt->u.bind_ack.auth_info = data_blob_null; - status = dcesrv_auth_bind_ack(call, pkt); + status = dcesrv_auth_prepare_bind_ack(call, pkt); + if (!NT_STATUS_IS_OK(status)) { + return dcesrv_bind_nak(call, 0); + } + + if (auth->auth_finished) { + return dcesrv_auth_reply(call); + } + + status = gensec_update_ev(auth->gensec_security, + call, call->event_ctx, + call->in_auth_info.credentials, + &call->out_auth_info->credentials); + + status = dcesrv_auth_complete(call, status); if (!NT_STATUS_IS_OK(status)) { return dcesrv_bind_nak(call, 0); }