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 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <smbsrv/smb_kproto.h>
27
28
29 /*
30 * smb_com_logoff_andx
31 *
32 * This SMB is the inverse of SMB_COM_SESSION_SETUP_ANDX.
33 *
34 * Client Request Description
35 * ================================== =================================
36 *
37 * UCHAR WordCount; Count of parameter words = 2
38 * UCHAR AndXCommand; Secondary (X) command; 0xFF = none
39 * UCHAR AndXReserved; Reserved (must be 0)
40 * USHORT AndXOffset; Offset to next command WordCount
41 * USHORT ByteCount; Count of data bytes = 0
42 *
43 * Server Response Description
46 * UCHAR WordCount; Count of parameter words = 2
47 * UCHAR AndXCommand; Secondary (X) command; 0xFF = none
48 * UCHAR AndXReserved; Reserved (must be 0)
49 * USHORT AndXOffset; Offset to next command WordCount
50 * USHORT ByteCount; Count of data bytes = 0
51 *
52 * The user represented by Uid in the SMB header is logged off. The server
53 * closes all files currently open by this user, and invalidates any
54 * outstanding requests with this Uid.
55 *
56 * SMB_COM_SESSION_SETUP_ANDX is the only valid AndX command for this SMB.
57 *
58 * 4.1.3.1 Errors
59 *
60 * ERRSRV/invnid - TID was invalid
61 * ERRSRV/baduid - UID was invalid
62 */
63 smb_sdrc_t
64 smb_pre_logoff_andx(smb_request_t *sr)
65 {
66 DTRACE_SMB_1(op__LogoffX__start, smb_request_t *, sr);
67 return (SDRC_SUCCESS);
68 }
69
70 void
71 smb_post_logoff_andx(smb_request_t *sr)
72 {
73 DTRACE_SMB_1(op__LogoffX__done, smb_request_t *, sr);
74 }
75
76 smb_sdrc_t
77 smb_com_logoff_andx(smb_request_t *sr)
78 {
79 if (sr->uid_user == NULL) {
80 smbsr_error(sr, 0, ERRSRV, ERRbaduid);
81 return (SDRC_ERROR);
82 }
83
84 smb_user_logoff(sr->uid_user);
85
86 if (smbsr_encode_result(sr, 2, 0, "bb.ww", 2, sr->andx_com, -1, 0))
87 return (SDRC_ERROR);
88 return (SDRC_SUCCESS);
89 }
|
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 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 #include <smbsrv/smb_kproto.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
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 smb_sdrc_t
66 smb_pre_logoff_andx(smb_request_t *sr)
67 {
68 DTRACE_SMB_START(op__LogoffX, smb_request_t *, sr);
69 return (SDRC_SUCCESS);
70 }
71
72 void
73 smb_post_logoff_andx(smb_request_t *sr)
74 {
75 DTRACE_SMB_DONE(op__LogoffX, smb_request_t *, sr);
76 }
77
78 smb_sdrc_t
79 smb_com_logoff_andx(smb_request_t *sr)
80 {
81 if (sr->uid_user == NULL) {
82 smbsr_error(sr, 0, ERRSRV, ERRbaduid);
83 return (SDRC_ERROR);
84 }
85
86 smb_user_logoff(sr->uid_user);
87
88 if (smbsr_encode_result(sr, 2, 0, "bb.ww", 2, sr->andx_com, -1, 0))
89 return (SDRC_ERROR);
90 return (SDRC_SUCCESS);
91 }
|