.in_create_disposition = in_create_disposition,
};
+ state->im = tevent_create_immediate(state);
+ if (tevent_req_nomem(state->im, req)) {
+ return tevent_req_post(req, state->ev);
+ }
+
smb1req = smbd_smb2_fake_smb_request(smb2req);
if (tevent_req_nomem(smb1req, req)) {
return tevent_req_post(req, state->ev);
state->open_was_deferred = false;
/* Ensure we don't have any outstanding immediate event. */
- TALLOC_FREE(state->im);
+ tevent_schedule_immediate(state->im, state->ev, NULL, NULL);
TALLOC_FREE(state->open_rec);
}
struct tevent_immediate *im,
void *private_data)
{
- struct smbd_smb2_request *smb2req = talloc_get_type_abort(private_data,
- struct smbd_smb2_request);
+ struct tevent_req *req =
+ talloc_get_type_abort(private_data,
+ struct tevent_req);
+ struct smbd_smb2_create_state *state =
+ tevent_req_data(req,
+ struct smbd_smb2_create_state);
+ struct smbd_smb2_request *smb2req = state->smb2req;
uint64_t mid = get_mid_from_smb2req(smb2req);
NTSTATUS status;
- DEBUG(10,("smbd_smb2_create_request_dispatch_immediate: "
- "re-dispatching mid %llu\n",
- (unsigned long long)mid ));
+ SMB_ASSERT(smb2req->subreq == req);
+
+ /*
+ * This is subtle. We must null out the callback
+ * before re-dispatching, else the first call to
+ * tevent_req_nterror() causes the _receive()
+ * function to be called, this causing tevent_req_post()
+ * to crash.
+ */
+ tevent_req_set_callback(req, NULL, NULL);
+ req = NULL;
+ state = NULL;
+
+ DBG_DEBUG("re-dispatching mid %llu on channel_id %llu\n",
+ (unsigned long long)mid,
+ (unsigned long long)smb2req->xconn->channel_id);
status = smbd_smb2_request_dispatch(smb2req);
if (!NT_STATUS_IS_OK(status)) {
return false;
}
- /* Ensure we don't have any outstanding immediate event. */
- TALLOC_FREE(state->im);
-
- /*
- * This is subtle. We must null out the callback
- * before rescheduling, else the first call to
- * tevent_req_nterror() causes the _receive()
- * function to be called, this causing tevent_req_post()
- * to crash.
- */
- tevent_req_set_callback(smb2req->subreq, NULL, NULL);
-
- state->im = tevent_create_immediate(smb2req);
- if (!state->im) {
- smbd_server_connection_terminate(smb2req->xconn,
- nt_errstr(NT_STATUS_NO_MEMORY));
- return false;
- }
-
- DEBUG(10,("schedule_deferred_open_message_smb2: "
- "re-processing mid %llu\n",
- (unsigned long long)mid ));
+ DBG_DEBUG("re-dispatching mid %llu on channel_id %llu\n",
+ (unsigned long long)mid,
+ (unsigned long long)smb2req->xconn->channel_id);
tevent_schedule_immediate(state->im,
- smb2req->sconn->ev_ctx,
- smbd_smb2_create_request_dispatch_immediate,
- smb2req);
+ state->ev,
+ smbd_smb2_create_request_dispatch_immediate,
+ smb2req->subreq);
return true;
}