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