xref: /illumos-gate/usr/src/uts/common/fs/smbsrv/smb_logoff_andx.c (revision e38a713ad4e0a9c42f8cccd9350412b2c6ccccdb)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include <smbsrv/smb_incl.h>
29 
30 
31 /*
32  * smb_com_logoff_andx
33  *
34  * This SMB is the inverse of SMB_COM_SESSION_SETUP_ANDX.
35  *
36  * Client Request                     Description
37  * ================================== =================================
38  *
39  * UCHAR WordCount;                   Count of parameter words = 2
40  * UCHAR AndXCommand;                 Secondary (X) command;  0xFF = none
41  * UCHAR AndXReserved;                Reserved (must be 0)
42  * USHORT AndXOffset;                 Offset to next command WordCount
43  * USHORT ByteCount;                  Count of data bytes = 0
44  *
45  * Server Response                    Description
46  * ================================== =================================
47  *
48  * UCHAR WordCount;                   Count of parameter words = 2
49  * UCHAR AndXCommand;                 Secondary (X) command;  0xFF = none
50  * UCHAR AndXReserved;                Reserved (must be 0)
51  * USHORT AndXOffset;                 Offset to next command WordCount
52  * USHORT ByteCount;                  Count of data bytes = 0
53  *
54  * The user represented by Uid in the SMB header is logged off.  The server
55  * closes all files currently open by this user, and invalidates any
56  * outstanding requests with this Uid.
57  *
58  * SMB_COM_SESSION_SETUP_ANDX is the only valid AndX command for this SMB.
59  *
60  * 4.1.3.1   Errors
61  *
62  * ERRSRV/invnid  - TID was invalid
63  * ERRSRV/baduid  - UID was invalid
64  */
65 int
66 smb_com_logoff_andx(struct smb_request *sr)
67 {
68 	if (sr->uid_user == NULL) {
69 		smbsr_error(sr, 0, ERRSRV, ERRbaduid);
70 		/* NOTREACHED */
71 	}
72 
73 	smb_user_logoff(sr->uid_user);
74 
75 	smbsr_encode_result(sr, 2, 0, "bb.ww", 2, sr->andx_com, -1, 0);
76 	return (SDRC_NORMAL_REPLY);
77 }
78