{
struct tevent_req *req, *subreq;
struct cli_ntcreate_state *state;
+ uint32_t impersonation_level = SMB2_IMPERSONATION_IMPERSONATION;
req = tevent_req_create(mem_ctx, &state, struct cli_ntcreate_state);
if (req == NULL) {
}
subreq = cli_smb2_create_fnum_send(
- state, ev, cli, fname, create_flags, desired_access,
+ state, ev, cli, fname, create_flags,
+ impersonation_level, desired_access,
file_attributes, share_access, create_disposition,
create_options);
} else {
****************************************************************************/
struct cli_notify_state {
+ struct tevent_req *subreq;
uint8_t setup[8];
uint32_t num_changes;
struct notify_change *changes;
static void cli_notify_done(struct tevent_req *subreq);
static void cli_notify_done_smb2(struct tevent_req *subreq);
+static bool cli_notify_cancel(struct tevent_req *req);
struct tevent_req *cli_notify_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
uint32_t buffer_size,
uint32_t completion_filter, bool recursive)
{
- struct tevent_req *req, *subreq;
+ struct tevent_req *req;
struct cli_notify_state *state;
unsigned old_timeout;
}
if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
- subreq = cli_smb2_notify_send(
+ /*
+ * Notifies should not time out
+ */
+ old_timeout = cli_set_timeout(cli, 0);
+
+ state->subreq = cli_smb2_notify_send(
state,
ev,
cli,
buffer_size,
completion_filter,
recursive);
- if (tevent_req_nomem(subreq, req)) {
+
+ cli_set_timeout(cli, old_timeout);
+
+ if (tevent_req_nomem(state->subreq, req)) {
return tevent_req_post(req, ev);
}
- tevent_req_set_callback(subreq, cli_notify_done_smb2, req);
- return req;
+ tevent_req_set_callback(
+ state->subreq, cli_notify_done_smb2, req);
+ goto done;
}
SIVAL(state->setup, 0, completion_filter);
*/
old_timeout = cli_set_timeout(cli, 0);
- subreq = cli_trans_send(
+ state->subreq = cli_trans_send(
state, /* mem ctx. */
ev, /* event ctx. */
cli, /* cli_state. */
cli_set_timeout(cli, old_timeout);
- if (tevent_req_nomem(subreq, req)) {
+ if (tevent_req_nomem(state->subreq, req)) {
return tevent_req_post(req, ev);
}
- tevent_req_set_callback(subreq, cli_notify_done, req);
+ tevent_req_set_callback(state->subreq, cli_notify_done, req);
+done:
+ tevent_req_set_cancel_fn(req, cli_notify_cancel);
return req;
}
+static bool cli_notify_cancel(struct tevent_req *req)
+{
+ struct cli_notify_state *state = tevent_req_data(
+ req, struct cli_notify_state);
+ bool ok;
+
+ ok = tevent_req_cancel(state->subreq);
+ return ok;
+}
+
static void cli_notify_done(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(
status = cli_trans_recv(subreq, talloc_tos(), &flags2, NULL, 0, NULL,
¶ms, 0, &num_params, NULL, 0, NULL);
TALLOC_FREE(subreq);
+ state->subreq = NULL;
if (tevent_req_nterror(req, status)) {
DEBUG(10, ("cli_trans_recv returned %s\n", nt_errstr(status)));
return;