da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER START
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The contents of this file are subject to the terms of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Common Development and Distribution License (the "License").
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You may not use this file except in compliance with the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * or http://www.opensolaris.org/os/licensing.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * See the License for the specific language governing permissions
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and limitations under the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * When distributing Covered Code, include this CDDL HEADER in each
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If applicable, add the following below this CDDL HEADER, with the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * fields enclosed by brackets "[]" replaced with your own identifying
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * information: Portions Copyright [yyyy] [name of copyright owner]
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER END
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
9c787c76803e57736d13413909945366ce3a9448Gordon Ross * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SMB: locking_andx
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SMB_COM_LOCKING_ANDX allows both locking and/or unlocking of file range(s).
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Client Request Description
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ================================== =================================
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * UCHAR WordCount; Count of parameter words = 8
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * UCHAR AndXCommand; Secondary (X) command; 0xFF = none
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * UCHAR AndXReserved; Reserved (must be 0)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * USHORT AndXOffset; Offset to next command WordCount
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * USHORT Fid; File handle
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * UCHAR LockType; See LockType table below
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * UCHAR OplockLevel; The new oplock level
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ULONG Timeout; Milliseconds to wait for unlock
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * USHORT NumberOfUnlocks; Num. unlock range structs following
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * USHORT NumberOfLocks; Num. lock range structs following
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * USHORT ByteCount; Count of data bytes
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * LOCKING_ANDX_RANGE Unlocks[]; Unlock ranges
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * LOCKING_ANDX_RANGE Locks[]; Lock ranges
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * LockType Flag Name Value Description
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ============================ ===== ================================
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * LOCKING_ANDX_SHARED_LOCK 0x01 Read-only lock
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * LOCKING_ANDX_OPLOCK_RELEASE 0x02 Oplock break notification
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * LOCKING_ANDX_CHANGE_LOCKTYPE 0x04 Change lock type
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * LOCKING_ANDX_CANCEL_LOCK 0x08 Cancel outstanding request
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * LOCKING_ANDX_LARGE_FILES 0x10 Large file locking format
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * LOCKING_ANDX_RANGE Format
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * =====================================================================
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * USHORT Pid; PID of process "owning" lock
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ULONG Offset; Offset to bytes to [un]lock
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ULONG Length; Number of bytes to [un]lock
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Large File LOCKING_ANDX_RANGE Format
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * =====================================================================
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * USHORT Pid; PID of process "owning" lock
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * USHORT Pad; Pad to DWORD align (mbz)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ULONG OffsetHigh; Offset to bytes to [un]lock
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * (high)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ULONG OffsetLow; Offset to bytes to [un]lock (low)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ULONG LengthHigh; Number of bytes to [un]lock
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * (high)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ULONG LengthLow; Number of bytes to [un]lock (low)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Server Response Description
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ================================== =================================
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * UCHAR WordCount; Count of parameter words = 2
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * UCHAR AndXCommand; Secondary (X) command; 0xFF =
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * none
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * UCHAR AndXReserved; Reserved (must be 0)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * USHORT AndXOffset; Offset to next command WordCount
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * USHORT ByteCount; Count of data bytes = 0
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Locking is a simple mechanism for excluding other processes read/write
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * access to regions of a file. The locked regions can be anywhere in the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * logical file. Locking beyond end-of-file is permitted. Any process
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * using the Fid specified in this request's Fid has access to the locked
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * bytes, other processes will be denied the locking of the same bytes.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The proper method for using locks is not to rely on being denied read or
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * write access on any of the read/write protocols but rather to attempt
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the locking protocol and proceed with the read/write only if the locks
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * succeeded.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Locking a range of bytes will fail if any subranges or overlapping
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ranges are locked. In other words, if any of the specified bytes are
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * already locked, the lock will fail.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If NumberOfUnlocks is non-zero, the Unlocks vector contains
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * NumberOfUnlocks elements. Each element requests that a lock at Offset
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * of Length be released. If NumberOfLocks is nonzero, the Locks vector
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * contains NumberOfLocks elements. Each element requests the acquisition
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * of a lock at Offset of Length.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Timeout is the maximum amount of time to wait for the byte range(s)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * specified to become unlocked. A timeout value of 0 indicates that the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * server should fail immediately if any lock range specified is locked. A
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * timeout value of -1 indicates that the server should wait as long as it
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * takes for each byte range specified to become unlocked so that it may be
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * again locked by this protocol. Any other value of smb_timeout specifies
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the maximum number of milliseconds to wait for all lock range(s)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * specified to become available.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If any of the lock ranges timeout because of the area to be locked is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * already locked (or the lock fails), the other ranges in the protocol
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * request which were successfully locked as a result of this protocol will
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * be unlocked (either all requested ranges will be locked when this
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * protocol returns to the client or none).
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If LockType has the LOCKING_ANDX_SHARED_LOCK flag set, the lock is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * specified as a shared lock. Locks for both read and write (where
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * LOCKING_ANDX_SHARED_LOCK is clear) should be prohibited, but other
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * shared locks should be permitted. If shared locks can not be supported
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * by a server, the server should map the lock to a lock for both read and
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * write. Closing a file with locks still in force causes the locks to be
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * released in no defined order.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If LockType has the LOCKING_ANDX_LARGE_FILES flag set and if the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * negotiated protocol is NT LM 0.12 or later, then the Locks and Unlocks
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * vectors are in the Large File LOCKING_ANDX_RANGE format. This allows
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * specification of 64 bit offsets for very large files.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If the one and only member of the Locks vector has the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * LOCKING_ANDX_CANCEL_LOCK flag set in the LockType field, the client is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * requesting the server to cancel a previously requested, but not yet
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * responded to, lock.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If LockType has the LOCKING_ANDX_CHANGE_LOCKTYPE flag set, the client is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * requesting that the server atomically change the lock type from a shared
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * lock to an exclusive lock or vice versa. If the server can not do this
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * in an atomic fashion, the server must reject this request. NT and W95
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * servers do not support this capability.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Oplocks are described in the "Opportunistic Locks" section elsewhere in
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * this document. A client requests an oplock by setting the appropriate
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * bit in the SMB_COM_OPEN_ANDX request when the file is being opened in a
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * mode which is not exclusive. The server responds by setting the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * appropriate bit in the response SMB indicating whether or not the oplock
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * was granted. By granting the oplock, the server tells the client the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * file is currently only being used by this one client process at the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * current time. The client can therefore safely do read ahead and write
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * behind as well as local caching of file locks knowing that the file will
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * not be accessed/changed in any way by another process while the oplock
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is in effect. The client will be notified when any other process
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * attempts to open or modify the oplocked file.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * When another user attempts to open or otherwise modify the file which a
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * client has oplocked, the server delays the second attempt and notifies
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the client via an SMB_LOCKING_ANDX SMB asynchronously sent from the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * server to the client. This message has the LOCKING_ANDX_OPLOCK_RELEASE
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * flag set indicating to the client that the oplock is being broken.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * OplockLevel indicates the type of oplock the client now owns. If
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * OplockLevel is 0, the client possesses no oplocks on the file at all, if
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * OplockLevel is 1 the client possesses a Level II oplock. The client is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * expected to flush any dirty buffers to the server, submit any file locks
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and respond to the server with either an SMB_LOCKING_ANDX SMB having the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * LOCKING_ANDX_OPLOCK_RELEASE flag set, or with a file close if the file
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is no longer in use by the client. If the client sends an
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SMB_LOCKING_ANDX SMB with the LOCKING_ANDX_OPLOCK_RELEASE flag set and
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * NumberOfLocks is zero, the server does not send a response. Since a
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * close being sent to the server and break oplock notification from the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * server could cross on the wire, if the client gets an oplock
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * notification on a file which it does not have open, that notification
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * should be ignored.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Due to timing, the client could get an "oplock broken" notification in a
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * user's data buffer as a result of this notification crossing on the wire
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * with a SMB_COM_READ_RAW request. The client must detect this (use
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * length of msg, "FFSMB", MID of -1 and Command of SMB_COM_LOCKING_ANDX)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and honor the "oplock broken" notification as usual. The server must
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * also note on receipt of an SMB_COM_READ_RAW request that there is an
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * outstanding (unanswered) "oplock broken" notification to the client and
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * return a zero length response denoting failure of the read raw request.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The client should (after responding to the "oplock broken"
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * notification), use a standard read protocol to redo the read request.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * This allows a file to actually contain data matching an "oplock broken"
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * notification and still be read correctly.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The entire message sent and received including the optional second
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * protocol must fit in the negotiated maximum transfer size. The
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * following are the only valid SMB commands for AndXCommand for
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SMB_COM_LOCKING_ANDX:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SMB_COM_READ SMB_COM_READ_ANDX
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SMB_COM_WRITE SMB_COM_WRITE_ANDX
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SMB_COM_FLUSH
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 4.2.6.1 Errors
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw *
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ERRDOS/ERRbadfile
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ERRDOS/ERRbadfid
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ERRDOS/ERRlock
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ERRDOS/ERRinvdevice
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ERRSRV/ERRinvid
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ERRSRV/ERRbaduid
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown#include <smbsrv/smb_kproto.h>
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
7b59d02d2a384be9a08087b14defadd214b3c1ddjbsmb_sdrc_t
faa1795a28a5c712eed6d0a3f84d98c368a316c6jbsmb_pre_locking_andx(smb_request_t *sr)
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb{
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__LockingX__start, smb_request_t *, sr);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_SUCCESS);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb}
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb
faa1795a28a5c712eed6d0a3f84d98c368a316c6jbvoid
faa1795a28a5c712eed6d0a3f84d98c368a316c6jbsmb_post_locking_andx(smb_request_t *sr)
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb{
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__LockingX__done, smb_request_t *, sr);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb}
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb
faa1795a28a5c712eed6d0a3f84d98c368a316c6jbsmb_sdrc_t
faa1795a28a5c712eed6d0a3f84d98c368a316c6jbsmb_com_locking_andx(smb_request_t *sr)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw{
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw unsigned short i;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw unsigned char lock_type; /* See lock_type table above */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw unsigned char oplock_level; /* The new oplock level */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint32_t timeout; /* Milliseconds to wait for lock */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw unsigned short unlock_num; /* # unlock range structs */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw unsigned short lock_num; /* # lock range structs */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross uint32_t save_pid; /* Process Id of owner */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint32_t offset32, length32;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint64_t offset64;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint64_t length64;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw DWORD result;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw int rc;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint32_t ltype;
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh smb_ofile_t *ofile;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross uint16_t tmp_pid; /* locking uses 16-bit pids */
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh uint8_t brk;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw rc = smbsr_decode_vwv(sr, "4.wbblww", &sr->smb_fid, &lock_type,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw &oplock_level, &timeout, &unlock_num, &lock_num);
7b59d02d2a384be9a08087b14defadd214b3c1ddjb if (rc != 0)
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego smbsr_lookup_file(sr);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (sr->fid_ofile == NULL) {
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as smbsr_error(sr, NT_STATUS_INVALID_HANDLE, ERRDOS, ERRbadfid);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh ofile = sr->fid_ofile;
9c787c76803e57736d13413909945366ce3a9448Gordon Ross if (ofile->f_node == NULL) {
9c787c76803e57736d13413909945366ce3a9448Gordon Ross smbsr_error(sr, NT_STATUS_INVALID_PARAMETER,
9c787c76803e57736d13413909945366ce3a9448Gordon Ross ERRDOS, ERROR_INVALID_PARAMETER);
9c787c76803e57736d13413909945366ce3a9448Gordon Ross return (SDRC_ERROR);
9c787c76803e57736d13413909945366ce3a9448Gordon Ross }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (lock_type & LOCKING_ANDX_SHARED_LOCK)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ltype = SMB_LOCK_TYPE_READONLY;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw else
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ltype = SMB_LOCK_TYPE_READWRITE;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross save_pid = sr->smb_pid; /* Save the original pid */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (lock_type & LOCKING_ANDX_OPLOCK_RELEASE) {
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh if (oplock_level == 0)
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh brk = SMB_OPLOCK_BREAK_TO_NONE;
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh else
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh brk = SMB_OPLOCK_BREAK_TO_LEVEL_II;
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh smb_oplock_ack(ofile->f_node, ofile, brk);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (unlock_num == 0 && lock_num == 0)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return (SDRC_NO_REPLY);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * No support for changing locktype (although we could probably
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * implement this)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (lock_type & LOCKING_ANDX_CHANGE_LOCK_TYPE) {
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright smbsr_error(sr, 0, ERRDOS,
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright ERROR_ATOMIC_LOCKS_NOT_SUPPORTED);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * No support for cancel lock (smbtorture expects this)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (lock_type & LOCKING_ANDX_CANCEL_LOCK) {
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as smbsr_error(sr, NT_STATUS_INVALID_PARAMETER,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ERRDOS, ERROR_INVALID_PARAMETER);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (lock_type & LOCKING_ANDX_LARGE_FILES) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /*
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * negotiated protocol should be NT LM 0.12 or later
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (sr->session->dialect < NT_LM_0_12) {
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as smbsr_error(sr, NT_STATUS_INVALID_PARAMETER,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw ERRDOS, ERROR_INVALID_PARAMETER);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw for (i = 0; i < unlock_num; i++) {
3db3f65c6274eb042354801a308c8e9bc4994553amw rc = smb_mbc_decodef(&sr->smb_data, "w2.QQ",
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross &tmp_pid, &offset64, &length64);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (rc) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /*
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as * This is the error returned by Windows 2000
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as * even when STATUS32 has been negotiated.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw */
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as smbsr_error(sr, 0, ERRSRV, ERRerror);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_pid = tmp_pid; /* NB: 16-bit */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw result = smb_unlock_range(sr, sr->fid_ofile->f_node,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw offset64, length64);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (result != NT_STATUS_SUCCESS) {
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as smbsr_error(sr, NT_STATUS_RANGE_NOT_LOCKED,
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright ERRDOS, ERROR_NOT_LOCKED);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw for (i = 0; i < lock_num; i++) {
3db3f65c6274eb042354801a308c8e9bc4994553amw rc = smb_mbc_decodef(&sr->smb_data, "w2.QQ",
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross &tmp_pid, &offset64, &length64);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (rc) {
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as smbsr_error(sr, 0, ERRSRV, ERRerror);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_pid = tmp_pid; /* NB: 16-bit */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas result = smb_lock_range(sr, offset64, length64, timeout,
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas ltype);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (result != NT_STATUS_SUCCESS) {
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as smb_lock_range_error(sr, result);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw } else {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw for (i = 0; i < unlock_num; i++) {
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross rc = smb_mbc_decodef(&sr->smb_data, "wll", &tmp_pid,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw &offset32, &length32);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (rc) {
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as smbsr_error(sr, 0, ERRSRV, ERRerror);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_pid = tmp_pid; /* NB: 16-bit */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw result = smb_unlock_range(sr, sr->fid_ofile->f_node,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw (uint64_t)offset32, (uint64_t)length32);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (result != NT_STATUS_SUCCESS) {
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as smbsr_error(sr, NT_STATUS_RANGE_NOT_LOCKED,
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright ERRDOS, ERROR_NOT_LOCKED);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw for (i = 0; i < lock_num; i++) {
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross rc = smb_mbc_decodef(&sr->smb_data, "wll", &tmp_pid,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw &offset32, &length32);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (rc) {
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as smbsr_error(sr, 0, ERRSRV, ERRerror);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_pid = tmp_pid; /* NB: 16-bit */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas result = smb_lock_range(sr, (uint64_t)offset32,
6537f381d2d9e7b4e2f7b29c3e7a3f13be036f2eas (uint64_t)length32, timeout, ltype);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (result != NT_STATUS_SUCCESS) {
dc20a3024900c47dd2ee44b9707e6df38f7d62a5as smb_lock_range_error(sr, result);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw }
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_pid = save_pid;
7b59d02d2a384be9a08087b14defadd214b3c1ddjb if (smbsr_encode_result(sr, 2, 0, "bb.ww", 2, sr->andx_com, 7, 0))
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_ERROR);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb return (SDRC_SUCCESS);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw}
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross/*
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * Compose an SMB1 Oplock Break Notification packet, including
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * the SMB1 header and everything, in sr->reply.
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * The caller will send it and free the request.
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Rossvoid
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Rosssmb1_oplock_break_notification(smb_request_t *sr, uint8_t brk)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross{
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross smb_ofile_t *ofile = sr->fid_ofile;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross uint16_t fid;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross uint8_t lock_type;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross uint8_t oplock_level;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross switch (brk) {
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross default:
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross ASSERT(0);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross /* FALLTHROUGH */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross case SMB_OPLOCK_BREAK_TO_NONE:
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross oplock_level = 0;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross break;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross case SMB_OPLOCK_BREAK_TO_LEVEL_II:
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross oplock_level = 1;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross break;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross }
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_com = SMB_COM_LOCKING_ANDX;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_tid = ofile->f_tree->t_tid;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_pid = 0xFFFF;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_uid = 0;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_mid = 0xFFFF;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross fid = ofile->f_fid;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross lock_type = LOCKING_ANDX_OPLOCK_RELEASE;
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross (void) smb_mbc_encodef(
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross &sr->reply, "Mb19.wwwwbb3.wbb10.",
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross /* "\xffSMB" M */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_com, /* b */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross /* status, flags, signature 19. */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_tid, /* w */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_pid, /* w */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_uid, /* w */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross sr->smb_mid, /* w */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross 8, /* word count b */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross 0xFF, /* AndX cmd b */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross /* AndX reserved, offset 3. */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross fid,
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross lock_type,
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross oplock_level);
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross}