Line data Source code
1 : /*
2 : Unix SMB/CIFS implementation.
3 : oplock processing
4 : Copyright (C) Andrew Tridgell 1992-1998
5 : Copyright (C) Jeremy Allison 1998 - 2001
6 : Copyright (C) Volker Lendecke 2005
7 :
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.
12 :
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.
17 :
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/>.
20 : */
21 :
22 : #include "includes.h"
23 : #include "lib/util/server_id.h"
24 : #include "locking/share_mode_lock.h"
25 : #include "smbd/smbd.h"
26 : #include "smbd/globals.h"
27 : #include "messages.h"
28 : #include "locking/leases_db.h"
29 : #include "../librpc/gen_ndr/ndr_open_files.h"
30 :
31 : /****************************************************************************
32 : Set up an oplock break message.
33 : ****************************************************************************/
34 :
35 0 : void new_break_message_smb1(files_struct *fsp, int cmd,
36 : char result[SMB1_BREAK_MESSAGE_LENGTH])
37 : {
38 0 : memset(result,'\0',smb_size);
39 0 : srv_smb1_set_message(result,8,0,true);
40 0 : SCVAL(result,smb_com,SMBlockingX);
41 0 : SSVAL(result,smb_tid,fsp->conn->cnum);
42 0 : SSVAL(result,smb_pid,0xFFFF);
43 0 : SSVAL(result,smb_uid,0);
44 0 : SSVAL(result,smb_mid,0xFFFF);
45 0 : SCVAL(result,smb_vwv0,0xFF);
46 0 : SSVAL(result,smb_vwv2,fsp->fnum);
47 0 : SCVAL(result,smb_vwv3,LOCKING_ANDX_OPLOCK_RELEASE);
48 0 : SCVAL(result,smb_vwv3+1,cmd);
49 0 : }
50 :
51 0 : void send_break_message_smb1(files_struct *fsp, int level)
52 : {
53 0 : struct smbXsrv_connection *xconn = NULL;
54 : char break_msg[SMB1_BREAK_MESSAGE_LENGTH];
55 :
56 : /*
57 : * For SMB1 we only have one connection
58 : */
59 0 : xconn = fsp->conn->sconn->client->connections;
60 :
61 0 : new_break_message_smb1(fsp, level, break_msg);
62 :
63 0 : show_msg(break_msg);
64 0 : if (!smb1_srv_send(xconn,
65 : break_msg, false, 0,
66 0 : IS_CONN_ENCRYPTED(fsp->conn),
67 : NULL)) {
68 0 : exit_server_cleanly("send_break_message_smb1: "
69 : "smb1_srv_send failed.");
70 : }
71 0 : }
|