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_mdns_name_values
[] = {
131 {MDNS_NAME_NETBIOS
, "netbios"},
132 {MDNS_NAME_MDNS
, "mdns"},
136 static const struct enum_list enum_tls_verify_peer_vals
[] = {
137 {TLS_VERIFY_PEER_NO_CHECK
,
138 TLS_VERIFY_PEER_NO_CHECK_STRING
},
139 {TLS_VERIFY_PEER_CA_ONLY
,
140 TLS_VERIFY_PEER_CA_ONLY_STRING
},
141 {TLS_VERIFY_PEER_CA_AND_NAME_IF_AVAILABLE
,
142 TLS_VERIFY_PEER_CA_AND_NAME_IF_AVAILABLE_STRING
},
143 {TLS_VERIFY_PEER_CA_AND_NAME
,
144 TLS_VERIFY_PEER_CA_AND_NAME_STRING
},
145 {TLS_VERIFY_PEER_AS_STRICT_AS_POSSIBLE
,
146 TLS_VERIFY_PEER_AS_STRICT_AS_POSSIBLE_STRING
},
150 /* DNS update options. */
151 static const struct enum_list enum_dns_update_settings
[] = {
152 {DNS_UPDATE_OFF
, "disabled"},
153 {DNS_UPDATE_OFF
, "No"},
154 {DNS_UPDATE_OFF
, "False"},
155 {DNS_UPDATE_OFF
, "0"},
156 {DNS_UPDATE_OFF
, "Off"},
157 {DNS_UPDATE_ON
, "nonsecure and secure"},
158 {DNS_UPDATE_ON
, "nonsecure"},
159 {DNS_UPDATE_SIGNED
, "secure only"},
160 {DNS_UPDATE_SIGNED
, "secure"},
161 {DNS_UPDATE_SIGNED
, "signed"},
166 Do you want session setups at user level security with a invalid
167 password to be rejected or allowed in as guest? WinNT rejects them
168 but it can be a pain as it means "net view" needs to use a password
170 You have 3 choices in the setting of map_to_guest:
172 "Never" means session setups with an invalid password
173 are rejected. This is the default.
175 "Bad User" means session setups with an invalid password
176 are rejected, unless the username does not exist, in which case it
177 is treated as a guest login
179 "Bad Password" means session setups with an invalid password
180 are treated as a guest login
182 Note that map_to_guest only has an effect in user or server
186 static const struct enum_list enum_map_to_guest
[] = {
187 {NEVER_MAP_TO_GUEST
, "Never"},
188 {MAP_TO_GUEST_ON_BAD_USER
, "Bad User"},
189 {MAP_TO_GUEST_ON_BAD_PASSWORD
, "Bad Password"},
190 {MAP_TO_GUEST_ON_BAD_UID
, "Bad Uid"},
194 /* Config backend options */
196 static const struct enum_list enum_config_backend
[] = {
197 {CONFIG_BACKEND_FILE
, "file"},
198 {CONFIG_BACKEND_REGISTRY
, "registry"},
202 static const struct enum_list enum_smbd_profiling_level
[] = {
203 {0, "off"}, {1, "count"}, {2, "on"}, {-1, NULL
}
207 /* ADS kerberos ticket verification options */
209 static const struct enum_list enum_kerberos_method
[] = {
210 {KERBEROS_VERIFY_SECRETS
, "default"},
211 {KERBEROS_VERIFY_SECRETS
, "secrets only"},
212 {KERBEROS_VERIFY_SECRETS
, "secretsonly"},
213 {KERBEROS_VERIFY_SYSTEM_KEYTAB
, "system keytab"},
214 {KERBEROS_VERIFY_SYSTEM_KEYTAB
, "systemkeytab"},
215 {KERBEROS_VERIFY_DEDICATED_KEYTAB
, "dedicated keytab"},
216 {KERBEROS_VERIFY_DEDICATED_KEYTAB
, "dedicatedkeytab"},
217 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB
, "secrets and keytab"},
218 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB
, "secretsandkeytab"},
222 /* Kerberos encryption types selection options */
224 static const struct enum_list enum_kerberos_encryption_types_vals
[] = {
225 {KERBEROS_ETYPES_ALL
, "all"},
226 {KERBEROS_ETYPES_STRONG
, "strong"},
227 {KERBEROS_ETYPES_LEGACY
, "legacy"},
231 static const struct enum_list enum_printing
[] = {
232 {PRINT_SYSV
, "sysv"},
234 {PRINT_HPUX
, "hpux"},
238 {PRINT_LPRNG
, "lprng"},
240 {PRINT_CUPS
, "cups"},
243 {PRINT_IPRINT
, "iprint"},
246 {PRINT_LPROS2
, "os2"},
247 #if defined(DEVELOPER) || defined(ENABLE_SELFTEST)
248 {PRINT_TEST
, "test"},
250 #endif /* DEVELOPER */
254 static const struct enum_list enum_ldap_sasl_wrapping
[] = {
256 {ADS_AUTH_SASL_SIGN
, "sign"},
257 {ADS_AUTH_SASL_SEAL
, "seal"},
261 static const struct enum_list enum_ldap_server_require_strong_auth_vals
[] = {
262 { LDAP_SERVER_REQUIRE_STRONG_AUTH_NO
, "No" },
263 { LDAP_SERVER_REQUIRE_STRONG_AUTH_NO
, "False" },
264 { LDAP_SERVER_REQUIRE_STRONG_AUTH_NO
, "0" },
265 { LDAP_SERVER_REQUIRE_STRONG_AUTH_ALLOW_SASL_OVER_TLS
,
266 "allow_sasl_over_tls" },
267 { LDAP_SERVER_REQUIRE_STRONG_AUTH_YES
, "Yes" },
268 { LDAP_SERVER_REQUIRE_STRONG_AUTH_YES
, "True" },
269 { LDAP_SERVER_REQUIRE_STRONG_AUTH_YES
, "1" },
273 static const struct enum_list enum_ldap_ssl
[] = {
274 {LDAP_SSL_OFF
, "no"},
275 {LDAP_SSL_OFF
, "off"},
276 {LDAP_SSL_START_TLS
, "start tls"},
277 {LDAP_SSL_START_TLS
, "start_tls"},
281 /* LDAP Dereferencing Alias types */
282 #define SAMBA_LDAP_DEREF_NEVER 0
283 #define SAMBA_LDAP_DEREF_SEARCHING 1
284 #define SAMBA_LDAP_DEREF_FINDING 2
285 #define SAMBA_LDAP_DEREF_ALWAYS 3
287 static const struct enum_list enum_ldap_deref
[] = {
288 {SAMBA_LDAP_DEREF_NEVER
, "never"},
289 {SAMBA_LDAP_DEREF_SEARCHING
, "searching"},
290 {SAMBA_LDAP_DEREF_FINDING
, "finding"},
291 {SAMBA_LDAP_DEREF_ALWAYS
, "always"},
295 static const struct enum_list enum_ldap_passwd_sync
[] = {
296 {LDAP_PASSWD_SYNC_OFF
, "no"},
297 {LDAP_PASSWD_SYNC_OFF
, "off"},
298 {LDAP_PASSWD_SYNC_ON
, "yes"},
299 {LDAP_PASSWD_SYNC_ON
, "on"},
300 {LDAP_PASSWD_SYNC_ONLY
, "only"},
304 static const struct enum_list enum_map_readonly
[] = {
305 {MAP_READONLY_NO
, "no"},
306 {MAP_READONLY_NO
, "false"},
307 {MAP_READONLY_NO
, "0"},
308 {MAP_READONLY_YES
, "yes"},
309 {MAP_READONLY_YES
, "true"},
310 {MAP_READONLY_YES
, "1"},
311 {MAP_READONLY_PERMISSIONS
, "permissions"},
312 {MAP_READONLY_PERMISSIONS
, "perms"},
316 static const struct enum_list enum_case
[] = {
317 {CASE_LOWER
, "lower"},
318 {CASE_UPPER
, "upper"},
322 static const struct enum_list enum_inherit_owner_vals
[] = {
323 {INHERIT_OWNER_NO
, "no"},
324 {INHERIT_OWNER_WINDOWS_AND_UNIX
, "windows and unix"},
325 {INHERIT_OWNER_WINDOWS_AND_UNIX
, "yes"},
326 {INHERIT_OWNER_UNIX_ONLY
, "unix only"},
329 static const struct enum_list enum_mangled_names
[] = {
330 {MANGLED_NAMES_NO
, "no"},
331 {MANGLED_NAMES_NO
, "false"},
332 {MANGLED_NAMES_NO
, "0"},
333 {MANGLED_NAMES_ILLEGAL
, "illegal"},
334 {MANGLED_NAMES_YES
, "yes"},
335 {MANGLED_NAMES_YES
, "true"},
336 {MANGLED_NAMES_YES
, "1"},
340 static const struct enum_list enum_ntlm_auth
[] = {
341 {NTLM_AUTH_DISABLED
, "disabled"},
342 {NTLM_AUTH_NTLMV2_ONLY
, "ntlmv2-only"},
343 {NTLM_AUTH_NTLMV2_ONLY
, "no"},
344 {NTLM_AUTH_NTLMV2_ONLY
, "false"},
345 {NTLM_AUTH_NTLMV2_ONLY
, "0"},
346 {NTLM_AUTH_ON
, "ntlmv1-permitted"},
347 {NTLM_AUTH_ON
, "yes"},
348 {NTLM_AUTH_ON
, "true"},
350 {NTLM_AUTH_MSCHAPv2_NTLMV2_ONLY
, "mschapv2-and-ntlmv2-only"},
354 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
356 * NOTE: Handling of duplicated (synonym) parameters:
357 * Parameters that are synonymous are stored in the same variable.
358 * All but the default spelling carry the flag FLAG_SYNONYM.
361 #define GLOBAL_VAR(name) offsetof(struct loadparm_global, name)
362 #define LOCAL_VAR(name) offsetof(struct loadparm_service, name)
364 #include "lib/param/param_table_gen.c"
366 int num_parameters(void)
368 return (sizeof(parm_table
) / sizeof(struct parm_struct
));