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 126 : void new_break_message_smb1(files_struct *fsp, int cmd, 36 : char result[SMB1_BREAK_MESSAGE_LENGTH]) 37 : { 38 126 : memset(result,'\0',smb_size); 39 126 : srv_smb1_set_message(result,8,0,true); 40 126 : SCVAL(result,smb_com,SMBlockingX); 41 126 : SSVAL(result,smb_tid,fsp->conn->cnum); 42 126 : SSVAL(result,smb_pid,0xFFFF); 43 126 : SSVAL(result,smb_uid,0); 44 126 : SSVAL(result,smb_mid,0xFFFF); 45 126 : SCVAL(result,smb_vwv0,0xFF); 46 126 : SSVAL(result,smb_vwv2,fsp->fnum); 47 126 : SCVAL(result,smb_vwv3,LOCKING_ANDX_OPLOCK_RELEASE); 48 126 : SCVAL(result,smb_vwv3+1,cmd); 49 126 : } 50 : 51 126 : void send_break_message_smb1(files_struct *fsp, int level) 52 : { 53 126 : struct smbXsrv_connection *xconn = NULL; 54 0 : char break_msg[SMB1_BREAK_MESSAGE_LENGTH]; 55 : 56 : /* 57 : * For SMB1 we only have one connection 58 : */ 59 126 : xconn = fsp->conn->sconn->client->connections; 60 : 61 126 : new_break_message_smb1(fsp, level, break_msg); 62 : 63 126 : show_msg(break_msg); 64 126 : if (!smb1_srv_send(xconn, 65 : break_msg, 66 : false, 67 : 0, 68 126 : IS_CONN_ENCRYPTED(fsp->conn))) { 69 0 : exit_server_cleanly("send_break_message_smb1: " 70 : "smb1_srv_send failed."); 71 : } 72 126 : }