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