]>
Commit | Line | Data |
---|---|---|
23db65f5 JL |
1 | /* |
2 | * SMB1 (CIFS) version specific operations | |
3 | * | |
4 | * Copyright (c) 2012, Jeff Layton <jlayton@redhat.com> | |
5 | * | |
6 | * This library is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License v2 as published | |
8 | * by the Free Software Foundation. | |
9 | * | |
10 | * This library is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | |
13 | * the GNU Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public License | |
16 | * along with this library; if not, write to the Free Software | |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | */ | |
19 | ||
20 | #include "cifsglob.h" | |
121b046a JL |
21 | #include "cifsproto.h" |
22 | #include "cifs_debug.h" | |
23 | ||
24 | /* | |
25 | * An NT cancel request header looks just like the original request except: | |
26 | * | |
27 | * The Command is SMB_COM_NT_CANCEL | |
28 | * The WordCount is zeroed out | |
29 | * The ByteCount is zeroed out | |
30 | * | |
31 | * This function mangles an existing request buffer into a | |
32 | * SMB_COM_NT_CANCEL request and then sends it. | |
33 | */ | |
34 | static int | |
35 | send_nt_cancel(struct TCP_Server_Info *server, void *buf, | |
36 | struct mid_q_entry *mid) | |
37 | { | |
38 | int rc = 0; | |
39 | struct smb_hdr *in_buf = (struct smb_hdr *)buf; | |
40 | ||
41 | /* -4 for RFC1001 length and +2 for BCC field */ | |
42 | in_buf->smb_buf_length = cpu_to_be32(sizeof(struct smb_hdr) - 4 + 2); | |
43 | in_buf->Command = SMB_COM_NT_CANCEL; | |
44 | in_buf->WordCount = 0; | |
45 | put_bcc(0, in_buf); | |
46 | ||
47 | mutex_lock(&server->srv_mutex); | |
48 | rc = cifs_sign_smb(in_buf, server, &mid->sequence_number); | |
49 | if (rc) { | |
50 | mutex_unlock(&server->srv_mutex); | |
51 | return rc; | |
52 | } | |
53 | rc = smb_send(server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); | |
54 | mutex_unlock(&server->srv_mutex); | |
55 | ||
56 | cFYI(1, "issued NT_CANCEL for mid %u, rc = %d", | |
57 | in_buf->Mid, rc); | |
58 | ||
59 | return rc; | |
60 | } | |
23db65f5 JL |
61 | |
62 | struct smb_version_operations smb1_operations = { | |
121b046a | 63 | .send_cancel = send_nt_cancel, |
23db65f5 JL |
64 | }; |
65 | ||
66 | struct smb_version_values smb1_values = { | |
67 | .version_string = SMB1_VERSION_STRING, | |
68 | }; |