return NT_STATUS_OK;
}
+struct dcesrv_netr_step_access_state {
+ struct dcesrv_call_state *dce_call;
+ enum dcerpc_AuthType auth_type;
+ enum dcerpc_AuthLevel auth_level;
+ uint16_t opnum;
+ NTSTATUS status;
+};
+
+static NTSTATUS dcesrv_netr_step_access_cb(
+ struct netlogon_creds_CredentialState *creds,
+ NTSTATUS step_status,
+ bool *store,
+ void *access_check_private)
+{
+ struct dcesrv_netr_step_access_state *s =
+ (struct dcesrv_netr_step_access_state *)access_check_private;
+ struct dcesrv_call_state *dce_call =
+ talloc_get_type_abort(s->dce_call,
+ struct dcesrv_call_state);
+
+ if (NT_STATUS_EQUAL(step_status, NT_STATUS_ACCESS_DENIED)) {
+ s->status = step_status;
+ *store = true;
+ return NT_STATUS_OK;
+ }
+
+ if (!NT_STATUS_IS_OK(step_status)) {
+ *store = false;
+ return step_status;
+ }
+
+ s->status = dcesrv_netr_check_schannel(dce_call,
+ creds,
+ s->auth_type,
+ s->auth_level,
+ s->opnum);
+
+ if (!NT_STATUS_IS_OK(s->status)) {
+ *store = false;
+ } else {
+ *store = true;
+ }
+
+ return NT_STATUS_OK;
+}
+
NTSTATUS dcesrv_netr_creds_server_step_check(struct dcesrv_call_state *dce_call,
TALLOC_CTX *mem_ctx,
const char *computer_name,
{
NTSTATUS nt_status;
struct netlogon_creds_CredentialState *creds = NULL;
- enum dcerpc_AuthType auth_type = DCERPC_AUTH_TYPE_NONE;
- enum dcerpc_AuthLevel auth_level = DCERPC_AUTH_LEVEL_NONE;
+ struct dcesrv_netr_step_access_state state = {
+ .dce_call = dce_call,
+ .auth_type = DCERPC_AUTH_TYPE_NONE,
+ .auth_level = DCERPC_AUTH_LEVEL_NONE,
+ .opnum = dce_call->pkt.u.request.opnum,
+ .status = NT_STATUS_INTERNAL_ERROR,
+ };
- dcesrv_call_auth_info(dce_call, &auth_type, &auth_level);
+ dcesrv_call_auth_info(dce_call, &state.auth_type, &state.auth_level);
nt_status = schannel_check_creds_state(mem_ctx,
dce_call->conn->dce_ctx->lp_ctx,
computer_name,
received_authenticator,
return_authenticator,
- auth_type,
- auth_level,
- NULL, /* access_check_cb */
- NULL, /* access_check_private */
+ state.auth_type,
+ state.auth_level,
+ dcesrv_netr_step_access_cb,
+ &state,
&creds);
if (!NT_STATUS_IS_OK(nt_status)) {
ZERO_STRUCTP(return_authenticator);
return nt_status;
}
- nt_status = dcesrv_netr_check_schannel(dce_call,
- creds,
- auth_type,
- auth_level,
- dce_call->pkt.u.request.opnum);
+ nt_status = state.status;
if (!NT_STATUS_IS_OK(nt_status)) {
TALLOC_FREE(creds);
ZERO_STRUCTP(return_authenticator);