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
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 3 of the License, or
17 (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>.
31 * This module provides suitable callback functions for the params
32 * module. It builds the internal table of service details which is
33 * then used by the rest of the server.
37 * 1) add it to the global or service structure definition
38 * 2) add it to the parm_table
39 * 3) add it to the list of available functions (eg: using FN_GLOBAL_STRING())
40 * 4) If it's a global then initialise it in init_globals. If a local
41 * (ie. service) parameter then initialise it in the sDefault structure
45 * The configuration file is processed sequentially for speed. It is NOT
46 * accessed randomly as happens in 'real' Windows. For this reason, there
47 * is a fair bit of sequence-dependent code here - ie., code which assumes
48 * that certain things happen before others. In particular, the code which
49 * happens at the boundary between sections is delicately poised, so be
56 #include "lib/smbconf/smbconf.h"
57 #include "lib/smbconf/smbconf_init.h"
58 #include "lib/smbconf/smbconf_reg.h"
61 #include "../librpc/gen_ndr/svcctl.h"
63 #include "smb_signing.h"
67 #ifdef HAVE_SYS_SYSCTL_H
68 #include <sys/sysctl.h>
71 #ifdef HAVE_HTTPCONNECTENCRYPT
72 #include <cups/http.h>
77 extern userdom_struct current_user_info;
80 #define GLOBAL_NAME "global"
84 #define PRINTERS_NAME "printers"
88 #define HOMES_NAME "homes"
91 /* the special value for the include parameter
92 * to be interpreted not as a file name but to
93 * trigger loading of the global smb.conf options
95 #ifndef INCLUDE_REGISTRY_NAME
96 #define INCLUDE_REGISTRY_NAME "registry"
99 static bool in_client = False; /* Not in the client by default */
100 static struct smbconf_csn conf_last_csn;
102 #define CONFIG_BACKEND_FILE 0
103 #define CONFIG_BACKEND_REGISTRY 1
105 static int config_backend = CONFIG_BACKEND_FILE;
107 /* some helpful bits */
108 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
109 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
111 #define USERSHARE_VALID 1
112 #define USERSHARE_PENDING_DELETE 2
114 static bool defaults_saved = False;
116 struct param_opt_struct {
117 struct param_opt_struct *prev, *next;
125 * This structure describes global (ie., server-wide) parameters.
132 char *display_charset;
133 char *szPrintcapname;
134 char *szAddPortCommand;
135 char *szEnumPortsCommand;
136 char *szAddPrinterCommand;
137 char *szDeletePrinterCommand;
138 char *szOs2DriverMap;
144 char *szDefaultService;
148 char *szServerString;
149 char *szAutoServices;
150 char *szPasswdProgram;
154 char *szSMBPasswdFile;
156 char *szPassdbBackend;
157 char **szPreloadModules;
158 char *szPasswordServer;
159 char *szSocketOptions;
161 char *szAfsUsernameMap;
162 int iAfsTokenLifetime;
163 char *szLogNtTokenCommand;
169 char **szWINSservers;
171 char *szRemoteAnnounce;
172 char *szRemoteBrowseSync;
173 char *szSocketAddress;
174 bool bNmbdBindExplicitBroadcast;
175 char *szNISHomeMapName;
176 char *szAnnounceVersion; /* This is initialised in init_globals */
179 char **szNetbiosAliases;
180 char *szNetbiosScope;
181 char *szNameResolveOrder;
183 char *szAddUserScript;
184 char *szRenameUserScript;
185 char *szDelUserScript;
186 char *szAddGroupScript;
187 char *szDelGroupScript;
188 char *szAddUserToGroupScript;
189 char *szDelUserFromGroupScript;
190 char *szSetPrimaryGroupScript;
191 char *szAddMachineScript;
192 char *szShutdownScript;
193 char *szAbortShutdownScript;
194 char *szUsernameMapScript;
195 int iUsernameMapCacheTime;
196 char *szCheckPasswordScript;
203 bool bPassdbExpandExplicit;
204 int AlgorithmicRidBase;
205 char *szTemplateHomedir;
206 char *szTemplateShell;
207 char *szWinbindSeparator;
208 bool bWinbindEnumUsers;
209 bool bWinbindEnumGroups;
210 bool bWinbindUseDefaultDomain;
211 bool bWinbindTrustedDomainsOnly;
212 bool bWinbindNestedGroups;
213 int winbind_expand_groups;
214 bool bWinbindRefreshTickets;
215 bool bWinbindOfflineLogon;
216 bool bWinbindNormalizeNames;
217 bool bWinbindRpcOnly;
218 bool bCreateKrb5Conf;
219 char *szIdmapBackend;
221 char *szAddShareCommand;
222 char *szChangeShareCommand;
223 char *szDeleteShareCommand;
225 char *szGuestaccount;
226 char *szManglingMethod;
227 char **szServicesList;
228 char *szUsersharePath;
229 char *szUsershareTemplateShare;
230 char **szUsersharePrefixAllowList;
231 char **szUsersharePrefixDenyList;
238 int open_files_db_hash_size;
247 bool paranoid_server_security;
250 int iMaxSmbdProcesses;
251 bool bDisableSpoolss;
254 bool enhanced_browsing;
260 int announce_as; /* This is initialised in init_globals */
261 int machine_password_timeout;
263 int oplock_break_wait_time;
264 int winbind_cache_time;
265 int winbind_reconnect_delay;
266 int winbind_max_clients;
267 char **szWinbindNssInfo;
269 char *szLdapMachineSuffix;
270 char *szLdapUserSuffix;
271 char *szLdapIdmapSuffix;
272 char *szLdapGroupSuffix;
276 int ldap_follow_referral;
279 int ldap_debug_level;
280 int ldap_debug_threshold;
284 char *szIPrintServer;
286 char **szClusterAddresses;
289 int ctdb_locktime_warn_threshold;
290 int ldap_passwd_sync;
291 int ldap_replication_sleep;
292 int ldap_timeout; /* This is initialised in init_globals */
293 int ldap_connection_timeout;
296 bool bMsAddPrinterWizard;
301 int iPreferredMaster;
304 char **szInitLogonDelayedHosts;
306 bool bEncryptPasswords;
311 bool bObeyPamRestrictions;
313 int PrintcapCacheTime;
314 bool bLargeReadwrite;
321 bool bBindInterfacesOnly;
322 bool bPamPasswordChange;
323 bool bUnixPasswdSync;
324 bool bPasswdChatDebug;
325 int iPasswdChatTimeout;
329 bool bNTStatusSupport;
331 int iMaxStatCacheSize;
333 bool bAllowTrustedDomains;
337 bool bClientLanManAuth;
338 bool bClientNTLMv2Auth;
339 bool bClientPlaintextAuth;
340 bool bClientUseSpnego;
341 bool bDebugPrefixTimestamp;
342 bool bDebugHiresTimestamp;
346 bool bEnableCoreFiles;
349 bool bHostnameLookups;
350 bool bUnixExtensions;
351 bool bDisableNetbios;
352 char * szDedicatedKeytabFile;
354 bool bDeferSharingViolations;
355 bool bEnablePrivileges;
357 bool bUsershareOwnerOnly;
358 bool bUsershareAllowGuests;
359 bool bRegistryShares;
360 int restrict_anonymous;
361 int name_cache_timeout;
364 int client_ldap_sasl_wrapping;
365 int iUsershareMaxShares;
367 int iIdmapNegativeCacheTime;
369 bool bLogWriteableFilesOnExit;
372 struct param_opt_struct *param_opt;
373 int cups_connection_timeout;
374 char *szSMBPerfcountModule;
375 bool bMapUntrustedToDomain;
376 bool bAsyncSMBEchoHandler;
377 bool bMulticastDnsRegister;
384 static struct global Globals;
387 * This structure describes a single service.
393 struct timespec usershare_last_mod;
397 char **szInvalidUsers;
405 char *szRootPostExec;
407 char *szPrintcommand;
410 char *szLppausecommand;
411 char *szLpresumecommand;
412 char *szQueuepausecommand;
413 char *szQueueresumecommand;
415 char *szPrintjobUsername;
423 char *szVetoOplockFiles;
429 char **printer_admin;
434 char *szAioWriteBehind;
438 int iMaxReportedPrintJobs;
441 int iCreate_force_mode;
443 int iSecurity_force_mode;
446 int iDir_Security_mask;
447 int iDir_Security_force_mode;
451 int iOplockContentionLimit;
456 bool bRootpreexecClose;
459 bool bShortCasePreserve;
461 bool bHideSpecialFiles;
462 bool bHideUnReadable;
463 bool bHideUnWriteableFiles;
465 bool bAccessBasedShareEnum;
470 bool bAdministrative_share;
476 bool bStoreDosAttributes;
489 bool bStrictAllocate;
492 struct bitmap *copymap;
493 bool bDeleteReadonly;
495 bool bDeleteVetoFiles;
498 bool bDosFiletimeResolution;
499 bool bFakeDirCreateTimes;
505 bool bUseClientDriver;
506 bool bDefaultDevmode;
507 bool bForcePrintername;
509 bool bForceUnknownAclUser;
512 bool bMap_acl_inherit;
515 bool bAclCheckPermissions;
516 bool bAclMapFullControl;
517 bool bAclGroupControl;
519 bool bKernelChangeNotify;
520 int iallocation_roundup_size;
524 int iDirectoryNameCacheSize;
526 struct param_opt_struct *param_opt;
528 char dummy[3]; /* for alignment */
532 /* This is a default service used to prime a services structure */
533 static struct service sDefault = {
535 False, /* not autoloaded */
536 0, /* not a usershare */
537 {0, }, /* No last mod time */
538 NULL, /* szService */
540 NULL, /* szUsername */
541 NULL, /* szInvalidUsers */
542 NULL, /* szValidUsers */
543 NULL, /* szAdminUsers */
545 NULL, /* szInclude */
546 NULL, /* szPreExec */
547 NULL, /* szPostExec */
548 NULL, /* szRootPreExec */
549 NULL, /* szRootPostExec */
550 NULL, /* szCupsOptions */
551 NULL, /* szPrintcommand */
552 NULL, /* szLpqcommand */
553 NULL, /* szLprmcommand */
554 NULL, /* szLppausecommand */
555 NULL, /* szLpresumecommand */
556 NULL, /* szQueuepausecommand */
557 NULL, /* szQueueresumecommand */
558 NULL, /* szPrintername */
559 NULL, /* szPrintjobUsername */
560 NULL, /* szDontdescend */
561 NULL, /* szHostsallow */
562 NULL, /* szHostsdeny */
563 NULL, /* szMagicScript */
564 NULL, /* szMagicOutput */
565 NULL, /* szVetoFiles */
566 NULL, /* szHideFiles */
567 NULL, /* szVetoOplockFiles */
569 NULL, /* force user */
570 NULL, /* force group */
572 NULL, /* writelist */
573 NULL, /* printer admin */
576 NULL, /* vfs objects */
577 NULL, /* szMSDfsProxy */
578 NULL, /* szAioWriteBehind */
580 0, /* iMinPrintSpace */
581 1000, /* iMaxPrintJobs */
582 0, /* iMaxReportedPrintJobs */
583 0, /* iWriteCacheSize */
584 0744, /* iCreate_mask */
585 0000, /* iCreate_force_mode */
586 0777, /* iSecurity_mask */
587 0, /* iSecurity_force_mode */
588 0755, /* iDir_mask */
589 0000, /* iDir_force_mode */
590 0777, /* iDir_Security_mask */
591 0, /* iDir_Security_force_mode */
592 0, /* iMaxConnections */
593 CASE_LOWER, /* iDefaultCase */
594 DEFAULT_PRINTING, /* iPrinting */
595 2, /* iOplockContentionLimit */
597 1024, /* iBlock_size */
598 0, /* iDfreeCacheTime */
599 False, /* bPreexecClose */
600 False, /* bRootpreexecClose */
601 Auto, /* case sensitive */
602 True, /* case preserve */
603 True, /* short case preserve */
604 True, /* bHideDotFiles */
605 False, /* bHideSpecialFiles */
606 False, /* bHideUnReadable */
607 False, /* bHideUnWriteableFiles */
608 True, /* bBrowseable */
609 False, /* bAccessBasedShareEnum */
610 True, /* bAvailable */
611 True, /* bRead_only */
612 True, /* bNo_set_dir */
613 False, /* bGuest_only */
614 False, /* bAdministrative_share */
615 False, /* bGuest_ok */
616 False, /* bPrint_ok */
617 False, /* bMap_system */
618 False, /* bMap_hidden */
619 True, /* bMap_archive */
620 False, /* bStoreDosAttributes */
621 False, /* bDmapiSupport */
623 Auto, /* iStrictLocking */
624 True, /* bPosixLocking */
625 True, /* bShareModes */
627 True, /* bLevel2OpLocks */
628 False, /* bOnlyUser */
629 True, /* bMangledNames */
630 false, /* bWidelinks */
631 True, /* bSymlinks */
632 False, /* bSyncAlways */
633 False, /* bStrictAllocate */
634 False, /* bStrictSync */
635 '~', /* magic char */
637 False, /* bDeleteReadonly */
638 False, /* bFakeOplocks */
639 False, /* bDeleteVetoFiles */
640 False, /* bDosFilemode */
641 True, /* bDosFiletimes */
642 False, /* bDosFiletimeResolution */
643 False, /* bFakeDirCreateTimes */
644 True, /* bBlockingLocks */
645 False, /* bInheritPerms */
646 False, /* bInheritACLS */
647 False, /* bInheritOwner */
648 False, /* bMSDfsRoot */
649 False, /* bUseClientDriver */
650 True, /* bDefaultDevmode */
651 False, /* bForcePrintername */
652 True, /* bNTAclSupport */
653 False, /* bForceUnknownAclUser */
654 False, /* bUseSendfile */
655 False, /* bProfileAcls */
656 False, /* bMap_acl_inherit */
657 False, /* bAfs_Share */
658 False, /* bEASupport */
659 True, /* bAclCheckPermissions */
660 True, /* bAclMapFullControl */
661 False, /* bAclGroupControl */
662 True, /* bChangeNotify */
663 True, /* bKernelChangeNotify */
664 SMB_ROUNDUP_ALLOCATION_SIZE, /* iallocation_roundup_size */
665 0, /* iAioReadSize */
666 0, /* iAioWriteSize */
667 MAP_READONLY_YES, /* iMap_readonly */
668 #ifdef BROKEN_DIRECTORY_HANDLING
669 0, /* iDirectoryNameCacheSize */
671 100, /* iDirectoryNameCacheSize */
673 Auto, /* ismb_encrypt */
674 NULL, /* Parametric options */
679 /* local variables */
680 static struct service **ServicePtrs = NULL;
681 static int iNumServices = 0;
682 static int iServiceIndex = 0;
683 static struct db_context *ServiceHash;
684 static int *invalid_services = NULL;
685 static int num_invalid_services = 0;
686 static bool bInGlobalSection = True;
687 static bool bGlobalOnly = False;
688 static int default_server_announce;
690 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
692 /* prototypes for the special type handlers */
693 static bool handle_include( int snum, const char *pszParmValue, char **ptr);
694 static bool handle_copy( int snum, const char *pszParmValue, char **ptr);
695 static bool handle_netbios_name( int snum, const char *pszParmValue, char **ptr);
696 static bool handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);
697 static bool handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);
698 static bool handle_debug_list( int snum, const char *pszParmValue, char **ptr );
699 static bool handle_workgroup( int snum, const char *pszParmValue, char **ptr );
700 static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
701 static bool handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );
702 static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
703 static bool handle_printing( int snum, const char *pszParmValue, char **ptr);
704 static bool handle_ldap_debug_level( int snum, const char *pszParmValue, char **ptr);
706 static void set_default_server_announce_type(void);
707 static void set_allowed_client_auth(void);
709 static void *lp_local_ptr(struct service *service, void *ptr);
711 static void add_to_file_list(const char *fname, const char *subfname);
712 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values);
714 static const struct enum_list enum_protocol[] = {
715 {PROTOCOL_SMB2, "SMB2"},
716 {PROTOCOL_NT1, "NT1"},
717 {PROTOCOL_LANMAN2, "LANMAN2"},
718 {PROTOCOL_LANMAN1, "LANMAN1"},
719 {PROTOCOL_CORE, "CORE"},
720 {PROTOCOL_COREPLUS, "COREPLUS"},
721 {PROTOCOL_COREPLUS, "CORE+"},
725 static const struct enum_list enum_security[] = {
726 {SEC_SHARE, "SHARE"},
728 {SEC_SERVER, "SERVER"},
729 {SEC_DOMAIN, "DOMAIN"},
736 static const struct enum_list enum_printing[] = {
737 {PRINT_SYSV, "sysv"},
739 {PRINT_HPUX, "hpux"},
743 {PRINT_LPRNG, "lprng"},
744 {PRINT_CUPS, "cups"},
745 {PRINT_IPRINT, "iprint"},
747 {PRINT_LPROS2, "os2"},
749 {PRINT_TEST, "test"},
751 #endif /* DEVELOPER */
755 static const struct enum_list enum_ldap_sasl_wrapping[] = {
757 {ADS_AUTH_SASL_SIGN, "sign"},
758 {ADS_AUTH_SASL_SEAL, "seal"},
762 static const struct enum_list enum_ldap_ssl[] = {
763 {LDAP_SSL_OFF, "no"},
764 {LDAP_SSL_OFF, "off"},
765 {LDAP_SSL_START_TLS, "start tls"},
766 {LDAP_SSL_START_TLS, "start_tls"},
770 /* LDAP Dereferencing Alias types */
771 #define SAMBA_LDAP_DEREF_NEVER 0
772 #define SAMBA_LDAP_DEREF_SEARCHING 1
773 #define SAMBA_LDAP_DEREF_FINDING 2
774 #define SAMBA_LDAP_DEREF_ALWAYS 3
776 static const struct enum_list enum_ldap_deref[] = {
777 {SAMBA_LDAP_DEREF_NEVER, "never"},
778 {SAMBA_LDAP_DEREF_SEARCHING, "searching"},
779 {SAMBA_LDAP_DEREF_FINDING, "finding"},
780 {SAMBA_LDAP_DEREF_ALWAYS, "always"},
784 static const struct enum_list enum_ldap_passwd_sync[] = {
785 {LDAP_PASSWD_SYNC_OFF, "no"},
786 {LDAP_PASSWD_SYNC_OFF, "off"},
787 {LDAP_PASSWD_SYNC_ON, "yes"},
788 {LDAP_PASSWD_SYNC_ON, "on"},
789 {LDAP_PASSWD_SYNC_ONLY, "only"},
793 /* Types of machine we can announce as. */
794 #define ANNOUNCE_AS_NT_SERVER 1
795 #define ANNOUNCE_AS_WIN95 2
796 #define ANNOUNCE_AS_WFW 3
797 #define ANNOUNCE_AS_NT_WORKSTATION 4
799 static const struct enum_list enum_announce_as[] = {
800 {ANNOUNCE_AS_NT_SERVER, "NT"},
801 {ANNOUNCE_AS_NT_SERVER, "NT Server"},
802 {ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},
803 {ANNOUNCE_AS_WIN95, "win95"},
804 {ANNOUNCE_AS_WFW, "WfW"},
808 static const struct enum_list enum_map_readonly[] = {
809 {MAP_READONLY_NO, "no"},
810 {MAP_READONLY_NO, "false"},
811 {MAP_READONLY_NO, "0"},
812 {MAP_READONLY_YES, "yes"},
813 {MAP_READONLY_YES, "true"},
814 {MAP_READONLY_YES, "1"},
815 {MAP_READONLY_PERMISSIONS, "permissions"},
816 {MAP_READONLY_PERMISSIONS, "perms"},
820 static const struct enum_list enum_case[] = {
821 {CASE_LOWER, "lower"},
822 {CASE_UPPER, "upper"},
828 static const struct enum_list enum_bool_auto[] = {
839 static const struct enum_list enum_csc_policy[] = {
840 {CSC_POLICY_MANUAL, "manual"},
841 {CSC_POLICY_DOCUMENTS, "documents"},
842 {CSC_POLICY_PROGRAMS, "programs"},
843 {CSC_POLICY_DISABLE, "disable"},
847 /* SMB signing types. */
848 static const struct enum_list enum_smb_signing_vals[] = {
860 {Required, "required"},
861 {Required, "mandatory"},
863 {Required, "forced"},
864 {Required, "enforced"},
868 /* ACL compatibility options. */
869 static const struct enum_list enum_acl_compat_vals[] = {
870 { ACL_COMPAT_AUTO, "auto" },
871 { ACL_COMPAT_WINNT, "winnt" },
872 { ACL_COMPAT_WIN2K, "win2k" },
877 Do you want session setups at user level security with a invalid
878 password to be rejected or allowed in as guest? WinNT rejects them
879 but it can be a pain as it means "net view" needs to use a password
881 You have 3 choices in the setting of map_to_guest:
883 "Never" means session setups with an invalid password
884 are rejected. This is the default.
886 "Bad User" means session setups with an invalid password
887 are rejected, unless the username does not exist, in which case it
888 is treated as a guest login
890 "Bad Password" means session setups with an invalid password
891 are treated as a guest login
893 Note that map_to_guest only has an effect in user or server
897 static const struct enum_list enum_map_to_guest[] = {
898 {NEVER_MAP_TO_GUEST, "Never"},
899 {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
900 {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
901 {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},
905 /* Config backend options */
907 static const struct enum_list enum_config_backend[] = {
908 {CONFIG_BACKEND_FILE, "file"},
909 {CONFIG_BACKEND_REGISTRY, "registry"},
913 /* ADS kerberos ticket verification options */
915 static const struct enum_list enum_kerberos_method[] = {
916 {KERBEROS_VERIFY_SECRETS, "default"},
917 {KERBEROS_VERIFY_SECRETS, "secrets only"},
918 {KERBEROS_VERIFY_SYSTEM_KEYTAB, "system keytab"},
919 {KERBEROS_VERIFY_DEDICATED_KEYTAB, "dedicated keytab"},
920 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB, "secrets and keytab"},
924 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
926 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
927 * screen in SWAT. This is used to exclude parameters as well as to squash all
928 * parameters that have been duplicated by pseudonyms.
930 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
931 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
932 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
935 * NOTE2: Handling of duplicated (synonym) parameters:
936 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
937 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
938 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
939 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
942 static struct parm_struct parm_table[] = {
943 {N_("Base Options"), P_SEP, P_SEPARATOR},
946 .label = "dos charset",
949 .ptr = &Globals.dos_charset,
950 .special = handle_charset,
952 .flags = FLAG_ADVANCED
955 .label = "unix charset",
958 .ptr = &Globals.unix_charset,
959 .special = handle_charset,
961 .flags = FLAG_ADVANCED
964 .label = "display charset",
967 .ptr = &Globals.display_charset,
968 .special = handle_charset,
970 .flags = FLAG_ADVANCED
976 .ptr = &sDefault.comment,
979 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT
985 .ptr = &sDefault.szPath,
988 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
991 .label = "directory",
994 .ptr = &sDefault.szPath,
1000 .label = "workgroup",
1002 .p_class = P_GLOBAL,
1003 .ptr = &Globals.szWorkgroup,
1004 .special = handle_workgroup,
1006 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1012 .p_class = P_GLOBAL,
1013 .ptr = &Globals.szRealm,
1016 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1020 .label = "netbios name",
1022 .p_class = P_GLOBAL,
1023 .ptr = &Globals.szNetbiosName,
1024 .special = handle_netbios_name,
1026 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1029 .label = "netbios aliases",
1031 .p_class = P_GLOBAL,
1032 .ptr = &Globals.szNetbiosAliases,
1033 .special = handle_netbios_aliases,
1035 .flags = FLAG_ADVANCED,
1038 .label = "netbios scope",
1040 .p_class = P_GLOBAL,
1041 .ptr = &Globals.szNetbiosScope,
1042 .special = handle_netbios_scope,
1044 .flags = FLAG_ADVANCED,
1047 .label = "server string",
1049 .p_class = P_GLOBAL,
1050 .ptr = &Globals.szServerString,
1053 .flags = FLAG_BASIC | FLAG_ADVANCED,
1056 .label = "interfaces",
1058 .p_class = P_GLOBAL,
1059 .ptr = &Globals.szInterfaces,
1062 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1065 .label = "bind interfaces only",
1067 .p_class = P_GLOBAL,
1068 .ptr = &Globals.bBindInterfacesOnly,
1071 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1074 .label = "config backend",
1076 .p_class = P_GLOBAL,
1077 .ptr = &Globals.ConfigBackend,
1079 .enum_list = enum_config_backend,
1080 .flags = FLAG_HIDE|FLAG_ADVANCED|FLAG_META,
1083 {N_("Security Options"), P_SEP, P_SEPARATOR},
1086 .label = "security",
1088 .p_class = P_GLOBAL,
1089 .ptr = &Globals.security,
1091 .enum_list = enum_security,
1092 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1095 .label = "auth methods",
1097 .p_class = P_GLOBAL,
1098 .ptr = &Globals.AuthMethods,
1101 .flags = FLAG_ADVANCED,
1104 .label = "encrypt passwords",
1106 .p_class = P_GLOBAL,
1107 .ptr = &Globals.bEncryptPasswords,
1110 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1113 .label = "client schannel",
1115 .p_class = P_GLOBAL,
1116 .ptr = &Globals.clientSchannel,
1118 .enum_list = enum_bool_auto,
1119 .flags = FLAG_BASIC | FLAG_ADVANCED,
1122 .label = "server schannel",
1124 .p_class = P_GLOBAL,
1125 .ptr = &Globals.serverSchannel,
1127 .enum_list = enum_bool_auto,
1128 .flags = FLAG_BASIC | FLAG_ADVANCED,
1131 .label = "allow trusted domains",
1133 .p_class = P_GLOBAL,
1134 .ptr = &Globals.bAllowTrustedDomains,
1137 .flags = FLAG_ADVANCED,
1140 .label = "map to guest",
1142 .p_class = P_GLOBAL,
1143 .ptr = &Globals.map_to_guest,
1145 .enum_list = enum_map_to_guest,
1146 .flags = FLAG_ADVANCED,
1149 .label = "null passwords",
1151 .p_class = P_GLOBAL,
1152 .ptr = &Globals.bNullPasswords,
1155 .flags = FLAG_ADVANCED,
1158 .label = "obey pam restrictions",
1160 .p_class = P_GLOBAL,
1161 .ptr = &Globals.bObeyPamRestrictions,
1164 .flags = FLAG_ADVANCED,
1167 .label = "password server",
1169 .p_class = P_GLOBAL,
1170 .ptr = &Globals.szPasswordServer,
1173 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1176 .label = "smb passwd file",
1178 .p_class = P_GLOBAL,
1179 .ptr = &Globals.szSMBPasswdFile,
1182 .flags = FLAG_ADVANCED,
1185 .label = "private dir",
1187 .p_class = P_GLOBAL,
1188 .ptr = &Globals.szPrivateDir,
1191 .flags = FLAG_ADVANCED,
1194 .label = "passdb backend",
1196 .p_class = P_GLOBAL,
1197 .ptr = &Globals.szPassdbBackend,
1200 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1203 .label = "algorithmic rid base",
1205 .p_class = P_GLOBAL,
1206 .ptr = &Globals.AlgorithmicRidBase,
1209 .flags = FLAG_ADVANCED,
1212 .label = "root directory",
1214 .p_class = P_GLOBAL,
1215 .ptr = &Globals.szRootdir,
1218 .flags = FLAG_ADVANCED,
1221 .label = "root dir",
1223 .p_class = P_GLOBAL,
1224 .ptr = &Globals.szRootdir,
1232 .p_class = P_GLOBAL,
1233 .ptr = &Globals.szRootdir,
1239 .label = "guest account",
1241 .p_class = P_GLOBAL,
1242 .ptr = &Globals.szGuestaccount,
1245 .flags = FLAG_BASIC | FLAG_ADVANCED,
1248 .label = "enable privileges",
1250 .p_class = P_GLOBAL,
1251 .ptr = &Globals.bEnablePrivileges,
1254 .flags = FLAG_ADVANCED,
1258 .label = "pam password change",
1260 .p_class = P_GLOBAL,
1261 .ptr = &Globals.bPamPasswordChange,
1264 .flags = FLAG_ADVANCED,
1267 .label = "passwd program",
1269 .p_class = P_GLOBAL,
1270 .ptr = &Globals.szPasswdProgram,
1273 .flags = FLAG_ADVANCED,
1276 .label = "passwd chat",
1278 .p_class = P_GLOBAL,
1279 .ptr = &Globals.szPasswdChat,
1282 .flags = FLAG_ADVANCED,
1285 .label = "passwd chat debug",
1287 .p_class = P_GLOBAL,
1288 .ptr = &Globals.bPasswdChatDebug,
1291 .flags = FLAG_ADVANCED,
1294 .label = "passwd chat timeout",
1296 .p_class = P_GLOBAL,
1297 .ptr = &Globals.iPasswdChatTimeout,
1300 .flags = FLAG_ADVANCED,
1303 .label = "check password script",
1305 .p_class = P_GLOBAL,
1306 .ptr = &Globals.szCheckPasswordScript,
1309 .flags = FLAG_ADVANCED,
1312 .label = "username map",
1314 .p_class = P_GLOBAL,
1315 .ptr = &Globals.szUsernameMap,
1318 .flags = FLAG_ADVANCED,
1321 .label = "password level",
1323 .p_class = P_GLOBAL,
1324 .ptr = &Globals.pwordlevel,
1327 .flags = FLAG_ADVANCED,
1330 .label = "username level",
1332 .p_class = P_GLOBAL,
1333 .ptr = &Globals.unamelevel,
1336 .flags = FLAG_ADVANCED,
1339 .label = "unix password sync",
1341 .p_class = P_GLOBAL,
1342 .ptr = &Globals.bUnixPasswdSync,
1345 .flags = FLAG_ADVANCED,
1348 .label = "restrict anonymous",
1350 .p_class = P_GLOBAL,
1351 .ptr = &Globals.restrict_anonymous,
1354 .flags = FLAG_ADVANCED,
1357 .label = "lanman auth",
1359 .p_class = P_GLOBAL,
1360 .ptr = &Globals.bLanmanAuth,
1363 .flags = FLAG_ADVANCED,
1366 .label = "ntlm auth",
1368 .p_class = P_GLOBAL,
1369 .ptr = &Globals.bNTLMAuth,
1372 .flags = FLAG_ADVANCED,
1375 .label = "client NTLMv2 auth",
1377 .p_class = P_GLOBAL,
1378 .ptr = &Globals.bClientNTLMv2Auth,
1381 .flags = FLAG_ADVANCED,
1384 .label = "client lanman auth",
1386 .p_class = P_GLOBAL,
1387 .ptr = &Globals.bClientLanManAuth,
1390 .flags = FLAG_ADVANCED,
1393 .label = "client plaintext auth",
1395 .p_class = P_GLOBAL,
1396 .ptr = &Globals.bClientPlaintextAuth,
1399 .flags = FLAG_ADVANCED,
1402 .label = "username",
1405 .ptr = &sDefault.szUsername,
1408 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1414 .ptr = &sDefault.szUsername,
1423 .ptr = &sDefault.szUsername,
1429 .label = "invalid users",
1432 .ptr = &sDefault.szInvalidUsers,
1435 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1438 .label = "valid users",
1441 .ptr = &sDefault.szValidUsers,
1444 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1447 .label = "admin users",
1450 .ptr = &sDefault.szAdminUsers,
1453 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1456 .label = "read list",
1459 .ptr = &sDefault.readlist,
1462 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1465 .label = "write list",
1468 .ptr = &sDefault.writelist,
1471 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1474 .label = "printer admin",
1477 .ptr = &sDefault.printer_admin,
1480 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_PRINT | FLAG_DEPRECATED,
1483 .label = "force user",
1486 .ptr = &sDefault.force_user,
1489 .flags = FLAG_ADVANCED | FLAG_SHARE,
1492 .label = "force group",
1495 .ptr = &sDefault.force_group,
1498 .flags = FLAG_ADVANCED | FLAG_SHARE,
1504 .ptr = &sDefault.force_group,
1507 .flags = FLAG_ADVANCED,
1510 .label = "read only",
1513 .ptr = &sDefault.bRead_only,
1516 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE,
1519 .label = "write ok",
1522 .ptr = &sDefault.bRead_only,
1528 .label = "writeable",
1531 .ptr = &sDefault.bRead_only,
1537 .label = "writable",
1540 .ptr = &sDefault.bRead_only,
1546 .label = "acl check permissions",
1549 .ptr = &sDefault.bAclCheckPermissions,
1552 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1555 .label = "acl group control",
1558 .ptr = &sDefault.bAclGroupControl,
1561 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1564 .label = "acl map full control",
1567 .ptr = &sDefault.bAclMapFullControl,
1570 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1573 .label = "create mask",
1576 .ptr = &sDefault.iCreate_mask,
1579 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1582 .label = "create mode",
1585 .ptr = &sDefault.iCreate_mask,
1591 .label = "force create mode",
1594 .ptr = &sDefault.iCreate_force_mode,
1597 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1600 .label = "security mask",
1603 .ptr = &sDefault.iSecurity_mask,
1606 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1609 .label = "force security mode",
1612 .ptr = &sDefault.iSecurity_force_mode,
1615 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1618 .label = "directory mask",
1621 .ptr = &sDefault.iDir_mask,
1624 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1627 .label = "directory mode",
1630 .ptr = &sDefault.iDir_mask,
1633 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1636 .label = "force directory mode",
1639 .ptr = &sDefault.iDir_force_mode,
1642 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1645 .label = "directory security mask",
1648 .ptr = &sDefault.iDir_Security_mask,
1651 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1654 .label = "force directory security mode",
1657 .ptr = &sDefault.iDir_Security_force_mode,
1660 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1663 .label = "force unknown acl user",
1666 .ptr = &sDefault.bForceUnknownAclUser,
1669 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1672 .label = "inherit permissions",
1675 .ptr = &sDefault.bInheritPerms,
1678 .flags = FLAG_ADVANCED | FLAG_SHARE,
1681 .label = "inherit acls",
1684 .ptr = &sDefault.bInheritACLS,
1687 .flags = FLAG_ADVANCED | FLAG_SHARE,
1690 .label = "inherit owner",
1693 .ptr = &sDefault.bInheritOwner,
1696 .flags = FLAG_ADVANCED | FLAG_SHARE,
1699 .label = "guest only",
1702 .ptr = &sDefault.bGuest_only,
1705 .flags = FLAG_ADVANCED | FLAG_SHARE,
1708 .label = "only guest",
1711 .ptr = &sDefault.bGuest_only,
1717 .label = "administrative share",
1720 .ptr = &sDefault.bAdministrative_share,
1723 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1727 .label = "guest ok",
1730 .ptr = &sDefault.bGuest_ok,
1733 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1739 .ptr = &sDefault.bGuest_ok,
1745 .label = "only user",
1748 .ptr = &sDefault.bOnlyUser,
1751 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED,
1754 .label = "hosts allow",
1757 .ptr = &sDefault.szHostsallow,
1760 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1763 .label = "allow hosts",
1766 .ptr = &sDefault.szHostsallow,
1772 .label = "hosts deny",
1775 .ptr = &sDefault.szHostsdeny,
1778 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1781 .label = "deny hosts",
1784 .ptr = &sDefault.szHostsdeny,
1790 .label = "preload modules",
1792 .p_class = P_GLOBAL,
1793 .ptr = &Globals.szPreloadModules,
1796 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1799 .label = "dedicated keytab file",
1801 .p_class = P_GLOBAL,
1802 .ptr = &Globals.szDedicatedKeytabFile,
1805 .flags = FLAG_ADVANCED,
1808 .label = "kerberos method",
1810 .p_class = P_GLOBAL,
1811 .ptr = &Globals.iKerberosMethod,
1813 .enum_list = enum_kerberos_method,
1814 .flags = FLAG_ADVANCED,
1817 .label = "map untrusted to domain",
1819 .p_class = P_GLOBAL,
1820 .ptr = &Globals.bMapUntrustedToDomain,
1823 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1827 {N_("Logging Options"), P_SEP, P_SEPARATOR},
1830 .label = "log level",
1832 .p_class = P_GLOBAL,
1833 .ptr = &Globals.szLogLevel,
1834 .special = handle_debug_list,
1836 .flags = FLAG_ADVANCED,
1839 .label = "debuglevel",
1841 .p_class = P_GLOBAL,
1842 .ptr = &Globals.szLogLevel,
1843 .special = handle_debug_list,
1850 .p_class = P_GLOBAL,
1851 .ptr = &Globals.syslog,
1854 .flags = FLAG_ADVANCED,
1857 .label = "syslog only",
1859 .p_class = P_GLOBAL,
1860 .ptr = &Globals.bSyslogOnly,
1863 .flags = FLAG_ADVANCED,
1866 .label = "log file",
1868 .p_class = P_GLOBAL,
1869 .ptr = &Globals.szLogFile,
1872 .flags = FLAG_ADVANCED,
1875 .label = "max log size",
1877 .p_class = P_GLOBAL,
1878 .ptr = &Globals.max_log_size,
1881 .flags = FLAG_ADVANCED,
1884 .label = "debug timestamp",
1886 .p_class = P_GLOBAL,
1887 .ptr = &Globals.bTimestampLogs,
1890 .flags = FLAG_ADVANCED,
1893 .label = "timestamp logs",
1895 .p_class = P_GLOBAL,
1896 .ptr = &Globals.bTimestampLogs,
1899 .flags = FLAG_ADVANCED,
1902 .label = "debug prefix timestamp",
1904 .p_class = P_GLOBAL,
1905 .ptr = &Globals.bDebugPrefixTimestamp,
1908 .flags = FLAG_ADVANCED,
1911 .label = "debug hires timestamp",
1913 .p_class = P_GLOBAL,
1914 .ptr = &Globals.bDebugHiresTimestamp,
1917 .flags = FLAG_ADVANCED,
1920 .label = "debug pid",
1922 .p_class = P_GLOBAL,
1923 .ptr = &Globals.bDebugPid,
1926 .flags = FLAG_ADVANCED,
1929 .label = "debug uid",
1931 .p_class = P_GLOBAL,
1932 .ptr = &Globals.bDebugUid,
1935 .flags = FLAG_ADVANCED,
1938 .label = "debug class",
1940 .p_class = P_GLOBAL,
1941 .ptr = &Globals.bDebugClass,
1944 .flags = FLAG_ADVANCED,
1947 .label = "enable core files",
1949 .p_class = P_GLOBAL,
1950 .ptr = &Globals.bEnableCoreFiles,
1953 .flags = FLAG_ADVANCED,
1956 {N_("Protocol Options"), P_SEP, P_SEPARATOR},
1959 .label = "allocation roundup size",
1962 .ptr = &sDefault.iallocation_roundup_size,
1965 .flags = FLAG_ADVANCED,
1968 .label = "aio read size",
1971 .ptr = &sDefault.iAioReadSize,
1974 .flags = FLAG_ADVANCED,
1977 .label = "aio write size",
1980 .ptr = &sDefault.iAioWriteSize,
1983 .flags = FLAG_ADVANCED,
1986 .label = "aio write behind",
1989 .ptr = &sDefault.szAioWriteBehind,
1992 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1995 .label = "smb ports",
1997 .p_class = P_GLOBAL,
1998 .ptr = &Globals.smb_ports,
2001 .flags = FLAG_ADVANCED,
2004 .label = "large readwrite",
2006 .p_class = P_GLOBAL,
2007 .ptr = &Globals.bLargeReadwrite,
2010 .flags = FLAG_ADVANCED,
2013 .label = "max protocol",
2015 .p_class = P_GLOBAL,
2016 .ptr = &Globals.maxprotocol,
2018 .enum_list = enum_protocol,
2019 .flags = FLAG_ADVANCED,
2022 .label = "protocol",
2024 .p_class = P_GLOBAL,
2025 .ptr = &Globals.maxprotocol,
2027 .enum_list = enum_protocol,
2028 .flags = FLAG_ADVANCED,
2031 .label = "min protocol",
2033 .p_class = P_GLOBAL,
2034 .ptr = &Globals.minprotocol,
2036 .enum_list = enum_protocol,
2037 .flags = FLAG_ADVANCED,
2040 .label = "min receivefile size",
2042 .p_class = P_GLOBAL,
2043 .ptr = &Globals.iminreceivefile,
2046 .flags = FLAG_ADVANCED,
2049 .label = "read raw",
2051 .p_class = P_GLOBAL,
2052 .ptr = &Globals.bReadRaw,
2055 .flags = FLAG_ADVANCED,
2058 .label = "write raw",
2060 .p_class = P_GLOBAL,
2061 .ptr = &Globals.bWriteRaw,
2064 .flags = FLAG_ADVANCED,
2067 .label = "disable netbios",
2069 .p_class = P_GLOBAL,
2070 .ptr = &Globals.bDisableNetbios,
2073 .flags = FLAG_ADVANCED,
2076 .label = "reset on zero vc",
2078 .p_class = P_GLOBAL,
2079 .ptr = &Globals.bResetOnZeroVC,
2082 .flags = FLAG_ADVANCED,
2085 .label = "log writeable files on exit",
2087 .p_class = P_GLOBAL,
2088 .ptr = &Globals.bLogWriteableFilesOnExit,
2091 .flags = FLAG_ADVANCED,
2094 .label = "acl compatibility",
2096 .p_class = P_GLOBAL,
2097 .ptr = &Globals.iAclCompat,
2099 .enum_list = enum_acl_compat_vals,
2100 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2103 .label = "defer sharing violations",
2105 .p_class = P_GLOBAL,
2106 .ptr = &Globals.bDeferSharingViolations,
2109 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2112 .label = "ea support",
2115 .ptr = &sDefault.bEASupport,
2118 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2121 .label = "nt acl support",
2124 .ptr = &sDefault.bNTAclSupport,
2127 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2130 .label = "nt pipe support",
2132 .p_class = P_GLOBAL,
2133 .ptr = &Globals.bNTPipeSupport,
2136 .flags = FLAG_ADVANCED,
2139 .label = "nt status support",
2141 .p_class = P_GLOBAL,
2142 .ptr = &Globals.bNTStatusSupport,
2145 .flags = FLAG_ADVANCED,
2148 .label = "profile acls",
2151 .ptr = &sDefault.bProfileAcls,
2154 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
2157 .label = "announce version",
2159 .p_class = P_GLOBAL,
2160 .ptr = &Globals.szAnnounceVersion,
2163 .flags = FLAG_ADVANCED,
2166 .label = "announce as",
2168 .p_class = P_GLOBAL,
2169 .ptr = &Globals.announce_as,
2171 .enum_list = enum_announce_as,
2172 .flags = FLAG_ADVANCED,
2175 .label = "map acl inherit",
2178 .ptr = &sDefault.bMap_acl_inherit,
2181 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2184 .label = "afs share",
2187 .ptr = &sDefault.bAfs_Share,
2190 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2195 .p_class = P_GLOBAL,
2196 .ptr = &Globals.max_mux,
2199 .flags = FLAG_ADVANCED,
2202 .label = "max xmit",
2204 .p_class = P_GLOBAL,
2205 .ptr = &Globals.max_xmit,
2208 .flags = FLAG_ADVANCED,
2211 .label = "name resolve order",
2213 .p_class = P_GLOBAL,
2214 .ptr = &Globals.szNameResolveOrder,
2217 .flags = FLAG_ADVANCED | FLAG_WIZARD,
2222 .p_class = P_GLOBAL,
2223 .ptr = &Globals.max_ttl,
2226 .flags = FLAG_ADVANCED,
2229 .label = "max wins ttl",
2231 .p_class = P_GLOBAL,
2232 .ptr = &Globals.max_wins_ttl,
2235 .flags = FLAG_ADVANCED,
2238 .label = "min wins ttl",
2240 .p_class = P_GLOBAL,
2241 .ptr = &Globals.min_wins_ttl,
2244 .flags = FLAG_ADVANCED,
2247 .label = "time server",
2249 .p_class = P_GLOBAL,
2250 .ptr = &Globals.bTimeServer,
2253 .flags = FLAG_ADVANCED,
2256 .label = "unix extensions",
2258 .p_class = P_GLOBAL,
2259 .ptr = &Globals.bUnixExtensions,
2262 .flags = FLAG_ADVANCED,
2265 .label = "use spnego",
2267 .p_class = P_GLOBAL,
2268 .ptr = &Globals.bUseSpnego,
2271 .flags = FLAG_ADVANCED,
2274 .label = "client signing",
2276 .p_class = P_GLOBAL,
2277 .ptr = &Globals.client_signing,
2279 .enum_list = enum_smb_signing_vals,
2280 .flags = FLAG_ADVANCED,
2283 .label = "server signing",
2285 .p_class = P_GLOBAL,
2286 .ptr = &Globals.server_signing,
2288 .enum_list = enum_smb_signing_vals,
2289 .flags = FLAG_ADVANCED,
2292 .label = "smb encrypt",
2295 .ptr = &sDefault.ismb_encrypt,
2297 .enum_list = enum_smb_signing_vals,
2298 .flags = FLAG_ADVANCED,
2301 .label = "client use spnego",
2303 .p_class = P_GLOBAL,
2304 .ptr = &Globals.bClientUseSpnego,
2307 .flags = FLAG_ADVANCED,
2310 .label = "client ldap sasl wrapping",
2312 .p_class = P_GLOBAL,
2313 .ptr = &Globals.client_ldap_sasl_wrapping,
2315 .enum_list = enum_ldap_sasl_wrapping,
2316 .flags = FLAG_ADVANCED,
2319 .label = "enable asu support",
2321 .p_class = P_GLOBAL,
2322 .ptr = &Globals.bASUSupport,
2325 .flags = FLAG_ADVANCED,
2328 .label = "svcctl list",
2330 .p_class = P_GLOBAL,
2331 .ptr = &Globals.szServicesList,
2334 .flags = FLAG_ADVANCED,
2337 {N_("Tuning Options"), P_SEP, P_SEPARATOR},
2340 .label = "block size",
2343 .ptr = &sDefault.iBlock_size,
2346 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2349 .label = "deadtime",
2351 .p_class = P_GLOBAL,
2352 .ptr = &Globals.deadtime,
2355 .flags = FLAG_ADVANCED,
2358 .label = "getwd cache",
2360 .p_class = P_GLOBAL,
2361 .ptr = &Globals.getwd_cache,
2364 .flags = FLAG_ADVANCED,
2367 .label = "keepalive",
2369 .p_class = P_GLOBAL,
2370 .ptr = &Globals.iKeepalive,
2373 .flags = FLAG_ADVANCED,
2376 .label = "change notify",
2379 .ptr = &sDefault.bChangeNotify,
2382 .flags = FLAG_ADVANCED | FLAG_SHARE,
2385 .label = "directory name cache size",
2388 .ptr = &sDefault.iDirectoryNameCacheSize,
2391 .flags = FLAG_ADVANCED | FLAG_SHARE,
2394 .label = "kernel change notify",
2397 .ptr = &sDefault.bKernelChangeNotify,
2400 .flags = FLAG_ADVANCED | FLAG_SHARE,
2403 .label = "lpq cache time",
2405 .p_class = P_GLOBAL,
2406 .ptr = &Globals.lpqcachetime,
2409 .flags = FLAG_ADVANCED,
2412 .label = "max smbd processes",
2414 .p_class = P_GLOBAL,
2415 .ptr = &Globals.iMaxSmbdProcesses,
2418 .flags = FLAG_ADVANCED,
2421 .label = "max connections",
2424 .ptr = &sDefault.iMaxConnections,
2427 .flags = FLAG_ADVANCED | FLAG_SHARE,
2430 .label = "paranoid server security",
2432 .p_class = P_GLOBAL,
2433 .ptr = &Globals.paranoid_server_security,
2436 .flags = FLAG_ADVANCED,
2439 .label = "max disk size",
2441 .p_class = P_GLOBAL,
2442 .ptr = &Globals.maxdisksize,
2445 .flags = FLAG_ADVANCED,
2448 .label = "max open files",
2450 .p_class = P_GLOBAL,
2451 .ptr = &Globals.max_open_files,
2454 .flags = FLAG_ADVANCED,
2457 .label = "min print space",
2460 .ptr = &sDefault.iMinPrintSpace,
2463 .flags = FLAG_ADVANCED | FLAG_PRINT,
2466 .label = "socket options",
2468 .p_class = P_GLOBAL,
2469 .ptr = &Globals.szSocketOptions,
2472 .flags = FLAG_ADVANCED,
2475 .label = "strict allocate",
2478 .ptr = &sDefault.bStrictAllocate,
2481 .flags = FLAG_ADVANCED | FLAG_SHARE,
2484 .label = "strict sync",
2487 .ptr = &sDefault.bStrictSync,
2490 .flags = FLAG_ADVANCED | FLAG_SHARE,
2493 .label = "sync always",
2496 .ptr = &sDefault.bSyncAlways,
2499 .flags = FLAG_ADVANCED | FLAG_SHARE,
2502 .label = "use mmap",
2504 .p_class = P_GLOBAL,
2505 .ptr = &Globals.bUseMmap,
2508 .flags = FLAG_ADVANCED,
2511 .label = "use sendfile",
2514 .ptr = &sDefault.bUseSendfile,
2517 .flags = FLAG_ADVANCED | FLAG_SHARE,
2520 .label = "hostname lookups",
2522 .p_class = P_GLOBAL,
2523 .ptr = &Globals.bHostnameLookups,
2526 .flags = FLAG_ADVANCED,
2529 .label = "write cache size",
2532 .ptr = &sDefault.iWriteCacheSize,
2535 .flags = FLAG_ADVANCED | FLAG_SHARE,
2538 .label = "name cache timeout",
2540 .p_class = P_GLOBAL,
2541 .ptr = &Globals.name_cache_timeout,
2544 .flags = FLAG_ADVANCED,
2547 .label = "ctdbd socket",
2549 .p_class = P_GLOBAL,
2550 .ptr = &Globals.ctdbdSocket,
2553 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2556 .label = "cluster addresses",
2558 .p_class = P_GLOBAL,
2559 .ptr = &Globals.szClusterAddresses,
2562 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2565 .label = "clustering",
2567 .p_class = P_GLOBAL,
2568 .ptr = &Globals.clustering,
2571 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2574 .label = "ctdb timeout",
2576 .p_class = P_GLOBAL,
2577 .ptr = &Globals.ctdb_timeout,
2580 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2583 .label = "ctdb locktime warn threshold",
2585 .p_class = P_GLOBAL,
2586 .ptr = &Globals.ctdb_locktime_warn_threshold,
2589 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2592 .label = "smb2 max read",
2594 .p_class = P_GLOBAL,
2595 .ptr = &Globals.ismb2_max_read,
2598 .flags = FLAG_ADVANCED,
2601 .label = "smb2 max write",
2603 .p_class = P_GLOBAL,
2604 .ptr = &Globals.ismb2_max_write,
2607 .flags = FLAG_ADVANCED,
2610 .label = "smb2 max trans",
2612 .p_class = P_GLOBAL,
2613 .ptr = &Globals.ismb2_max_trans,
2616 .flags = FLAG_ADVANCED,
2619 {N_("Printing Options"), P_SEP, P_SEPARATOR},
2622 .label = "max reported print jobs",
2625 .ptr = &sDefault.iMaxReportedPrintJobs,
2628 .flags = FLAG_ADVANCED | FLAG_PRINT,
2631 .label = "max print jobs",
2634 .ptr = &sDefault.iMaxPrintJobs,
2637 .flags = FLAG_ADVANCED | FLAG_PRINT,
2640 .label = "load printers",
2642 .p_class = P_GLOBAL,
2643 .ptr = &Globals.bLoadPrinters,
2646 .flags = FLAG_ADVANCED | FLAG_PRINT,
2649 .label = "printcap cache time",
2651 .p_class = P_GLOBAL,
2652 .ptr = &Globals.PrintcapCacheTime,
2655 .flags = FLAG_ADVANCED | FLAG_PRINT,
2658 .label = "printcap name",
2660 .p_class = P_GLOBAL,
2661 .ptr = &Globals.szPrintcapname,
2664 .flags = FLAG_ADVANCED | FLAG_PRINT,
2667 .label = "printcap",
2669 .p_class = P_GLOBAL,
2670 .ptr = &Globals.szPrintcapname,
2676 .label = "printable",
2679 .ptr = &sDefault.bPrint_ok,
2682 .flags = FLAG_ADVANCED | FLAG_PRINT,
2685 .label = "print ok",
2688 .ptr = &sDefault.bPrint_ok,
2694 .label = "printing",
2697 .ptr = &sDefault.iPrinting,
2698 .special = handle_printing,
2699 .enum_list = enum_printing,
2700 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2703 .label = "cups options",
2706 .ptr = &sDefault.szCupsOptions,
2709 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2712 .label = "cups server",
2714 .p_class = P_GLOBAL,
2715 .ptr = &Globals.szCupsServer,
2718 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2721 .label = "cups encrypt",
2723 .p_class = P_GLOBAL,
2724 .ptr = &Globals.CupsEncrypt,
2726 .enum_list = enum_bool_auto,
2727 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2731 .label = "cups connection timeout",
2733 .p_class = P_GLOBAL,
2734 .ptr = &Globals.cups_connection_timeout,
2737 .flags = FLAG_ADVANCED,
2740 .label = "iprint server",
2742 .p_class = P_GLOBAL,
2743 .ptr = &Globals.szIPrintServer,
2746 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2749 .label = "print command",
2752 .ptr = &sDefault.szPrintcommand,
2755 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2758 .label = "disable spoolss",
2760 .p_class = P_GLOBAL,
2761 .ptr = &Globals.bDisableSpoolss,
2764 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2767 .label = "enable spoolss",
2769 .p_class = P_GLOBAL,
2770 .ptr = &Globals.bDisableSpoolss,
2776 .label = "lpq command",
2779 .ptr = &sDefault.szLpqcommand,
2782 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2785 .label = "lprm command",
2788 .ptr = &sDefault.szLprmcommand,
2791 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2794 .label = "lppause command",
2797 .ptr = &sDefault.szLppausecommand,
2800 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2803 .label = "lpresume command",
2806 .ptr = &sDefault.szLpresumecommand,
2809 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2812 .label = "queuepause command",
2815 .ptr = &sDefault.szQueuepausecommand,
2818 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2821 .label = "queueresume command",
2824 .ptr = &sDefault.szQueueresumecommand,
2827 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2830 .label = "addport command",
2832 .p_class = P_GLOBAL,
2833 .ptr = &Globals.szAddPortCommand,
2836 .flags = FLAG_ADVANCED,
2839 .label = "enumports command",
2841 .p_class = P_GLOBAL,
2842 .ptr = &Globals.szEnumPortsCommand,
2845 .flags = FLAG_ADVANCED,
2848 .label = "addprinter command",
2850 .p_class = P_GLOBAL,
2851 .ptr = &Globals.szAddPrinterCommand,
2854 .flags = FLAG_ADVANCED,
2857 .label = "deleteprinter command",
2859 .p_class = P_GLOBAL,
2860 .ptr = &Globals.szDeletePrinterCommand,
2863 .flags = FLAG_ADVANCED,
2866 .label = "show add printer wizard",
2868 .p_class = P_GLOBAL,
2869 .ptr = &Globals.bMsAddPrinterWizard,
2872 .flags = FLAG_ADVANCED,
2875 .label = "os2 driver map",
2877 .p_class = P_GLOBAL,
2878 .ptr = &Globals.szOs2DriverMap,
2881 .flags = FLAG_ADVANCED,
2885 .label = "printer name",
2888 .ptr = &sDefault.szPrintername,
2891 .flags = FLAG_ADVANCED | FLAG_PRINT,
2897 .ptr = &sDefault.szPrintername,
2903 .label = "use client driver",
2906 .ptr = &sDefault.bUseClientDriver,
2909 .flags = FLAG_ADVANCED | FLAG_PRINT,
2912 .label = "default devmode",
2915 .ptr = &sDefault.bDefaultDevmode,
2918 .flags = FLAG_ADVANCED | FLAG_PRINT,
2921 .label = "force printername",
2924 .ptr = &sDefault.bForcePrintername,
2927 .flags = FLAG_ADVANCED | FLAG_PRINT,
2930 .label = "printjob username",
2933 .ptr = &sDefault.szPrintjobUsername,
2936 .flags = FLAG_ADVANCED | FLAG_PRINT,
2939 {N_("Filename Handling"), P_SEP, P_SEPARATOR},
2942 .label = "mangling method",
2944 .p_class = P_GLOBAL,
2945 .ptr = &Globals.szManglingMethod,
2948 .flags = FLAG_ADVANCED,
2951 .label = "mangle prefix",
2953 .p_class = P_GLOBAL,
2954 .ptr = &Globals.mangle_prefix,
2957 .flags = FLAG_ADVANCED,
2961 .label = "default case",
2964 .ptr = &sDefault.iDefaultCase,
2966 .enum_list = enum_case,
2967 .flags = FLAG_ADVANCED | FLAG_SHARE,
2970 .label = "case sensitive",
2973 .ptr = &sDefault.iCaseSensitive,
2975 .enum_list = enum_bool_auto,
2976 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2979 .label = "casesignames",
2982 .ptr = &sDefault.iCaseSensitive,
2984 .enum_list = enum_bool_auto,
2985 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_HIDE,
2988 .label = "preserve case",
2991 .ptr = &sDefault.bCasePreserve,
2994 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2997 .label = "short preserve case",
3000 .ptr = &sDefault.bShortCasePreserve,
3003 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3006 .label = "mangling char",
3009 .ptr = &sDefault.magic_char,
3012 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3015 .label = "hide dot files",
3018 .ptr = &sDefault.bHideDotFiles,
3021 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3024 .label = "hide special files",
3027 .ptr = &sDefault.bHideSpecialFiles,
3030 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3033 .label = "hide unreadable",
3036 .ptr = &sDefault.bHideUnReadable,
3039 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3042 .label = "hide unwriteable files",
3045 .ptr = &sDefault.bHideUnWriteableFiles,
3048 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3051 .label = "delete veto files",
3054 .ptr = &sDefault.bDeleteVetoFiles,
3057 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3060 .label = "veto files",
3063 .ptr = &sDefault.szVetoFiles,
3066 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3069 .label = "hide files",
3072 .ptr = &sDefault.szHideFiles,
3075 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3078 .label = "veto oplock files",
3081 .ptr = &sDefault.szVetoOplockFiles,
3084 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3087 .label = "map archive",
3090 .ptr = &sDefault.bMap_archive,
3093 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3096 .label = "map hidden",
3099 .ptr = &sDefault.bMap_hidden,
3102 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3105 .label = "map system",
3108 .ptr = &sDefault.bMap_system,
3111 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3114 .label = "map readonly",
3117 .ptr = &sDefault.iMap_readonly,
3119 .enum_list = enum_map_readonly,
3120 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3123 .label = "mangled names",
3126 .ptr = &sDefault.bMangledNames,
3129 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3132 .label = "max stat cache size",
3134 .p_class = P_GLOBAL,
3135 .ptr = &Globals.iMaxStatCacheSize,
3138 .flags = FLAG_ADVANCED,
3141 .label = "stat cache",
3143 .p_class = P_GLOBAL,
3144 .ptr = &Globals.bStatCache,
3147 .flags = FLAG_ADVANCED,
3150 .label = "store dos attributes",
3153 .ptr = &sDefault.bStoreDosAttributes,
3156 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3159 .label = "dmapi support",
3162 .ptr = &sDefault.bDmapiSupport,
3165 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3169 {N_("Domain Options"), P_SEP, P_SEPARATOR},
3172 .label = "machine password timeout",
3174 .p_class = P_GLOBAL,
3175 .ptr = &Globals.machine_password_timeout,
3178 .flags = FLAG_ADVANCED | FLAG_WIZARD,
3181 {N_("Logon Options"), P_SEP, P_SEPARATOR},
3184 .label = "add user script",
3186 .p_class = P_GLOBAL,
3187 .ptr = &Globals.szAddUserScript,
3190 .flags = FLAG_ADVANCED,
3193 .label = "rename user script",
3195 .p_class = P_GLOBAL,
3196 .ptr = &Globals.szRenameUserScript,
3199 .flags = FLAG_ADVANCED,
3202 .label = "delete user script",
3204 .p_class = P_GLOBAL,
3205 .ptr = &Globals.szDelUserScript,
3208 .flags = FLAG_ADVANCED,
3211 .label = "add group script",
3213 .p_class = P_GLOBAL,
3214 .ptr = &Globals.szAddGroupScript,
3217 .flags = FLAG_ADVANCED,
3220 .label = "delete group script",
3222 .p_class = P_GLOBAL,
3223 .ptr = &Globals.szDelGroupScript,
3226 .flags = FLAG_ADVANCED,
3229 .label = "add user to group script",
3231 .p_class = P_GLOBAL,
3232 .ptr = &Globals.szAddUserToGroupScript,
3235 .flags = FLAG_ADVANCED,
3238 .label = "delete user from group script",
3240 .p_class = P_GLOBAL,
3241 .ptr = &Globals.szDelUserFromGroupScript,
3244 .flags = FLAG_ADVANCED,
3247 .label = "set primary group script",
3249 .p_class = P_GLOBAL,
3250 .ptr = &Globals.szSetPrimaryGroupScript,
3253 .flags = FLAG_ADVANCED,
3256 .label = "add machine script",
3258 .p_class = P_GLOBAL,
3259 .ptr = &Globals.szAddMachineScript,
3262 .flags = FLAG_ADVANCED,
3265 .label = "shutdown script",
3267 .p_class = P_GLOBAL,
3268 .ptr = &Globals.szShutdownScript,
3271 .flags = FLAG_ADVANCED,
3274 .label = "abort shutdown script",
3276 .p_class = P_GLOBAL,
3277 .ptr = &Globals.szAbortShutdownScript,
3280 .flags = FLAG_ADVANCED,
3283 .label = "username map script",
3285 .p_class = P_GLOBAL,
3286 .ptr = &Globals.szUsernameMapScript,
3289 .flags = FLAG_ADVANCED,
3292 .label = "username map cache time",
3294 .p_class = P_GLOBAL,
3295 .ptr = &Globals.iUsernameMapCacheTime,
3298 .flags = FLAG_ADVANCED,
3301 .label = "logon script",
3303 .p_class = P_GLOBAL,
3304 .ptr = &Globals.szLogonScript,
3307 .flags = FLAG_ADVANCED,
3310 .label = "logon path",
3312 .p_class = P_GLOBAL,
3313 .ptr = &Globals.szLogonPath,
3316 .flags = FLAG_ADVANCED,
3319 .label = "logon drive",
3321 .p_class = P_GLOBAL,
3322 .ptr = &Globals.szLogonDrive,
3325 .flags = FLAG_ADVANCED,
3328 .label = "logon home",
3330 .p_class = P_GLOBAL,
3331 .ptr = &Globals.szLogonHome,
3334 .flags = FLAG_ADVANCED,
3337 .label = "domain logons",
3339 .p_class = P_GLOBAL,
3340 .ptr = &Globals.bDomainLogons,
3343 .flags = FLAG_ADVANCED,
3347 .label = "init logon delayed hosts",
3349 .p_class = P_GLOBAL,
3350 .ptr = &Globals.szInitLogonDelayedHosts,
3353 .flags = FLAG_ADVANCED,
3357 .label = "init logon delay",
3359 .p_class = P_GLOBAL,
3360 .ptr = &Globals.InitLogonDelay,
3363 .flags = FLAG_ADVANCED,
3367 {N_("Browse Options"), P_SEP, P_SEPARATOR},
3370 .label = "os level",
3372 .p_class = P_GLOBAL,
3373 .ptr = &Globals.os_level,
3376 .flags = FLAG_BASIC | FLAG_ADVANCED,
3379 .label = "lm announce",
3381 .p_class = P_GLOBAL,
3382 .ptr = &Globals.lm_announce,
3384 .enum_list = enum_bool_auto,
3385 .flags = FLAG_ADVANCED,
3388 .label = "lm interval",
3390 .p_class = P_GLOBAL,
3391 .ptr = &Globals.lm_interval,
3394 .flags = FLAG_ADVANCED,
3397 .label = "preferred master",
3399 .p_class = P_GLOBAL,
3400 .ptr = &Globals.iPreferredMaster,
3402 .enum_list = enum_bool_auto,
3403 .flags = FLAG_BASIC | FLAG_ADVANCED,
3406 .label = "prefered master",
3408 .p_class = P_GLOBAL,
3409 .ptr = &Globals.iPreferredMaster,
3411 .enum_list = enum_bool_auto,
3415 .label = "local master",
3417 .p_class = P_GLOBAL,
3418 .ptr = &Globals.bLocalMaster,
3421 .flags = FLAG_BASIC | FLAG_ADVANCED,
3424 .label = "domain master",
3426 .p_class = P_GLOBAL,
3427 .ptr = &Globals.iDomainMaster,
3429 .enum_list = enum_bool_auto,
3430 .flags = FLAG_BASIC | FLAG_ADVANCED,
3433 .label = "browse list",
3435 .p_class = P_GLOBAL,
3436 .ptr = &Globals.bBrowseList,
3439 .flags = FLAG_ADVANCED,
3442 .label = "browseable",
3445 .ptr = &sDefault.bBrowseable,
3448 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3451 .label = "browsable",
3454 .ptr = &sDefault.bBrowseable,
3460 .label = "access based share enum",
3463 .ptr = &sDefault.bAccessBasedShareEnum,
3466 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE
3469 .label = "enhanced browsing",
3471 .p_class = P_GLOBAL,
3472 .ptr = &Globals.enhanced_browsing,
3475 .flags = FLAG_ADVANCED,
3478 {N_("WINS Options"), P_SEP, P_SEPARATOR},
3481 .label = "dns proxy",
3483 .p_class = P_GLOBAL,
3484 .ptr = &Globals.bDNSproxy,
3487 .flags = FLAG_ADVANCED,
3490 .label = "wins proxy",
3492 .p_class = P_GLOBAL,
3493 .ptr = &Globals.bWINSproxy,
3496 .flags = FLAG_ADVANCED,
3499 .label = "wins server",
3501 .p_class = P_GLOBAL,
3502 .ptr = &Globals.szWINSservers,
3505 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3508 .label = "wins support",
3510 .p_class = P_GLOBAL,
3511 .ptr = &Globals.bWINSsupport,
3514 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3517 .label = "wins hook",
3519 .p_class = P_GLOBAL,
3520 .ptr = &Globals.szWINSHook,
3523 .flags = FLAG_ADVANCED,
3526 {N_("Locking Options"), P_SEP, P_SEPARATOR},
3529 .label = "blocking locks",
3532 .ptr = &sDefault.bBlockingLocks,
3535 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3538 .label = "csc policy",
3541 .ptr = &sDefault.iCSCPolicy,
3543 .enum_list = enum_csc_policy,
3544 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3547 .label = "fake oplocks",
3550 .ptr = &sDefault.bFakeOplocks,
3553 .flags = FLAG_ADVANCED | FLAG_SHARE,
3556 .label = "kernel oplocks",
3558 .p_class = P_GLOBAL,
3559 .ptr = &Globals.bKernelOplocks,
3562 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3568 .ptr = &sDefault.bLocking,
3571 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3574 .label = "lock spin time",
3576 .p_class = P_GLOBAL,
3577 .ptr = &Globals.iLockSpinTime,
3580 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3586 .ptr = &sDefault.bOpLocks,
3589 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3592 .label = "level2 oplocks",
3595 .ptr = &sDefault.bLevel2OpLocks,
3598 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3601 .label = "oplock break wait time",
3603 .p_class = P_GLOBAL,
3604 .ptr = &Globals.oplock_break_wait_time,
3607 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3610 .label = "oplock contention limit",
3613 .ptr = &sDefault.iOplockContentionLimit,
3616 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3619 .label = "posix locking",
3622 .ptr = &sDefault.bPosixLocking,
3625 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3628 .label = "strict locking",
3631 .ptr = &sDefault.iStrictLocking,
3633 .enum_list = enum_bool_auto,
3634 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3637 .label = "share modes",
3640 .ptr = &sDefault.bShareModes,
3643 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_DEPRECATED,
3646 {N_("Ldap Options"), P_SEP, P_SEPARATOR},
3649 .label = "ldap admin dn",
3651 .p_class = P_GLOBAL,
3652 .ptr = &Globals.szLdapAdminDn,
3655 .flags = FLAG_ADVANCED,
3658 .label = "ldap delete dn",
3660 .p_class = P_GLOBAL,
3661 .ptr = &Globals.ldap_delete_dn,
3664 .flags = FLAG_ADVANCED,
3667 .label = "ldap group suffix",
3669 .p_class = P_GLOBAL,
3670 .ptr = &Globals.szLdapGroupSuffix,
3673 .flags = FLAG_ADVANCED,
3676 .label = "ldap idmap suffix",
3678 .p_class = P_GLOBAL,
3679 .ptr = &Globals.szLdapIdmapSuffix,
3682 .flags = FLAG_ADVANCED,
3685 .label = "ldap machine suffix",
3687 .p_class = P_GLOBAL,
3688 .ptr = &Globals.szLdapMachineSuffix,
3691 .flags = FLAG_ADVANCED,
3694 .label = "ldap passwd sync",
3696 .p_class = P_GLOBAL,
3697 .ptr = &Globals.ldap_passwd_sync,
3699 .enum_list = enum_ldap_passwd_sync,
3700 .flags = FLAG_ADVANCED,
3703 .label = "ldap password sync",
3705 .p_class = P_GLOBAL,
3706 .ptr = &Globals.ldap_passwd_sync,
3708 .enum_list = enum_ldap_passwd_sync,
3712 .label = "ldap replication sleep",
3714 .p_class = P_GLOBAL,
3715 .ptr = &Globals.ldap_replication_sleep,
3718 .flags = FLAG_ADVANCED,
3721 .label = "ldap suffix",
3723 .p_class = P_GLOBAL,
3724 .ptr = &Globals.szLdapSuffix,
3727 .flags = FLAG_ADVANCED,
3730 .label = "ldap ssl",
3732 .p_class = P_GLOBAL,
3733 .ptr = &Globals.ldap_ssl,
3735 .enum_list = enum_ldap_ssl,
3736 .flags = FLAG_ADVANCED,
3739 .label = "ldap ssl ads",
3741 .p_class = P_GLOBAL,
3742 .ptr = &Globals.ldap_ssl_ads,
3745 .flags = FLAG_ADVANCED,
3748 .label = "ldap deref",
3750 .p_class = P_GLOBAL,
3751 .ptr = &Globals.ldap_deref,
3753 .enum_list = enum_ldap_deref,
3754 .flags = FLAG_ADVANCED,
3757 .label = "ldap follow referral",
3759 .p_class = P_GLOBAL,
3760 .ptr = &Globals.ldap_follow_referral,
3762 .enum_list = enum_bool_auto,
3763 .flags = FLAG_ADVANCED,
3766 .label = "ldap timeout",
3768 .p_class = P_GLOBAL,
3769 .ptr = &Globals.ldap_timeout,
3772 .flags = FLAG_ADVANCED,
3775 .label = "ldap connection timeout",
3777 .p_class = P_GLOBAL,
3778 .ptr = &Globals.ldap_connection_timeout,
3781 .flags = FLAG_ADVANCED,
3784 .label = "ldap page size",
3786 .p_class = P_GLOBAL,
3787 .ptr = &Globals.ldap_page_size,
3790 .flags = FLAG_ADVANCED,
3793 .label = "ldap user suffix",
3795 .p_class = P_GLOBAL,
3796 .ptr = &Globals.szLdapUserSuffix,
3799 .flags = FLAG_ADVANCED,
3802 .label = "ldap debug level",
3804 .p_class = P_GLOBAL,
3805 .ptr = &Globals.ldap_debug_level,
3806 .special = handle_ldap_debug_level,
3808 .flags = FLAG_ADVANCED,
3811 .label = "ldap debug threshold",
3813 .p_class = P_GLOBAL,
3814 .ptr = &Globals.ldap_debug_threshold,
3817 .flags = FLAG_ADVANCED,
3820 {N_("EventLog Options"), P_SEP, P_SEPARATOR},
3823 .label = "eventlog list",
3825 .p_class = P_GLOBAL,
3826 .ptr = &Globals.szEventLogs,
3829 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
3832 {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
3835 .label = "add share command",
3837 .p_class = P_GLOBAL,
3838 .ptr = &Globals.szAddShareCommand,
3841 .flags = FLAG_ADVANCED,
3844 .label = "change share command",
3846 .p_class = P_GLOBAL,
3847 .ptr = &Globals.szChangeShareCommand,
3850 .flags = FLAG_ADVANCED,
3853 .label = "delete share command",
3855 .p_class = P_GLOBAL,
3856 .ptr = &Globals.szDeleteShareCommand,
3859 .flags = FLAG_ADVANCED,
3862 .label = "config file",
3864 .p_class = P_GLOBAL,
3865 .ptr = &Globals.szConfigFile,
3868 .flags = FLAG_HIDE|FLAG_META,
3873 .p_class = P_GLOBAL,
3874 .ptr = &Globals.szAutoServices,
3877 .flags = FLAG_ADVANCED,
3880 .label = "auto services",
3882 .p_class = P_GLOBAL,
3883 .ptr = &Globals.szAutoServices,
3886 .flags = FLAG_ADVANCED,
3889 .label = "lock directory",
3891 .p_class = P_GLOBAL,
3892 .ptr = &Globals.szLockDir,
3895 .flags = FLAG_ADVANCED,
3898 .label = "lock dir",
3900 .p_class = P_GLOBAL,
3901 .ptr = &Globals.szLockDir,
3907 .label = "state directory",
3909 .p_class = P_GLOBAL,
3910 .ptr = &Globals.szStateDir,
3913 .flags = FLAG_ADVANCED,
3916 .label = "cache directory",
3918 .p_class = P_GLOBAL,
3919 .ptr = &Globals.szCacheDir,
3922 .flags = FLAG_ADVANCED,
3925 .label = "pid directory",
3927 .p_class = P_GLOBAL,
3928 .ptr = &Globals.szPidDir,
3931 .flags = FLAG_ADVANCED,
3935 .label = "utmp directory",
3937 .p_class = P_GLOBAL,
3938 .ptr = &Globals.szUtmpDir,
3941 .flags = FLAG_ADVANCED,
3944 .label = "wtmp directory",
3946 .p_class = P_GLOBAL,
3947 .ptr = &Globals.szWtmpDir,
3950 .flags = FLAG_ADVANCED,
3955 .p_class = P_GLOBAL,
3956 .ptr = &Globals.bUtmp,
3959 .flags = FLAG_ADVANCED,
3963 .label = "default service",
3965 .p_class = P_GLOBAL,
3966 .ptr = &Globals.szDefaultService,
3969 .flags = FLAG_ADVANCED,
3974 .p_class = P_GLOBAL,
3975 .ptr = &Globals.szDefaultService,
3978 .flags = FLAG_ADVANCED,
3981 .label = "message command",
3983 .p_class = P_GLOBAL,
3984 .ptr = &Globals.szMsgCommand,
3987 .flags = FLAG_ADVANCED,
3990 .label = "dfree cache time",
3993 .ptr = &sDefault.iDfreeCacheTime,
3996 .flags = FLAG_ADVANCED,
3999 .label = "dfree command",
4002 .ptr = &sDefault.szDfree,
4005 .flags = FLAG_ADVANCED,
4008 .label = "get quota command",
4010 .p_class = P_GLOBAL,
4011 .ptr = &Globals.szGetQuota,
4014 .flags = FLAG_ADVANCED,
4017 .label = "set quota command",
4019 .p_class = P_GLOBAL,
4020 .ptr = &Globals.szSetQuota,
4023 .flags = FLAG_ADVANCED,
4026 .label = "remote announce",
4028 .p_class = P_GLOBAL,
4029 .ptr = &Globals.szRemoteAnnounce,
4032 .flags = FLAG_ADVANCED,
4035 .label = "remote browse sync",
4037 .p_class = P_GLOBAL,
4038 .ptr = &Globals.szRemoteBrowseSync,
4041 .flags = FLAG_ADVANCED,
4044 .label = "socket address",
4046 .p_class = P_GLOBAL,
4047 .ptr = &Globals.szSocketAddress,
4050 .flags = FLAG_ADVANCED,
4053 .label = "nmbd bind explicit broadcast",
4055 .p_class = P_GLOBAL,
4056 .ptr = &Globals.bNmbdBindExplicitBroadcast,
4059 .flags = FLAG_ADVANCED,
4062 .label = "homedir map",
4064 .p_class = P_GLOBAL,
4065 .ptr = &Globals.szNISHomeMapName,
4068 .flags = FLAG_ADVANCED,
4071 .label = "afs username map",
4073 .p_class = P_GLOBAL,
4074 .ptr = &Globals.szAfsUsernameMap,
4077 .flags = FLAG_ADVANCED,
4080 .label = "afs token lifetime",
4082 .p_class = P_GLOBAL,
4083 .ptr = &Globals.iAfsTokenLifetime,
4086 .flags = FLAG_ADVANCED,
4089 .label = "log nt token command",
4091 .p_class = P_GLOBAL,
4092 .ptr = &Globals.szLogNtTokenCommand,
4095 .flags = FLAG_ADVANCED,
4098 .label = "time offset",
4100 .p_class = P_GLOBAL,
4101 .ptr = &extra_time_offset,
4104 .flags = FLAG_ADVANCED,
4107 .label = "NIS homedir",
4109 .p_class = P_GLOBAL,
4110 .ptr = &Globals.bNISHomeMap,
4113 .flags = FLAG_ADVANCED,
4119 .ptr = &sDefault.valid,
4128 .ptr = &sDefault.szCopy,
4129 .special = handle_copy,
4137 .ptr = &sDefault.szInclude,
4138 .special = handle_include,
4140 .flags = FLAG_HIDE|FLAG_META,
4146 .ptr = &sDefault.szPreExec,
4149 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4155 .ptr = &sDefault.szPreExec,
4158 .flags = FLAG_ADVANCED,
4161 .label = "preexec close",
4164 .ptr = &sDefault.bPreexecClose,
4167 .flags = FLAG_ADVANCED | FLAG_SHARE,
4170 .label = "postexec",
4173 .ptr = &sDefault.szPostExec,
4176 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4179 .label = "root preexec",
4182 .ptr = &sDefault.szRootPreExec,
4185 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4188 .label = "root preexec close",
4191 .ptr = &sDefault.bRootpreexecClose,
4194 .flags = FLAG_ADVANCED | FLAG_SHARE,
4197 .label = "root postexec",
4200 .ptr = &sDefault.szRootPostExec,
4203 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4206 .label = "available",
4209 .ptr = &sDefault.bAvailable,
4212 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4215 .label = "registry shares",
4217 .p_class = P_GLOBAL,
4218 .ptr = &Globals.bRegistryShares,
4221 .flags = FLAG_ADVANCED,
4224 .label = "usershare allow guests",
4226 .p_class = P_GLOBAL,
4227 .ptr = &Globals.bUsershareAllowGuests,
4230 .flags = FLAG_ADVANCED,
4233 .label = "usershare max shares",
4235 .p_class = P_GLOBAL,
4236 .ptr = &Globals.iUsershareMaxShares,
4239 .flags = FLAG_ADVANCED,
4242 .label = "usershare owner only",
4244 .p_class = P_GLOBAL,
4245 .ptr = &Globals.bUsershareOwnerOnly,
4248 .flags = FLAG_ADVANCED,
4251 .label = "usershare path",
4253 .p_class = P_GLOBAL,
4254 .ptr = &Globals.szUsersharePath,
4257 .flags = FLAG_ADVANCED,
4260 .label = "usershare prefix allow list",
4262 .p_class = P_GLOBAL,
4263 .ptr = &Globals.szUsersharePrefixAllowList,
4266 .flags = FLAG_ADVANCED,
4269 .label = "usershare prefix deny list",
4271 .p_class = P_GLOBAL,
4272 .ptr = &Globals.szUsersharePrefixDenyList,
4275 .flags = FLAG_ADVANCED,
4278 .label = "usershare template share",
4280 .p_class = P_GLOBAL,
4281 .ptr = &Globals.szUsershareTemplateShare,
4284 .flags = FLAG_ADVANCED,
4290 .ptr = &sDefault.volume,
4293 .flags = FLAG_ADVANCED | FLAG_SHARE,
4299 .ptr = &sDefault.fstype,
4302 .flags = FLAG_ADVANCED | FLAG_SHARE,
4305 .label = "set directory",
4308 .ptr = &sDefault.bNo_set_dir,
4311 .flags = FLAG_ADVANCED | FLAG_SHARE,
4314 .label = "wide links",
4317 .ptr = &sDefault.bWidelinks,
4320 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4323 .label = "follow symlinks",
4326 .ptr = &sDefault.bSymlinks,
4329 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4332 .label = "dont descend",
4335 .ptr = &sDefault.szDontdescend,
4338 .flags = FLAG_ADVANCED | FLAG_SHARE,
4341 .label = "magic script",
4344 .ptr = &sDefault.szMagicScript,
4347 .flags = FLAG_ADVANCED | FLAG_SHARE,
4350 .label = "magic output",
4353 .ptr = &sDefault.szMagicOutput,
4356 .flags = FLAG_ADVANCED | FLAG_SHARE,
4359 .label = "delete readonly",
4362 .ptr = &sDefault.bDeleteReadonly,
4365 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4368 .label = "dos filemode",
4371 .ptr = &sDefault.bDosFilemode,
4374 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4377 .label = "dos filetimes",
4380 .ptr = &sDefault.bDosFiletimes,
4383 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4386 .label = "dos filetime resolution",
4389 .ptr = &sDefault.bDosFiletimeResolution,
4392 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4395 .label = "fake directory create times",
4398 .ptr = &sDefault.bFakeDirCreateTimes,
4401 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4404 .label = "async smb echo handler",
4406 .p_class = P_GLOBAL,
4407 .ptr = &Globals.bAsyncSMBEchoHandler,
4410 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4413 .label = "multicast dns register",
4415 .p_class = P_GLOBAL,
4416 .ptr = &Globals.bMulticastDnsRegister,
4419 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4422 .label = "panic action",
4424 .p_class = P_GLOBAL,
4425 .ptr = &Globals.szPanicAction,
4428 .flags = FLAG_ADVANCED,
4431 .label = "perfcount module",
4433 .p_class = P_GLOBAL,
4434 .ptr = &Globals.szSMBPerfcountModule,
4437 .flags = FLAG_ADVANCED,
4440 {N_("VFS module options"), P_SEP, P_SEPARATOR},
4443 .label = "vfs objects",
4446 .ptr = &sDefault.szVfsObjects,
4449 .flags = FLAG_ADVANCED | FLAG_SHARE,
4452 .label = "vfs object",
4455 .ptr = &sDefault.szVfsObjects,
4462 {N_("MSDFS options"), P_SEP, P_SEPARATOR},
4465 .label = "msdfs root",
4468 .ptr = &sDefault.bMSDfsRoot,
4471 .flags = FLAG_ADVANCED | FLAG_SHARE,
4474 .label = "msdfs proxy",
4477 .ptr = &sDefault.szMSDfsProxy,
4480 .flags = FLAG_ADVANCED | FLAG_SHARE,
4483 .label = "host msdfs",
4485 .p_class = P_GLOBAL,
4486 .ptr = &Globals.bHostMSDfs,
4489 .flags = FLAG_ADVANCED,
4492 {N_("Winbind options"), P_SEP, P_SEPARATOR},
4495 .label = "passdb expand explicit",
4497 .p_class = P_GLOBAL,
4498 .ptr = &Globals.bPassdbExpandExplicit,
4501 .flags = FLAG_ADVANCED,
4504 .label = "idmap backend",
4506 .p_class = P_GLOBAL,
4507 .ptr = &Globals.szIdmapBackend,
4510 .flags = FLAG_ADVANCED,
4513 .label = "idmap read only",
4515 .p_class = P_GLOBAL,
4516 .ptr = &Globals.bIdmapReadOnly,
4519 .flags = FLAG_ADVANCED,
4522 .label = "idmap cache time",
4524 .p_class = P_GLOBAL,
4525 .ptr = &Globals.iIdmapCacheTime,
4528 .flags = FLAG_ADVANCED,
4531 .label = "idmap negative cache time",
4533 .p_class = P_GLOBAL,
4534 .ptr = &Globals.iIdmapNegativeCacheTime,
4537 .flags = FLAG_ADVANCED,
4540 .label = "idmap uid",
4542 .p_class = P_GLOBAL,
4543 .ptr = &Globals.szIdmapUID,
4544 .special = handle_idmap_uid,
4546 .flags = FLAG_ADVANCED,
4549 .label = "winbind uid",
4551 .p_class = P_GLOBAL,
4552 .ptr = &Globals.szIdmapUID,
4553 .special = handle_idmap_uid,
4558 .label = "idmap gid",
4560 .p_class = P_GLOBAL,
4561 .ptr = &Globals.szIdmapGID,
4562 .special = handle_idmap_gid,
4564 .flags = FLAG_ADVANCED,
4567 .label = "winbind gid",
4569 .p_class = P_GLOBAL,
4570 .ptr = &Globals.szIdmapGID,
4571 .special = handle_idmap_gid,
4576 .label = "template homedir",
4578 .p_class = P_GLOBAL,
4579 .ptr = &Globals.szTemplateHomedir,
4582 .flags = FLAG_ADVANCED,
4585 .label = "template shell",
4587 .p_class = P_GLOBAL,
4588 .ptr = &Globals.szTemplateShell,
4591 .flags = FLAG_ADVANCED,
4594 .label = "winbind separator",
4596 .p_class = P_GLOBAL,
4597 .ptr = &Globals.szWinbindSeparator,
4600 .flags = FLAG_ADVANCED,
4603 .label = "winbind cache time",
4605 .p_class = P_GLOBAL,
4606 .ptr = &Globals.winbind_cache_time,
4609 .flags = FLAG_ADVANCED,
4612 .label = "winbind reconnect delay",
4614 .p_class = P_GLOBAL,
4615 .ptr = &Globals.winbind_reconnect_delay,
4618 .flags = FLAG_ADVANCED,
4621 .label = "winbind max clients",
4623 .p_class = P_GLOBAL,
4624 .ptr = &Globals.winbind_max_clients,
4627 .flags = FLAG_ADVANCED,
4630 .label = "winbind enum users",
4632 .p_class = P_GLOBAL,
4633 .ptr = &Globals.bWinbindEnumUsers,
4636 .flags = FLAG_ADVANCED,
4639 .label = "winbind enum groups",
4641 .p_class = P_GLOBAL,
4642 .ptr = &Globals.bWinbindEnumGroups,
4645 .flags = FLAG_ADVANCED,
4648 .label = "winbind use default domain",
4650 .p_class = P_GLOBAL,
4651 .ptr = &Globals.bWinbindUseDefaultDomain,
4654 .flags = FLAG_ADVANCED,
4657 .label = "winbind trusted domains only",
4659 .p_class = P_GLOBAL,
4660 .ptr = &Globals.bWinbindTrustedDomainsOnly,
4663 .flags = FLAG_ADVANCED,
4666 .label = "winbind nested groups",
4668 .p_class = P_GLOBAL,
4669 .ptr = &Globals.bWinbindNestedGroups,
4672 .flags = FLAG_ADVANCED,
4675 .label = "winbind expand groups",
4677 .p_class = P_GLOBAL,
4678 .ptr = &Globals.winbind_expand_groups,
4681 .flags = FLAG_ADVANCED,
4684 .label = "winbind nss info",
4686 .p_class = P_GLOBAL,
4687 .ptr = &Globals.szWinbindNssInfo,
4690 .flags = FLAG_ADVANCED,
4693 .label = "winbind refresh tickets",
4695 .p_class = P_GLOBAL,
4696 .ptr = &Globals.bWinbindRefreshTickets,
4699 .flags = FLAG_ADVANCED,
4702 .label = "winbind offline logon",
4704 .p_class = P_GLOBAL,
4705 .ptr = &Globals.bWinbindOfflineLogon,
4708 .flags = FLAG_ADVANCED,
4711 .label = "winbind normalize names",
4713 .p_class = P_GLOBAL,
4714 .ptr = &Globals.bWinbindNormalizeNames,
4717 .flags = FLAG_ADVANCED,
4720 .label = "winbind rpc only",
4722 .p_class = P_GLOBAL,
4723 .ptr = &Globals.bWinbindRpcOnly,
4726 .flags = FLAG_ADVANCED,
4729 .label = "create krb5 conf",
4731 .p_class = P_GLOBAL,
4732 .ptr = &Globals.bCreateKrb5Conf,
4735 .flags = FLAG_ADVANCED,
4738 .label = "ncalrpc dir",
4740 .p_class = P_GLOBAL,
4741 .ptr = &Globals.ncalrpc_dir,
4744 .flags = FLAG_ADVANCED,
4747 {NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
4750 /***************************************************************************
4751 Initialise the sDefault parameter structure for the printer values.
4752 ***************************************************************************/
4754 static void init_printer_values(struct service *pService)
4756 /* choose defaults depending on the type of printing */
4757 switch (pService->iPrinting) {
4762 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4763 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4764 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4769 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4770 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4771 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4772 string_set(&pService->szQueuepausecommand, "lpc stop '%p'");
4773 string_set(&pService->szQueueresumecommand, "lpc start '%p'");
4774 string_set(&pService->szLppausecommand, "lpc hold '%p' %j");
4775 string_set(&pService->szLpresumecommand, "lpc release '%p' %j");
4781 /* set the lpq command to contain the destination printer
4782 name only. This is used by cups_queue_get() */
4783 string_set(&pService->szLpqcommand, "%p");
4784 string_set(&pService->szLprmcommand, "");
4785 string_set(&pService->szPrintcommand, "");
4786 string_set(&pService->szLppausecommand, "");
4787 string_set(&pService->szLpresumecommand, "");
4788 string_set(&pService->szQueuepausecommand, "");
4789 string_set(&pService->szQueueresumecommand, "");
4791 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4792 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4793 string_set(&pService->szPrintcommand, "lpr -P'%p' %s; rm %s");
4794 string_set(&pService->szLppausecommand, "lp -i '%p-%j' -H hold");
4795 string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
4796 string_set(&pService->szQueuepausecommand, "disable '%p'");
4797 string_set(&pService->szQueueresumecommand, "enable '%p'");
4798 #endif /* HAVE_CUPS */
4803 string_set(&pService->szLpqcommand, "lpstat -o%p");
4804 string_set(&pService->szLprmcommand, "cancel %p-%j");
4805 string_set(&pService->szPrintcommand, "lp -c -d%p %s; rm %s");
4806 string_set(&pService->szQueuepausecommand, "disable %p");
4807 string_set(&pService->szQueueresumecommand, "enable %p");
4809 string_set(&pService->szLppausecommand, "lp -i %p-%j -H hold");
4810 string_set(&pService->szLpresumecommand, "lp -i %p-%j -H resume");
4815 string_set(&pService->szLpqcommand, "lpq -P%p");
4816 string_set(&pService->szLprmcommand, "lprm -P%p %j");
4817 string_set(&pService->szPrintcommand, "lp -r -P%p %s");
4823 string_set(&pService->szPrintcommand, "vlp print %p %s");
4824 string_set(&pService->szLpqcommand, "vlp lpq %p");
4825 string_set(&pService->szLprmcommand, "vlp lprm %p %j");
4826 string_set(&pService->szLppausecommand, "vlp lppause %p %j");
4827 string_set(&pService->szLpresumecommand, "vlp lpresume %p %j");
4828 string_set(&pService->szQueuepausecommand, "vlp queuepause %p");
4829 string_set(&pService->szQueueresumecommand, "vlp queueresume %p");
4831 #endif /* DEVELOPER */
4836 * Function to return the default value for the maximum number of open
4837 * file descriptors permitted. This function tries to consult the
4838 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4839 * the smaller of those.
4841 static int max_open_files(void)
4843 int sysctl_max = MAX_OPEN_FILES;
4844 int rlimit_max = MAX_OPEN_FILES;
4846 #ifdef HAVE_SYSCTLBYNAME
4848 size_t size = sizeof(sysctl_max);
4849 sysctlbyname("kern.maxfilesperproc", &sysctl_max, &size, NULL,
4854 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4860 if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
4861 rlimit_max = rl.rlim_cur;
4863 #if defined(RLIM_INFINITY)
4864 if(rl.rlim_cur == RLIM_INFINITY)
4865 rlimit_max = MAX_OPEN_FILES;
4870 if (sysctl_max < MIN_OPEN_FILES_WINDOWS) {
4871 DEBUG(2,("max_open_files: sysctl_max (%d) below "
4872 "minimum Windows limit (%d)\n",
4874 MIN_OPEN_FILES_WINDOWS));
4875 sysctl_max = MIN_OPEN_FILES_WINDOWS;
4878 if (rlimit_max < MIN_OPEN_FILES_WINDOWS) {
4879 DEBUG(2,("rlimit_max: rlimit_max (%d) below "
4880 "minimum Windows limit (%d)\n",
4882 MIN_OPEN_FILES_WINDOWS));
4883 rlimit_max = MIN_OPEN_FILES_WINDOWS;
4886 return MIN(sysctl_max, rlimit_max);
4890 * Common part of freeing allocated data for one parameter.
4892 static void free_one_parameter_common(void *parm_ptr,
4893 struct parm_struct parm)
4895 if ((parm.type == P_STRING) ||
4896 (parm.type == P_USTRING))
4898 string_free((char**)parm_ptr);
4899 } else if (parm.type == P_LIST) {
4900 TALLOC_FREE(*((char***)parm_ptr));
4905 * Free the allocated data for one parameter for a share
4906 * given as a service struct.
4908 static void free_one_parameter(struct service *service,
4909 struct parm_struct parm)
4913 if (parm.p_class != P_LOCAL) {
4917 parm_ptr = lp_local_ptr(service, parm.ptr);
4919 free_one_parameter_common(parm_ptr, parm);
4923 * Free the allocated parameter data of a share given
4924 * as a service struct.
4926 static void free_parameters(struct service *service)
4930 for (i=0; parm_table[i].label; i++) {
4931 free_one_parameter(service, parm_table[i]);
4936 * Free the allocated data for one parameter for a given share
4937 * specified by an snum.
4939 static void free_one_parameter_by_snum(int snum, struct parm_struct parm)
4943 if (parm.ptr == NULL) {
4948 parm_ptr = parm.ptr;
4949 } else if (parm.p_class != P_LOCAL) {
4952 parm_ptr = lp_local_ptr_by_snum(snum, parm.ptr);
4955 free_one_parameter_common(parm_ptr, parm);
4959 * Free the allocated parameter data for a share specified
4962 static void free_parameters_by_snum(int snum)
4966 for (i=0; parm_table[i].label; i++) {
4967 free_one_parameter_by_snum(snum, parm_table[i]);
4972 * Free the allocated global parameters.
4974 static void free_global_parameters(void)
4976 free_parameters_by_snum(GLOBAL_SECTION_SNUM);
4979 static int map_parameter(const char *pszParmName);
4981 struct lp_stored_option {
4982 struct lp_stored_option *prev, *next;
4987 static struct lp_stored_option *stored_options;
4990 save options set by lp_set_cmdline() into a list. This list is
4991 re-applied when we do a globals reset, so that cmdline set options
4992 are sticky across reloads of smb.conf
4994 static bool store_lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
4996 struct lp_stored_option *entry, *entry_next;
4997 for (entry = stored_options; entry != NULL; entry = entry_next) {
4998 entry_next = entry->next;
4999 if (strcmp(pszParmName, entry->label) == 0) {
5000 DLIST_REMOVE(stored_options, entry);
5006 entry = talloc(NULL, struct lp_stored_option);
5011 entry->label = talloc_strdup(entry, pszParmName);
5012 if (!entry->label) {
5017 entry->value = talloc_strdup(entry, pszParmValue);
5018 if (!entry->value) {
5023 DLIST_ADD_END(stored_options, entry, struct lp_stored_option);
5028 static bool apply_lp_set_cmdline(void)
5030 struct lp_stored_option *entry = NULL;
5031 for (entry = stored_options; entry != NULL; entry = entry->next) {
5032 if (!lp_set_cmdline_helper(entry->label, entry->value, false)) {
5033 DEBUG(0, ("Failed to re-apply cmdline parameter %s = %s\n",
5034 entry->label, entry->value));
5041 /***************************************************************************
5042 Initialise the global parameter structure.
5043 ***************************************************************************/
5045 static void init_globals(bool reinit_globals)
5047 static bool done_init = False;
5051 /* If requested to initialize only once and we've already done it... */
5052 if (!reinit_globals && done_init) {
5053 /* ... then we have nothing more to do */
5058 /* The logfile can be set before this is invoked. Free it if so. */
5059 if (Globals.szLogFile != NULL) {
5060 string_free(&Globals.szLogFile);
5061 Globals.szLogFile = NULL;
5065 free_global_parameters();
5068 /* This memset and the free_global_parameters() above will
5069 * wipe out smb.conf options set with lp_set_cmdline(). The
5070 * apply_lp_set_cmdline() call puts these values back in the
5071 * table once the defaults are set */
5072 memset((void *)&Globals, '\0', sizeof(Globals));
5074 for (i = 0; parm_table[i].label; i++) {
5075 if ((parm_table[i].type == P_STRING ||
5076 parm_table[i].type == P_USTRING) &&
5079 string_set((char **)parm_table[i].ptr, "");
5083 string_set(&sDefault.fstype, FSTYPE_STRING);
5084 string_set(&sDefault.szPrintjobUsername, "%U");
5086 init_printer_values(&sDefault);
5089 DEBUG(3, ("Initialising global parameters\n"));
5091 string_set(&Globals.szSMBPasswdFile, get_dyn_SMB_PASSWD_FILE());
5092 string_set(&Globals.szPrivateDir, get_dyn_PRIVATE_DIR());
5094 /* use the new 'hash2' method by default, with a prefix of 1 */
5095 string_set(&Globals.szManglingMethod, "hash2");
5096 Globals.mangle_prefix = 1;
5098 string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
5100 /* using UTF8 by default allows us to support all chars */
5101 string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
5103 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
5104 /* If the system supports nl_langinfo(), try to grab the value
5105 from the user's locale */
5106 string_set(&Globals.display_charset, "LOCALE");
5108 string_set(&Globals.display_charset, DEFAULT_DISPLAY_CHARSET);
5111 /* Use codepage 850 as a default for the dos character set */
5112 string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
5115 * Allow the default PASSWD_CHAT to be overridden in local.h.
5117 string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
5119 set_global_myname(myhostname());
5120 string_set(&Globals.szNetbiosName,global_myname());
5122 set_global_myworkgroup(WORKGROUP);
5123 string_set(&Globals.szWorkgroup, lp_workgroup());
5125 string_set(&Globals.szPasswdProgram, "");
5126 string_set(&Globals.szLockDir, get_dyn_LOCKDIR());
5127 string_set(&Globals.szStateDir, get_dyn_STATEDIR());
5128 string_set(&Globals.szCacheDir, get_dyn_CACHEDIR());
5129 string_set(&Globals.szPidDir, get_dyn_PIDDIR());
5130 string_set(&Globals.szSocketAddress, "0.0.0.0");
5132 * By default support explicit binding to broadcast
5135 Globals.bNmbdBindExplicitBroadcast = true;
5137 if (asprintf(&s, "Samba %s", samba_version_string()) < 0) {
5138 smb_panic("init_globals: ENOMEM");
5140 string_set(&Globals.szServerString, s);
5142 if (asprintf(&s, "%d.%d", DEFAULT_MAJOR_VERSION,
5143 DEFAULT_MINOR_VERSION) < 0) {
5144 smb_panic("init_globals: ENOMEM");
5146 string_set(&Globals.szAnnounceVersion, s);
5149 string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
5152 string_set(&Globals.szSocketOptions, DEFAULT_SOCKET_OPTIONS);
5154 string_set(&Globals.szLogonDrive, "");
5155 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
5156 string_set(&Globals.szLogonHome, "\\\\%N\\%U");
5157 string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
5159 string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
5160 string_set(&Globals.szPasswordServer, "*");
5162 Globals.AlgorithmicRidBase = BASE_RID;
5164 Globals.bLoadPrinters = True;
5165 Globals.PrintcapCacheTime = 750; /* 12.5 minutes */
5167 Globals.ConfigBackend = config_backend;
5169 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
5170 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
5171 Globals.max_xmit = 0x4104;
5172 Globals.max_mux = 50; /* This is *needed* for profile support. */
5173 Globals.lpqcachetime = 30; /* changed to handle large print servers better -- jerry */
5174 Globals.bDisableSpoolss = False;
5175 Globals.iMaxSmbdProcesses = 0;/* no limit specified */
5176 Globals.pwordlevel = 0;
5177 Globals.unamelevel = 0;
5178 Globals.deadtime = 0;
5179 Globals.getwd_cache = true;
5180 Globals.bLargeReadwrite = True;
5181 Globals.max_log_size = 5000;
5182 Globals.max_open_files = max_open_files();
5183 Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
5184 Globals.maxprotocol = PROTOCOL_NT1;
5185 Globals.minprotocol = PROTOCOL_CORE;
5186 Globals.security = SEC_USER;
5187 Globals.paranoid_server_security = True;
5188 Globals.bEncryptPasswords = True;
5189 Globals.bUpdateEncrypt = False;
5190 Globals.clientSchannel = Auto;
5191 Globals.serverSchannel = Auto;
5192 Globals.bReadRaw = True;
5193 Globals.bWriteRaw = True;
5194 Globals.bNullPasswords = False;
5195 Globals.bObeyPamRestrictions = False;
5197 Globals.bSyslogOnly = False;
5198 Globals.bTimestampLogs = True;
5199 string_set(&Globals.szLogLevel, "0");
5200 Globals.bDebugPrefixTimestamp = False;
5201 Globals.bDebugHiresTimestamp = true;
5202 Globals.bDebugPid = False;
5203 Globals.bDebugUid = False;
5204 Globals.bDebugClass = False;
5205 Globals.bEnableCoreFiles = True;
5206 Globals.max_ttl = 60 * 60 * 24 * 3; /* 3 days default. */
5207 Globals.max_wins_ttl = 60 * 60 * 24 * 6; /* 6 days default. */
5208 Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
5209 Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
5210 Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
5211 Globals.lm_interval = 60;
5212 Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
5213 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
5214 Globals.bNISHomeMap = False;
5215 #ifdef WITH_NISPLUS_HOME
5216 string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
5218 string_set(&Globals.szNISHomeMapName, "auto.home");
5221 Globals.bTimeServer = False;
5222 Globals.bBindInterfacesOnly = False;
5223 Globals.bUnixPasswdSync = False;
5224 Globals.bPamPasswordChange = False;
5225 Globals.bPasswdChatDebug = False;
5226 Globals.iPasswdChatTimeout = 2; /* 2 second default. */
5227 Globals.bNTPipeSupport = True; /* Do NT pipes by default. */
5228 Globals.bNTStatusSupport = True; /* Use NT status by default. */
5229 Globals.bStatCache = True; /* use stat cache by default */
5230 Globals.iMaxStatCacheSize = 256; /* 256k by default */
5231 Globals.restrict_anonymous = 0;
5232 Globals.bClientLanManAuth = False; /* Do NOT use the LanMan hash if it is available */
5233 Globals.bClientPlaintextAuth = False; /* Do NOT use a plaintext password even if is requested by the server */
5234 Globals.bLanmanAuth = False; /* Do NOT use the LanMan hash, even if it is supplied */
5235 Globals.bNTLMAuth = True; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
5236 Globals.bClientNTLMv2Auth = False; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
5237 /* Note, that we will use NTLM2 session security (which is different), if it is available */
5239 Globals.map_to_guest = 0; /* By Default, "Never" */
5240 Globals.oplock_break_wait_time = 0; /* By Default, 0 msecs. */
5241 Globals.enhanced_browsing = true;
5242 Globals.iLockSpinTime = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
5243 #ifdef MMAP_BLACKLIST
5244 Globals.bUseMmap = False;
5246 Globals.bUseMmap = True;
5248 Globals.bUnixExtensions = True;
5249 Globals.bResetOnZeroVC = False;
5250 Globals.bLogWriteableFilesOnExit = False;
5251 Globals.bCreateKrb5Conf = true;
5253 /* hostname lookups can be very expensive and are broken on
5254 a large number of sites (tridge) */
5255 Globals.bHostnameLookups = False;
5257 string_set(&Globals.szPassdbBackend, "tdbsam");
5258 string_set(&Globals.szLdapSuffix, "");
5259 string_set(&Globals.szLdapMachineSuffix, "");
5260 string_set(&Globals.szLdapUserSuffix, "");
5261 string_set(&Globals.szLdapGroupSuffix, "");
5262 string_set(&Globals.szLdapIdmapSuffix, "");
5264 string_set(&Globals.szLdapAdminDn, "");
5265 Globals.ldap_ssl = LDAP_SSL_START_TLS;
5266 Globals.ldap_ssl_ads = False;
5267 Globals.ldap_deref = -1;
5268 Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
5269 Globals.ldap_delete_dn = False;
5270 Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
5271 Globals.ldap_follow_referral = Auto;
5272 Globals.ldap_timeout = LDAP_DEFAULT_TIMEOUT;
5273 Globals.ldap_connection_timeout = LDAP_CONNECTION_DEFAULT_TIMEOUT;
5274 Globals.ldap_page_size = LDAP_PAGE_SIZE;
5276 Globals.ldap_debug_level = 0;
5277 Globals.ldap_debug_threshold = 10;
5279 /* This is what we tell the afs client. in reality we set the token
5280 * to never expire, though, when this runs out the afs client will
5281 * forget the token. Set to 0 to get NEVERDATE.*/
5282 Globals.iAfsTokenLifetime = 604800;
5283 Globals.cups_connection_timeout = CUPS_DEFAULT_CONNECTION_TIMEOUT;
5285 /* these parameters are set to defaults that are more appropriate
5286 for the increasing samba install base:
5288 as a member of the workgroup, that will possibly become a
5289 _local_ master browser (lm = True). this is opposed to a forced
5290 local master browser startup (pm = True).
5292 doesn't provide WINS server service by default (wsupp = False),
5293 and doesn't provide domain master browser services by default, either.
5297 Globals.bMsAddPrinterWizard = True;
5298 Globals.os_level = 20;
5299 Globals.bLocalMaster = True;
5300 Globals.iDomainMaster = Auto; /* depending on bDomainLogons */
5301 Globals.bDomainLogons = False;
5302 Globals.bBrowseList = True;
5303 Globals.bWINSsupport = False;
5304 Globals.bWINSproxy = False;
5306 TALLOC_FREE(Globals.szInitLogonDelayedHosts);
5307 Globals.InitLogonDelay = 100; /* 100 ms default delay */
5309 Globals.bDNSproxy = True;
5311 /* this just means to use them if they exist */
5312 Globals.bKernelOplocks = True;
5314 Globals.bAllowTrustedDomains = True;
5315 string_set(&Globals.szIdmapBackend, "tdb");
5316 Globals.bIdmapReadOnly = false;
5318 string_set(&Globals.szTemplateShell, "/bin/false");
5319 string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
5320 string_set(&Globals.szWinbindSeparator, "\\");
5322 string_set(&Globals.szCupsServer, "");
5323 string_set(&Globals.szIPrintServer, "");
5325 string_set(&Globals.ctdbdSocket, "");
5326 Globals.szClusterAddresses = NULL;
5327 Globals.clustering = False;
5328 Globals.ctdb_timeout = 0;
5329 Globals.ctdb_locktime_warn_threshold = 0;
5331 Globals.winbind_cache_time = 300; /* 5 minutes */
5332 Globals.winbind_reconnect_delay = 30; /* 30 seconds */
5333 Globals.winbind_max_clients = 200;
5334 Globals.bWinbindEnumUsers = False;
5335 Globals.bWinbindEnumGroups = False;
5336 Globals.bWinbindUseDefaultDomain = False;
5337 Globals.bWinbindTrustedDomainsOnly = False;
5338 Globals.bWinbindNestedGroups = True;
5339 Globals.winbind_expand_groups = 1;
5340 Globals.szWinbindNssInfo = str_list_make_v3(NULL, "template", NULL);
5341 Globals.bWinbindRefreshTickets = False;
5342 Globals.bWinbindOfflineLogon = False;
5344 Globals.iIdmapCacheTime = 86400 * 7; /* a week by default */
5345 Globals.iIdmapNegativeCacheTime = 120; /* 2 minutes by default */
5347 Globals.bPassdbExpandExplicit = False;
5349 Globals.name_cache_timeout = 660; /* In seconds */
5351 Globals.bUseSpnego = True;
5352 Globals.bClientUseSpnego = True;
5354 Globals.client_signing = Auto;
5355 Globals.server_signing = False;
5357 Globals.bDeferSharingViolations = True;
5358 string_set(&Globals.smb_ports, SMB_PORTS);
5360 Globals.bEnablePrivileges = True;
5361 Globals.bHostMSDfs = True;
5362 Globals.bASUSupport = False;
5364 /* User defined shares. */
5365 if (asprintf(&s, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5366 smb_panic("init_globals: ENOMEM");
5368 string_set(&Globals.szUsersharePath, s);
5370 string_set(&Globals.szUsershareTemplateShare, "");
5371 Globals.iUsershareMaxShares = 0;
5372 /* By default disallow sharing of directories not owned by the sharer. */
5373 Globals.bUsershareOwnerOnly = True;
5374 /* By default disallow guest access to usershares. */
5375 Globals.bUsershareAllowGuests = False;
5377 Globals.iKeepalive = DEFAULT_KEEPALIVE;
5379 /* By default no shares out of the registry */
5380 Globals.bRegistryShares = False;
5382 Globals.iminreceivefile = 0;
5384 Globals.bMapUntrustedToDomain = false;
5385 Globals.bMulticastDnsRegister = true;
5387 Globals.ismb2_max_read = 1024*1024;
5388 Globals.ismb2_max_write = 1024*1024;
5389 Globals.ismb2_max_trans = 1024*1024;
5391 string_set(&Globals.ncalrpc_dir, get_dyn_NCALRPCDIR());
5393 /* Now put back the settings that were set with lp_set_cmdline() */
5394 apply_lp_set_cmdline();
5397 /*******************************************************************
5398 Convenience routine to grab string parameters into temporary memory
5399 and run standard_sub_basic on them. The buffers can be written to by
5400 callers without affecting the source string.
5401 ********************************************************************/
5403 static char *lp_string(const char *s)
5406 TALLOC_CTX *ctx = talloc_tos();
5408 /* The follow debug is useful for tracking down memory problems
5409 especially if you have an inner loop that is calling a lp_*()
5410 function that returns a string. Perhaps this debug should be
5411 present all the time? */
5414 DEBUG(10, ("lp_string(%s)\n", s));
5420 ret = talloc_sub_basic(ctx,
5421 get_current_username(),
5422 current_user_info.domain,
5424 if (trim_char(ret, '\"', '\"')) {
5425 if (strchr(ret,'\"') != NULL) {
5427 ret = talloc_sub_basic(ctx,
5428 get_current_username(),
5429 current_user_info.domain,
5437 In this section all the functions that are used to access the
5438 parameters from the rest of the program are defined
5441 #define FN_GLOBAL_STRING(fn_name,ptr) \
5442 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
5443 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5444 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
5445 #define FN_GLOBAL_LIST(fn_name,ptr) \
5446 const char **fn_name(void) {return(*(const char ***)(ptr));}
5447 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5448 bool fn_name(void) {return(*(bool *)(ptr));}
5449 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5450 char fn_name(void) {return(*(char *)(ptr));}
5451 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5452 int fn_name(void) {return(*(int *)(ptr));}
5454 #define FN_LOCAL_STRING(fn_name,val) \
5455 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5456 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5457 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5458 #define FN_LOCAL_LIST(fn_name,val) \
5459 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5460 #define FN_LOCAL_BOOL(fn_name,val) \
5461 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5462 #define FN_LOCAL_INTEGER(fn_name,val) \
5463 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5465 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5466 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5467 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5468 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5469 #define FN_LOCAL_CHAR(fn_name,val) \
5470 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5472 FN_GLOBAL_STRING(lp_smb_ports, &Globals.smb_ports)
5473 FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset)
5474 FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset)
5475 FN_GLOBAL_STRING(lp_display_charset, &Globals.display_charset)
5476 FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile)
5477 FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
5478 FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
5479 FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)
5480 FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString)
5481 FN_GLOBAL_INTEGER(lp_printcap_cache_time, &Globals.PrintcapCacheTime)
5482 FN_GLOBAL_STRING(lp_addport_cmd, &Globals.szAddPortCommand)
5483 FN_GLOBAL_STRING(lp_enumports_cmd, &Globals.szEnumPortsCommand)
5484 FN_GLOBAL_STRING(lp_addprinter_cmd, &Globals.szAddPrinterCommand)
5485 FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
5486 FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap)
5487 FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
5488 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5489 * build process or in smb.conf, we use that value. Otherwise they
5490 * default to the value of lp_lockdir(). */
5491 char *lp_statedir(void) {
5492 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5493 (strcmp(get_dyn_STATEDIR(), Globals.szStateDir) != 0))
5494 return(lp_string(*(char **)(&Globals.szStateDir) ?
5495 *(char **)(&Globals.szStateDir) : ""));
5497 return(lp_string(*(char **)(&Globals.szLockDir) ?
5498 *(char **)(&Globals.szLockDir) : ""));
5500 char *lp_cachedir(void) {
5501 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5502 (strcmp(get_dyn_CACHEDIR(), Globals.szCacheDir) != 0))
5503 return(lp_string(*(char **)(&Globals.szCacheDir) ?
5504 *(char **)(&Globals.szCacheDir) : ""));
5506 return(lp_string(*(char **)(&Globals.szLockDir) ?
5507 *(char **)(&Globals.szLockDir) : ""));
5509 FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
5510 FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
5511 FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
5512 FN_GLOBAL_STRING(lp_utmpdir, &Globals.szUtmpDir)
5513 FN_GLOBAL_STRING(lp_wtmpdir, &Globals.szWtmpDir)
5514 FN_GLOBAL_BOOL(lp_utmp, &Globals.bUtmp)
5515 FN_GLOBAL_STRING(lp_rootdir, &Globals.szRootdir)
5516 FN_GLOBAL_STRING(lp_perfcount_module, &Globals.szSMBPerfcountModule)
5517 FN_GLOBAL_STRING(lp_defaultservice, &Globals.szDefaultService)
5518 FN_GLOBAL_STRING(lp_msg_command, &Globals.szMsgCommand)
5519 FN_GLOBAL_STRING(lp_get_quota_command, &Globals.szGetQuota)
5520 FN_GLOBAL_STRING(lp_set_quota_command, &Globals.szSetQuota)
5521 FN_GLOBAL_STRING(lp_auto_services, &Globals.szAutoServices)
5522 FN_GLOBAL_STRING(lp_passwd_program, &Globals.szPasswdProgram)
5523 FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat)
5524 FN_GLOBAL_STRING(lp_passwordserver, &Globals.szPasswordServer)
5525 FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
5526 FN_GLOBAL_STRING(lp_realm, &Globals.szRealm)
5527 FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap)
5528 FN_GLOBAL_INTEGER(lp_afs_token_lifetime, &Globals.iAfsTokenLifetime)
5529 FN_GLOBAL_STRING(lp_log_nt_token_command, &Globals.szLogNtTokenCommand)
5530 FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap)
5531 FN_GLOBAL_CONST_STRING(lp_logon_script, &Globals.szLogonScript)
5532 FN_GLOBAL_CONST_STRING(lp_logon_path, &Globals.szLogonPath)
5533 FN_GLOBAL_CONST_STRING(lp_logon_drive, &Globals.szLogonDrive)
5534 FN_GLOBAL_CONST_STRING(lp_logon_home, &Globals.szLogonHome)
5535 FN_GLOBAL_STRING(lp_remote_announce, &Globals.szRemoteAnnounce)
5536 FN_GLOBAL_STRING(lp_remote_browse_sync, &Globals.szRemoteBrowseSync)
5537 FN_GLOBAL_BOOL(lp_nmbd_bind_explicit_broadcast, &Globals.bNmbdBindExplicitBroadcast)
5538 FN_GLOBAL_LIST(lp_wins_server_list, &Globals.szWINSservers)
5539 FN_GLOBAL_LIST(lp_interfaces, &Globals.szInterfaces)
5540 FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName)
5541 static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
5542 FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
5543 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
5544 * lp_passdb_backend() should be replace by the this macro again after
5547 const char *lp_passdb_backend(void)
5549 char *delim, *quote;
5551 delim = strchr( Globals.szPassdbBackend, ' ');
5552 /* no space at all */
5553 if (delim == NULL) {
5557 quote = strchr(Globals.szPassdbBackend, '"');
5558 /* no quote char or non in the first part */
5559 if (quote == NULL || quote > delim) {
5564 quote = strchr(quote+1, '"');
5565 if (quote == NULL) {
5566 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
5568 } else if (*(quote+1) == '\0') {
5569 /* space, fitting quote char, and one backend only */
5572 /* terminate string after the fitting quote char */
5577 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5578 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5579 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5580 "backend (%s) is used. The rest is ignored.\n", Globals.szPassdbBackend));
5583 return Globals.szPassdbBackend;
5585 FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
5586 FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
5587 FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
5588 FN_GLOBAL_STRING(lp_renameuser_script, &Globals.szRenameUserScript)
5589 FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
5591 FN_GLOBAL_CONST_STRING(lp_guestaccount, &Globals.szGuestaccount)
5592 FN_GLOBAL_STRING(lp_addgroup_script, &Globals.szAddGroupScript)
5593 FN_GLOBAL_STRING(lp_delgroup_script, &Globals.szDelGroupScript)
5594 FN_GLOBAL_STRING(lp_addusertogroup_script, &Globals.szAddUserToGroupScript)
5595 FN_GLOBAL_STRING(lp_deluserfromgroup_script, &Globals.szDelUserFromGroupScript)
5596 FN_GLOBAL_STRING(lp_setprimarygroup_script, &Globals.szSetPrimaryGroupScript)
5598 FN_GLOBAL_STRING(lp_addmachine_script, &Globals.szAddMachineScript)
5600 FN_GLOBAL_STRING(lp_shutdown_script, &Globals.szShutdownScript)
5601 FN_GLOBAL_STRING(lp_abort_shutdown_script, &Globals.szAbortShutdownScript)
5602 FN_GLOBAL_STRING(lp_username_map_script, &Globals.szUsernameMapScript)
5603 FN_GLOBAL_INTEGER(lp_username_map_cache_time, &Globals.iUsernameMapCacheTime)
5605 FN_GLOBAL_STRING(lp_check_password_script, &Globals.szCheckPasswordScript)
5607 FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
5608 FN_GLOBAL_CONST_STRING(lp_template_homedir, &Globals.szTemplateHomedir)
5609 FN_GLOBAL_CONST_STRING(lp_template_shell, &Globals.szTemplateShell)
5610 FN_GLOBAL_CONST_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
5611 FN_GLOBAL_INTEGER(lp_acl_compatibility, &Globals.iAclCompat)
5612 FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
5613 FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
5614 FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
5615 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, &Globals.bWinbindTrustedDomainsOnly)
5616 FN_GLOBAL_BOOL(lp_winbind_nested_groups, &Globals.bWinbindNestedGroups)
5617 FN_GLOBAL_INTEGER(lp_winbind_expand_groups, &Globals.winbind_expand_groups)
5618 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets, &Globals.bWinbindRefreshTickets)
5619 FN_GLOBAL_BOOL(lp_winbind_offline_logon, &Globals.bWinbindOfflineLogon)
5620 FN_GLOBAL_BOOL(lp_winbind_normalize_names, &Globals.bWinbindNormalizeNames)
5621 FN_GLOBAL_BOOL(lp_winbind_rpc_only, &Globals.bWinbindRpcOnly)
5622 FN_GLOBAL_BOOL(lp_create_krb5_conf, &Globals.bCreateKrb5Conf)
5624 FN_GLOBAL_CONST_STRING(lp_idmap_backend, &Globals.szIdmapBackend)
5625 FN_GLOBAL_BOOL(lp_idmap_read_only, &Globals.bIdmapReadOnly)
5626 FN_GLOBAL_INTEGER(lp_idmap_cache_time, &Globals.iIdmapCacheTime)
5627 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time, &Globals.iIdmapNegativeCacheTime)
5628 FN_GLOBAL_INTEGER(lp_keepalive, &Globals.iKeepalive)
5629 FN_GLOBAL_BOOL(lp_passdb_expand_explicit, &Globals.bPassdbExpandExplicit)
5631 FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix)
5632 FN_GLOBAL_STRING(lp_ldap_admin_dn, &Globals.szLdapAdminDn)
5633 FN_GLOBAL_INTEGER(lp_ldap_ssl, &Globals.ldap_ssl)
5634 FN_GLOBAL_BOOL(lp_ldap_ssl_ads, &Globals.ldap_ssl_ads)
5635 FN_GLOBAL_INTEGER(lp_ldap_deref, &Globals.ldap_deref)
5636 FN_GLOBAL_INTEGER(lp_ldap_follow_referral, &Globals.ldap_follow_referral)
5637 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, &Globals.ldap_passwd_sync)
5638 FN_GLOBAL_BOOL(lp_ldap_delete_dn, &Globals.ldap_delete_dn)
5639 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep, &Globals.ldap_replication_sleep)
5640 FN_GLOBAL_INTEGER(lp_ldap_timeout, &Globals.ldap_timeout)
5641 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout, &Globals.ldap_connection_timeout)
5642 FN_GLOBAL_INTEGER(lp_ldap_page_size, &Globals.ldap_page_size)
5643 FN_GLOBAL_INTEGER(lp_ldap_debug_level, &Globals.ldap_debug_level)
5644 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold, &Globals.ldap_debug_threshold)
5645 FN_GLOBAL_STRING(lp_add_share_cmd, &Globals.szAddShareCommand)
5646 FN_GLOBAL_STRING(lp_change_share_cmd, &Globals.szChangeShareCommand)
5647 FN_GLOBAL_STRING(lp_delete_share_cmd, &Globals.szDeleteShareCommand)
5648 FN_GLOBAL_STRING(lp_usershare_path, &Globals.szUsersharePath)
5649 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list, &Globals.szUsersharePrefixAllowList)
5650 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list, &Globals.szUsersharePrefixDenyList)
5652 FN_GLOBAL_LIST(lp_eventlog_list, &Globals.szEventLogs)
5654 FN_GLOBAL_BOOL(lp_registry_shares, &Globals.bRegistryShares)
5655 FN_GLOBAL_BOOL(lp_usershare_allow_guests, &Globals.bUsershareAllowGuests)
5656 FN_GLOBAL_BOOL(lp_usershare_owner_only, &Globals.bUsershareOwnerOnly)
5657 FN_GLOBAL_BOOL(lp_disable_netbios, &Globals.bDisableNetbios)
5658 FN_GLOBAL_BOOL(lp_reset_on_zero_vc, &Globals.bResetOnZeroVC)
5659 FN_GLOBAL_BOOL(lp_log_writeable_files_on_exit,
5660 &Globals.bLogWriteableFilesOnExit)
5661 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, &Globals.bMsAddPrinterWizard)
5662 FN_GLOBAL_BOOL(lp_dns_proxy, &Globals.bDNSproxy)
5663 FN_GLOBAL_BOOL(lp_wins_support, &Globals.bWINSsupport)
5664 FN_GLOBAL_BOOL(lp_we_are_a_wins_server, &Globals.bWINSsupport)
5665 FN_GLOBAL_BOOL(lp_wins_proxy, &Globals.bWINSproxy)
5666 FN_GLOBAL_BOOL(lp_local_master, &Globals.bLocalMaster)
5667 FN_GLOBAL_BOOL(lp_domain_logons, &Globals.bDomainLogons)
5668 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts, &Globals.szInitLogonDelayedHosts)
5669 FN_GLOBAL_INTEGER(lp_init_logon_delay, &Globals.InitLogonDelay)
5670 FN_GLOBAL_BOOL(lp_load_printers, &Globals.bLoadPrinters)
5671 FN_GLOBAL_BOOL(_lp_readraw, &Globals.bReadRaw)
5672 FN_GLOBAL_BOOL(lp_large_readwrite, &Globals.bLargeReadwrite)
5673 FN_GLOBAL_BOOL(_lp_writeraw, &Globals.bWriteRaw)
5674 FN_GLOBAL_BOOL(lp_null_passwords, &Globals.bNullPasswords)
5675 FN_GLOBAL_BOOL(lp_obey_pam_restrictions, &Globals.bObeyPamRestrictions)
5676 FN_GLOBAL_BOOL(lp_encrypted_passwords, &Globals.bEncryptPasswords)
5677 FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
5678 FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
5679 FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
5680 FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
5681 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, &Globals.bDebugPrefixTimestamp)
5682 FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
5683 FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
5684 FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
5685 FN_GLOBAL_BOOL(lp_debug_class, &Globals.bDebugClass)
5686 FN_GLOBAL_BOOL(lp_enable_core_files, &Globals.bEnableCoreFiles)
5687 FN_GLOBAL_BOOL(lp_browse_list, &Globals.bBrowseList)
5688 FN_GLOBAL_BOOL(lp_nis_home_map, &Globals.bNISHomeMap)
5689 static FN_GLOBAL_BOOL(lp_time_server, &Globals.bTimeServer)
5690 FN_GLOBAL_BOOL(lp_bind_interfaces_only, &Globals.bBindInterfacesOnly)
5691 FN_GLOBAL_BOOL(lp_pam_password_change, &Globals.bPamPasswordChange)
5692 FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)
5693 FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)
5694 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout)
5695 FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport)
5696 FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)
5697 FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache)
5698 FN_GLOBAL_INTEGER(lp_max_stat_cache_size, &Globals.iMaxStatCacheSize)
5699 FN_GLOBAL_BOOL(lp_allow_trusted_domains, &Globals.bAllowTrustedDomains)
5700 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain, &Globals.bMapUntrustedToDomain)
5701 FN_GLOBAL_INTEGER(lp_restrict_anonymous, &Globals.restrict_anonymous)
5702 FN_GLOBAL_BOOL(lp_lanman_auth, &Globals.bLanmanAuth)
5703 FN_GLOBAL_BOOL(lp_ntlm_auth, &Globals.bNTLMAuth)
5704 FN_GLOBAL_BOOL(lp_client_plaintext_auth, &Globals.bClientPlaintextAuth)
5705 FN_GLOBAL_BOOL(lp_client_lanman_auth, &Globals.bClientLanManAuth)
5706 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, &Globals.bClientNTLMv2Auth)
5707 FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
5708 FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
5709 FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
5710 FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
5711 FN_GLOBAL_BOOL(lp_unix_extensions, &Globals.bUnixExtensions)
5712 FN_GLOBAL_BOOL(lp_use_spnego, &Globals.bUseSpnego)
5713 FN_GLOBAL_BOOL(lp_client_use_spnego, &Globals.bClientUseSpnego)
5714 FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups)
5715 FN_LOCAL_PARM_BOOL(lp_change_notify, bChangeNotify)
5716 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify, bKernelChangeNotify)
5717 FN_GLOBAL_STRING(lp_dedicated_keytab_file, &Globals.szDedicatedKeytabFile)
5718 FN_GLOBAL_INTEGER(lp_kerberos_method, &Globals.iKerberosMethod)
5719 FN_GLOBAL_BOOL(lp_defer_sharing_violations, &Globals.bDeferSharingViolations)
5720 FN_GLOBAL_BOOL(lp_enable_privileges, &Globals.bEnablePrivileges)
5721 FN_GLOBAL_BOOL(lp_enable_asu_support, &Globals.bASUSupport)
5722 FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
5723 FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
5724 FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
5725 FN_GLOBAL_INTEGER(lp_min_wins_ttl, &Globals.min_wins_ttl)
5726 FN_GLOBAL_INTEGER(lp_max_log_size, &Globals.max_log_size)
5727 FN_GLOBAL_INTEGER(lp_max_open_files, &Globals.max_open_files)
5728 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size, &Globals.open_files_db_hash_size)
5729 FN_GLOBAL_INTEGER(lp_maxxmit, &Globals.max_xmit)
5730 FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux)
5731 FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel)
5732 FN_GLOBAL_INTEGER(lp_usernamelevel, &Globals.unamelevel)
5733 FN_GLOBAL_INTEGER(lp_deadtime, &Globals.deadtime)
5734 FN_GLOBAL_BOOL(lp_getwd_cache, &Globals.getwd_cache)
5735 FN_GLOBAL_INTEGER(lp_maxprotocol, &Globals.maxprotocol)
5736 FN_GLOBAL_INTEGER(lp_minprotocol, &Globals.minprotocol)
5737 FN_GLOBAL_INTEGER(lp_security, &Globals.security)
5738 FN_GLOBAL_LIST(lp_auth_methods, &Globals.AuthMethods)
5739 FN_GLOBAL_BOOL(lp_paranoid_server_security, &Globals.paranoid_server_security)
5740 FN_GLOBAL_INTEGER(lp_maxdisksize, &Globals.maxdisksize)
5741 FN_GLOBAL_INTEGER(lp_lpqcachetime, &Globals.lpqcachetime)
5742 FN_GLOBAL_INTEGER(lp_max_smbd_processes, &Globals.iMaxSmbdProcesses)
5743 FN_GLOBAL_BOOL(_lp_disable_spoolss, &Globals.bDisableSpoolss)
5744 FN_GLOBAL_INTEGER(lp_syslog, &Globals.syslog)
5745 static FN_GLOBAL_INTEGER(lp_announce_as, &Globals.announce_as)
5746 FN_GLOBAL_INTEGER(lp_lm_announce, &Globals.lm_announce)
5747 FN_GLOBAL_INTEGER(lp_lm_interval, &Globals.lm_interval)
5748 FN_GLOBAL_INTEGER(lp_machine_password_timeout, &Globals.machine_password_timeout)
5749 FN_GLOBAL_INTEGER(lp_map_to_guest, &Globals.map_to_guest)
5750 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time)
5751 FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime)
5752 FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares)
5753 FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions)
5754 FN_GLOBAL_INTEGER(lp_config_backend, &Globals.ConfigBackend)
5755 FN_GLOBAL_INTEGER(lp_smb2_max_read, &Globals.ismb2_max_read)
5756 FN_GLOBAL_INTEGER(lp_smb2_max_write, &Globals.ismb2_max_write)
5757 FN_GLOBAL_INTEGER(lp_smb2_max_trans, &Globals.ismb2_max_trans)
5759 FN_LOCAL_STRING(lp_preexec, szPreExec)
5760 FN_LOCAL_STRING(lp_postexec, szPostExec)
5761 FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
5762 FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
5763 FN_LOCAL_STRING(lp_servicename, szService)
5764 FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
5765 FN_LOCAL_STRING(lp_pathname, szPath)
5766 FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
5767 FN_LOCAL_STRING(lp_username, szUsername)
5768 FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers)
5769 FN_LOCAL_LIST(lp_valid_users, szValidUsers)
5770 FN_LOCAL_LIST(lp_admin_users, szAdminUsers)
5771 FN_GLOBAL_LIST(lp_svcctl_list, &Globals.szServicesList)
5772 FN_LOCAL_STRING(lp_cups_options, szCupsOptions)
5773 FN_GLOBAL_STRING(lp_cups_server, &Globals.szCupsServer)
5774 int lp_cups_encrypt(void)
5777 #ifdef HAVE_HTTPCONNECTENCRYPT
5778 switch (Globals.CupsEncrypt) {
5780 result = HTTP_ENCRYPT_REQUIRED;
5783 result = HTTP_ENCRYPT_ALWAYS;
5786 result = HTTP_ENCRYPT_NEVER;
5792 FN_GLOBAL_STRING(lp_iprint_server, &Globals.szIPrintServer)
5793 FN_GLOBAL_INTEGER(lp_cups_connection_timeout, &Globals.cups_connection_timeout)
5794 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket, &Globals.ctdbdSocket)
5795 FN_GLOBAL_LIST(lp_cluster_addresses, &Globals.szClusterAddresses)
5796 FN_GLOBAL_BOOL(lp_clustering, &Globals.clustering)
5797 FN_GLOBAL_INTEGER(lp_ctdb_timeout, &Globals.ctdb_timeout)
5798 FN_GLOBAL_INTEGER(lp_ctdb_locktime_warn_threshold, &Globals.ctdb_locktime_warn_threshold)
5799 FN_LOCAL_STRING(lp_printcommand, szPrintcommand)
5800 FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand)
5801 FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand)
5802 FN_LOCAL_STRING(lp_lppausecommand, szLppausecommand)
5803 FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
5804 FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
5805 FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
5806 static FN_LOCAL_STRING(_lp_printername, szPrintername)
5807 FN_LOCAL_CONST_STRING(lp_printjob_username, szPrintjobUsername)
5808 FN_LOCAL_LIST(lp_hostsallow, szHostsallow)
5809 FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny)
5810 FN_LOCAL_STRING(lp_magicscript, szMagicScript)
5811 FN_LOCAL_STRING(lp_magicoutput, szMagicOutput)
5812 FN_LOCAL_STRING(lp_comment, comment)
5813 FN_LOCAL_STRING(lp_force_user, force_user)
5814 FN_LOCAL_STRING(lp_force_group, force_group)
5815 FN_LOCAL_LIST(lp_readlist, readlist)
5816 FN_LOCAL_LIST(lp_writelist, writelist)
5817 FN_LOCAL_LIST(lp_printer_admin, printer_admin)
5818 FN_LOCAL_STRING(lp_fstype, fstype)
5819 FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects)
5820 FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
5821 static FN_LOCAL_STRING(lp_volume, volume)
5822 FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
5823 FN_LOCAL_STRING(lp_hide_files, szHideFiles)
5824 FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
5825 FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
5826 FN_LOCAL_STRING(lp_aio_write_behind, szAioWriteBehind)
5827 FN_LOCAL_STRING(lp_dfree_command, szDfree)
5828 FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
5829 FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
5830 FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
5831 FN_LOCAL_INTEGER(lp_casesensitive, iCaseSensitive)
5832 FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
5833 FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
5834 FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
5835 FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles)
5836 FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable)
5837 FN_LOCAL_BOOL(lp_hideunwriteable_files, bHideUnWriteableFiles)
5838 FN_LOCAL_BOOL(lp_browseable, bBrowseable)
5839 FN_LOCAL_BOOL(lp_access_based_share_enum, bAccessBasedShareEnum)
5840 FN_LOCAL_BOOL(lp_readonly, bRead_only)
5841 FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir)
5842 FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok)
5843 FN_LOCAL_BOOL(lp_guest_only, bGuest_only)
5844 FN_LOCAL_BOOL(lp_administrative_share, bAdministrative_share)
5845 FN_LOCAL_BOOL(lp_print_ok, bPrint_ok)
5846 FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
5847 FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
5848 FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes)
5849 FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport)
5850 FN_LOCAL_PARM_BOOL(lp_locking, bLocking)
5851 FN_LOCAL_PARM_INTEGER(lp_strict_locking, iStrictLocking)
5852 FN_LOCAL_PARM_BOOL(lp_posix_locking, bPosixLocking)
5853 FN_LOCAL_BOOL(lp_share_modes, bShareModes)
5854 FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
5855 FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
5856 FN_LOCAL_BOOL(lp_onlyuser, bOnlyUser)
5857 FN_LOCAL_PARM_BOOL(lp_manglednames, bMangledNames)
5858 FN_LOCAL_BOOL(lp_symlinks, bSymlinks)
5859 FN_LOCAL_BOOL(lp_syncalways, bSyncAlways)
5860 FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate)
5861 FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
5862 FN_LOCAL_BOOL(lp_map_system, bMap_system)
5863 FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly)
5864 FN_LOCAL_BOOL(lp_fake_oplocks, bFakeOplocks)
5865 FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles)
5866 FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode)
5867 FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes)
5868 FN_LOCAL_BOOL(lp_dos_filetime_resolution, bDosFiletimeResolution)
5869 FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes)
5870 FN_GLOBAL_BOOL(lp_async_smb_echo_handler, &Globals.bAsyncSMBEchoHandler)
5871 FN_GLOBAL_BOOL(lp_multicast_dns_register, &Globals.bMulticastDnsRegister)
5872 FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks)
5873 FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms)
5874 FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS)
5875 FN_LOCAL_BOOL(lp_inherit_owner, bInheritOwner)
5876 FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver)
5877 FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode)
5878 FN_LOCAL_BOOL(lp_force_printername, bForcePrintername)
5879 FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport)
5880 FN_LOCAL_BOOL(lp_force_unknown_acl_user, bForceUnknownAclUser)
5881 FN_LOCAL_BOOL(lp_ea_support, bEASupport)
5882 FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile)
5883 FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls)
5884 FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit)
5885 FN_LOCAL_BOOL(lp_afs_share, bAfs_Share)
5886 FN_LOCAL_BOOL(lp_acl_check_permissions, bAclCheckPermissions)
5887 FN_LOCAL_BOOL(lp_acl_group_control, bAclGroupControl)
5888 FN_LOCAL_BOOL(lp_acl_map_full_control, bAclMapFullControl)
5889 FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask)
5890 FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode)
5891 FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask)
5892 FN_LOCAL_INTEGER(lp_force_security_mode, iSecurity_force_mode)
5893 FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask)
5894 FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode)
5895 FN_LOCAL_INTEGER(lp_dir_security_mask, iDir_Security_mask)
5896 FN_LOCAL_INTEGER(lp_force_dir_security_mode, iDir_Security_force_mode)
5897 FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections)
5898 FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
5899 FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
5900 FN_LOCAL_INTEGER(lp_printing, iPrinting)
5901 FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
5902 FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
5903 FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
5904 FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
5905 FN_LOCAL_INTEGER(lp_block_size, iBlock_size)
5906 FN_LOCAL_INTEGER(lp_dfree_cache_time, iDfreeCacheTime)
5907 FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size)
5908 FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize)
5909 FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize)
5910 FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly)
5911 FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize)
5912 FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt)
5913 FN_LOCAL_CHAR(lp_magicchar, magic_char)
5914 FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
5915 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay, &Globals.winbind_reconnect_delay)
5916 FN_GLOBAL_INTEGER(lp_winbind_max_clients, &Globals.winbind_max_clients)
5917 FN_GLOBAL_LIST(lp_winbind_nss_info, &Globals.szWinbindNssInfo)
5918 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
5919 FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
5920 FN_GLOBAL_INTEGER(lp_client_signing, &Globals.client_signing)
5921 FN_GLOBAL_INTEGER(lp_server_signing, &Globals.server_signing)
5922 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping, &Globals.client_ldap_sasl_wrapping)
5924 FN_GLOBAL_STRING(lp_ncalrpc_dir, &Globals.ncalrpc_dir)
5926 /* local prototypes */
5928 static int map_parameter_canonical(const char *pszParmName, bool *inverse);
5929 static const char *get_boolean(bool bool_value);
5930 static int getservicebyname(const char *pszServiceName,
5931 struct service *pserviceDest);
5932 static void copy_service(struct service *pserviceDest,
5933 struct service *pserviceSource,
5934 struct bitmap *pcopymapDest);
5935 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
5937 static bool do_section(const char *pszSectionName, void *userdata);
5938 static void init_copymap(struct service *pservice);
5939 static bool hash_a_service(const char *name, int number);
5940 static void free_service_byindex(int iService);
5941 static void free_param_opts(struct param_opt_struct **popts);
5942 static void show_parameter(int parmIndex);
5943 static bool is_synonym_of(int parm1, int parm2, bool *inverse);
5946 * This is a helper function for parametrical options support. It returns a
5947 * pointer to parametrical option value if it exists or NULL otherwise. Actual
5948 * parametrical functions are quite simple
5950 static struct param_opt_struct *get_parametrics(int snum, const char *type,
5953 bool global_section = False;
5955 struct param_opt_struct *data;
5957 if (snum >= iNumServices) return NULL;
5960 data = Globals.param_opt;
5961 global_section = True;
5963 data = ServicePtrs[snum]->param_opt;
5966 if (asprintf(¶m_key, "%s:%s", type, option) == -1) {
5967 DEBUG(0,("asprintf failed!\n"));
5972 if (strwicmp(data->key, param_key) == 0) {
5973 string_free(¶m_key);
5979 if (!global_section) {
5980 /* Try to fetch the same option but from globals */
5981 /* but only if we are not already working with Globals */
5982 data = Globals.param_opt;
5984 if (strwicmp(data->key, param_key) == 0) {
5985 string_free(¶m_key);
5992 string_free(¶m_key);
5998 #define MISSING_PARAMETER(name) \
5999 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
6001 /*******************************************************************
6002 convenience routine to return int parameters.
6003 ********************************************************************/
6004 static int lp_int(const char *s)
6008 MISSING_PARAMETER(lp_int);
6012 return (int)strtol(s, NULL, 0);
6015 /*******************************************************************
6016 convenience routine to return unsigned long parameters.
6017 ********************************************************************/
6018 static unsigned long lp_ulong(const char *s)
6022 MISSING_PARAMETER(lp_ulong);
6026 return strtoul(s, NULL, 0);
6029 /*******************************************************************
6030 convenience routine to return boolean parameters.
6031 ********************************************************************/
6032 static bool lp_bool(const char *s)
6037 MISSING_PARAMETER(lp_bool);
6041 if (!set_boolean(s, &ret)) {
6042 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
6049 /*******************************************************************
6050 convenience routine to return enum parameters.
6051 ********************************************************************/
6052 static int lp_enum(const char *s,const struct enum_list *_enum)
6056 if (!s || !*s || !_enum) {
6057 MISSING_PARAMETER(lp_enum);
6061 for (i=0; _enum[i].name; i++) {
6062 if (strequal(_enum[i].name,s))
6063 return _enum[i].value;
6066 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
6070 #undef MISSING_PARAMETER
6072 /* DO NOT USE lp_parm_string ANYMORE!!!!
6073 * use lp_parm_const_string or lp_parm_talloc_string
6075 * lp_parm_string is only used to let old modules find this symbol
6077 #undef lp_parm_string
6078 char *lp_parm_string(const char *servicename, const char *type, const char *option);
6079 char *lp_parm_string(const char *servicename, const char *type, const char *option)
6081 return lp_parm_talloc_string(lp_servicenumber(servicename), type, option, NULL);
6084 /* Return parametric option from a given service. Type is a part of option before ':' */
6085 /* Parametric option has following syntax: 'Type: option = value' */
6086 /* the returned value is talloced on the talloc_tos() */
6087 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def)
6089 struct param_opt_struct *data = get_parametrics(snum, type, option);
6091 if (data == NULL||data->value==NULL) {
6093 return lp_string(def);
6099 return lp_string(data->value);
6102 /* Return parametric option from a given service. Type is a part of option before ':' */
6103 /* Parametric option has following syntax: 'Type: option = value' */
6104 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
6106 struct param_opt_struct *data = get_parametrics(snum, type, option);
6108 if (data == NULL||data->value==NULL)
6114 /* Return parametric option from a given service. Type is a part of option before ':' */
6115 /* Parametric option has following syntax: 'Type: option = value' */
6117 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
6119 struct param_opt_struct *data = get_parametrics(snum, type, option);
6121 if (data == NULL||data->value==NULL)
6122 return (const char **)def;
6124 if (data->list==NULL) {
6125 data->list = str_list_make_v3(NULL, data->value, NULL);
6128 return (const char **)data->list;
6131 /* Return parametric option from a given service. Type is a part of option before ':' */
6132 /* Parametric option has following syntax: 'Type: option = value' */
6134 int lp_parm_int(int snum, const char *type, const char *option, int def)
6136 struct param_opt_struct *data = get_parametrics(snum, type, option);
6138 if (data && data->value && *data->value)
6139 return lp_int(data->value);
6144 /* Return parametric option from a given service. Type is a part of option before ':' */
6145 /* Parametric option has following syntax: 'Type: option = value' */
6147 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
6149 struct param_opt_struct *data = get_parametrics(snum, type, option);
6151 if (data && data->value && *data->value)
6152 return lp_ulong(data->value);
6157 /* Return parametric option from a given service. Type is a part of option before ':' */
6158 /* Parametric option has following syntax: 'Type: option = value' */
6160 bool lp_parm_bool(int snum, const char *type, const char *option, bool def)
6162 struct param_opt_struct *data = get_parametrics(snum, type, option);
6164 if (data && data->value && *data->value)
6165 return lp_bool(data->value);
6170 /* Return parametric option from a given service. Type is a part of option before ':' */
6171 /* Parametric option has following syntax: 'Type: option = value' */
6173 int lp_parm_enum(int snum, const char *type, const char *option,
6174 const struct enum_list *_enum, int def)
6176 struct param_opt_struct *data = get_parametrics(snum, type, option);
6178 if (data && data->value && *data->value && _enum)
6179 return lp_enum(data->value, _enum);
6185 /***************************************************************************
6186 Initialise a service to the defaults.
6187 ***************************************************************************/
6189 static void init_service(struct service *pservice)
6191 memset((char *)pservice, '\0', sizeof(struct service));
6192 copy_service(pservice, &sDefault, NULL);
6197 * free a param_opts structure.
6198 * param_opts handling should be moved to talloc;
6199 * then this whole functions reduces to a TALLOC_FREE().
6202 static void free_param_opts(struct param_opt_struct **popts)
6204 struct param_opt_struct *opt, *next_opt;
6206 if (popts == NULL) {
6210 if (*popts != NULL) {
6211 DEBUG(5, ("Freeing parametrics:\n"));
6214 while (opt != NULL) {
6215 string_free(&opt->key);
6216 string_free(&opt->value);
6217 TALLOC_FREE(opt->list);
6218 next_opt = opt->next;
6225 /***************************************************************************
6226 Free the dynamically allocated parts of a service struct.
6227 ***************************************************************************/
6229 static void free_service(struct service *pservice)
6234 if (pservice->szService)
6235 DEBUG(5, ("free_service: Freeing service %s\n",
6236 pservice->szService));
6238 free_parameters(pservice);
6240 string_free(&pservice->szService);
6241 TALLOC_FREE(pservice->copymap);
6243 free_param_opts(&pservice->param_opt);
6245 ZERO_STRUCTP(pservice);
6249 /***************************************************************************
6250 remove a service indexed in the ServicePtrs array from the ServiceHash
6251 and free the dynamically allocated parts
6252 ***************************************************************************/
6254 static void free_service_byindex(int idx)
6256 if ( !LP_SNUM_OK(idx) )
6259 ServicePtrs[idx]->valid = False;
6260 invalid_services[num_invalid_services++] = idx;
6262 /* we have to cleanup the hash record */
6264 if (ServicePtrs[idx]->szService) {
6265 char *canon_name = canonicalize_servicename(
6267 ServicePtrs[idx]->szService );
6269 dbwrap_delete_bystring(ServiceHash, canon_name );
6270 TALLOC_FREE(canon_name);
6273 free_service(ServicePtrs[idx]);
6276 /***************************************************************************
6277 Add a new service to the services array initialising it with the given
6279 ***************************************************************************/
6281 static int add_a_service(const struct service *pservice, const char *name)
6284 struct service tservice;
6285 int num_to_alloc = iNumServices + 1;
6287 tservice = *pservice;
6289 /* it might already exist */
6291 i = getservicebyname(name, NULL);
6297 /* find an invalid one */
6299 if (num_invalid_services > 0) {
6300 i = invalid_services[--num_invalid_services];
6303 /* if not, then create one */
6304 if (i == iNumServices) {
6305 struct service **tsp;
6308 tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct service *, num_to_alloc);
6310 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
6314 ServicePtrs[iNumServices] = SMB_MALLOC_P(struct service);
6315 if (!ServicePtrs[iNumServices]) {
6316 DEBUG(0,("add_a_service: out of memory!\n"));
6321 /* enlarge invalid_services here for now... */
6322 tinvalid = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services, int,
6324 if (tinvalid == NULL) {
6325 DEBUG(0,("add_a_service: failed to enlarge "
6326 "invalid_services!\n"));
6329 invalid_services = tinvalid;
6331 free_service_byindex(i);
6334 ServicePtrs[i]->valid = True;
6336 init_service(ServicePtrs[i]);
6337 copy_service(ServicePtrs[i], &tservice, NULL);
6339 string_set(&ServicePtrs[i]->szService, name);
6341 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
6342 i, ServicePtrs[i]->szService));
6344 if (!hash_a_service(ServicePtrs[i]->szService, i)) {
6351 /***************************************************************************
6352 Convert a string to uppercase and remove whitespaces.
6353 ***************************************************************************/
6355 char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src)
6360 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
6364 result = talloc_strdup(ctx, src);
6365 SMB_ASSERT(result != NULL);
6371 /***************************************************************************
6372 Add a name/index pair for the services array to the hash table.
6373 ***************************************************************************/
6375 static bool hash_a_service(const char *name, int idx)
6379 if ( !ServiceHash ) {
6380 DEBUG(10,("hash_a_service: creating servicehash\n"));
6381 ServiceHash = db_open_rbt(NULL);
6382 if ( !ServiceHash ) {
6383 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
6388 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
6391 canon_name = canonicalize_servicename(talloc_tos(), name );
6393 dbwrap_store_bystring(ServiceHash, canon_name,
6394 make_tdb_data((uint8 *)&idx, sizeof(idx)),
6397 TALLOC_FREE(canon_name);
6402 /***************************************************************************
6403 Add a new home service, with the specified home directory, defaults coming
6405 ***************************************************************************/
6407 bool lp_add_home(const char *pszHomename, int iDefaultService,
6408 const char *user, const char *pszHomedir)
6412 if (pszHomename == NULL || user == NULL || pszHomedir == NULL ||
6413 pszHomedir[0] == '\0') {
6417 i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
6422 if (!(*(ServicePtrs[iDefaultService]->szPath))
6423 || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
6424 string_set(&ServicePtrs[i]->szPath, pszHomedir);
6427 if (!(*(ServicePtrs[i]->comment))) {
6428 char *comment = NULL;
6429 if (asprintf(&comment, "Home directory of %s", user) < 0) {
6432 string_set(&ServicePtrs[i]->comment, comment);
6436 /* set the browseable flag from the global default */
6438 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6439 ServicePtrs[i]->bAccessBasedShareEnum = sDefault.bAccessBasedShareEnum;
6441 ServicePtrs[i]->autoloaded = True;
6443 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
6444 user, ServicePtrs[i]->szPath ));
6449 /***************************************************************************
6450 Add a new service, based on an old one.
6451 ***************************************************************************/
6453 int lp_add_service(const char *pszService, int iDefaultService)
6455 if (iDefaultService < 0) {
6456 return add_a_service(&sDefault, pszService);
6459 return (add_a_service(ServicePtrs[iDefaultService], pszService));
6462 /***************************************************************************
6463 Add the IPC service.
6464 ***************************************************************************/
6466 static bool lp_add_ipc(const char *ipc_name, bool guest_ok)
6468 char *comment = NULL;
6469 int i = add_a_service(&sDefault, ipc_name);
6474 if (asprintf(&comment, "IPC Service (%s)",
6475 Globals.szServerString) < 0) {
6479 string_set(&ServicePtrs[i]->szPath, tmpdir());
6480 string_set(&ServicePtrs[i]->szUsername, "");
6481 string_set(&ServicePtrs[i]->comment, comment);
6482 string_set(&ServicePtrs[i]->fstype, "IPC");
6483 ServicePtrs[i]->iMaxConnections = 0;
6484 ServicePtrs[i]->bAvailable = True;
6485 ServicePtrs[i]->bRead_only = True;
6486 ServicePtrs[i]->bGuest_only = False;
6487 ServicePtrs[i]->bAdministrative_share = True;
6488 ServicePtrs[i]->bGuest_ok = guest_ok;
6489 ServicePtrs[i]->bPrint_ok = False;
6490 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6492 DEBUG(3, ("adding IPC service\n"));
6498 /***************************************************************************
6499 Add a new printer service, with defaults coming from service iFrom.
6500 ***************************************************************************/
6502 bool lp_add_printer(const char *pszPrintername, int iDefaultService)
6504 const char *comment = "From Printcap";
6505 int i = add_a_service(ServicePtrs[iDefaultService], pszPrintername);
6510 /* note that we do NOT default the availability flag to True - */
6511 /* we take it from the default service passed. This allows all */
6512 /* dynamic printers to be disabled by disabling the [printers] */
6513 /* entry (if/when the 'available' keyword is implemented!). */
6515 /* the printer name is set to the service name. */
6516 string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
6517 string_set(&ServicePtrs[i]->comment, comment);
6519 /* set the browseable flag from the gloabl default */
6520 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6522 /* Printers cannot be read_only. */
6523 ServicePtrs[i]->bRead_only = False;
6524 /* No share modes on printer services. */
6525 ServicePtrs[i]->bShareModes = False;
6526 /* No oplocks on printer services. */
6527 ServicePtrs[i]->bOpLocks = False;
6528 /* Printer services must be printable. */
6529 ServicePtrs[i]->bPrint_ok = True;
6531 DEBUG(3, ("adding printer service %s\n", pszPrintername));
6537 /***************************************************************************
6538 Check whether the given parameter name is valid.
6539 Parametric options (names containing a colon) are considered valid.
6540 ***************************************************************************/
6542 bool lp_parameter_is_valid(const char *pszParmName)
6544 return ((map_parameter(pszParmName) != -1) ||
6545 (strchr(pszParmName, ':') != NULL));
6548 /***************************************************************************
6549 Check whether the given name is the name of a global parameter.
6550 Returns True for strings belonging to parameters of class
6551 P_GLOBAL, False for all other strings, also for parametric options
6552 and strings not belonging to any option.
6553 ***************************************************************************/
6555 bool lp_parameter_is_global(const char *pszParmName)
6557 int num = map_parameter(pszParmName);
6560 return (parm_table[num].p_class == P_GLOBAL);
6566 /**************************************************************************
6567 Check whether the given name is the canonical name of a parameter.
6568 Returns False if it is not a valid parameter Name.
6569 For parametric options, True is returned.
6570 **************************************************************************/
6572 bool lp_parameter_is_canonical(const char *parm_name)
6574 if (!lp_parameter_is_valid(parm_name)) {
6578 return (map_parameter(parm_name) ==
6579 map_parameter_canonical(parm_name, NULL));
6582 /**************************************************************************
6583 Determine the canonical name for a parameter.
6584 Indicate when it is an inverse (boolean) synonym instead of a
6586 **************************************************************************/
6588 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
6593 if (!lp_parameter_is_valid(parm_name)) {
6598 num = map_parameter_canonical(parm_name, inverse);
6600 /* parametric option */
6601 *canon_parm = parm_name;
6603 *canon_parm = parm_table[num].label;
6610 /**************************************************************************
6611 Determine the canonical name for a parameter.
6612 Turn the value given into the inverse boolean expression when
6613 the synonym is an invers boolean synonym.
6615 Return True if parm_name is a valid parameter name and
6616 in case it is an invers boolean synonym, if the val string could
6617 successfully be converted to the reverse bool.
6618 Return false in all other cases.
6619 **************************************************************************/
6621 bool lp_canonicalize_parameter_with_value(const char *parm_name,
6623 const char **canon_parm,
6624 const char **canon_val)
6629 if (!lp_parameter_is_valid(parm_name)) {
6635 num = map_parameter_canonical(parm_name, &inverse);
6637 /* parametric option */
6638 *canon_parm = parm_name;
6641 *canon_parm = parm_table[num].label;
6643 if (!lp_invert_boolean(val, canon_val)) {
6655 /***************************************************************************
6656 Map a parameter's string representation to something we can use.
6657 Returns False if the parameter string is not recognised, else TRUE.
6658 ***************************************************************************/
6660 static int map_parameter(const char *pszParmName)
6664 if (*pszParmName == '-' && !strequal(pszParmName, "-valid"))
6667 for (iIndex = 0; parm_table[iIndex].label; iIndex++)
6668 if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
6671 /* Warn only if it isn't parametric option */
6672 if (strchr(pszParmName, ':') == NULL)
6673 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
6674 /* We do return 'fail' for parametric options as well because they are
6675 stored in different storage
6680 /***************************************************************************
6681 Map a parameter's string representation to the index of the canonical
6682 form of the parameter (it might be a synonym).
6683 Returns -1 if the parameter string is not recognised.
6684 ***************************************************************************/
6686 static int map_parameter_canonical(const char *pszParmName, bool *inverse)
6688 int parm_num, canon_num;
6689 bool loc_inverse = False;
6691 parm_num = map_parameter(pszParmName);
6692 if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_HIDE)) {
6693 /* invalid, parametric or no canidate for synonyms ... */
6697 for (canon_num = 0; parm_table[canon_num].label; canon_num++) {
6698 if (is_synonym_of(parm_num, canon_num, &loc_inverse)) {
6699 parm_num = canon_num;
6705 if (inverse != NULL) {
6706 *inverse = loc_inverse;
6711 /***************************************************************************
6712 return true if parameter number parm1 is a synonym of parameter
6713 number parm2 (parm2 being the principal name).
6714 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6716 ***************************************************************************/
6718 static bool is_synonym_of(int parm1, int parm2, bool *inverse)
6720 if ((parm_table[parm1].ptr == parm_table[parm2].ptr) &&
6721 (parm_table[parm1].flags & FLAG_HIDE) &&
6722 !(parm_table[parm2].flags & FLAG_HIDE))
6724 if (inverse != NULL) {
6725 if ((parm_table[parm1].type == P_BOOLREV) &&
6726 (parm_table[parm2].type == P_BOOL))
6738 /***************************************************************************
6739 Show one parameter's name, type, [values,] and flags.
6740 (helper functions for show_parameter_list)
6741 ***************************************************************************/
6743 static void show_parameter(int parmIndex)
6745 int enumIndex, flagIndex;
6750 const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6751 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6753 unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
6754 FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
6755 FLAG_HIDE, FLAG_DOS_STRING};
6756 const char *flag_names[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6757 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6758 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL};
6760 printf("%s=%s", parm_table[parmIndex].label,
6761 type[parm_table[parmIndex].type]);
6762 if (parm_table[parmIndex].type == P_ENUM) {
6765 parm_table[parmIndex].enum_list[enumIndex].name;
6769 enumIndex ? "|" : "",
6770 parm_table[parmIndex].enum_list[enumIndex].name);
6775 for (flagIndex=0; flag_names[flagIndex]; flagIndex++) {
6776 if (parm_table[parmIndex].flags & flags[flagIndex]) {
6779 flag_names[flagIndex]);
6784 /* output synonyms */
6786 for (parmIndex2=0; parm_table[parmIndex2].label; parmIndex2++) {
6787 if (is_synonym_of(parmIndex, parmIndex2, &inverse)) {
6788 printf(" (%ssynonym of %s)", inverse ? "inverse " : "",
6789 parm_table[parmIndex2].label);
6790 } else if (is_synonym_of(parmIndex2, parmIndex, &inverse)) {
6792 printf(" (synonyms: ");
6797 printf("%s%s", parm_table[parmIndex2].label,
6798 inverse ? "[i]" : "");
6808 /***************************************************************************
6809 Show all parameter's name, type, [values,] and flags.
6810 ***************************************************************************/
6812 void show_parameter_list(void)
6814 int classIndex, parmIndex;
6815 const char *section_names[] = { "local", "global", NULL};
6817 for (classIndex=0; section_names[classIndex]; classIndex++) {
6818 printf("[%s]\n", section_names[classIndex]);
6819 for (parmIndex = 0; parm_table[parmIndex].label; parmIndex++) {
6820 if (parm_table[parmIndex].p_class == classIndex) {
6821 show_parameter(parmIndex);
6827 /***************************************************************************
6828 Check if a given string correctly represents a boolean value.
6829 ***************************************************************************/
6831 bool lp_string_is_valid_boolean(const char *parm_value)
6833 return set_boolean(parm_value, NULL);
6836 /***************************************************************************
6837 Get the standard string representation of a boolean value ("yes" or "no")
6838 ***************************************************************************/
6840 static const char *get_boolean(bool bool_value)
6842 static const char *yes_str = "yes";
6843 static const char *no_str = "no";
6845 return (bool_value ? yes_str : no_str);
6848 /***************************************************************************
6849 Provide the string of the negated boolean value associated to the boolean
6850 given as a string. Returns False if the passed string does not correctly
6851 represent a boolean.
6852 ***************************************************************************/
6854 bool lp_invert_boolean(const char *str, const char **inverse_str)
6858 if (!set_boolean(str, &val)) {
6862 *inverse_str = get_boolean(!val);
6866 /***************************************************************************
6867 Provide the canonical string representation of a boolean value given
6868 as a string. Return True on success, False if the string given does
6869 not correctly represent a boolean.
6870 ***************************************************************************/
6872 bool lp_canonicalize_boolean(const char *str, const char**canon_str)
6876 if (!set_boolean(str, &val)) {
6880 *canon_str = get_boolean(val);
6884 /***************************************************************************
6885 Find a service by name. Otherwise works like get_service.
6886 ***************************************************************************/
6888 static int getservicebyname(const char *pszServiceName, struct service *pserviceDest)
6894 if (ServiceHash == NULL) {
6898 canon_name = canonicalize_servicename(talloc_tos(), pszServiceName);
6900 data = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name);
6902 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
6903 iService = *(int *)data.dptr;
6906 TALLOC_FREE(canon_name);
6908 if ((iService != -1) && (LP_SNUM_OK(iService))
6909 && (pserviceDest != NULL)) {
6910 copy_service(pserviceDest, ServicePtrs[iService], NULL);
6916 /***************************************************************************
6917 Copy a service structure to another.
6918 If pcopymapDest is NULL then copy all fields
6919 ***************************************************************************/
6922 * Add a parametric option to a param_opt_struct,
6923 * replacing old value, if already present.
6925 static void set_param_opt(struct param_opt_struct **opt_list,
6926 const char *opt_name,
6927 const char *opt_value,
6930 struct param_opt_struct *new_opt, *opt;
6933 if (opt_list == NULL) {
6940 /* Traverse destination */
6942 /* If we already have same option, override it */
6943 if (strwicmp(opt->key, opt_name) == 0) {
6944 if ((opt->flags & FLAG_CMDLINE) &&
6945 !(flags & FLAG_CMDLINE)) {
6946 /* it's been marked as not to be
6950 string_free(&opt->value);
6951 TALLOC_FREE(opt->list);
6952 opt->value = SMB_STRDUP(opt_value);
6960 new_opt = SMB_XMALLOC_P(struct param_opt_struct);
6961 new_opt->key = SMB_STRDUP(opt_name);
6962 new_opt->value = SMB_STRDUP(opt_value);
6963 new_opt->list = NULL;
6964 new_opt->flags = flags;
6965 DLIST_ADD(*opt_list, new_opt);
6969 static void copy_service(struct service *pserviceDest, struct service *pserviceSource,
6970 struct bitmap *pcopymapDest)
6973 bool bcopyall = (pcopymapDest == NULL);
6974 struct param_opt_struct *data;
6976 for (i = 0; parm_table[i].label; i++)
6977 if (parm_table[i].ptr && parm_table[i].p_class == P_LOCAL &&
6978 (bcopyall || bitmap_query(pcopymapDest,i))) {
6979 void *def_ptr = parm_table[i].ptr;
6981 ((char *)pserviceSource) + PTR_DIFF(def_ptr,
6984 ((char *)pserviceDest) + PTR_DIFF(def_ptr,
6987 switch (parm_table[i].type) {
6990 *(bool *)dest_ptr = *(bool *)src_ptr;
6996 *(int *)dest_ptr = *(int *)src_ptr;
7000 *(char *)dest_ptr = *(char *)src_ptr;
7004 string_set((char **)dest_ptr,
7009 string_set((char **)dest_ptr,
7011 strupper_m(*(char **)dest_ptr);
7014 TALLOC_FREE(*((char ***)dest_ptr));
7015 *((char ***)dest_ptr) = str_list_copy(NULL,
7016 *(const char ***)src_ptr);
7024 init_copymap(pserviceDest);
7025 if (pserviceSource->copymap)
7026 bitmap_copy(pserviceDest->copymap,
7027 pserviceSource->copymap);
7030 data = pserviceSource->param_opt;
7032 set_param_opt(&pserviceDest->param_opt, data->key, data->value, data->flags);
7037 /***************************************************************************
7038 Check a service for consistency. Return False if the service is in any way
7039 incomplete or faulty, else True.
7040 ***************************************************************************/
7042 bool service_ok(int iService)
7047 if (ServicePtrs[iService]->szService[0] == '\0') {
7048 DEBUG(0, ("The following message indicates an internal error:\n"));
7049 DEBUG(0, ("No service name in service entry.\n"));
7053 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
7054 /* I can't see why you'd want a non-printable printer service... */
7055 if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
7056 if (!ServicePtrs[iService]->bPrint_ok) {
7057 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
7058 ServicePtrs[iService]->szService));
7059 ServicePtrs[iService]->bPrint_ok = True;
7061 /* [printers] service must also be non-browsable. */
7062 if (ServicePtrs[iService]->bBrowseable)
7063 ServicePtrs[iService]->bBrowseable = False;
7066 if (ServicePtrs[iService]->szPath[0] == '\0' &&
7067 strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0 &&
7068 ServicePtrs[iService]->szMSDfsProxy[0] == '\0'
7070 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
7071 ServicePtrs[iService]->szService));
7072 ServicePtrs[iService]->bAvailable = False;
7075 /* If a service is flagged unavailable, log the fact at level 1. */
7076 if (!ServicePtrs[iService]->bAvailable)
7077 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
7078 ServicePtrs[iService]->szService));
7083 static struct smbconf_ctx *lp_smbconf_ctx(void)
7086 static struct smbconf_ctx *conf_ctx = NULL;
7088 if (conf_ctx == NULL) {
7089 werr = smbconf_init(NULL, &conf_ctx, "registry:");
7090 if (!W_ERROR_IS_OK(werr)) {
7091 DEBUG(1, ("error initializing registry configuration: "
7092 "%s\n", win_errstr(werr)));
7100 static bool process_smbconf_service(struct smbconf_service *service)
7105 if (service == NULL) {
7109 ret = do_section(service->name, NULL);
7113 for (count = 0; count < service->num_params; count++) {
7114 ret = do_parameter(service->param_names[count],
7115 service->param_values[count],
7121 if (iServiceIndex >= 0) {
7122 return service_ok(iServiceIndex);
7128 * load a service from registry and activate it
7130 bool process_registry_service(const char *service_name)
7133 struct smbconf_service *service = NULL;
7134 TALLOC_CTX *mem_ctx = talloc_stackframe();
7135 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7138 if (conf_ctx == NULL) {
7142 DEBUG(5, ("process_registry_service: service name %s\n", service_name));
7144 if (!smbconf_share_exists(conf_ctx, service_name)) {
7146 * Registry does not contain data for this service (yet),
7147 * but make sure lp_load doesn't return false.
7153 werr = smbconf_get_share(conf_ctx, mem_ctx, service_name, &service);
7154 if (!W_ERROR_IS_OK(werr)) {
7158 ret = process_smbconf_service(service);
7164 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7167 TALLOC_FREE(mem_ctx);
7172 * process_registry_globals
7174 static bool process_registry_globals(void)
7178 add_to_file_list(INCLUDE_REGISTRY_NAME, INCLUDE_REGISTRY_NAME);
7180 ret = do_parameter("registry shares", "yes", NULL);
7185 return process_registry_service(GLOBAL_NAME);
7188 bool process_registry_shares(void)
7192 struct smbconf_service **service = NULL;
7193 uint32_t num_shares = 0;
7194 TALLOC_CTX *mem_ctx = talloc_stackframe();
7195 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7198 if (conf_ctx == NULL) {
7202 werr = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &service);
7203 if (!W_ERROR_IS_OK(werr)) {
7209 for (count = 0; count < num_shares; count++) {
7210 if (strequal(service[count]->name, GLOBAL_NAME)) {
7213 ret = process_smbconf_service(service[count]);
7220 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7223 TALLOC_FREE(mem_ctx);
7227 #define MAX_INCLUDE_DEPTH 100
7229 static uint8_t include_depth;
7231 static struct file_lists {
7232 struct file_lists *next;
7236 } *file_lists = NULL;
7238 /*******************************************************************
7239 Keep a linked list of all config files so we know when one has changed
7240 it's date and needs to be reloaded.
7241 ********************************************************************/
7243 static void add_to_file_list(const char *fname, const char *subfname)
7245 struct file_lists *f = file_lists;
7248 if (f->name && !strcmp(f->name, fname))
7254 f = SMB_MALLOC_P(struct file_lists);
7257 f->next = file_lists;
7258 f->name = SMB_STRDUP(fname);
7263 f->subfname = SMB_STRDUP(subfname);
7270 f->modtime = file_modtime(subfname);
7272 time_t t = file_modtime(subfname);
7280 * Free the file lists
7282 static void free_file_list(void)
7284 struct file_lists *f;
7285 struct file_lists *next;
7290 SAFE_FREE( f->name );
7291 SAFE_FREE( f->subfname );
7300 * Utility function for outsiders to check if we're running on registry.
7302 bool lp_config_backend_is_registry(void)
7304 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY);
7308 * Utility function to check if the config backend is FILE.
7310 bool lp_config_backend_is_file(void)
7312 return (lp_config_backend() == CONFIG_BACKEND_FILE);
7315 /*******************************************************************
7316 Check if a config file has changed date.
7317 ********************************************************************/
7319 bool lp_file_list_changed(void)
7321 struct file_lists *f = file_lists;
7323 DEBUG(6, ("lp_file_list_changed()\n"));
7328 if (strequal(f->name, INCLUDE_REGISTRY_NAME)) {
7329 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7331 if (conf_ctx == NULL) {
7334 if (smbconf_changed(conf_ctx, &conf_last_csn, NULL,
7337 DEBUGADD(6, ("registry config changed\n"));
7342 n2 = talloc_sub_basic(talloc_tos(),
7343 get_current_username(),
7344 current_user_info.domain,
7349 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
7350 f->name, n2, ctime(&f->modtime)));
7352 mod_time = file_modtime(n2);
7355 ((f->modtime != mod_time) ||
7356 (f->subfname == NULL) ||
7357 (strcmp(n2, f->subfname) != 0)))
7360 ("file %s modified: %s\n", n2,
7362 f->modtime = mod_time;
7363 SAFE_FREE(f->subfname);
7364 f->subfname = SMB_STRDUP(n2);
7376 /***************************************************************************
7377 Run standard_sub_basic on netbios name... needed because global_myname
7378 is not accessed through any lp_ macro.
7379 Note: We must *NOT* use string_set() here as ptr points to global_myname.
7380 ***************************************************************************/
7382 static bool handle_netbios_name(int snum, const char *pszParmValue, char **ptr)
7385 char *netbios_name = talloc_sub_basic(
7386 talloc_tos(), get_current_username(), current_user_info.domain,
7389 ret = set_global_myname(netbios_name);
7390 TALLOC_FREE(netbios_name);
7391 string_set(&Globals.szNetbiosName,global_myname());
7393 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
7399 static bool handle_charset(int snum, const char *pszParmValue, char **ptr)
7401 if (strcmp(*ptr, pszParmValue) != 0) {
7402 string_set(ptr, pszParmValue);
7410 static bool handle_workgroup(int snum, const char *pszParmValue, char **ptr)
7414 ret = set_global_myworkgroup(pszParmValue);
7415 string_set(&Globals.szWorkgroup,lp_workgroup());
7420 static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
7424 ret = set_global_scope(pszParmValue);
7425 string_set(&Globals.szNetbiosScope,global_scope());
7430 static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
7432 TALLOC_FREE(Globals.szNetbiosAliases);
7433 Globals.szNetbiosAliases = str_list_make_v3(NULL, pszParmValue, NULL);
7434 return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
7437 /***************************************************************************
7438 Handle the include operation.
7439 ***************************************************************************/
7440 static bool bAllowIncludeRegistry = true;
7442 static bool handle_include(int snum, const char *pszParmValue, char **ptr)
7446 if (include_depth >= MAX_INCLUDE_DEPTH) {
7447 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7452 if (strequal(pszParmValue, INCLUDE_REGISTRY_NAME)) {
7453 if (!bAllowIncludeRegistry) {
7456 if (bInGlobalSection) {
7459 ret = process_registry_globals();
7463 DEBUG(1, ("\"include = registry\" only effective "
7464 "in %s section\n", GLOBAL_NAME));
7469 fname = talloc_sub_basic(talloc_tos(), get_current_username(),
7470 current_user_info.domain,
7473 add_to_file_list(pszParmValue, fname);
7475 string_set(ptr, fname);
7477 if (file_exist(fname)) {
7480 ret = pm_process(fname, do_section, do_parameter, NULL);
7486 DEBUG(2, ("Can't find include file %s\n", fname));
7491 /***************************************************************************
7492 Handle the interpretation of the copy parameter.
7493 ***************************************************************************/
7495 static bool handle_copy(int snum, const char *pszParmValue, char **ptr)
7499 struct service serviceTemp;
7501 string_set(ptr, pszParmValue);
7503 init_service(&serviceTemp);
7507 DEBUG(3, ("Copying service from service %s\n", pszParmValue));
7509 if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) {
7510 if (iTemp == iServiceIndex) {
7511 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
7513 copy_service(ServicePtrs[iServiceIndex],
7515 ServicePtrs[iServiceIndex]->copymap);
7519 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
7523 free_service(&serviceTemp);
7527 static bool handle_ldap_debug_level(int snum, const char *pszParmValue, char **ptr)
7529 Globals.ldap_debug_level = lp_int(pszParmValue);
7530 init_ldap_debugging();
7534 /***************************************************************************
7535 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7540 idmap uid = 1000-1999
7543 We only do simple parsing checks here. The strings are parsed into useful
7544 structures in the idmap daemon code.
7546 ***************************************************************************/
7548 /* Some lp_ routines to return idmap [ug]id information */
7550 static uid_t idmap_uid_low, idmap_uid_high;
7551 static gid_t idmap_gid_low, idmap_gid_high;
7553 bool lp_idmap_uid(uid_t *low, uid_t *high)
7555 if (idmap_uid_low == 0 || idmap_uid_high == 0)
7559 *low = idmap_uid_low;
7562 *high = idmap_uid_high;
7567 bool lp_idmap_gid(gid_t *low, gid_t *high)
7569 if (idmap_gid_low == 0 || idmap_gid_high == 0)
7573 *low = idmap_gid_low;
7576 *high = idmap_gid_high;
7581 /* Do some simple checks on "idmap [ug]id" parameter values */
7583 static bool handle_idmap_uid(int snum, const char *pszParmValue, char **ptr)
7587 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
7592 string_set(ptr, pszParmValue);
7594 idmap_uid_low = low;
7595 idmap_uid_high = high;
7600 static bool handle_idmap_gid(int snum, const char *pszParmValue, char **ptr)
7604 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
7609 string_set(ptr, pszParmValue);
7611 idmap_gid_low = low;
7612 idmap_gid_high = high;
7617 /***************************************************************************
7618 Handle the DEBUG level list.
7619 ***************************************************************************/
7621 static bool handle_debug_list( int snum, const char *pszParmValueIn, char **ptr )
7623 string_set(ptr, pszParmValueIn);
7624 return debug_parse_levels(pszParmValueIn);
7627 /***************************************************************************
7628 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7629 ***************************************************************************/
7631 static const char *append_ldap_suffix( const char *str )
7633 const char *suffix_string;
7636 suffix_string = talloc_asprintf(talloc_tos(), "%s,%s", str,
7637 Globals.szLdapSuffix );
7638 if ( !suffix_string ) {
7639 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7643 return suffix_string;
7646 const char *lp_ldap_machine_suffix(void)
7648 if (Globals.szLdapMachineSuffix[0])
7649 return append_ldap_suffix(Globals.szLdapMachineSuffix);
7651 return lp_string(Globals.szLdapSuffix);
7654 const char *lp_ldap_user_suffix(void)
7656 if (Globals.szLdapUserSuffix[0])
7657 return append_ldap_suffix(Globals.szLdapUserSuffix);
7659 return lp_string(Globals.szLdapSuffix);
7662 const char *lp_ldap_group_suffix(void)
7664 if (Globals.szLdapGroupSuffix[0])
7665 return append_ldap_suffix(Globals.szLdapGroupSuffix);
7667 return lp_string(Globals.szLdapSuffix);
7670 const char *lp_ldap_idmap_suffix(void)
7672 if (Globals.szLdapIdmapSuffix[0])
7673 return append_ldap_suffix(Globals.szLdapIdmapSuffix);
7675 return lp_string(Globals.szLdapSuffix);
7678 /****************************************************************************
7679 set the value for a P_ENUM
7680 ***************************************************************************/
7682 static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue,
7687 for (i = 0; parm->enum_list[i].name; i++) {
7688 if ( strequal(pszParmValue, parm->enum_list[i].name)) {
7689 *ptr = parm->enum_list[i].value;
7693 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7694 pszParmValue, parm->label));
7697 /***************************************************************************
7698 ***************************************************************************/
7700 static bool handle_printing(int snum, const char *pszParmValue, char **ptr)
7702 static int parm_num = -1;
7705 if ( parm_num == -1 )
7706 parm_num = map_parameter( "printing" );
7708 lp_set_enum_parm( &parm_table[parm_num], pszParmValue, (int*)ptr );
7713 s = ServicePtrs[snum];
7715 init_printer_values( s );
7721 /***************************************************************************
7722 Initialise a copymap.
7723 ***************************************************************************/
7725 static void init_copymap(struct service *pservice)
7729 TALLOC_FREE(pservice->copymap);
7731 pservice->copymap = bitmap_talloc(NULL, NUMPARAMETERS);
7732 if (!pservice->copymap)
7734 ("Couldn't allocate copymap!! (size %d)\n",
7735 (int)NUMPARAMETERS));
7737 for (i = 0; i < NUMPARAMETERS; i++)
7738 bitmap_set(pservice->copymap, i);
7741 /***************************************************************************
7742 Return the local pointer to a parameter given a service struct and the
7743 pointer into the default structure.
7744 ***************************************************************************/
7746 static void *lp_local_ptr(struct service *service, void *ptr)
7748 return (void *)(((char *)service) + PTR_DIFF(ptr, &sDefault));
7751 /***************************************************************************
7752 Return the local pointer to a parameter given the service number and the
7753 pointer into the default structure.
7754 ***************************************************************************/
7756 void *lp_local_ptr_by_snum(int snum, void *ptr)
7758 return lp_local_ptr(ServicePtrs[snum], ptr);
7761 /***************************************************************************
7762 Process a parameter for a particular service number. If snum < 0
7763 then assume we are in the globals.
7764 ***************************************************************************/
7766 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
7769 void *parm_ptr = NULL; /* where we are going to store the result */
7770 void *def_ptr = NULL;
7771 struct param_opt_struct **opt_list;
7773 parmnum = map_parameter(pszParmName);
7776 if (strchr(pszParmName, ':') == NULL) {
7777 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7783 * We've got a parametric option
7786 opt_list = (snum < 0)
7787 ? &Globals.param_opt : &ServicePtrs[snum]->param_opt;
7788 set_param_opt(opt_list, pszParmName, pszParmValue, 0);
7793 /* if it's already been set by the command line, then we don't
7795 if (parm_table[parmnum].flags & FLAG_CMDLINE) {
7799 if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
7800 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7804 def_ptr = parm_table[parmnum].ptr;
7806 /* we might point at a service, the default service or a global */
7810 if (parm_table[parmnum].p_class == P_GLOBAL) {
7812 ("Global parameter %s found in service section!\n",
7816 parm_ptr = lp_local_ptr_by_snum(snum, def_ptr);
7820 if (!ServicePtrs[snum]->copymap)
7821 init_copymap(ServicePtrs[snum]);
7823 /* this handles the aliases - set the copymap for other entries with
7824 the same data pointer */
7825 for (i = 0; parm_table[i].label; i++)
7826 if (parm_table[i].ptr == parm_table[parmnum].ptr)
7827 bitmap_clear(ServicePtrs[snum]->copymap, i);
7830 /* if it is a special case then go ahead */
7831 if (parm_table[parmnum].special) {
7832 return parm_table[parmnum].special(snum, pszParmValue,
7836 /* now switch on the type of variable it is */
7837 switch (parm_table[parmnum].type)
7840 *(bool *)parm_ptr = lp_bool(pszParmValue);
7844 *(bool *)parm_ptr = !lp_bool(pszParmValue);
7848 *(int *)parm_ptr = lp_int(pszParmValue);
7852 *(char *)parm_ptr = *pszParmValue;
7856 i = sscanf(pszParmValue, "%o", (int *)parm_ptr);
7858 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName ));
7863 TALLOC_FREE(*((char ***)parm_ptr));
7864 *(char ***)parm_ptr = str_list_make_v3(
7865 NULL, pszParmValue, NULL);
7869 string_set((char **)parm_ptr, pszParmValue);
7873 string_set((char **)parm_ptr, pszParmValue);
7874 strupper_m(*(char **)parm_ptr);
7878 lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
7887 /***************************************************************************
7888 set a parameter, marking it with FLAG_CMDLINE. Parameters marked as
7889 FLAG_CMDLINE won't be overridden by loads from smb.conf.
7890 ***************************************************************************/
7892 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values)
7895 parmnum = map_parameter(pszParmName);
7897 parm_table[parmnum].flags &= ~FLAG_CMDLINE;
7898 if (!lp_do_parameter(-1, pszParmName, pszParmValue)) {
7901 parm_table[parmnum].flags |= FLAG_CMDLINE;
7904 store_lp_set_cmdline(pszParmName, pszParmValue);
7909 /* it might be parametric */
7910 if (strchr(pszParmName, ':') != NULL) {
7911 set_param_opt(&Globals.param_opt, pszParmName, pszParmValue, FLAG_CMDLINE);
7913 store_lp_set_cmdline(pszParmName, pszParmValue);
7918 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName));
7922 bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
7924 return lp_set_cmdline_helper(pszParmName, pszParmValue, true);
7927 /***************************************************************************
7928 Process a parameter.
7929 ***************************************************************************/
7931 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
7934 if (!bInGlobalSection && bGlobalOnly)
7937 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
7939 return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
7940 pszParmName, pszParmValue));
7944 set a option from the commandline in 'a=b' format. Use to support --option
7946 bool lp_set_option(const char *option)
7951 s = talloc_strdup(NULL, option);
7964 ret = lp_set_cmdline(s, p+1);
7969 /**************************************************************************
7970 Print a parameter of the specified type.
7971 ***************************************************************************/
7973 static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
7979 for (i = 0; p->enum_list[i].name; i++) {
7980 if (*(int *)ptr == p->enum_list[i].value) {
7982 p->enum_list[i].name);
7989 fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
7993 fprintf(f, "%s", BOOLSTR(!*(bool *)ptr));
7997 fprintf(f, "%d", *(int *)ptr);
8001 fprintf(f, "%c", *(char *)ptr);
8005 char *o = octal_string(*(int *)ptr);
8006 fprintf(f, "%s", o);
8012 if ((char ***)ptr && *(char ***)ptr) {
8013 char **list = *(char ***)ptr;
8014 for (; *list; list++) {
8015 /* surround strings with whitespace in double quotes */
8016 if ( strchr_m( *list, ' ' ) )
8017 fprintf(f, "\"%s\"%s", *list, ((*(list+1))?", ":""));
8019 fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
8026 if (*(char **)ptr) {
8027 fprintf(f, "%s", *(char **)ptr);
8035 /***************************************************************************
8036 Check if two parameters are equal.
8037 ***************************************************************************/
8039 static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
8044 return (*((bool *)ptr1) == *((bool *)ptr2));
8049 return (*((int *)ptr1) == *((int *)ptr2));
8052 return (*((char *)ptr1) == *((char *)ptr2));
8055 return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2);
8060 char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
8065 return (p1 == p2 || strequal(p1, p2));
8073 /***************************************************************************
8074 Initialize any local varients in the sDefault table.
8075 ***************************************************************************/
8077 void init_locals(void)
8082 /***************************************************************************
8083 Process a new section (service). At this stage all sections are services.
8084 Later we'll have special sections that permit server parameters to be set.
8085 Returns True on success, False on failure.
8086 ***************************************************************************/
8088 static bool do_section(const char *pszSectionName, void *userdata)
8091 bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
8092 (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
8095 /* if we were in a global section then do the local inits */
8096 if (bInGlobalSection && !isglobal)
8099 /* if we've just struck a global section, note the fact. */
8100 bInGlobalSection = isglobal;
8102 /* check for multiple global sections */
8103 if (bInGlobalSection) {
8104 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
8108 if (!bInGlobalSection && bGlobalOnly)
8111 /* if we have a current service, tidy it up before moving on */
8114 if (iServiceIndex >= 0)
8115 bRetval = service_ok(iServiceIndex);
8117 /* if all is still well, move to the next record in the services array */
8119 /* We put this here to avoid an odd message order if messages are */
8120 /* issued by the post-processing of a previous section. */
8121 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName));
8123 if ((iServiceIndex = add_a_service(&sDefault, pszSectionName))
8125 DEBUG(0, ("Failed to add a new service\n"));
8128 /* Clean all parametric options for service */
8129 /* They will be added during parsing again */
8130 free_param_opts(&ServicePtrs[iServiceIndex]->param_opt);
8137 /***************************************************************************
8138 Determine if a partcular base parameter is currentl set to the default value.
8139 ***************************************************************************/
8141 static bool is_default(int i)
8143 if (!defaults_saved)
8145 switch (parm_table[i].type) {
8147 return str_list_equal((const char **)parm_table[i].def.lvalue,
8148 *(const char ***)parm_table[i].ptr);
8151 return strequal(parm_table[i].def.svalue,
8152 *(char **)parm_table[i].ptr);
8155 return parm_table[i].def.bvalue ==
8156 *(bool *)parm_table[i].ptr;
8158 return parm_table[i].def.cvalue ==
8159 *(char *)parm_table[i].ptr;
8163 return parm_table[i].def.ivalue ==
8164 *(int *)parm_table[i].ptr;
8171 /***************************************************************************
8172 Display the contents of the global structure.
8173 ***************************************************************************/
8175 static void dump_globals(FILE *f)
8178 struct param_opt_struct *data;
8180 fprintf(f, "[global]\n");
8182 for (i = 0; parm_table[i].label; i++)
8183 if (parm_table[i].p_class == P_GLOBAL &&
8184 !(parm_table[i].flags & FLAG_META) &&
8185 parm_table[i].ptr &&
8186 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
8187 if (defaults_saved && is_default(i))
8189 fprintf(f, "\t%s = ", parm_table[i].label);
8190 print_parameter(&parm_table[i], parm_table[i].ptr, f);
8193 if (Globals.param_opt != NULL) {
8194 data = Globals.param_opt;
8196 fprintf(f, "\t%s = %s\n", data->key, data->value);
8203 /***************************************************************************
8204 Return True if a local parameter is currently set to the global default.
8205 ***************************************************************************/
8207 bool lp_is_default(int snum, struct parm_struct *parm)
8209 int pdiff = PTR_DIFF(parm->ptr, &sDefault);
8211 return equal_parameter(parm->type,
8212 ((char *)ServicePtrs[snum]) + pdiff,
8213 ((char *)&sDefault) + pdiff);
8216 /***************************************************************************
8217 Display the contents of a single services record.
8218 ***************************************************************************/
8220 static void dump_a_service(struct service *pService, FILE * f)
8223 struct param_opt_struct *data;
8225 if (pService != &sDefault)
8226 fprintf(f, "[%s]\n", pService->szService);
8228 for (i = 0; parm_table[i].label; i++) {
8230 if (parm_table[i].p_class == P_LOCAL &&
8231 !(parm_table[i].flags & FLAG_META) &&
8232 parm_table[i].ptr &&
8233 (*parm_table[i].label != '-') &&
8234 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8236 int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault);
8238 if (pService == &sDefault) {
8239 if (defaults_saved && is_default(i))
8242 if (equal_parameter(parm_table[i].type,
8243 ((char *)pService) +
8245 ((char *)&sDefault) +
8250 fprintf(f, "\t%s = ", parm_table[i].label);
8251 print_parameter(&parm_table[i],
8252 ((char *)pService) + pdiff, f);
8257 if (pService->param_opt != NULL) {
8258 data = pService->param_opt;
8260 fprintf(f, "\t%s = %s\n", data->key, data->value);
8266 /***************************************************************************
8267 Display the contents of a parameter of a single services record.
8268 ***************************************************************************/
8270 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
8273 bool result = False;
8276 fstring local_parm_name;
8278 const char *parm_opt_value;
8280 /* check for parametrical option */
8281 fstrcpy( local_parm_name, parm_name);
8282 parm_opt = strchr( local_parm_name, ':');
8287 if (strlen(parm_opt)) {
8288 parm_opt_value = lp_parm_const_string( snum,
8289 local_parm_name, parm_opt, NULL);
8290 if (parm_opt_value) {
8291 printf( "%s\n", parm_opt_value);
8298 /* check for a key and print the value */
8305 for (i = 0; parm_table[i].label; i++) {
8306 if (strwicmp(parm_table[i].label, parm_name) == 0 &&
8307 !(parm_table[i].flags & FLAG_META) &&
8308 (parm_table[i].p_class == p_class || parm_table[i].flags & flag) &&
8309 parm_table[i].ptr &&
8310 (*parm_table[i].label != '-') &&
8311 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8316 ptr = parm_table[i].ptr;
8318 struct service *pService = ServicePtrs[snum];
8319 ptr = ((char *)pService) +
8320 PTR_DIFF(parm_table[i].ptr, &sDefault);
8323 print_parameter(&parm_table[i],
8334 /***************************************************************************
8335 Return info about the requested parameter (given as a string).
8336 Return NULL when the string is not a valid parameter name.
8337 ***************************************************************************/
8339 struct parm_struct *lp_get_parameter(const char *param_name)
8341 int num = map_parameter(param_name);
8347 return &parm_table[num];
8350 /***************************************************************************
8351 Return info about the next parameter in a service.
8352 snum==GLOBAL_SECTION_SNUM gives the globals.
8353 Return NULL when out of parameters.
8354 ***************************************************************************/
8356 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
8359 /* do the globals */
8360 for (; parm_table[*i].label; (*i)++) {
8361 if (parm_table[*i].p_class == P_SEPARATOR)
8362 return &parm_table[(*i)++];
8364 if (!parm_table[*i].ptr
8365 || (*parm_table[*i].label == '-'))
8369 && (parm_table[*i].ptr ==
8370 parm_table[(*i) - 1].ptr))
8373 if (is_default(*i) && !allparameters)
8376 return &parm_table[(*i)++];
8379 struct service *pService = ServicePtrs[snum];
8381 for (; parm_table[*i].label; (*i)++) {
8382 if (parm_table[*i].p_class == P_SEPARATOR)
8383 return &parm_table[(*i)++];
8385 if (parm_table[*i].p_class == P_LOCAL &&
8386 parm_table[*i].ptr &&
8387 (*parm_table[*i].label != '-') &&
8389 (parm_table[*i].ptr !=
8390 parm_table[(*i) - 1].ptr)))
8393 PTR_DIFF(parm_table[*i].ptr,
8396 if (allparameters ||
8397 !equal_parameter(parm_table[*i].type,
8398 ((char *)pService) +
8400 ((char *)&sDefault) +
8403 return &parm_table[(*i)++];
8414 /***************************************************************************
8415 Display the contents of a single copy structure.
8416 ***************************************************************************/
8417 static void dump_copy_map(bool *pcopymap)
8423 printf("\n\tNon-Copied parameters:\n");
8425 for (i = 0; parm_table[i].label; i++)
8426 if (parm_table[i].p_class == P_LOCAL &&
8427 parm_table[i].ptr && !pcopymap[i] &&
8428 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8430 printf("\t\t%s\n", parm_table[i].label);
8435 /***************************************************************************
8436 Return TRUE if the passed service number is within range.
8437 ***************************************************************************/
8439 bool lp_snum_ok(int iService)
8441 return (LP_SNUM_OK(iService) && ServicePtrs[iService]->bAvailable);
8444 /***************************************************************************
8445 Auto-load some home services.
8446 ***************************************************************************/
8448 static void lp_add_auto_services(char *str)
8458 s = SMB_STRDUP(str);
8462 homes = lp_servicenumber(HOMES_NAME);
8464 for (p = strtok_r(s, LIST_SEP, &saveptr); p;
8465 p = strtok_r(NULL, LIST_SEP, &saveptr)) {
8468 if (lp_servicenumber(p) >= 0)
8471 home = get_user_home_dir(talloc_tos(), p);
8473 if (home && home[0] && homes >= 0)
8474 lp_add_home(p, homes, p, home);
8481 /***************************************************************************
8482 Auto-load one printer.
8483 ***************************************************************************/
8485 void lp_add_one_printer(const char *name, const char *comment, void *pdata)
8487 int printers = lp_servicenumber(PRINTERS_NAME);
8490 if (lp_servicenumber(name) < 0) {
8491 lp_add_printer(name, printers);
8492 if ((i = lp_servicenumber(name)) >= 0) {
8493 string_set(&ServicePtrs[i]->comment, comment);
8494 ServicePtrs[i]->autoloaded = True;
8499 /***************************************************************************
8500 Have we loaded a services file yet?
8501 ***************************************************************************/
8503 bool lp_loaded(void)
8508 /***************************************************************************
8509 Unload unused services.
8510 ***************************************************************************/
8512 void lp_killunused(bool (*snumused) (int))
8515 for (i = 0; i < iNumServices; i++) {
8519 /* don't kill autoloaded or usershare services */
8520 if ( ServicePtrs[i]->autoloaded ||
8521 ServicePtrs[i]->usershare == USERSHARE_VALID) {
8525 if (!snumused || !snumused(i)) {
8526 free_service_byindex(i);
8532 * Kill all except autoloaded and usershare services - convenience wrapper
8534 void lp_kill_all_services(void)
8536 lp_killunused(NULL);
8539 /***************************************************************************
8541 ***************************************************************************/
8543 void lp_killservice(int iServiceIn)
8545 if (VALID(iServiceIn)) {
8546 free_service_byindex(iServiceIn);
8550 /***************************************************************************
8551 Save the curent values of all global and sDefault parameters into the
8552 defaults union. This allows swat and testparm to show only the
8553 changed (ie. non-default) parameters.
8554 ***************************************************************************/
8556 static void lp_save_defaults(void)
8559 for (i = 0; parm_table[i].label; i++) {
8560 if (i > 0 && parm_table[i].ptr == parm_table[i - 1].ptr)
8562 switch (parm_table[i].type) {
8564 parm_table[i].def.lvalue = str_list_copy(
8565 NULL, *(const char ***)parm_table[i].ptr);
8569 if (parm_table[i].ptr) {
8570 parm_table[i].def.svalue = SMB_STRDUP(*(char **)parm_table[i].ptr);
8572 parm_table[i].def.svalue = NULL;
8577 parm_table[i].def.bvalue =
8578 *(bool *)parm_table[i].ptr;
8581 parm_table[i].def.cvalue =
8582 *(char *)parm_table[i].ptr;
8587 parm_table[i].def.ivalue =
8588 *(int *)parm_table[i].ptr;
8594 defaults_saved = True;
8597 /***********************************************************
8598 If we should send plaintext/LANMAN passwords in the clinet
8599 ************************************************************/
8601 static void set_allowed_client_auth(void)
8603 if (Globals.bClientNTLMv2Auth) {
8604 Globals.bClientLanManAuth = False;
8606 if (!Globals.bClientLanManAuth) {
8607 Globals.bClientPlaintextAuth = False;
8611 /***************************************************************************
8613 The following code allows smbd to read a user defined share file.
8614 Yes, this is my intent. Yes, I'm comfortable with that...
8616 THE FOLLOWING IS SECURITY CRITICAL CODE.
8618 It washes your clothes, it cleans your house, it guards you while you sleep...
8619 Do not f%^k with it....
8620 ***************************************************************************/
8622 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8624 /***************************************************************************
8625 Check allowed stat state of a usershare file.
8626 Ensure we print out who is dicking with us so the admin can
8627 get their sorry ass fired.
8628 ***************************************************************************/
8630 static bool check_usershare_stat(const char *fname,
8631 const SMB_STRUCT_STAT *psbuf)
8633 if (!S_ISREG(psbuf->st_ex_mode)) {
8634 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8635 "not a regular file\n",
8636 fname, (unsigned int)psbuf->st_ex_uid ));
8640 /* Ensure this doesn't have the other write bit set. */
8641 if (psbuf->st_ex_mode & S_IWOTH) {
8642 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8643 "public write. Refusing to allow as a usershare file.\n",
8644 fname, (unsigned int)psbuf->st_ex_uid ));
8648 /* Should be 10k or less. */
8649 if (psbuf->st_ex_size > MAX_USERSHARE_FILE_SIZE) {
8650 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8651 "too large (%u) to be a user share file.\n",
8652 fname, (unsigned int)psbuf->st_ex_uid,
8653 (unsigned int)psbuf->st_ex_size ));
8660 /***************************************************************************
8661 Parse the contents of a usershare file.
8662 ***************************************************************************/
8664 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
8665 SMB_STRUCT_STAT *psbuf,
8666 const char *servicename,
8670 char **pp_sharepath,
8672 char **pp_cp_servicename,
8673 struct security_descriptor **ppsd,
8676 const char **prefixallowlist = lp_usershare_prefix_allow_list();
8677 const char **prefixdenylist = lp_usershare_prefix_deny_list();
8680 SMB_STRUCT_STAT sbuf;
8681 char *sharepath = NULL;
8682 char *comment = NULL;
8684 *pp_sharepath = NULL;
8687 *pallow_guest = False;
8690 return USERSHARE_MALFORMED_FILE;
8693 if (strcmp(lines[0], "#VERSION 1") == 0) {
8695 } else if (strcmp(lines[0], "#VERSION 2") == 0) {
8698 return USERSHARE_MALFORMED_FILE;
8701 return USERSHARE_BAD_VERSION;
8704 if (strncmp(lines[1], "path=", 5) != 0) {
8705 return USERSHARE_MALFORMED_PATH;
8708 sharepath = talloc_strdup(ctx, &lines[1][5]);
8710 return USERSHARE_POSIX_ERR;
8712 trim_string(sharepath, " ", " ");
8714 if (strncmp(lines[2], "comment=", 8) != 0) {
8715 return USERSHARE_MALFORMED_COMMENT_DEF;
8718 comment = talloc_strdup(ctx, &lines[2][8]);
8720 return USERSHARE_POSIX_ERR;
8722 trim_string(comment, " ", " ");
8723 trim_char(comment, '"', '"');
8725 if (strncmp(lines[3], "usershare_acl=", 14) != 0) {
8726 return USERSHARE_MALFORMED_ACL_DEF;
8729 if (!parse_usershare_acl(ctx, &lines[3][14], ppsd)) {
8730 return USERSHARE_ACL_ERR;
8734 if (strncmp(lines[4], "guest_ok=", 9) != 0) {
8735 return USERSHARE_MALFORMED_ACL_DEF;
8737 if (lines[4][9] == 'y') {
8738 *pallow_guest = True;
8741 /* Backwards compatible extension to file version #2. */
8743 if (strncmp(lines[5], "sharename=", 10) != 0) {
8744 return USERSHARE_MALFORMED_SHARENAME_DEF;
8746 if (!strequal(&lines[5][10], servicename)) {
8747 return USERSHARE_BAD_SHARENAME;
8749 *pp_cp_servicename = talloc_strdup(ctx, &lines[5][10]);
8750 if (!*pp_cp_servicename) {
8751 return USERSHARE_POSIX_ERR;
8756 if (*pp_cp_servicename == NULL) {
8757 *pp_cp_servicename = talloc_strdup(ctx, servicename);
8758 if (!*pp_cp_servicename) {
8759 return USERSHARE_POSIX_ERR;
8763 if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->szPath) == 0)) {
8764 /* Path didn't change, no checks needed. */
8765 *pp_sharepath = sharepath;
8766 *pp_comment = comment;
8767 return USERSHARE_OK;
8770 /* The path *must* be absolute. */
8771 if (sharepath[0] != '/') {
8772 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8773 servicename, sharepath));
8774 return USERSHARE_PATH_NOT_ABSOLUTE;
8777 /* If there is a usershare prefix deny list ensure one of these paths
8778 doesn't match the start of the user given path. */
8779 if (prefixdenylist) {
8781 for ( i=0; prefixdenylist[i]; i++ ) {
8782 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8783 servicename, i, prefixdenylist[i], sharepath ));
8784 if (memcmp( sharepath, prefixdenylist[i], strlen(prefixdenylist[i])) == 0) {
8785 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8786 "usershare prefix deny list entries.\n",
8787 servicename, sharepath));
8788 return USERSHARE_PATH_IS_DENIED;
8793 /* If there is a usershare prefix allow list ensure one of these paths
8794 does match the start of the user given path. */
8796 if (prefixallowlist) {
8798 for ( i=0; prefixallowlist[i]; i++ ) {
8799 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8800 servicename, i, prefixallowlist[i], sharepath ));
8801 if (memcmp( sharepath, prefixallowlist[i], strlen(prefixallowlist[i])) == 0) {
8805 if (prefixallowlist[i] == NULL) {
8806 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8807 "usershare prefix allow list entries.\n",
8808 servicename, sharepath));
8809 return USERSHARE_PATH_NOT_ALLOWED;
8813 /* Ensure this is pointing to a directory. */
8814 dp = sys_opendir(sharepath);
8817 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8818 servicename, sharepath));
8819 return USERSHARE_PATH_NOT_DIRECTORY;
8822 /* Ensure the owner of the usershare file has permission to share
8825 if (sys_stat(sharepath, &sbuf, false) == -1) {
8826 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8827 servicename, sharepath, strerror(errno) ));
8829 return USERSHARE_POSIX_ERR;
8834 if (!S_ISDIR(sbuf.st_ex_mode)) {
8835 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8836 servicename, sharepath ));
8837 return USERSHARE_PATH_NOT_DIRECTORY;
8840 /* Check if sharing is restricted to owner-only. */
8841 /* psbuf is the stat of the usershare definition file,
8842 sbuf is the stat of the target directory to be shared. */
8844 if (lp_usershare_owner_only()) {
8845 /* root can share anything. */
8846 if ((psbuf->st_ex_uid != 0) && (sbuf.st_ex_uid != psbuf->st_ex_uid)) {
8847 return USERSHARE_PATH_NOT_ALLOWED;
8851 *pp_sharepath = sharepath;
8852 *pp_comment = comment;
8853 return USERSHARE_OK;
8856 /***************************************************************************
8857 Deal with a usershare file.
8860 -1 - Bad name, invalid contents.
8861 - service name already existed and not a usershare, problem
8862 with permissions to share directory etc.
8863 ***************************************************************************/
8865 static int process_usershare_file(const char *dir_name, const char *file_name, int snum_template)
8867 SMB_STRUCT_STAT sbuf;
8868 SMB_STRUCT_STAT lsbuf;
8870 char *sharepath = NULL;
8871 char *comment = NULL;
8872 char *cp_service_name = NULL;
8873 char **lines = NULL;
8877 TALLOC_CTX *ctx = talloc_stackframe();
8878 struct security_descriptor *psd = NULL;
8879 bool guest_ok = False;
8880 char *canon_name = NULL;
8881 bool added_service = false;
8884 /* Ensure share name doesn't contain invalid characters. */
8885 if (!validate_net_name(file_name, INVALID_SHARENAME_CHARS, strlen(file_name))) {
8886 DEBUG(0,("process_usershare_file: share name %s contains "
8887 "invalid characters (any of %s)\n",
8888 file_name, INVALID_SHARENAME_CHARS ));
8892 canon_name = canonicalize_servicename(ctx, file_name);
8897 fname = talloc_asprintf(ctx, "%s/%s", dir_name, file_name);
8902 /* Minimize the race condition by doing an lstat before we
8903 open and fstat. Ensure this isn't a symlink link. */
8905 if (sys_lstat(fname, &lsbuf, false) != 0) {
8906 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8907 fname, strerror(errno) ));
8911 /* This must be a regular file, not a symlink, directory or
8912 other strange filetype. */
8913 if (!check_usershare_stat(fname, &lsbuf)) {
8918 TDB_DATA data = dbwrap_fetch_bystring(
8919 ServiceHash, canon_name, canon_name);
8923 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
8924 iService = *(int *)data.dptr;
8928 if (iService != -1 &&
8929 timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
8930 &lsbuf.st_ex_mtime) == 0) {
8931 /* Nothing changed - Mark valid and return. */
8932 DEBUG(10,("process_usershare_file: service %s not changed.\n",
8934 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8939 /* Try and open the file read only - no symlinks allowed. */
8941 fd = sys_open(fname, O_RDONLY|O_NOFOLLOW, 0);
8943 fd = sys_open(fname, O_RDONLY, 0);
8947 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
8948 fname, strerror(errno) ));
8952 /* Now fstat to be *SURE* it's a regular file. */
8953 if (sys_fstat(fd, &sbuf, false) != 0) {
8955 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
8956 fname, strerror(errno) ));
8960 /* Is it the same dev/inode as was lstated ? */
8961 if (lsbuf.st_ex_dev != sbuf.st_ex_dev || lsbuf.st_ex_ino != sbuf.st_ex_ino) {
8963 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
8964 "Symlink spoofing going on ?\n", fname ));
8968 /* This must be a regular file, not a symlink, directory or
8969 other strange filetype. */
8970 if (!check_usershare_stat(fname, &sbuf)) {
8974 lines = fd_lines_load(fd, &numlines, MAX_USERSHARE_FILE_SIZE, NULL);
8977 if (lines == NULL) {
8978 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
8979 fname, (unsigned int)sbuf.st_ex_uid ));
8983 if (parse_usershare_file(ctx, &sbuf, file_name,
8984 iService, lines, numlines, &sharepath,
8985 &comment, &cp_service_name,
8986 &psd, &guest_ok) != USERSHARE_OK) {
8990 /* Everything ok - add the service possibly using a template. */
8992 const struct service *sp = &sDefault;
8993 if (snum_template != -1) {
8994 sp = ServicePtrs[snum_template];
8997 if ((iService = add_a_service(sp, cp_service_name)) < 0) {
8998 DEBUG(0, ("process_usershare_file: Failed to add "
8999 "new service %s\n", cp_service_name));
9003 added_service = true;
9005 /* Read only is controlled by usershare ACL below. */
9006 ServicePtrs[iService]->bRead_only = False;
9009 /* Write the ACL of the new/modified share. */
9010 if (!set_share_security(canon_name, psd)) {
9011 DEBUG(0, ("process_usershare_file: Failed to set share "
9012 "security for user share %s\n",
9017 /* If from a template it may be marked invalid. */
9018 ServicePtrs[iService]->valid = True;
9020 /* Set the service as a valid usershare. */
9021 ServicePtrs[iService]->usershare = USERSHARE_VALID;
9023 /* Set guest access. */
9024 if (lp_usershare_allow_guests()) {
9025 ServicePtrs[iService]->bGuest_ok = guest_ok;
9028 /* And note when it was loaded. */
9029 ServicePtrs[iService]->usershare_last_mod = sbuf.st_ex_mtime;
9030 string_set(&ServicePtrs[iService]->szPath, sharepath);
9031 string_set(&ServicePtrs[iService]->comment, comment);
9037 if (ret == -1 && iService != -1 && added_service) {
9038 lp_remove_service(iService);
9046 /***************************************************************************
9047 Checks if a usershare entry has been modified since last load.
9048 ***************************************************************************/
9050 static bool usershare_exists(int iService, struct timespec *last_mod)
9052 SMB_STRUCT_STAT lsbuf;
9053 const char *usersharepath = Globals.szUsersharePath;
9056 if (asprintf(&fname, "%s/%s",
9058 ServicePtrs[iService]->szService) < 0) {
9062 if (sys_lstat(fname, &lsbuf, false) != 0) {
9067 if (!S_ISREG(lsbuf.st_ex_mode)) {
9073 *last_mod = lsbuf.st_ex_mtime;
9077 /***************************************************************************
9078 Load a usershare service by name. Returns a valid servicenumber or -1.
9079 ***************************************************************************/
9081 int load_usershare_service(const char *servicename)
9083 SMB_STRUCT_STAT sbuf;
9084 const char *usersharepath = Globals.szUsersharePath;
9085 int max_user_shares = Globals.iUsershareMaxShares;
9086 int snum_template = -1;
9088 if (*usersharepath == 0 || max_user_shares == 0) {
9092 if (sys_stat(usersharepath, &sbuf, false) != 0) {
9093 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
9094 usersharepath, strerror(errno) ));
9098 if (!S_ISDIR(sbuf.st_ex_mode)) {
9099 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
9105 * This directory must be owned by root, and have the 't' bit set.
9106 * It also must not be writable by "other".
9110 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
9112 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
9114 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
9115 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9120 /* Ensure the template share exists if it's set. */
9121 if (Globals.szUsershareTemplateShare[0]) {
9122 /* We can't use lp_servicenumber here as we are recommending that
9123 template shares have -valid=False set. */
9124 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
9125 if (ServicePtrs[snum_template]->szService &&
9126 strequal(ServicePtrs[snum_template]->szService,
9127 Globals.szUsershareTemplateShare)) {
9132 if (snum_template == -1) {
9133 DEBUG(0,("load_usershare_service: usershare template share %s "
9134 "does not exist.\n",
9135 Globals.szUsershareTemplateShare ));
9140 return process_usershare_file(usersharepath, servicename, snum_template);
9143 /***************************************************************************
9144 Load all user defined shares from the user share directory.
9145 We only do this if we're enumerating the share list.
9146 This is the function that can delete usershares that have
9148 ***************************************************************************/
9150 int load_usershare_shares(void)
9153 SMB_STRUCT_STAT sbuf;
9154 SMB_STRUCT_DIRENT *de;
9155 int num_usershares = 0;
9156 int max_user_shares = Globals.iUsershareMaxShares;
9157 unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries;
9158 unsigned int allowed_bad_entries = ((2*max_user_shares)/10);
9159 unsigned int allowed_tmp_entries = ((2*max_user_shares)/10);
9161 int snum_template = -1;
9162 const char *usersharepath = Globals.szUsersharePath;
9163 int ret = lp_numservices();
9165 if (max_user_shares == 0 || *usersharepath == '\0') {
9166 return lp_numservices();
9169 if (sys_stat(usersharepath, &sbuf, false) != 0) {
9170 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
9171 usersharepath, strerror(errno) ));
9176 * This directory must be owned by root, and have the 't' bit set.
9177 * It also must not be writable by "other".
9181 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
9183 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
9185 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
9186 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9191 /* Ensure the template share exists if it's set. */
9192 if (Globals.szUsershareTemplateShare[0]) {
9193 /* We can't use lp_servicenumber here as we are recommending that
9194 template shares have -valid=False set. */
9195 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
9196 if (ServicePtrs[snum_template]->szService &&
9197 strequal(ServicePtrs[snum_template]->szService,
9198 Globals.szUsershareTemplateShare)) {
9203 if (snum_template == -1) {
9204 DEBUG(0,("load_usershare_shares: usershare template share %s "
9205 "does not exist.\n",
9206 Globals.szUsershareTemplateShare ));
9211 /* Mark all existing usershares as pending delete. */
9212 for (iService = iNumServices - 1; iService >= 0; iService--) {
9213 if (VALID(iService) && ServicePtrs[iService]->usershare) {
9214 ServicePtrs[iService]->usershare = USERSHARE_PENDING_DELETE;
9218 dp = sys_opendir(usersharepath);
9220 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
9221 usersharepath, strerror(errno) ));
9225 for (num_dir_entries = 0, num_bad_dir_entries = 0, num_tmp_dir_entries = 0;
9226 (de = sys_readdir(dp));
9227 num_dir_entries++ ) {
9229 const char *n = de->d_name;
9231 /* Ignore . and .. */
9233 if ((n[1] == '\0') || (n[1] == '.' && n[2] == '\0')) {
9239 /* Temporary file used when creating a share. */
9240 num_tmp_dir_entries++;
9243 /* Allow 20% tmp entries. */
9244 if (num_tmp_dir_entries > allowed_tmp_entries) {
9245 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
9246 "in directory %s\n",
9247 num_tmp_dir_entries, usersharepath));
9251 r = process_usershare_file(usersharepath, n, snum_template);
9253 /* Update the services count. */
9255 if (num_usershares >= max_user_shares) {
9256 DEBUG(0,("load_usershare_shares: max user shares reached "
9257 "on file %s in directory %s\n",
9258 n, usersharepath ));
9261 } else if (r == -1) {
9262 num_bad_dir_entries++;
9265 /* Allow 20% bad entries. */
9266 if (num_bad_dir_entries > allowed_bad_entries) {
9267 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
9268 "in directory %s\n",
9269 num_bad_dir_entries, usersharepath));
9273 /* Allow 20% bad entries. */
9274 if (num_dir_entries > max_user_shares + allowed_bad_entries) {
9275 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
9276 "in directory %s\n",
9277 num_dir_entries, usersharepath));
9284 /* Sweep through and delete any non-refreshed usershares that are
9285 not currently in use. */
9286 for (iService = iNumServices - 1; iService >= 0; iService--) {
9287 if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
9288 if (conn_snum_used(iService)) {
9291 /* Remove from the share ACL db. */
9292 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
9293 lp_servicename(iService) ));
9294 delete_share_security(lp_servicename(iService));
9295 free_service_byindex(iService);
9299 return lp_numservices();
9302 /********************************************************
9303 Destroy global resources allocated in this file
9304 ********************************************************/
9306 void gfree_loadparm(void)
9312 /* Free resources allocated to services */
9314 for ( i = 0; i < iNumServices; i++ ) {
9316 free_service_byindex(i);
9320 SAFE_FREE( ServicePtrs );
9323 /* Now release all resources allocated to global
9324 parameters and the default service */
9326 free_global_parameters();
9330 /***************************************************************************
9331 Allow client apps to specify that they are a client
9332 ***************************************************************************/
9333 void lp_set_in_client(bool b)
9339 /***************************************************************************
9340 Determine if we're running in a client app
9341 ***************************************************************************/
9342 bool lp_is_in_client(void)
9347 /***************************************************************************
9348 Load the services array from the services file. Return True on success,
9350 ***************************************************************************/
9352 static bool lp_load_ex(const char *pszFname,
9356 bool initialize_globals,
9357 bool allow_include_registry,
9358 bool allow_registry_shares)
9365 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9367 bInGlobalSection = True;
9368 bGlobalOnly = global_only;
9369 bAllowIncludeRegistry = allow_include_registry;
9371 init_globals(initialize_globals);
9376 if (save_defaults) {
9381 free_param_opts(&Globals.param_opt);
9383 /* We get sections first, so have to start 'behind' to make up */
9386 if (lp_config_backend_is_file()) {
9387 n2 = talloc_sub_basic(talloc_tos(), get_current_username(),
9388 current_user_info.domain,
9391 smb_panic("lp_load_ex: out of memory");
9394 add_to_file_list(pszFname, n2);
9396 bRetval = pm_process(n2, do_section, do_parameter, NULL);
9399 /* finish up the last section */
9400 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
9402 if (iServiceIndex >= 0) {
9403 bRetval = service_ok(iServiceIndex);
9407 if (lp_config_backend_is_registry()) {
9408 /* config backend changed to registry in config file */
9410 * We need to use this extra global variable here to
9411 * survive restart: init_globals uses this as a default
9412 * for ConfigBackend. Otherwise, init_globals would
9413 * send us into an endless loop here.
9415 config_backend = CONFIG_BACKEND_REGISTRY;
9417 DEBUG(1, ("lp_load_ex: changing to config backend "
9420 lp_kill_all_services();
9421 return lp_load_ex(pszFname, global_only, save_defaults,
9422 add_ipc, initialize_globals,
9423 allow_include_registry,
9424 allow_registry_shares);
9426 } else if (lp_config_backend_is_registry()) {
9427 bRetval = process_registry_globals();
9429 DEBUG(0, ("Illegal config backend given: %d\n",
9430 lp_config_backend()));
9434 if (bRetval && lp_registry_shares() && allow_registry_shares) {
9435 bRetval = process_registry_shares();
9438 lp_add_auto_services(lp_auto_services());
9441 /* When 'restrict anonymous = 2' guest connections to ipc$
9443 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9444 if ( lp_enable_asu_support() ) {
9445 lp_add_ipc("ADMIN$", false);
9450 set_default_server_announce_type();
9451 set_allowed_client_auth();
9455 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9456 /* if bWINSsupport is true and we are in the client */
9457 if (lp_is_in_client() && Globals.bWINSsupport) {
9458 lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
9463 bAllowIncludeRegistry = true;
9468 bool lp_load(const char *pszFname,
9472 bool initialize_globals)
9474 return lp_load_ex(pszFname,
9479 true, /* allow_include_registry */
9480 false); /* allow_registry_shares*/
9483 bool lp_load_initial_only(const char *pszFname)
9485 return lp_load_ex(pszFname,
9486 true, /* global only */
9487 false, /* save_defaults */
9488 false, /* add_ipc */
9489 true, /* initialize_globals */
9490 false, /* allow_include_registry */
9491 false); /* allow_registry_shares*/
9494 bool lp_load_with_registry_shares(const char *pszFname,
9498 bool initialize_globals)
9500 return lp_load_ex(pszFname,
9505 true, /* allow_include_registry */
9506 true); /* allow_registry_shares*/
9509 /***************************************************************************
9510 Return the max number of services.
9511 ***************************************************************************/
9513 int lp_numservices(void)
9515 return (iNumServices);
9518 /***************************************************************************
9519 Display the contents of the services array in human-readable form.
9520 ***************************************************************************/
9522 void lp_dump(FILE *f, bool show_defaults, int maxtoprint)
9527 defaults_saved = False;
9531 dump_a_service(&sDefault, f);
9533 for (iService = 0; iService < maxtoprint; iService++) {
9535 lp_dump_one(f, show_defaults, iService);
9539 /***************************************************************************
9540 Display the contents of one service in human-readable form.
9541 ***************************************************************************/
9543 void lp_dump_one(FILE * f, bool show_defaults, int snum)
9546 if (ServicePtrs[snum]->szService[0] == '\0')
9548 dump_a_service(ServicePtrs[snum], f);
9552 /***************************************************************************
9553 Return the number of the service with the given name, or -1 if it doesn't
9554 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9555 getservicebyname()! This works ONLY if all services have been loaded, and
9556 does not copy the found service.
9557 ***************************************************************************/
9559 int lp_servicenumber(const char *pszServiceName)
9562 fstring serviceName;
9564 if (!pszServiceName) {
9565 return GLOBAL_SECTION_SNUM;
9568 for (iService = iNumServices - 1; iService >= 0; iService--) {
9569 if (VALID(iService) && ServicePtrs[iService]->szService) {
9571 * The substitution here is used to support %U is
9574 fstrcpy(serviceName, ServicePtrs[iService]->szService);
9575 standard_sub_basic(get_current_username(),
9576 current_user_info.domain,
9577 serviceName,sizeof(serviceName));
9578 if (strequal(serviceName, pszServiceName)) {
9584 if (iService >= 0 && ServicePtrs[iService]->usershare == USERSHARE_VALID) {
9585 struct timespec last_mod;
9587 if (!usershare_exists(iService, &last_mod)) {
9588 /* Remove the share security tdb entry for it. */
9589 delete_share_security(lp_servicename(iService));
9590 /* Remove it from the array. */
9591 free_service_byindex(iService);
9592 /* Doesn't exist anymore. */
9593 return GLOBAL_SECTION_SNUM;
9596 /* Has it been modified ? If so delete and reload. */
9597 if (timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
9599 /* Remove it from the array. */
9600 free_service_byindex(iService);
9601 /* and now reload it. */
9602 iService = load_usershare_service(pszServiceName);
9607 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
9608 return GLOBAL_SECTION_SNUM;
9614 bool share_defined(const char *service_name)
9616 return (lp_servicenumber(service_name) != -1);
9619 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
9620 const char *sharename)
9622 struct share_params *result;
9626 snum = find_service(mem_ctx, sharename, &sname);
9627 if (snum < 0 || sname == NULL) {
9631 if (!(result = TALLOC_P(mem_ctx, struct share_params))) {
9632 DEBUG(0, ("talloc failed\n"));
9636 result->service = snum;
9640 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx)
9642 struct share_iterator *result;
9644 if (!(result = TALLOC_P(mem_ctx, struct share_iterator))) {
9645 DEBUG(0, ("talloc failed\n"));
9649 result->next_id = 0;
9653 struct share_params *next_share(struct share_iterator *list)
9655 struct share_params *result;
9657 while (!lp_snum_ok(list->next_id) &&
9658 (list->next_id < lp_numservices())) {
9662 if (list->next_id >= lp_numservices()) {
9666 if (!(result = TALLOC_P(list, struct share_params))) {
9667 DEBUG(0, ("talloc failed\n"));
9671 result->service = list->next_id;
9676 struct share_params *next_printer(struct share_iterator *list)
9678 struct share_params *result;
9680 while ((result = next_share(list)) != NULL) {
9681 if (lp_print_ok(result->service)) {
9689 * This is a hack for a transition period until we transformed all code from
9690 * service numbers to struct share_params.
9693 struct share_params *snum2params_static(int snum)
9695 static struct share_params result;
9696 result.service = snum;
9700 /*******************************************************************
9701 A useful volume label function.
9702 ********************************************************************/
9704 const char *volume_label(int snum)
9707 const char *label = lp_volume(snum);
9709 label = lp_servicename(snum);
9712 /* This returns a 33 byte guarenteed null terminated string. */
9713 ret = talloc_strndup(talloc_tos(), label, 32);
9720 /*******************************************************************
9721 Set the server type we will announce as via nmbd.
9722 ********************************************************************/
9724 static void set_default_server_announce_type(void)
9726 default_server_announce = 0;
9727 default_server_announce |= SV_TYPE_WORKSTATION;
9728 default_server_announce |= SV_TYPE_SERVER;
9729 default_server_announce |= SV_TYPE_SERVER_UNIX;
9731 /* note that the flag should be set only if we have a
9732 printer service but nmbd doesn't actually load the
9733 services so we can't tell --jerry */
9735 default_server_announce |= SV_TYPE_PRINTQ_SERVER;
9737 switch (lp_announce_as()) {
9738 case ANNOUNCE_AS_NT_SERVER:
9739 default_server_announce |= SV_TYPE_SERVER_NT;
9740 /* fall through... */
9741 case ANNOUNCE_AS_NT_WORKSTATION:
9742 default_server_announce |= SV_TYPE_NT;
9744 case ANNOUNCE_AS_WIN95:
9745 default_server_announce |= SV_TYPE_WIN95_PLUS;
9747 case ANNOUNCE_AS_WFW:
9748 default_server_announce |= SV_TYPE_WFW;
9754 switch (lp_server_role()) {
9755 case ROLE_DOMAIN_MEMBER:
9756 default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
9758 case ROLE_DOMAIN_PDC:
9759 default_server_announce |= SV_TYPE_DOMAIN_CTRL;
9761 case ROLE_DOMAIN_BDC:
9762 default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL;
9764 case ROLE_STANDALONE:
9768 if (lp_time_server())
9769 default_server_announce |= SV_TYPE_TIME_SOURCE;
9771 if (lp_host_msdfs())
9772 default_server_announce |= SV_TYPE_DFS_SERVER;
9775 /***********************************************************
9776 If we are PDC then prefer us as DMB
9777 ************************************************************/
9779 bool lp_domain_master(void)
9781 if (Globals.iDomainMaster == Auto)
9782 return (lp_server_role() == ROLE_DOMAIN_PDC);
9784 return (bool)Globals.iDomainMaster;
9787 /***********************************************************
9788 If we are PDC then prefer us as DMB
9789 ************************************************************/
9791 bool lp_domain_master_true_or_auto(void)
9793 if (Globals.iDomainMaster) /* auto or yes */
9799 /***********************************************************
9800 If we are DMB then prefer us as LMB
9801 ************************************************************/
9803 bool lp_preferred_master(void)
9805 if (Globals.iPreferredMaster == Auto)
9806 return (lp_local_master() && lp_domain_master());
9808 return (bool)Globals.iPreferredMaster;
9811 /*******************************************************************
9813 ********************************************************************/
9815 void lp_remove_service(int snum)
9817 ServicePtrs[snum]->valid = False;
9818 invalid_services[num_invalid_services++] = snum;
9821 /*******************************************************************
9823 ********************************************************************/
9825 void lp_copy_service(int snum, const char *new_name)
9827 do_section(new_name, NULL);
9829 snum = lp_servicenumber(new_name);
9831 lp_do_parameter(snum, "copy", lp_servicename(snum));
9836 /*******************************************************************
9837 Get the default server type we will announce as via nmbd.
9838 ********************************************************************/
9840 int lp_default_server_announce(void)
9842 return default_server_announce;
9845 /*******************************************************************
9846 Split the announce version into major and minor numbers.
9847 ********************************************************************/
9849 int lp_major_announce_version(void)
9851 static bool got_major = False;
9852 static int major_version = DEFAULT_MAJOR_VERSION;
9857 return major_version;
9860 if ((vers = lp_announce_version()) == NULL)
9861 return major_version;
9863 if ((p = strchr_m(vers, '.')) == 0)
9864 return major_version;
9867 major_version = atoi(vers);
9868 return major_version;
9871 int lp_minor_announce_version(void)
9873 static bool got_minor = False;
9874 static int minor_version = DEFAULT_MINOR_VERSION;
9879 return minor_version;
9882 if ((vers = lp_announce_version()) == NULL)
9883 return minor_version;
9885 if ((p = strchr_m(vers, '.')) == 0)
9886 return minor_version;
9889 minor_version = atoi(p);
9890 return minor_version;
9893 /***********************************************************
9894 Set the global name resolution order (used in smbclient).
9895 ************************************************************/
9897 void lp_set_name_resolve_order(const char *new_order)
9899 string_set(&Globals.szNameResolveOrder, new_order);
9902 const char *lp_printername(int snum)
9904 const char *ret = _lp_printername(snum);
9905 if (ret == NULL || (ret != NULL && *ret == '\0'))
9906 ret = lp_const_servicename(snum);
9912 /***********************************************************
9913 Allow daemons such as winbindd to fix their logfile name.
9914 ************************************************************/
9916 void lp_set_logfile(const char *name)
9918 string_set(&Globals.szLogFile, name);
9919 debug_set_logfile(name);
9922 /*******************************************************************
9923 Return the max print jobs per queue.
9924 ********************************************************************/
9926 int lp_maxprintjobs(int snum)
9928 int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
9929 if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
9930 maxjobs = PRINT_MAX_JOBID - 1;
9935 const char *lp_printcapname(void)
9937 if ((Globals.szPrintcapname != NULL) &&
9938 (Globals.szPrintcapname[0] != '\0'))
9939 return Globals.szPrintcapname;
9941 if (sDefault.iPrinting == PRINT_CUPS) {
9949 if (sDefault.iPrinting == PRINT_BSD)
9950 return "/etc/printcap";
9952 return PRINTCAP_NAME;
9955 static uint32 spoolss_state;
9957 bool lp_disable_spoolss( void )
9959 if ( spoolss_state == SVCCTL_STATE_UNKNOWN )
9960 spoolss_state = _lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9962 return spoolss_state == SVCCTL_STOPPED ? True : False;
9965 void lp_set_spoolss_state( uint32 state )
9967 SMB_ASSERT( (state == SVCCTL_STOPPED) || (state == SVCCTL_RUNNING) );
9969 spoolss_state = state;
9972 uint32 lp_get_spoolss_state( void )
9974 return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9977 /*******************************************************************
9978 Ensure we don't use sendfile if server smb signing is active.
9979 ********************************************************************/
9981 bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state)
9983 bool sign_active = false;
9985 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
9986 if (get_Protocol() < PROTOCOL_NT1) {
9989 if (signing_state) {
9990 sign_active = smb_signing_is_active(signing_state);
9992 return (_lp_use_sendfile(snum) &&
9993 (get_remote_arch() != RA_WIN95) &&
9997 /*******************************************************************
9998 Turn off sendfile if we find the underlying OS doesn't support it.
9999 ********************************************************************/
10001 void set_use_sendfile(int snum, bool val)
10003 if (LP_SNUM_OK(snum))
10004 ServicePtrs[snum]->bUseSendfile = val;
10006 sDefault.bUseSendfile = val;
10009 /*******************************************************************
10010 Turn off storing DOS attributes if this share doesn't support it.
10011 ********************************************************************/
10013 void set_store_dos_attributes(int snum, bool val)
10015 if (!LP_SNUM_OK(snum))
10017 ServicePtrs[(snum)]->bStoreDosAttributes = val;
10020 void lp_set_mangling_method(const char *new_method)
10022 string_set(&Globals.szManglingMethod, new_method);
10025 /*******************************************************************
10026 Global state for POSIX pathname processing.
10027 ********************************************************************/
10029 static bool posix_pathnames;
10031 bool lp_posix_pathnames(void)
10033 return posix_pathnames;
10036 /*******************************************************************
10037 Change everything needed to ensure POSIX pathname processing (currently
10039 ********************************************************************/
10041 void lp_set_posix_pathnames(void)
10043 posix_pathnames = True;
10046 /*******************************************************************
10047 Global state for POSIX lock processing - CIFS unix extensions.
10048 ********************************************************************/
10050 bool posix_default_lock_was_set;
10051 static enum brl_flavour posix_cifsx_locktype; /* By default 0 == WINDOWS_LOCK */
10053 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp)
10055 if (posix_default_lock_was_set) {
10056 return posix_cifsx_locktype;
10058 return fsp->posix_open ? POSIX_LOCK : WINDOWS_LOCK;
10062 /*******************************************************************
10063 ********************************************************************/
10065 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val)
10067 posix_default_lock_was_set = True;
10068 posix_cifsx_locktype = val;
10071 int lp_min_receive_file_size(void)
10073 if (Globals.iminreceivefile < 0) {
10076 return MIN(Globals.iminreceivefile, BUFFER_SIZE);
10079 /*******************************************************************
10080 If socket address is an empty character string, it is necessary to
10081 define it as "0.0.0.0".
10082 ********************************************************************/
10084 const char *lp_socket_address(void)
10086 char *sock_addr = Globals.szSocketAddress;
10088 if (sock_addr[0] == '\0'){
10089 string_set(&Globals.szSocketAddress, "0.0.0.0");
10091 return Globals.szSocketAddress;
10094 void lp_set_passdb_backend(const char *backend)
10096 string_set(&Globals.szPassdbBackend, backend);
10099 /*******************************************************************
10100 Safe wide links checks.
10101 This helper function always verify the validity of wide links,
10102 even after a configuration file reload.
10103 ********************************************************************/
10105 static bool lp_widelinks_internal(int snum)
10107 return (bool)(LP_SNUM_OK(snum)? ServicePtrs[(snum)]->bWidelinks :
10108 sDefault.bWidelinks);
10111 void widelinks_warning(int snum)
10113 if (lp_unix_extensions() && lp_widelinks_internal(snum)) {
10114 DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
10115 "These parameters are incompatible. "
10116 "Wide links will be disabled for this share.\n",
10117 lp_servicename(snum) ));
10121 bool lp_widelinks(int snum)
10123 /* wide links is always incompatible with unix extensions */
10124 if (lp_unix_extensions()) {
10128 return lp_widelinks_internal(snum);
10131 bool lp_writeraw(void)
10133 if (lp_async_smb_echo_handler()) {
10136 return _lp_writeraw();
10139 bool lp_readraw(void)
10141 if (lp_async_smb_echo_handler()) {
10144 return _lp_readraw();