Avoid including libds/common/roles.h in public loadparm.h header.
[kai/samba-autobuild/.git] / lib / param / param_table.c
1 /*
2    Unix SMB/CIFS implementation.
3    Parameter loading functions
4    Copyright (C) Karl Auer 1993-1998
5
6    Largely re-written by Andrew Tridgell, September 1994
7
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
15
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.
20
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.
25
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/>.
28 */
29
30 #include "includes.h"
31 #include "lib/param/param.h"
32 #include "lib/param/loadparm.h"
33 #include "lib/param/param_global.h"
34 #include "libcli/smb/smb_constants.h"
35 #include "libds/common/roles.h"
36
37 #ifndef N_
38 #define N_(x) x
39 #endif
40
41 static const struct enum_list enum_protocol[] = {
42         {PROTOCOL_DEFAULT, "default"}, /* the caller decides what this means */
43         {PROTOCOL_SMB2_10, "SMB2"}, /* for now keep PROTOCOL_SMB2_10 */
44         {PROTOCOL_SMB3_11, "SMB3"}, /* for now keep PROTOCOL_SMB3_11 */
45         {PROTOCOL_SMB3_11, "SMB3_11"},
46         {PROTOCOL_SMB3_10, "SMB3_10"},
47         {PROTOCOL_SMB3_02, "SMB3_02"},
48         {PROTOCOL_SMB3_00, "SMB3_00"},
49         {PROTOCOL_SMB2_24, "SMB2_24"},
50         {PROTOCOL_SMB2_22, "SMB2_22"},
51         {PROTOCOL_SMB2_10, "SMB2_10"},
52         {PROTOCOL_SMB2_02, "SMB2_02"},
53         {PROTOCOL_NT1, "NT1"},
54         {PROTOCOL_LANMAN2, "LANMAN2"},
55         {PROTOCOL_LANMAN1, "LANMAN1"},
56         {PROTOCOL_CORE, "CORE"},
57         {PROTOCOL_COREPLUS, "COREPLUS"},
58         {PROTOCOL_COREPLUS, "CORE+"},
59         {-1, NULL}
60 };
61
62 static const struct enum_list enum_security[] = {
63         {SEC_AUTO, "AUTO"},
64         {SEC_USER, "USER"},
65         {SEC_DOMAIN, "DOMAIN"},
66         {SEC_ADS, "ADS"},
67         {-1, NULL}
68 };
69
70 static const struct enum_list enum_bool_auto[] = {
71         {false, "No"},
72         {false, "False"},
73         {false, "0"},
74         {true, "Yes"},
75         {true, "True"},
76         {true, "1"},
77         {Auto, "Auto"},
78         {-1, NULL}
79 };
80
81 static const struct enum_list enum_csc_policy[] = {
82         {CSC_POLICY_MANUAL, "manual"},
83         {CSC_POLICY_DOCUMENTS, "documents"},
84         {CSC_POLICY_PROGRAMS, "programs"},
85         {CSC_POLICY_DISABLE, "disable"},
86         {-1, NULL}
87 };
88
89 /* Server role options */
90 static const struct enum_list enum_server_role[] = {
91         {ROLE_AUTO, "auto"},
92         {ROLE_STANDALONE, "standalone server"},
93         {ROLE_STANDALONE, "standalone"},
94         {ROLE_DOMAIN_MEMBER, "member server"},
95         {ROLE_DOMAIN_MEMBER, "member"},
96         {ROLE_DOMAIN_PDC, "classic primary domain controller"},
97         {ROLE_DOMAIN_BDC, "classic backup domain controller"},
98         {ROLE_ACTIVE_DIRECTORY_DC, "active directory domain controller"},
99         {ROLE_ACTIVE_DIRECTORY_DC, "domain controller"},
100         {ROLE_ACTIVE_DIRECTORY_DC, "dc"},
101         {-1, NULL}
102 };
103
104 /* SMB signing types. */
105 static const struct enum_list enum_smb_signing_vals[] = {
106         {SMB_SIGNING_DEFAULT, "default"},
107         {SMB_SIGNING_OFF, "No"},
108         {SMB_SIGNING_OFF, "False"},
109         {SMB_SIGNING_OFF, "0"},
110         {SMB_SIGNING_OFF, "Off"},
111         {SMB_SIGNING_OFF, "disabled"},
112         {SMB_SIGNING_IF_REQUIRED, "if_required"},
113         {SMB_SIGNING_IF_REQUIRED, "Yes"},
114         {SMB_SIGNING_IF_REQUIRED, "True"},
115         {SMB_SIGNING_IF_REQUIRED, "1"},
116         {SMB_SIGNING_IF_REQUIRED, "On"},
117         {SMB_SIGNING_IF_REQUIRED, "enabled"},
118         {SMB_SIGNING_IF_REQUIRED, "auto"},
119         {SMB_SIGNING_DESIRED, "desired"},
120         {SMB_SIGNING_REQUIRED, "required"},
121         {SMB_SIGNING_REQUIRED, "mandatory"},
122         {SMB_SIGNING_REQUIRED, "force"},
123         {SMB_SIGNING_REQUIRED, "forced"},
124         {SMB_SIGNING_REQUIRED, "enforced"},
125         {-1, NULL}
126 };
127
128 /* DNS update options. */
129 static const struct enum_list enum_dns_update_settings[] = {
130         {DNS_UPDATE_OFF, "disabled"},
131         {DNS_UPDATE_OFF, "No"},
132         {DNS_UPDATE_OFF, "False"},
133         {DNS_UPDATE_OFF, "0"},
134         {DNS_UPDATE_OFF, "Off"},
135         {DNS_UPDATE_ON, "nonsecure and secure"},
136         {DNS_UPDATE_ON, "nonsecure"},
137         {DNS_UPDATE_SIGNED, "secure only"},
138         {DNS_UPDATE_SIGNED, "secure"},
139         {DNS_UPDATE_SIGNED, "signed"},
140         {-1, NULL}
141 };
142
143 /*
144    Do you want session setups at user level security with a invalid
145    password to be rejected or allowed in as guest? WinNT rejects them
146    but it can be a pain as it means "net view" needs to use a password
147
148    You have 3 choices in the setting of map_to_guest:
149
150    "Never" means session setups with an invalid password
151    are rejected. This is the default.
152
153    "Bad User" means session setups with an invalid password
154    are rejected, unless the username does not exist, in which case it
155    is treated as a guest login
156
157    "Bad Password" means session setups with an invalid password
158    are treated as a guest login
159
160    Note that map_to_guest only has an effect in user or server
161    level security.
162 */
163
164 static const struct enum_list enum_map_to_guest[] = {
165         {NEVER_MAP_TO_GUEST, "Never"},
166         {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
167         {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
168         {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},
169         {-1, NULL}
170 };
171
172 /* Config backend options */
173
174 static const struct enum_list enum_config_backend[] = {
175         {CONFIG_BACKEND_FILE, "file"},
176         {CONFIG_BACKEND_REGISTRY, "registry"},
177         {-1, NULL}
178 };
179
180 static const struct enum_list enum_smbd_profiling_level[] = {
181         {0, "off"}, {1, "count"}, {2, "on"}, {-1, NULL}
182 };
183
184
185 /* ADS kerberos ticket verification options */
186
187 static const struct enum_list enum_kerberos_method[] = {
188         {KERBEROS_VERIFY_SECRETS, "default"},
189         {KERBEROS_VERIFY_SECRETS, "secrets only"},
190         {KERBEROS_VERIFY_SYSTEM_KEYTAB, "system keytab"},
191         {KERBEROS_VERIFY_DEDICATED_KEYTAB, "dedicated keytab"},
192         {KERBEROS_VERIFY_SECRETS_AND_KEYTAB, "secrets and keytab"},
193         {-1, NULL}
194 };
195
196 static const struct enum_list enum_printing[] = {
197         {PRINT_SYSV, "sysv"},
198         {PRINT_AIX, "aix"},
199         {PRINT_HPUX, "hpux"},
200         {PRINT_BSD, "bsd"},
201         {PRINT_QNX, "qnx"},
202         {PRINT_PLP, "plp"},
203         {PRINT_LPRNG, "lprng"},
204 #ifdef HAVE_CUPS
205         {PRINT_CUPS, "cups"},
206 #endif
207 #ifdef HAVE_IPRINT
208         {PRINT_IPRINT, "iprint"},
209 #endif
210         {PRINT_LPRNT, "nt"},
211         {PRINT_LPROS2, "os2"},
212 #if defined(DEVELOPER) || defined(ENABLE_SELFTEST)
213         {PRINT_TEST, "test"},
214         {PRINT_VLP, "vlp"},
215 #endif /* DEVELOPER */
216         {-1, NULL}
217 };
218
219 static const struct enum_list enum_ldap_sasl_wrapping[] = {
220         {0, "plain"},
221         {ADS_AUTH_SASL_SIGN, "sign"},
222         {ADS_AUTH_SASL_SEAL, "seal"},
223         {-1, NULL}
224 };
225
226 static const struct enum_list enum_ldap_ssl[] = {
227         {LDAP_SSL_OFF, "no"},
228         {LDAP_SSL_OFF, "off"},
229         {LDAP_SSL_START_TLS, "start tls"},
230         {LDAP_SSL_START_TLS, "start_tls"},
231         {-1, NULL}
232 };
233
234 /* LDAP Dereferencing Alias types */
235 #define SAMBA_LDAP_DEREF_NEVER          0
236 #define SAMBA_LDAP_DEREF_SEARCHING      1
237 #define SAMBA_LDAP_DEREF_FINDING        2
238 #define SAMBA_LDAP_DEREF_ALWAYS         3
239
240 static const struct enum_list enum_ldap_deref[] = {
241         {SAMBA_LDAP_DEREF_NEVER, "never"},
242         {SAMBA_LDAP_DEREF_SEARCHING, "searching"},
243         {SAMBA_LDAP_DEREF_FINDING, "finding"},
244         {SAMBA_LDAP_DEREF_ALWAYS, "always"},
245         {-1, "auto"}
246 };
247
248 static const struct enum_list enum_ldap_passwd_sync[] = {
249         {LDAP_PASSWD_SYNC_OFF, "no"},
250         {LDAP_PASSWD_SYNC_OFF, "off"},
251         {LDAP_PASSWD_SYNC_ON, "yes"},
252         {LDAP_PASSWD_SYNC_ON, "on"},
253         {LDAP_PASSWD_SYNC_ONLY, "only"},
254         {-1, NULL}
255 };
256
257 static const struct enum_list enum_map_readonly[] = {
258         {MAP_READONLY_NO, "no"},
259         {MAP_READONLY_NO, "false"},
260         {MAP_READONLY_NO, "0"},
261         {MAP_READONLY_YES, "yes"},
262         {MAP_READONLY_YES, "true"},
263         {MAP_READONLY_YES, "1"},
264         {MAP_READONLY_PERMISSIONS, "permissions"},
265         {MAP_READONLY_PERMISSIONS, "perms"},
266         {-1, NULL}
267 };
268
269 static const struct enum_list enum_case[] = {
270         {CASE_LOWER, "lower"},
271         {CASE_UPPER, "upper"},
272         {-1, NULL}
273 };
274
275
276 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
277  *
278  * NOTE: Handling of duplicated (synonym) parameters:
279  *   Parameters that are synonymous are stored in the same variable.
280  *   All but the default spelling carry the flag FLAG_SYNONYM.
281  */
282
283 #define GLOBAL_VAR(name) offsetof(struct loadparm_global, name)
284 #define LOCAL_VAR(name) offsetof(struct loadparm_service, name)
285
286 #include "lib/param/param_table_gen.c"
287
288 int num_parameters(void)
289 {
290         return (sizeof(parm_table) / sizeof(struct parm_struct));
291 }