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 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * SMB: process_exit
28 *
29 * This command informs the server that a client process has terminated.
30 * The server must close all files opened by Pid in the SMB header. This
31 * must automatically release all locks the process holds.
32 *
33 * Client Request Description
34 * ================================== =================================
35 *
36 * UCHAR WordCount; Count of parameter words = 0
37 * USHORT ByteCount; Count of data bytes = 0
38 *
39 * Server Response Description
40 * ================================== =================================
41 *
42 * UCHAR WordCount; Count of parameter words = 0
43 * USHORT ByteCount; Count of data bytes = 0
44 *
45 * This SMB should not generate any errors from the server, unless the
46 * server is a user mode server and Uid in the SMB header is invalid.
47 *
48 * Clients are not required to send this SMB, they can do all cleanup
49 * necessary by sending close SMBs to the server to release resources. In
50 * fact, clients who have negotiated LANMAN 1.0 and later probably do not
51 * send this message at all.
52 */
53
54 #include <smbsrv/smb_kproto.h>
55
56 smb_sdrc_t
57 smb_pre_process_exit(smb_request_t *sr)
58 {
59 DTRACE_SMB_1(op__ProcessExit__start, smb_request_t *, sr);
60 return (SDRC_SUCCESS);
61 }
62
63 void
64 smb_post_process_exit(smb_request_t *sr)
65 {
66 DTRACE_SMB_1(op__ProcessExit__done, smb_request_t *, sr);
67 }
68
69 smb_sdrc_t
70 smb_com_process_exit(smb_request_t *sr)
71 {
72 int rc;
73
74 sr->uid_user = smb_session_lookup_uid(sr->session, sr->smb_uid);
75 if (sr->uid_user == NULL) {
76 rc = smbsr_encode_empty_result(sr);
77 return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
78 }
79
80 sr->user_cr = smb_user_getcred(sr->uid_user);
81
82 /*
83 * If request has a valid tree ID, only look for the PID within
84 * that tree. Otherwise look in all the trees. smbtorture seems
85 * to be the only thing that sends this request these days and
86 * it doesn't provide a TID.
|
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 2010 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 /*
29 * SMB: process_exit
30 *
31 * This command informs the server that a client process has terminated.
32 * The server must close all files opened by Pid in the SMB header. This
33 * must automatically release all locks the process holds.
34 *
35 * Client Request Description
36 * ================================== =================================
37 *
38 * UCHAR WordCount; Count of parameter words = 0
39 * USHORT ByteCount; Count of data bytes = 0
40 *
41 * Server Response Description
42 * ================================== =================================
43 *
44 * UCHAR WordCount; Count of parameter words = 0
45 * USHORT ByteCount; Count of data bytes = 0
46 *
47 * This SMB should not generate any errors from the server, unless the
48 * server is a user mode server and Uid in the SMB header is invalid.
49 *
50 * Clients are not required to send this SMB, they can do all cleanup
51 * necessary by sending close SMBs to the server to release resources. In
52 * fact, clients who have negotiated LANMAN 1.0 and later probably do not
53 * send this message at all.
54 */
55
56 #include <smbsrv/smb_kproto.h>
57
58 smb_sdrc_t
59 smb_pre_process_exit(smb_request_t *sr)
60 {
61 DTRACE_SMB_START(op__ProcessExit, smb_request_t *, sr);
62 return (SDRC_SUCCESS);
63 }
64
65 void
66 smb_post_process_exit(smb_request_t *sr)
67 {
68 DTRACE_SMB_DONE(op__ProcessExit, smb_request_t *, sr);
69 }
70
71 smb_sdrc_t
72 smb_com_process_exit(smb_request_t *sr)
73 {
74 int rc;
75
76 sr->uid_user = smb_session_lookup_uid(sr->session, sr->smb_uid);
77 if (sr->uid_user == NULL) {
78 rc = smbsr_encode_empty_result(sr);
79 return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
80 }
81
82 sr->user_cr = smb_user_getcred(sr->uid_user);
83
84 /*
85 * If request has a valid tree ID, only look for the PID within
86 * that tree. Otherwise look in all the trees. smbtorture seems
87 * to be the only thing that sends this request these days and
88 * it doesn't provide a TID.
|