2 Unix SMB/CIFS implementation.
3 Parameter loading functions
4 Copyright (C) Karl Auer 1993-1998
6 Largely re-written by Andrew Tridgell, September 1994
8 Copyright (C) Simo Sorce 2001
9 Copyright (C) Alexander Bokovoy 2002
10 Copyright (C) Stefan (metze) Metzmacher 2002
11 Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
12 Copyright (C) Michael Adam 2008
13 Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
14 Copyright (C) Andrew Bartlett 2011
16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 3 of the License, or
19 (at your option) any later version.
21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
26 You should have received a copy of the GNU General Public License
27 along with this program. If not, see <http://www.gnu.org/licenses/>.
31 #include "lib/param/param.h"
32 #include "lib/param/loadparm.h"
33 #include "lib/param/param_global.h"
34 #include "libcli/auth/ntlm_check.h"
35 #include "libcli/smb/smb_constants.h"
36 #include "libds/common/roles.h"
37 #include "source4/lib/tls/tls.h"
43 static const struct enum_list enum_protocol
[] = {
44 {PROTOCOL_DEFAULT
, "default"}, /* the caller decides what this means */
45 {PROTOCOL_SMB2_10
, "SMB2"}, /* for now keep PROTOCOL_SMB2_10 */
46 {PROTOCOL_SMB3_11
, "SMB3"}, /* for now keep PROTOCOL_SMB3_11 */
47 {PROTOCOL_SMB3_11
, "SMB3_11"},
48 {PROTOCOL_SMB3_10
, "SMB3_10"},
49 {PROTOCOL_SMB3_02
, "SMB3_02"},
50 {PROTOCOL_SMB3_00
, "SMB3_00"},
51 {PROTOCOL_SMB2_24
, "SMB2_24"},
52 {PROTOCOL_SMB2_22
, "SMB2_22"},
53 {PROTOCOL_SMB2_10
, "SMB2_10"},
54 {PROTOCOL_SMB2_02
, "SMB2_02"},
55 {PROTOCOL_NT1
, "NT1"},
56 {PROTOCOL_LANMAN2
, "LANMAN2"},
57 {PROTOCOL_LANMAN1
, "LANMAN1"},
58 {PROTOCOL_CORE
, "CORE"},
59 {PROTOCOL_COREPLUS
, "COREPLUS"},
60 {PROTOCOL_COREPLUS
, "CORE+"},
64 static const struct enum_list enum_security
[] = {
67 {SEC_DOMAIN
, "DOMAIN"},
72 static const struct enum_list enum_bool_auto
[] = {
83 static const struct enum_list enum_csc_policy
[] = {
84 {CSC_POLICY_MANUAL
, "manual"},
85 {CSC_POLICY_DOCUMENTS
, "documents"},
86 {CSC_POLICY_PROGRAMS
, "programs"},
87 {CSC_POLICY_DISABLE
, "disable"},
91 /* Server role options */
92 static const struct enum_list enum_server_role
[] = {
94 {ROLE_STANDALONE
, "standalone server"},
95 {ROLE_STANDALONE
, "standalone"},
96 {ROLE_DOMAIN_MEMBER
, "member server"},
97 {ROLE_DOMAIN_MEMBER
, "member"},
98 {ROLE_DOMAIN_PDC
, "classic primary domain controller"},
99 {ROLE_DOMAIN_BDC
, "classic backup domain controller"},
100 {ROLE_ACTIVE_DIRECTORY_DC
, "active directory domain controller"},
101 {ROLE_ACTIVE_DIRECTORY_DC
, "domain controller"},
102 {ROLE_ACTIVE_DIRECTORY_DC
, "dc"},
106 /* SMB signing types. */
107 static const struct enum_list enum_smb_signing_vals
[] = {
108 {SMB_SIGNING_DEFAULT
, "default"},
109 {SMB_SIGNING_OFF
, "No"},
110 {SMB_SIGNING_OFF
, "False"},
111 {SMB_SIGNING_OFF
, "0"},
112 {SMB_SIGNING_OFF
, "Off"},
113 {SMB_SIGNING_OFF
, "disabled"},
114 {SMB_SIGNING_IF_REQUIRED
, "if_required"},
115 {SMB_SIGNING_IF_REQUIRED
, "Yes"},
116 {SMB_SIGNING_IF_REQUIRED
, "True"},
117 {SMB_SIGNING_IF_REQUIRED
, "1"},
118 {SMB_SIGNING_IF_REQUIRED
, "On"},
119 {SMB_SIGNING_IF_REQUIRED
, "enabled"},
120 {SMB_SIGNING_IF_REQUIRED
, "auto"},
121 {SMB_SIGNING_DESIRED
, "desired"},
122 {SMB_SIGNING_REQUIRED
, "required"},
123 {SMB_SIGNING_REQUIRED
, "mandatory"},
124 {SMB_SIGNING_REQUIRED
, "force"},
125 {SMB_SIGNING_REQUIRED
, "forced"},
126 {SMB_SIGNING_REQUIRED
, "enforced"},
130 static const struct enum_list enum_tls_verify_peer_vals
[] = {
131 {TLS_VERIFY_PEER_NO_CHECK
,
132 TLS_VERIFY_PEER_NO_CHECK_STRING
},
133 {TLS_VERIFY_PEER_CA_ONLY
,
134 TLS_VERIFY_PEER_CA_ONLY_STRING
},
135 {TLS_VERIFY_PEER_CA_AND_NAME_IF_AVAILABLE
,
136 TLS_VERIFY_PEER_CA_AND_NAME_IF_AVAILABLE_STRING
},
137 {TLS_VERIFY_PEER_CA_AND_NAME
,
138 TLS_VERIFY_PEER_CA_AND_NAME_STRING
},
139 {TLS_VERIFY_PEER_AS_STRICT_AS_POSSIBLE
,
140 TLS_VERIFY_PEER_AS_STRICT_AS_POSSIBLE_STRING
},
144 /* DNS update options. */
145 static const struct enum_list enum_dns_update_settings
[] = {
146 {DNS_UPDATE_OFF
, "disabled"},
147 {DNS_UPDATE_OFF
, "No"},
148 {DNS_UPDATE_OFF
, "False"},
149 {DNS_UPDATE_OFF
, "0"},
150 {DNS_UPDATE_OFF
, "Off"},
151 {DNS_UPDATE_ON
, "nonsecure and secure"},
152 {DNS_UPDATE_ON
, "nonsecure"},
153 {DNS_UPDATE_SIGNED
, "secure only"},
154 {DNS_UPDATE_SIGNED
, "secure"},
155 {DNS_UPDATE_SIGNED
, "signed"},
160 Do you want session setups at user level security with a invalid
161 password to be rejected or allowed in as guest? WinNT rejects them
162 but it can be a pain as it means "net view" needs to use a password
164 You have 3 choices in the setting of map_to_guest:
166 "Never" means session setups with an invalid password
167 are rejected. This is the default.
169 "Bad User" means session setups with an invalid password
170 are rejected, unless the username does not exist, in which case it
171 is treated as a guest login
173 "Bad Password" means session setups with an invalid password
174 are treated as a guest login
176 Note that map_to_guest only has an effect in user or server
180 static const struct enum_list enum_map_to_guest
[] = {
181 {NEVER_MAP_TO_GUEST
, "Never"},
182 {MAP_TO_GUEST_ON_BAD_USER
, "Bad User"},
183 {MAP_TO_GUEST_ON_BAD_PASSWORD
, "Bad Password"},
184 {MAP_TO_GUEST_ON_BAD_UID
, "Bad Uid"},
188 /* Config backend options */
190 static const struct enum_list enum_config_backend
[] = {
191 {CONFIG_BACKEND_FILE
, "file"},
192 {CONFIG_BACKEND_REGISTRY
, "registry"},
196 static const struct enum_list enum_smbd_profiling_level
[] = {
197 {0, "off"}, {1, "count"}, {2, "on"}, {-1, NULL
}
201 /* ADS kerberos ticket verification options */
203 static const struct enum_list enum_kerberos_method
[] = {
204 {KERBEROS_VERIFY_SECRETS
, "default"},
205 {KERBEROS_VERIFY_SECRETS
, "secrets only"},
206 {KERBEROS_VERIFY_SECRETS
, "secretsonly"},
207 {KERBEROS_VERIFY_SYSTEM_KEYTAB
, "system keytab"},
208 {KERBEROS_VERIFY_SYSTEM_KEYTAB
, "systemkeytab"},
209 {KERBEROS_VERIFY_DEDICATED_KEYTAB
, "dedicated keytab"},
210 {KERBEROS_VERIFY_DEDICATED_KEYTAB
, "dedicatedkeytab"},
211 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB
, "secrets and keytab"},
212 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB
, "secretsandkeytab"},
216 /* Kerberos encryption types selection options */
218 static const struct enum_list enum_kerberos_encryption_types_vals
[] = {
219 {KERBEROS_ETYPES_ALL
, "all"},
220 {KERBEROS_ETYPES_STRONG
, "strong"},
221 {KERBEROS_ETYPES_LEGACY
, "legacy"},
225 static const struct enum_list enum_printing
[] = {
226 {PRINT_SYSV
, "sysv"},
228 {PRINT_HPUX
, "hpux"},
232 {PRINT_LPRNG
, "lprng"},
234 {PRINT_CUPS
, "cups"},
237 {PRINT_IPRINT
, "iprint"},
240 {PRINT_LPROS2
, "os2"},
241 #if defined(DEVELOPER) || defined(ENABLE_SELFTEST)
242 {PRINT_TEST
, "test"},
244 #endif /* DEVELOPER */
248 static const struct enum_list enum_ldap_sasl_wrapping
[] = {
250 {ADS_AUTH_SASL_SIGN
, "sign"},
251 {ADS_AUTH_SASL_SEAL
, "seal"},
255 static const struct enum_list enum_ldap_server_require_strong_auth_vals
[] = {
256 { LDAP_SERVER_REQUIRE_STRONG_AUTH_NO
, "No" },
257 { LDAP_SERVER_REQUIRE_STRONG_AUTH_NO
, "False" },
258 { LDAP_SERVER_REQUIRE_STRONG_AUTH_NO
, "0" },
259 { LDAP_SERVER_REQUIRE_STRONG_AUTH_ALLOW_SASL_OVER_TLS
,
260 "allow_sasl_over_tls" },
261 { LDAP_SERVER_REQUIRE_STRONG_AUTH_YES
, "Yes" },
262 { LDAP_SERVER_REQUIRE_STRONG_AUTH_YES
, "True" },
263 { LDAP_SERVER_REQUIRE_STRONG_AUTH_YES
, "1" },
267 static const struct enum_list enum_ldap_ssl
[] = {
268 {LDAP_SSL_OFF
, "no"},
269 {LDAP_SSL_OFF
, "off"},
270 {LDAP_SSL_START_TLS
, "start tls"},
271 {LDAP_SSL_START_TLS
, "start_tls"},
275 /* LDAP Dereferencing Alias types */
276 #define SAMBA_LDAP_DEREF_NEVER 0
277 #define SAMBA_LDAP_DEREF_SEARCHING 1
278 #define SAMBA_LDAP_DEREF_FINDING 2
279 #define SAMBA_LDAP_DEREF_ALWAYS 3
281 static const struct enum_list enum_ldap_deref
[] = {
282 {SAMBA_LDAP_DEREF_NEVER
, "never"},
283 {SAMBA_LDAP_DEREF_SEARCHING
, "searching"},
284 {SAMBA_LDAP_DEREF_FINDING
, "finding"},
285 {SAMBA_LDAP_DEREF_ALWAYS
, "always"},
289 static const struct enum_list enum_ldap_passwd_sync
[] = {
290 {LDAP_PASSWD_SYNC_OFF
, "no"},
291 {LDAP_PASSWD_SYNC_OFF
, "off"},
292 {LDAP_PASSWD_SYNC_ON
, "yes"},
293 {LDAP_PASSWD_SYNC_ON
, "on"},
294 {LDAP_PASSWD_SYNC_ONLY
, "only"},
298 static const struct enum_list enum_map_readonly
[] = {
299 {MAP_READONLY_NO
, "no"},
300 {MAP_READONLY_NO
, "false"},
301 {MAP_READONLY_NO
, "0"},
302 {MAP_READONLY_YES
, "yes"},
303 {MAP_READONLY_YES
, "true"},
304 {MAP_READONLY_YES
, "1"},
305 {MAP_READONLY_PERMISSIONS
, "permissions"},
306 {MAP_READONLY_PERMISSIONS
, "perms"},
310 static const struct enum_list enum_case
[] = {
311 {CASE_LOWER
, "lower"},
312 {CASE_UPPER
, "upper"},
316 static const struct enum_list enum_inherit_owner_vals
[] = {
317 {INHERIT_OWNER_NO
, "no"},
318 {INHERIT_OWNER_WINDOWS_AND_UNIX
, "windows and unix"},
319 {INHERIT_OWNER_WINDOWS_AND_UNIX
, "yes"},
320 {INHERIT_OWNER_UNIX_ONLY
, "unix only"},
323 static const struct enum_list enum_mangled_names
[] = {
324 {MANGLED_NAMES_NO
, "no"},
325 {MANGLED_NAMES_NO
, "false"},
326 {MANGLED_NAMES_NO
, "0"},
327 {MANGLED_NAMES_ILLEGAL
, "illegal"},
328 {MANGLED_NAMES_YES
, "yes"},
329 {MANGLED_NAMES_YES
, "true"},
330 {MANGLED_NAMES_YES
, "1"},
334 static const struct enum_list enum_ntlm_auth
[] = {
335 {NTLM_AUTH_DISABLED
, "disabled"},
336 {NTLM_AUTH_NTLMV2_ONLY
, "ntlmv2-only"},
337 {NTLM_AUTH_NTLMV2_ONLY
, "no"},
338 {NTLM_AUTH_NTLMV2_ONLY
, "false"},
339 {NTLM_AUTH_NTLMV2_ONLY
, "0"},
340 {NTLM_AUTH_ON
, "ntlmv1-permitted"},
341 {NTLM_AUTH_ON
, "yes"},
342 {NTLM_AUTH_ON
, "true"},
344 {NTLM_AUTH_MSCHAPv2_NTLMV2_ONLY
, "mschapv2-and-ntlmv2-only"},
348 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
350 * NOTE: Handling of duplicated (synonym) parameters:
351 * Parameters that are synonymous are stored in the same variable.
352 * All but the default spelling carry the flag FLAG_SYNONYM.
355 #define GLOBAL_VAR(name) offsetof(struct loadparm_global, name)
356 #define LOCAL_VAR(name) offsetof(struct loadparm_service, name)
358 #include "lib/param/param_table_gen.c"
360 int num_parameters(void)
362 return (sizeof(parm_table
) / sizeof(struct parm_struct
));