2 Unix SMB/CIFS implementation.
4 SMB2 client notify calls
6 Copyright (C) Stefan Metzmacher 2006
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "libcli/raw/libcliraw.h"
24 #include "libcli/smb2/smb2.h"
25 #include "libcli/smb2/smb2_calls.h"
30 NTSTATUS
smb2_cancel(struct smb2_request
*r
)
33 struct smb2_request
*c
;
38 * if we don't get a pending id yet, we just
39 * mark the request for pending, so that we directly
40 * send the cancel after getting the pending id
42 if (!r
->cancel
.can_cancel
) {
43 r
->cancel
.do_cancel
++;
47 /* we don't want a seqmun for a SMB2 Cancel */
48 old_seqnum
= r
->transport
->seqnum
;
49 c
= smb2_request_init(r
->transport
, SMB2_OP_CANCEL
, 0x04, false, 0);
50 r
->transport
->seqnum
= old_seqnum
;
51 NT_STATUS_HAVE_NO_MEMORY(c
);
54 SIVAL(c
->out
.hdr
, SMB2_HDR_FLAGS
, 0x00000002);
55 SSVAL(c
->out
.hdr
, SMB2_HDR_CREDIT
, 0x0030);
56 SIVAL(c
->out
.hdr
, SMB2_HDR_PID
, r
->cancel
.pending_id
);
57 SBVAL(c
->out
.hdr
, SMB2_HDR_MESSAGE_ID
, c
->seqnum
);
59 SBVAL(c
->out
.hdr
, SMB2_HDR_SESSION_ID
, r
->session
->uid
);
62 SSVAL(c
->out
.body
, 0x02, 0);
64 old_timeout
= c
->transport
->options
.request_timeout
;
65 c
->transport
->options
.request_timeout
= 0;
66 smb2_transport_send(c
);
67 c
->transport
->options
.request_timeout
= old_timeout
;
69 if (c
->state
== SMB2_REQUEST_ERROR
) {
72 status
= NT_STATUS_OK
;