xref: /titanic_41/usr/src/uts/common/smbsrv/smbinfo.h (revision 0a96f64e3185cf2fb9959e528ba7f454ca681484)
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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef	_SMBSRV_SMBINFO_H
26 #define	_SMBSRV_SMBINFO_H
27 
28 #include <sys/types.h>
29 #include <smbsrv/netbios.h>
30 #include <netinet/in.h>
31 #include <smbsrv/smb_inet.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * Native OS types used in SmbSessionSetupX.
39  */
40 #ifndef NATIVE_OS_DEFINED
41 #define	NATIVE_OS_DEFINED
42 
43 #define	NATIVE_OS_UNKNOWN	0x00000000
44 #define	NATIVE_OS_WINNT		0x00000001
45 #define	NATIVE_OS_WIN95		0x00000002
46 #define	NATIVE_OS_MACOS		0x00000003
47 #define	NATIVE_OS_WIN2000	0x00000004
48 
49 #endif /* NATIVE_OS_DEFINED */
50 
51 
52 /*
53  * Native lanman types in SmbSessionSetupX. Note that these values
54  * are not directly related to the negotiated protocol dialect.
55  */
56 #ifndef NATIVE_LANMAN_DEFINED
57 #define	NATIVE_LANMAN_DEFINED
58 
59 #define	NATIVE_LM_NONE		0x00000000
60 #define	NATIVE_LM_NT		0x00000001
61 #define	NATIVE_LM_WIN2000	0x00000002
62 
63 #endif /* NATIVE_LANMAN_DEFINED */
64 
65 
66 /* PDC types to be used in user authentication process */
67 
68 #define	PDC_UNKNOWN		0
69 #define	PDC_WINNT		1
70 #define	PDC_WIN2000		2
71 #define	PDC_WINXP		3
72 #define	PDC_SAMBA		4
73 
74 /*
75  * Please replace the use of MAX_NETWORKS with SMB_PI_MAX_NETWORKS if
76  * you find it used in conjunction with smbparm_info and maybe one day
77  * there will be just a single definition (here) throughout the code.
78  */
79 #ifndef MAX_NETWORKS
80 #define	MAX_NETWORKS		36
81 #endif /* MAX_NETWORKS */
82 
83 #define	SMB_PI_MAX_NETWORKS	36
84 #define	SMB_PI_MAX_WINS		2
85 
86 #define	SMB_SECMODE_WORKGRP	1
87 #define	SMB_SECMODE_DOMAIN	2
88 
89 #define	SMB_PI_MAX_HOST		48
90 #define	SMB_PI_MAX_DOMAIN	256
91 #define	SMB_PI_MAX_SCOPE	16
92 #define	SMB_PI_MAX_COMMENT	58
93 #define	SMB_PI_MAX_NATIVE_OS	32
94 #define	SMB_PI_MAX_LANMAN	32
95 
96 #define	SMB_PI_KEEP_ALIVE_MIN		(90 * 60)
97 /*
98  * Some older clients (Windows 98) only handle the low byte
99  * of the max workers value. If the low byte is less than
100  * SMB_PI_MAX_WORKERS_MIN we set it to SMB_PI_MAX_WORKERS_MIN.
101  * SMB_PI_MAX_WORKERS_MIN must therefore be < 256
102  */
103 #define	SMB_PI_MAX_WORKERS_MIN		64
104 
105 /*
106  * sv_size is used by the RPC services and should be set to
107  * sizeof (smb_version_t).
108  */
109 typedef struct smb_version {
110 	uint32_t	sv_size;
111 	uint32_t	sv_major;
112 	uint32_t	sv_minor;
113 	uint32_t	sv_build_number;
114 	uint32_t	sv_platform_id;
115 } smb_version_t;
116 
117 typedef struct smb_kmod_cfg {
118 	uint32_t skc_maxworkers;
119 	uint32_t skc_maxconnections;
120 	uint32_t skc_keepalive;
121 	int32_t skc_restrict_anon;
122 	int32_t skc_signing_enable;
123 	int32_t skc_signing_required;
124 	int32_t skc_oplock_enable;
125 	int32_t skc_sync_enable;
126 	int32_t skc_secmode;
127 	int32_t skc_ipv6_enable;
128 	int32_t skc_print_enable;
129 	uint32_t skc_execflags;
130 	smb_version_t skc_version;
131 	char skc_nbdomain[NETBIOS_NAME_SZ];
132 	char skc_fqdn[SMB_PI_MAX_DOMAIN];
133 	char skc_hostname[SMB_PI_MAX_HOST];
134 	char skc_system_comment[SMB_PI_MAX_COMMENT];
135 } smb_kmod_cfg_t;
136 
137 #define	SMB_EXEC_MAP	0x01
138 #define	SMB_EXEC_UNMAP	0x02
139 #define	SMB_EXEC_TERM	0x04
140 
141 #define	SMB_EXEC_DISP_CONTINUE	"continue"
142 #define	SMB_EXEC_DISP_TERMINATE	"terminate"
143 
144 /*
145  * Major version numbers
146  */
147 #define	SMB_MAJOR_NT		4	/* Windows 95/98/Me, Windows NT4.0 */
148 #define	SMB_MAJOR_2000		5
149 #define	SMB_MAJOR_XP		5
150 #define	SMB_MAJOR_2003		5
151 #define	SMB_MAJOR_VISTA		6
152 #define	SMB_MAJOR_2008		6
153 #define	SMB_MAJOR_2008R2	6
154 #define	SMB_MAJOR_7		6
155 
156 /*
157  * Minor version numbers
158  */
159 #define	SMB_MINOR_NT		0
160 #define	SMB_MINOR_2000		0
161 #define	SMB_MINOR_XP		1
162 #define	SMB_MINOR_2003		2
163 #define	SMB_MINOR_VISTA		0
164 #define	SMB_MINOR_2008		0
165 #define	SMB_MINOR_2008R2	1
166 #define	SMB_MINOR_7		1
167 
168 /*
169  * Max version length in string format
170  */
171 #define	SMB_VERSTR_LEN		8
172 
173 int smbnative_os_value(const char *);
174 int smbnative_lm_value(const char *);
175 int smbnative_pdc_value(const char *);
176 const char *smbnative_os_str(smb_version_t *);
177 const char *smbnative_lm_str(smb_version_t *);
178 
179 /*
180  * Support for passthrough authentication.
181  */
182 #define	AUTH_USER_GRANT			0x00000000
183 #define	AUTH_GUEST_GRANT		0x00000001
184 #define	AUTH_IPC_ONLY_GRANT		0x00000002
185 
186 #ifdef __cplusplus
187 }
188 #endif
189 
190 #endif /* _SMBSRV_SMBINFO_H */
191