lib/param: Rename param_enums.c to param_table.c
[Samba/gebeck_regimport.git] / source3 / param / loadparm.c
bloba116531ebd547ca37a9905ab97303ad785e4986c
1 /*
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 * Load parameters.
33 * This module provides suitable callback functions for the params
34 * module. It builds the internal table of service details which is
35 * then used by the rest of the server.
37 * To add a parameter:
39 * 1) add it to the global or service structure definition
40 * 2) add it to the parm_table
41 * 3) add it to the list of available functions (eg: using FN_GLOBAL_STRING())
42 * 4) If it's a global then initialise it in init_globals. If a local
43 * (ie. service) parameter then initialise it in the sDefault structure
46 * Notes:
47 * The configuration file is processed sequentially for speed. It is NOT
48 * accessed randomly as happens in 'real' Windows. For this reason, there
49 * is a fair bit of sequence-dependent code here - ie., code which assumes
50 * that certain things happen before others. In particular, the code which
51 * happens at the boundary between sections is delicately poised, so be
52 * careful!
56 #include "includes.h"
57 #include "system/filesys.h"
58 #include "util_tdb.h"
59 #include "printing.h"
60 #include "lib/smbconf/smbconf.h"
61 #include "lib/smbconf/smbconf_init.h"
62 #include "lib/param/loadparm.h"
64 #include "ads.h"
65 #include "../librpc/gen_ndr/svcctl.h"
66 #include "intl.h"
67 #include "../libcli/smb/smb_signing.h"
68 #include "dbwrap/dbwrap.h"
69 #include "dbwrap/dbwrap_rbt.h"
70 #include "../lib/util/bitmap.h"
71 #include "../source4/dns_server/dns_update.h"
73 #ifdef HAVE_SYS_SYSCTL_H
74 #include <sys/sysctl.h>
75 #endif
77 #ifdef HAVE_HTTPCONNECTENCRYPT
78 #include <cups/http.h>
79 #endif
81 #ifdef CLUSTER_SUPPORT
82 #include "ctdb_private.h"
83 #endif
85 bool bLoaded = false;
87 extern userdom_struct current_user_info;
89 /* the special value for the include parameter
90 * to be interpreted not as a file name but to
91 * trigger loading of the global smb.conf options
92 * from registry. */
93 #ifndef INCLUDE_REGISTRY_NAME
94 #define INCLUDE_REGISTRY_NAME "registry"
95 #endif
97 static bool in_client = false; /* Not in the client by default */
98 static struct smbconf_csn conf_last_csn;
100 #define CONFIG_BACKEND_FILE 0
101 #define CONFIG_BACKEND_REGISTRY 1
103 static int config_backend = CONFIG_BACKEND_FILE;
105 /* some helpful bits */
106 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
107 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
109 #define USERSHARE_VALID 1
110 #define USERSHARE_PENDING_DELETE 2
112 static bool defaults_saved = false;
114 #define LOADPARM_EXTRA_GLOBALS \
115 struct parmlist_entry *param_opt; \
116 char *szRealm; \
117 char *loglevel; \
118 int iminreceivefile; \
119 char *szPrintcapname; \
120 int CupsEncrypt; \
121 int iPreferredMaster; \
122 int domain_master; \
123 char *szLdapMachineSuffix; \
124 char *szLdapUserSuffix; \
125 char *szLdapIdmapSuffix; \
126 char *szLdapGroupSuffix; \
127 char *szStateDir; \
128 char *szCacheDir; \
129 char *szSocketAddress; \
130 char *szUsershareTemplateShare; \
131 char *szIdmapUID; \
132 char *szIdmapGID; \
133 int winbindMaxDomainConnections; \
134 int ismb2_max_credits; \
135 char *tls_keyfile; \
136 char *tls_certfile; \
137 char *tls_cafile; \
138 char *tls_crlfile; \
139 char *tls_dhpfile; \
140 char *panic_action; \
141 int bPreferredMaster;
143 #include "param/param_global.h"
145 static struct loadparm_global Globals;
147 /* This is a default service used to prime a services structure */
148 static struct loadparm_service sDefault =
150 .valid = true,
151 .autoloaded = false,
152 .usershare = 0,
153 .usershare_last_mod = {0, 0},
154 .szService = NULL,
155 .szPath = NULL,
156 .szUsername = NULL,
157 .szInvalidUsers = NULL,
158 .szValidUsers = NULL,
159 .szAdminUsers = NULL,
160 .szCopy = NULL,
161 .szInclude = NULL,
162 .szPreExec = NULL,
163 .szPostExec = NULL,
164 .szRootPreExec = NULL,
165 .szRootPostExec = NULL,
166 .szCupsOptions = NULL,
167 .szPrintcommand = NULL,
168 .szLpqcommand = NULL,
169 .szLprmcommand = NULL,
170 .szLppausecommand = NULL,
171 .szLpresumecommand = NULL,
172 .szQueuepausecommand = NULL,
173 .szQueueresumecommand = NULL,
174 .szPrintername = NULL,
175 .szPrintjobUsername = NULL,
176 .szDontdescend = NULL,
177 .szHostsallow = NULL,
178 .szHostsdeny = NULL,
179 .szMagicScript = NULL,
180 .szMagicOutput = NULL,
181 .szVetoFiles = NULL,
182 .szHideFiles = NULL,
183 .szVetoOplockFiles = NULL,
184 .comment = NULL,
185 .force_user = NULL,
186 .force_group = NULL,
187 .readlist = NULL,
188 .writelist = NULL,
189 .volume = NULL,
190 .fstype = NULL,
191 .szVfsObjects = NULL,
192 .szMSDfsProxy = NULL,
193 .szAioWriteBehind = NULL,
194 .szDfree = NULL,
195 .iMinPrintSpace = 0,
196 .iMaxPrintJobs = 1000,
197 .iMaxReportedPrintJobs = 0,
198 .iWriteCacheSize = 0,
199 .iCreate_mask = 0744,
200 .iCreate_force_mode = 0,
201 .iSecurity_mask = 0777,
202 .iSecurity_force_mode = 0,
203 .iDir_mask = 0755,
204 .iDir_force_mode = 0,
205 .iDir_Security_mask = 0777,
206 .iDir_Security_force_mode = 0,
207 .iMaxConnections = 0,
208 .iDefaultCase = CASE_LOWER,
209 .iPrinting = DEFAULT_PRINTING,
210 .iOplockContentionLimit = 2,
211 .iCSCPolicy = 0,
212 .iBlock_size = 1024,
213 .iDfreeCacheTime = 0,
214 .bPreexecClose = false,
215 .bRootpreexecClose = false,
216 .iCaseSensitive = Auto,
217 .bCasePreserve = true,
218 .bShortCasePreserve = true,
219 .bHideDotFiles = true,
220 .bHideSpecialFiles = false,
221 .bHideUnReadable = false,
222 .bHideUnWriteableFiles = false,
223 .bBrowseable = true,
224 .bAccessBasedShareEnum = false,
225 .bAvailable = true,
226 .bRead_only = true,
227 .bNo_set_dir = true,
228 .bGuest_only = false,
229 .bAdministrative_share = false,
230 .bGuest_ok = false,
231 .bPrint_ok = false,
232 .bPrintNotifyBackchannel = true,
233 .bMap_system = false,
234 .bMap_hidden = false,
235 .bMap_archive = true,
236 .bStoreDosAttributes = false,
237 .bDmapiSupport = false,
238 .bLocking = true,
239 .iStrictLocking = Auto,
240 .bPosixLocking = true,
241 .bShareModes = true,
242 .bOpLocks = true,
243 .bKernelOplocks = false,
244 .bLevel2OpLocks = true,
245 .bOnlyUser = false,
246 .bMangledNames = true,
247 .bWidelinks = false,
248 .bSymlinks = true,
249 .bSyncAlways = false,
250 .bStrictAllocate = false,
251 .bStrictSync = false,
252 .magic_char = '~',
253 .copymap = NULL,
254 .bDeleteReadonly = false,
255 .bFakeOplocks = false,
256 .bDeleteVetoFiles = false,
257 .bDosFilemode = false,
258 .bDosFiletimes = true,
259 .bDosFiletimeResolution = false,
260 .bFakeDirCreateTimes = false,
261 .bBlockingLocks = true,
262 .bInheritPerms = false,
263 .bInheritACLS = false,
264 .bInheritOwner = false,
265 .bMSDfsRoot = false,
266 .bUseClientDriver = false,
267 .bDefaultDevmode = true,
268 .bForcePrintername = false,
269 .bNTAclSupport = true,
270 .bForceUnknownAclUser = false,
271 .bUseSendfile = false,
272 .bProfileAcls = false,
273 .bMap_acl_inherit = false,
274 .bAfs_Share = false,
275 .bEASupport = false,
276 .bAclCheckPermissions = true,
277 .bAclMapFullControl = true,
278 .bAclGroupControl = false,
279 .bChangeNotify = true,
280 .bKernelChangeNotify = true,
281 .iallocation_roundup_size = SMB_ROUNDUP_ALLOCATION_SIZE,
282 .iAioReadSize = 0,
283 .iAioWriteSize = 0,
284 .iMap_readonly = MAP_READONLY_YES,
285 #ifdef BROKEN_DIRECTORY_HANDLING
286 .iDirectoryNameCacheSize = 0,
287 #else
288 .iDirectoryNameCacheSize = 100,
289 #endif
290 .ismb_encrypt = Auto,
291 .param_opt = NULL,
292 .dummy = ""
295 /* local variables */
296 static struct loadparm_service **ServicePtrs = NULL;
297 static int iNumServices = 0;
298 static int iServiceIndex = 0;
299 static struct db_context *ServiceHash;
300 static int *invalid_services = NULL;
301 static int num_invalid_services = 0;
302 static bool bInGlobalSection = true;
303 static bool bGlobalOnly = false;
305 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
307 /* prototypes for the special type handlers */
308 static bool handle_include(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
309 static bool handle_copy(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
310 static bool handle_idmap_backend(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
311 static bool handle_idmap_uid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
312 static bool handle_idmap_gid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
313 static bool handle_debug_list(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr );
314 static bool handle_realm(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr );
315 static bool handle_netbios_aliases(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr );
316 static bool handle_charset(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr );
317 static bool handle_dos_charset(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr );
318 static bool handle_printing(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
319 static bool handle_ldap_debug_level(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr);
321 static void set_allowed_client_auth(void);
323 static void add_to_file_list(const char *fname, const char *subfname);
324 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values);
325 static void free_param_opts(struct parmlist_entry **popts);
327 #include "lib/param/param_table.c"
329 static const struct enum_list enum_printing[] = {
330 {PRINT_SYSV, "sysv"},
331 {PRINT_AIX, "aix"},
332 {PRINT_HPUX, "hpux"},
333 {PRINT_BSD, "bsd"},
334 {PRINT_QNX, "qnx"},
335 {PRINT_PLP, "plp"},
336 {PRINT_LPRNG, "lprng"},
337 {PRINT_CUPS, "cups"},
338 {PRINT_IPRINT, "iprint"},
339 {PRINT_LPRNT, "nt"},
340 {PRINT_LPROS2, "os2"},
341 #if defined(DEVELOPER) || defined(ENABLE_BUILD_FARM_HACKS)
342 {PRINT_TEST, "test"},
343 {PRINT_VLP, "vlp"},
344 #endif /* DEVELOPER */
345 {-1, NULL}
348 static const struct enum_list enum_ldap_sasl_wrapping[] = {
349 {0, "plain"},
350 {ADS_AUTH_SASL_SIGN, "sign"},
351 {ADS_AUTH_SASL_SEAL, "seal"},
352 {-1, NULL}
355 static const struct enum_list enum_ldap_ssl[] = {
356 {LDAP_SSL_OFF, "no"},
357 {LDAP_SSL_OFF, "off"},
358 {LDAP_SSL_START_TLS, "start tls"},
359 {LDAP_SSL_START_TLS, "start_tls"},
360 {-1, NULL}
363 /* LDAP Dereferencing Alias types */
364 #define SAMBA_LDAP_DEREF_NEVER 0
365 #define SAMBA_LDAP_DEREF_SEARCHING 1
366 #define SAMBA_LDAP_DEREF_FINDING 2
367 #define SAMBA_LDAP_DEREF_ALWAYS 3
369 static const struct enum_list enum_ldap_deref[] = {
370 {SAMBA_LDAP_DEREF_NEVER, "never"},
371 {SAMBA_LDAP_DEREF_SEARCHING, "searching"},
372 {SAMBA_LDAP_DEREF_FINDING, "finding"},
373 {SAMBA_LDAP_DEREF_ALWAYS, "always"},
374 {-1, "auto"}
377 static const struct enum_list enum_ldap_passwd_sync[] = {
378 {LDAP_PASSWD_SYNC_OFF, "no"},
379 {LDAP_PASSWD_SYNC_OFF, "off"},
380 {LDAP_PASSWD_SYNC_ON, "yes"},
381 {LDAP_PASSWD_SYNC_ON, "on"},
382 {LDAP_PASSWD_SYNC_ONLY, "only"},
383 {-1, NULL}
386 static const struct enum_list enum_map_readonly[] = {
387 {MAP_READONLY_NO, "no"},
388 {MAP_READONLY_NO, "false"},
389 {MAP_READONLY_NO, "0"},
390 {MAP_READONLY_YES, "yes"},
391 {MAP_READONLY_YES, "true"},
392 {MAP_READONLY_YES, "1"},
393 {MAP_READONLY_PERMISSIONS, "permissions"},
394 {MAP_READONLY_PERMISSIONS, "perms"},
395 {-1, NULL}
398 static const struct enum_list enum_case[] = {
399 {CASE_LOWER, "lower"},
400 {CASE_UPPER, "upper"},
401 {-1, NULL}
405 /* ACL compatibility options. */
406 static const struct enum_list enum_acl_compat_vals[] = {
407 { ACL_COMPAT_AUTO, "auto" },
408 { ACL_COMPAT_WINNT, "winnt" },
409 { ACL_COMPAT_WIN2K, "win2k" },
410 { -1, NULL}
414 Do you want session setups at user level security with a invalid
415 password to be rejected or allowed in as guest? WinNT rejects them
416 but it can be a pain as it means "net view" needs to use a password
418 You have 3 choices in the setting of map_to_guest:
420 "Never" means session setups with an invalid password
421 are rejected. This is the default.
423 "Bad User" means session setups with an invalid password
424 are rejected, unless the username does not exist, in which case it
425 is treated as a guest login
427 "Bad Password" means session setups with an invalid password
428 are treated as a guest login
430 Note that map_to_guest only has an effect in user or server
431 level security.
434 static const struct enum_list enum_map_to_guest[] = {
435 {NEVER_MAP_TO_GUEST, "Never"},
436 {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
437 {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
438 {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},
439 {-1, NULL}
442 /* Config backend options */
444 static const struct enum_list enum_config_backend[] = {
445 {CONFIG_BACKEND_FILE, "file"},
446 {CONFIG_BACKEND_REGISTRY, "registry"},
447 {-1, NULL}
450 /* ADS kerberos ticket verification options */
452 static const struct enum_list enum_kerberos_method[] = {
453 {KERBEROS_VERIFY_SECRETS, "default"},
454 {KERBEROS_VERIFY_SECRETS, "secrets only"},
455 {KERBEROS_VERIFY_SYSTEM_KEYTAB, "system keytab"},
456 {KERBEROS_VERIFY_DEDICATED_KEYTAB, "dedicated keytab"},
457 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB, "secrets and keytab"},
458 {-1, NULL}
461 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
463 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
464 * screen in SWAT. This is used to exclude parameters as well as to squash all
465 * parameters that have been duplicated by pseudonyms.
467 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
468 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
469 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
470 * respective views.
472 * NOTE2: Handling of duplicated (synonym) parameters:
473 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
474 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
475 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
476 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
479 #define GLOBAL_VAR(name) offsetof(struct loadparm_global, name)
480 #define LOCAL_VAR(name) offsetof(struct loadparm_service, name)
483 static struct parm_struct parm_table[] = {
484 {N_("Base Options"), P_SEP, P_SEPARATOR},
487 .label = "dos charset",
488 .type = P_STRING,
489 .p_class = P_GLOBAL,
490 .offset = GLOBAL_VAR(dos_charset),
491 .special = handle_dos_charset,
492 .enum_list = NULL,
493 .flags = FLAG_ADVANCED
496 .label = "unix charset",
497 .type = P_STRING,
498 .p_class = P_GLOBAL,
499 .offset = GLOBAL_VAR(unix_charset),
500 .special = handle_charset,
501 .enum_list = NULL,
502 .flags = FLAG_ADVANCED
505 .label = "comment",
506 .type = P_STRING,
507 .p_class = P_LOCAL,
508 .offset = LOCAL_VAR(comment),
509 .special = NULL,
510 .enum_list = NULL,
511 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT
514 .label = "path",
515 .type = P_STRING,
516 .p_class = P_LOCAL,
517 .offset = LOCAL_VAR(szPath),
518 .special = NULL,
519 .enum_list = NULL,
520 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
523 .label = "directory",
524 .type = P_STRING,
525 .p_class = P_LOCAL,
526 .offset = LOCAL_VAR(szPath),
527 .special = NULL,
528 .enum_list = NULL,
529 .flags = FLAG_HIDE,
532 .label = "workgroup",
533 .type = P_USTRING,
534 .p_class = P_GLOBAL,
535 .offset = GLOBAL_VAR(szWorkgroup),
536 .special = NULL,
537 .enum_list = NULL,
538 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
541 .label = "realm",
542 .type = P_STRING,
543 .p_class = P_GLOBAL,
544 .offset = GLOBAL_VAR(szRealm),
545 .special = handle_realm,
546 .enum_list = NULL,
547 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
550 .label = "netbios name",
551 .type = P_USTRING,
552 .p_class = P_GLOBAL,
553 .offset = GLOBAL_VAR(szNetbiosName),
554 .special = NULL,
555 .enum_list = NULL,
556 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
559 .label = "netbios aliases",
560 .type = P_LIST,
561 .p_class = P_GLOBAL,
562 .offset = GLOBAL_VAR(szNetbiosAliases),
563 .special = handle_netbios_aliases,
564 .enum_list = NULL,
565 .flags = FLAG_ADVANCED,
568 .label = "netbios scope",
569 .type = P_USTRING,
570 .p_class = P_GLOBAL,
571 .offset = GLOBAL_VAR(szNetbiosScope),
572 .special = NULL,
573 .enum_list = NULL,
574 .flags = FLAG_ADVANCED,
577 .label = "server string",
578 .type = P_STRING,
579 .p_class = P_GLOBAL,
580 .offset = GLOBAL_VAR(szServerString),
581 .special = NULL,
582 .enum_list = NULL,
583 .flags = FLAG_BASIC | FLAG_ADVANCED,
586 .label = "interfaces",
587 .type = P_LIST,
588 .p_class = P_GLOBAL,
589 .offset = GLOBAL_VAR(szInterfaces),
590 .special = NULL,
591 .enum_list = NULL,
592 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
595 .label = "bind interfaces only",
596 .type = P_BOOL,
597 .p_class = P_GLOBAL,
598 .offset = GLOBAL_VAR(bBindInterfacesOnly),
599 .special = NULL,
600 .enum_list = NULL,
601 .flags = FLAG_ADVANCED | FLAG_WIZARD,
604 .label = "config backend",
605 .type = P_ENUM,
606 .p_class = P_GLOBAL,
607 .offset = GLOBAL_VAR(ConfigBackend),
608 .special = NULL,
609 .enum_list = enum_config_backend,
610 .flags = FLAG_HIDE|FLAG_ADVANCED|FLAG_META,
613 .label = "server role",
614 .type = P_ENUM,
615 .p_class = P_GLOBAL,
616 .offset = GLOBAL_VAR(server_role),
617 .special = NULL,
618 .enum_list = enum_server_role,
619 .flags = FLAG_BASIC | FLAG_ADVANCED,
622 {N_("Security Options"), P_SEP, P_SEPARATOR},
625 .label = "security",
626 .type = P_ENUM,
627 .p_class = P_GLOBAL,
628 .offset = GLOBAL_VAR(security),
629 .special = NULL,
630 .enum_list = enum_security,
631 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
634 .label = "auth methods",
635 .type = P_LIST,
636 .p_class = P_GLOBAL,
637 .offset = GLOBAL_VAR(AuthMethods),
638 .special = NULL,
639 .enum_list = NULL,
640 .flags = FLAG_ADVANCED,
643 .label = "encrypt passwords",
644 .type = P_BOOL,
645 .p_class = P_GLOBAL,
646 .offset = GLOBAL_VAR(bEncryptPasswords),
647 .special = NULL,
648 .enum_list = NULL,
649 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
652 .label = "client schannel",
653 .type = P_ENUM,
654 .p_class = P_GLOBAL,
655 .offset = GLOBAL_VAR(clientSchannel),
656 .special = NULL,
657 .enum_list = enum_bool_auto,
658 .flags = FLAG_BASIC | FLAG_ADVANCED,
661 .label = "server schannel",
662 .type = P_ENUM,
663 .p_class = P_GLOBAL,
664 .offset = GLOBAL_VAR(serverSchannel),
665 .special = NULL,
666 .enum_list = enum_bool_auto,
667 .flags = FLAG_BASIC | FLAG_ADVANCED,
670 .label = "allow trusted domains",
671 .type = P_BOOL,
672 .p_class = P_GLOBAL,
673 .offset = GLOBAL_VAR(bAllowTrustedDomains),
674 .special = NULL,
675 .enum_list = NULL,
676 .flags = FLAG_ADVANCED,
679 .label = "map to guest",
680 .type = P_ENUM,
681 .p_class = P_GLOBAL,
682 .offset = GLOBAL_VAR(map_to_guest),
683 .special = NULL,
684 .enum_list = enum_map_to_guest,
685 .flags = FLAG_ADVANCED,
688 .label = "null passwords",
689 .type = P_BOOL,
690 .p_class = P_GLOBAL,
691 .offset = GLOBAL_VAR(bNullPasswords),
692 .special = NULL,
693 .enum_list = NULL,
694 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
697 .label = "obey pam restrictions",
698 .type = P_BOOL,
699 .p_class = P_GLOBAL,
700 .offset = GLOBAL_VAR(bObeyPamRestrictions),
701 .special = NULL,
702 .enum_list = NULL,
703 .flags = FLAG_ADVANCED,
706 .label = "password server",
707 .type = P_STRING,
708 .p_class = P_GLOBAL,
709 .offset = GLOBAL_VAR(szPasswordServer),
710 .special = NULL,
711 .enum_list = NULL,
712 .flags = FLAG_ADVANCED | FLAG_WIZARD,
715 .label = "smb passwd file",
716 .type = P_STRING,
717 .p_class = P_GLOBAL,
718 .offset = GLOBAL_VAR(szSMBPasswdFile),
719 .special = NULL,
720 .enum_list = NULL,
721 .flags = FLAG_ADVANCED,
724 .label = "private dir",
725 .type = P_STRING,
726 .p_class = P_GLOBAL,
727 .offset = GLOBAL_VAR(szPrivateDir),
728 .special = NULL,
729 .enum_list = NULL,
730 .flags = FLAG_ADVANCED,
733 .label = "private directory",
734 .type = P_STRING,
735 .p_class = P_GLOBAL,
736 .offset = GLOBAL_VAR(szPrivateDir),
737 .special = NULL,
738 .enum_list = NULL,
739 .flags = FLAG_HIDE,
742 .label = "passdb backend",
743 .type = P_STRING,
744 .p_class = P_GLOBAL,
745 .offset = GLOBAL_VAR(passdb_backend),
746 .special = NULL,
747 .enum_list = NULL,
748 .flags = FLAG_ADVANCED | FLAG_WIZARD,
751 .label = "algorithmic rid base",
752 .type = P_INTEGER,
753 .p_class = P_GLOBAL,
754 .offset = GLOBAL_VAR(AlgorithmicRidBase),
755 .special = NULL,
756 .enum_list = NULL,
757 .flags = FLAG_ADVANCED,
760 .label = "root directory",
761 .type = P_STRING,
762 .p_class = P_GLOBAL,
763 .offset = GLOBAL_VAR(szRootdir),
764 .special = NULL,
765 .enum_list = NULL,
766 .flags = FLAG_ADVANCED,
769 .label = "root dir",
770 .type = P_STRING,
771 .p_class = P_GLOBAL,
772 .offset = GLOBAL_VAR(szRootdir),
773 .special = NULL,
774 .enum_list = NULL,
775 .flags = FLAG_HIDE,
778 .label = "root",
779 .type = P_STRING,
780 .p_class = P_GLOBAL,
781 .offset = GLOBAL_VAR(szRootdir),
782 .special = NULL,
783 .enum_list = NULL,
784 .flags = FLAG_HIDE,
787 .label = "guest account",
788 .type = P_STRING,
789 .p_class = P_GLOBAL,
790 .offset = GLOBAL_VAR(szGuestaccount),
791 .special = NULL,
792 .enum_list = NULL,
793 .flags = FLAG_BASIC | FLAG_ADVANCED,
796 .label = "enable privileges",
797 .type = P_BOOL,
798 .p_class = P_GLOBAL,
799 .offset = GLOBAL_VAR(bEnablePrivileges),
800 .special = NULL,
801 .enum_list = NULL,
802 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
806 .label = "pam password change",
807 .type = P_BOOL,
808 .p_class = P_GLOBAL,
809 .offset = GLOBAL_VAR(bPamPasswordChange),
810 .special = NULL,
811 .enum_list = NULL,
812 .flags = FLAG_ADVANCED,
815 .label = "passwd program",
816 .type = P_STRING,
817 .p_class = P_GLOBAL,
818 .offset = GLOBAL_VAR(szPasswdProgram),
819 .special = NULL,
820 .enum_list = NULL,
821 .flags = FLAG_ADVANCED,
824 .label = "passwd chat",
825 .type = P_STRING,
826 .p_class = P_GLOBAL,
827 .offset = GLOBAL_VAR(szPasswdChat),
828 .special = NULL,
829 .enum_list = NULL,
830 .flags = FLAG_ADVANCED,
833 .label = "passwd chat debug",
834 .type = P_BOOL,
835 .p_class = P_GLOBAL,
836 .offset = GLOBAL_VAR(bPasswdChatDebug),
837 .special = NULL,
838 .enum_list = NULL,
839 .flags = FLAG_ADVANCED,
842 .label = "passwd chat timeout",
843 .type = P_INTEGER,
844 .p_class = P_GLOBAL,
845 .offset = GLOBAL_VAR(iPasswdChatTimeout),
846 .special = NULL,
847 .enum_list = NULL,
848 .flags = FLAG_ADVANCED,
851 .label = "check password script",
852 .type = P_STRING,
853 .p_class = P_GLOBAL,
854 .offset = GLOBAL_VAR(szCheckPasswordScript),
855 .special = NULL,
856 .enum_list = NULL,
857 .flags = FLAG_ADVANCED,
860 .label = "username map",
861 .type = P_STRING,
862 .p_class = P_GLOBAL,
863 .offset = GLOBAL_VAR(szUsernameMap),
864 .special = NULL,
865 .enum_list = NULL,
866 .flags = FLAG_ADVANCED,
869 .label = "password level",
870 .type = P_INTEGER,
871 .p_class = P_GLOBAL,
872 .offset = GLOBAL_VAR(pwordlevel),
873 .special = NULL,
874 .enum_list = NULL,
875 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
878 .label = "username level",
879 .type = P_INTEGER,
880 .p_class = P_GLOBAL,
881 .offset = GLOBAL_VAR(unamelevel),
882 .special = NULL,
883 .enum_list = NULL,
884 .flags = FLAG_ADVANCED,
887 .label = "unix password sync",
888 .type = P_BOOL,
889 .p_class = P_GLOBAL,
890 .offset = GLOBAL_VAR(bUnixPasswdSync),
891 .special = NULL,
892 .enum_list = NULL,
893 .flags = FLAG_ADVANCED,
896 .label = "restrict anonymous",
897 .type = P_INTEGER,
898 .p_class = P_GLOBAL,
899 .offset = GLOBAL_VAR(restrict_anonymous),
900 .special = NULL,
901 .enum_list = NULL,
902 .flags = FLAG_ADVANCED,
905 .label = "lanman auth",
906 .type = P_BOOL,
907 .p_class = P_GLOBAL,
908 .offset = GLOBAL_VAR(bLanmanAuth),
909 .special = NULL,
910 .enum_list = NULL,
911 .flags = FLAG_ADVANCED,
914 .label = "ntlm auth",
915 .type = P_BOOL,
916 .p_class = P_GLOBAL,
917 .offset = GLOBAL_VAR(bNTLMAuth),
918 .special = NULL,
919 .enum_list = NULL,
920 .flags = FLAG_ADVANCED,
923 .label = "client NTLMv2 auth",
924 .type = P_BOOL,
925 .p_class = P_GLOBAL,
926 .offset = GLOBAL_VAR(bClientNTLMv2Auth),
927 .special = NULL,
928 .enum_list = NULL,
929 .flags = FLAG_ADVANCED,
932 .label = "client lanman auth",
933 .type = P_BOOL,
934 .p_class = P_GLOBAL,
935 .offset = GLOBAL_VAR(bClientLanManAuth),
936 .special = NULL,
937 .enum_list = NULL,
938 .flags = FLAG_ADVANCED,
941 .label = "client plaintext auth",
942 .type = P_BOOL,
943 .p_class = P_GLOBAL,
944 .offset = GLOBAL_VAR(bClientPlaintextAuth),
945 .special = NULL,
946 .enum_list = NULL,
947 .flags = FLAG_ADVANCED,
950 .label = "client use spnego principal",
951 .type = P_BOOL,
952 .p_class = P_GLOBAL,
953 .offset = GLOBAL_VAR(client_use_spnego_principal),
954 .special = NULL,
955 .enum_list = NULL,
956 .flags = FLAG_ADVANCED,
959 .label = "username",
960 .type = P_STRING,
961 .p_class = P_LOCAL,
962 .offset = LOCAL_VAR(szUsername),
963 .special = NULL,
964 .enum_list = NULL,
965 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE | FLAG_DEPRECATED,
968 .label = "user",
969 .type = P_STRING,
970 .p_class = P_LOCAL,
971 .offset = LOCAL_VAR(szUsername),
972 .special = NULL,
973 .enum_list = NULL,
974 .flags = FLAG_HIDE,
977 .label = "users",
978 .type = P_STRING,
979 .p_class = P_LOCAL,
980 .offset = LOCAL_VAR(szUsername),
981 .special = NULL,
982 .enum_list = NULL,
983 .flags = FLAG_HIDE,
986 .label = "invalid users",
987 .type = P_LIST,
988 .p_class = P_LOCAL,
989 .offset = LOCAL_VAR(szInvalidUsers),
990 .special = NULL,
991 .enum_list = NULL,
992 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
995 .label = "valid users",
996 .type = P_LIST,
997 .p_class = P_LOCAL,
998 .offset = LOCAL_VAR(szValidUsers),
999 .special = NULL,
1000 .enum_list = NULL,
1001 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1004 .label = "admin users",
1005 .type = P_LIST,
1006 .p_class = P_LOCAL,
1007 .offset = LOCAL_VAR(szAdminUsers),
1008 .special = NULL,
1009 .enum_list = NULL,
1010 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1013 .label = "read list",
1014 .type = P_LIST,
1015 .p_class = P_LOCAL,
1016 .offset = LOCAL_VAR(readlist),
1017 .special = NULL,
1018 .enum_list = NULL,
1019 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1022 .label = "write list",
1023 .type = P_LIST,
1024 .p_class = P_LOCAL,
1025 .offset = LOCAL_VAR(writelist),
1026 .special = NULL,
1027 .enum_list = NULL,
1028 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1031 .label = "force user",
1032 .type = P_STRING,
1033 .p_class = P_LOCAL,
1034 .offset = LOCAL_VAR(force_user),
1035 .special = NULL,
1036 .enum_list = NULL,
1037 .flags = FLAG_ADVANCED | FLAG_SHARE,
1040 .label = "force group",
1041 .type = P_STRING,
1042 .p_class = P_LOCAL,
1043 .offset = LOCAL_VAR(force_group),
1044 .special = NULL,
1045 .enum_list = NULL,
1046 .flags = FLAG_ADVANCED | FLAG_SHARE,
1049 .label = "group",
1050 .type = P_STRING,
1051 .p_class = P_LOCAL,
1052 .offset = LOCAL_VAR(force_group),
1053 .special = NULL,
1054 .enum_list = NULL,
1055 .flags = FLAG_ADVANCED,
1058 .label = "read only",
1059 .type = P_BOOL,
1060 .p_class = P_LOCAL,
1061 .offset = LOCAL_VAR(bRead_only),
1062 .special = NULL,
1063 .enum_list = NULL,
1064 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE,
1067 .label = "write ok",
1068 .type = P_BOOLREV,
1069 .p_class = P_LOCAL,
1070 .offset = LOCAL_VAR(bRead_only),
1071 .special = NULL,
1072 .enum_list = NULL,
1073 .flags = FLAG_HIDE,
1076 .label = "writeable",
1077 .type = P_BOOLREV,
1078 .p_class = P_LOCAL,
1079 .offset = LOCAL_VAR(bRead_only),
1080 .special = NULL,
1081 .enum_list = NULL,
1082 .flags = FLAG_HIDE,
1085 .label = "writable",
1086 .type = P_BOOLREV,
1087 .p_class = P_LOCAL,
1088 .offset = LOCAL_VAR(bRead_only),
1089 .special = NULL,
1090 .enum_list = NULL,
1091 .flags = FLAG_HIDE,
1094 .label = "acl check permissions",
1095 .type = P_BOOL,
1096 .p_class = P_LOCAL,
1097 .offset = LOCAL_VAR(bAclCheckPermissions),
1098 .special = NULL,
1099 .enum_list = NULL,
1100 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE | FLAG_DEPRECATED,
1103 .label = "acl group control",
1104 .type = P_BOOL,
1105 .p_class = P_LOCAL,
1106 .offset = LOCAL_VAR(bAclGroupControl),
1107 .special = NULL,
1108 .enum_list = NULL,
1109 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1112 .label = "acl map full control",
1113 .type = P_BOOL,
1114 .p_class = P_LOCAL,
1115 .offset = LOCAL_VAR(bAclMapFullControl),
1116 .special = NULL,
1117 .enum_list = NULL,
1118 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1121 .label = "create mask",
1122 .type = P_OCTAL,
1123 .p_class = P_LOCAL,
1124 .offset = LOCAL_VAR(iCreate_mask),
1125 .special = NULL,
1126 .enum_list = NULL,
1127 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1130 .label = "create mode",
1131 .type = P_OCTAL,
1132 .p_class = P_LOCAL,
1133 .offset = LOCAL_VAR(iCreate_mask),
1134 .special = NULL,
1135 .enum_list = NULL,
1136 .flags = FLAG_HIDE,
1139 .label = "force create mode",
1140 .type = P_OCTAL,
1141 .p_class = P_LOCAL,
1142 .offset = LOCAL_VAR(iCreate_force_mode),
1143 .special = NULL,
1144 .enum_list = NULL,
1145 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1148 .label = "security mask",
1149 .type = P_OCTAL,
1150 .p_class = P_LOCAL,
1151 .offset = LOCAL_VAR(iSecurity_mask),
1152 .special = NULL,
1153 .enum_list = NULL,
1154 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1157 .label = "force security mode",
1158 .type = P_OCTAL,
1159 .p_class = P_LOCAL,
1160 .offset = LOCAL_VAR(iSecurity_force_mode),
1161 .special = NULL,
1162 .enum_list = NULL,
1163 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1166 .label = "directory mask",
1167 .type = P_OCTAL,
1168 .p_class = P_LOCAL,
1169 .offset = LOCAL_VAR(iDir_mask),
1170 .special = NULL,
1171 .enum_list = NULL,
1172 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1175 .label = "directory mode",
1176 .type = P_OCTAL,
1177 .p_class = P_LOCAL,
1178 .offset = LOCAL_VAR(iDir_mask),
1179 .special = NULL,
1180 .enum_list = NULL,
1181 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1184 .label = "force directory mode",
1185 .type = P_OCTAL,
1186 .p_class = P_LOCAL,
1187 .offset = LOCAL_VAR(iDir_force_mode),
1188 .special = NULL,
1189 .enum_list = NULL,
1190 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1193 .label = "directory security mask",
1194 .type = P_OCTAL,
1195 .p_class = P_LOCAL,
1196 .offset = LOCAL_VAR(iDir_Security_mask),
1197 .special = NULL,
1198 .enum_list = NULL,
1199 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1202 .label = "force directory security mode",
1203 .type = P_OCTAL,
1204 .p_class = P_LOCAL,
1205 .offset = LOCAL_VAR(iDir_Security_force_mode),
1206 .special = NULL,
1207 .enum_list = NULL,
1208 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1211 .label = "force unknown acl user",
1212 .type = P_BOOL,
1213 .p_class = P_LOCAL,
1214 .offset = LOCAL_VAR(bForceUnknownAclUser),
1215 .special = NULL,
1216 .enum_list = NULL,
1217 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1220 .label = "inherit permissions",
1221 .type = P_BOOL,
1222 .p_class = P_LOCAL,
1223 .offset = LOCAL_VAR(bInheritPerms),
1224 .special = NULL,
1225 .enum_list = NULL,
1226 .flags = FLAG_ADVANCED | FLAG_SHARE,
1229 .label = "inherit acls",
1230 .type = P_BOOL,
1231 .p_class = P_LOCAL,
1232 .offset = LOCAL_VAR(bInheritACLS),
1233 .special = NULL,
1234 .enum_list = NULL,
1235 .flags = FLAG_ADVANCED | FLAG_SHARE,
1238 .label = "inherit owner",
1239 .type = P_BOOL,
1240 .p_class = P_LOCAL,
1241 .offset = LOCAL_VAR(bInheritOwner),
1242 .special = NULL,
1243 .enum_list = NULL,
1244 .flags = FLAG_ADVANCED | FLAG_SHARE,
1247 .label = "guest only",
1248 .type = P_BOOL,
1249 .p_class = P_LOCAL,
1250 .offset = LOCAL_VAR(bGuest_only),
1251 .special = NULL,
1252 .enum_list = NULL,
1253 .flags = FLAG_ADVANCED | FLAG_SHARE,
1256 .label = "only guest",
1257 .type = P_BOOL,
1258 .p_class = P_LOCAL,
1259 .offset = LOCAL_VAR(bGuest_only),
1260 .special = NULL,
1261 .enum_list = NULL,
1262 .flags = FLAG_HIDE,
1265 .label = "administrative share",
1266 .type = P_BOOL,
1267 .p_class = P_LOCAL,
1268 .offset = LOCAL_VAR(bAdministrative_share),
1269 .special = NULL,
1270 .enum_list = NULL,
1271 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1275 .label = "guest ok",
1276 .type = P_BOOL,
1277 .p_class = P_LOCAL,
1278 .offset = LOCAL_VAR(bGuest_ok),
1279 .special = NULL,
1280 .enum_list = NULL,
1281 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1284 .label = "public",
1285 .type = P_BOOL,
1286 .p_class = P_LOCAL,
1287 .offset = LOCAL_VAR(bGuest_ok),
1288 .special = NULL,
1289 .enum_list = NULL,
1290 .flags = FLAG_HIDE,
1293 .label = "only user",
1294 .type = P_BOOL,
1295 .p_class = P_LOCAL,
1296 .offset = LOCAL_VAR(bOnlyUser),
1297 .special = NULL,
1298 .enum_list = NULL,
1299 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED,
1302 .label = "hosts allow",
1303 .type = P_LIST,
1304 .p_class = P_LOCAL,
1305 .offset = LOCAL_VAR(szHostsallow),
1306 .special = NULL,
1307 .enum_list = NULL,
1308 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1311 .label = "allow hosts",
1312 .type = P_LIST,
1313 .p_class = P_LOCAL,
1314 .offset = LOCAL_VAR(szHostsallow),
1315 .special = NULL,
1316 .enum_list = NULL,
1317 .flags = FLAG_HIDE,
1320 .label = "hosts deny",
1321 .type = P_LIST,
1322 .p_class = P_LOCAL,
1323 .offset = LOCAL_VAR(szHostsdeny),
1324 .special = NULL,
1325 .enum_list = NULL,
1326 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1329 .label = "deny hosts",
1330 .type = P_LIST,
1331 .p_class = P_LOCAL,
1332 .offset = LOCAL_VAR(szHostsdeny),
1333 .special = NULL,
1334 .enum_list = NULL,
1335 .flags = FLAG_HIDE,
1338 .label = "preload modules",
1339 .type = P_LIST,
1340 .p_class = P_GLOBAL,
1341 .offset = GLOBAL_VAR(szPreloadModules),
1342 .special = NULL,
1343 .enum_list = NULL,
1344 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1347 .label = "dedicated keytab file",
1348 .type = P_STRING,
1349 .p_class = P_GLOBAL,
1350 .offset = GLOBAL_VAR(szDedicatedKeytabFile),
1351 .special = NULL,
1352 .enum_list = NULL,
1353 .flags = FLAG_ADVANCED,
1356 .label = "kerberos method",
1357 .type = P_ENUM,
1358 .p_class = P_GLOBAL,
1359 .offset = GLOBAL_VAR(iKerberosMethod),
1360 .special = NULL,
1361 .enum_list = enum_kerberos_method,
1362 .flags = FLAG_ADVANCED,
1365 .label = "map untrusted to domain",
1366 .type = P_BOOL,
1367 .p_class = P_GLOBAL,
1368 .offset = GLOBAL_VAR(bMapUntrustedToDomain),
1369 .special = NULL,
1370 .enum_list = NULL,
1371 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1375 {N_("Logging Options"), P_SEP, P_SEPARATOR},
1378 .label = "log level",
1379 .type = P_STRING,
1380 .p_class = P_GLOBAL,
1381 .offset = GLOBAL_VAR(loglevel),
1382 .special = handle_debug_list,
1383 .enum_list = NULL,
1384 .flags = FLAG_ADVANCED,
1387 .label = "debuglevel",
1388 .type = P_STRING,
1389 .p_class = P_GLOBAL,
1390 .offset = GLOBAL_VAR(loglevel),
1391 .special = handle_debug_list,
1392 .enum_list = NULL,
1393 .flags = FLAG_HIDE,
1396 .label = "syslog",
1397 .type = P_INTEGER,
1398 .p_class = P_GLOBAL,
1399 .offset = GLOBAL_VAR(syslog),
1400 .special = NULL,
1401 .enum_list = NULL,
1402 .flags = FLAG_ADVANCED,
1405 .label = "syslog only",
1406 .type = P_BOOL,
1407 .p_class = P_GLOBAL,
1408 .offset = GLOBAL_VAR(bSyslogOnly),
1409 .special = NULL,
1410 .enum_list = NULL,
1411 .flags = FLAG_ADVANCED,
1414 .label = "log file",
1415 .type = P_STRING,
1416 .p_class = P_GLOBAL,
1417 .offset = GLOBAL_VAR(logfile),
1418 .special = NULL,
1419 .enum_list = NULL,
1420 .flags = FLAG_ADVANCED,
1423 .label = "max log size",
1424 .type = P_BYTES,
1425 .p_class = P_GLOBAL,
1426 .offset = GLOBAL_VAR(max_log_size),
1427 .special = NULL,
1428 .enum_list = NULL,
1429 .flags = FLAG_ADVANCED,
1432 .label = "debug timestamp",
1433 .type = P_BOOL,
1434 .p_class = P_GLOBAL,
1435 .offset = GLOBAL_VAR(bTimestampLogs),
1436 .special = NULL,
1437 .enum_list = NULL,
1438 .flags = FLAG_ADVANCED,
1441 .label = "timestamp logs",
1442 .type = P_BOOL,
1443 .p_class = P_GLOBAL,
1444 .offset = GLOBAL_VAR(bTimestampLogs),
1445 .special = NULL,
1446 .enum_list = NULL,
1447 .flags = FLAG_ADVANCED,
1450 .label = "debug prefix timestamp",
1451 .type = P_BOOL,
1452 .p_class = P_GLOBAL,
1453 .offset = GLOBAL_VAR(bDebugPrefixTimestamp),
1454 .special = NULL,
1455 .enum_list = NULL,
1456 .flags = FLAG_ADVANCED,
1459 .label = "debug hires timestamp",
1460 .type = P_BOOL,
1461 .p_class = P_GLOBAL,
1462 .offset = GLOBAL_VAR(bDebugHiresTimestamp),
1463 .special = NULL,
1464 .enum_list = NULL,
1465 .flags = FLAG_ADVANCED,
1468 .label = "debug pid",
1469 .type = P_BOOL,
1470 .p_class = P_GLOBAL,
1471 .offset = GLOBAL_VAR(bDebugPid),
1472 .special = NULL,
1473 .enum_list = NULL,
1474 .flags = FLAG_ADVANCED,
1477 .label = "debug uid",
1478 .type = P_BOOL,
1479 .p_class = P_GLOBAL,
1480 .offset = GLOBAL_VAR(bDebugUid),
1481 .special = NULL,
1482 .enum_list = NULL,
1483 .flags = FLAG_ADVANCED,
1486 .label = "debug class",
1487 .type = P_BOOL,
1488 .p_class = P_GLOBAL,
1489 .offset = GLOBAL_VAR(bDebugClass),
1490 .special = NULL,
1491 .enum_list = NULL,
1492 .flags = FLAG_ADVANCED,
1495 .label = "enable core files",
1496 .type = P_BOOL,
1497 .p_class = P_GLOBAL,
1498 .offset = GLOBAL_VAR(bEnableCoreFiles),
1499 .special = NULL,
1500 .enum_list = NULL,
1501 .flags = FLAG_ADVANCED,
1504 {N_("Protocol Options"), P_SEP, P_SEPARATOR},
1507 .label = "allocation roundup size",
1508 .type = P_BYTES,
1509 .p_class = P_LOCAL,
1510 .offset = LOCAL_VAR(iallocation_roundup_size),
1511 .special = NULL,
1512 .enum_list = NULL,
1513 .flags = FLAG_ADVANCED,
1516 .label = "aio read size",
1517 .type = P_BYTES,
1518 .p_class = P_LOCAL,
1519 .offset = LOCAL_VAR(iAioReadSize),
1520 .special = NULL,
1521 .enum_list = NULL,
1522 .flags = FLAG_ADVANCED,
1525 .label = "aio write size",
1526 .type = P_BYTES,
1527 .p_class = P_LOCAL,
1528 .offset = LOCAL_VAR(iAioWriteSize),
1529 .special = NULL,
1530 .enum_list = NULL,
1531 .flags = FLAG_ADVANCED,
1534 .label = "aio write behind",
1535 .type = P_STRING,
1536 .p_class = P_LOCAL,
1537 .offset = LOCAL_VAR(szAioWriteBehind),
1538 .special = NULL,
1539 .enum_list = NULL,
1540 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1543 .label = "smb ports",
1544 .type = P_LIST,
1545 .p_class = P_GLOBAL,
1546 .offset = GLOBAL_VAR(smb_ports),
1547 .special = NULL,
1548 .enum_list = NULL,
1549 .flags = FLAG_ADVANCED,
1552 .label = "large readwrite",
1553 .type = P_BOOL,
1554 .p_class = P_GLOBAL,
1555 .offset = GLOBAL_VAR(bLargeReadwrite),
1556 .special = NULL,
1557 .enum_list = NULL,
1558 .flags = FLAG_ADVANCED,
1561 .label = "server max protocol",
1562 .type = P_ENUM,
1563 .p_class = P_GLOBAL,
1564 .offset = GLOBAL_VAR(srv_maxprotocol),
1565 .special = NULL,
1566 .enum_list = enum_protocol,
1567 .flags = FLAG_ADVANCED,
1570 .label = "max protocol",
1571 .type = P_ENUM,
1572 .p_class = P_GLOBAL,
1573 .offset = GLOBAL_VAR(srv_maxprotocol),
1574 .special = NULL,
1575 .enum_list = enum_protocol,
1576 .flags = FLAG_ADVANCED,
1579 .label = "protocol",
1580 .type = P_ENUM,
1581 .p_class = P_GLOBAL,
1582 .offset = GLOBAL_VAR(srv_maxprotocol),
1583 .special = NULL,
1584 .enum_list = enum_protocol,
1585 .flags = FLAG_ADVANCED,
1588 .label = "server min protocol",
1589 .type = P_ENUM,
1590 .p_class = P_GLOBAL,
1591 .offset = GLOBAL_VAR(srv_minprotocol),
1592 .special = NULL,
1593 .enum_list = enum_protocol,
1594 .flags = FLAG_ADVANCED,
1597 .label = "min protocol",
1598 .type = P_ENUM,
1599 .p_class = P_GLOBAL,
1600 .offset = GLOBAL_VAR(srv_minprotocol),
1601 .special = NULL,
1602 .enum_list = enum_protocol,
1603 .flags = FLAG_ADVANCED,
1606 .label = "client max protocol",
1607 .type = P_ENUM,
1608 .p_class = P_GLOBAL,
1609 .offset = GLOBAL_VAR(cli_maxprotocol),
1610 .special = NULL,
1611 .enum_list = enum_protocol,
1612 .flags = FLAG_ADVANCED,
1615 .label = "client min protocol",
1616 .type = P_ENUM,
1617 .p_class = P_GLOBAL,
1618 .offset = GLOBAL_VAR(cli_minprotocol),
1619 .special = NULL,
1620 .enum_list = enum_protocol,
1621 .flags = FLAG_ADVANCED,
1624 .label = "unicode",
1625 .type = P_BOOL,
1626 .p_class = P_GLOBAL,
1627 .offset = GLOBAL_VAR(bUnicode),
1628 .special = NULL,
1629 .enum_list = NULL
1632 .label = "min receivefile size",
1633 .type = P_BYTES,
1634 .p_class = P_GLOBAL,
1635 .offset = GLOBAL_VAR(iminreceivefile),
1636 .special = NULL,
1637 .enum_list = NULL,
1638 .flags = FLAG_ADVANCED,
1641 .label = "read raw",
1642 .type = P_BOOL,
1643 .p_class = P_GLOBAL,
1644 .offset = GLOBAL_VAR(bReadRaw),
1645 .special = NULL,
1646 .enum_list = NULL,
1647 .flags = FLAG_ADVANCED,
1650 .label = "write raw",
1651 .type = P_BOOL,
1652 .p_class = P_GLOBAL,
1653 .offset = GLOBAL_VAR(bWriteRaw),
1654 .special = NULL,
1655 .enum_list = NULL,
1656 .flags = FLAG_ADVANCED,
1659 .label = "disable netbios",
1660 .type = P_BOOL,
1661 .p_class = P_GLOBAL,
1662 .offset = GLOBAL_VAR(bDisableNetbios),
1663 .special = NULL,
1664 .enum_list = NULL,
1665 .flags = FLAG_ADVANCED,
1668 .label = "reset on zero vc",
1669 .type = P_BOOL,
1670 .p_class = P_GLOBAL,
1671 .offset = GLOBAL_VAR(bResetOnZeroVC),
1672 .special = NULL,
1673 .enum_list = NULL,
1674 .flags = FLAG_ADVANCED,
1677 .label = "log writeable files on exit",
1678 .type = P_BOOL,
1679 .p_class = P_GLOBAL,
1680 .offset = GLOBAL_VAR(bLogWriteableFilesOnExit),
1681 .special = NULL,
1682 .enum_list = NULL,
1683 .flags = FLAG_ADVANCED,
1686 .label = "acl compatibility",
1687 .type = P_ENUM,
1688 .p_class = P_GLOBAL,
1689 .offset = GLOBAL_VAR(iAclCompat),
1690 .special = NULL,
1691 .enum_list = enum_acl_compat_vals,
1692 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1695 .label = "defer sharing violations",
1696 .type = P_BOOL,
1697 .p_class = P_GLOBAL,
1698 .offset = GLOBAL_VAR(bDeferSharingViolations),
1699 .special = NULL,
1700 .enum_list = NULL,
1701 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1704 .label = "ea support",
1705 .type = P_BOOL,
1706 .p_class = P_LOCAL,
1707 .offset = LOCAL_VAR(bEASupport),
1708 .special = NULL,
1709 .enum_list = NULL,
1710 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1713 .label = "nt acl support",
1714 .type = P_BOOL,
1715 .p_class = P_LOCAL,
1716 .offset = LOCAL_VAR(bNTAclSupport),
1717 .special = NULL,
1718 .enum_list = NULL,
1719 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1722 .label = "nt pipe support",
1723 .type = P_BOOL,
1724 .p_class = P_GLOBAL,
1725 .offset = GLOBAL_VAR(bNTPipeSupport),
1726 .special = NULL,
1727 .enum_list = NULL,
1728 .flags = FLAG_ADVANCED,
1731 .label = "nt status support",
1732 .type = P_BOOL,
1733 .p_class = P_GLOBAL,
1734 .offset = GLOBAL_VAR(bNTStatusSupport),
1735 .special = NULL,
1736 .enum_list = NULL,
1737 .flags = FLAG_ADVANCED,
1740 .label = "profile acls",
1741 .type = P_BOOL,
1742 .p_class = P_LOCAL,
1743 .offset = LOCAL_VAR(bProfileAcls),
1744 .special = NULL,
1745 .enum_list = NULL,
1746 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1749 .label = "map acl inherit",
1750 .type = P_BOOL,
1751 .p_class = P_LOCAL,
1752 .offset = LOCAL_VAR(bMap_acl_inherit),
1753 .special = NULL,
1754 .enum_list = NULL,
1755 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1758 .label = "afs share",
1759 .type = P_BOOL,
1760 .p_class = P_LOCAL,
1761 .offset = LOCAL_VAR(bAfs_Share),
1762 .special = NULL,
1763 .enum_list = NULL,
1764 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1767 .label = "max mux",
1768 .type = P_INTEGER,
1769 .p_class = P_GLOBAL,
1770 .offset = GLOBAL_VAR(max_mux),
1771 .special = NULL,
1772 .enum_list = NULL,
1773 .flags = FLAG_ADVANCED,
1776 .label = "max xmit",
1777 .type = P_BYTES,
1778 .p_class = P_GLOBAL,
1779 .offset = GLOBAL_VAR(max_xmit),
1780 .special = NULL,
1781 .enum_list = NULL,
1782 .flags = FLAG_ADVANCED,
1785 .label = "name resolve order",
1786 .type = P_LIST,
1787 .p_class = P_GLOBAL,
1788 .offset = GLOBAL_VAR(szNameResolveOrder),
1789 .special = NULL,
1790 .enum_list = NULL,
1791 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1794 .label = "max ttl",
1795 .type = P_INTEGER,
1796 .p_class = P_GLOBAL,
1797 .offset = GLOBAL_VAR(max_ttl),
1798 .special = NULL,
1799 .enum_list = NULL,
1800 .flags = FLAG_ADVANCED,
1803 .label = "max wins ttl",
1804 .type = P_INTEGER,
1805 .p_class = P_GLOBAL,
1806 .offset = GLOBAL_VAR(max_wins_ttl),
1807 .special = NULL,
1808 .enum_list = NULL,
1809 .flags = FLAG_ADVANCED,
1812 .label = "min wins ttl",
1813 .type = P_INTEGER,
1814 .p_class = P_GLOBAL,
1815 .offset = GLOBAL_VAR(min_wins_ttl),
1816 .special = NULL,
1817 .enum_list = NULL,
1818 .flags = FLAG_ADVANCED,
1821 .label = "time server",
1822 .type = P_BOOL,
1823 .p_class = P_GLOBAL,
1824 .offset = GLOBAL_VAR(bTimeServer),
1825 .special = NULL,
1826 .enum_list = NULL,
1827 .flags = FLAG_ADVANCED,
1830 .label = "unix extensions",
1831 .type = P_BOOL,
1832 .p_class = P_GLOBAL,
1833 .offset = GLOBAL_VAR(bUnixExtensions),
1834 .special = NULL,
1835 .enum_list = NULL,
1836 .flags = FLAG_ADVANCED,
1839 .label = "use spnego",
1840 .type = P_BOOL,
1841 .p_class = P_GLOBAL,
1842 .offset = GLOBAL_VAR(bUseSpnego),
1843 .special = NULL,
1844 .enum_list = NULL,
1845 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
1848 .label = "client signing",
1849 .type = P_ENUM,
1850 .p_class = P_GLOBAL,
1851 .offset = GLOBAL_VAR(client_signing),
1852 .special = NULL,
1853 .enum_list = enum_smb_signing_vals,
1854 .flags = FLAG_ADVANCED,
1857 .label = "server signing",
1858 .type = P_ENUM,
1859 .p_class = P_GLOBAL,
1860 .offset = GLOBAL_VAR(server_signing),
1861 .special = NULL,
1862 .enum_list = enum_smb_signing_vals,
1863 .flags = FLAG_ADVANCED,
1866 .label = "smb encrypt",
1867 .type = P_ENUM,
1868 .p_class = P_LOCAL,
1869 .offset = LOCAL_VAR(ismb_encrypt),
1870 .special = NULL,
1871 .enum_list = enum_smb_signing_vals,
1872 .flags = FLAG_ADVANCED,
1875 .label = "client use spnego",
1876 .type = P_BOOL,
1877 .p_class = P_GLOBAL,
1878 .offset = GLOBAL_VAR(bClientUseSpnego),
1879 .special = NULL,
1880 .enum_list = NULL,
1881 .flags = FLAG_ADVANCED,
1884 .label = "client ldap sasl wrapping",
1885 .type = P_ENUM,
1886 .p_class = P_GLOBAL,
1887 .offset = GLOBAL_VAR(client_ldap_sasl_wrapping),
1888 .special = NULL,
1889 .enum_list = enum_ldap_sasl_wrapping,
1890 .flags = FLAG_ADVANCED,
1893 .label = "enable asu support",
1894 .type = P_BOOL,
1895 .p_class = P_GLOBAL,
1896 .offset = GLOBAL_VAR(bASUSupport),
1897 .special = NULL,
1898 .enum_list = NULL,
1899 .flags = FLAG_ADVANCED,
1902 .label = "svcctl list",
1903 .type = P_LIST,
1904 .p_class = P_GLOBAL,
1905 .offset = GLOBAL_VAR(szServicesList),
1906 .special = NULL,
1907 .enum_list = NULL,
1908 .flags = FLAG_ADVANCED,
1911 .label = "cldap port",
1912 .type = P_INTEGER,
1913 .p_class = P_GLOBAL,
1914 .offset = GLOBAL_VAR(cldap_port),
1915 .special = NULL,
1916 .enum_list = NULL
1919 .label = "dgram port",
1920 .type = P_INTEGER,
1921 .p_class = P_GLOBAL,
1922 .offset = GLOBAL_VAR(dgram_port),
1923 .special = NULL,
1924 .enum_list = NULL
1927 .label = "nbt port",
1928 .type = P_INTEGER,
1929 .p_class = P_GLOBAL,
1930 .offset = GLOBAL_VAR(nbt_port),
1931 .special = NULL,
1932 .enum_list = NULL
1935 .label = "krb5 port",
1936 .type = P_INTEGER,
1937 .p_class = P_GLOBAL,
1938 .offset = GLOBAL_VAR(krb5_port),
1939 .special = NULL,
1940 .enum_list = NULL
1943 .label = "kpasswd port",
1944 .type = P_INTEGER,
1945 .p_class = P_GLOBAL,
1946 .offset = GLOBAL_VAR(kpasswd_port),
1947 .special = NULL,
1948 .enum_list = NULL
1951 .label = "web port",
1952 .type = P_INTEGER,
1953 .p_class = P_GLOBAL,
1954 .offset = GLOBAL_VAR(web_port),
1955 .special = NULL,
1956 .enum_list = NULL
1959 .label = "rpc big endian",
1960 .type = P_BOOL,
1961 .p_class = P_GLOBAL,
1962 .offset = GLOBAL_VAR(bRpcBigEndian),
1963 .special = NULL,
1964 .enum_list = NULL
1967 {N_("Tuning Options"), P_SEP, P_SEPARATOR},
1970 .label = "block size",
1971 .type = P_BYTES,
1972 .p_class = P_LOCAL,
1973 .offset = LOCAL_VAR(iBlock_size),
1974 .special = NULL,
1975 .enum_list = NULL,
1976 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1979 .label = "deadtime",
1980 .type = P_INTEGER,
1981 .p_class = P_GLOBAL,
1982 .offset = GLOBAL_VAR(deadtime),
1983 .special = NULL,
1984 .enum_list = NULL,
1985 .flags = FLAG_ADVANCED,
1988 .label = "getwd cache",
1989 .type = P_BOOL,
1990 .p_class = P_GLOBAL,
1991 .offset = GLOBAL_VAR(getwd_cache),
1992 .special = NULL,
1993 .enum_list = NULL,
1994 .flags = FLAG_ADVANCED,
1997 .label = "keepalive",
1998 .type = P_INTEGER,
1999 .p_class = P_GLOBAL,
2000 .offset = GLOBAL_VAR(iKeepalive),
2001 .special = NULL,
2002 .enum_list = NULL,
2003 .flags = FLAG_ADVANCED,
2006 .label = "change notify",
2007 .type = P_BOOL,
2008 .p_class = P_LOCAL,
2009 .offset = LOCAL_VAR(bChangeNotify),
2010 .special = NULL,
2011 .enum_list = NULL,
2012 .flags = FLAG_ADVANCED | FLAG_SHARE,
2015 .label = "directory name cache size",
2016 .type = P_INTEGER,
2017 .p_class = P_LOCAL,
2018 .offset = LOCAL_VAR(iDirectoryNameCacheSize),
2019 .special = NULL,
2020 .enum_list = NULL,
2021 .flags = FLAG_ADVANCED | FLAG_SHARE,
2024 .label = "kernel change notify",
2025 .type = P_BOOL,
2026 .p_class = P_LOCAL,
2027 .offset = LOCAL_VAR(bKernelChangeNotify),
2028 .special = NULL,
2029 .enum_list = NULL,
2030 .flags = FLAG_ADVANCED | FLAG_SHARE,
2033 .label = "lpq cache time",
2034 .type = P_INTEGER,
2035 .p_class = P_GLOBAL,
2036 .offset = GLOBAL_VAR(lpqcachetime),
2037 .special = NULL,
2038 .enum_list = NULL,
2039 .flags = FLAG_ADVANCED,
2042 .label = "max smbd processes",
2043 .type = P_INTEGER,
2044 .p_class = P_GLOBAL,
2045 .offset = GLOBAL_VAR(iMaxSmbdProcesses),
2046 .special = NULL,
2047 .enum_list = NULL,
2048 .flags = FLAG_ADVANCED,
2051 .label = "max connections",
2052 .type = P_INTEGER,
2053 .p_class = P_LOCAL,
2054 .offset = LOCAL_VAR(iMaxConnections),
2055 .special = NULL,
2056 .enum_list = NULL,
2057 .flags = FLAG_ADVANCED | FLAG_SHARE,
2060 .label = "paranoid server security",
2061 .type = P_BOOL,
2062 .p_class = P_GLOBAL,
2063 .offset = GLOBAL_VAR(paranoid_server_security),
2064 .special = NULL,
2065 .enum_list = NULL,
2066 .flags = FLAG_ADVANCED,
2069 .label = "max disk size",
2070 .type = P_BYTES,
2071 .p_class = P_GLOBAL,
2072 .offset = GLOBAL_VAR(maxdisksize),
2073 .special = NULL,
2074 .enum_list = NULL,
2075 .flags = FLAG_ADVANCED,
2078 .label = "max open files",
2079 .type = P_INTEGER,
2080 .p_class = P_GLOBAL,
2081 .offset = GLOBAL_VAR(max_open_files),
2082 .special = NULL,
2083 .enum_list = NULL,
2084 .flags = FLAG_ADVANCED,
2087 .label = "min print space",
2088 .type = P_INTEGER,
2089 .p_class = P_LOCAL,
2090 .offset = LOCAL_VAR(iMinPrintSpace),
2091 .special = NULL,
2092 .enum_list = NULL,
2093 .flags = FLAG_ADVANCED | FLAG_PRINT,
2096 .label = "socket options",
2097 .type = P_STRING,
2098 .p_class = P_GLOBAL,
2099 .offset = GLOBAL_VAR(socket_options),
2100 .special = NULL,
2101 .enum_list = NULL,
2102 .flags = FLAG_ADVANCED,
2105 .label = "strict allocate",
2106 .type = P_BOOL,
2107 .p_class = P_LOCAL,
2108 .offset = LOCAL_VAR(bStrictAllocate),
2109 .special = NULL,
2110 .enum_list = NULL,
2111 .flags = FLAG_ADVANCED | FLAG_SHARE,
2114 .label = "strict sync",
2115 .type = P_BOOL,
2116 .p_class = P_LOCAL,
2117 .offset = LOCAL_VAR(bStrictSync),
2118 .special = NULL,
2119 .enum_list = NULL,
2120 .flags = FLAG_ADVANCED | FLAG_SHARE,
2123 .label = "sync always",
2124 .type = P_BOOL,
2125 .p_class = P_LOCAL,
2126 .offset = LOCAL_VAR(bSyncAlways),
2127 .special = NULL,
2128 .enum_list = NULL,
2129 .flags = FLAG_ADVANCED | FLAG_SHARE,
2132 .label = "use mmap",
2133 .type = P_BOOL,
2134 .p_class = P_GLOBAL,
2135 .offset = GLOBAL_VAR(bUseMmap),
2136 .special = NULL,
2137 .enum_list = NULL,
2138 .flags = FLAG_ADVANCED,
2141 .label = "use sendfile",
2142 .type = P_BOOL,
2143 .p_class = P_LOCAL,
2144 .offset = LOCAL_VAR(bUseSendfile),
2145 .special = NULL,
2146 .enum_list = NULL,
2147 .flags = FLAG_ADVANCED | FLAG_SHARE,
2150 .label = "hostname lookups",
2151 .type = P_BOOL,
2152 .p_class = P_GLOBAL,
2153 .offset = GLOBAL_VAR(bHostnameLookups),
2154 .special = NULL,
2155 .enum_list = NULL,
2156 .flags = FLAG_ADVANCED,
2159 .label = "write cache size",
2160 .type = P_BYTES,
2161 .p_class = P_LOCAL,
2162 .offset = LOCAL_VAR(iWriteCacheSize),
2163 .special = NULL,
2164 .enum_list = NULL,
2165 .flags = FLAG_ADVANCED | FLAG_SHARE,
2168 .label = "name cache timeout",
2169 .type = P_INTEGER,
2170 .p_class = P_GLOBAL,
2171 .offset = GLOBAL_VAR(name_cache_timeout),
2172 .special = NULL,
2173 .enum_list = NULL,
2174 .flags = FLAG_ADVANCED,
2177 .label = "ctdbd socket",
2178 .type = P_STRING,
2179 .p_class = P_GLOBAL,
2180 .offset = GLOBAL_VAR(ctdbdSocket),
2181 .special = NULL,
2182 .enum_list = NULL,
2183 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2186 .label = "cluster addresses",
2187 .type = P_LIST,
2188 .p_class = P_GLOBAL,
2189 .offset = GLOBAL_VAR(szClusterAddresses),
2190 .special = NULL,
2191 .enum_list = NULL,
2192 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2195 .label = "clustering",
2196 .type = P_BOOL,
2197 .p_class = P_GLOBAL,
2198 .offset = GLOBAL_VAR(clustering),
2199 .special = NULL,
2200 .enum_list = NULL,
2201 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2204 .label = "ctdb timeout",
2205 .type = P_INTEGER,
2206 .p_class = P_GLOBAL,
2207 .offset = GLOBAL_VAR(ctdb_timeout),
2208 .special = NULL,
2209 .enum_list = NULL,
2210 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2213 .label = "ctdb locktime warn threshold",
2214 .type = P_INTEGER,
2215 .p_class = P_GLOBAL,
2216 .offset = GLOBAL_VAR(ctdb_locktime_warn_threshold),
2217 .special = NULL,
2218 .enum_list = NULL,
2219 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2222 .label = "smb2 max read",
2223 .type = P_BYTES,
2224 .p_class = P_GLOBAL,
2225 .offset = GLOBAL_VAR(ismb2_max_read),
2226 .special = NULL,
2227 .enum_list = NULL,
2228 .flags = FLAG_ADVANCED,
2231 .label = "smb2 max write",
2232 .type = P_BYTES,
2233 .p_class = P_GLOBAL,
2234 .offset = GLOBAL_VAR(ismb2_max_write),
2235 .special = NULL,
2236 .enum_list = NULL,
2237 .flags = FLAG_ADVANCED,
2240 .label = "smb2 max trans",
2241 .type = P_BYTES,
2242 .p_class = P_GLOBAL,
2243 .offset = GLOBAL_VAR(ismb2_max_trans),
2244 .special = NULL,
2245 .enum_list = NULL,
2246 .flags = FLAG_ADVANCED,
2249 .label = "smb2 max credits",
2250 .type = P_INTEGER,
2251 .p_class = P_GLOBAL,
2252 .offset = GLOBAL_VAR(ismb2_max_credits),
2253 .special = NULL,
2254 .enum_list = NULL,
2255 .flags = FLAG_ADVANCED,
2258 {N_("Printing Options"), P_SEP, P_SEPARATOR},
2261 .label = "max reported print jobs",
2262 .type = P_INTEGER,
2263 .p_class = P_LOCAL,
2264 .offset = LOCAL_VAR(iMaxReportedPrintJobs),
2265 .special = NULL,
2266 .enum_list = NULL,
2267 .flags = FLAG_ADVANCED | FLAG_PRINT,
2270 .label = "max print jobs",
2271 .type = P_INTEGER,
2272 .p_class = P_LOCAL,
2273 .offset = LOCAL_VAR(iMaxPrintJobs),
2274 .special = NULL,
2275 .enum_list = NULL,
2276 .flags = FLAG_ADVANCED | FLAG_PRINT,
2279 .label = "load printers",
2280 .type = P_BOOL,
2281 .p_class = P_GLOBAL,
2282 .offset = GLOBAL_VAR(bLoadPrinters),
2283 .special = NULL,
2284 .enum_list = NULL,
2285 .flags = FLAG_ADVANCED | FLAG_PRINT,
2288 .label = "printcap cache time",
2289 .type = P_INTEGER,
2290 .p_class = P_GLOBAL,
2291 .offset = GLOBAL_VAR(PrintcapCacheTime),
2292 .special = NULL,
2293 .enum_list = NULL,
2294 .flags = FLAG_ADVANCED | FLAG_PRINT,
2297 .label = "printcap name",
2298 .type = P_STRING,
2299 .p_class = P_GLOBAL,
2300 .offset = GLOBAL_VAR(szPrintcapname),
2301 .special = NULL,
2302 .enum_list = NULL,
2303 .flags = FLAG_ADVANCED | FLAG_PRINT,
2306 .label = "printcap",
2307 .type = P_STRING,
2308 .p_class = P_GLOBAL,
2309 .offset = GLOBAL_VAR(szPrintcapname),
2310 .special = NULL,
2311 .enum_list = NULL,
2312 .flags = FLAG_HIDE,
2315 .label = "printable",
2316 .type = P_BOOL,
2317 .p_class = P_LOCAL,
2318 .offset = LOCAL_VAR(bPrint_ok),
2319 .special = NULL,
2320 .enum_list = NULL,
2321 .flags = FLAG_ADVANCED | FLAG_PRINT,
2324 .label = "print notify backchannel",
2325 .type = P_BOOL,
2326 .p_class = P_LOCAL,
2327 .offset = LOCAL_VAR(bPrintNotifyBackchannel),
2328 .special = NULL,
2329 .enum_list = NULL,
2330 .flags = FLAG_ADVANCED,
2333 .label = "print ok",
2334 .type = P_BOOL,
2335 .p_class = P_LOCAL,
2336 .offset = LOCAL_VAR(bPrint_ok),
2337 .special = NULL,
2338 .enum_list = NULL,
2339 .flags = FLAG_HIDE,
2342 .label = "printing",
2343 .type = P_ENUM,
2344 .p_class = P_LOCAL,
2345 .offset = LOCAL_VAR(iPrinting),
2346 .special = handle_printing,
2347 .enum_list = enum_printing,
2348 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2351 .label = "cups options",
2352 .type = P_STRING,
2353 .p_class = P_LOCAL,
2354 .offset = LOCAL_VAR(szCupsOptions),
2355 .special = NULL,
2356 .enum_list = NULL,
2357 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2360 .label = "cups server",
2361 .type = P_STRING,
2362 .p_class = P_GLOBAL,
2363 .offset = GLOBAL_VAR(szCupsServer),
2364 .special = NULL,
2365 .enum_list = NULL,
2366 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2369 .label = "cups encrypt",
2370 .type = P_ENUM,
2371 .p_class = P_GLOBAL,
2372 .offset = GLOBAL_VAR(CupsEncrypt),
2373 .special = NULL,
2374 .enum_list = enum_bool_auto,
2375 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2379 .label = "cups connection timeout",
2380 .type = P_INTEGER,
2381 .p_class = P_GLOBAL,
2382 .offset = GLOBAL_VAR(cups_connection_timeout),
2383 .special = NULL,
2384 .enum_list = NULL,
2385 .flags = FLAG_ADVANCED,
2388 .label = "iprint server",
2389 .type = P_STRING,
2390 .p_class = P_GLOBAL,
2391 .offset = GLOBAL_VAR(szIPrintServer),
2392 .special = NULL,
2393 .enum_list = NULL,
2394 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2397 .label = "print command",
2398 .type = P_STRING,
2399 .p_class = P_LOCAL,
2400 .offset = LOCAL_VAR(szPrintcommand),
2401 .special = NULL,
2402 .enum_list = NULL,
2403 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2406 .label = "disable spoolss",
2407 .type = P_BOOL,
2408 .p_class = P_GLOBAL,
2409 .offset = GLOBAL_VAR(bDisableSpoolss),
2410 .special = NULL,
2411 .enum_list = NULL,
2412 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2415 .label = "enable spoolss",
2416 .type = P_BOOLREV,
2417 .p_class = P_GLOBAL,
2418 .offset = GLOBAL_VAR(bDisableSpoolss),
2419 .special = NULL,
2420 .enum_list = NULL,
2421 .flags = FLAG_HIDE,
2424 .label = "lpq command",
2425 .type = P_STRING,
2426 .p_class = P_LOCAL,
2427 .offset = LOCAL_VAR(szLpqcommand),
2428 .special = NULL,
2429 .enum_list = NULL,
2430 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2433 .label = "lprm command",
2434 .type = P_STRING,
2435 .p_class = P_LOCAL,
2436 .offset = LOCAL_VAR(szLprmcommand),
2437 .special = NULL,
2438 .enum_list = NULL,
2439 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2442 .label = "lppause command",
2443 .type = P_STRING,
2444 .p_class = P_LOCAL,
2445 .offset = LOCAL_VAR(szLppausecommand),
2446 .special = NULL,
2447 .enum_list = NULL,
2448 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2451 .label = "lpresume command",
2452 .type = P_STRING,
2453 .p_class = P_LOCAL,
2454 .offset = LOCAL_VAR(szLpresumecommand),
2455 .special = NULL,
2456 .enum_list = NULL,
2457 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2460 .label = "queuepause command",
2461 .type = P_STRING,
2462 .p_class = P_LOCAL,
2463 .offset = LOCAL_VAR(szQueuepausecommand),
2464 .special = NULL,
2465 .enum_list = NULL,
2466 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2469 .label = "queueresume command",
2470 .type = P_STRING,
2471 .p_class = P_LOCAL,
2472 .offset = LOCAL_VAR(szQueueresumecommand),
2473 .special = NULL,
2474 .enum_list = NULL,
2475 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2478 .label = "addport command",
2479 .type = P_STRING,
2480 .p_class = P_GLOBAL,
2481 .offset = GLOBAL_VAR(szAddPortCommand),
2482 .special = NULL,
2483 .enum_list = NULL,
2484 .flags = FLAG_ADVANCED,
2487 .label = "enumports command",
2488 .type = P_STRING,
2489 .p_class = P_GLOBAL,
2490 .offset = GLOBAL_VAR(szEnumPortsCommand),
2491 .special = NULL,
2492 .enum_list = NULL,
2493 .flags = FLAG_ADVANCED,
2496 .label = "addprinter command",
2497 .type = P_STRING,
2498 .p_class = P_GLOBAL,
2499 .offset = GLOBAL_VAR(szAddPrinterCommand),
2500 .special = NULL,
2501 .enum_list = NULL,
2502 .flags = FLAG_ADVANCED,
2505 .label = "deleteprinter command",
2506 .type = P_STRING,
2507 .p_class = P_GLOBAL,
2508 .offset = GLOBAL_VAR(szDeletePrinterCommand),
2509 .special = NULL,
2510 .enum_list = NULL,
2511 .flags = FLAG_ADVANCED,
2514 .label = "show add printer wizard",
2515 .type = P_BOOL,
2516 .p_class = P_GLOBAL,
2517 .offset = GLOBAL_VAR(bMsAddPrinterWizard),
2518 .special = NULL,
2519 .enum_list = NULL,
2520 .flags = FLAG_ADVANCED,
2523 .label = "os2 driver map",
2524 .type = P_STRING,
2525 .p_class = P_GLOBAL,
2526 .offset = GLOBAL_VAR(szOs2DriverMap),
2527 .special = NULL,
2528 .enum_list = NULL,
2529 .flags = FLAG_ADVANCED,
2533 .label = "printer name",
2534 .type = P_STRING,
2535 .p_class = P_LOCAL,
2536 .offset = LOCAL_VAR(szPrintername),
2537 .special = NULL,
2538 .enum_list = NULL,
2539 .flags = FLAG_ADVANCED | FLAG_PRINT,
2542 .label = "printer",
2543 .type = P_STRING,
2544 .p_class = P_LOCAL,
2545 .offset = LOCAL_VAR(szPrintername),
2546 .special = NULL,
2547 .enum_list = NULL,
2548 .flags = FLAG_HIDE,
2551 .label = "use client driver",
2552 .type = P_BOOL,
2553 .p_class = P_LOCAL,
2554 .offset = LOCAL_VAR(bUseClientDriver),
2555 .special = NULL,
2556 .enum_list = NULL,
2557 .flags = FLAG_ADVANCED | FLAG_PRINT,
2560 .label = "default devmode",
2561 .type = P_BOOL,
2562 .p_class = P_LOCAL,
2563 .offset = LOCAL_VAR(bDefaultDevmode),
2564 .special = NULL,
2565 .enum_list = NULL,
2566 .flags = FLAG_ADVANCED | FLAG_PRINT,
2569 .label = "force printername",
2570 .type = P_BOOL,
2571 .p_class = P_LOCAL,
2572 .offset = LOCAL_VAR(bForcePrintername),
2573 .special = NULL,
2574 .enum_list = NULL,
2575 .flags = FLAG_ADVANCED | FLAG_PRINT,
2578 .label = "printjob username",
2579 .type = P_STRING,
2580 .p_class = P_LOCAL,
2581 .offset = LOCAL_VAR(szPrintjobUsername),
2582 .special = NULL,
2583 .enum_list = NULL,
2584 .flags = FLAG_ADVANCED | FLAG_PRINT,
2587 {N_("Filename Handling"), P_SEP, P_SEPARATOR},
2590 .label = "mangling method",
2591 .type = P_STRING,
2592 .p_class = P_GLOBAL,
2593 .offset = GLOBAL_VAR(szManglingMethod),
2594 .special = NULL,
2595 .enum_list = NULL,
2596 .flags = FLAG_ADVANCED,
2599 .label = "mangle prefix",
2600 .type = P_INTEGER,
2601 .p_class = P_GLOBAL,
2602 .offset = GLOBAL_VAR(mangle_prefix),
2603 .special = NULL,
2604 .enum_list = NULL,
2605 .flags = FLAG_ADVANCED,
2609 .label = "default case",
2610 .type = P_ENUM,
2611 .p_class = P_LOCAL,
2612 .offset = LOCAL_VAR(iDefaultCase),
2613 .special = NULL,
2614 .enum_list = enum_case,
2615 .flags = FLAG_ADVANCED | FLAG_SHARE,
2618 .label = "case sensitive",
2619 .type = P_ENUM,
2620 .p_class = P_LOCAL,
2621 .offset = LOCAL_VAR(iCaseSensitive),
2622 .special = NULL,
2623 .enum_list = enum_bool_auto,
2624 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2627 .label = "casesignames",
2628 .type = P_ENUM,
2629 .p_class = P_LOCAL,
2630 .offset = LOCAL_VAR(iCaseSensitive),
2631 .special = NULL,
2632 .enum_list = enum_bool_auto,
2633 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_HIDE,
2636 .label = "preserve case",
2637 .type = P_BOOL,
2638 .p_class = P_LOCAL,
2639 .offset = LOCAL_VAR(bCasePreserve),
2640 .special = NULL,
2641 .enum_list = NULL,
2642 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2645 .label = "short preserve case",
2646 .type = P_BOOL,
2647 .p_class = P_LOCAL,
2648 .offset = LOCAL_VAR(bShortCasePreserve),
2649 .special = NULL,
2650 .enum_list = NULL,
2651 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2654 .label = "mangling char",
2655 .type = P_CHAR,
2656 .p_class = P_LOCAL,
2657 .offset = LOCAL_VAR(magic_char),
2658 .special = NULL,
2659 .enum_list = NULL,
2660 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2663 .label = "hide dot files",
2664 .type = P_BOOL,
2665 .p_class = P_LOCAL,
2666 .offset = LOCAL_VAR(bHideDotFiles),
2667 .special = NULL,
2668 .enum_list = NULL,
2669 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2672 .label = "hide special files",
2673 .type = P_BOOL,
2674 .p_class = P_LOCAL,
2675 .offset = LOCAL_VAR(bHideSpecialFiles),
2676 .special = NULL,
2677 .enum_list = NULL,
2678 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2681 .label = "hide unreadable",
2682 .type = P_BOOL,
2683 .p_class = P_LOCAL,
2684 .offset = LOCAL_VAR(bHideUnReadable),
2685 .special = NULL,
2686 .enum_list = NULL,
2687 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2690 .label = "hide unwriteable files",
2691 .type = P_BOOL,
2692 .p_class = P_LOCAL,
2693 .offset = LOCAL_VAR(bHideUnWriteableFiles),
2694 .special = NULL,
2695 .enum_list = NULL,
2696 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2699 .label = "delete veto files",
2700 .type = P_BOOL,
2701 .p_class = P_LOCAL,
2702 .offset = LOCAL_VAR(bDeleteVetoFiles),
2703 .special = NULL,
2704 .enum_list = NULL,
2705 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2708 .label = "veto files",
2709 .type = P_STRING,
2710 .p_class = P_LOCAL,
2711 .offset = LOCAL_VAR(szVetoFiles),
2712 .special = NULL,
2713 .enum_list = NULL,
2714 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2717 .label = "hide files",
2718 .type = P_STRING,
2719 .p_class = P_LOCAL,
2720 .offset = LOCAL_VAR(szHideFiles),
2721 .special = NULL,
2722 .enum_list = NULL,
2723 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2726 .label = "veto oplock files",
2727 .type = P_STRING,
2728 .p_class = P_LOCAL,
2729 .offset = LOCAL_VAR(szVetoOplockFiles),
2730 .special = NULL,
2731 .enum_list = NULL,
2732 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2735 .label = "map archive",
2736 .type = P_BOOL,
2737 .p_class = P_LOCAL,
2738 .offset = LOCAL_VAR(bMap_archive),
2739 .special = NULL,
2740 .enum_list = NULL,
2741 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2744 .label = "map hidden",
2745 .type = P_BOOL,
2746 .p_class = P_LOCAL,
2747 .offset = LOCAL_VAR(bMap_hidden),
2748 .special = NULL,
2749 .enum_list = NULL,
2750 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2753 .label = "map system",
2754 .type = P_BOOL,
2755 .p_class = P_LOCAL,
2756 .offset = LOCAL_VAR(bMap_system),
2757 .special = NULL,
2758 .enum_list = NULL,
2759 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2762 .label = "map readonly",
2763 .type = P_ENUM,
2764 .p_class = P_LOCAL,
2765 .offset = LOCAL_VAR(iMap_readonly),
2766 .special = NULL,
2767 .enum_list = enum_map_readonly,
2768 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2771 .label = "mangled names",
2772 .type = P_BOOL,
2773 .p_class = P_LOCAL,
2774 .offset = LOCAL_VAR(bMangledNames),
2775 .special = NULL,
2776 .enum_list = NULL,
2777 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2780 .label = "max stat cache size",
2781 .type = P_INTEGER,
2782 .p_class = P_GLOBAL,
2783 .offset = GLOBAL_VAR(iMaxStatCacheSize),
2784 .special = NULL,
2785 .enum_list = NULL,
2786 .flags = FLAG_ADVANCED,
2789 .label = "stat cache",
2790 .type = P_BOOL,
2791 .p_class = P_GLOBAL,
2792 .offset = GLOBAL_VAR(bStatCache),
2793 .special = NULL,
2794 .enum_list = NULL,
2795 .flags = FLAG_ADVANCED,
2798 .label = "store dos attributes",
2799 .type = P_BOOL,
2800 .p_class = P_LOCAL,
2801 .offset = LOCAL_VAR(bStoreDosAttributes),
2802 .special = NULL,
2803 .enum_list = NULL,
2804 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2807 .label = "dmapi support",
2808 .type = P_BOOL,
2809 .p_class = P_LOCAL,
2810 .offset = LOCAL_VAR(bDmapiSupport),
2811 .special = NULL,
2812 .enum_list = NULL,
2813 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2817 {N_("Domain Options"), P_SEP, P_SEPARATOR},
2820 .label = "machine password timeout",
2821 .type = P_INTEGER,
2822 .p_class = P_GLOBAL,
2823 .offset = GLOBAL_VAR(machine_password_timeout),
2824 .special = NULL,
2825 .enum_list = NULL,
2826 .flags = FLAG_ADVANCED | FLAG_WIZARD,
2829 {N_("Logon Options"), P_SEP, P_SEPARATOR},
2832 .label = "add user script",
2833 .type = P_STRING,
2834 .p_class = P_GLOBAL,
2835 .offset = GLOBAL_VAR(szAddUserScript),
2836 .special = NULL,
2837 .enum_list = NULL,
2838 .flags = FLAG_ADVANCED,
2841 .label = "rename user script",
2842 .type = P_STRING,
2843 .p_class = P_GLOBAL,
2844 .offset = GLOBAL_VAR(szRenameUserScript),
2845 .special = NULL,
2846 .enum_list = NULL,
2847 .flags = FLAG_ADVANCED,
2850 .label = "delete user script",
2851 .type = P_STRING,
2852 .p_class = P_GLOBAL,
2853 .offset = GLOBAL_VAR(szDelUserScript),
2854 .special = NULL,
2855 .enum_list = NULL,
2856 .flags = FLAG_ADVANCED,
2859 .label = "add group script",
2860 .type = P_STRING,
2861 .p_class = P_GLOBAL,
2862 .offset = GLOBAL_VAR(szAddGroupScript),
2863 .special = NULL,
2864 .enum_list = NULL,
2865 .flags = FLAG_ADVANCED,
2868 .label = "delete group script",
2869 .type = P_STRING,
2870 .p_class = P_GLOBAL,
2871 .offset = GLOBAL_VAR(szDelGroupScript),
2872 .special = NULL,
2873 .enum_list = NULL,
2874 .flags = FLAG_ADVANCED,
2877 .label = "add user to group script",
2878 .type = P_STRING,
2879 .p_class = P_GLOBAL,
2880 .offset = GLOBAL_VAR(szAddUserToGroupScript),
2881 .special = NULL,
2882 .enum_list = NULL,
2883 .flags = FLAG_ADVANCED,
2886 .label = "delete user from group script",
2887 .type = P_STRING,
2888 .p_class = P_GLOBAL,
2889 .offset = GLOBAL_VAR(szDelUserFromGroupScript),
2890 .special = NULL,
2891 .enum_list = NULL,
2892 .flags = FLAG_ADVANCED,
2895 .label = "set primary group script",
2896 .type = P_STRING,
2897 .p_class = P_GLOBAL,
2898 .offset = GLOBAL_VAR(szSetPrimaryGroupScript),
2899 .special = NULL,
2900 .enum_list = NULL,
2901 .flags = FLAG_ADVANCED,
2904 .label = "add machine script",
2905 .type = P_STRING,
2906 .p_class = P_GLOBAL,
2907 .offset = GLOBAL_VAR(szAddMachineScript),
2908 .special = NULL,
2909 .enum_list = NULL,
2910 .flags = FLAG_ADVANCED,
2913 .label = "shutdown script",
2914 .type = P_STRING,
2915 .p_class = P_GLOBAL,
2916 .offset = GLOBAL_VAR(szShutdownScript),
2917 .special = NULL,
2918 .enum_list = NULL,
2919 .flags = FLAG_ADVANCED,
2922 .label = "abort shutdown script",
2923 .type = P_STRING,
2924 .p_class = P_GLOBAL,
2925 .offset = GLOBAL_VAR(szAbortShutdownScript),
2926 .special = NULL,
2927 .enum_list = NULL,
2928 .flags = FLAG_ADVANCED,
2931 .label = "username map script",
2932 .type = P_STRING,
2933 .p_class = P_GLOBAL,
2934 .offset = GLOBAL_VAR(szUsernameMapScript),
2935 .special = NULL,
2936 .enum_list = NULL,
2937 .flags = FLAG_ADVANCED,
2940 .label = "username map cache time",
2941 .type = P_INTEGER,
2942 .p_class = P_GLOBAL,
2943 .offset = GLOBAL_VAR(iUsernameMapCacheTime),
2944 .special = NULL,
2945 .enum_list = NULL,
2946 .flags = FLAG_ADVANCED,
2949 .label = "logon script",
2950 .type = P_STRING,
2951 .p_class = P_GLOBAL,
2952 .offset = GLOBAL_VAR(szLogonScript),
2953 .special = NULL,
2954 .enum_list = NULL,
2955 .flags = FLAG_ADVANCED,
2958 .label = "logon path",
2959 .type = P_STRING,
2960 .p_class = P_GLOBAL,
2961 .offset = GLOBAL_VAR(szLogonPath),
2962 .special = NULL,
2963 .enum_list = NULL,
2964 .flags = FLAG_ADVANCED,
2967 .label = "logon drive",
2968 .type = P_STRING,
2969 .p_class = P_GLOBAL,
2970 .offset = GLOBAL_VAR(szLogonDrive),
2971 .special = NULL,
2972 .enum_list = NULL,
2973 .flags = FLAG_ADVANCED,
2976 .label = "logon home",
2977 .type = P_STRING,
2978 .p_class = P_GLOBAL,
2979 .offset = GLOBAL_VAR(szLogonHome),
2980 .special = NULL,
2981 .enum_list = NULL,
2982 .flags = FLAG_ADVANCED,
2985 .label = "domain logons",
2986 .type = P_BOOL,
2987 .p_class = P_GLOBAL,
2988 .offset = GLOBAL_VAR(bDomainLogons),
2989 .special = NULL,
2990 .enum_list = NULL,
2991 .flags = FLAG_ADVANCED,
2995 .label = "init logon delayed hosts",
2996 .type = P_LIST,
2997 .p_class = P_GLOBAL,
2998 .offset = GLOBAL_VAR(szInitLogonDelayedHosts),
2999 .special = NULL,
3000 .enum_list = NULL,
3001 .flags = FLAG_ADVANCED,
3005 .label = "init logon delay",
3006 .type = P_INTEGER,
3007 .p_class = P_GLOBAL,
3008 .offset = GLOBAL_VAR(InitLogonDelay),
3009 .special = NULL,
3010 .enum_list = NULL,
3011 .flags = FLAG_ADVANCED,
3015 {N_("Browse Options"), P_SEP, P_SEPARATOR},
3018 .label = "os level",
3019 .type = P_INTEGER,
3020 .p_class = P_GLOBAL,
3021 .offset = GLOBAL_VAR(os_level),
3022 .special = NULL,
3023 .enum_list = NULL,
3024 .flags = FLAG_BASIC | FLAG_ADVANCED,
3027 .label = "lm announce",
3028 .type = P_ENUM,
3029 .p_class = P_GLOBAL,
3030 .offset = GLOBAL_VAR(lm_announce),
3031 .special = NULL,
3032 .enum_list = enum_bool_auto,
3033 .flags = FLAG_ADVANCED,
3036 .label = "lm interval",
3037 .type = P_INTEGER,
3038 .p_class = P_GLOBAL,
3039 .offset = GLOBAL_VAR(lm_interval),
3040 .special = NULL,
3041 .enum_list = NULL,
3042 .flags = FLAG_ADVANCED,
3045 .label = "preferred master",
3046 .type = P_ENUM,
3047 .p_class = P_GLOBAL,
3048 .offset = GLOBAL_VAR(iPreferredMaster),
3049 .special = NULL,
3050 .enum_list = enum_bool_auto,
3051 .flags = FLAG_BASIC | FLAG_ADVANCED,
3054 .label = "prefered master",
3055 .type = P_ENUM,
3056 .p_class = P_GLOBAL,
3057 .offset = GLOBAL_VAR(iPreferredMaster),
3058 .special = NULL,
3059 .enum_list = enum_bool_auto,
3060 .flags = FLAG_HIDE,
3063 .label = "local master",
3064 .type = P_BOOL,
3065 .p_class = P_GLOBAL,
3066 .offset = GLOBAL_VAR(bLocalMaster),
3067 .special = NULL,
3068 .enum_list = NULL,
3069 .flags = FLAG_BASIC | FLAG_ADVANCED,
3072 .label = "domain master",
3073 .type = P_ENUM,
3074 .p_class = P_GLOBAL,
3075 .offset = GLOBAL_VAR(domain_master),
3076 .special = NULL,
3077 .enum_list = enum_bool_auto,
3078 .flags = FLAG_BASIC | FLAG_ADVANCED,
3081 .label = "browse list",
3082 .type = P_BOOL,
3083 .p_class = P_GLOBAL,
3084 .offset = GLOBAL_VAR(bBrowseList),
3085 .special = NULL,
3086 .enum_list = NULL,
3087 .flags = FLAG_ADVANCED,
3090 .label = "browseable",
3091 .type = P_BOOL,
3092 .p_class = P_LOCAL,
3093 .offset = LOCAL_VAR(bBrowseable),
3094 .special = NULL,
3095 .enum_list = NULL,
3096 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3099 .label = "browsable",
3100 .type = P_BOOL,
3101 .p_class = P_LOCAL,
3102 .offset = LOCAL_VAR(bBrowseable),
3103 .special = NULL,
3104 .enum_list = NULL,
3105 .flags = FLAG_HIDE,
3108 .label = "access based share enum",
3109 .type = P_BOOL,
3110 .p_class = P_LOCAL,
3111 .offset = LOCAL_VAR(bAccessBasedShareEnum),
3112 .special = NULL,
3113 .enum_list = NULL,
3114 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE
3117 .label = "enhanced browsing",
3118 .type = P_BOOL,
3119 .p_class = P_GLOBAL,
3120 .offset = GLOBAL_VAR(enhanced_browsing),
3121 .special = NULL,
3122 .enum_list = NULL,
3123 .flags = FLAG_ADVANCED,
3126 {N_("WINS Options"), P_SEP, P_SEPARATOR},
3129 .label = "dns proxy",
3130 .type = P_BOOL,
3131 .p_class = P_GLOBAL,
3132 .offset = GLOBAL_VAR(bWINSdnsProxy),
3133 .special = NULL,
3134 .enum_list = NULL,
3135 .flags = FLAG_ADVANCED,
3138 .label = "wins proxy",
3139 .type = P_BOOL,
3140 .p_class = P_GLOBAL,
3141 .offset = GLOBAL_VAR(bWINSproxy),
3142 .special = NULL,
3143 .enum_list = NULL,
3144 .flags = FLAG_ADVANCED,
3147 .label = "wins server",
3148 .type = P_LIST,
3149 .p_class = P_GLOBAL,
3150 .offset = GLOBAL_VAR(szWINSservers),
3151 .special = NULL,
3152 .enum_list = NULL,
3153 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3156 .label = "wins support",
3157 .type = P_BOOL,
3158 .p_class = P_GLOBAL,
3159 .offset = GLOBAL_VAR(bWINSsupport),
3160 .special = NULL,
3161 .enum_list = NULL,
3162 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3165 .label = "wins hook",
3166 .type = P_STRING,
3167 .p_class = P_GLOBAL,
3168 .offset = GLOBAL_VAR(szWINSHook),
3169 .special = NULL,
3170 .enum_list = NULL,
3171 .flags = FLAG_ADVANCED,
3174 {N_("Locking Options"), P_SEP, P_SEPARATOR},
3177 .label = "blocking locks",
3178 .type = P_BOOL,
3179 .p_class = P_LOCAL,
3180 .offset = LOCAL_VAR(bBlockingLocks),
3181 .special = NULL,
3182 .enum_list = NULL,
3183 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3186 .label = "csc policy",
3187 .type = P_ENUM,
3188 .p_class = P_LOCAL,
3189 .offset = LOCAL_VAR(iCSCPolicy),
3190 .special = NULL,
3191 .enum_list = enum_csc_policy,
3192 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3195 .label = "fake oplocks",
3196 .type = P_BOOL,
3197 .p_class = P_LOCAL,
3198 .offset = LOCAL_VAR(bFakeOplocks),
3199 .special = NULL,
3200 .enum_list = NULL,
3201 .flags = FLAG_ADVANCED | FLAG_SHARE,
3204 .label = "kernel oplocks",
3205 .type = P_BOOL,
3206 .p_class = P_LOCAL,
3207 .offset = LOCAL_VAR(bKernelOplocks),
3208 .special = NULL,
3209 .enum_list = NULL,
3210 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3213 .label = "locking",
3214 .type = P_BOOL,
3215 .p_class = P_LOCAL,
3216 .offset = LOCAL_VAR(bLocking),
3217 .special = NULL,
3218 .enum_list = NULL,
3219 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3222 .label = "lock spin time",
3223 .type = P_INTEGER,
3224 .p_class = P_GLOBAL,
3225 .offset = GLOBAL_VAR(iLockSpinTime),
3226 .special = NULL,
3227 .enum_list = NULL,
3228 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3231 .label = "oplocks",
3232 .type = P_BOOL,
3233 .p_class = P_LOCAL,
3234 .offset = LOCAL_VAR(bOpLocks),
3235 .special = NULL,
3236 .enum_list = NULL,
3237 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3240 .label = "level2 oplocks",
3241 .type = P_BOOL,
3242 .p_class = P_LOCAL,
3243 .offset = LOCAL_VAR(bLevel2OpLocks),
3244 .special = NULL,
3245 .enum_list = NULL,
3246 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3249 .label = "oplock break wait time",
3250 .type = P_INTEGER,
3251 .p_class = P_GLOBAL,
3252 .offset = GLOBAL_VAR(oplock_break_wait_time),
3253 .special = NULL,
3254 .enum_list = NULL,
3255 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3258 .label = "oplock contention limit",
3259 .type = P_INTEGER,
3260 .p_class = P_LOCAL,
3261 .offset = LOCAL_VAR(iOplockContentionLimit),
3262 .special = NULL,
3263 .enum_list = NULL,
3264 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3267 .label = "posix locking",
3268 .type = P_BOOL,
3269 .p_class = P_LOCAL,
3270 .offset = LOCAL_VAR(bPosixLocking),
3271 .special = NULL,
3272 .enum_list = NULL,
3273 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3276 .label = "strict locking",
3277 .type = P_ENUM,
3278 .p_class = P_LOCAL,
3279 .offset = LOCAL_VAR(iStrictLocking),
3280 .special = NULL,
3281 .enum_list = enum_bool_auto,
3282 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3285 {N_("Ldap Options"), P_SEP, P_SEPARATOR},
3288 .label = "ldap admin dn",
3289 .type = P_STRING,
3290 .p_class = P_GLOBAL,
3291 .offset = GLOBAL_VAR(szLdapAdminDn),
3292 .special = NULL,
3293 .enum_list = NULL,
3294 .flags = FLAG_ADVANCED,
3297 .label = "ldap delete dn",
3298 .type = P_BOOL,
3299 .p_class = P_GLOBAL,
3300 .offset = GLOBAL_VAR(ldap_delete_dn),
3301 .special = NULL,
3302 .enum_list = NULL,
3303 .flags = FLAG_ADVANCED,
3306 .label = "ldap group suffix",
3307 .type = P_STRING,
3308 .p_class = P_GLOBAL,
3309 .offset = GLOBAL_VAR(szLdapGroupSuffix),
3310 .special = NULL,
3311 .enum_list = NULL,
3312 .flags = FLAG_ADVANCED,
3315 .label = "ldap idmap suffix",
3316 .type = P_STRING,
3317 .p_class = P_GLOBAL,
3318 .offset = GLOBAL_VAR(szLdapIdmapSuffix),
3319 .special = NULL,
3320 .enum_list = NULL,
3321 .flags = FLAG_ADVANCED,
3324 .label = "ldap machine suffix",
3325 .type = P_STRING,
3326 .p_class = P_GLOBAL,
3327 .offset = GLOBAL_VAR(szLdapMachineSuffix),
3328 .special = NULL,
3329 .enum_list = NULL,
3330 .flags = FLAG_ADVANCED,
3333 .label = "ldap passwd sync",
3334 .type = P_ENUM,
3335 .p_class = P_GLOBAL,
3336 .offset = GLOBAL_VAR(ldap_passwd_sync),
3337 .special = NULL,
3338 .enum_list = enum_ldap_passwd_sync,
3339 .flags = FLAG_ADVANCED,
3342 .label = "ldap password sync",
3343 .type = P_ENUM,
3344 .p_class = P_GLOBAL,
3345 .offset = GLOBAL_VAR(ldap_passwd_sync),
3346 .special = NULL,
3347 .enum_list = enum_ldap_passwd_sync,
3348 .flags = FLAG_HIDE,
3351 .label = "ldap replication sleep",
3352 .type = P_INTEGER,
3353 .p_class = P_GLOBAL,
3354 .offset = GLOBAL_VAR(ldap_replication_sleep),
3355 .special = NULL,
3356 .enum_list = NULL,
3357 .flags = FLAG_ADVANCED,
3360 .label = "ldap suffix",
3361 .type = P_STRING,
3362 .p_class = P_GLOBAL,
3363 .offset = GLOBAL_VAR(szLdapSuffix),
3364 .special = NULL,
3365 .enum_list = NULL,
3366 .flags = FLAG_ADVANCED,
3369 .label = "ldap ssl",
3370 .type = P_ENUM,
3371 .p_class = P_GLOBAL,
3372 .offset = GLOBAL_VAR(ldap_ssl),
3373 .special = NULL,
3374 .enum_list = enum_ldap_ssl,
3375 .flags = FLAG_ADVANCED,
3378 .label = "ldap ssl ads",
3379 .type = P_BOOL,
3380 .p_class = P_GLOBAL,
3381 .offset = GLOBAL_VAR(ldap_ssl_ads),
3382 .special = NULL,
3383 .enum_list = NULL,
3384 .flags = FLAG_ADVANCED,
3387 .label = "ldap deref",
3388 .type = P_ENUM,
3389 .p_class = P_GLOBAL,
3390 .offset = GLOBAL_VAR(ldap_deref),
3391 .special = NULL,
3392 .enum_list = enum_ldap_deref,
3393 .flags = FLAG_ADVANCED,
3396 .label = "ldap follow referral",
3397 .type = P_ENUM,
3398 .p_class = P_GLOBAL,
3399 .offset = GLOBAL_VAR(ldap_follow_referral),
3400 .special = NULL,
3401 .enum_list = enum_bool_auto,
3402 .flags = FLAG_ADVANCED,
3405 .label = "ldap timeout",
3406 .type = P_INTEGER,
3407 .p_class = P_GLOBAL,
3408 .offset = GLOBAL_VAR(ldap_timeout),
3409 .special = NULL,
3410 .enum_list = NULL,
3411 .flags = FLAG_ADVANCED,
3414 .label = "ldap connection timeout",
3415 .type = P_INTEGER,
3416 .p_class = P_GLOBAL,
3417 .offset = GLOBAL_VAR(ldap_connection_timeout),
3418 .special = NULL,
3419 .enum_list = NULL,
3420 .flags = FLAG_ADVANCED,
3423 .label = "ldap page size",
3424 .type = P_INTEGER,
3425 .p_class = P_GLOBAL,
3426 .offset = GLOBAL_VAR(ldap_page_size),
3427 .special = NULL,
3428 .enum_list = NULL,
3429 .flags = FLAG_ADVANCED,
3432 .label = "ldap user suffix",
3433 .type = P_STRING,
3434 .p_class = P_GLOBAL,
3435 .offset = GLOBAL_VAR(szLdapUserSuffix),
3436 .special = NULL,
3437 .enum_list = NULL,
3438 .flags = FLAG_ADVANCED,
3441 .label = "ldap debug level",
3442 .type = P_INTEGER,
3443 .p_class = P_GLOBAL,
3444 .offset = GLOBAL_VAR(ldap_debug_level),
3445 .special = handle_ldap_debug_level,
3446 .enum_list = NULL,
3447 .flags = FLAG_ADVANCED,
3450 .label = "ldap debug threshold",
3451 .type = P_INTEGER,
3452 .p_class = P_GLOBAL,
3453 .offset = GLOBAL_VAR(ldap_debug_threshold),
3454 .special = NULL,
3455 .enum_list = NULL,
3456 .flags = FLAG_ADVANCED,
3459 {N_("EventLog Options"), P_SEP, P_SEPARATOR},
3462 .label = "eventlog list",
3463 .type = P_LIST,
3464 .p_class = P_GLOBAL,
3465 .offset = GLOBAL_VAR(szEventLogs),
3466 .special = NULL,
3467 .enum_list = NULL,
3468 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
3471 {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
3474 .label = "add share command",
3475 .type = P_STRING,
3476 .p_class = P_GLOBAL,
3477 .offset = GLOBAL_VAR(szAddShareCommand),
3478 .special = NULL,
3479 .enum_list = NULL,
3480 .flags = FLAG_ADVANCED,
3483 .label = "change share command",
3484 .type = P_STRING,
3485 .p_class = P_GLOBAL,
3486 .offset = GLOBAL_VAR(szChangeShareCommand),
3487 .special = NULL,
3488 .enum_list = NULL,
3489 .flags = FLAG_ADVANCED,
3492 .label = "delete share command",
3493 .type = P_STRING,
3494 .p_class = P_GLOBAL,
3495 .offset = GLOBAL_VAR(szDeleteShareCommand),
3496 .special = NULL,
3497 .enum_list = NULL,
3498 .flags = FLAG_ADVANCED,
3501 .label = "config file",
3502 .type = P_STRING,
3503 .p_class = P_GLOBAL,
3504 .offset = GLOBAL_VAR(szConfigFile),
3505 .special = NULL,
3506 .enum_list = NULL,
3507 .flags = FLAG_HIDE|FLAG_META,
3510 .label = "preload",
3511 .type = P_STRING,
3512 .p_class = P_GLOBAL,
3513 .offset = GLOBAL_VAR(szAutoServices),
3514 .special = NULL,
3515 .enum_list = NULL,
3516 .flags = FLAG_ADVANCED,
3519 .label = "auto services",
3520 .type = P_STRING,
3521 .p_class = P_GLOBAL,
3522 .offset = GLOBAL_VAR(szAutoServices),
3523 .special = NULL,
3524 .enum_list = NULL,
3525 .flags = FLAG_ADVANCED,
3528 .label = "lock directory",
3529 .type = P_STRING,
3530 .p_class = P_GLOBAL,
3531 .offset = GLOBAL_VAR(szLockDir),
3532 .special = NULL,
3533 .enum_list = NULL,
3534 .flags = FLAG_ADVANCED,
3537 .label = "lock dir",
3538 .type = P_STRING,
3539 .p_class = P_GLOBAL,
3540 .offset = GLOBAL_VAR(szLockDir),
3541 .special = NULL,
3542 .enum_list = NULL,
3543 .flags = FLAG_HIDE,
3546 .label = "state directory",
3547 .type = P_STRING,
3548 .p_class = P_GLOBAL,
3549 .offset = GLOBAL_VAR(szStateDir),
3550 .special = NULL,
3551 .enum_list = NULL,
3552 .flags = FLAG_ADVANCED,
3555 .label = "cache directory",
3556 .type = P_STRING,
3557 .p_class = P_GLOBAL,
3558 .offset = GLOBAL_VAR(szCacheDir),
3559 .special = NULL,
3560 .enum_list = NULL,
3561 .flags = FLAG_ADVANCED,
3564 .label = "pid directory",
3565 .type = P_STRING,
3566 .p_class = P_GLOBAL,
3567 .offset = GLOBAL_VAR(szPidDir),
3568 .special = NULL,
3569 .enum_list = NULL,
3570 .flags = FLAG_ADVANCED,
3573 .label = "ntp signd socket directory",
3574 .type = P_STRING,
3575 .p_class = P_GLOBAL,
3576 .offset = GLOBAL_VAR(szNTPSignDSocketDirectory),
3577 .special = NULL,
3578 .enum_list = NULL,
3579 .flags = FLAG_ADVANCED,
3582 #ifdef WITH_UTMP
3584 .label = "utmp directory",
3585 .type = P_STRING,
3586 .p_class = P_GLOBAL,
3587 .offset = GLOBAL_VAR(szUtmpDir),
3588 .special = NULL,
3589 .enum_list = NULL,
3590 .flags = FLAG_ADVANCED,
3593 .label = "wtmp directory",
3594 .type = P_STRING,
3595 .p_class = P_GLOBAL,
3596 .offset = GLOBAL_VAR(szWtmpDir),
3597 .special = NULL,
3598 .enum_list = NULL,
3599 .flags = FLAG_ADVANCED,
3602 .label = "utmp",
3603 .type = P_BOOL,
3604 .p_class = P_GLOBAL,
3605 .offset = GLOBAL_VAR(bUtmp),
3606 .special = NULL,
3607 .enum_list = NULL,
3608 .flags = FLAG_ADVANCED,
3610 #endif
3612 .label = "default service",
3613 .type = P_STRING,
3614 .p_class = P_GLOBAL,
3615 .offset = GLOBAL_VAR(szDefaultService),
3616 .special = NULL,
3617 .enum_list = NULL,
3618 .flags = FLAG_ADVANCED,
3621 .label = "default",
3622 .type = P_STRING,
3623 .p_class = P_GLOBAL,
3624 .offset = GLOBAL_VAR(szDefaultService),
3625 .special = NULL,
3626 .enum_list = NULL,
3627 .flags = FLAG_ADVANCED,
3630 .label = "message command",
3631 .type = P_STRING,
3632 .p_class = P_GLOBAL,
3633 .offset = GLOBAL_VAR(szMsgCommand),
3634 .special = NULL,
3635 .enum_list = NULL,
3636 .flags = FLAG_ADVANCED,
3639 .label = "dfree cache time",
3640 .type = P_INTEGER,
3641 .p_class = P_LOCAL,
3642 .offset = LOCAL_VAR(iDfreeCacheTime),
3643 .special = NULL,
3644 .enum_list = NULL,
3645 .flags = FLAG_ADVANCED,
3648 .label = "dfree command",
3649 .type = P_STRING,
3650 .p_class = P_LOCAL,
3651 .offset = LOCAL_VAR(szDfree),
3652 .special = NULL,
3653 .enum_list = NULL,
3654 .flags = FLAG_ADVANCED,
3657 .label = "get quota command",
3658 .type = P_STRING,
3659 .p_class = P_GLOBAL,
3660 .offset = GLOBAL_VAR(szGetQuota),
3661 .special = NULL,
3662 .enum_list = NULL,
3663 .flags = FLAG_ADVANCED,
3666 .label = "set quota command",
3667 .type = P_STRING,
3668 .p_class = P_GLOBAL,
3669 .offset = GLOBAL_VAR(szSetQuota),
3670 .special = NULL,
3671 .enum_list = NULL,
3672 .flags = FLAG_ADVANCED,
3675 .label = "remote announce",
3676 .type = P_STRING,
3677 .p_class = P_GLOBAL,
3678 .offset = GLOBAL_VAR(szRemoteAnnounce),
3679 .special = NULL,
3680 .enum_list = NULL,
3681 .flags = FLAG_ADVANCED,
3684 .label = "remote browse sync",
3685 .type = P_STRING,
3686 .p_class = P_GLOBAL,
3687 .offset = GLOBAL_VAR(szRemoteBrowseSync),
3688 .special = NULL,
3689 .enum_list = NULL,
3690 .flags = FLAG_ADVANCED,
3693 .label = "socket address",
3694 .type = P_STRING,
3695 .p_class = P_GLOBAL,
3696 .offset = GLOBAL_VAR(szSocketAddress),
3697 .special = NULL,
3698 .enum_list = NULL,
3699 .flags = FLAG_ADVANCED,
3702 .label = "nmbd bind explicit broadcast",
3703 .type = P_BOOL,
3704 .p_class = P_GLOBAL,
3705 .offset = GLOBAL_VAR(bNmbdBindExplicitBroadcast),
3706 .special = NULL,
3707 .enum_list = NULL,
3708 .flags = FLAG_ADVANCED,
3711 .label = "homedir map",
3712 .type = P_STRING,
3713 .p_class = P_GLOBAL,
3714 .offset = GLOBAL_VAR(szNISHomeMapName),
3715 .special = NULL,
3716 .enum_list = NULL,
3717 .flags = FLAG_ADVANCED,
3720 .label = "afs username map",
3721 .type = P_STRING,
3722 .p_class = P_GLOBAL,
3723 .offset = GLOBAL_VAR(szAfsUsernameMap),
3724 .special = NULL,
3725 .enum_list = NULL,
3726 .flags = FLAG_ADVANCED,
3729 .label = "afs token lifetime",
3730 .type = P_INTEGER,
3731 .p_class = P_GLOBAL,
3732 .offset = GLOBAL_VAR(iAfsTokenLifetime),
3733 .special = NULL,
3734 .enum_list = NULL,
3735 .flags = FLAG_ADVANCED,
3738 .label = "log nt token command",
3739 .type = P_STRING,
3740 .p_class = P_GLOBAL,
3741 .offset = GLOBAL_VAR(szLogNtTokenCommand),
3742 .special = NULL,
3743 .enum_list = NULL,
3744 .flags = FLAG_ADVANCED,
3747 .label = "NIS homedir",
3748 .type = P_BOOL,
3749 .p_class = P_GLOBAL,
3750 .offset = GLOBAL_VAR(bNISHomeMap),
3751 .special = NULL,
3752 .enum_list = NULL,
3753 .flags = FLAG_ADVANCED,
3756 .label = "-valid",
3757 .type = P_BOOL,
3758 .p_class = P_LOCAL,
3759 .offset = LOCAL_VAR(valid),
3760 .special = NULL,
3761 .enum_list = NULL,
3762 .flags = FLAG_HIDE,
3765 .label = "copy",
3766 .type = P_STRING,
3767 .p_class = P_LOCAL,
3768 .offset = LOCAL_VAR(szCopy),
3769 .special = handle_copy,
3770 .enum_list = NULL,
3771 .flags = FLAG_HIDE,
3774 .label = "include",
3775 .type = P_STRING,
3776 .p_class = P_LOCAL,
3777 .offset = LOCAL_VAR(szInclude),
3778 .special = handle_include,
3779 .enum_list = NULL,
3780 .flags = FLAG_HIDE|FLAG_META,
3783 .label = "preexec",
3784 .type = P_STRING,
3785 .p_class = P_LOCAL,
3786 .offset = LOCAL_VAR(szPreExec),
3787 .special = NULL,
3788 .enum_list = NULL,
3789 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3792 .label = "exec",
3793 .type = P_STRING,
3794 .p_class = P_LOCAL,
3795 .offset = LOCAL_VAR(szPreExec),
3796 .special = NULL,
3797 .enum_list = NULL,
3798 .flags = FLAG_ADVANCED,
3801 .label = "preexec close",
3802 .type = P_BOOL,
3803 .p_class = P_LOCAL,
3804 .offset = LOCAL_VAR(bPreexecClose),
3805 .special = NULL,
3806 .enum_list = NULL,
3807 .flags = FLAG_ADVANCED | FLAG_SHARE,
3810 .label = "postexec",
3811 .type = P_STRING,
3812 .p_class = P_LOCAL,
3813 .offset = LOCAL_VAR(szPostExec),
3814 .special = NULL,
3815 .enum_list = NULL,
3816 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3819 .label = "root preexec",
3820 .type = P_STRING,
3821 .p_class = P_LOCAL,
3822 .offset = LOCAL_VAR(szRootPreExec),
3823 .special = NULL,
3824 .enum_list = NULL,
3825 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3828 .label = "root preexec close",
3829 .type = P_BOOL,
3830 .p_class = P_LOCAL,
3831 .offset = LOCAL_VAR(bRootpreexecClose),
3832 .special = NULL,
3833 .enum_list = NULL,
3834 .flags = FLAG_ADVANCED | FLAG_SHARE,
3837 .label = "root postexec",
3838 .type = P_STRING,
3839 .p_class = P_LOCAL,
3840 .offset = LOCAL_VAR(szRootPostExec),
3841 .special = NULL,
3842 .enum_list = NULL,
3843 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3846 .label = "available",
3847 .type = P_BOOL,
3848 .p_class = P_LOCAL,
3849 .offset = LOCAL_VAR(bAvailable),
3850 .special = NULL,
3851 .enum_list = NULL,
3852 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3855 .label = "registry shares",
3856 .type = P_BOOL,
3857 .p_class = P_GLOBAL,
3858 .offset = GLOBAL_VAR(bRegistryShares),
3859 .special = NULL,
3860 .enum_list = NULL,
3861 .flags = FLAG_ADVANCED,
3864 .label = "usershare allow guests",
3865 .type = P_BOOL,
3866 .p_class = P_GLOBAL,
3867 .offset = GLOBAL_VAR(bUsershareAllowGuests),
3868 .special = NULL,
3869 .enum_list = NULL,
3870 .flags = FLAG_ADVANCED,
3873 .label = "usershare max shares",
3874 .type = P_INTEGER,
3875 .p_class = P_GLOBAL,
3876 .offset = GLOBAL_VAR(iUsershareMaxShares),
3877 .special = NULL,
3878 .enum_list = NULL,
3879 .flags = FLAG_ADVANCED,
3882 .label = "usershare owner only",
3883 .type = P_BOOL,
3884 .p_class = P_GLOBAL,
3885 .offset = GLOBAL_VAR(bUsershareOwnerOnly),
3886 .special = NULL,
3887 .enum_list = NULL,
3888 .flags = FLAG_ADVANCED,
3891 .label = "usershare path",
3892 .type = P_STRING,
3893 .p_class = P_GLOBAL,
3894 .offset = GLOBAL_VAR(szUsersharePath),
3895 .special = NULL,
3896 .enum_list = NULL,
3897 .flags = FLAG_ADVANCED,
3900 .label = "usershare prefix allow list",
3901 .type = P_LIST,
3902 .p_class = P_GLOBAL,
3903 .offset = GLOBAL_VAR(szUsersharePrefixAllowList),
3904 .special = NULL,
3905 .enum_list = NULL,
3906 .flags = FLAG_ADVANCED,
3909 .label = "usershare prefix deny list",
3910 .type = P_LIST,
3911 .p_class = P_GLOBAL,
3912 .offset = GLOBAL_VAR(szUsersharePrefixDenyList),
3913 .special = NULL,
3914 .enum_list = NULL,
3915 .flags = FLAG_ADVANCED,
3918 .label = "usershare template share",
3919 .type = P_STRING,
3920 .p_class = P_GLOBAL,
3921 .offset = GLOBAL_VAR(szUsershareTemplateShare),
3922 .special = NULL,
3923 .enum_list = NULL,
3924 .flags = FLAG_ADVANCED,
3927 .label = "volume",
3928 .type = P_STRING,
3929 .p_class = P_LOCAL,
3930 .offset = LOCAL_VAR(volume),
3931 .special = NULL,
3932 .enum_list = NULL,
3933 .flags = FLAG_ADVANCED | FLAG_SHARE,
3936 .label = "fstype",
3937 .type = P_STRING,
3938 .p_class = P_LOCAL,
3939 .offset = LOCAL_VAR(fstype),
3940 .special = NULL,
3941 .enum_list = NULL,
3942 .flags = FLAG_ADVANCED | FLAG_SHARE,
3945 .label = "set directory",
3946 .type = P_BOOLREV,
3947 .p_class = P_LOCAL,
3948 .offset = LOCAL_VAR(bNo_set_dir),
3949 .special = NULL,
3950 .enum_list = NULL,
3951 .flags = FLAG_ADVANCED | FLAG_SHARE,
3954 .label = "allow insecure wide links",
3955 .type = P_BOOL,
3956 .p_class = P_GLOBAL,
3957 .offset = GLOBAL_VAR(bAllowInsecureWidelinks),
3958 .special = NULL,
3959 .enum_list = NULL,
3960 .flags = FLAG_ADVANCED,
3963 .label = "wide links",
3964 .type = P_BOOL,
3965 .p_class = P_LOCAL,
3966 .offset = LOCAL_VAR(bWidelinks),
3967 .special = NULL,
3968 .enum_list = NULL,
3969 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3972 .label = "follow symlinks",
3973 .type = P_BOOL,
3974 .p_class = P_LOCAL,
3975 .offset = LOCAL_VAR(bSymlinks),
3976 .special = NULL,
3977 .enum_list = NULL,
3978 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3981 .label = "dont descend",
3982 .type = P_STRING,
3983 .p_class = P_LOCAL,
3984 .offset = LOCAL_VAR(szDontdescend),
3985 .special = NULL,
3986 .enum_list = NULL,
3987 .flags = FLAG_ADVANCED | FLAG_SHARE,
3990 .label = "magic script",
3991 .type = P_STRING,
3992 .p_class = P_LOCAL,
3993 .offset = LOCAL_VAR(szMagicScript),
3994 .special = NULL,
3995 .enum_list = NULL,
3996 .flags = FLAG_ADVANCED | FLAG_SHARE,
3999 .label = "magic output",
4000 .type = P_STRING,
4001 .p_class = P_LOCAL,
4002 .offset = LOCAL_VAR(szMagicOutput),
4003 .special = NULL,
4004 .enum_list = NULL,
4005 .flags = FLAG_ADVANCED | FLAG_SHARE,
4008 .label = "delete readonly",
4009 .type = P_BOOL,
4010 .p_class = P_LOCAL,
4011 .offset = LOCAL_VAR(bDeleteReadonly),
4012 .special = NULL,
4013 .enum_list = NULL,
4014 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4017 .label = "dos filemode",
4018 .type = P_BOOL,
4019 .p_class = P_LOCAL,
4020 .offset = LOCAL_VAR(bDosFilemode),
4021 .special = NULL,
4022 .enum_list = NULL,
4023 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4026 .label = "dos filetimes",
4027 .type = P_BOOL,
4028 .p_class = P_LOCAL,
4029 .offset = LOCAL_VAR(bDosFiletimes),
4030 .special = NULL,
4031 .enum_list = NULL,
4032 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4035 .label = "dos filetime resolution",
4036 .type = P_BOOL,
4037 .p_class = P_LOCAL,
4038 .offset = LOCAL_VAR(bDosFiletimeResolution),
4039 .special = NULL,
4040 .enum_list = NULL,
4041 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4044 .label = "fake directory create times",
4045 .type = P_BOOL,
4046 .p_class = P_LOCAL,
4047 .offset = LOCAL_VAR(bFakeDirCreateTimes),
4048 .special = NULL,
4049 .enum_list = NULL,
4050 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4053 .label = "async smb echo handler",
4054 .type = P_BOOL,
4055 .p_class = P_GLOBAL,
4056 .offset = GLOBAL_VAR(bAsyncSMBEchoHandler),
4057 .special = NULL,
4058 .enum_list = NULL,
4059 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4062 .label = "panic action",
4063 .type = P_STRING,
4064 .p_class = P_GLOBAL,
4065 .offset = GLOBAL_VAR(szPanicAction),
4066 .special = NULL,
4067 .enum_list = NULL,
4068 .flags = FLAG_ADVANCED,
4071 .label = "perfcount module",
4072 .type = P_STRING,
4073 .p_class = P_GLOBAL,
4074 .offset = GLOBAL_VAR(szSMBPerfcountModule),
4075 .special = NULL,
4076 .enum_list = NULL,
4077 .flags = FLAG_ADVANCED,
4080 {N_("VFS module options"), P_SEP, P_SEPARATOR},
4083 .label = "vfs objects",
4084 .type = P_LIST,
4085 .p_class = P_LOCAL,
4086 .offset = LOCAL_VAR(szVfsObjects),
4087 .special = NULL,
4088 .enum_list = NULL,
4089 .flags = FLAG_ADVANCED | FLAG_SHARE,
4092 .label = "vfs object",
4093 .type = P_LIST,
4094 .p_class = P_LOCAL,
4095 .offset = LOCAL_VAR(szVfsObjects),
4096 .special = NULL,
4097 .enum_list = NULL,
4098 .flags = FLAG_HIDE,
4102 {N_("MSDFS options"), P_SEP, P_SEPARATOR},
4105 .label = "msdfs root",
4106 .type = P_BOOL,
4107 .p_class = P_LOCAL,
4108 .offset = LOCAL_VAR(bMSDfsRoot),
4109 .special = NULL,
4110 .enum_list = NULL,
4111 .flags = FLAG_ADVANCED | FLAG_SHARE,
4114 .label = "msdfs proxy",
4115 .type = P_STRING,
4116 .p_class = P_LOCAL,
4117 .offset = LOCAL_VAR(szMSDfsProxy),
4118 .special = NULL,
4119 .enum_list = NULL,
4120 .flags = FLAG_ADVANCED | FLAG_SHARE,
4123 .label = "host msdfs",
4124 .type = P_BOOL,
4125 .p_class = P_GLOBAL,
4126 .offset = GLOBAL_VAR(bHostMSDfs),
4127 .special = NULL,
4128 .enum_list = NULL,
4129 .flags = FLAG_ADVANCED,
4132 {N_("Winbind options"), P_SEP, P_SEPARATOR},
4135 .label = "passdb expand explicit",
4136 .type = P_BOOL,
4137 .p_class = P_GLOBAL,
4138 .offset = GLOBAL_VAR(bPassdbExpandExplicit),
4139 .special = NULL,
4140 .enum_list = NULL,
4141 .flags = FLAG_ADVANCED,
4144 .label = "idmap backend",
4145 .type = P_STRING,
4146 .p_class = P_GLOBAL,
4147 .offset = GLOBAL_VAR(szIdmapBackend),
4148 .special = handle_idmap_backend,
4149 .enum_list = NULL,
4150 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
4153 .label = "idmap cache time",
4154 .type = P_INTEGER,
4155 .p_class = P_GLOBAL,
4156 .offset = GLOBAL_VAR(iIdmapCacheTime),
4157 .special = NULL,
4158 .enum_list = NULL,
4159 .flags = FLAG_ADVANCED,
4162 .label = "idmap negative cache time",
4163 .type = P_INTEGER,
4164 .p_class = P_GLOBAL,
4165 .offset = GLOBAL_VAR(iIdmapNegativeCacheTime),
4166 .special = NULL,
4167 .enum_list = NULL,
4168 .flags = FLAG_ADVANCED,
4171 .label = "idmap uid",
4172 .type = P_STRING,
4173 .p_class = P_GLOBAL,
4174 .offset = GLOBAL_VAR(szIdmapUID),
4175 .special = handle_idmap_uid,
4176 .enum_list = NULL,
4177 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
4180 .label = "winbind uid",
4181 .type = P_STRING,
4182 .p_class = P_GLOBAL,
4183 .offset = GLOBAL_VAR(szIdmapUID),
4184 .special = handle_idmap_uid,
4185 .enum_list = NULL,
4186 .flags = FLAG_HIDE,
4189 .label = "idmap gid",
4190 .type = P_STRING,
4191 .p_class = P_GLOBAL,
4192 .offset = GLOBAL_VAR(szIdmapGID),
4193 .special = handle_idmap_gid,
4194 .enum_list = NULL,
4195 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
4198 .label = "winbind gid",
4199 .type = P_STRING,
4200 .p_class = P_GLOBAL,
4201 .offset = GLOBAL_VAR(szIdmapGID),
4202 .special = handle_idmap_gid,
4203 .enum_list = NULL,
4204 .flags = FLAG_HIDE,
4207 .label = "template homedir",
4208 .type = P_STRING,
4209 .p_class = P_GLOBAL,
4210 .offset = GLOBAL_VAR(szTemplateHomedir),
4211 .special = NULL,
4212 .enum_list = NULL,
4213 .flags = FLAG_ADVANCED,
4216 .label = "template shell",
4217 .type = P_STRING,
4218 .p_class = P_GLOBAL,
4219 .offset = GLOBAL_VAR(szTemplateShell),
4220 .special = NULL,
4221 .enum_list = NULL,
4222 .flags = FLAG_ADVANCED,
4225 .label = "winbind separator",
4226 .type = P_STRING,
4227 .p_class = P_GLOBAL,
4228 .offset = GLOBAL_VAR(szWinbindSeparator),
4229 .special = NULL,
4230 .enum_list = NULL,
4231 .flags = FLAG_ADVANCED,
4234 .label = "winbind cache time",
4235 .type = P_INTEGER,
4236 .p_class = P_GLOBAL,
4237 .offset = GLOBAL_VAR(winbind_cache_time),
4238 .special = NULL,
4239 .enum_list = NULL,
4240 .flags = FLAG_ADVANCED,
4243 .label = "winbind reconnect delay",
4244 .type = P_INTEGER,
4245 .p_class = P_GLOBAL,
4246 .offset = GLOBAL_VAR(winbind_reconnect_delay),
4247 .special = NULL,
4248 .enum_list = NULL,
4249 .flags = FLAG_ADVANCED,
4252 .label = "winbind max clients",
4253 .type = P_INTEGER,
4254 .p_class = P_GLOBAL,
4255 .offset = GLOBAL_VAR(winbind_max_clients),
4256 .special = NULL,
4257 .enum_list = NULL,
4258 .flags = FLAG_ADVANCED,
4261 .label = "winbind enum users",
4262 .type = P_BOOL,
4263 .p_class = P_GLOBAL,
4264 .offset = GLOBAL_VAR(bWinbindEnumUsers),
4265 .special = NULL,
4266 .enum_list = NULL,
4267 .flags = FLAG_ADVANCED,
4270 .label = "winbind enum groups",
4271 .type = P_BOOL,
4272 .p_class = P_GLOBAL,
4273 .offset = GLOBAL_VAR(bWinbindEnumGroups),
4274 .special = NULL,
4275 .enum_list = NULL,
4276 .flags = FLAG_ADVANCED,
4279 .label = "winbind use default domain",
4280 .type = P_BOOL,
4281 .p_class = P_GLOBAL,
4282 .offset = GLOBAL_VAR(bWinbindUseDefaultDomain),
4283 .special = NULL,
4284 .enum_list = NULL,
4285 .flags = FLAG_ADVANCED,
4288 .label = "winbind trusted domains only",
4289 .type = P_BOOL,
4290 .p_class = P_GLOBAL,
4291 .offset = GLOBAL_VAR(bWinbindTrustedDomainsOnly),
4292 .special = NULL,
4293 .enum_list = NULL,
4294 .flags = FLAG_ADVANCED,
4297 .label = "winbind nested groups",
4298 .type = P_BOOL,
4299 .p_class = P_GLOBAL,
4300 .offset = GLOBAL_VAR(bWinbindNestedGroups),
4301 .special = NULL,
4302 .enum_list = NULL,
4303 .flags = FLAG_ADVANCED,
4306 .label = "winbind expand groups",
4307 .type = P_INTEGER,
4308 .p_class = P_GLOBAL,
4309 .offset = GLOBAL_VAR(winbind_expand_groups),
4310 .special = NULL,
4311 .enum_list = NULL,
4312 .flags = FLAG_ADVANCED,
4315 .label = "winbind nss info",
4316 .type = P_LIST,
4317 .p_class = P_GLOBAL,
4318 .offset = GLOBAL_VAR(szWinbindNssInfo),
4319 .special = NULL,
4320 .enum_list = NULL,
4321 .flags = FLAG_ADVANCED,
4324 .label = "winbind refresh tickets",
4325 .type = P_BOOL,
4326 .p_class = P_GLOBAL,
4327 .offset = GLOBAL_VAR(bWinbindRefreshTickets),
4328 .special = NULL,
4329 .enum_list = NULL,
4330 .flags = FLAG_ADVANCED,
4333 .label = "winbind offline logon",
4334 .type = P_BOOL,
4335 .p_class = P_GLOBAL,
4336 .offset = GLOBAL_VAR(bWinbindOfflineLogon),
4337 .special = NULL,
4338 .enum_list = NULL,
4339 .flags = FLAG_ADVANCED,
4342 .label = "winbind normalize names",
4343 .type = P_BOOL,
4344 .p_class = P_GLOBAL,
4345 .offset = GLOBAL_VAR(bWinbindNormalizeNames),
4346 .special = NULL,
4347 .enum_list = NULL,
4348 .flags = FLAG_ADVANCED,
4351 .label = "winbind rpc only",
4352 .type = P_BOOL,
4353 .p_class = P_GLOBAL,
4354 .offset = GLOBAL_VAR(bWinbindRpcOnly),
4355 .special = NULL,
4356 .enum_list = NULL,
4357 .flags = FLAG_ADVANCED,
4360 .label = "create krb5 conf",
4361 .type = P_BOOL,
4362 .p_class = P_GLOBAL,
4363 .offset = GLOBAL_VAR(bCreateKrb5Conf),
4364 .special = NULL,
4365 .enum_list = NULL,
4366 .flags = FLAG_ADVANCED,
4369 .label = "ncalrpc dir",
4370 .type = P_STRING,
4371 .p_class = P_GLOBAL,
4372 .offset = GLOBAL_VAR(ncalrpc_dir),
4373 .special = NULL,
4374 .enum_list = NULL,
4375 .flags = FLAG_ADVANCED,
4378 .label = "winbind max domain connections",
4379 .type = P_INTEGER,
4380 .p_class = P_GLOBAL,
4381 .offset = GLOBAL_VAR(winbindMaxDomainConnections),
4382 .special = NULL,
4383 .enum_list = NULL,
4384 .flags = FLAG_ADVANCED,
4387 .label = "winbindd socket directory",
4388 .type = P_STRING,
4389 .p_class = P_GLOBAL,
4390 .offset = GLOBAL_VAR(szWinbinddSocketDirectory),
4391 .special = NULL,
4392 .enum_list = NULL,
4393 .flags = FLAG_ADVANCED,
4396 .label = "winbindd privileged socket directory",
4397 .type = P_STRING,
4398 .p_class = P_GLOBAL,
4399 .offset = GLOBAL_VAR(szWinbinddPrivilegedSocketDirectory),
4400 .special = NULL,
4401 .enum_list = NULL,
4402 .flags = FLAG_ADVANCED,
4405 .label = "winbind sealed pipes",
4406 .type = P_BOOL,
4407 .p_class = P_GLOBAL,
4408 .offset = GLOBAL_VAR(bWinbindSealedPipes),
4409 .special = NULL,
4410 .enum_list = NULL,
4411 .flags = FLAG_ADVANCED,
4414 {N_("DNS options"), P_SEP, P_SEPARATOR},
4416 .label = "allow dns updates",
4417 .type = P_ENUM,
4418 .p_class = P_GLOBAL,
4419 .offset = GLOBAL_VAR(allow_dns_updates),
4420 .special = NULL,
4421 .enum_list = enum_dns_update_settings,
4422 .flags = FLAG_ADVANCED,
4425 .label = "dns forwarder",
4426 .type = P_STRING,
4427 .p_class = P_GLOBAL,
4428 .offset = GLOBAL_VAR(dns_forwarder),
4429 .special = NULL,
4430 .enum_list = NULL,
4431 .flags = FLAG_ADVANCED,
4434 .label = "dns recursive queries",
4435 .type = P_BOOL,
4436 .p_class = P_GLOBAL,
4437 .offset = GLOBAL_VAR(dns_recursive_queries),
4438 .special = NULL,
4439 .enum_list = NULL
4442 .label = "dns update command",
4443 .type = P_CMDLIST,
4444 .p_class = P_GLOBAL,
4445 .offset = GLOBAL_VAR(szDNSUpdateCommand),
4446 .special = NULL,
4447 .enum_list = NULL,
4448 .flags = FLAG_ADVANCED,
4451 .label = "nsupdate command",
4452 .type = P_CMDLIST,
4453 .p_class = P_GLOBAL,
4454 .offset = GLOBAL_VAR(szNSUpdateCommand),
4455 .special = NULL,
4456 .enum_list = NULL,
4457 .flags = FLAG_ADVANCED,
4460 .label = "rndc command",
4461 .type = P_CMDLIST,
4462 .p_class = P_GLOBAL,
4463 .offset = GLOBAL_VAR(szRNDCCommand),
4464 .special = NULL,
4465 .enum_list = NULL,
4466 .flags = FLAG_ADVANCED,
4469 .label = "multicast dns register",
4470 .type = P_BOOL,
4471 .p_class = P_GLOBAL,
4472 .offset = GLOBAL_VAR(bMulticastDnsRegister),
4473 .special = NULL,
4474 .enum_list = NULL,
4475 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4478 {N_("AD DC options"), P_SEP, P_SEPARATOR},
4481 .label = "samba kcc command",
4482 .type = P_CMDLIST,
4483 .p_class = P_GLOBAL,
4484 .offset = GLOBAL_VAR(szSambaKCCCommand),
4485 .special = NULL,
4486 .enum_list = NULL,
4487 .flags = FLAG_ADVANCED,
4490 .label = "server services",
4491 .type = P_LIST,
4492 .p_class = P_GLOBAL,
4493 .offset = GLOBAL_VAR(server_services),
4494 .special = NULL,
4495 .enum_list = NULL
4498 .label = "dcerpc endpoint servers",
4499 .type = P_LIST,
4500 .p_class = P_GLOBAL,
4501 .offset = GLOBAL_VAR(dcerpc_ep_servers),
4502 .special = NULL,
4503 .enum_list = NULL
4506 .label = "spn update command",
4507 .type = P_CMDLIST,
4508 .p_class = P_GLOBAL,
4509 .offset = GLOBAL_VAR(szSPNUpdateCommand),
4510 .special = NULL,
4511 .enum_list = NULL,
4512 .flags = FLAG_ADVANCED,
4515 .label = "share backend",
4516 .type = P_STRING,
4517 .p_class = P_GLOBAL,
4518 .offset = GLOBAL_VAR(szShareBackend),
4519 .special = NULL,
4520 .enum_list = NULL
4523 .label = "ntvfs handler",
4524 .type = P_LIST,
4525 .p_class = P_LOCAL,
4526 .offset = LOCAL_VAR(ntvfs_handler),
4527 .special = NULL,
4528 .enum_list = NULL
4531 {N_("TLS options"), P_SEP, P_SEPARATOR},
4534 .label = "tls enabled",
4535 .type = P_BOOL,
4536 .p_class = P_GLOBAL,
4537 .offset = GLOBAL_VAR(tls_enabled),
4538 .special = NULL,
4539 .enum_list = NULL
4542 .label = "tls keyfile",
4543 .type = P_STRING,
4544 .p_class = P_GLOBAL,
4545 .offset = GLOBAL_VAR(tls_keyfile),
4546 .special = NULL,
4547 .enum_list = NULL
4550 .label = "tls certfile",
4551 .type = P_STRING,
4552 .p_class = P_GLOBAL,
4553 .offset = GLOBAL_VAR(tls_certfile),
4554 .special = NULL,
4555 .enum_list = NULL
4558 .label = "tls cafile",
4559 .type = P_STRING,
4560 .p_class = P_GLOBAL,
4561 .offset = GLOBAL_VAR(tls_cafile),
4562 .special = NULL,
4563 .enum_list = NULL
4566 .label = "tls crlfile",
4567 .type = P_STRING,
4568 .p_class = P_GLOBAL,
4569 .offset = GLOBAL_VAR(tls_crlfile),
4570 .special = NULL,
4571 .enum_list = NULL
4574 .label = "tls dh params file",
4575 .type = P_STRING,
4576 .p_class = P_GLOBAL,
4577 .offset = GLOBAL_VAR(tls_dhpfile),
4578 .special = NULL,
4579 .enum_list = NULL
4582 {NULL, P_BOOL, P_NONE, 0, NULL, NULL, 0}
4585 /***************************************************************************
4586 Initialise the sDefault parameter structure for the printer values.
4587 ***************************************************************************/
4589 static void init_printer_values(struct loadparm_service *pService)
4591 /* choose defaults depending on the type of printing */
4592 switch (pService->iPrinting) {
4593 case PRINT_BSD:
4594 case PRINT_AIX:
4595 case PRINT_LPRNT:
4596 case PRINT_LPROS2:
4597 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4598 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4599 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4600 break;
4602 case PRINT_LPRNG:
4603 case PRINT_PLP:
4604 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4605 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4606 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4607 string_set(&pService->szQueuepausecommand, "lpc stop '%p'");
4608 string_set(&pService->szQueueresumecommand, "lpc start '%p'");
4609 string_set(&pService->szLppausecommand, "lpc hold '%p' %j");
4610 string_set(&pService->szLpresumecommand, "lpc release '%p' %j");
4611 break;
4613 case PRINT_CUPS:
4614 case PRINT_IPRINT:
4615 #ifdef HAVE_CUPS
4616 /* set the lpq command to contain the destination printer
4617 name only. This is used by cups_queue_get() */
4618 string_set(&pService->szLpqcommand, "%p");
4619 string_set(&pService->szLprmcommand, "");
4620 string_set(&pService->szPrintcommand, "");
4621 string_set(&pService->szLppausecommand, "");
4622 string_set(&pService->szLpresumecommand, "");
4623 string_set(&pService->szQueuepausecommand, "");
4624 string_set(&pService->szQueueresumecommand, "");
4625 #else
4626 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4627 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4628 string_set(&pService->szPrintcommand, "lpr -P'%p' %s; rm %s");
4629 string_set(&pService->szLppausecommand, "lp -i '%p-%j' -H hold");
4630 string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
4631 string_set(&pService->szQueuepausecommand, "disable '%p'");
4632 string_set(&pService->szQueueresumecommand, "enable '%p'");
4633 #endif /* HAVE_CUPS */
4634 break;
4636 case PRINT_SYSV:
4637 case PRINT_HPUX:
4638 string_set(&pService->szLpqcommand, "lpstat -o%p");
4639 string_set(&pService->szLprmcommand, "cancel %p-%j");
4640 string_set(&pService->szPrintcommand, "lp -c -d%p %s; rm %s");
4641 string_set(&pService->szQueuepausecommand, "disable %p");
4642 string_set(&pService->szQueueresumecommand, "enable %p");
4643 #ifndef HPUX
4644 string_set(&pService->szLppausecommand, "lp -i %p-%j -H hold");
4645 string_set(&pService->szLpresumecommand, "lp -i %p-%j -H resume");
4646 #endif /* HPUX */
4647 break;
4649 case PRINT_QNX:
4650 string_set(&pService->szLpqcommand, "lpq -P%p");
4651 string_set(&pService->szLprmcommand, "lprm -P%p %j");
4652 string_set(&pService->szPrintcommand, "lp -r -P%p %s");
4653 break;
4655 #if defined(DEVELOPER) || defined(ENABLE_BUILD_FARM_HACKS)
4657 case PRINT_TEST:
4658 case PRINT_VLP: {
4659 const char *tdbfile;
4660 TALLOC_CTX *tmp_ctx = talloc_stackframe();
4661 char *tmp;
4663 tdbfile = talloc_asprintf(
4664 tmp_ctx, "tdbfile=%s",
4665 lp_parm_const_string(-1, "vlp", "tdbfile",
4666 "/tmp/vlp.tdb"));
4667 if (tdbfile == NULL) {
4668 tdbfile="tdbfile=/tmp/vlp.tdb";
4671 tmp = talloc_asprintf(tmp_ctx, "vlp %s print %%p %%s",
4672 tdbfile);
4673 string_set(&pService->szPrintcommand,
4674 tmp ? tmp : "vlp print %p %s");
4676 tmp = talloc_asprintf(tmp_ctx, "vlp %s lpq %%p",
4677 tdbfile);
4678 string_set(&pService->szLpqcommand,
4679 tmp ? tmp : "vlp lpq %p");
4681 tmp = talloc_asprintf(tmp_ctx, "vlp %s lprm %%p %%j",
4682 tdbfile);
4683 string_set(&pService->szLprmcommand,
4684 tmp ? tmp : "vlp lprm %p %j");
4686 tmp = talloc_asprintf(tmp_ctx, "vlp %s lppause %%p %%j",
4687 tdbfile);
4688 string_set(&pService->szLppausecommand,
4689 tmp ? tmp : "vlp lppause %p %j");
4691 tmp = talloc_asprintf(tmp_ctx, "vlp %s lpresume %%p %%j",
4692 tdbfile);
4693 string_set(&pService->szLpresumecommand,
4694 tmp ? tmp : "vlp lpresume %p %j");
4696 tmp = talloc_asprintf(tmp_ctx, "vlp %s queuepause %%p",
4697 tdbfile);
4698 string_set(&pService->szQueuepausecommand,
4699 tmp ? tmp : "vlp queuepause %p");
4701 tmp = talloc_asprintf(tmp_ctx, "vlp %s queueresume %%p",
4702 tdbfile);
4703 string_set(&pService->szQueueresumecommand,
4704 tmp ? tmp : "vlp queueresume %p");
4705 TALLOC_FREE(tmp_ctx);
4707 break;
4709 #endif /* DEVELOPER */
4714 * Function to return the default value for the maximum number of open
4715 * file descriptors permitted. This function tries to consult the
4716 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4717 * the smaller of those.
4719 static int max_open_files(void)
4721 int sysctl_max = MAX_OPEN_FILES;
4722 int rlimit_max = MAX_OPEN_FILES;
4724 #ifdef HAVE_SYSCTLBYNAME
4726 size_t size = sizeof(sysctl_max);
4727 sysctlbyname("kern.maxfilesperproc", &sysctl_max, &size, NULL,
4730 #endif
4732 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4734 struct rlimit rl;
4736 ZERO_STRUCT(rl);
4738 if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
4739 rlimit_max = rl.rlim_cur;
4741 #if defined(RLIM_INFINITY)
4742 if(rl.rlim_cur == RLIM_INFINITY)
4743 rlimit_max = MAX_OPEN_FILES;
4744 #endif
4746 #endif
4748 if (sysctl_max < MIN_OPEN_FILES_WINDOWS) {
4749 DEBUG(2,("max_open_files: increasing sysctl_max (%d) to "
4750 "minimum Windows limit (%d)\n",
4751 sysctl_max,
4752 MIN_OPEN_FILES_WINDOWS));
4753 sysctl_max = MIN_OPEN_FILES_WINDOWS;
4756 if (rlimit_max < MIN_OPEN_FILES_WINDOWS) {
4757 DEBUG(2,("rlimit_max: increasing rlimit_max (%d) to "
4758 "minimum Windows limit (%d)\n",
4759 rlimit_max,
4760 MIN_OPEN_FILES_WINDOWS));
4761 rlimit_max = MIN_OPEN_FILES_WINDOWS;
4764 return MIN(sysctl_max, rlimit_max);
4768 * Common part of freeing allocated data for one parameter.
4770 static void free_one_parameter_common(void *parm_ptr,
4771 struct parm_struct parm)
4773 if ((parm.type == P_STRING) ||
4774 (parm.type == P_USTRING))
4776 string_free((char**)parm_ptr);
4777 } else if (parm.type == P_LIST) {
4778 TALLOC_FREE(*((char***)parm_ptr));
4783 * Free the allocated data for one parameter for a share
4784 * given as a service struct.
4786 static void free_one_parameter(struct loadparm_service *service,
4787 struct parm_struct parm)
4789 void *parm_ptr;
4791 if (parm.p_class != P_LOCAL) {
4792 return;
4795 parm_ptr = lp_parm_ptr(service, &parm);
4797 free_one_parameter_common(parm_ptr, parm);
4801 * Free the allocated parameter data of a share given
4802 * as a service struct.
4804 static void free_parameters(struct loadparm_service *service)
4806 uint32_t i;
4808 for (i=0; parm_table[i].label; i++) {
4809 free_one_parameter(service, parm_table[i]);
4814 * Free the allocated data for one parameter for a given share
4815 * specified by an snum.
4817 static void free_one_parameter_by_snum(int snum, struct parm_struct parm)
4819 void *parm_ptr;
4821 if (snum < 0) {
4822 parm_ptr = lp_parm_ptr(NULL, &parm);
4823 } else if (parm.p_class != P_LOCAL) {
4824 return;
4825 } else {
4826 parm_ptr = lp_local_ptr_by_snum(snum, &parm);
4829 free_one_parameter_common(parm_ptr, parm);
4833 * Free the allocated parameter data for a share specified
4834 * by an snum.
4836 static void free_parameters_by_snum(int snum)
4838 uint32_t i;
4840 for (i=0; parm_table[i].label; i++) {
4841 free_one_parameter_by_snum(snum, parm_table[i]);
4846 * Free the allocated global parameters.
4848 static void free_global_parameters(void)
4850 free_param_opts(&Globals.param_opt);
4851 free_parameters_by_snum(GLOBAL_SECTION_SNUM);
4854 static int map_parameter(const char *pszParmName);
4856 struct lp_stored_option {
4857 struct lp_stored_option *prev, *next;
4858 const char *label;
4859 const char *value;
4862 static struct lp_stored_option *stored_options;
4865 save options set by lp_set_cmdline() into a list. This list is
4866 re-applied when we do a globals reset, so that cmdline set options
4867 are sticky across reloads of smb.conf
4869 static bool store_lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
4871 struct lp_stored_option *entry, *entry_next;
4872 for (entry = stored_options; entry != NULL; entry = entry_next) {
4873 entry_next = entry->next;
4874 if (strcmp(pszParmName, entry->label) == 0) {
4875 DLIST_REMOVE(stored_options, entry);
4876 talloc_free(entry);
4877 break;
4881 entry = talloc(NULL, struct lp_stored_option);
4882 if (!entry) {
4883 return false;
4886 entry->label = talloc_strdup(entry, pszParmName);
4887 if (!entry->label) {
4888 talloc_free(entry);
4889 return false;
4892 entry->value = talloc_strdup(entry, pszParmValue);
4893 if (!entry->value) {
4894 talloc_free(entry);
4895 return false;
4898 DLIST_ADD_END(stored_options, entry, struct lp_stored_option);
4900 return true;
4903 static bool apply_lp_set_cmdline(void)
4905 struct lp_stored_option *entry = NULL;
4906 for (entry = stored_options; entry != NULL; entry = entry->next) {
4907 if (!lp_set_cmdline_helper(entry->label, entry->value, false)) {
4908 DEBUG(0, ("Failed to re-apply cmdline parameter %s = %s\n",
4909 entry->label, entry->value));
4910 return false;
4913 return true;
4916 /***************************************************************************
4917 Initialise the global parameter structure.
4918 ***************************************************************************/
4920 static void init_globals(bool reinit_globals)
4922 static bool done_init = false;
4923 char *s = NULL;
4924 int i;
4926 /* If requested to initialize only once and we've already done it... */
4927 if (!reinit_globals && done_init) {
4928 /* ... then we have nothing more to do */
4929 return;
4932 if (!done_init) {
4933 /* The logfile can be set before this is invoked. Free it if so. */
4934 if (Globals.logfile != NULL) {
4935 string_free(&Globals.logfile);
4936 Globals.logfile = NULL;
4938 done_init = true;
4939 } else {
4940 free_global_parameters();
4943 /* This memset and the free_global_parameters() above will
4944 * wipe out smb.conf options set with lp_set_cmdline(). The
4945 * apply_lp_set_cmdline() call puts these values back in the
4946 * table once the defaults are set */
4947 ZERO_STRUCT(Globals);
4949 for (i = 0; parm_table[i].label; i++) {
4950 if ((parm_table[i].type == P_STRING ||
4951 parm_table[i].type == P_USTRING))
4953 string_set((char **)lp_parm_ptr(NULL, &parm_table[i]), "");
4958 string_set(&sDefault.fstype, FSTYPE_STRING);
4959 string_set(&sDefault.szPrintjobUsername, "%U");
4961 init_printer_values(&sDefault);
4964 DEBUG(3, ("Initialising global parameters\n"));
4966 /* Must manually force to upper case here, as this does not go via the handler */
4967 string_set(&Globals.szNetbiosName, myhostname_upper());
4969 string_set(&Globals.szSMBPasswdFile, get_dyn_SMB_PASSWD_FILE());
4970 string_set(&Globals.szPrivateDir, get_dyn_PRIVATE_DIR());
4972 /* use the new 'hash2' method by default, with a prefix of 1 */
4973 string_set(&Globals.szManglingMethod, "hash2");
4974 Globals.mangle_prefix = 1;
4976 string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
4978 /* using UTF8 by default allows us to support all chars */
4979 string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
4981 /* Use codepage 850 as a default for the dos character set */
4982 string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
4985 * Allow the default PASSWD_CHAT to be overridden in local.h.
4987 string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
4989 string_set(&Globals.szWorkgroup, DEFAULT_WORKGROUP);
4991 string_set(&Globals.szPasswdProgram, "");
4992 string_set(&Globals.szLockDir, get_dyn_LOCKDIR());
4993 string_set(&Globals.szStateDir, get_dyn_STATEDIR());
4994 string_set(&Globals.szCacheDir, get_dyn_CACHEDIR());
4995 string_set(&Globals.szPidDir, get_dyn_PIDDIR());
4996 string_set(&Globals.szSocketAddress, "0.0.0.0");
4998 * By default support explicit binding to broadcast
4999 * addresses.
5001 Globals.bNmbdBindExplicitBroadcast = true;
5003 if (asprintf(&s, "Samba %s", samba_version_string()) < 0) {
5004 smb_panic("init_globals: ENOMEM");
5006 string_set(&Globals.szServerString, s);
5007 SAFE_FREE(s);
5008 #ifdef DEVELOPER
5009 string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
5010 #endif
5012 string_set(&Globals.socket_options, DEFAULT_SOCKET_OPTIONS);
5014 string_set(&Globals.szLogonDrive, "");
5015 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
5016 string_set(&Globals.szLogonHome, "\\\\%N\\%U");
5017 string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
5019 Globals.szNameResolveOrder = (const char **)str_list_make_v3(NULL, "lmhosts wins host bcast", NULL);
5020 string_set(&Globals.szPasswordServer, "*");
5022 Globals.AlgorithmicRidBase = BASE_RID;
5024 Globals.bLoadPrinters = true;
5025 Globals.PrintcapCacheTime = 750; /* 12.5 minutes */
5027 Globals.ConfigBackend = config_backend;
5028 Globals.server_role = ROLE_AUTO;
5030 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
5031 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
5032 Globals.max_xmit = 0x4104;
5033 Globals.max_mux = 50; /* This is *needed* for profile support. */
5034 Globals.lpqcachetime = 30; /* changed to handle large print servers better -- jerry */
5035 Globals.bDisableSpoolss = false;
5036 Globals.iMaxSmbdProcesses = 0;/* no limit specified */
5037 Globals.pwordlevel = 0;
5038 Globals.unamelevel = 0;
5039 Globals.deadtime = 0;
5040 Globals.getwd_cache = true;
5041 Globals.bLargeReadwrite = true;
5042 Globals.max_log_size = 5000;
5043 Globals.max_open_files = max_open_files();
5044 Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
5045 Globals.srv_maxprotocol = PROTOCOL_SMB2_10;
5046 Globals.srv_minprotocol = PROTOCOL_LANMAN1;
5047 Globals.security = SEC_USER;
5048 Globals.paranoid_server_security = true;
5049 Globals.bEncryptPasswords = true;
5050 Globals.clientSchannel = Auto;
5051 Globals.serverSchannel = Auto;
5052 Globals.bReadRaw = true;
5053 Globals.bWriteRaw = true;
5054 Globals.bNullPasswords = false;
5055 Globals.bObeyPamRestrictions = false;
5056 Globals.syslog = 1;
5057 Globals.bSyslogOnly = false;
5058 Globals.bTimestampLogs = true;
5059 string_set(&Globals.loglevel, "0");
5060 Globals.bDebugPrefixTimestamp = false;
5061 Globals.bDebugHiresTimestamp = true;
5062 Globals.bDebugPid = false;
5063 Globals.bDebugUid = false;
5064 Globals.bDebugClass = false;
5065 Globals.bEnableCoreFiles = true;
5066 Globals.max_ttl = 60 * 60 * 24 * 3; /* 3 days default. */
5067 Globals.max_wins_ttl = 60 * 60 * 24 * 6; /* 6 days default. */
5068 Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
5069 Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
5070 Globals.lm_announce = Auto; /* = Auto: send only if LM clients found */
5071 Globals.lm_interval = 60;
5072 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
5073 Globals.bNISHomeMap = false;
5074 #ifdef WITH_NISPLUS_HOME
5075 string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
5076 #else
5077 string_set(&Globals.szNISHomeMapName, "auto.home");
5078 #endif
5079 #endif
5080 Globals.bTimeServer = false;
5081 Globals.bBindInterfacesOnly = false;
5082 Globals.bUnixPasswdSync = false;
5083 Globals.bPamPasswordChange = false;
5084 Globals.bPasswdChatDebug = false;
5085 Globals.iPasswdChatTimeout = 2; /* 2 second default. */
5086 Globals.bNTPipeSupport = true; /* Do NT pipes by default. */
5087 Globals.bNTStatusSupport = true; /* Use NT status by default. */
5088 Globals.bStatCache = true; /* use stat cache by default */
5089 Globals.iMaxStatCacheSize = 256; /* 256k by default */
5090 Globals.restrict_anonymous = 0;
5091 Globals.bClientLanManAuth = false; /* Do NOT use the LanMan hash if it is available */
5092 Globals.bClientPlaintextAuth = false; /* Do NOT use a plaintext password even if is requested by the server */
5093 Globals.bLanmanAuth = false; /* Do NOT use the LanMan hash, even if it is supplied */
5094 Globals.bNTLMAuth = true; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
5095 Globals.bClientNTLMv2Auth = true; /* Client should always use use NTLMv2, as we can't tell that the server supports it, but most modern servers do */
5096 /* Note, that we will also use NTLM2 session security (which is different), if it is available */
5098 Globals.map_to_guest = 0; /* By Default, "Never" */
5099 Globals.oplock_break_wait_time = 0; /* By Default, 0 msecs. */
5100 Globals.enhanced_browsing = true;
5101 Globals.iLockSpinTime = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
5102 #ifdef MMAP_BLACKLIST
5103 Globals.bUseMmap = false;
5104 #else
5105 Globals.bUseMmap = true;
5106 #endif
5107 Globals.bUnicode = true;
5108 Globals.bUnixExtensions = true;
5109 Globals.bResetOnZeroVC = false;
5110 Globals.bLogWriteableFilesOnExit = false;
5111 Globals.bCreateKrb5Conf = true;
5112 Globals.winbindMaxDomainConnections = 1;
5114 /* hostname lookups can be very expensive and are broken on
5115 a large number of sites (tridge) */
5116 Globals.bHostnameLookups = false;
5118 string_set(&Globals.passdb_backend, "tdbsam");
5119 string_set(&Globals.szLdapSuffix, "");
5120 string_set(&Globals.szLdapMachineSuffix, "");
5121 string_set(&Globals.szLdapUserSuffix, "");
5122 string_set(&Globals.szLdapGroupSuffix, "");
5123 string_set(&Globals.szLdapIdmapSuffix, "");
5125 string_set(&Globals.szLdapAdminDn, "");
5126 Globals.ldap_ssl = LDAP_SSL_START_TLS;
5127 Globals.ldap_ssl_ads = false;
5128 Globals.ldap_deref = -1;
5129 Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
5130 Globals.ldap_delete_dn = false;
5131 Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
5132 Globals.ldap_follow_referral = Auto;
5133 Globals.ldap_timeout = LDAP_DEFAULT_TIMEOUT;
5134 Globals.ldap_connection_timeout = LDAP_CONNECTION_DEFAULT_TIMEOUT;
5135 Globals.ldap_page_size = LDAP_PAGE_SIZE;
5137 Globals.ldap_debug_level = 0;
5138 Globals.ldap_debug_threshold = 10;
5140 /* This is what we tell the afs client. in reality we set the token
5141 * to never expire, though, when this runs out the afs client will
5142 * forget the token. Set to 0 to get NEVERDATE.*/
5143 Globals.iAfsTokenLifetime = 604800;
5144 Globals.cups_connection_timeout = CUPS_DEFAULT_CONNECTION_TIMEOUT;
5146 /* these parameters are set to defaults that are more appropriate
5147 for the increasing samba install base:
5149 as a member of the workgroup, that will possibly become a
5150 _local_ master browser (lm = true). this is opposed to a forced
5151 local master browser startup (pm = true).
5153 doesn't provide WINS server service by default (wsupp = false),
5154 and doesn't provide domain master browser services by default, either.
5158 Globals.bMsAddPrinterWizard = true;
5159 Globals.os_level = 20;
5160 Globals.bLocalMaster = true;
5161 Globals.domain_master = Auto; /* depending on bDomainLogons */
5162 Globals.bDomainLogons = false;
5163 Globals.bBrowseList = true;
5164 Globals.bWINSsupport = false;
5165 Globals.bWINSproxy = false;
5167 TALLOC_FREE(Globals.szInitLogonDelayedHosts);
5168 Globals.InitLogonDelay = 100; /* 100 ms default delay */
5170 Globals.bWINSdnsProxy = true;
5172 Globals.bAllowTrustedDomains = true;
5173 string_set(&Globals.szIdmapBackend, "tdb");
5175 string_set(&Globals.szTemplateShell, "/bin/false");
5176 string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
5177 string_set(&Globals.szWinbindSeparator, "\\");
5179 string_set(&Globals.szCupsServer, "");
5180 string_set(&Globals.szIPrintServer, "");
5182 #ifdef CLUSTER_SUPPORT
5183 string_set(&Globals.ctdbdSocket, CTDB_PATH);
5184 #else
5185 string_set(&Globals.ctdbdSocket, "");
5186 #endif
5188 Globals.szClusterAddresses = NULL;
5189 Globals.clustering = false;
5190 Globals.ctdb_timeout = 0;
5191 Globals.ctdb_locktime_warn_threshold = 0;
5193 Globals.winbind_cache_time = 300; /* 5 minutes */
5194 Globals.winbind_reconnect_delay = 30; /* 30 seconds */
5195 Globals.winbind_max_clients = 200;
5196 Globals.bWinbindEnumUsers = false;
5197 Globals.bWinbindEnumGroups = false;
5198 Globals.bWinbindUseDefaultDomain = false;
5199 Globals.bWinbindTrustedDomainsOnly = false;
5200 Globals.bWinbindNestedGroups = true;
5201 Globals.winbind_expand_groups = 1;
5202 Globals.szWinbindNssInfo = (const char **)str_list_make_v3(NULL, "template", NULL);
5203 Globals.bWinbindRefreshTickets = false;
5204 Globals.bWinbindOfflineLogon = false;
5206 Globals.iIdmapCacheTime = 86400 * 7; /* a week by default */
5207 Globals.iIdmapNegativeCacheTime = 120; /* 2 minutes by default */
5209 Globals.bPassdbExpandExplicit = false;
5211 Globals.name_cache_timeout = 660; /* In seconds */
5213 Globals.bUseSpnego = true;
5214 Globals.bClientUseSpnego = true;
5216 Globals.client_signing = SMB_SIGNING_DEFAULT;
5217 Globals.server_signing = SMB_SIGNING_DEFAULT;
5219 Globals.bDeferSharingViolations = true;
5220 Globals.smb_ports = (const char **)str_list_make_v3(NULL, SMB_PORTS, NULL);
5222 Globals.bEnablePrivileges = true;
5223 Globals.bHostMSDfs = true;
5224 Globals.bASUSupport = false;
5226 /* User defined shares. */
5227 if (asprintf(&s, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5228 smb_panic("init_globals: ENOMEM");
5230 string_set(&Globals.szUsersharePath, s);
5231 SAFE_FREE(s);
5232 string_set(&Globals.szUsershareTemplateShare, "");
5233 Globals.iUsershareMaxShares = 0;
5234 /* By default disallow sharing of directories not owned by the sharer. */
5235 Globals.bUsershareOwnerOnly = true;
5236 /* By default disallow guest access to usershares. */
5237 Globals.bUsershareAllowGuests = false;
5239 Globals.iKeepalive = DEFAULT_KEEPALIVE;
5241 /* By default no shares out of the registry */
5242 Globals.bRegistryShares = false;
5244 Globals.iminreceivefile = 0;
5246 Globals.bMapUntrustedToDomain = false;
5247 Globals.bMulticastDnsRegister = true;
5249 Globals.ismb2_max_read = DEFAULT_SMB2_MAX_READ;
5250 Globals.ismb2_max_write = DEFAULT_SMB2_MAX_WRITE;
5251 Globals.ismb2_max_trans = DEFAULT_SMB2_MAX_TRANSACT;
5252 Globals.ismb2_max_credits = DEFAULT_SMB2_MAX_CREDITS;
5254 string_set(&Globals.ncalrpc_dir, get_dyn_NCALRPCDIR());
5256 /* Now put back the settings that were set with lp_set_cmdline() */
5257 apply_lp_set_cmdline();
5260 /*******************************************************************
5261 Convenience routine to grab string parameters into talloced memory
5262 and run standard_sub_basic on them. The buffers can be written to by
5263 callers without affecting the source string.
5264 ********************************************************************/
5266 static char *lp_string(TALLOC_CTX *ctx, const char *s)
5268 char *ret;
5270 /* The follow debug is useful for tracking down memory problems
5271 especially if you have an inner loop that is calling a lp_*()
5272 function that returns a string. Perhaps this debug should be
5273 present all the time? */
5275 #if 0
5276 DEBUG(10, ("lp_string(%s)\n", s));
5277 #endif
5278 if (!s) {
5279 return NULL;
5282 ret = talloc_sub_basic(ctx,
5283 get_current_username(),
5284 current_user_info.domain,
5286 if (trim_char(ret, '\"', '\"')) {
5287 if (strchr(ret,'\"') != NULL) {
5288 TALLOC_FREE(ret);
5289 ret = talloc_sub_basic(ctx,
5290 get_current_username(),
5291 current_user_info.domain,
5295 return ret;
5299 In this section all the functions that are used to access the
5300 parameters from the rest of the program are defined
5303 #define FN_GLOBAL_STRING(fn_name,ptr) \
5304 char *lp_ ## fn_name(TALLOC_CTX *ctx) {return(lp_string((ctx), *(char **)(&Globals.ptr) ? *(char **)(&Globals.ptr) : ""));}
5305 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5306 const char *lp_ ## fn_name(void) {return(*(const char **)(&Globals.ptr) ? *(const char **)(&Globals.ptr) : "");}
5307 #define FN_GLOBAL_LIST(fn_name,ptr) \
5308 const char **lp_ ## fn_name(void) {return(*(const char ***)(&Globals.ptr));}
5309 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5310 bool lp_ ## fn_name(void) {return(*(bool *)(&Globals.ptr));}
5311 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5312 char lp_ ## fn_name(void) {return(*(char *)(&Globals.ptr));}
5313 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5314 int lp_ ## fn_name(void) {return(*(int *)(&Globals.ptr));}
5316 #define FN_LOCAL_STRING(fn_name,val) \
5317 char *lp_ ## fn_name(TALLOC_CTX *ctx,int i) {return(lp_string((ctx), (LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5318 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5319 const char *lp_ ## fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5320 #define FN_LOCAL_LIST(fn_name,val) \
5321 const char **lp_ ## fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5322 #define FN_LOCAL_BOOL(fn_name,val) \
5323 bool lp_ ## fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5324 #define FN_LOCAL_INTEGER(fn_name,val) \
5325 int lp_ ## fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5327 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5328 bool lp_ ## fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5329 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5330 int lp_ ## fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5331 #define FN_LOCAL_CHAR(fn_name,val) \
5332 char lp_ ## fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5335 static FN_GLOBAL_BOOL(domain_logons, bDomainLogons)
5336 static FN_GLOBAL_BOOL(_readraw, bReadRaw)
5337 static FN_GLOBAL_BOOL(_writeraw, bWriteRaw)
5339 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5340 * build process or in smb.conf, we use that value. Otherwise they
5341 * default to the value of lp_lockdir(). */
5342 const char *lp_statedir(void) {
5343 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5344 (strcmp(get_dyn_STATEDIR(), Globals.szStateDir) != 0))
5345 return(*(char **)(&Globals.szStateDir) ?
5346 *(char **)(&Globals.szStateDir) : "");
5347 else
5348 return(*(char **)(&Globals.szLockDir) ?
5349 *(char **)(&Globals.szLockDir) : "");
5351 const char *lp_cachedir(void) {
5352 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5353 (strcmp(get_dyn_CACHEDIR(), Globals.szCacheDir) != 0))
5354 return(*(char **)(&Globals.szCacheDir) ?
5355 *(char **)(&Globals.szCacheDir) : "");
5356 else
5357 return(*(char **)(&Globals.szLockDir) ?
5358 *(char **)(&Globals.szLockDir) : "");
5360 static FN_GLOBAL_INTEGER(winbind_max_domain_connections_int,
5361 winbindMaxDomainConnections)
5363 int lp_winbind_max_domain_connections(void)
5365 if (lp_winbind_offline_logon() &&
5366 lp_winbind_max_domain_connections_int() > 1) {
5367 DEBUG(1, ("offline logons active, restricting max domain "
5368 "connections to 1\n"));
5369 return 1;
5371 return MAX(1, lp_winbind_max_domain_connections_int());
5374 int lp_smb2_max_credits(void)
5376 if (Globals.ismb2_max_credits == 0) {
5377 Globals.ismb2_max_credits = DEFAULT_SMB2_MAX_CREDITS;
5379 return Globals.ismb2_max_credits;
5381 int lp_cups_encrypt(void)
5383 int result = 0;
5384 #ifdef HAVE_HTTPCONNECTENCRYPT
5385 switch (Globals.CupsEncrypt) {
5386 case Auto:
5387 result = HTTP_ENCRYPT_REQUIRED;
5388 break;
5389 case true:
5390 result = HTTP_ENCRYPT_ALWAYS;
5391 break;
5392 case false:
5393 result = HTTP_ENCRYPT_NEVER;
5394 break;
5396 #endif
5397 return result;
5400 /* These functions remain in source3/param for now */
5402 FN_GLOBAL_INTEGER(security, security)
5403 FN_GLOBAL_INTEGER(usershare_max_shares, iUsershareMaxShares)
5404 FN_GLOBAL_STRING(configfile, szConfigFile)
5406 #include "lib/param/param_functions.c"
5408 FN_LOCAL_STRING(servicename, szService)
5409 FN_LOCAL_CONST_STRING(const_servicename, szService)
5411 /* local prototypes */
5413 static int map_parameter_canonical(const char *pszParmName, bool *inverse);
5414 static const char *get_boolean(bool bool_value);
5415 static int getservicebyname(const char *pszServiceName,
5416 struct loadparm_service *pserviceDest);
5417 static void copy_service(struct loadparm_service *pserviceDest,
5418 struct loadparm_service *pserviceSource,
5419 struct bitmap *pcopymapDest);
5420 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
5421 void *userdata);
5422 static bool do_section(const char *pszSectionName, void *userdata);
5423 static void init_copymap(struct loadparm_service *pservice);
5424 static bool hash_a_service(const char *name, int number);
5425 static void free_service_byindex(int iService);
5426 static void show_parameter(int parmIndex);
5427 static bool is_synonym_of(int parm1, int parm2, bool *inverse);
5430 * This is a helper function for parametrical options support. It returns a
5431 * pointer to parametrical option value if it exists or NULL otherwise. Actual
5432 * parametrical functions are quite simple
5434 static struct parmlist_entry *get_parametrics_by_service(struct loadparm_service *service, const char *type,
5435 const char *option)
5437 bool global_section = false;
5438 char* param_key;
5439 struct parmlist_entry *data;
5441 if (service == NULL) {
5442 data = Globals.param_opt;
5443 global_section = true;
5444 } else {
5445 data = service->param_opt;
5448 if (asprintf(&param_key, "%s:%s", type, option) == -1) {
5449 DEBUG(0,("asprintf failed!\n"));
5450 return NULL;
5453 while (data) {
5454 if (strwicmp(data->key, param_key) == 0) {
5455 string_free(&param_key);
5456 return data;
5458 data = data->next;
5461 if (!global_section) {
5462 /* Try to fetch the same option but from globals */
5463 /* but only if we are not already working with Globals */
5464 data = Globals.param_opt;
5465 while (data) {
5466 if (strwicmp(data->key, param_key) == 0) {
5467 string_free(&param_key);
5468 return data;
5470 data = data->next;
5474 string_free(&param_key);
5476 return NULL;
5480 * This is a helper function for parametrical options support. It returns a
5481 * pointer to parametrical option value if it exists or NULL otherwise. Actual
5482 * parametrical functions are quite simple
5484 static struct parmlist_entry *get_parametrics(int snum, const char *type,
5485 const char *option)
5487 if (snum >= iNumServices) return NULL;
5489 if (snum < 0) {
5490 return get_parametrics_by_service(NULL, type, option);
5491 } else {
5492 return get_parametrics_by_service(ServicePtrs[snum], type, option);
5497 #define MISSING_PARAMETER(name) \
5498 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
5500 /*******************************************************************
5501 convenience routine to return int parameters.
5502 ********************************************************************/
5503 static int lp_int(const char *s)
5506 if (!s || !*s) {
5507 MISSING_PARAMETER(lp_int);
5508 return (-1);
5511 return (int)strtol(s, NULL, 0);
5514 /*******************************************************************
5515 convenience routine to return unsigned long parameters.
5516 ********************************************************************/
5517 static unsigned long lp_ulong(const char *s)
5520 if (!s || !*s) {
5521 MISSING_PARAMETER(lp_ulong);
5522 return (0);
5525 return strtoul(s, NULL, 0);
5528 /*******************************************************************
5529 convenience routine to return boolean parameters.
5530 ********************************************************************/
5531 static bool lp_bool(const char *s)
5533 bool ret = false;
5535 if (!s || !*s) {
5536 MISSING_PARAMETER(lp_bool);
5537 return false;
5540 if (!set_boolean(s, &ret)) {
5541 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
5542 return false;
5545 return ret;
5548 /*******************************************************************
5549 convenience routine to return enum parameters.
5550 ********************************************************************/
5551 static int lp_enum(const char *s,const struct enum_list *_enum)
5553 int i;
5555 if (!s || !*s || !_enum) {
5556 MISSING_PARAMETER(lp_enum);
5557 return (-1);
5560 for (i=0; _enum[i].name; i++) {
5561 if (strequal(_enum[i].name,s))
5562 return _enum[i].value;
5565 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
5566 return (-1);
5569 #undef MISSING_PARAMETER
5571 /* Return parametric option from a given service. Type is a part of option before ':' */
5572 /* Parametric option has following syntax: 'Type: option = value' */
5573 char *lp_parm_talloc_string(TALLOC_CTX *ctx, int snum, const char *type, const char *option, const char *def)
5575 struct parmlist_entry *data = get_parametrics(snum, type, option);
5577 if (data == NULL||data->value==NULL) {
5578 if (def) {
5579 return lp_string(ctx, def);
5580 } else {
5581 return NULL;
5585 return lp_string(ctx, data->value);
5588 /* Return parametric option from a given service. Type is a part of option before ':' */
5589 /* Parametric option has following syntax: 'Type: option = value' */
5590 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
5592 struct parmlist_entry *data = get_parametrics(snum, type, option);
5594 if (data == NULL||data->value==NULL)
5595 return def;
5597 return data->value;
5600 const char *lp_parm_const_string_service(struct loadparm_service *service, const char *type, const char *option)
5602 struct parmlist_entry *data = get_parametrics_by_service(service, type, option);
5604 if (data == NULL||data->value==NULL)
5605 return NULL;
5607 return data->value;
5611 /* Return parametric option from a given service. Type is a part of option before ':' */
5612 /* Parametric option has following syntax: 'Type: option = value' */
5614 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
5616 struct parmlist_entry *data = get_parametrics(snum, type, option);
5618 if (data == NULL||data->value==NULL)
5619 return (const char **)def;
5621 if (data->list==NULL) {
5622 data->list = str_list_make_v3(NULL, data->value, NULL);
5625 return (const char **)data->list;
5628 /* Return parametric option from a given service. Type is a part of option before ':' */
5629 /* Parametric option has following syntax: 'Type: option = value' */
5631 int lp_parm_int(int snum, const char *type, const char *option, int def)
5633 struct parmlist_entry *data = get_parametrics(snum, type, option);
5635 if (data && data->value && *data->value)
5636 return lp_int(data->value);
5638 return def;
5641 /* Return parametric option from a given service. Type is a part of option before ':' */
5642 /* Parametric option has following syntax: 'Type: option = value' */
5644 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
5646 struct parmlist_entry *data = get_parametrics(snum, type, option);
5648 if (data && data->value && *data->value)
5649 return lp_ulong(data->value);
5651 return def;
5654 /* Return parametric option from a given service. Type is a part of option before ':' */
5655 /* Parametric option has following syntax: 'Type: option = value' */
5657 bool lp_parm_bool(int snum, const char *type, const char *option, bool def)
5659 struct parmlist_entry *data = get_parametrics(snum, type, option);
5661 if (data && data->value && *data->value)
5662 return lp_bool(data->value);
5664 return def;
5667 /* Return parametric option from a given service. Type is a part of option before ':' */
5668 /* Parametric option has following syntax: 'Type: option = value' */
5670 int lp_parm_enum(int snum, const char *type, const char *option,
5671 const struct enum_list *_enum, int def)
5673 struct parmlist_entry *data = get_parametrics(snum, type, option);
5675 if (data && data->value && *data->value && _enum)
5676 return lp_enum(data->value, _enum);
5678 return def;
5682 /***************************************************************************
5683 Initialise a service to the defaults.
5684 ***************************************************************************/
5686 static void init_service(struct loadparm_service *pservice)
5688 memset((char *)pservice, '\0', sizeof(struct loadparm_service));
5689 copy_service(pservice, &sDefault, NULL);
5694 * free a param_opts structure.
5695 * param_opts handling should be moved to talloc;
5696 * then this whole functions reduces to a TALLOC_FREE().
5699 static void free_param_opts(struct parmlist_entry **popts)
5701 struct parmlist_entry *opt, *next_opt;
5703 if (popts == NULL) {
5704 return;
5707 if (*popts != NULL) {
5708 DEBUG(5, ("Freeing parametrics:\n"));
5710 opt = *popts;
5711 while (opt != NULL) {
5712 string_free(&opt->key);
5713 string_free(&opt->value);
5714 TALLOC_FREE(opt->list);
5715 next_opt = opt->next;
5716 SAFE_FREE(opt);
5717 opt = next_opt;
5719 *popts = NULL;
5722 /***************************************************************************
5723 Free the dynamically allocated parts of a service struct.
5724 ***************************************************************************/
5726 static void free_service(struct loadparm_service *pservice)
5728 if (!pservice)
5729 return;
5731 if (pservice->szService)
5732 DEBUG(5, ("free_service: Freeing service %s\n",
5733 pservice->szService));
5735 free_parameters(pservice);
5737 string_free(&pservice->szService);
5738 TALLOC_FREE(pservice->copymap);
5740 free_param_opts(&pservice->param_opt);
5742 ZERO_STRUCTP(pservice);
5746 /***************************************************************************
5747 remove a service indexed in the ServicePtrs array from the ServiceHash
5748 and free the dynamically allocated parts
5749 ***************************************************************************/
5751 static void free_service_byindex(int idx)
5753 if ( !LP_SNUM_OK(idx) )
5754 return;
5756 ServicePtrs[idx]->valid = false;
5757 invalid_services[num_invalid_services++] = idx;
5759 /* we have to cleanup the hash record */
5761 if (ServicePtrs[idx]->szService) {
5762 char *canon_name = canonicalize_servicename(
5763 talloc_tos(),
5764 ServicePtrs[idx]->szService );
5766 dbwrap_delete_bystring(ServiceHash, canon_name );
5767 TALLOC_FREE(canon_name);
5770 free_service(ServicePtrs[idx]);
5773 /***************************************************************************
5774 Add a new service to the services array initialising it with the given
5775 service.
5776 ***************************************************************************/
5778 static int add_a_service(const struct loadparm_service *pservice, const char *name)
5780 int i;
5781 struct loadparm_service tservice;
5782 int num_to_alloc = iNumServices + 1;
5784 tservice = *pservice;
5786 /* it might already exist */
5787 if (name) {
5788 i = getservicebyname(name, NULL);
5789 if (i >= 0) {
5790 return (i);
5794 /* find an invalid one */
5795 i = iNumServices;
5796 if (num_invalid_services > 0) {
5797 i = invalid_services[--num_invalid_services];
5800 /* if not, then create one */
5801 if (i == iNumServices) {
5802 struct loadparm_service **tsp;
5803 int *tinvalid;
5805 tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct loadparm_service *, num_to_alloc);
5806 if (tsp == NULL) {
5807 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
5808 return (-1);
5810 ServicePtrs = tsp;
5811 ServicePtrs[iNumServices] = SMB_MALLOC_P(struct loadparm_service);
5812 if (!ServicePtrs[iNumServices]) {
5813 DEBUG(0,("add_a_service: out of memory!\n"));
5814 return (-1);
5816 iNumServices++;
5818 /* enlarge invalid_services here for now... */
5819 tinvalid = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services, int,
5820 num_to_alloc);
5821 if (tinvalid == NULL) {
5822 DEBUG(0,("add_a_service: failed to enlarge "
5823 "invalid_services!\n"));
5824 return (-1);
5826 invalid_services = tinvalid;
5827 } else {
5828 free_service_byindex(i);
5831 ServicePtrs[i]->valid = true;
5833 init_service(ServicePtrs[i]);
5834 copy_service(ServicePtrs[i], &tservice, NULL);
5835 if (name)
5836 string_set(&ServicePtrs[i]->szService, name);
5838 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
5839 i, ServicePtrs[i]->szService));
5841 if (!hash_a_service(ServicePtrs[i]->szService, i)) {
5842 return (-1);
5845 return (i);
5848 /***************************************************************************
5849 Convert a string to uppercase and remove whitespaces.
5850 ***************************************************************************/
5852 char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src)
5854 char *result;
5856 if ( !src ) {
5857 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
5858 return NULL;
5861 result = talloc_strdup(ctx, src);
5862 SMB_ASSERT(result != NULL);
5864 strlower_m(result);
5865 return result;
5868 /***************************************************************************
5869 Add a name/index pair for the services array to the hash table.
5870 ***************************************************************************/
5872 static bool hash_a_service(const char *name, int idx)
5874 char *canon_name;
5876 if ( !ServiceHash ) {
5877 DEBUG(10,("hash_a_service: creating servicehash\n"));
5878 ServiceHash = db_open_rbt(NULL);
5879 if ( !ServiceHash ) {
5880 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
5881 return false;
5885 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
5886 idx, name));
5888 canon_name = canonicalize_servicename(talloc_tos(), name );
5890 dbwrap_store_bystring(ServiceHash, canon_name,
5891 make_tdb_data((uint8 *)&idx, sizeof(idx)),
5892 TDB_REPLACE);
5894 TALLOC_FREE(canon_name);
5896 return true;
5899 /***************************************************************************
5900 Add a new home service, with the specified home directory, defaults coming
5901 from service ifrom.
5902 ***************************************************************************/
5904 bool lp_add_home(const char *pszHomename, int iDefaultService,
5905 const char *user, const char *pszHomedir)
5907 int i;
5909 if (pszHomename == NULL || user == NULL || pszHomedir == NULL ||
5910 pszHomedir[0] == '\0') {
5911 return false;
5914 i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
5916 if (i < 0)
5917 return false;
5919 if (!(*(ServicePtrs[iDefaultService]->szPath))
5920 || strequal(ServicePtrs[iDefaultService]->szPath,
5921 lp_pathname(talloc_tos(), GLOBAL_SECTION_SNUM))) {
5922 string_set(&ServicePtrs[i]->szPath, pszHomedir);
5925 if (!(*(ServicePtrs[i]->comment))) {
5926 char *comment = NULL;
5927 if (asprintf(&comment, "Home directory of %s", user) < 0) {
5928 return false;
5930 string_set(&ServicePtrs[i]->comment, comment);
5931 SAFE_FREE(comment);
5934 /* set the browseable flag from the global default */
5936 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
5937 ServicePtrs[i]->bAccessBasedShareEnum = sDefault.bAccessBasedShareEnum;
5939 ServicePtrs[i]->autoloaded = true;
5941 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
5942 user, ServicePtrs[i]->szPath ));
5944 return true;
5947 /***************************************************************************
5948 Add a new service, based on an old one.
5949 ***************************************************************************/
5951 int lp_add_service(const char *pszService, int iDefaultService)
5953 if (iDefaultService < 0) {
5954 return add_a_service(&sDefault, pszService);
5957 return (add_a_service(ServicePtrs[iDefaultService], pszService));
5960 /***************************************************************************
5961 Add the IPC service.
5962 ***************************************************************************/
5964 static bool lp_add_ipc(const char *ipc_name, bool guest_ok)
5966 char *comment = NULL;
5967 int i = add_a_service(&sDefault, ipc_name);
5969 if (i < 0)
5970 return false;
5972 if (asprintf(&comment, "IPC Service (%s)",
5973 Globals.szServerString) < 0) {
5974 return false;
5977 string_set(&ServicePtrs[i]->szPath, tmpdir());
5978 string_set(&ServicePtrs[i]->szUsername, "");
5979 string_set(&ServicePtrs[i]->comment, comment);
5980 string_set(&ServicePtrs[i]->fstype, "IPC");
5981 ServicePtrs[i]->iMaxConnections = 0;
5982 ServicePtrs[i]->bAvailable = true;
5983 ServicePtrs[i]->bRead_only = true;
5984 ServicePtrs[i]->bGuest_only = false;
5985 ServicePtrs[i]->bAdministrative_share = true;
5986 ServicePtrs[i]->bGuest_ok = guest_ok;
5987 ServicePtrs[i]->bPrint_ok = false;
5988 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
5990 DEBUG(3, ("adding IPC service\n"));
5992 SAFE_FREE(comment);
5993 return true;
5996 /***************************************************************************
5997 Add a new printer service, with defaults coming from service iFrom.
5998 ***************************************************************************/
6000 bool lp_add_printer(const char *pszPrintername, int iDefaultService)
6002 const char *comment = "From Printcap";
6003 int i = add_a_service(ServicePtrs[iDefaultService], pszPrintername);
6005 if (i < 0)
6006 return false;
6008 /* note that we do NOT default the availability flag to true - */
6009 /* we take it from the default service passed. This allows all */
6010 /* dynamic printers to be disabled by disabling the [printers] */
6011 /* entry (if/when the 'available' keyword is implemented!). */
6013 /* the printer name is set to the service name. */
6014 string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
6015 string_set(&ServicePtrs[i]->comment, comment);
6017 /* set the browseable flag from the gloabl default */
6018 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6020 /* Printers cannot be read_only. */
6021 ServicePtrs[i]->bRead_only = false;
6022 /* No share modes on printer services. */
6023 ServicePtrs[i]->bShareModes = false;
6024 /* No oplocks on printer services. */
6025 ServicePtrs[i]->bOpLocks = false;
6026 /* Printer services must be printable. */
6027 ServicePtrs[i]->bPrint_ok = true;
6029 DEBUG(3, ("adding printer service %s\n", pszPrintername));
6031 return true;
6035 /***************************************************************************
6036 Check whether the given parameter name is valid.
6037 Parametric options (names containing a colon) are considered valid.
6038 ***************************************************************************/
6040 bool lp_parameter_is_valid(const char *pszParmName)
6042 return ((map_parameter(pszParmName) != -1) ||
6043 (strchr(pszParmName, ':') != NULL));
6046 /***************************************************************************
6047 Check whether the given name is the name of a global parameter.
6048 Returns true for strings belonging to parameters of class
6049 P_GLOBAL, false for all other strings, also for parametric options
6050 and strings not belonging to any option.
6051 ***************************************************************************/
6053 bool lp_parameter_is_global(const char *pszParmName)
6055 int num = map_parameter(pszParmName);
6057 if (num >= 0) {
6058 return (parm_table[num].p_class == P_GLOBAL);
6061 return false;
6064 /**************************************************************************
6065 Check whether the given name is the canonical name of a parameter.
6066 Returns false if it is not a valid parameter Name.
6067 For parametric options, true is returned.
6068 **************************************************************************/
6070 bool lp_parameter_is_canonical(const char *parm_name)
6072 if (!lp_parameter_is_valid(parm_name)) {
6073 return false;
6076 return (map_parameter(parm_name) ==
6077 map_parameter_canonical(parm_name, NULL));
6080 /**************************************************************************
6081 Determine the canonical name for a parameter.
6082 Indicate when it is an inverse (boolean) synonym instead of a
6083 "usual" synonym.
6084 **************************************************************************/
6086 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
6087 bool *inverse)
6089 int num;
6091 if (!lp_parameter_is_valid(parm_name)) {
6092 *canon_parm = NULL;
6093 return false;
6096 num = map_parameter_canonical(parm_name, inverse);
6097 if (num < 0) {
6098 /* parametric option */
6099 *canon_parm = parm_name;
6100 } else {
6101 *canon_parm = parm_table[num].label;
6104 return true;
6108 /**************************************************************************
6109 Determine the canonical name for a parameter.
6110 Turn the value given into the inverse boolean expression when
6111 the synonym is an invers boolean synonym.
6113 Return true if parm_name is a valid parameter name and
6114 in case it is an invers boolean synonym, if the val string could
6115 successfully be converted to the reverse bool.
6116 Return false in all other cases.
6117 **************************************************************************/
6119 bool lp_canonicalize_parameter_with_value(const char *parm_name,
6120 const char *val,
6121 const char **canon_parm,
6122 const char **canon_val)
6124 int num;
6125 bool inverse;
6127 if (!lp_parameter_is_valid(parm_name)) {
6128 *canon_parm = NULL;
6129 *canon_val = NULL;
6130 return false;
6133 num = map_parameter_canonical(parm_name, &inverse);
6134 if (num < 0) {
6135 /* parametric option */
6136 *canon_parm = parm_name;
6137 *canon_val = val;
6138 } else {
6139 *canon_parm = parm_table[num].label;
6140 if (inverse) {
6141 if (!lp_invert_boolean(val, canon_val)) {
6142 *canon_val = NULL;
6143 return false;
6145 } else {
6146 *canon_val = val;
6150 return true;
6153 /***************************************************************************
6154 Map a parameter's string representation to something we can use.
6155 Returns false if the parameter string is not recognised, else TRUE.
6156 ***************************************************************************/
6158 static int map_parameter(const char *pszParmName)
6160 int iIndex;
6162 if (*pszParmName == '-' && !strequal(pszParmName, "-valid"))
6163 return (-1);
6165 for (iIndex = 0; parm_table[iIndex].label; iIndex++)
6166 if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
6167 return (iIndex);
6169 /* Warn only if it isn't parametric option */
6170 if (strchr(pszParmName, ':') == NULL)
6171 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
6172 /* We do return 'fail' for parametric options as well because they are
6173 stored in different storage
6175 return (-1);
6178 /***************************************************************************
6179 Map a parameter's string representation to the index of the canonical
6180 form of the parameter (it might be a synonym).
6181 Returns -1 if the parameter string is not recognised.
6182 ***************************************************************************/
6184 static int map_parameter_canonical(const char *pszParmName, bool *inverse)
6186 int parm_num, canon_num;
6187 bool loc_inverse = false;
6189 parm_num = map_parameter(pszParmName);
6190 if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_HIDE)) {
6191 /* invalid, parametric or no canidate for synonyms ... */
6192 goto done;
6195 for (canon_num = 0; parm_table[canon_num].label; canon_num++) {
6196 if (is_synonym_of(parm_num, canon_num, &loc_inverse)) {
6197 parm_num = canon_num;
6198 goto done;
6202 done:
6203 if (inverse != NULL) {
6204 *inverse = loc_inverse;
6206 return parm_num;
6209 /***************************************************************************
6210 return true if parameter number parm1 is a synonym of parameter
6211 number parm2 (parm2 being the principal name).
6212 set inverse to true if parm1 is P_BOOLREV and parm2 is P_BOOL,
6213 false otherwise.
6214 ***************************************************************************/
6216 static bool is_synonym_of(int parm1, int parm2, bool *inverse)
6218 if ((parm_table[parm1].offset == parm_table[parm2].offset) &&
6219 (parm_table[parm1].p_class == parm_table[parm2].p_class) &&
6220 (parm_table[parm1].flags & FLAG_HIDE) &&
6221 !(parm_table[parm2].flags & FLAG_HIDE))
6223 if (inverse != NULL) {
6224 if ((parm_table[parm1].type == P_BOOLREV) &&
6225 (parm_table[parm2].type == P_BOOL))
6227 *inverse = true;
6228 } else {
6229 *inverse = false;
6232 return true;
6234 return false;
6237 /***************************************************************************
6238 Show one parameter's name, type, [values,] and flags.
6239 (helper functions for show_parameter_list)
6240 ***************************************************************************/
6242 static void show_parameter(int parmIndex)
6244 int enumIndex, flagIndex;
6245 int parmIndex2;
6246 bool hadFlag;
6247 bool hadSyn;
6248 bool inverse;
6249 const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6250 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6251 "P_ENUM", "P_SEP"};
6252 unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
6253 FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
6254 FLAG_HIDE};
6255 const char *flag_names[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6256 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6257 "FLAG_DEPRECATED", "FLAG_HIDE", NULL};
6259 printf("%s=%s", parm_table[parmIndex].label,
6260 type[parm_table[parmIndex].type]);
6261 if (parm_table[parmIndex].type == P_ENUM) {
6262 printf(",");
6263 for (enumIndex=0;
6264 parm_table[parmIndex].enum_list[enumIndex].name;
6265 enumIndex++)
6267 printf("%s%s",
6268 enumIndex ? "|" : "",
6269 parm_table[parmIndex].enum_list[enumIndex].name);
6272 printf(",");
6273 hadFlag = false;
6274 for (flagIndex=0; flag_names[flagIndex]; flagIndex++) {
6275 if (parm_table[parmIndex].flags & flags[flagIndex]) {
6276 printf("%s%s",
6277 hadFlag ? "|" : "",
6278 flag_names[flagIndex]);
6279 hadFlag = true;
6283 /* output synonyms */
6284 hadSyn = false;
6285 for (parmIndex2=0; parm_table[parmIndex2].label; parmIndex2++) {
6286 if (is_synonym_of(parmIndex, parmIndex2, &inverse)) {
6287 printf(" (%ssynonym of %s)", inverse ? "inverse " : "",
6288 parm_table[parmIndex2].label);
6289 } else if (is_synonym_of(parmIndex2, parmIndex, &inverse)) {
6290 if (!hadSyn) {
6291 printf(" (synonyms: ");
6292 hadSyn = true;
6293 } else {
6294 printf(", ");
6296 printf("%s%s", parm_table[parmIndex2].label,
6297 inverse ? "[i]" : "");
6300 if (hadSyn) {
6301 printf(")");
6304 printf("\n");
6307 /***************************************************************************
6308 Show all parameter's name, type, [values,] and flags.
6309 ***************************************************************************/
6311 void show_parameter_list(void)
6313 int classIndex, parmIndex;
6314 const char *section_names[] = { "local", "global", NULL};
6316 for (classIndex=0; section_names[classIndex]; classIndex++) {
6317 printf("[%s]\n", section_names[classIndex]);
6318 for (parmIndex = 0; parm_table[parmIndex].label; parmIndex++) {
6319 if (parm_table[parmIndex].p_class == classIndex) {
6320 show_parameter(parmIndex);
6326 /***************************************************************************
6327 Check if a given string correctly represents a boolean value.
6328 ***************************************************************************/
6330 bool lp_string_is_valid_boolean(const char *parm_value)
6332 return set_boolean(parm_value, NULL);
6335 /***************************************************************************
6336 Get the standard string representation of a boolean value ("yes" or "no")
6337 ***************************************************************************/
6339 static const char *get_boolean(bool bool_value)
6341 static const char *yes_str = "yes";
6342 static const char *no_str = "no";
6344 return (bool_value ? yes_str : no_str);
6347 /***************************************************************************
6348 Provide the string of the negated boolean value associated to the boolean
6349 given as a string. Returns false if the passed string does not correctly
6350 represent a boolean.
6351 ***************************************************************************/
6353 bool lp_invert_boolean(const char *str, const char **inverse_str)
6355 bool val;
6357 if (!set_boolean(str, &val)) {
6358 return false;
6361 *inverse_str = get_boolean(!val);
6362 return true;
6365 /***************************************************************************
6366 Provide the canonical string representation of a boolean value given
6367 as a string. Return true on success, false if the string given does
6368 not correctly represent a boolean.
6369 ***************************************************************************/
6371 bool lp_canonicalize_boolean(const char *str, const char**canon_str)
6373 bool val;
6375 if (!set_boolean(str, &val)) {
6376 return false;
6379 *canon_str = get_boolean(val);
6380 return true;
6383 /***************************************************************************
6384 Find a service by name. Otherwise works like get_service.
6385 ***************************************************************************/
6387 static int getservicebyname(const char *pszServiceName, struct loadparm_service *pserviceDest)
6389 int iService = -1;
6390 char *canon_name;
6391 TDB_DATA data;
6392 NTSTATUS status;
6394 if (ServiceHash == NULL) {
6395 return -1;
6398 canon_name = canonicalize_servicename(talloc_tos(), pszServiceName);
6400 status = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name,
6401 &data);
6403 if (NT_STATUS_IS_OK(status) &&
6404 (data.dptr != NULL) &&
6405 (data.dsize == sizeof(iService)))
6407 iService = *(int *)data.dptr;
6410 TALLOC_FREE(canon_name);
6412 if ((iService != -1) && (LP_SNUM_OK(iService))
6413 && (pserviceDest != NULL)) {
6414 copy_service(pserviceDest, ServicePtrs[iService], NULL);
6417 return (iService);
6420 /* Return a pointer to a service by name. Unlike getservicebyname, it does not copy the service */
6421 struct loadparm_service *lp_service(const char *pszServiceName)
6423 int iService = getservicebyname(pszServiceName, NULL);
6424 if (iService == -1 || !LP_SNUM_OK(iService)) {
6425 return NULL;
6427 return ServicePtrs[iService];
6430 struct loadparm_service *lp_servicebynum(int snum)
6432 if ((snum == -1) || !LP_SNUM_OK(snum)) {
6433 return NULL;
6435 return ServicePtrs[snum];
6438 struct loadparm_service *lp_default_loadparm_service()
6440 return &sDefault;
6444 /***************************************************************************
6445 Copy a service structure to another.
6446 If pcopymapDest is NULL then copy all fields
6447 ***************************************************************************/
6450 * Add a parametric option to a parmlist_entry,
6451 * replacing old value, if already present.
6453 static void set_param_opt(struct parmlist_entry **opt_list,
6454 const char *opt_name,
6455 const char *opt_value,
6456 unsigned priority)
6458 struct parmlist_entry *new_opt, *opt;
6459 bool not_added;
6461 if (opt_list == NULL) {
6462 return;
6465 opt = *opt_list;
6466 not_added = true;
6468 /* Traverse destination */
6469 while (opt) {
6470 /* If we already have same option, override it */
6471 if (strwicmp(opt->key, opt_name) == 0) {
6472 if ((opt->priority & FLAG_CMDLINE) &&
6473 !(priority & FLAG_CMDLINE)) {
6474 /* it's been marked as not to be
6475 overridden */
6476 return;
6478 string_free(&opt->value);
6479 TALLOC_FREE(opt->list);
6480 opt->value = SMB_STRDUP(opt_value);
6481 opt->priority = priority;
6482 not_added = false;
6483 break;
6485 opt = opt->next;
6487 if (not_added) {
6488 new_opt = SMB_XMALLOC_P(struct parmlist_entry);
6489 new_opt->key = SMB_STRDUP(opt_name);
6490 new_opt->value = SMB_STRDUP(opt_value);
6491 new_opt->list = NULL;
6492 new_opt->priority = priority;
6493 DLIST_ADD(*opt_list, new_opt);
6497 static void copy_service(struct loadparm_service *pserviceDest, struct loadparm_service *pserviceSource,
6498 struct bitmap *pcopymapDest)
6500 int i;
6501 bool bcopyall = (pcopymapDest == NULL);
6502 struct parmlist_entry *data;
6504 for (i = 0; parm_table[i].label; i++)
6505 if (parm_table[i].p_class == P_LOCAL &&
6506 (bcopyall || bitmap_query(pcopymapDest,i))) {
6507 void *src_ptr = lp_parm_ptr(pserviceSource, &parm_table[i]);
6508 void *dest_ptr = lp_parm_ptr(pserviceDest, &parm_table[i]);
6510 switch (parm_table[i].type) {
6511 case P_BOOL:
6512 case P_BOOLREV:
6513 *(bool *)dest_ptr = *(bool *)src_ptr;
6514 break;
6516 case P_INTEGER:
6517 case P_ENUM:
6518 case P_OCTAL:
6519 case P_BYTES:
6520 *(int *)dest_ptr = *(int *)src_ptr;
6521 break;
6523 case P_CHAR:
6524 *(char *)dest_ptr = *(char *)src_ptr;
6525 break;
6527 case P_STRING:
6528 string_set((char **)dest_ptr,
6529 *(char **)src_ptr);
6530 break;
6532 case P_USTRING:
6534 char *upper_string = strupper_talloc(talloc_tos(),
6535 *(char **)src_ptr);
6536 string_set((char **)dest_ptr,
6537 upper_string);
6538 TALLOC_FREE(upper_string);
6539 break;
6541 case P_LIST:
6542 TALLOC_FREE(*((char ***)dest_ptr));
6543 *((char ***)dest_ptr) = str_list_copy(NULL,
6544 *(const char ***)src_ptr);
6545 break;
6546 default:
6547 break;
6551 if (bcopyall) {
6552 init_copymap(pserviceDest);
6553 if (pserviceSource->copymap)
6554 bitmap_copy(pserviceDest->copymap,
6555 pserviceSource->copymap);
6558 data = pserviceSource->param_opt;
6559 while (data) {
6560 set_param_opt(&pserviceDest->param_opt, data->key, data->value, data->priority);
6561 data = data->next;
6565 /***************************************************************************
6566 Check a service for consistency. Return false if the service is in any way
6567 incomplete or faulty, else true.
6568 ***************************************************************************/
6570 bool service_ok(int iService)
6572 bool bRetval;
6574 bRetval = true;
6575 if (ServicePtrs[iService]->szService[0] == '\0') {
6576 DEBUG(0, ("The following message indicates an internal error:\n"));
6577 DEBUG(0, ("No service name in service entry.\n"));
6578 bRetval = false;
6581 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
6582 /* I can't see why you'd want a non-printable printer service... */
6583 if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
6584 if (!ServicePtrs[iService]->bPrint_ok) {
6585 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
6586 ServicePtrs[iService]->szService));
6587 ServicePtrs[iService]->bPrint_ok = true;
6589 /* [printers] service must also be non-browsable. */
6590 if (ServicePtrs[iService]->bBrowseable)
6591 ServicePtrs[iService]->bBrowseable = false;
6594 if (ServicePtrs[iService]->szPath[0] == '\0' &&
6595 strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0 &&
6596 ServicePtrs[iService]->szMSDfsProxy[0] == '\0'
6598 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
6599 ServicePtrs[iService]->szService));
6600 ServicePtrs[iService]->bAvailable = false;
6603 /* If a service is flagged unavailable, log the fact at level 1. */
6604 if (!ServicePtrs[iService]->bAvailable)
6605 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
6606 ServicePtrs[iService]->szService));
6608 return (bRetval);
6611 static struct smbconf_ctx *lp_smbconf_ctx(void)
6613 sbcErr err;
6614 static struct smbconf_ctx *conf_ctx = NULL;
6616 if (conf_ctx == NULL) {
6617 err = smbconf_init(NULL, &conf_ctx, "registry:");
6618 if (!SBC_ERROR_IS_OK(err)) {
6619 DEBUG(1, ("error initializing registry configuration: "
6620 "%s\n", sbcErrorString(err)));
6621 conf_ctx = NULL;
6625 return conf_ctx;
6628 static bool process_smbconf_service(struct smbconf_service *service)
6630 uint32_t count;
6631 bool ret;
6633 if (service == NULL) {
6634 return false;
6637 ret = do_section(service->name, NULL);
6638 if (ret != true) {
6639 return false;
6641 for (count = 0; count < service->num_params; count++) {
6642 ret = do_parameter(service->param_names[count],
6643 service->param_values[count],
6644 NULL);
6645 if (ret != true) {
6646 return false;
6649 if (iServiceIndex >= 0) {
6650 return service_ok(iServiceIndex);
6652 return true;
6656 * load a service from registry and activate it
6658 bool process_registry_service(const char *service_name)
6660 sbcErr err;
6661 struct smbconf_service *service = NULL;
6662 TALLOC_CTX *mem_ctx = talloc_stackframe();
6663 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
6664 bool ret = false;
6666 if (conf_ctx == NULL) {
6667 goto done;
6670 DEBUG(5, ("process_registry_service: service name %s\n", service_name));
6672 if (!smbconf_share_exists(conf_ctx, service_name)) {
6674 * Registry does not contain data for this service (yet),
6675 * but make sure lp_load doesn't return false.
6677 ret = true;
6678 goto done;
6681 err = smbconf_get_share(conf_ctx, mem_ctx, service_name, &service);
6682 if (!SBC_ERROR_IS_OK(err)) {
6683 goto done;
6686 ret = process_smbconf_service(service);
6687 if (!ret) {
6688 goto done;
6691 /* store the csn */
6692 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
6694 done:
6695 TALLOC_FREE(mem_ctx);
6696 return ret;
6700 * process_registry_globals
6702 static bool process_registry_globals(void)
6704 bool ret;
6706 add_to_file_list(INCLUDE_REGISTRY_NAME, INCLUDE_REGISTRY_NAME);
6708 ret = do_parameter("registry shares", "yes", NULL);
6709 if (!ret) {
6710 return ret;
6713 return process_registry_service(GLOBAL_NAME);
6716 bool process_registry_shares(void)
6718 sbcErr err;
6719 uint32_t count;
6720 struct smbconf_service **service = NULL;
6721 uint32_t num_shares = 0;
6722 TALLOC_CTX *mem_ctx = talloc_stackframe();
6723 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
6724 bool ret = false;
6726 if (conf_ctx == NULL) {
6727 goto done;
6730 err = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &service);
6731 if (!SBC_ERROR_IS_OK(err)) {
6732 goto done;
6735 ret = true;
6737 for (count = 0; count < num_shares; count++) {
6738 if (strequal(service[count]->name, GLOBAL_NAME)) {
6739 continue;
6741 ret = process_smbconf_service(service[count]);
6742 if (!ret) {
6743 goto done;
6747 /* store the csn */
6748 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
6750 done:
6751 TALLOC_FREE(mem_ctx);
6752 return ret;
6756 * reload those shares from registry that are already
6757 * activated in the services array.
6759 static bool reload_registry_shares(void)
6761 int i;
6762 bool ret = true;
6764 for (i = 0; i < iNumServices; i++) {
6765 if (!VALID(i)) {
6766 continue;
6769 if (ServicePtrs[i]->usershare == USERSHARE_VALID) {
6770 continue;
6773 ret = process_registry_service(ServicePtrs[i]->szService);
6774 if (!ret) {
6775 goto done;
6779 done:
6780 return ret;
6784 #define MAX_INCLUDE_DEPTH 100
6786 static uint8_t include_depth;
6788 static struct file_lists {
6789 struct file_lists *next;
6790 char *name;
6791 char *subfname;
6792 time_t modtime;
6793 } *file_lists = NULL;
6795 /*******************************************************************
6796 Keep a linked list of all config files so we know when one has changed
6797 it's date and needs to be reloaded.
6798 ********************************************************************/
6800 static void add_to_file_list(const char *fname, const char *subfname)
6802 struct file_lists *f = file_lists;
6804 while (f) {
6805 if (f->name && !strcmp(f->name, fname))
6806 break;
6807 f = f->next;
6810 if (!f) {
6811 f = SMB_MALLOC_P(struct file_lists);
6812 if (!f)
6813 return;
6814 f->next = file_lists;
6815 f->name = SMB_STRDUP(fname);
6816 if (!f->name) {
6817 SAFE_FREE(f);
6818 return;
6820 f->subfname = SMB_STRDUP(subfname);
6821 if (!f->subfname) {
6822 SAFE_FREE(f->name);
6823 SAFE_FREE(f);
6824 return;
6826 file_lists = f;
6827 f->modtime = file_modtime(subfname);
6828 } else {
6829 time_t t = file_modtime(subfname);
6830 if (t)
6831 f->modtime = t;
6833 return;
6837 * Free the file lists
6839 static void free_file_list(void)
6841 struct file_lists *f;
6842 struct file_lists *next;
6844 f = file_lists;
6845 while( f ) {
6846 next = f->next;
6847 SAFE_FREE( f->name );
6848 SAFE_FREE( f->subfname );
6849 SAFE_FREE( f );
6850 f = next;
6852 file_lists = NULL;
6857 * Utility function for outsiders to check if we're running on registry.
6859 bool lp_config_backend_is_registry(void)
6861 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY);
6865 * Utility function to check if the config backend is FILE.
6867 bool lp_config_backend_is_file(void)
6869 return (lp_config_backend() == CONFIG_BACKEND_FILE);
6872 /*******************************************************************
6873 Check if a config file has changed date.
6874 ********************************************************************/
6876 bool lp_file_list_changed(void)
6878 struct file_lists *f = file_lists;
6880 DEBUG(6, ("lp_file_list_changed()\n"));
6882 while (f) {
6883 time_t mod_time;
6885 if (strequal(f->name, INCLUDE_REGISTRY_NAME)) {
6886 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
6888 if (conf_ctx == NULL) {
6889 return false;
6891 if (smbconf_changed(conf_ctx, &conf_last_csn, NULL,
6892 NULL))
6894 DEBUGADD(6, ("registry config changed\n"));
6895 return true;
6897 } else {
6898 char *n2 = NULL;
6899 n2 = talloc_sub_basic(talloc_tos(),
6900 get_current_username(),
6901 current_user_info.domain,
6902 f->name);
6903 if (!n2) {
6904 return false;
6906 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
6907 f->name, n2, ctime(&f->modtime)));
6909 mod_time = file_modtime(n2);
6911 if (mod_time &&
6912 ((f->modtime != mod_time) ||
6913 (f->subfname == NULL) ||
6914 (strcmp(n2, f->subfname) != 0)))
6916 DEBUGADD(6,
6917 ("file %s modified: %s\n", n2,
6918 ctime(&mod_time)));
6919 f->modtime = mod_time;
6920 SAFE_FREE(f->subfname);
6921 f->subfname = SMB_STRDUP(n2);
6922 TALLOC_FREE(n2);
6923 return true;
6925 TALLOC_FREE(n2);
6927 f = f->next;
6929 return false;
6934 * Initialize iconv conversion descriptors.
6936 * This is called the first time it is needed, and also called again
6937 * every time the configuration is reloaded, because the charset or
6938 * codepage might have changed.
6940 static void init_iconv(void)
6942 global_iconv_handle = smb_iconv_handle_reinit(NULL, lp_dos_charset(),
6943 lp_unix_charset(),
6944 true, global_iconv_handle);
6947 static bool handle_charset(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
6949 if (strcmp(*ptr, pszParmValue) != 0) {
6950 string_set(ptr, pszParmValue);
6951 init_iconv();
6953 return true;
6956 static bool handle_dos_charset(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
6958 bool is_utf8 = false;
6959 size_t len = strlen(pszParmValue);
6961 if (len == 4 || len == 5) {
6962 /* Don't use StrCaseCmp here as we don't want to
6963 initialize iconv. */
6964 if ((toupper_m(pszParmValue[0]) == 'U') &&
6965 (toupper_m(pszParmValue[1]) == 'T') &&
6966 (toupper_m(pszParmValue[2]) == 'F')) {
6967 if (len == 4) {
6968 if (pszParmValue[3] == '8') {
6969 is_utf8 = true;
6971 } else {
6972 if (pszParmValue[3] == '-' &&
6973 pszParmValue[4] == '8') {
6974 is_utf8 = true;
6980 if (strcmp(*ptr, pszParmValue) != 0) {
6981 if (is_utf8) {
6982 DEBUG(0,("ERROR: invalid DOS charset: 'dos charset' must not "
6983 "be UTF8, using (default value) %s instead.\n",
6984 DEFAULT_DOS_CHARSET));
6985 pszParmValue = DEFAULT_DOS_CHARSET;
6987 string_set(ptr, pszParmValue);
6988 init_iconv();
6990 return true;
6993 static bool handle_realm(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
6995 bool ret = true;
6996 char *realm = strupper_talloc(talloc_tos(), pszParmValue);
6997 char *dnsdomain = strlower_talloc(realm, pszParmValue);
6999 ret &= string_set(&Globals.szRealm, pszParmValue);
7000 ret &= string_set(&Globals.szRealm_upper, realm);
7001 ret &= string_set(&Globals.szRealm_lower, dnsdomain);
7002 TALLOC_FREE(realm);
7004 return ret;
7007 static bool handle_netbios_aliases(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
7009 TALLOC_FREE(Globals.szNetbiosAliases);
7010 Globals.szNetbiosAliases = (const char **)str_list_make_v3(NULL, pszParmValue, NULL);
7011 return set_netbios_aliases(Globals.szNetbiosAliases);
7014 /***************************************************************************
7015 Handle the include operation.
7016 ***************************************************************************/
7017 static bool bAllowIncludeRegistry = true;
7019 static bool handle_include(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
7021 char *fname;
7023 if (include_depth >= MAX_INCLUDE_DEPTH) {
7024 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7025 include_depth));
7026 return false;
7029 if (strequal(pszParmValue, INCLUDE_REGISTRY_NAME)) {
7030 if (!bAllowIncludeRegistry) {
7031 return true;
7033 if (bInGlobalSection) {
7034 bool ret;
7035 include_depth++;
7036 ret = process_registry_globals();
7037 include_depth--;
7038 return ret;
7039 } else {
7040 DEBUG(1, ("\"include = registry\" only effective "
7041 "in %s section\n", GLOBAL_NAME));
7042 return false;
7046 fname = talloc_sub_basic(talloc_tos(), get_current_username(),
7047 current_user_info.domain,
7048 pszParmValue);
7050 add_to_file_list(pszParmValue, fname);
7052 string_set(ptr, fname);
7054 if (file_exist(fname)) {
7055 bool ret;
7056 include_depth++;
7057 ret = pm_process(fname, do_section, do_parameter, NULL);
7058 include_depth--;
7059 TALLOC_FREE(fname);
7060 return ret;
7063 DEBUG(2, ("Can't find include file %s\n", fname));
7064 TALLOC_FREE(fname);
7065 return true;
7068 /***************************************************************************
7069 Handle the interpretation of the copy parameter.
7070 ***************************************************************************/
7072 static bool handle_copy(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
7074 bool bRetval;
7075 int iTemp;
7076 struct loadparm_service serviceTemp;
7078 string_set(ptr, pszParmValue);
7080 init_service(&serviceTemp);
7082 bRetval = false;
7084 DEBUG(3, ("Copying service from service %s\n", pszParmValue));
7086 if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) {
7087 if (iTemp == iServiceIndex) {
7088 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
7089 } else {
7090 copy_service(ServicePtrs[iServiceIndex],
7091 &serviceTemp,
7092 ServicePtrs[iServiceIndex]->copymap);
7093 bRetval = true;
7095 } else {
7096 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
7097 bRetval = false;
7100 free_service(&serviceTemp);
7101 return (bRetval);
7104 static bool handle_ldap_debug_level(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
7106 Globals.ldap_debug_level = lp_int(pszParmValue);
7107 init_ldap_debugging();
7108 return true;
7111 /***************************************************************************
7112 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7113 parameters is:
7115 [global]
7117 idmap uid = 1000-1999
7118 idmap gid = 700-899
7120 We only do simple parsing checks here. The strings are parsed into useful
7121 structures in the idmap daemon code.
7123 ***************************************************************************/
7125 /* Some lp_ routines to return idmap [ug]id information */
7127 static uid_t idmap_uid_low, idmap_uid_high;
7128 static gid_t idmap_gid_low, idmap_gid_high;
7130 bool lp_idmap_uid(uid_t *low, uid_t *high)
7132 if (idmap_uid_low == 0 || idmap_uid_high == 0)
7133 return false;
7135 if (low)
7136 *low = idmap_uid_low;
7138 if (high)
7139 *high = idmap_uid_high;
7141 return true;
7144 bool lp_idmap_gid(gid_t *low, gid_t *high)
7146 if (idmap_gid_low == 0 || idmap_gid_high == 0)
7147 return false;
7149 if (low)
7150 *low = idmap_gid_low;
7152 if (high)
7153 *high = idmap_gid_high;
7155 return true;
7158 static bool handle_idmap_backend(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
7160 lp_do_parameter(snum, "idmap config * : backend", pszParmValue);
7162 return true;
7165 /* Do some simple checks on "idmap [ug]id" parameter values */
7167 static bool handle_idmap_uid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
7169 lp_do_parameter(snum, "idmap config * : range", pszParmValue);
7171 return true;
7174 static bool handle_idmap_gid(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
7176 lp_do_parameter(snum, "idmap config * : range", pszParmValue);
7178 return true;
7181 /***************************************************************************
7182 Handle the DEBUG level list.
7183 ***************************************************************************/
7185 static bool handle_debug_list(struct loadparm_context *unused, int snum, const char *pszParmValueIn, char **ptr )
7187 string_set(ptr, pszParmValueIn);
7188 return debug_parse_levels(pszParmValueIn);
7191 /***************************************************************************
7192 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7193 ***************************************************************************/
7195 static const char *append_ldap_suffix(TALLOC_CTX *ctx, const char *str )
7197 const char *suffix_string;
7199 suffix_string = talloc_asprintf(ctx, "%s,%s", str,
7200 Globals.szLdapSuffix );
7201 if ( !suffix_string ) {
7202 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7203 return "";
7206 return suffix_string;
7209 const char *lp_ldap_machine_suffix(TALLOC_CTX *ctx)
7211 if (Globals.szLdapMachineSuffix[0])
7212 return append_ldap_suffix(ctx, Globals.szLdapMachineSuffix);
7214 return lp_string(ctx, Globals.szLdapSuffix);
7217 const char *lp_ldap_user_suffix(TALLOC_CTX *ctx)
7219 if (Globals.szLdapUserSuffix[0])
7220 return append_ldap_suffix(ctx, Globals.szLdapUserSuffix);
7222 return lp_string(ctx, Globals.szLdapSuffix);
7225 const char *lp_ldap_group_suffix(TALLOC_CTX *ctx)
7227 if (Globals.szLdapGroupSuffix[0])
7228 return append_ldap_suffix(ctx, Globals.szLdapGroupSuffix);
7230 return lp_string(ctx, Globals.szLdapSuffix);
7233 const char *lp_ldap_idmap_suffix(TALLOC_CTX *ctx)
7235 if (Globals.szLdapIdmapSuffix[0])
7236 return append_ldap_suffix(ctx, Globals.szLdapIdmapSuffix);
7238 return lp_string(ctx, Globals.szLdapSuffix);
7241 /****************************************************************************
7242 set the value for a P_ENUM
7243 ***************************************************************************/
7245 static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue,
7246 int *ptr )
7248 int i;
7250 for (i = 0; parm->enum_list[i].name; i++) {
7251 if ( strequal(pszParmValue, parm->enum_list[i].name)) {
7252 *ptr = parm->enum_list[i].value;
7253 return;
7256 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7257 pszParmValue, parm->label));
7260 /***************************************************************************
7261 ***************************************************************************/
7263 static bool handle_printing(struct loadparm_context *unused, int snum, const char *pszParmValue, char **ptr)
7265 static int parm_num = -1;
7266 struct loadparm_service *s;
7268 if ( parm_num == -1 )
7269 parm_num = map_parameter( "printing" );
7271 lp_set_enum_parm( &parm_table[parm_num], pszParmValue, (int*)ptr );
7273 if ( snum < 0 )
7274 s = &sDefault;
7275 else
7276 s = ServicePtrs[snum];
7278 init_printer_values( s );
7280 return true;
7284 /***************************************************************************
7285 Initialise a copymap.
7286 ***************************************************************************/
7288 static void init_copymap(struct loadparm_service *pservice)
7290 int i;
7292 TALLOC_FREE(pservice->copymap);
7294 pservice->copymap = bitmap_talloc(NULL, NUMPARAMETERS);
7295 if (!pservice->copymap)
7296 DEBUG(0,
7297 ("Couldn't allocate copymap!! (size %d)\n",
7298 (int)NUMPARAMETERS));
7299 else
7300 for (i = 0; i < NUMPARAMETERS; i++)
7301 bitmap_set(pservice->copymap, i);
7305 return the parameter pointer for a parameter
7307 void *lp_parm_ptr(struct loadparm_service *service, struct parm_struct *parm)
7309 if (service == NULL) {
7310 if (parm->p_class == P_LOCAL)
7311 return (void *)(((char *)&sDefault)+parm->offset);
7312 else if (parm->p_class == P_GLOBAL)
7313 return (void *)(((char *)&Globals)+parm->offset);
7314 else return NULL;
7315 } else {
7316 return (void *)(((char *)service) + parm->offset);
7320 /***************************************************************************
7321 Return the local pointer to a parameter given the service number and parameter
7322 ***************************************************************************/
7324 void *lp_local_ptr_by_snum(int snum, struct parm_struct *parm)
7326 return lp_parm_ptr(ServicePtrs[snum], parm);
7329 /***************************************************************************
7330 Process a parameter for a particular service number. If snum < 0
7331 then assume we are in the globals.
7332 ***************************************************************************/
7334 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
7336 int parmnum, i;
7337 void *parm_ptr = NULL; /* where we are going to store the result */
7338 struct parmlist_entry **opt_list;
7340 parmnum = map_parameter(pszParmName);
7342 if (parmnum < 0) {
7343 if (strchr(pszParmName, ':') == NULL) {
7344 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7345 pszParmName));
7346 return true;
7350 * We've got a parametric option
7353 opt_list = (snum < 0)
7354 ? &Globals.param_opt : &ServicePtrs[snum]->param_opt;
7355 set_param_opt(opt_list, pszParmName, pszParmValue, 0);
7357 return true;
7360 /* if it's already been set by the command line, then we don't
7361 override here */
7362 if (parm_table[parmnum].flags & FLAG_CMDLINE) {
7363 return true;
7366 if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
7367 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7368 pszParmName));
7371 /* we might point at a service, the default service or a global */
7372 if (snum < 0) {
7373 parm_ptr = lp_parm_ptr(NULL, &parm_table[parmnum]);
7374 } else {
7375 if (parm_table[parmnum].p_class == P_GLOBAL) {
7376 DEBUG(0,
7377 ("Global parameter %s found in service section!\n",
7378 pszParmName));
7379 return true;
7381 parm_ptr = lp_local_ptr_by_snum(snum, &parm_table[parmnum]);
7384 if (snum >= 0) {
7385 if (!ServicePtrs[snum]->copymap)
7386 init_copymap(ServicePtrs[snum]);
7388 /* this handles the aliases - set the copymap for other entries with
7389 the same data pointer */
7390 for (i = 0; parm_table[i].label; i++) {
7391 if ((parm_table[i].offset == parm_table[parmnum].offset)
7392 && (parm_table[i].p_class == parm_table[parmnum].p_class)) {
7393 bitmap_clear(ServicePtrs[snum]->copymap, i);
7398 /* if it is a special case then go ahead */
7399 if (parm_table[parmnum].special) {
7400 return parm_table[parmnum].special(NULL, snum, pszParmValue,
7401 (char **)parm_ptr);
7404 /* now switch on the type of variable it is */
7405 switch (parm_table[parmnum].type)
7407 case P_BOOL:
7408 *(bool *)parm_ptr = lp_bool(pszParmValue);
7409 break;
7411 case P_BOOLREV:
7412 *(bool *)parm_ptr = !lp_bool(pszParmValue);
7413 break;
7415 case P_INTEGER:
7416 *(int *)parm_ptr = lp_int(pszParmValue);
7417 break;
7419 case P_CHAR:
7420 *(char *)parm_ptr = *pszParmValue;
7421 break;
7423 case P_OCTAL:
7424 i = sscanf(pszParmValue, "%o", (int *)parm_ptr);
7425 if ( i != 1 ) {
7426 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName ));
7428 break;
7430 case P_BYTES:
7432 uint64_t val;
7433 if (conv_str_size_error(pszParmValue, &val)) {
7434 if (val <= INT_MAX) {
7435 *(int *)parm_ptr = (int)val;
7436 break;
7440 DEBUG(0,("lp_do_parameter(%s): value is not "
7441 "a valid size specifier!\n", pszParmValue));
7442 return false;
7445 case P_LIST:
7446 case P_CMDLIST:
7447 TALLOC_FREE(*((char ***)parm_ptr));
7448 *(char ***)parm_ptr = str_list_make_v3(
7449 NULL, pszParmValue, NULL);
7450 break;
7452 case P_STRING:
7453 string_set((char **)parm_ptr, pszParmValue);
7454 break;
7456 case P_USTRING:
7458 char *upper_string = strupper_talloc(talloc_tos(),
7459 pszParmValue);
7460 string_set((char **)parm_ptr, upper_string);
7461 TALLOC_FREE(upper_string);
7462 break;
7464 case P_ENUM:
7465 lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
7466 break;
7467 case P_SEP:
7468 break;
7471 return true;
7474 /***************************************************************************
7475 set a parameter, marking it with FLAG_CMDLINE. Parameters marked as
7476 FLAG_CMDLINE won't be overridden by loads from smb.conf.
7477 ***************************************************************************/
7479 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values)
7481 int parmnum, i;
7482 parmnum = map_parameter(pszParmName);
7483 if (parmnum >= 0) {
7484 parm_table[parmnum].flags &= ~FLAG_CMDLINE;
7485 if (!lp_do_parameter(-1, pszParmName, pszParmValue)) {
7486 return false;
7488 parm_table[parmnum].flags |= FLAG_CMDLINE;
7490 /* we have to also set FLAG_CMDLINE on aliases. Aliases must
7491 * be grouped in the table, so we don't have to search the
7492 * whole table */
7493 for (i=parmnum-1;
7494 i>=0 && parm_table[i].offset == parm_table[parmnum].offset
7495 && parm_table[i].p_class == parm_table[parmnum].p_class;
7496 i--) {
7497 parm_table[i].flags |= FLAG_CMDLINE;
7499 for (i=parmnum+1;i<NUMPARAMETERS && parm_table[i].offset == parm_table[parmnum].offset
7500 && parm_table[i].p_class == parm_table[parmnum].p_class;i++) {
7501 parm_table[i].flags |= FLAG_CMDLINE;
7504 if (store_values) {
7505 store_lp_set_cmdline(pszParmName, pszParmValue);
7507 return true;
7510 /* it might be parametric */
7511 if (strchr(pszParmName, ':') != NULL) {
7512 set_param_opt(&Globals.param_opt, pszParmName, pszParmValue, FLAG_CMDLINE);
7513 if (store_values) {
7514 store_lp_set_cmdline(pszParmName, pszParmValue);
7516 return true;
7519 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName));
7520 return true;
7523 bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
7525 return lp_set_cmdline_helper(pszParmName, pszParmValue, true);
7528 /***************************************************************************
7529 Process a parameter.
7530 ***************************************************************************/
7532 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
7533 void *userdata)
7535 if (!bInGlobalSection && bGlobalOnly)
7536 return true;
7538 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
7540 return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
7541 pszParmName, pszParmValue));
7545 set a option from the commandline in 'a=b' format. Use to support --option
7547 bool lp_set_option(const char *option)
7549 char *p, *s;
7550 bool ret;
7552 s = talloc_strdup(NULL, option);
7553 if (!s) {
7554 return false;
7557 p = strchr(s, '=');
7558 if (!p) {
7559 talloc_free(s);
7560 return false;
7563 *p = 0;
7565 /* skip white spaces after the = sign */
7566 do {
7567 p++;
7568 } while (*p == ' ');
7570 ret = lp_set_cmdline(s, p);
7571 talloc_free(s);
7572 return ret;
7575 /**************************************************************************
7576 Print a parameter of the specified type.
7577 ***************************************************************************/
7579 static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
7581 /* For the seperation of lists values that we print below */
7582 const char *list_sep = ", ";
7583 int i;
7584 switch (p->type)
7586 case P_ENUM:
7587 for (i = 0; p->enum_list[i].name; i++) {
7588 if (*(int *)ptr == p->enum_list[i].value) {
7589 fprintf(f, "%s",
7590 p->enum_list[i].name);
7591 break;
7594 break;
7596 case P_BOOL:
7597 fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
7598 break;
7600 case P_BOOLREV:
7601 fprintf(f, "%s", BOOLSTR(!*(bool *)ptr));
7602 break;
7604 case P_INTEGER:
7605 case P_BYTES:
7606 fprintf(f, "%d", *(int *)ptr);
7607 break;
7609 case P_CHAR:
7610 fprintf(f, "%c", *(char *)ptr);
7611 break;
7613 case P_OCTAL: {
7614 int val = *(int *)ptr;
7615 if (val == -1) {
7616 fprintf(f, "-1");
7617 } else {
7618 fprintf(f, "0%o", val);
7620 break;
7623 case P_CMDLIST:
7624 list_sep = " ";
7625 /* fall through */
7626 case P_LIST:
7627 if ((char ***)ptr && *(char ***)ptr) {
7628 char **list = *(char ***)ptr;
7629 for (; *list; list++) {
7630 /* surround strings with whitespace in double quotes */
7631 if (*(list+1) == NULL) {
7632 /* last item, no extra separator */
7633 list_sep = "";
7635 if ( strchr_m( *list, ' ' ) ) {
7636 fprintf(f, "\"%s\"%s", *list, list_sep);
7637 } else {
7638 fprintf(f, "%s%s", *list, list_sep);
7642 break;
7644 case P_STRING:
7645 case P_USTRING:
7646 if (*(char **)ptr) {
7647 fprintf(f, "%s", *(char **)ptr);
7649 break;
7650 case P_SEP:
7651 break;
7655 /***************************************************************************
7656 Check if two parameters are equal.
7657 ***************************************************************************/
7659 static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
7661 switch (type) {
7662 case P_BOOL:
7663 case P_BOOLREV:
7664 return (*((bool *)ptr1) == *((bool *)ptr2));
7666 case P_INTEGER:
7667 case P_ENUM:
7668 case P_OCTAL:
7669 case P_BYTES:
7670 return (*((int *)ptr1) == *((int *)ptr2));
7672 case P_CHAR:
7673 return (*((char *)ptr1) == *((char *)ptr2));
7675 case P_LIST:
7676 case P_CMDLIST:
7677 return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2);
7679 case P_STRING:
7680 case P_USTRING:
7682 char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
7683 if (p1 && !*p1)
7684 p1 = NULL;
7685 if (p2 && !*p2)
7686 p2 = NULL;
7687 return (p1 == p2 || strequal(p1, p2));
7689 case P_SEP:
7690 break;
7692 return false;
7695 /***************************************************************************
7696 Initialize any local varients in the sDefault table.
7697 ***************************************************************************/
7699 void init_locals(void)
7701 /* None as yet. */
7704 /***************************************************************************
7705 Process a new section (service). At this stage all sections are services.
7706 Later we'll have special sections that permit server parameters to be set.
7707 Returns true on success, false on failure.
7708 ***************************************************************************/
7710 static bool do_section(const char *pszSectionName, void *userdata)
7712 bool bRetval;
7713 bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
7714 (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
7715 bRetval = false;
7717 /* if we were in a global section then do the local inits */
7718 if (bInGlobalSection && !isglobal)
7719 init_locals();
7721 /* if we've just struck a global section, note the fact. */
7722 bInGlobalSection = isglobal;
7724 /* check for multiple global sections */
7725 if (bInGlobalSection) {
7726 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
7727 return true;
7730 if (!bInGlobalSection && bGlobalOnly)
7731 return true;
7733 /* if we have a current service, tidy it up before moving on */
7734 bRetval = true;
7736 if (iServiceIndex >= 0)
7737 bRetval = service_ok(iServiceIndex);
7739 /* if all is still well, move to the next record in the services array */
7740 if (bRetval) {
7741 /* We put this here to avoid an odd message order if messages are */
7742 /* issued by the post-processing of a previous section. */
7743 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName));
7745 iServiceIndex = add_a_service(&sDefault, pszSectionName);
7746 if (iServiceIndex < 0) {
7747 DEBUG(0, ("Failed to add a new service\n"));
7748 return false;
7750 /* Clean all parametric options for service */
7751 /* They will be added during parsing again */
7752 free_param_opts(&ServicePtrs[iServiceIndex]->param_opt);
7755 return bRetval;
7759 /***************************************************************************
7760 Determine if a partcular base parameter is currentl set to the default value.
7761 ***************************************************************************/
7763 static bool is_default(int i)
7765 if (!defaults_saved)
7766 return false;
7767 switch (parm_table[i].type) {
7768 case P_LIST:
7769 case P_CMDLIST:
7770 return str_list_equal((const char **)parm_table[i].def.lvalue,
7771 *(const char ***)lp_parm_ptr(NULL,
7772 &parm_table[i]));
7773 case P_STRING:
7774 case P_USTRING:
7775 return strequal(parm_table[i].def.svalue,
7776 *(char **)lp_parm_ptr(NULL,
7777 &parm_table[i]));
7778 case P_BOOL:
7779 case P_BOOLREV:
7780 return parm_table[i].def.bvalue ==
7781 *(bool *)lp_parm_ptr(NULL,
7782 &parm_table[i]);
7783 case P_CHAR:
7784 return parm_table[i].def.cvalue ==
7785 *(char *)lp_parm_ptr(NULL,
7786 &parm_table[i]);
7787 case P_INTEGER:
7788 case P_OCTAL:
7789 case P_ENUM:
7790 case P_BYTES:
7791 return parm_table[i].def.ivalue ==
7792 *(int *)lp_parm_ptr(NULL,
7793 &parm_table[i]);
7794 case P_SEP:
7795 break;
7797 return false;
7800 /***************************************************************************
7801 Display the contents of the global structure.
7802 ***************************************************************************/
7804 static void dump_globals(FILE *f)
7806 int i;
7807 struct parmlist_entry *data;
7809 fprintf(f, "[global]\n");
7811 for (i = 0; parm_table[i].label; i++)
7812 if (parm_table[i].p_class == P_GLOBAL &&
7813 !(parm_table[i].flags & FLAG_META) &&
7814 (i == 0 || (parm_table[i].offset != parm_table[i - 1].offset))) {
7815 if (defaults_saved && is_default(i))
7816 continue;
7817 fprintf(f, "\t%s = ", parm_table[i].label);
7818 print_parameter(&parm_table[i], lp_parm_ptr(NULL,
7819 &parm_table[i]),
7821 fprintf(f, "\n");
7823 if (Globals.param_opt != NULL) {
7824 data = Globals.param_opt;
7825 while(data) {
7826 fprintf(f, "\t%s = %s\n", data->key, data->value);
7827 data = data->next;
7833 /***************************************************************************
7834 Return true if a local parameter is currently set to the global default.
7835 ***************************************************************************/
7837 bool lp_is_default(int snum, struct parm_struct *parm)
7839 return equal_parameter(parm->type,
7840 lp_parm_ptr(ServicePtrs[snum], parm),
7841 lp_parm_ptr(NULL, parm));
7844 /***************************************************************************
7845 Display the contents of a single services record.
7846 ***************************************************************************/
7848 static void dump_a_service(struct loadparm_service *pService, FILE * f)
7850 int i;
7851 struct parmlist_entry *data;
7853 if (pService != &sDefault)
7854 fprintf(f, "[%s]\n", pService->szService);
7856 for (i = 0; parm_table[i].label; i++) {
7858 if (parm_table[i].p_class == P_LOCAL &&
7859 !(parm_table[i].flags & FLAG_META) &&
7860 (*parm_table[i].label != '-') &&
7861 (i == 0 || (parm_table[i].offset != parm_table[i - 1].offset)))
7863 if (pService == &sDefault) {
7864 if (defaults_saved && is_default(i))
7865 continue;
7866 } else {
7867 if (equal_parameter(parm_table[i].type,
7868 lp_parm_ptr(pService, &parm_table[i]),
7869 lp_parm_ptr(NULL, &parm_table[i])))
7870 continue;
7873 fprintf(f, "\t%s = ", parm_table[i].label);
7874 print_parameter(&parm_table[i],
7875 lp_parm_ptr(pService, &parm_table[i]),
7877 fprintf(f, "\n");
7881 if (pService->param_opt != NULL) {
7882 data = pService->param_opt;
7883 while(data) {
7884 fprintf(f, "\t%s = %s\n", data->key, data->value);
7885 data = data->next;
7890 /***************************************************************************
7891 Display the contents of a parameter of a single services record.
7892 ***************************************************************************/
7894 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
7896 int i;
7897 bool result = false;
7898 parm_class p_class;
7899 unsigned flag = 0;
7900 fstring local_parm_name;
7901 char *parm_opt;
7902 const char *parm_opt_value;
7904 /* check for parametrical option */
7905 fstrcpy( local_parm_name, parm_name);
7906 parm_opt = strchr( local_parm_name, ':');
7908 if (parm_opt) {
7909 *parm_opt = '\0';
7910 parm_opt++;
7911 if (strlen(parm_opt)) {
7912 parm_opt_value = lp_parm_const_string( snum,
7913 local_parm_name, parm_opt, NULL);
7914 if (parm_opt_value) {
7915 printf( "%s\n", parm_opt_value);
7916 result = true;
7919 return result;
7922 /* check for a key and print the value */
7923 if (isGlobal) {
7924 p_class = P_GLOBAL;
7925 flag = FLAG_GLOBAL;
7926 } else
7927 p_class = P_LOCAL;
7929 for (i = 0; parm_table[i].label; i++) {
7930 if (strwicmp(parm_table[i].label, parm_name) == 0 &&
7931 !(parm_table[i].flags & FLAG_META) &&
7932 (parm_table[i].p_class == p_class || parm_table[i].flags & flag) &&
7933 (*parm_table[i].label != '-') &&
7934 (i == 0 || (parm_table[i].offset != parm_table[i - 1].offset)))
7936 void *ptr;
7938 if (isGlobal) {
7939 ptr = lp_parm_ptr(NULL,
7940 &parm_table[i]);
7941 } else {
7942 ptr = lp_parm_ptr(ServicePtrs[snum],
7943 &parm_table[i]);
7946 print_parameter(&parm_table[i],
7947 ptr, f);
7948 fprintf(f, "\n");
7949 result = true;
7950 break;
7954 return result;
7957 /***************************************************************************
7958 Return info about the requested parameter (given as a string).
7959 Return NULL when the string is not a valid parameter name.
7960 ***************************************************************************/
7962 struct parm_struct *lp_get_parameter(const char *param_name)
7964 int num = map_parameter(param_name);
7966 if (num < 0) {
7967 return NULL;
7970 return &parm_table[num];
7973 /***************************************************************************
7974 Return info about the next parameter in a service.
7975 snum==GLOBAL_SECTION_SNUM gives the globals.
7976 Return NULL when out of parameters.
7977 ***************************************************************************/
7979 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
7981 if (snum < 0) {
7982 /* do the globals */
7983 for (; parm_table[*i].label; (*i)++) {
7984 if (parm_table[*i].p_class == P_SEPARATOR)
7985 return &parm_table[(*i)++];
7987 if ((*parm_table[*i].label == '-'))
7988 continue;
7990 if ((*i) > 0
7991 && (parm_table[*i].offset ==
7992 parm_table[(*i) - 1].offset)
7993 && (parm_table[*i].p_class ==
7994 parm_table[(*i) - 1].p_class))
7995 continue;
7997 if (is_default(*i) && !allparameters)
7998 continue;
8000 return &parm_table[(*i)++];
8002 } else {
8003 struct loadparm_service *pService = ServicePtrs[snum];
8005 for (; parm_table[*i].label; (*i)++) {
8006 if (parm_table[*i].p_class == P_SEPARATOR)
8007 return &parm_table[(*i)++];
8009 if (parm_table[*i].p_class == P_LOCAL &&
8010 (*parm_table[*i].label != '-') &&
8011 ((*i) == 0 ||
8012 (parm_table[*i].offset !=
8013 parm_table[(*i) - 1].offset)))
8015 if (allparameters ||
8016 !equal_parameter(parm_table[*i].type,
8017 lp_parm_ptr(pService,
8018 &parm_table[*i]),
8019 lp_parm_ptr(NULL,
8020 &parm_table[*i])))
8022 return &parm_table[(*i)++];
8028 return NULL;
8032 #if 0
8033 /***************************************************************************
8034 Display the contents of a single copy structure.
8035 ***************************************************************************/
8036 static void dump_copy_map(bool *pcopymap)
8038 int i;
8039 if (!pcopymap)
8040 return;
8042 printf("\n\tNon-Copied parameters:\n");
8044 for (i = 0; parm_table[i].label; i++)
8045 if (parm_table[i].p_class == P_LOCAL &&
8046 parm_table[i].ptr && !pcopymap[i] &&
8047 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8049 printf("\t\t%s\n", parm_table[i].label);
8052 #endif
8054 /***************************************************************************
8055 Return TRUE if the passed service number is within range.
8056 ***************************************************************************/
8058 bool lp_snum_ok(int iService)
8060 return (LP_SNUM_OK(iService) && ServicePtrs[iService]->bAvailable);
8063 /***************************************************************************
8064 Auto-load some home services.
8065 ***************************************************************************/
8067 static void lp_add_auto_services(char *str)
8069 char *s;
8070 char *p;
8071 int homes;
8072 char *saveptr;
8074 if (!str)
8075 return;
8077 s = SMB_STRDUP(str);
8078 if (!s)
8079 return;
8081 homes = lp_servicenumber(HOMES_NAME);
8083 for (p = strtok_r(s, LIST_SEP, &saveptr); p;
8084 p = strtok_r(NULL, LIST_SEP, &saveptr)) {
8085 char *home;
8087 if (lp_servicenumber(p) >= 0)
8088 continue;
8090 home = get_user_home_dir(talloc_tos(), p);
8092 if (home && home[0] && homes >= 0)
8093 lp_add_home(p, homes, p, home);
8095 TALLOC_FREE(home);
8097 SAFE_FREE(s);
8100 /***************************************************************************
8101 Auto-load one printer.
8102 ***************************************************************************/
8104 void lp_add_one_printer(const char *name, const char *comment,
8105 const char *location, void *pdata)
8107 int printers = lp_servicenumber(PRINTERS_NAME);
8108 int i;
8110 if (lp_servicenumber(name) < 0) {
8111 lp_add_printer(name, printers);
8112 if ((i = lp_servicenumber(name)) >= 0) {
8113 string_set(&ServicePtrs[i]->comment, comment);
8114 ServicePtrs[i]->autoloaded = true;
8119 /***************************************************************************
8120 Have we loaded a services file yet?
8121 ***************************************************************************/
8123 bool lp_loaded(void)
8125 return (bLoaded);
8128 /***************************************************************************
8129 Unload unused services.
8130 ***************************************************************************/
8132 void lp_killunused(struct smbd_server_connection *sconn,
8133 bool (*snumused) (struct smbd_server_connection *, int))
8135 int i;
8136 for (i = 0; i < iNumServices; i++) {
8137 if (!VALID(i))
8138 continue;
8140 /* don't kill autoloaded or usershare services */
8141 if ( ServicePtrs[i]->autoloaded ||
8142 ServicePtrs[i]->usershare == USERSHARE_VALID) {
8143 continue;
8146 if (!snumused || !snumused(sconn, i)) {
8147 free_service_byindex(i);
8153 * Kill all except autoloaded and usershare services - convenience wrapper
8155 void lp_kill_all_services(void)
8157 lp_killunused(NULL, NULL);
8160 /***************************************************************************
8161 Unload a service.
8162 ***************************************************************************/
8164 void lp_killservice(int iServiceIn)
8166 if (VALID(iServiceIn)) {
8167 free_service_byindex(iServiceIn);
8171 /***************************************************************************
8172 Save the curent values of all global and sDefault parameters into the
8173 defaults union. This allows swat and testparm to show only the
8174 changed (ie. non-default) parameters.
8175 ***************************************************************************/
8177 static void lp_save_defaults(void)
8179 int i;
8180 for (i = 0; parm_table[i].label; i++) {
8181 if (i > 0 && parm_table[i].offset == parm_table[i - 1].offset
8182 && parm_table[i].p_class == parm_table[i - 1].p_class)
8183 continue;
8184 switch (parm_table[i].type) {
8185 case P_LIST:
8186 case P_CMDLIST:
8187 parm_table[i].def.lvalue = str_list_copy(
8188 NULL, *(const char ***)lp_parm_ptr(NULL, &parm_table[i]));
8189 break;
8190 case P_STRING:
8191 case P_USTRING:
8192 parm_table[i].def.svalue = SMB_STRDUP(*(char **)lp_parm_ptr(NULL, &parm_table[i]));
8193 break;
8194 case P_BOOL:
8195 case P_BOOLREV:
8196 parm_table[i].def.bvalue =
8197 *(bool *)lp_parm_ptr(NULL, &parm_table[i]);
8198 break;
8199 case P_CHAR:
8200 parm_table[i].def.cvalue =
8201 *(char *)lp_parm_ptr(NULL, &parm_table[i]);
8202 break;
8203 case P_INTEGER:
8204 case P_OCTAL:
8205 case P_ENUM:
8206 case P_BYTES:
8207 parm_table[i].def.ivalue =
8208 *(int *)lp_parm_ptr(NULL, &parm_table[i]);
8209 break;
8210 case P_SEP:
8211 break;
8214 defaults_saved = true;
8217 /***********************************************************
8218 If we should send plaintext/LANMAN passwords in the clinet
8219 ************************************************************/
8221 static void set_allowed_client_auth(void)
8223 if (Globals.bClientNTLMv2Auth) {
8224 Globals.bClientLanManAuth = false;
8226 if (!Globals.bClientLanManAuth) {
8227 Globals.bClientPlaintextAuth = false;
8231 /***************************************************************************
8232 JRA.
8233 The following code allows smbd to read a user defined share file.
8234 Yes, this is my intent. Yes, I'm comfortable with that...
8236 THE FOLLOWING IS SECURITY CRITICAL CODE.
8238 It washes your clothes, it cleans your house, it guards you while you sleep...
8239 Do not f%^k with it....
8240 ***************************************************************************/
8242 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8244 /***************************************************************************
8245 Check allowed stat state of a usershare file.
8246 Ensure we print out who is dicking with us so the admin can
8247 get their sorry ass fired.
8248 ***************************************************************************/
8250 static bool check_usershare_stat(const char *fname,
8251 const SMB_STRUCT_STAT *psbuf)
8253 if (!S_ISREG(psbuf->st_ex_mode)) {
8254 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8255 "not a regular file\n",
8256 fname, (unsigned int)psbuf->st_ex_uid ));
8257 return false;
8260 /* Ensure this doesn't have the other write bit set. */
8261 if (psbuf->st_ex_mode & S_IWOTH) {
8262 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8263 "public write. Refusing to allow as a usershare file.\n",
8264 fname, (unsigned int)psbuf->st_ex_uid ));
8265 return false;
8268 /* Should be 10k or less. */
8269 if (psbuf->st_ex_size > MAX_USERSHARE_FILE_SIZE) {
8270 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8271 "too large (%u) to be a user share file.\n",
8272 fname, (unsigned int)psbuf->st_ex_uid,
8273 (unsigned int)psbuf->st_ex_size ));
8274 return false;
8277 return true;
8280 /***************************************************************************
8281 Parse the contents of a usershare file.
8282 ***************************************************************************/
8284 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
8285 SMB_STRUCT_STAT *psbuf,
8286 const char *servicename,
8287 int snum,
8288 char **lines,
8289 int numlines,
8290 char **pp_sharepath,
8291 char **pp_comment,
8292 char **pp_cp_servicename,
8293 struct security_descriptor **ppsd,
8294 bool *pallow_guest)
8296 const char **prefixallowlist = lp_usershare_prefix_allow_list();
8297 const char **prefixdenylist = lp_usershare_prefix_deny_list();
8298 int us_vers;
8299 DIR *dp;
8300 SMB_STRUCT_STAT sbuf;
8301 char *sharepath = NULL;
8302 char *comment = NULL;
8304 *pp_sharepath = NULL;
8305 *pp_comment = NULL;
8307 *pallow_guest = false;
8309 if (numlines < 4) {
8310 return USERSHARE_MALFORMED_FILE;
8313 if (strcmp(lines[0], "#VERSION 1") == 0) {
8314 us_vers = 1;
8315 } else if (strcmp(lines[0], "#VERSION 2") == 0) {
8316 us_vers = 2;
8317 if (numlines < 5) {
8318 return USERSHARE_MALFORMED_FILE;
8320 } else {
8321 return USERSHARE_BAD_VERSION;
8324 if (strncmp(lines[1], "path=", 5) != 0) {
8325 return USERSHARE_MALFORMED_PATH;
8328 sharepath = talloc_strdup(ctx, &lines[1][5]);
8329 if (!sharepath) {
8330 return USERSHARE_POSIX_ERR;
8332 trim_string(sharepath, " ", " ");
8334 if (strncmp(lines[2], "comment=", 8) != 0) {
8335 return USERSHARE_MALFORMED_COMMENT_DEF;
8338 comment = talloc_strdup(ctx, &lines[2][8]);
8339 if (!comment) {
8340 return USERSHARE_POSIX_ERR;
8342 trim_string(comment, " ", " ");
8343 trim_char(comment, '"', '"');
8345 if (strncmp(lines[3], "usershare_acl=", 14) != 0) {
8346 return USERSHARE_MALFORMED_ACL_DEF;
8349 if (!parse_usershare_acl(ctx, &lines[3][14], ppsd)) {
8350 return USERSHARE_ACL_ERR;
8353 if (us_vers == 2) {
8354 if (strncmp(lines[4], "guest_ok=", 9) != 0) {
8355 return USERSHARE_MALFORMED_ACL_DEF;
8357 if (lines[4][9] == 'y') {
8358 *pallow_guest = true;
8361 /* Backwards compatible extension to file version #2. */
8362 if (numlines > 5) {
8363 if (strncmp(lines[5], "sharename=", 10) != 0) {
8364 return USERSHARE_MALFORMED_SHARENAME_DEF;
8366 if (!strequal(&lines[5][10], servicename)) {
8367 return USERSHARE_BAD_SHARENAME;
8369 *pp_cp_servicename = talloc_strdup(ctx, &lines[5][10]);
8370 if (!*pp_cp_servicename) {
8371 return USERSHARE_POSIX_ERR;
8376 if (*pp_cp_servicename == NULL) {
8377 *pp_cp_servicename = talloc_strdup(ctx, servicename);
8378 if (!*pp_cp_servicename) {
8379 return USERSHARE_POSIX_ERR;
8383 if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->szPath) == 0)) {
8384 /* Path didn't change, no checks needed. */
8385 *pp_sharepath = sharepath;
8386 *pp_comment = comment;
8387 return USERSHARE_OK;
8390 /* The path *must* be absolute. */
8391 if (sharepath[0] != '/') {
8392 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8393 servicename, sharepath));
8394 return USERSHARE_PATH_NOT_ABSOLUTE;
8397 /* If there is a usershare prefix deny list ensure one of these paths
8398 doesn't match the start of the user given path. */
8399 if (prefixdenylist) {
8400 int i;
8401 for ( i=0; prefixdenylist[i]; i++ ) {
8402 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8403 servicename, i, prefixdenylist[i], sharepath ));
8404 if (memcmp( sharepath, prefixdenylist[i], strlen(prefixdenylist[i])) == 0) {
8405 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8406 "usershare prefix deny list entries.\n",
8407 servicename, sharepath));
8408 return USERSHARE_PATH_IS_DENIED;
8413 /* If there is a usershare prefix allow list ensure one of these paths
8414 does match the start of the user given path. */
8416 if (prefixallowlist) {
8417 int i;
8418 for ( i=0; prefixallowlist[i]; i++ ) {
8419 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8420 servicename, i, prefixallowlist[i], sharepath ));
8421 if (memcmp( sharepath, prefixallowlist[i], strlen(prefixallowlist[i])) == 0) {
8422 break;
8425 if (prefixallowlist[i] == NULL) {
8426 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8427 "usershare prefix allow list entries.\n",
8428 servicename, sharepath));
8429 return USERSHARE_PATH_NOT_ALLOWED;
8433 /* Ensure this is pointing to a directory. */
8434 dp = opendir(sharepath);
8436 if (!dp) {
8437 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8438 servicename, sharepath));
8439 return USERSHARE_PATH_NOT_DIRECTORY;
8442 /* Ensure the owner of the usershare file has permission to share
8443 this directory. */
8445 if (sys_stat(sharepath, &sbuf, false) == -1) {
8446 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8447 servicename, sharepath, strerror(errno) ));
8448 closedir(dp);
8449 return USERSHARE_POSIX_ERR;
8452 closedir(dp);
8454 if (!S_ISDIR(sbuf.st_ex_mode)) {
8455 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8456 servicename, sharepath ));
8457 return USERSHARE_PATH_NOT_DIRECTORY;
8460 /* Check if sharing is restricted to owner-only. */
8461 /* psbuf is the stat of the usershare definition file,
8462 sbuf is the stat of the target directory to be shared. */
8464 if (lp_usershare_owner_only()) {
8465 /* root can share anything. */
8466 if ((psbuf->st_ex_uid != 0) && (sbuf.st_ex_uid != psbuf->st_ex_uid)) {
8467 return USERSHARE_PATH_NOT_ALLOWED;
8471 *pp_sharepath = sharepath;
8472 *pp_comment = comment;
8473 return USERSHARE_OK;
8476 /***************************************************************************
8477 Deal with a usershare file.
8478 Returns:
8479 >= 0 - snum
8480 -1 - Bad name, invalid contents.
8481 - service name already existed and not a usershare, problem
8482 with permissions to share directory etc.
8483 ***************************************************************************/
8485 static int process_usershare_file(const char *dir_name, const char *file_name, int snum_template)
8487 SMB_STRUCT_STAT sbuf;
8488 SMB_STRUCT_STAT lsbuf;
8489 char *fname = NULL;
8490 char *sharepath = NULL;
8491 char *comment = NULL;
8492 char *cp_service_name = NULL;
8493 char **lines = NULL;
8494 int numlines = 0;
8495 int fd = -1;
8496 int iService = -1;
8497 TALLOC_CTX *ctx = talloc_stackframe();
8498 struct security_descriptor *psd = NULL;
8499 bool guest_ok = false;
8500 char *canon_name = NULL;
8501 bool added_service = false;
8502 int ret = -1;
8504 /* Ensure share name doesn't contain invalid characters. */
8505 if (!validate_net_name(file_name, INVALID_SHARENAME_CHARS, strlen(file_name))) {
8506 DEBUG(0,("process_usershare_file: share name %s contains "
8507 "invalid characters (any of %s)\n",
8508 file_name, INVALID_SHARENAME_CHARS ));
8509 goto out;
8512 canon_name = canonicalize_servicename(ctx, file_name);
8513 if (!canon_name) {
8514 goto out;
8517 fname = talloc_asprintf(ctx, "%s/%s", dir_name, file_name);
8518 if (!fname) {
8519 goto out;
8522 /* Minimize the race condition by doing an lstat before we
8523 open and fstat. Ensure this isn't a symlink link. */
8525 if (sys_lstat(fname, &lsbuf, false) != 0) {
8526 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8527 fname, strerror(errno) ));
8528 goto out;
8531 /* This must be a regular file, not a symlink, directory or
8532 other strange filetype. */
8533 if (!check_usershare_stat(fname, &lsbuf)) {
8534 goto out;
8538 TDB_DATA data;
8539 NTSTATUS status;
8541 status = dbwrap_fetch_bystring(ServiceHash, canon_name,
8542 canon_name, &data);
8544 iService = -1;
8546 if (NT_STATUS_IS_OK(status) &&
8547 (data.dptr != NULL) &&
8548 (data.dsize == sizeof(iService))) {
8549 memcpy(&iService, data.dptr, sizeof(iService));
8553 if (iService != -1 &&
8554 timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
8555 &lsbuf.st_ex_mtime) == 0) {
8556 /* Nothing changed - Mark valid and return. */
8557 DEBUG(10,("process_usershare_file: service %s not changed.\n",
8558 canon_name ));
8559 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8560 ret = iService;
8561 goto out;
8564 /* Try and open the file read only - no symlinks allowed. */
8565 #ifdef O_NOFOLLOW
8566 fd = open(fname, O_RDONLY|O_NOFOLLOW, 0);
8567 #else
8568 fd = open(fname, O_RDONLY, 0);
8569 #endif
8571 if (fd == -1) {
8572 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
8573 fname, strerror(errno) ));
8574 goto out;
8577 /* Now fstat to be *SURE* it's a regular file. */
8578 if (sys_fstat(fd, &sbuf, false) != 0) {
8579 close(fd);
8580 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
8581 fname, strerror(errno) ));
8582 goto out;
8585 /* Is it the same dev/inode as was lstated ? */
8586 if (!check_same_stat(&lsbuf, &sbuf)) {
8587 close(fd);
8588 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
8589 "Symlink spoofing going on ?\n", fname ));
8590 goto out;
8593 /* This must be a regular file, not a symlink, directory or
8594 other strange filetype. */
8595 if (!check_usershare_stat(fname, &sbuf)) {
8596 goto out;
8599 lines = fd_lines_load(fd, &numlines, MAX_USERSHARE_FILE_SIZE, NULL);
8601 close(fd);
8602 if (lines == NULL) {
8603 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
8604 fname, (unsigned int)sbuf.st_ex_uid ));
8605 goto out;
8608 if (parse_usershare_file(ctx, &sbuf, file_name,
8609 iService, lines, numlines, &sharepath,
8610 &comment, &cp_service_name,
8611 &psd, &guest_ok) != USERSHARE_OK) {
8612 goto out;
8615 /* Everything ok - add the service possibly using a template. */
8616 if (iService < 0) {
8617 const struct loadparm_service *sp = &sDefault;
8618 if (snum_template != -1) {
8619 sp = ServicePtrs[snum_template];
8622 if ((iService = add_a_service(sp, cp_service_name)) < 0) {
8623 DEBUG(0, ("process_usershare_file: Failed to add "
8624 "new service %s\n", cp_service_name));
8625 goto out;
8628 added_service = true;
8630 /* Read only is controlled by usershare ACL below. */
8631 ServicePtrs[iService]->bRead_only = false;
8634 /* Write the ACL of the new/modified share. */
8635 if (!set_share_security(canon_name, psd)) {
8636 DEBUG(0, ("process_usershare_file: Failed to set share "
8637 "security for user share %s\n",
8638 canon_name ));
8639 goto out;
8642 /* If from a template it may be marked invalid. */
8643 ServicePtrs[iService]->valid = true;
8645 /* Set the service as a valid usershare. */
8646 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8648 /* Set guest access. */
8649 if (lp_usershare_allow_guests()) {
8650 ServicePtrs[iService]->bGuest_ok = guest_ok;
8653 /* And note when it was loaded. */
8654 ServicePtrs[iService]->usershare_last_mod = sbuf.st_ex_mtime;
8655 string_set(&ServicePtrs[iService]->szPath, sharepath);
8656 string_set(&ServicePtrs[iService]->comment, comment);
8658 ret = iService;
8660 out:
8662 if (ret == -1 && iService != -1 && added_service) {
8663 lp_remove_service(iService);
8666 TALLOC_FREE(lines);
8667 TALLOC_FREE(ctx);
8668 return ret;
8671 /***************************************************************************
8672 Checks if a usershare entry has been modified since last load.
8673 ***************************************************************************/
8675 static bool usershare_exists(int iService, struct timespec *last_mod)
8677 SMB_STRUCT_STAT lsbuf;
8678 const char *usersharepath = Globals.szUsersharePath;
8679 char *fname;
8681 if (asprintf(&fname, "%s/%s",
8682 usersharepath,
8683 ServicePtrs[iService]->szService) < 0) {
8684 return false;
8687 if (sys_lstat(fname, &lsbuf, false) != 0) {
8688 SAFE_FREE(fname);
8689 return false;
8692 if (!S_ISREG(lsbuf.st_ex_mode)) {
8693 SAFE_FREE(fname);
8694 return false;
8697 SAFE_FREE(fname);
8698 *last_mod = lsbuf.st_ex_mtime;
8699 return true;
8702 /***************************************************************************
8703 Load a usershare service by name. Returns a valid servicenumber or -1.
8704 ***************************************************************************/
8706 int load_usershare_service(const char *servicename)
8708 SMB_STRUCT_STAT sbuf;
8709 const char *usersharepath = Globals.szUsersharePath;
8710 int max_user_shares = Globals.iUsershareMaxShares;
8711 int snum_template = -1;
8713 if (*usersharepath == 0 || max_user_shares == 0) {
8714 return -1;
8717 if (sys_stat(usersharepath, &sbuf, false) != 0) {
8718 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
8719 usersharepath, strerror(errno) ));
8720 return -1;
8723 if (!S_ISDIR(sbuf.st_ex_mode)) {
8724 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
8725 usersharepath ));
8726 return -1;
8730 * This directory must be owned by root, and have the 't' bit set.
8731 * It also must not be writable by "other".
8734 #ifdef S_ISVTX
8735 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
8736 #else
8737 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
8738 #endif
8739 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
8740 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8741 usersharepath ));
8742 return -1;
8745 /* Ensure the template share exists if it's set. */
8746 if (Globals.szUsershareTemplateShare[0]) {
8747 /* We can't use lp_servicenumber here as we are recommending that
8748 template shares have -valid=false set. */
8749 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
8750 if (ServicePtrs[snum_template]->szService &&
8751 strequal(ServicePtrs[snum_template]->szService,
8752 Globals.szUsershareTemplateShare)) {
8753 break;
8757 if (snum_template == -1) {
8758 DEBUG(0,("load_usershare_service: usershare template share %s "
8759 "does not exist.\n",
8760 Globals.szUsershareTemplateShare ));
8761 return -1;
8765 return process_usershare_file(usersharepath, servicename, snum_template);
8768 /***************************************************************************
8769 Load all user defined shares from the user share directory.
8770 We only do this if we're enumerating the share list.
8771 This is the function that can delete usershares that have
8772 been removed.
8773 ***************************************************************************/
8775 int load_usershare_shares(struct smbd_server_connection *sconn,
8776 bool (*snumused) (struct smbd_server_connection *, int))
8778 DIR *dp;
8779 SMB_STRUCT_STAT sbuf;
8780 struct dirent *de;
8781 int num_usershares = 0;
8782 int max_user_shares = Globals.iUsershareMaxShares;
8783 unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries;
8784 unsigned int allowed_bad_entries = ((2*max_user_shares)/10);
8785 unsigned int allowed_tmp_entries = ((2*max_user_shares)/10);
8786 int iService;
8787 int snum_template = -1;
8788 const char *usersharepath = Globals.szUsersharePath;
8789 int ret = lp_numservices();
8790 TALLOC_CTX *tmp_ctx;
8792 if (max_user_shares == 0 || *usersharepath == '\0') {
8793 return lp_numservices();
8796 if (sys_stat(usersharepath, &sbuf, false) != 0) {
8797 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
8798 usersharepath, strerror(errno) ));
8799 return ret;
8803 * This directory must be owned by root, and have the 't' bit set.
8804 * It also must not be writable by "other".
8807 #ifdef S_ISVTX
8808 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
8809 #else
8810 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
8811 #endif
8812 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
8813 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8814 usersharepath ));
8815 return ret;
8818 /* Ensure the template share exists if it's set. */
8819 if (Globals.szUsershareTemplateShare[0]) {
8820 /* We can't use lp_servicenumber here as we are recommending that
8821 template shares have -valid=false set. */
8822 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
8823 if (ServicePtrs[snum_template]->szService &&
8824 strequal(ServicePtrs[snum_template]->szService,
8825 Globals.szUsershareTemplateShare)) {
8826 break;
8830 if (snum_template == -1) {
8831 DEBUG(0,("load_usershare_shares: usershare template share %s "
8832 "does not exist.\n",
8833 Globals.szUsershareTemplateShare ));
8834 return ret;
8838 /* Mark all existing usershares as pending delete. */
8839 for (iService = iNumServices - 1; iService >= 0; iService--) {
8840 if (VALID(iService) && ServicePtrs[iService]->usershare) {
8841 ServicePtrs[iService]->usershare = USERSHARE_PENDING_DELETE;
8845 dp = opendir(usersharepath);
8846 if (!dp) {
8847 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
8848 usersharepath, strerror(errno) ));
8849 return ret;
8852 for (num_dir_entries = 0, num_bad_dir_entries = 0, num_tmp_dir_entries = 0;
8853 (de = readdir(dp));
8854 num_dir_entries++ ) {
8855 int r;
8856 const char *n = de->d_name;
8858 /* Ignore . and .. */
8859 if (*n == '.') {
8860 if ((n[1] == '\0') || (n[1] == '.' && n[2] == '\0')) {
8861 continue;
8865 if (n[0] == ':') {
8866 /* Temporary file used when creating a share. */
8867 num_tmp_dir_entries++;
8870 /* Allow 20% tmp entries. */
8871 if (num_tmp_dir_entries > allowed_tmp_entries) {
8872 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
8873 "in directory %s\n",
8874 num_tmp_dir_entries, usersharepath));
8875 break;
8878 r = process_usershare_file(usersharepath, n, snum_template);
8879 if (r == 0) {
8880 /* Update the services count. */
8881 num_usershares++;
8882 if (num_usershares >= max_user_shares) {
8883 DEBUG(0,("load_usershare_shares: max user shares reached "
8884 "on file %s in directory %s\n",
8885 n, usersharepath ));
8886 break;
8888 } else if (r == -1) {
8889 num_bad_dir_entries++;
8892 /* Allow 20% bad entries. */
8893 if (num_bad_dir_entries > allowed_bad_entries) {
8894 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
8895 "in directory %s\n",
8896 num_bad_dir_entries, usersharepath));
8897 break;
8900 /* Allow 20% bad entries. */
8901 if (num_dir_entries > max_user_shares + allowed_bad_entries) {
8902 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
8903 "in directory %s\n",
8904 num_dir_entries, usersharepath));
8905 break;
8909 closedir(dp);
8911 /* Sweep through and delete any non-refreshed usershares that are
8912 not currently in use. */
8913 tmp_ctx = talloc_stackframe();
8914 for (iService = iNumServices - 1; iService >= 0; iService--) {
8915 if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
8916 char *servname;
8918 if (snumused && snumused(sconn, iService)) {
8919 continue;
8922 servname = lp_servicename(tmp_ctx, iService);
8924 /* Remove from the share ACL db. */
8925 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
8926 servname ));
8927 delete_share_security(servname);
8928 free_service_byindex(iService);
8931 talloc_free(tmp_ctx);
8933 return lp_numservices();
8936 /********************************************************
8937 Destroy global resources allocated in this file
8938 ********************************************************/
8940 void gfree_loadparm(void)
8942 int i;
8944 free_file_list();
8946 /* Free resources allocated to services */
8948 for ( i = 0; i < iNumServices; i++ ) {
8949 if ( VALID(i) ) {
8950 free_service_byindex(i);
8954 SAFE_FREE( ServicePtrs );
8955 iNumServices = 0;
8957 /* Now release all resources allocated to global
8958 parameters and the default service */
8960 free_global_parameters();
8964 /***************************************************************************
8965 Allow client apps to specify that they are a client
8966 ***************************************************************************/
8967 static void lp_set_in_client(bool b)
8969 in_client = b;
8973 /***************************************************************************
8974 Determine if we're running in a client app
8975 ***************************************************************************/
8976 static bool lp_is_in_client(void)
8978 return in_client;
8981 /***************************************************************************
8982 Load the services array from the services file. Return true on success,
8983 false on failure.
8984 ***************************************************************************/
8986 static bool lp_load_ex(const char *pszFname,
8987 bool global_only,
8988 bool save_defaults,
8989 bool add_ipc,
8990 bool initialize_globals,
8991 bool allow_include_registry,
8992 bool load_all_shares)
8994 char *n2 = NULL;
8995 bool bRetval;
8997 bRetval = false;
8999 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9001 bInGlobalSection = true;
9002 bGlobalOnly = global_only;
9003 bAllowIncludeRegistry = allow_include_registry;
9005 init_globals(initialize_globals);
9007 free_file_list();
9009 if (save_defaults) {
9010 init_locals();
9011 lp_save_defaults();
9014 if (!initialize_globals) {
9015 free_param_opts(&Globals.param_opt);
9016 apply_lp_set_cmdline();
9019 lp_do_parameter(-1, "idmap config * : backend", Globals.szIdmapBackend);
9021 /* We get sections first, so have to start 'behind' to make up */
9022 iServiceIndex = -1;
9024 if (lp_config_backend_is_file()) {
9025 n2 = talloc_sub_basic(talloc_tos(), get_current_username(),
9026 current_user_info.domain,
9027 pszFname);
9028 if (!n2) {
9029 smb_panic("lp_load_ex: out of memory");
9032 add_to_file_list(pszFname, n2);
9034 bRetval = pm_process(n2, do_section, do_parameter, NULL);
9035 TALLOC_FREE(n2);
9037 /* finish up the last section */
9038 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
9039 if (bRetval) {
9040 if (iServiceIndex >= 0) {
9041 bRetval = service_ok(iServiceIndex);
9045 if (lp_config_backend_is_registry()) {
9046 /* config backend changed to registry in config file */
9048 * We need to use this extra global variable here to
9049 * survive restart: init_globals uses this as a default
9050 * for ConfigBackend. Otherwise, init_globals would
9051 * send us into an endless loop here.
9053 config_backend = CONFIG_BACKEND_REGISTRY;
9054 /* start over */
9055 DEBUG(1, ("lp_load_ex: changing to config backend "
9056 "registry\n"));
9057 init_globals(true);
9058 lp_kill_all_services();
9059 return lp_load_ex(pszFname, global_only, save_defaults,
9060 add_ipc, initialize_globals,
9061 allow_include_registry,
9062 load_all_shares);
9064 } else if (lp_config_backend_is_registry()) {
9065 bRetval = process_registry_globals();
9066 } else {
9067 DEBUG(0, ("Illegal config backend given: %d\n",
9068 lp_config_backend()));
9069 bRetval = false;
9072 if (bRetval && lp_registry_shares()) {
9073 if (load_all_shares) {
9074 bRetval = process_registry_shares();
9075 } else {
9076 bRetval = reload_registry_shares();
9081 char *serv = lp_auto_services(talloc_tos());
9082 lp_add_auto_services(serv);
9083 TALLOC_FREE(serv);
9086 if (add_ipc) {
9087 /* When 'restrict anonymous = 2' guest connections to ipc$
9088 are denied */
9089 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9090 if ( lp_enable_asu_support() ) {
9091 lp_add_ipc("ADMIN$", false);
9095 set_allowed_client_auth();
9097 if (lp_security() == SEC_ADS && strchr(lp_passwordserver(), ':')) {
9098 DEBUG(1, ("WARNING: The optional ':port' in password server = %s is deprecated\n",
9099 lp_passwordserver()));
9102 bLoaded = true;
9104 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9105 /* if bWINSsupport is true and we are in the client */
9106 if (lp_is_in_client() && Globals.bWINSsupport) {
9107 lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
9110 init_iconv();
9112 fault_configure(smb_panic_s3);
9114 bAllowIncludeRegistry = true;
9116 return (bRetval);
9119 bool lp_load(const char *pszFname,
9120 bool global_only,
9121 bool save_defaults,
9122 bool add_ipc,
9123 bool initialize_globals)
9125 return lp_load_ex(pszFname,
9126 global_only,
9127 save_defaults,
9128 add_ipc,
9129 initialize_globals,
9130 true, /* allow_include_registry */
9131 false); /* load_all_shares*/
9134 bool lp_load_initial_only(const char *pszFname)
9136 return lp_load_ex(pszFname,
9137 true, /* global only */
9138 false, /* save_defaults */
9139 false, /* add_ipc */
9140 true, /* initialize_globals */
9141 false, /* allow_include_registry */
9142 false); /* load_all_shares*/
9146 * most common lp_load wrapper, loading only the globals
9148 bool lp_load_global(const char *file_name)
9150 return lp_load_ex(file_name,
9151 true, /* global_only */
9152 false, /* save_defaults */
9153 false, /* add_ipc */
9154 true, /* initialize_globals */
9155 true, /* allow_include_registry */
9156 false); /* load_all_shares*/
9160 * lp_load wrapper, especially for clients
9162 bool lp_load_client(const char *file_name)
9164 lp_set_in_client(true);
9166 return lp_load_global(file_name);
9170 * lp_load wrapper, loading only globals, but intended
9171 * for subsequent calls, not reinitializing the globals
9172 * to default values
9174 bool lp_load_global_no_reinit(const char *file_name)
9176 return lp_load_ex(file_name,
9177 true, /* global_only */
9178 false, /* save_defaults */
9179 false, /* add_ipc */
9180 false, /* initialize_globals */
9181 true, /* allow_include_registry */
9182 false); /* load_all_shares*/
9186 * lp_load wrapper, especially for clients, no reinitialization
9188 bool lp_load_client_no_reinit(const char *file_name)
9190 lp_set_in_client(true);
9192 return lp_load_global_no_reinit(file_name);
9195 bool lp_load_with_registry_shares(const char *pszFname,
9196 bool global_only,
9197 bool save_defaults,
9198 bool add_ipc,
9199 bool initialize_globals)
9201 return lp_load_ex(pszFname,
9202 global_only,
9203 save_defaults,
9204 add_ipc,
9205 initialize_globals,
9206 true, /* allow_include_registry */
9207 true); /* load_all_shares*/
9210 /***************************************************************************
9211 Return the max number of services.
9212 ***************************************************************************/
9214 int lp_numservices(void)
9216 return (iNumServices);
9219 /***************************************************************************
9220 Display the contents of the services array in human-readable form.
9221 ***************************************************************************/
9223 void lp_dump(FILE *f, bool show_defaults, int maxtoprint)
9225 int iService;
9227 if (show_defaults)
9228 defaults_saved = false;
9230 dump_globals(f);
9232 dump_a_service(&sDefault, f);
9234 for (iService = 0; iService < maxtoprint; iService++) {
9235 fprintf(f,"\n");
9236 lp_dump_one(f, show_defaults, iService);
9240 /***************************************************************************
9241 Display the contents of one service in human-readable form.
9242 ***************************************************************************/
9244 void lp_dump_one(FILE * f, bool show_defaults, int snum)
9246 if (VALID(snum)) {
9247 if (ServicePtrs[snum]->szService[0] == '\0')
9248 return;
9249 dump_a_service(ServicePtrs[snum], f);
9253 /***************************************************************************
9254 Return the number of the service with the given name, or -1 if it doesn't
9255 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9256 getservicebyname()! This works ONLY if all services have been loaded, and
9257 does not copy the found service.
9258 ***************************************************************************/
9260 int lp_servicenumber(const char *pszServiceName)
9262 int iService;
9263 fstring serviceName;
9265 if (!pszServiceName) {
9266 return GLOBAL_SECTION_SNUM;
9269 for (iService = iNumServices - 1; iService >= 0; iService--) {
9270 if (VALID(iService) && ServicePtrs[iService]->szService) {
9272 * The substitution here is used to support %U is
9273 * service names
9275 fstrcpy(serviceName, ServicePtrs[iService]->szService);
9276 standard_sub_basic(get_current_username(),
9277 current_user_info.domain,
9278 serviceName,sizeof(serviceName));
9279 if (strequal(serviceName, pszServiceName)) {
9280 break;
9285 if (iService >= 0 && ServicePtrs[iService]->usershare == USERSHARE_VALID) {
9286 struct timespec last_mod;
9288 if (!usershare_exists(iService, &last_mod)) {
9289 /* Remove the share security tdb entry for it. */
9290 delete_share_security(lp_servicename(talloc_tos(), iService));
9291 /* Remove it from the array. */
9292 free_service_byindex(iService);
9293 /* Doesn't exist anymore. */
9294 return GLOBAL_SECTION_SNUM;
9297 /* Has it been modified ? If so delete and reload. */
9298 if (timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
9299 &last_mod) < 0) {
9300 /* Remove it from the array. */
9301 free_service_byindex(iService);
9302 /* and now reload it. */
9303 iService = load_usershare_service(pszServiceName);
9307 if (iService < 0) {
9308 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
9309 return GLOBAL_SECTION_SNUM;
9312 return (iService);
9315 /*******************************************************************
9316 A useful volume label function.
9317 ********************************************************************/
9319 const char *volume_label(TALLOC_CTX *ctx, int snum)
9321 char *ret;
9322 const char *label = lp_volume(ctx, snum);
9323 if (!*label) {
9324 label = lp_servicename(ctx, snum);
9327 /* This returns a 33 byte guarenteed null terminated string. */
9328 ret = talloc_strndup(ctx, label, 32);
9329 if (!ret) {
9330 return "";
9332 return ret;
9335 /*******************************************************************
9336 Get the default server type we will announce as via nmbd.
9337 ********************************************************************/
9339 int lp_default_server_announce(void)
9341 int default_server_announce = 0;
9342 default_server_announce |= SV_TYPE_WORKSTATION;
9343 default_server_announce |= SV_TYPE_SERVER;
9344 default_server_announce |= SV_TYPE_SERVER_UNIX;
9346 /* note that the flag should be set only if we have a
9347 printer service but nmbd doesn't actually load the
9348 services so we can't tell --jerry */
9350 default_server_announce |= SV_TYPE_PRINTQ_SERVER;
9352 default_server_announce |= SV_TYPE_SERVER_NT;
9353 default_server_announce |= SV_TYPE_NT;
9355 switch (lp_server_role()) {
9356 case ROLE_DOMAIN_MEMBER:
9357 default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
9358 break;
9359 case ROLE_DOMAIN_PDC:
9360 default_server_announce |= SV_TYPE_DOMAIN_CTRL;
9361 break;
9362 case ROLE_DOMAIN_BDC:
9363 default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL;
9364 break;
9365 case ROLE_STANDALONE:
9366 default:
9367 break;
9369 if (lp_time_server())
9370 default_server_announce |= SV_TYPE_TIME_SOURCE;
9372 if (lp_host_msdfs())
9373 default_server_announce |= SV_TYPE_DFS_SERVER;
9375 return default_server_announce;
9378 /***********************************************************
9379 If we are PDC then prefer us as DMB
9380 ************************************************************/
9382 bool lp_domain_master(void)
9384 if (Globals.domain_master == Auto)
9385 return (lp_server_role() == ROLE_DOMAIN_PDC);
9387 return (bool)Globals.domain_master;
9390 /***********************************************************
9391 If we are PDC then prefer us as DMB
9392 ************************************************************/
9394 static bool lp_domain_master_true_or_auto(void)
9396 if (Globals.domain_master) /* auto or yes */
9397 return true;
9399 return false;
9402 /***********************************************************
9403 If we are DMB then prefer us as LMB
9404 ************************************************************/
9406 bool lp_preferred_master(void)
9408 if (Globals.iPreferredMaster == Auto)
9409 return (lp_local_master() && lp_domain_master());
9411 return (bool)Globals.iPreferredMaster;
9414 /*******************************************************************
9415 Remove a service.
9416 ********************************************************************/
9418 void lp_remove_service(int snum)
9420 ServicePtrs[snum]->valid = false;
9421 invalid_services[num_invalid_services++] = snum;
9424 /*******************************************************************
9425 Copy a service.
9426 ********************************************************************/
9428 void lp_copy_service(int snum, const char *new_name)
9430 do_section(new_name, NULL);
9431 if (snum >= 0) {
9432 snum = lp_servicenumber(new_name);
9433 if (snum >= 0) {
9434 char *name = lp_servicename(talloc_tos(), snum);
9435 lp_do_parameter(snum, "copy", name);
9440 const char *lp_printername(TALLOC_CTX *ctx, int snum)
9442 const char *ret = lp__printername(talloc_tos(), snum);
9443 if (ret == NULL || *ret == '\0') {
9444 ret = lp_const_servicename(snum);
9447 return ret;
9451 /***********************************************************
9452 Allow daemons such as winbindd to fix their logfile name.
9453 ************************************************************/
9455 void lp_set_logfile(const char *name)
9457 string_set(&Globals.logfile, name);
9458 debug_set_logfile(name);
9461 /*******************************************************************
9462 Return the max print jobs per queue.
9463 ********************************************************************/
9465 int lp_maxprintjobs(int snum)
9467 int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
9468 if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
9469 maxjobs = PRINT_MAX_JOBID - 1;
9471 return maxjobs;
9474 const char *lp_printcapname(void)
9476 if ((Globals.szPrintcapname != NULL) &&
9477 (Globals.szPrintcapname[0] != '\0'))
9478 return Globals.szPrintcapname;
9480 if (sDefault.iPrinting == PRINT_CUPS) {
9481 #ifdef HAVE_CUPS
9482 return "cups";
9483 #else
9484 return "lpstat";
9485 #endif
9488 if (sDefault.iPrinting == PRINT_BSD)
9489 return "/etc/printcap";
9491 return PRINTCAP_NAME;
9494 static uint32 spoolss_state;
9496 bool lp_disable_spoolss( void )
9498 if ( spoolss_state == SVCCTL_STATE_UNKNOWN )
9499 spoolss_state = lp__disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9501 return spoolss_state == SVCCTL_STOPPED ? true : false;
9504 void lp_set_spoolss_state( uint32 state )
9506 SMB_ASSERT( (state == SVCCTL_STOPPED) || (state == SVCCTL_RUNNING) );
9508 spoolss_state = state;
9511 uint32 lp_get_spoolss_state( void )
9513 return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9516 /*******************************************************************
9517 Ensure we don't use sendfile if server smb signing is active.
9518 ********************************************************************/
9520 bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state)
9522 bool sign_active = false;
9524 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
9525 if (get_Protocol() < PROTOCOL_NT1) {
9526 return false;
9528 if (signing_state) {
9529 sign_active = smb_signing_is_active(signing_state);
9531 return (lp__use_sendfile(snum) &&
9532 (get_remote_arch() != RA_WIN95) &&
9533 !sign_active);
9536 /*******************************************************************
9537 Turn off sendfile if we find the underlying OS doesn't support it.
9538 ********************************************************************/
9540 void set_use_sendfile(int snum, bool val)
9542 if (LP_SNUM_OK(snum))
9543 ServicePtrs[snum]->bUseSendfile = val;
9544 else
9545 sDefault.bUseSendfile = val;
9548 /*******************************************************************
9549 Turn off storing DOS attributes if this share doesn't support it.
9550 ********************************************************************/
9552 void set_store_dos_attributes(int snum, bool val)
9554 if (!LP_SNUM_OK(snum))
9555 return;
9556 ServicePtrs[(snum)]->bStoreDosAttributes = val;
9559 void lp_set_mangling_method(const char *new_method)
9561 string_set(&Globals.szManglingMethod, new_method);
9564 /*******************************************************************
9565 Global state for POSIX pathname processing.
9566 ********************************************************************/
9568 static bool posix_pathnames;
9570 bool lp_posix_pathnames(void)
9572 return posix_pathnames;
9575 /*******************************************************************
9576 Change everything needed to ensure POSIX pathname processing (currently
9577 not much).
9578 ********************************************************************/
9580 void lp_set_posix_pathnames(void)
9582 posix_pathnames = true;
9585 /*******************************************************************
9586 Global state for POSIX lock processing - CIFS unix extensions.
9587 ********************************************************************/
9589 bool posix_default_lock_was_set;
9590 static enum brl_flavour posix_cifsx_locktype; /* By default 0 == WINDOWS_LOCK */
9592 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp)
9594 if (posix_default_lock_was_set) {
9595 return posix_cifsx_locktype;
9596 } else {
9597 return fsp->posix_open ? POSIX_LOCK : WINDOWS_LOCK;
9601 /*******************************************************************
9602 ********************************************************************/
9604 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val)
9606 posix_default_lock_was_set = true;
9607 posix_cifsx_locktype = val;
9610 int lp_min_receive_file_size(void)
9612 if (Globals.iminreceivefile < 0) {
9613 return 0;
9615 return MIN(Globals.iminreceivefile, BUFFER_SIZE);
9618 /*******************************************************************
9619 If socket address is an empty character string, it is necessary to
9620 define it as "0.0.0.0".
9621 ********************************************************************/
9623 const char *lp_socket_address(void)
9625 char *sock_addr = Globals.szSocketAddress;
9627 if (sock_addr[0] == '\0'){
9628 string_set(&Globals.szSocketAddress, "0.0.0.0");
9630 return Globals.szSocketAddress;
9633 /*******************************************************************
9634 Safe wide links checks.
9635 This helper function always verify the validity of wide links,
9636 even after a configuration file reload.
9637 ********************************************************************/
9639 static bool lp_widelinks_internal(int snum)
9641 return (bool)(LP_SNUM_OK(snum)? ServicePtrs[(snum)]->bWidelinks :
9642 sDefault.bWidelinks);
9645 void widelinks_warning(int snum)
9647 if (lp_allow_insecure_widelinks()) {
9648 return;
9651 if (lp_unix_extensions() && lp_widelinks_internal(snum)) {
9652 DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
9653 "These parameters are incompatible. "
9654 "Wide links will be disabled for this share.\n",
9655 lp_servicename(talloc_tos(), snum) ));
9659 bool lp_widelinks(int snum)
9661 /* wide links is always incompatible with unix extensions */
9662 if (lp_unix_extensions()) {
9664 * Unless we have "allow insecure widelinks"
9665 * turned on.
9667 if (!lp_allow_insecure_widelinks()) {
9668 return false;
9672 return lp_widelinks_internal(snum);
9675 bool lp_writeraw(void)
9677 if (lp_async_smb_echo_handler()) {
9678 return false;
9680 return lp__writeraw();
9683 bool lp_readraw(void)
9685 if (lp_async_smb_echo_handler()) {
9686 return false;
9688 return lp__readraw();
9691 int lp_server_role(void)
9693 return lp_find_server_role(lp__server_role(),
9694 lp_security(),
9695 lp_domain_logons(),
9696 lp_domain_master_true_or_auto());