libsmb: Use clistr_smb2_extract_snapshot_token() in cli_smb2_create_fnum_send()
[Samba.git] / source3 / smbd / smb1_oplock.c
blob6425eff67b295124929f5374115726f9f83686ad
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
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/>.
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"
31 /****************************************************************************
32 Set up an oplock break message.
33 ****************************************************************************/
35 void new_break_message_smb1(files_struct *fsp, int cmd,
36 char result[SMB1_BREAK_MESSAGE_LENGTH])
38 memset(result,'\0',smb_size);
39 srv_smb1_set_message(result,8,0,true);
40 SCVAL(result,smb_com,SMBlockingX);
41 SSVAL(result,smb_tid,fsp->conn->cnum);
42 SSVAL(result,smb_pid,0xFFFF);
43 SSVAL(result,smb_uid,0);
44 SSVAL(result,smb_mid,0xFFFF);
45 SCVAL(result,smb_vwv0,0xFF);
46 SSVAL(result,smb_vwv2,fsp->fnum);
47 SCVAL(result,smb_vwv3,LOCKING_ANDX_OPLOCK_RELEASE);
48 SCVAL(result,smb_vwv3+1,cmd);
51 void send_break_message_smb1(files_struct *fsp, int level)
53 struct smbXsrv_connection *xconn = NULL;
54 char break_msg[SMB1_BREAK_MESSAGE_LENGTH];
57 * For SMB1 we only have one connection
59 xconn = fsp->conn->sconn->client->connections;
61 new_break_message_smb1(fsp, level, break_msg);
63 show_msg(break_msg);
64 if (!smb1_srv_send(xconn,
65 break_msg, false, 0,
66 IS_CONN_ENCRYPTED(fsp->conn),
67 NULL)) {
68 exit_server_cleanly("send_break_message_smb1: "
69 "smb1_srv_send failed.");