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
55 #include "system/filesys.h"
58 #include "lib/smbconf/smbconf.h"
59 #include "lib/smbconf/smbconf_init.h"
62 #include "../librpc/gen_ndr/svcctl.h"
64 #include "smb_signing.h"
68 #ifdef HAVE_SYS_SYSCTL_H
69 #include <sys/sysctl.h>
72 #ifdef HAVE_HTTPCONNECTENCRYPT
73 #include <cups/http.h>
78 extern userdom_struct current_user_info;
81 #define GLOBAL_NAME "global"
85 #define PRINTERS_NAME "printers"
89 #define HOMES_NAME "homes"
92 /* the special value for the include parameter
93 * to be interpreted not as a file name but to
94 * trigger loading of the global smb.conf options
96 #ifndef INCLUDE_REGISTRY_NAME
97 #define INCLUDE_REGISTRY_NAME "registry"
100 static bool in_client = False; /* Not in the client by default */
101 static struct smbconf_csn conf_last_csn;
103 #define CONFIG_BACKEND_FILE 0
104 #define CONFIG_BACKEND_REGISTRY 1
106 static int config_backend = CONFIG_BACKEND_FILE;
108 /* some helpful bits */
109 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
110 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
112 #define USERSHARE_VALID 1
113 #define USERSHARE_PENDING_DELETE 2
115 static bool defaults_saved = False;
117 struct param_opt_struct {
118 struct param_opt_struct *prev, *next;
126 * This structure describes global (ie., server-wide) parameters.
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;
163 char *szAfsUsernameMap;
164 int iAfsTokenLifetime;
165 char *szLogNtTokenCommand;
171 char **szWINSservers;
173 char *szRemoteAnnounce;
174 char *szRemoteBrowseSync;
175 char *szSocketAddress;
176 bool bNmbdBindExplicitBroadcast;
177 char *szNISHomeMapName;
178 char *szAnnounceVersion; /* This is initialised in init_globals */
181 char **szNetbiosAliases;
182 char *szNetbiosScope;
183 char *szNameResolveOrder;
185 char *szAddUserScript;
186 char *szRenameUserScript;
187 char *szDelUserScript;
188 char *szAddGroupScript;
189 char *szDelGroupScript;
190 char *szAddUserToGroupScript;
191 char *szDelUserFromGroupScript;
192 char *szSetPrimaryGroupScript;
193 char *szAddMachineScript;
194 char *szShutdownScript;
195 char *szAbortShutdownScript;
196 char *szUsernameMapScript;
197 int iUsernameMapCacheTime;
198 char *szCheckPasswordScript;
205 bool bPassdbExpandExplicit;
206 int AlgorithmicRidBase;
207 char *szTemplateHomedir;
208 char *szTemplateShell;
209 char *szWinbindSeparator;
210 bool bWinbindEnumUsers;
211 bool bWinbindEnumGroups;
212 bool bWinbindUseDefaultDomain;
213 bool bWinbindTrustedDomainsOnly;
214 bool bWinbindNestedGroups;
215 int winbind_expand_groups;
216 bool bWinbindRefreshTickets;
217 bool bWinbindOfflineLogon;
218 bool bWinbindNormalizeNames;
219 bool bWinbindRpcOnly;
220 bool bCreateKrb5Conf;
221 int winbindMaxDomainConnections;
222 char *szIdmapBackend;
224 char *szAddShareCommand;
225 char *szChangeShareCommand;
226 char *szDeleteShareCommand;
228 char *szGuestaccount;
229 char *szManglingMethod;
230 char **szServicesList;
231 char *szUsersharePath;
232 char *szUsershareTemplateShare;
233 char **szUsersharePrefixAllowList;
234 char **szUsersharePrefixDenyList;
241 int open_files_db_hash_size;
250 bool paranoid_server_security;
253 int iMaxSmbdProcesses;
254 bool bDisableSpoolss;
257 bool enhanced_browsing;
263 int machine_password_timeout;
265 int oplock_break_wait_time;
266 int winbind_cache_time;
267 int winbind_reconnect_delay;
268 int winbind_max_clients;
269 char **szWinbindNssInfo;
271 char *szLdapMachineSuffix;
272 char *szLdapUserSuffix;
273 char *szLdapIdmapSuffix;
274 char *szLdapGroupSuffix;
278 int ldap_follow_referral;
281 int ldap_debug_level;
282 int ldap_debug_threshold;
286 char *szIPrintServer;
288 char **szClusterAddresses;
291 int ctdb_locktime_warn_threshold;
292 int ldap_passwd_sync;
293 int ldap_replication_sleep;
294 int ldap_timeout; /* This is initialised in init_globals */
295 int ldap_connection_timeout;
298 bool bMsAddPrinterWizard;
303 int iPreferredMaster;
306 char **szInitLogonDelayedHosts;
308 bool bEncryptPasswords;
313 bool bObeyPamRestrictions;
315 int PrintcapCacheTime;
316 bool bLargeReadwrite;
323 bool bBindInterfacesOnly;
324 bool bPamPasswordChange;
325 bool bUnixPasswdSync;
326 bool bPasswdChatDebug;
327 int iPasswdChatTimeout;
331 bool bNTStatusSupport;
333 int iMaxStatCacheSize;
335 bool bAllowTrustedDomains;
339 bool bClientLanManAuth;
340 bool bClientNTLMv2Auth;
341 bool bClientPlaintextAuth;
342 bool bClientUseSpnego;
343 bool client_use_spnego_principal;
344 bool send_spnego_principal;
345 bool bDebugPrefixTimestamp;
346 bool bDebugHiresTimestamp;
350 bool bEnableCoreFiles;
353 bool bHostnameLookups;
354 bool bUnixExtensions;
355 bool bDisableNetbios;
356 char * szDedicatedKeytabFile;
358 bool bDeferSharingViolations;
359 bool bEnablePrivileges;
361 bool bUsershareOwnerOnly;
362 bool bUsershareAllowGuests;
363 bool bRegistryShares;
364 int restrict_anonymous;
365 int name_cache_timeout;
368 int client_ldap_sasl_wrapping;
369 int iUsershareMaxShares;
371 int iIdmapNegativeCacheTime;
373 bool bLogWriteableFilesOnExit;
376 struct param_opt_struct *param_opt;
377 int cups_connection_timeout;
378 char *szSMBPerfcountModule;
379 bool bMapUntrustedToDomain;
380 bool bAsyncSMBEchoHandler;
381 bool bMulticastDnsRegister;
385 int ismb2_max_credits;
389 static struct global Globals;
392 * This structure describes a single service.
398 struct timespec usershare_last_mod;
402 char **szInvalidUsers;
410 char *szRootPostExec;
412 char *szPrintcommand;
415 char *szLppausecommand;
416 char *szLpresumecommand;
417 char *szQueuepausecommand;
418 char *szQueueresumecommand;
420 char *szPrintjobUsername;
428 char *szVetoOplockFiles;
434 char **printer_admin;
439 char *szAioWriteBehind;
443 int iMaxReportedPrintJobs;
446 int iCreate_force_mode;
448 int iSecurity_force_mode;
451 int iDir_Security_mask;
452 int iDir_Security_force_mode;
456 int iOplockContentionLimit;
461 bool bRootpreexecClose;
464 bool bShortCasePreserve;
466 bool bHideSpecialFiles;
467 bool bHideUnReadable;
468 bool bHideUnWriteableFiles;
470 bool bAccessBasedShareEnum;
475 bool bAdministrative_share;
478 bool bPrintNotifyBackchannel;
482 bool bStoreDosAttributes;
495 bool bStrictAllocate;
498 struct bitmap *copymap;
499 bool bDeleteReadonly;
501 bool bDeleteVetoFiles;
504 bool bDosFiletimeResolution;
505 bool bFakeDirCreateTimes;
511 bool bUseClientDriver;
512 bool bDefaultDevmode;
513 bool bForcePrintername;
515 bool bForceUnknownAclUser;
518 bool bMap_acl_inherit;
521 bool bAclCheckPermissions;
522 bool bAclMapFullControl;
523 bool bAclGroupControl;
525 bool bKernelChangeNotify;
526 int iallocation_roundup_size;
530 int iDirectoryNameCacheSize;
532 struct param_opt_struct *param_opt;
534 char dummy[3]; /* for alignment */
538 /* This is a default service used to prime a services structure */
539 static struct service sDefault = {
541 False, /* not autoloaded */
542 0, /* not a usershare */
543 {0, }, /* No last mod time */
544 NULL, /* szService */
546 NULL, /* szUsername */
547 NULL, /* szInvalidUsers */
548 NULL, /* szValidUsers */
549 NULL, /* szAdminUsers */
551 NULL, /* szInclude */
552 NULL, /* szPreExec */
553 NULL, /* szPostExec */
554 NULL, /* szRootPreExec */
555 NULL, /* szRootPostExec */
556 NULL, /* szCupsOptions */
557 NULL, /* szPrintcommand */
558 NULL, /* szLpqcommand */
559 NULL, /* szLprmcommand */
560 NULL, /* szLppausecommand */
561 NULL, /* szLpresumecommand */
562 NULL, /* szQueuepausecommand */
563 NULL, /* szQueueresumecommand */
564 NULL, /* szPrintername */
565 NULL, /* szPrintjobUsername */
566 NULL, /* szDontdescend */
567 NULL, /* szHostsallow */
568 NULL, /* szHostsdeny */
569 NULL, /* szMagicScript */
570 NULL, /* szMagicOutput */
571 NULL, /* szVetoFiles */
572 NULL, /* szHideFiles */
573 NULL, /* szVetoOplockFiles */
575 NULL, /* force user */
576 NULL, /* force group */
578 NULL, /* writelist */
579 NULL, /* printer admin */
582 NULL, /* vfs objects */
583 NULL, /* szMSDfsProxy */
584 NULL, /* szAioWriteBehind */
586 0, /* iMinPrintSpace */
587 1000, /* iMaxPrintJobs */
588 0, /* iMaxReportedPrintJobs */
589 0, /* iWriteCacheSize */
590 0744, /* iCreate_mask */
591 0000, /* iCreate_force_mode */
592 0777, /* iSecurity_mask */
593 0, /* iSecurity_force_mode */
594 0755, /* iDir_mask */
595 0000, /* iDir_force_mode */
596 0777, /* iDir_Security_mask */
597 0, /* iDir_Security_force_mode */
598 0, /* iMaxConnections */
599 CASE_LOWER, /* iDefaultCase */
600 DEFAULT_PRINTING, /* iPrinting */
601 2, /* iOplockContentionLimit */
603 1024, /* iBlock_size */
604 0, /* iDfreeCacheTime */
605 False, /* bPreexecClose */
606 False, /* bRootpreexecClose */
607 Auto, /* case sensitive */
608 True, /* case preserve */
609 True, /* short case preserve */
610 True, /* bHideDotFiles */
611 False, /* bHideSpecialFiles */
612 False, /* bHideUnReadable */
613 False, /* bHideUnWriteableFiles */
614 True, /* bBrowseable */
615 False, /* bAccessBasedShareEnum */
616 True, /* bAvailable */
617 True, /* bRead_only */
618 True, /* bNo_set_dir */
619 False, /* bGuest_only */
620 False, /* bAdministrative_share */
621 False, /* bGuest_ok */
622 False, /* bPrint_ok */
623 True, /* bPrintNotifyBackchannel */
624 False, /* bMap_system */
625 False, /* bMap_hidden */
626 True, /* bMap_archive */
627 False, /* bStoreDosAttributes */
628 False, /* bDmapiSupport */
630 Auto, /* iStrictLocking */
631 True, /* bPosixLocking */
632 True, /* bShareModes */
634 True, /* bLevel2OpLocks */
635 False, /* bOnlyUser */
636 True, /* bMangledNames */
637 false, /* bWidelinks */
638 True, /* bSymlinks */
639 False, /* bSyncAlways */
640 False, /* bStrictAllocate */
641 False, /* bStrictSync */
642 '~', /* magic char */
644 False, /* bDeleteReadonly */
645 False, /* bFakeOplocks */
646 False, /* bDeleteVetoFiles */
647 False, /* bDosFilemode */
648 True, /* bDosFiletimes */
649 False, /* bDosFiletimeResolution */
650 False, /* bFakeDirCreateTimes */
651 True, /* bBlockingLocks */
652 False, /* bInheritPerms */
653 False, /* bInheritACLS */
654 False, /* bInheritOwner */
655 False, /* bMSDfsRoot */
656 False, /* bUseClientDriver */
657 True, /* bDefaultDevmode */
658 False, /* bForcePrintername */
659 True, /* bNTAclSupport */
660 False, /* bForceUnknownAclUser */
661 False, /* bUseSendfile */
662 False, /* bProfileAcls */
663 False, /* bMap_acl_inherit */
664 False, /* bAfs_Share */
665 False, /* bEASupport */
666 True, /* bAclCheckPermissions */
667 True, /* bAclMapFullControl */
668 False, /* bAclGroupControl */
669 True, /* bChangeNotify */
670 True, /* bKernelChangeNotify */
671 SMB_ROUNDUP_ALLOCATION_SIZE, /* iallocation_roundup_size */
672 0, /* iAioReadSize */
673 0, /* iAioWriteSize */
674 MAP_READONLY_YES, /* iMap_readonly */
675 #ifdef BROKEN_DIRECTORY_HANDLING
676 0, /* iDirectoryNameCacheSize */
678 100, /* iDirectoryNameCacheSize */
680 Auto, /* ismb_encrypt */
681 NULL, /* Parametric options */
686 /* local variables */
687 static struct service **ServicePtrs = NULL;
688 static int iNumServices = 0;
689 static int iServiceIndex = 0;
690 static struct db_context *ServiceHash;
691 static int *invalid_services = NULL;
692 static int num_invalid_services = 0;
693 static bool bInGlobalSection = True;
694 static bool bGlobalOnly = False;
695 static int default_server_announce;
697 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
699 /* prototypes for the special type handlers */
700 static bool handle_include( int snum, const char *pszParmValue, char **ptr);
701 static bool handle_copy( int snum, const char *pszParmValue, char **ptr);
702 static bool handle_idmap_backend(int snum, const char *pszParmValue, char **ptr);
703 static bool handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);
704 static bool handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);
705 static bool handle_debug_list( int snum, const char *pszParmValue, char **ptr );
706 static bool handle_realm( int snum, const char *pszParmValue, char **ptr );
707 static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
708 static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
709 static bool handle_dos_charset( int snum, const char *pszParmValue, char **ptr );
710 static bool handle_printing( int snum, const char *pszParmValue, char **ptr);
711 static bool handle_ldap_debug_level( int snum, const char *pszParmValue, char **ptr);
713 static void set_default_server_announce_type(void);
714 static void set_allowed_client_auth(void);
716 static void *lp_local_ptr(struct service *service, void *ptr);
718 static void add_to_file_list(const char *fname, const char *subfname);
719 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values);
721 static const struct enum_list enum_protocol[] = {
722 {PROTOCOL_SMB2, "SMB2"},
723 {PROTOCOL_NT1, "NT1"},
724 {PROTOCOL_LANMAN2, "LANMAN2"},
725 {PROTOCOL_LANMAN1, "LANMAN1"},
726 {PROTOCOL_CORE, "CORE"},
727 {PROTOCOL_COREPLUS, "COREPLUS"},
728 {PROTOCOL_COREPLUS, "CORE+"},
732 static const struct enum_list enum_security[] = {
733 {SEC_SHARE, "SHARE"},
735 {SEC_SERVER, "SERVER"},
736 {SEC_DOMAIN, "DOMAIN"},
743 static const struct enum_list enum_printing[] = {
744 {PRINT_SYSV, "sysv"},
746 {PRINT_HPUX, "hpux"},
750 {PRINT_LPRNG, "lprng"},
751 {PRINT_CUPS, "cups"},
752 {PRINT_IPRINT, "iprint"},
754 {PRINT_LPROS2, "os2"},
755 #if defined(DEVELOPER) || defined(ENABLE_BUILD_FARM_HACKS)
756 {PRINT_TEST, "test"},
758 #endif /* DEVELOPER */
762 static const struct enum_list enum_ldap_sasl_wrapping[] = {
764 {ADS_AUTH_SASL_SIGN, "sign"},
765 {ADS_AUTH_SASL_SEAL, "seal"},
769 static const struct enum_list enum_ldap_ssl[] = {
770 {LDAP_SSL_OFF, "no"},
771 {LDAP_SSL_OFF, "off"},
772 {LDAP_SSL_START_TLS, "start tls"},
773 {LDAP_SSL_START_TLS, "start_tls"},
777 /* LDAP Dereferencing Alias types */
778 #define SAMBA_LDAP_DEREF_NEVER 0
779 #define SAMBA_LDAP_DEREF_SEARCHING 1
780 #define SAMBA_LDAP_DEREF_FINDING 2
781 #define SAMBA_LDAP_DEREF_ALWAYS 3
783 static const struct enum_list enum_ldap_deref[] = {
784 {SAMBA_LDAP_DEREF_NEVER, "never"},
785 {SAMBA_LDAP_DEREF_SEARCHING, "searching"},
786 {SAMBA_LDAP_DEREF_FINDING, "finding"},
787 {SAMBA_LDAP_DEREF_ALWAYS, "always"},
791 static const struct enum_list enum_ldap_passwd_sync[] = {
792 {LDAP_PASSWD_SYNC_OFF, "no"},
793 {LDAP_PASSWD_SYNC_OFF, "off"},
794 {LDAP_PASSWD_SYNC_ON, "yes"},
795 {LDAP_PASSWD_SYNC_ON, "on"},
796 {LDAP_PASSWD_SYNC_ONLY, "only"},
800 static const struct enum_list enum_map_readonly[] = {
801 {MAP_READONLY_NO, "no"},
802 {MAP_READONLY_NO, "false"},
803 {MAP_READONLY_NO, "0"},
804 {MAP_READONLY_YES, "yes"},
805 {MAP_READONLY_YES, "true"},
806 {MAP_READONLY_YES, "1"},
807 {MAP_READONLY_PERMISSIONS, "permissions"},
808 {MAP_READONLY_PERMISSIONS, "perms"},
812 static const struct enum_list enum_case[] = {
813 {CASE_LOWER, "lower"},
814 {CASE_UPPER, "upper"},
820 static const struct enum_list enum_bool_auto[] = {
831 static const struct enum_list enum_csc_policy[] = {
832 {CSC_POLICY_MANUAL, "manual"},
833 {CSC_POLICY_DOCUMENTS, "documents"},
834 {CSC_POLICY_PROGRAMS, "programs"},
835 {CSC_POLICY_DISABLE, "disable"},
839 /* SMB signing types. */
840 static const struct enum_list enum_smb_signing_vals[] = {
852 {Required, "required"},
853 {Required, "mandatory"},
855 {Required, "forced"},
856 {Required, "enforced"},
860 /* ACL compatibility options. */
861 static const struct enum_list enum_acl_compat_vals[] = {
862 { ACL_COMPAT_AUTO, "auto" },
863 { ACL_COMPAT_WINNT, "winnt" },
864 { ACL_COMPAT_WIN2K, "win2k" },
869 Do you want session setups at user level security with a invalid
870 password to be rejected or allowed in as guest? WinNT rejects them
871 but it can be a pain as it means "net view" needs to use a password
873 You have 3 choices in the setting of map_to_guest:
875 "Never" means session setups with an invalid password
876 are rejected. This is the default.
878 "Bad User" means session setups with an invalid password
879 are rejected, unless the username does not exist, in which case it
880 is treated as a guest login
882 "Bad Password" means session setups with an invalid password
883 are treated as a guest login
885 Note that map_to_guest only has an effect in user or server
889 static const struct enum_list enum_map_to_guest[] = {
890 {NEVER_MAP_TO_GUEST, "Never"},
891 {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
892 {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
893 {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},
897 /* Config backend options */
899 static const struct enum_list enum_config_backend[] = {
900 {CONFIG_BACKEND_FILE, "file"},
901 {CONFIG_BACKEND_REGISTRY, "registry"},
905 /* ADS kerberos ticket verification options */
907 static const struct enum_list enum_kerberos_method[] = {
908 {KERBEROS_VERIFY_SECRETS, "default"},
909 {KERBEROS_VERIFY_SECRETS, "secrets only"},
910 {KERBEROS_VERIFY_SYSTEM_KEYTAB, "system keytab"},
911 {KERBEROS_VERIFY_DEDICATED_KEYTAB, "dedicated keytab"},
912 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB, "secrets and keytab"},
916 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
918 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
919 * screen in SWAT. This is used to exclude parameters as well as to squash all
920 * parameters that have been duplicated by pseudonyms.
922 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
923 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
924 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
927 * NOTE2: Handling of duplicated (synonym) parameters:
928 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
929 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
930 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
931 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
934 static struct parm_struct parm_table[] = {
935 {N_("Base Options"), P_SEP, P_SEPARATOR},
938 .label = "dos charset",
941 .ptr = &Globals.dos_charset,
942 .special = handle_dos_charset,
944 .flags = FLAG_ADVANCED
947 .label = "unix charset",
950 .ptr = &Globals.unix_charset,
951 .special = handle_charset,
953 .flags = FLAG_ADVANCED
959 .ptr = &sDefault.comment,
962 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT
968 .ptr = &sDefault.szPath,
971 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
974 .label = "directory",
977 .ptr = &sDefault.szPath,
983 .label = "workgroup",
986 .ptr = &Globals.szWorkgroup,
989 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
995 .ptr = &Globals.szRealm,
996 .special = handle_realm,
998 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1001 .label = "netbios name",
1003 .p_class = P_GLOBAL,
1004 .ptr = &Globals.szNetbiosName,
1007 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1010 .label = "netbios aliases",
1012 .p_class = P_GLOBAL,
1013 .ptr = &Globals.szNetbiosAliases,
1014 .special = handle_netbios_aliases,
1016 .flags = FLAG_ADVANCED,
1019 .label = "netbios scope",
1021 .p_class = P_GLOBAL,
1022 .ptr = &Globals.szNetbiosScope,
1025 .flags = FLAG_ADVANCED,
1028 .label = "server string",
1030 .p_class = P_GLOBAL,
1031 .ptr = &Globals.szServerString,
1034 .flags = FLAG_BASIC | FLAG_ADVANCED,
1037 .label = "interfaces",
1039 .p_class = P_GLOBAL,
1040 .ptr = &Globals.szInterfaces,
1043 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1046 .label = "bind interfaces only",
1048 .p_class = P_GLOBAL,
1049 .ptr = &Globals.bBindInterfacesOnly,
1052 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1055 .label = "config backend",
1057 .p_class = P_GLOBAL,
1058 .ptr = &Globals.ConfigBackend,
1060 .enum_list = enum_config_backend,
1061 .flags = FLAG_HIDE|FLAG_ADVANCED|FLAG_META,
1064 {N_("Security Options"), P_SEP, P_SEPARATOR},
1067 .label = "security",
1069 .p_class = P_GLOBAL,
1070 .ptr = &Globals.security,
1072 .enum_list = enum_security,
1073 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1076 .label = "auth methods",
1078 .p_class = P_GLOBAL,
1079 .ptr = &Globals.AuthMethods,
1082 .flags = FLAG_ADVANCED,
1085 .label = "encrypt passwords",
1087 .p_class = P_GLOBAL,
1088 .ptr = &Globals.bEncryptPasswords,
1091 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1094 .label = "client schannel",
1096 .p_class = P_GLOBAL,
1097 .ptr = &Globals.clientSchannel,
1099 .enum_list = enum_bool_auto,
1100 .flags = FLAG_BASIC | FLAG_ADVANCED,
1103 .label = "server schannel",
1105 .p_class = P_GLOBAL,
1106 .ptr = &Globals.serverSchannel,
1108 .enum_list = enum_bool_auto,
1109 .flags = FLAG_BASIC | FLAG_ADVANCED,
1112 .label = "allow trusted domains",
1114 .p_class = P_GLOBAL,
1115 .ptr = &Globals.bAllowTrustedDomains,
1118 .flags = FLAG_ADVANCED,
1121 .label = "map to guest",
1123 .p_class = P_GLOBAL,
1124 .ptr = &Globals.map_to_guest,
1126 .enum_list = enum_map_to_guest,
1127 .flags = FLAG_ADVANCED,
1130 .label = "null passwords",
1132 .p_class = P_GLOBAL,
1133 .ptr = &Globals.bNullPasswords,
1136 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
1139 .label = "obey pam restrictions",
1141 .p_class = P_GLOBAL,
1142 .ptr = &Globals.bObeyPamRestrictions,
1145 .flags = FLAG_ADVANCED,
1148 .label = "password server",
1150 .p_class = P_GLOBAL,
1151 .ptr = &Globals.szPasswordServer,
1154 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1157 .label = "smb passwd file",
1159 .p_class = P_GLOBAL,
1160 .ptr = &Globals.szSMBPasswdFile,
1163 .flags = FLAG_ADVANCED,
1166 .label = "private dir",
1168 .p_class = P_GLOBAL,
1169 .ptr = &Globals.szPrivateDir,
1172 .flags = FLAG_ADVANCED,
1175 .label = "passdb backend",
1177 .p_class = P_GLOBAL,
1178 .ptr = &Globals.szPassdbBackend,
1181 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1184 .label = "algorithmic rid base",
1186 .p_class = P_GLOBAL,
1187 .ptr = &Globals.AlgorithmicRidBase,
1190 .flags = FLAG_ADVANCED,
1193 .label = "root directory",
1195 .p_class = P_GLOBAL,
1196 .ptr = &Globals.szRootdir,
1199 .flags = FLAG_ADVANCED,
1202 .label = "root dir",
1204 .p_class = P_GLOBAL,
1205 .ptr = &Globals.szRootdir,
1213 .p_class = P_GLOBAL,
1214 .ptr = &Globals.szRootdir,
1220 .label = "guest account",
1222 .p_class = P_GLOBAL,
1223 .ptr = &Globals.szGuestaccount,
1226 .flags = FLAG_BASIC | FLAG_ADVANCED,
1229 .label = "enable privileges",
1231 .p_class = P_GLOBAL,
1232 .ptr = &Globals.bEnablePrivileges,
1235 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
1239 .label = "pam password change",
1241 .p_class = P_GLOBAL,
1242 .ptr = &Globals.bPamPasswordChange,
1245 .flags = FLAG_ADVANCED,
1248 .label = "passwd program",
1250 .p_class = P_GLOBAL,
1251 .ptr = &Globals.szPasswdProgram,
1254 .flags = FLAG_ADVANCED,
1257 .label = "passwd chat",
1259 .p_class = P_GLOBAL,
1260 .ptr = &Globals.szPasswdChat,
1263 .flags = FLAG_ADVANCED,
1266 .label = "passwd chat debug",
1268 .p_class = P_GLOBAL,
1269 .ptr = &Globals.bPasswdChatDebug,
1272 .flags = FLAG_ADVANCED,
1275 .label = "passwd chat timeout",
1277 .p_class = P_GLOBAL,
1278 .ptr = &Globals.iPasswdChatTimeout,
1281 .flags = FLAG_ADVANCED,
1284 .label = "check password script",
1286 .p_class = P_GLOBAL,
1287 .ptr = &Globals.szCheckPasswordScript,
1290 .flags = FLAG_ADVANCED,
1293 .label = "username map",
1295 .p_class = P_GLOBAL,
1296 .ptr = &Globals.szUsernameMap,
1299 .flags = FLAG_ADVANCED,
1302 .label = "password level",
1304 .p_class = P_GLOBAL,
1305 .ptr = &Globals.pwordlevel,
1308 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
1311 .label = "username level",
1313 .p_class = P_GLOBAL,
1314 .ptr = &Globals.unamelevel,
1317 .flags = FLAG_ADVANCED,
1320 .label = "unix password sync",
1322 .p_class = P_GLOBAL,
1323 .ptr = &Globals.bUnixPasswdSync,
1326 .flags = FLAG_ADVANCED,
1329 .label = "restrict anonymous",
1331 .p_class = P_GLOBAL,
1332 .ptr = &Globals.restrict_anonymous,
1335 .flags = FLAG_ADVANCED,
1338 .label = "lanman auth",
1340 .p_class = P_GLOBAL,
1341 .ptr = &Globals.bLanmanAuth,
1344 .flags = FLAG_ADVANCED,
1347 .label = "ntlm auth",
1349 .p_class = P_GLOBAL,
1350 .ptr = &Globals.bNTLMAuth,
1353 .flags = FLAG_ADVANCED,
1356 .label = "client NTLMv2 auth",
1358 .p_class = P_GLOBAL,
1359 .ptr = &Globals.bClientNTLMv2Auth,
1362 .flags = FLAG_ADVANCED,
1365 .label = "client lanman auth",
1367 .p_class = P_GLOBAL,
1368 .ptr = &Globals.bClientLanManAuth,
1371 .flags = FLAG_ADVANCED,
1374 .label = "client plaintext auth",
1376 .p_class = P_GLOBAL,
1377 .ptr = &Globals.bClientPlaintextAuth,
1380 .flags = FLAG_ADVANCED,
1383 .label = "client use spnego principal",
1385 .p_class = P_GLOBAL,
1386 .ptr = &Globals.client_use_spnego_principal,
1389 .flags = FLAG_ADVANCED,
1392 .label = "send spnego principal",
1394 .p_class = P_GLOBAL,
1395 .ptr = &Globals.send_spnego_principal,
1398 .flags = FLAG_ADVANCED,
1401 .label = "username",
1404 .ptr = &sDefault.szUsername,
1407 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE | FLAG_DEPRECATED,
1413 .ptr = &sDefault.szUsername,
1422 .ptr = &sDefault.szUsername,
1428 .label = "invalid users",
1431 .ptr = &sDefault.szInvalidUsers,
1434 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1437 .label = "valid users",
1440 .ptr = &sDefault.szValidUsers,
1443 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1446 .label = "admin users",
1449 .ptr = &sDefault.szAdminUsers,
1452 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1455 .label = "read list",
1458 .ptr = &sDefault.readlist,
1461 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1464 .label = "write list",
1467 .ptr = &sDefault.writelist,
1470 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1473 .label = "printer admin",
1476 .ptr = &sDefault.printer_admin,
1479 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_PRINT | FLAG_DEPRECATED,
1482 .label = "force user",
1485 .ptr = &sDefault.force_user,
1488 .flags = FLAG_ADVANCED | FLAG_SHARE,
1491 .label = "force group",
1494 .ptr = &sDefault.force_group,
1497 .flags = FLAG_ADVANCED | FLAG_SHARE,
1503 .ptr = &sDefault.force_group,
1506 .flags = FLAG_ADVANCED,
1509 .label = "read only",
1512 .ptr = &sDefault.bRead_only,
1515 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE,
1518 .label = "write ok",
1521 .ptr = &sDefault.bRead_only,
1527 .label = "writeable",
1530 .ptr = &sDefault.bRead_only,
1536 .label = "writable",
1539 .ptr = &sDefault.bRead_only,
1545 .label = "acl check permissions",
1548 .ptr = &sDefault.bAclCheckPermissions,
1551 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1554 .label = "acl group control",
1557 .ptr = &sDefault.bAclGroupControl,
1560 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1563 .label = "acl map full control",
1566 .ptr = &sDefault.bAclMapFullControl,
1569 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1572 .label = "create mask",
1575 .ptr = &sDefault.iCreate_mask,
1578 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1581 .label = "create mode",
1584 .ptr = &sDefault.iCreate_mask,
1590 .label = "force create mode",
1593 .ptr = &sDefault.iCreate_force_mode,
1596 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1599 .label = "security mask",
1602 .ptr = &sDefault.iSecurity_mask,
1605 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1608 .label = "force security mode",
1611 .ptr = &sDefault.iSecurity_force_mode,
1614 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1617 .label = "directory mask",
1620 .ptr = &sDefault.iDir_mask,
1623 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1626 .label = "directory mode",
1629 .ptr = &sDefault.iDir_mask,
1632 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1635 .label = "force directory mode",
1638 .ptr = &sDefault.iDir_force_mode,
1641 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1644 .label = "directory security mask",
1647 .ptr = &sDefault.iDir_Security_mask,
1650 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1653 .label = "force directory security mode",
1656 .ptr = &sDefault.iDir_Security_force_mode,
1659 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1662 .label = "force unknown acl user",
1665 .ptr = &sDefault.bForceUnknownAclUser,
1668 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1671 .label = "inherit permissions",
1674 .ptr = &sDefault.bInheritPerms,
1677 .flags = FLAG_ADVANCED | FLAG_SHARE,
1680 .label = "inherit acls",
1683 .ptr = &sDefault.bInheritACLS,
1686 .flags = FLAG_ADVANCED | FLAG_SHARE,
1689 .label = "inherit owner",
1692 .ptr = &sDefault.bInheritOwner,
1695 .flags = FLAG_ADVANCED | FLAG_SHARE,
1698 .label = "guest only",
1701 .ptr = &sDefault.bGuest_only,
1704 .flags = FLAG_ADVANCED | FLAG_SHARE,
1707 .label = "only guest",
1710 .ptr = &sDefault.bGuest_only,
1716 .label = "administrative share",
1719 .ptr = &sDefault.bAdministrative_share,
1722 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1726 .label = "guest ok",
1729 .ptr = &sDefault.bGuest_ok,
1732 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1738 .ptr = &sDefault.bGuest_ok,
1744 .label = "only user",
1747 .ptr = &sDefault.bOnlyUser,
1750 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED,
1753 .label = "hosts allow",
1756 .ptr = &sDefault.szHostsallow,
1759 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1762 .label = "allow hosts",
1765 .ptr = &sDefault.szHostsallow,
1771 .label = "hosts deny",
1774 .ptr = &sDefault.szHostsdeny,
1777 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1780 .label = "deny hosts",
1783 .ptr = &sDefault.szHostsdeny,
1789 .label = "preload modules",
1791 .p_class = P_GLOBAL,
1792 .ptr = &Globals.szPreloadModules,
1795 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1798 .label = "dedicated keytab file",
1800 .p_class = P_GLOBAL,
1801 .ptr = &Globals.szDedicatedKeytabFile,
1804 .flags = FLAG_ADVANCED,
1807 .label = "kerberos method",
1809 .p_class = P_GLOBAL,
1810 .ptr = &Globals.iKerberosMethod,
1812 .enum_list = enum_kerberos_method,
1813 .flags = FLAG_ADVANCED,
1816 .label = "map untrusted to domain",
1818 .p_class = P_GLOBAL,
1819 .ptr = &Globals.bMapUntrustedToDomain,
1822 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1826 {N_("Logging Options"), P_SEP, P_SEPARATOR},
1829 .label = "log level",
1831 .p_class = P_GLOBAL,
1832 .ptr = &Globals.szLogLevel,
1833 .special = handle_debug_list,
1835 .flags = FLAG_ADVANCED,
1838 .label = "debuglevel",
1840 .p_class = P_GLOBAL,
1841 .ptr = &Globals.szLogLevel,
1842 .special = handle_debug_list,
1849 .p_class = P_GLOBAL,
1850 .ptr = &Globals.syslog,
1853 .flags = FLAG_ADVANCED,
1856 .label = "syslog only",
1858 .p_class = P_GLOBAL,
1859 .ptr = &Globals.bSyslogOnly,
1862 .flags = FLAG_ADVANCED,
1865 .label = "log file",
1867 .p_class = P_GLOBAL,
1868 .ptr = &Globals.szLogFile,
1871 .flags = FLAG_ADVANCED,
1874 .label = "max log size",
1876 .p_class = P_GLOBAL,
1877 .ptr = &Globals.max_log_size,
1880 .flags = FLAG_ADVANCED,
1883 .label = "debug timestamp",
1885 .p_class = P_GLOBAL,
1886 .ptr = &Globals.bTimestampLogs,
1889 .flags = FLAG_ADVANCED,
1892 .label = "timestamp logs",
1894 .p_class = P_GLOBAL,
1895 .ptr = &Globals.bTimestampLogs,
1898 .flags = FLAG_ADVANCED,
1901 .label = "debug prefix timestamp",
1903 .p_class = P_GLOBAL,
1904 .ptr = &Globals.bDebugPrefixTimestamp,
1907 .flags = FLAG_ADVANCED,
1910 .label = "debug hires timestamp",
1912 .p_class = P_GLOBAL,
1913 .ptr = &Globals.bDebugHiresTimestamp,
1916 .flags = FLAG_ADVANCED,
1919 .label = "debug pid",
1921 .p_class = P_GLOBAL,
1922 .ptr = &Globals.bDebugPid,
1925 .flags = FLAG_ADVANCED,
1928 .label = "debug uid",
1930 .p_class = P_GLOBAL,
1931 .ptr = &Globals.bDebugUid,
1934 .flags = FLAG_ADVANCED,
1937 .label = "debug class",
1939 .p_class = P_GLOBAL,
1940 .ptr = &Globals.bDebugClass,
1943 .flags = FLAG_ADVANCED,
1946 .label = "enable core files",
1948 .p_class = P_GLOBAL,
1949 .ptr = &Globals.bEnableCoreFiles,
1952 .flags = FLAG_ADVANCED,
1955 {N_("Protocol Options"), P_SEP, P_SEPARATOR},
1958 .label = "allocation roundup size",
1961 .ptr = &sDefault.iallocation_roundup_size,
1964 .flags = FLAG_ADVANCED,
1967 .label = "aio read size",
1970 .ptr = &sDefault.iAioReadSize,
1973 .flags = FLAG_ADVANCED,
1976 .label = "aio write size",
1979 .ptr = &sDefault.iAioWriteSize,
1982 .flags = FLAG_ADVANCED,
1985 .label = "aio write behind",
1988 .ptr = &sDefault.szAioWriteBehind,
1991 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1994 .label = "smb ports",
1996 .p_class = P_GLOBAL,
1997 .ptr = &Globals.smb_ports,
2000 .flags = FLAG_ADVANCED,
2003 .label = "large readwrite",
2005 .p_class = P_GLOBAL,
2006 .ptr = &Globals.bLargeReadwrite,
2009 .flags = FLAG_ADVANCED,
2012 .label = "max protocol",
2014 .p_class = P_GLOBAL,
2015 .ptr = &Globals.maxprotocol,
2017 .enum_list = enum_protocol,
2018 .flags = FLAG_ADVANCED,
2021 .label = "protocol",
2023 .p_class = P_GLOBAL,
2024 .ptr = &Globals.maxprotocol,
2026 .enum_list = enum_protocol,
2027 .flags = FLAG_ADVANCED,
2030 .label = "min protocol",
2032 .p_class = P_GLOBAL,
2033 .ptr = &Globals.minprotocol,
2035 .enum_list = enum_protocol,
2036 .flags = FLAG_ADVANCED,
2039 .label = "min receivefile size",
2041 .p_class = P_GLOBAL,
2042 .ptr = &Globals.iminreceivefile,
2045 .flags = FLAG_ADVANCED,
2048 .label = "read raw",
2050 .p_class = P_GLOBAL,
2051 .ptr = &Globals.bReadRaw,
2054 .flags = FLAG_ADVANCED,
2057 .label = "write raw",
2059 .p_class = P_GLOBAL,
2060 .ptr = &Globals.bWriteRaw,
2063 .flags = FLAG_ADVANCED,
2066 .label = "disable netbios",
2068 .p_class = P_GLOBAL,
2069 .ptr = &Globals.bDisableNetbios,
2072 .flags = FLAG_ADVANCED,
2075 .label = "reset on zero vc",
2077 .p_class = P_GLOBAL,
2078 .ptr = &Globals.bResetOnZeroVC,
2081 .flags = FLAG_ADVANCED,
2084 .label = "log writeable files on exit",
2086 .p_class = P_GLOBAL,
2087 .ptr = &Globals.bLogWriteableFilesOnExit,
2090 .flags = FLAG_ADVANCED,
2093 .label = "acl compatibility",
2095 .p_class = P_GLOBAL,
2096 .ptr = &Globals.iAclCompat,
2098 .enum_list = enum_acl_compat_vals,
2099 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2102 .label = "defer sharing violations",
2104 .p_class = P_GLOBAL,
2105 .ptr = &Globals.bDeferSharingViolations,
2108 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2111 .label = "ea support",
2114 .ptr = &sDefault.bEASupport,
2117 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2120 .label = "nt acl support",
2123 .ptr = &sDefault.bNTAclSupport,
2126 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2129 .label = "nt pipe support",
2131 .p_class = P_GLOBAL,
2132 .ptr = &Globals.bNTPipeSupport,
2135 .flags = FLAG_ADVANCED,
2138 .label = "nt status support",
2140 .p_class = P_GLOBAL,
2141 .ptr = &Globals.bNTStatusSupport,
2144 .flags = FLAG_ADVANCED,
2147 .label = "profile acls",
2150 .ptr = &sDefault.bProfileAcls,
2153 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
2156 .label = "announce version",
2158 .p_class = P_GLOBAL,
2159 .ptr = &Globals.szAnnounceVersion,
2162 .flags = FLAG_ADVANCED,
2165 .label = "map acl inherit",
2168 .ptr = &sDefault.bMap_acl_inherit,
2171 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2174 .label = "afs share",
2177 .ptr = &sDefault.bAfs_Share,
2180 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2185 .p_class = P_GLOBAL,
2186 .ptr = &Globals.max_mux,
2189 .flags = FLAG_ADVANCED,
2192 .label = "max xmit",
2194 .p_class = P_GLOBAL,
2195 .ptr = &Globals.max_xmit,
2198 .flags = FLAG_ADVANCED,
2201 .label = "name resolve order",
2203 .p_class = P_GLOBAL,
2204 .ptr = &Globals.szNameResolveOrder,
2207 .flags = FLAG_ADVANCED | FLAG_WIZARD,
2212 .p_class = P_GLOBAL,
2213 .ptr = &Globals.max_ttl,
2216 .flags = FLAG_ADVANCED,
2219 .label = "max wins ttl",
2221 .p_class = P_GLOBAL,
2222 .ptr = &Globals.max_wins_ttl,
2225 .flags = FLAG_ADVANCED,
2228 .label = "min wins ttl",
2230 .p_class = P_GLOBAL,
2231 .ptr = &Globals.min_wins_ttl,
2234 .flags = FLAG_ADVANCED,
2237 .label = "time server",
2239 .p_class = P_GLOBAL,
2240 .ptr = &Globals.bTimeServer,
2243 .flags = FLAG_ADVANCED,
2246 .label = "unix extensions",
2248 .p_class = P_GLOBAL,
2249 .ptr = &Globals.bUnixExtensions,
2252 .flags = FLAG_ADVANCED,
2255 .label = "use spnego",
2257 .p_class = P_GLOBAL,
2258 .ptr = &Globals.bUseSpnego,
2261 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
2264 .label = "client signing",
2266 .p_class = P_GLOBAL,
2267 .ptr = &Globals.client_signing,
2269 .enum_list = enum_smb_signing_vals,
2270 .flags = FLAG_ADVANCED,
2273 .label = "server signing",
2275 .p_class = P_GLOBAL,
2276 .ptr = &Globals.server_signing,
2278 .enum_list = enum_smb_signing_vals,
2279 .flags = FLAG_ADVANCED,
2282 .label = "smb encrypt",
2285 .ptr = &sDefault.ismb_encrypt,
2287 .enum_list = enum_smb_signing_vals,
2288 .flags = FLAG_ADVANCED,
2291 .label = "client use spnego",
2293 .p_class = P_GLOBAL,
2294 .ptr = &Globals.bClientUseSpnego,
2297 .flags = FLAG_ADVANCED,
2300 .label = "client ldap sasl wrapping",
2302 .p_class = P_GLOBAL,
2303 .ptr = &Globals.client_ldap_sasl_wrapping,
2305 .enum_list = enum_ldap_sasl_wrapping,
2306 .flags = FLAG_ADVANCED,
2309 .label = "enable asu support",
2311 .p_class = P_GLOBAL,
2312 .ptr = &Globals.bASUSupport,
2315 .flags = FLAG_ADVANCED,
2318 .label = "svcctl list",
2320 .p_class = P_GLOBAL,
2321 .ptr = &Globals.szServicesList,
2324 .flags = FLAG_ADVANCED,
2327 {N_("Tuning Options"), P_SEP, P_SEPARATOR},
2330 .label = "block size",
2333 .ptr = &sDefault.iBlock_size,
2336 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2339 .label = "deadtime",
2341 .p_class = P_GLOBAL,
2342 .ptr = &Globals.deadtime,
2345 .flags = FLAG_ADVANCED,
2348 .label = "getwd cache",
2350 .p_class = P_GLOBAL,
2351 .ptr = &Globals.getwd_cache,
2354 .flags = FLAG_ADVANCED,
2357 .label = "keepalive",
2359 .p_class = P_GLOBAL,
2360 .ptr = &Globals.iKeepalive,
2363 .flags = FLAG_ADVANCED,
2366 .label = "change notify",
2369 .ptr = &sDefault.bChangeNotify,
2372 .flags = FLAG_ADVANCED | FLAG_SHARE,
2375 .label = "directory name cache size",
2378 .ptr = &sDefault.iDirectoryNameCacheSize,
2381 .flags = FLAG_ADVANCED | FLAG_SHARE,
2384 .label = "kernel change notify",
2387 .ptr = &sDefault.bKernelChangeNotify,
2390 .flags = FLAG_ADVANCED | FLAG_SHARE,
2393 .label = "lpq cache time",
2395 .p_class = P_GLOBAL,
2396 .ptr = &Globals.lpqcachetime,
2399 .flags = FLAG_ADVANCED,
2402 .label = "max smbd processes",
2404 .p_class = P_GLOBAL,
2405 .ptr = &Globals.iMaxSmbdProcesses,
2408 .flags = FLAG_ADVANCED,
2411 .label = "max connections",
2414 .ptr = &sDefault.iMaxConnections,
2417 .flags = FLAG_ADVANCED | FLAG_SHARE,
2420 .label = "paranoid server security",
2422 .p_class = P_GLOBAL,
2423 .ptr = &Globals.paranoid_server_security,
2426 .flags = FLAG_ADVANCED,
2429 .label = "max disk size",
2431 .p_class = P_GLOBAL,
2432 .ptr = &Globals.maxdisksize,
2435 .flags = FLAG_ADVANCED,
2438 .label = "max open files",
2440 .p_class = P_GLOBAL,
2441 .ptr = &Globals.max_open_files,
2444 .flags = FLAG_ADVANCED,
2447 .label = "min print space",
2450 .ptr = &sDefault.iMinPrintSpace,
2453 .flags = FLAG_ADVANCED | FLAG_PRINT,
2456 .label = "socket options",
2458 .p_class = P_GLOBAL,
2459 .ptr = &Globals.szSocketOptions,
2462 .flags = FLAG_ADVANCED,
2465 .label = "strict allocate",
2468 .ptr = &sDefault.bStrictAllocate,
2471 .flags = FLAG_ADVANCED | FLAG_SHARE,
2474 .label = "strict sync",
2477 .ptr = &sDefault.bStrictSync,
2480 .flags = FLAG_ADVANCED | FLAG_SHARE,
2483 .label = "sync always",
2486 .ptr = &sDefault.bSyncAlways,
2489 .flags = FLAG_ADVANCED | FLAG_SHARE,
2492 .label = "use mmap",
2494 .p_class = P_GLOBAL,
2495 .ptr = &Globals.bUseMmap,
2498 .flags = FLAG_ADVANCED,
2501 .label = "use sendfile",
2504 .ptr = &sDefault.bUseSendfile,
2507 .flags = FLAG_ADVANCED | FLAG_SHARE,
2510 .label = "hostname lookups",
2512 .p_class = P_GLOBAL,
2513 .ptr = &Globals.bHostnameLookups,
2516 .flags = FLAG_ADVANCED,
2519 .label = "write cache size",
2522 .ptr = &sDefault.iWriteCacheSize,
2525 .flags = FLAG_ADVANCED | FLAG_SHARE,
2528 .label = "name cache timeout",
2530 .p_class = P_GLOBAL,
2531 .ptr = &Globals.name_cache_timeout,
2534 .flags = FLAG_ADVANCED,
2537 .label = "ctdbd socket",
2539 .p_class = P_GLOBAL,
2540 .ptr = &Globals.ctdbdSocket,
2543 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2546 .label = "cluster addresses",
2548 .p_class = P_GLOBAL,
2549 .ptr = &Globals.szClusterAddresses,
2552 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2555 .label = "clustering",
2557 .p_class = P_GLOBAL,
2558 .ptr = &Globals.clustering,
2561 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2564 .label = "ctdb timeout",
2566 .p_class = P_GLOBAL,
2567 .ptr = &Globals.ctdb_timeout,
2570 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2573 .label = "ctdb locktime warn threshold",
2575 .p_class = P_GLOBAL,
2576 .ptr = &Globals.ctdb_locktime_warn_threshold,
2579 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2582 .label = "smb2 max read",
2584 .p_class = P_GLOBAL,
2585 .ptr = &Globals.ismb2_max_read,
2588 .flags = FLAG_ADVANCED,
2591 .label = "smb2 max write",
2593 .p_class = P_GLOBAL,
2594 .ptr = &Globals.ismb2_max_write,
2597 .flags = FLAG_ADVANCED,
2600 .label = "smb2 max trans",
2602 .p_class = P_GLOBAL,
2603 .ptr = &Globals.ismb2_max_trans,
2606 .flags = FLAG_ADVANCED,
2609 .label = "smb2 max credits",
2611 .p_class = P_GLOBAL,
2612 .ptr = &Globals.ismb2_max_credits,
2615 .flags = FLAG_ADVANCED,
2618 {N_("Printing Options"), P_SEP, P_SEPARATOR},
2621 .label = "max reported print jobs",
2624 .ptr = &sDefault.iMaxReportedPrintJobs,
2627 .flags = FLAG_ADVANCED | FLAG_PRINT,
2630 .label = "max print jobs",
2633 .ptr = &sDefault.iMaxPrintJobs,
2636 .flags = FLAG_ADVANCED | FLAG_PRINT,
2639 .label = "load printers",
2641 .p_class = P_GLOBAL,
2642 .ptr = &Globals.bLoadPrinters,
2645 .flags = FLAG_ADVANCED | FLAG_PRINT,
2648 .label = "printcap cache time",
2650 .p_class = P_GLOBAL,
2651 .ptr = &Globals.PrintcapCacheTime,
2654 .flags = FLAG_ADVANCED | FLAG_PRINT,
2657 .label = "printcap name",
2659 .p_class = P_GLOBAL,
2660 .ptr = &Globals.szPrintcapname,
2663 .flags = FLAG_ADVANCED | FLAG_PRINT,
2666 .label = "printcap",
2668 .p_class = P_GLOBAL,
2669 .ptr = &Globals.szPrintcapname,
2675 .label = "printable",
2678 .ptr = &sDefault.bPrint_ok,
2681 .flags = FLAG_ADVANCED | FLAG_PRINT,
2684 .label = "print notify backchannel",
2687 .ptr = &sDefault.bPrintNotifyBackchannel,
2690 .flags = FLAG_ADVANCED,
2693 .label = "print ok",
2696 .ptr = &sDefault.bPrint_ok,
2702 .label = "printing",
2705 .ptr = &sDefault.iPrinting,
2706 .special = handle_printing,
2707 .enum_list = enum_printing,
2708 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2711 .label = "cups options",
2714 .ptr = &sDefault.szCupsOptions,
2717 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2720 .label = "cups server",
2722 .p_class = P_GLOBAL,
2723 .ptr = &Globals.szCupsServer,
2726 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2729 .label = "cups encrypt",
2731 .p_class = P_GLOBAL,
2732 .ptr = &Globals.CupsEncrypt,
2734 .enum_list = enum_bool_auto,
2735 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2739 .label = "cups connection timeout",
2741 .p_class = P_GLOBAL,
2742 .ptr = &Globals.cups_connection_timeout,
2745 .flags = FLAG_ADVANCED,
2748 .label = "iprint server",
2750 .p_class = P_GLOBAL,
2751 .ptr = &Globals.szIPrintServer,
2754 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2757 .label = "print command",
2760 .ptr = &sDefault.szPrintcommand,
2763 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2766 .label = "disable spoolss",
2768 .p_class = P_GLOBAL,
2769 .ptr = &Globals.bDisableSpoolss,
2772 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2775 .label = "enable spoolss",
2777 .p_class = P_GLOBAL,
2778 .ptr = &Globals.bDisableSpoolss,
2784 .label = "lpq command",
2787 .ptr = &sDefault.szLpqcommand,
2790 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2793 .label = "lprm command",
2796 .ptr = &sDefault.szLprmcommand,
2799 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2802 .label = "lppause command",
2805 .ptr = &sDefault.szLppausecommand,
2808 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2811 .label = "lpresume command",
2814 .ptr = &sDefault.szLpresumecommand,
2817 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2820 .label = "queuepause command",
2823 .ptr = &sDefault.szQueuepausecommand,
2826 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2829 .label = "queueresume command",
2832 .ptr = &sDefault.szQueueresumecommand,
2835 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2838 .label = "addport command",
2840 .p_class = P_GLOBAL,
2841 .ptr = &Globals.szAddPortCommand,
2844 .flags = FLAG_ADVANCED,
2847 .label = "enumports command",
2849 .p_class = P_GLOBAL,
2850 .ptr = &Globals.szEnumPortsCommand,
2853 .flags = FLAG_ADVANCED,
2856 .label = "addprinter command",
2858 .p_class = P_GLOBAL,
2859 .ptr = &Globals.szAddPrinterCommand,
2862 .flags = FLAG_ADVANCED,
2865 .label = "deleteprinter command",
2867 .p_class = P_GLOBAL,
2868 .ptr = &Globals.szDeletePrinterCommand,
2871 .flags = FLAG_ADVANCED,
2874 .label = "show add printer wizard",
2876 .p_class = P_GLOBAL,
2877 .ptr = &Globals.bMsAddPrinterWizard,
2880 .flags = FLAG_ADVANCED,
2883 .label = "os2 driver map",
2885 .p_class = P_GLOBAL,
2886 .ptr = &Globals.szOs2DriverMap,
2889 .flags = FLAG_ADVANCED,
2893 .label = "printer name",
2896 .ptr = &sDefault.szPrintername,
2899 .flags = FLAG_ADVANCED | FLAG_PRINT,
2905 .ptr = &sDefault.szPrintername,
2911 .label = "use client driver",
2914 .ptr = &sDefault.bUseClientDriver,
2917 .flags = FLAG_ADVANCED | FLAG_PRINT,
2920 .label = "default devmode",
2923 .ptr = &sDefault.bDefaultDevmode,
2926 .flags = FLAG_ADVANCED | FLAG_PRINT,
2929 .label = "force printername",
2932 .ptr = &sDefault.bForcePrintername,
2935 .flags = FLAG_ADVANCED | FLAG_PRINT,
2938 .label = "printjob username",
2941 .ptr = &sDefault.szPrintjobUsername,
2944 .flags = FLAG_ADVANCED | FLAG_PRINT,
2947 {N_("Filename Handling"), P_SEP, P_SEPARATOR},
2950 .label = "mangling method",
2952 .p_class = P_GLOBAL,
2953 .ptr = &Globals.szManglingMethod,
2956 .flags = FLAG_ADVANCED,
2959 .label = "mangle prefix",
2961 .p_class = P_GLOBAL,
2962 .ptr = &Globals.mangle_prefix,
2965 .flags = FLAG_ADVANCED,
2969 .label = "default case",
2972 .ptr = &sDefault.iDefaultCase,
2974 .enum_list = enum_case,
2975 .flags = FLAG_ADVANCED | FLAG_SHARE,
2978 .label = "case sensitive",
2981 .ptr = &sDefault.iCaseSensitive,
2983 .enum_list = enum_bool_auto,
2984 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2987 .label = "casesignames",
2990 .ptr = &sDefault.iCaseSensitive,
2992 .enum_list = enum_bool_auto,
2993 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_HIDE,
2996 .label = "preserve case",
2999 .ptr = &sDefault.bCasePreserve,
3002 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3005 .label = "short preserve case",
3008 .ptr = &sDefault.bShortCasePreserve,
3011 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3014 .label = "mangling char",
3017 .ptr = &sDefault.magic_char,
3020 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3023 .label = "hide dot files",
3026 .ptr = &sDefault.bHideDotFiles,
3029 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3032 .label = "hide special files",
3035 .ptr = &sDefault.bHideSpecialFiles,
3038 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3041 .label = "hide unreadable",
3044 .ptr = &sDefault.bHideUnReadable,
3047 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3050 .label = "hide unwriteable files",
3053 .ptr = &sDefault.bHideUnWriteableFiles,
3056 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3059 .label = "delete veto files",
3062 .ptr = &sDefault.bDeleteVetoFiles,
3065 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3068 .label = "veto files",
3071 .ptr = &sDefault.szVetoFiles,
3074 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3077 .label = "hide files",
3080 .ptr = &sDefault.szHideFiles,
3083 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3086 .label = "veto oplock files",
3089 .ptr = &sDefault.szVetoOplockFiles,
3092 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3095 .label = "map archive",
3098 .ptr = &sDefault.bMap_archive,
3101 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3104 .label = "map hidden",
3107 .ptr = &sDefault.bMap_hidden,
3110 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3113 .label = "map system",
3116 .ptr = &sDefault.bMap_system,
3119 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3122 .label = "map readonly",
3125 .ptr = &sDefault.iMap_readonly,
3127 .enum_list = enum_map_readonly,
3128 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3131 .label = "mangled names",
3134 .ptr = &sDefault.bMangledNames,
3137 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3140 .label = "max stat cache size",
3142 .p_class = P_GLOBAL,
3143 .ptr = &Globals.iMaxStatCacheSize,
3146 .flags = FLAG_ADVANCED,
3149 .label = "stat cache",
3151 .p_class = P_GLOBAL,
3152 .ptr = &Globals.bStatCache,
3155 .flags = FLAG_ADVANCED,
3158 .label = "store dos attributes",
3161 .ptr = &sDefault.bStoreDosAttributes,
3164 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3167 .label = "dmapi support",
3170 .ptr = &sDefault.bDmapiSupport,
3173 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3177 {N_("Domain Options"), P_SEP, P_SEPARATOR},
3180 .label = "machine password timeout",
3182 .p_class = P_GLOBAL,
3183 .ptr = &Globals.machine_password_timeout,
3186 .flags = FLAG_ADVANCED | FLAG_WIZARD,
3189 {N_("Logon Options"), P_SEP, P_SEPARATOR},
3192 .label = "add user script",
3194 .p_class = P_GLOBAL,
3195 .ptr = &Globals.szAddUserScript,
3198 .flags = FLAG_ADVANCED,
3201 .label = "rename user script",
3203 .p_class = P_GLOBAL,
3204 .ptr = &Globals.szRenameUserScript,
3207 .flags = FLAG_ADVANCED,
3210 .label = "delete user script",
3212 .p_class = P_GLOBAL,
3213 .ptr = &Globals.szDelUserScript,
3216 .flags = FLAG_ADVANCED,
3219 .label = "add group script",
3221 .p_class = P_GLOBAL,
3222 .ptr = &Globals.szAddGroupScript,
3225 .flags = FLAG_ADVANCED,
3228 .label = "delete group script",
3230 .p_class = P_GLOBAL,
3231 .ptr = &Globals.szDelGroupScript,
3234 .flags = FLAG_ADVANCED,
3237 .label = "add user to group script",
3239 .p_class = P_GLOBAL,
3240 .ptr = &Globals.szAddUserToGroupScript,
3243 .flags = FLAG_ADVANCED,
3246 .label = "delete user from group script",
3248 .p_class = P_GLOBAL,
3249 .ptr = &Globals.szDelUserFromGroupScript,
3252 .flags = FLAG_ADVANCED,
3255 .label = "set primary group script",
3257 .p_class = P_GLOBAL,
3258 .ptr = &Globals.szSetPrimaryGroupScript,
3261 .flags = FLAG_ADVANCED,
3264 .label = "add machine script",
3266 .p_class = P_GLOBAL,
3267 .ptr = &Globals.szAddMachineScript,
3270 .flags = FLAG_ADVANCED,
3273 .label = "shutdown script",
3275 .p_class = P_GLOBAL,
3276 .ptr = &Globals.szShutdownScript,
3279 .flags = FLAG_ADVANCED,
3282 .label = "abort shutdown script",
3284 .p_class = P_GLOBAL,
3285 .ptr = &Globals.szAbortShutdownScript,
3288 .flags = FLAG_ADVANCED,
3291 .label = "username map script",
3293 .p_class = P_GLOBAL,
3294 .ptr = &Globals.szUsernameMapScript,
3297 .flags = FLAG_ADVANCED,
3300 .label = "username map cache time",
3302 .p_class = P_GLOBAL,
3303 .ptr = &Globals.iUsernameMapCacheTime,
3306 .flags = FLAG_ADVANCED,
3309 .label = "logon script",
3311 .p_class = P_GLOBAL,
3312 .ptr = &Globals.szLogonScript,
3315 .flags = FLAG_ADVANCED,
3318 .label = "logon path",
3320 .p_class = P_GLOBAL,
3321 .ptr = &Globals.szLogonPath,
3324 .flags = FLAG_ADVANCED,
3327 .label = "logon drive",
3329 .p_class = P_GLOBAL,
3330 .ptr = &Globals.szLogonDrive,
3333 .flags = FLAG_ADVANCED,
3336 .label = "logon home",
3338 .p_class = P_GLOBAL,
3339 .ptr = &Globals.szLogonHome,
3342 .flags = FLAG_ADVANCED,
3345 .label = "domain logons",
3347 .p_class = P_GLOBAL,
3348 .ptr = &Globals.bDomainLogons,
3351 .flags = FLAG_ADVANCED,
3355 .label = "init logon delayed hosts",
3357 .p_class = P_GLOBAL,
3358 .ptr = &Globals.szInitLogonDelayedHosts,
3361 .flags = FLAG_ADVANCED,
3365 .label = "init logon delay",
3367 .p_class = P_GLOBAL,
3368 .ptr = &Globals.InitLogonDelay,
3371 .flags = FLAG_ADVANCED,
3375 {N_("Browse Options"), P_SEP, P_SEPARATOR},
3378 .label = "os level",
3380 .p_class = P_GLOBAL,
3381 .ptr = &Globals.os_level,
3384 .flags = FLAG_BASIC | FLAG_ADVANCED,
3387 .label = "lm announce",
3389 .p_class = P_GLOBAL,
3390 .ptr = &Globals.lm_announce,
3392 .enum_list = enum_bool_auto,
3393 .flags = FLAG_ADVANCED,
3396 .label = "lm interval",
3398 .p_class = P_GLOBAL,
3399 .ptr = &Globals.lm_interval,
3402 .flags = FLAG_ADVANCED,
3405 .label = "preferred master",
3407 .p_class = P_GLOBAL,
3408 .ptr = &Globals.iPreferredMaster,
3410 .enum_list = enum_bool_auto,
3411 .flags = FLAG_BASIC | FLAG_ADVANCED,
3414 .label = "prefered master",
3416 .p_class = P_GLOBAL,
3417 .ptr = &Globals.iPreferredMaster,
3419 .enum_list = enum_bool_auto,
3423 .label = "local master",
3425 .p_class = P_GLOBAL,
3426 .ptr = &Globals.bLocalMaster,
3429 .flags = FLAG_BASIC | FLAG_ADVANCED,
3432 .label = "domain master",
3434 .p_class = P_GLOBAL,
3435 .ptr = &Globals.iDomainMaster,
3437 .enum_list = enum_bool_auto,
3438 .flags = FLAG_BASIC | FLAG_ADVANCED,
3441 .label = "browse list",
3443 .p_class = P_GLOBAL,
3444 .ptr = &Globals.bBrowseList,
3447 .flags = FLAG_ADVANCED,
3450 .label = "browseable",
3453 .ptr = &sDefault.bBrowseable,
3456 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3459 .label = "browsable",
3462 .ptr = &sDefault.bBrowseable,
3468 .label = "access based share enum",
3471 .ptr = &sDefault.bAccessBasedShareEnum,
3474 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE
3477 .label = "enhanced browsing",
3479 .p_class = P_GLOBAL,
3480 .ptr = &Globals.enhanced_browsing,
3483 .flags = FLAG_ADVANCED,
3486 {N_("WINS Options"), P_SEP, P_SEPARATOR},
3489 .label = "dns proxy",
3491 .p_class = P_GLOBAL,
3492 .ptr = &Globals.bDNSproxy,
3495 .flags = FLAG_ADVANCED,
3498 .label = "wins proxy",
3500 .p_class = P_GLOBAL,
3501 .ptr = &Globals.bWINSproxy,
3504 .flags = FLAG_ADVANCED,
3507 .label = "wins server",
3509 .p_class = P_GLOBAL,
3510 .ptr = &Globals.szWINSservers,
3513 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3516 .label = "wins support",
3518 .p_class = P_GLOBAL,
3519 .ptr = &Globals.bWINSsupport,
3522 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3525 .label = "wins hook",
3527 .p_class = P_GLOBAL,
3528 .ptr = &Globals.szWINSHook,
3531 .flags = FLAG_ADVANCED,
3534 {N_("Locking Options"), P_SEP, P_SEPARATOR},
3537 .label = "blocking locks",
3540 .ptr = &sDefault.bBlockingLocks,
3543 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3546 .label = "csc policy",
3549 .ptr = &sDefault.iCSCPolicy,
3551 .enum_list = enum_csc_policy,
3552 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3555 .label = "fake oplocks",
3558 .ptr = &sDefault.bFakeOplocks,
3561 .flags = FLAG_ADVANCED | FLAG_SHARE,
3564 .label = "kernel oplocks",
3566 .p_class = P_GLOBAL,
3567 .ptr = &Globals.bKernelOplocks,
3570 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3576 .ptr = &sDefault.bLocking,
3579 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3582 .label = "lock spin time",
3584 .p_class = P_GLOBAL,
3585 .ptr = &Globals.iLockSpinTime,
3588 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3594 .ptr = &sDefault.bOpLocks,
3597 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3600 .label = "level2 oplocks",
3603 .ptr = &sDefault.bLevel2OpLocks,
3606 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3609 .label = "oplock break wait time",
3611 .p_class = P_GLOBAL,
3612 .ptr = &Globals.oplock_break_wait_time,
3615 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3618 .label = "oplock contention limit",
3621 .ptr = &sDefault.iOplockContentionLimit,
3624 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3627 .label = "posix locking",
3630 .ptr = &sDefault.bPosixLocking,
3633 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3636 .label = "strict locking",
3639 .ptr = &sDefault.iStrictLocking,
3641 .enum_list = enum_bool_auto,
3642 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3645 .label = "share modes",
3648 .ptr = &sDefault.bShareModes,
3651 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_DEPRECATED,
3654 {N_("Ldap Options"), P_SEP, P_SEPARATOR},
3657 .label = "ldap admin dn",
3659 .p_class = P_GLOBAL,
3660 .ptr = &Globals.szLdapAdminDn,
3663 .flags = FLAG_ADVANCED,
3666 .label = "ldap delete dn",
3668 .p_class = P_GLOBAL,
3669 .ptr = &Globals.ldap_delete_dn,
3672 .flags = FLAG_ADVANCED,
3675 .label = "ldap group suffix",
3677 .p_class = P_GLOBAL,
3678 .ptr = &Globals.szLdapGroupSuffix,
3681 .flags = FLAG_ADVANCED,
3684 .label = "ldap idmap suffix",
3686 .p_class = P_GLOBAL,
3687 .ptr = &Globals.szLdapIdmapSuffix,
3690 .flags = FLAG_ADVANCED,
3693 .label = "ldap machine suffix",
3695 .p_class = P_GLOBAL,
3696 .ptr = &Globals.szLdapMachineSuffix,
3699 .flags = FLAG_ADVANCED,
3702 .label = "ldap passwd sync",
3704 .p_class = P_GLOBAL,
3705 .ptr = &Globals.ldap_passwd_sync,
3707 .enum_list = enum_ldap_passwd_sync,
3708 .flags = FLAG_ADVANCED,
3711 .label = "ldap password sync",
3713 .p_class = P_GLOBAL,
3714 .ptr = &Globals.ldap_passwd_sync,
3716 .enum_list = enum_ldap_passwd_sync,
3720 .label = "ldap replication sleep",
3722 .p_class = P_GLOBAL,
3723 .ptr = &Globals.ldap_replication_sleep,
3726 .flags = FLAG_ADVANCED,
3729 .label = "ldap suffix",
3731 .p_class = P_GLOBAL,
3732 .ptr = &Globals.szLdapSuffix,
3735 .flags = FLAG_ADVANCED,
3738 .label = "ldap ssl",
3740 .p_class = P_GLOBAL,
3741 .ptr = &Globals.ldap_ssl,
3743 .enum_list = enum_ldap_ssl,
3744 .flags = FLAG_ADVANCED,
3747 .label = "ldap ssl ads",
3749 .p_class = P_GLOBAL,
3750 .ptr = &Globals.ldap_ssl_ads,
3753 .flags = FLAG_ADVANCED,
3756 .label = "ldap deref",
3758 .p_class = P_GLOBAL,
3759 .ptr = &Globals.ldap_deref,
3761 .enum_list = enum_ldap_deref,
3762 .flags = FLAG_ADVANCED,
3765 .label = "ldap follow referral",
3767 .p_class = P_GLOBAL,
3768 .ptr = &Globals.ldap_follow_referral,
3770 .enum_list = enum_bool_auto,
3771 .flags = FLAG_ADVANCED,
3774 .label = "ldap timeout",
3776 .p_class = P_GLOBAL,
3777 .ptr = &Globals.ldap_timeout,
3780 .flags = FLAG_ADVANCED,
3783 .label = "ldap connection timeout",
3785 .p_class = P_GLOBAL,
3786 .ptr = &Globals.ldap_connection_timeout,
3789 .flags = FLAG_ADVANCED,
3792 .label = "ldap page size",
3794 .p_class = P_GLOBAL,
3795 .ptr = &Globals.ldap_page_size,
3798 .flags = FLAG_ADVANCED,
3801 .label = "ldap user suffix",
3803 .p_class = P_GLOBAL,
3804 .ptr = &Globals.szLdapUserSuffix,
3807 .flags = FLAG_ADVANCED,
3810 .label = "ldap debug level",
3812 .p_class = P_GLOBAL,
3813 .ptr = &Globals.ldap_debug_level,
3814 .special = handle_ldap_debug_level,
3816 .flags = FLAG_ADVANCED,
3819 .label = "ldap debug threshold",
3821 .p_class = P_GLOBAL,
3822 .ptr = &Globals.ldap_debug_threshold,
3825 .flags = FLAG_ADVANCED,
3828 {N_("EventLog Options"), P_SEP, P_SEPARATOR},
3831 .label = "eventlog list",
3833 .p_class = P_GLOBAL,
3834 .ptr = &Globals.szEventLogs,
3837 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
3840 {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
3843 .label = "add share command",
3845 .p_class = P_GLOBAL,
3846 .ptr = &Globals.szAddShareCommand,
3849 .flags = FLAG_ADVANCED,
3852 .label = "change share command",
3854 .p_class = P_GLOBAL,
3855 .ptr = &Globals.szChangeShareCommand,
3858 .flags = FLAG_ADVANCED,
3861 .label = "delete share command",
3863 .p_class = P_GLOBAL,
3864 .ptr = &Globals.szDeleteShareCommand,
3867 .flags = FLAG_ADVANCED,
3870 .label = "config file",
3872 .p_class = P_GLOBAL,
3873 .ptr = &Globals.szConfigFile,
3876 .flags = FLAG_HIDE|FLAG_META,
3881 .p_class = P_GLOBAL,
3882 .ptr = &Globals.szAutoServices,
3885 .flags = FLAG_ADVANCED,
3888 .label = "auto services",
3890 .p_class = P_GLOBAL,
3891 .ptr = &Globals.szAutoServices,
3894 .flags = FLAG_ADVANCED,
3897 .label = "lock directory",
3899 .p_class = P_GLOBAL,
3900 .ptr = &Globals.szLockDir,
3903 .flags = FLAG_ADVANCED,
3906 .label = "lock dir",
3908 .p_class = P_GLOBAL,
3909 .ptr = &Globals.szLockDir,
3915 .label = "state directory",
3917 .p_class = P_GLOBAL,
3918 .ptr = &Globals.szStateDir,
3921 .flags = FLAG_ADVANCED,
3924 .label = "cache directory",
3926 .p_class = P_GLOBAL,
3927 .ptr = &Globals.szCacheDir,
3930 .flags = FLAG_ADVANCED,
3933 .label = "pid directory",
3935 .p_class = P_GLOBAL,
3936 .ptr = &Globals.szPidDir,
3939 .flags = FLAG_ADVANCED,
3943 .label = "utmp directory",
3945 .p_class = P_GLOBAL,
3946 .ptr = &Globals.szUtmpDir,
3949 .flags = FLAG_ADVANCED,
3952 .label = "wtmp directory",
3954 .p_class = P_GLOBAL,
3955 .ptr = &Globals.szWtmpDir,
3958 .flags = FLAG_ADVANCED,
3963 .p_class = P_GLOBAL,
3964 .ptr = &Globals.bUtmp,
3967 .flags = FLAG_ADVANCED,
3971 .label = "default service",
3973 .p_class = P_GLOBAL,
3974 .ptr = &Globals.szDefaultService,
3977 .flags = FLAG_ADVANCED,
3982 .p_class = P_GLOBAL,
3983 .ptr = &Globals.szDefaultService,
3986 .flags = FLAG_ADVANCED,
3989 .label = "message command",
3991 .p_class = P_GLOBAL,
3992 .ptr = &Globals.szMsgCommand,
3995 .flags = FLAG_ADVANCED,
3998 .label = "dfree cache time",
4001 .ptr = &sDefault.iDfreeCacheTime,
4004 .flags = FLAG_ADVANCED,
4007 .label = "dfree command",
4010 .ptr = &sDefault.szDfree,
4013 .flags = FLAG_ADVANCED,
4016 .label = "get quota command",
4018 .p_class = P_GLOBAL,
4019 .ptr = &Globals.szGetQuota,
4022 .flags = FLAG_ADVANCED,
4025 .label = "set quota command",
4027 .p_class = P_GLOBAL,
4028 .ptr = &Globals.szSetQuota,
4031 .flags = FLAG_ADVANCED,
4034 .label = "remote announce",
4036 .p_class = P_GLOBAL,
4037 .ptr = &Globals.szRemoteAnnounce,
4040 .flags = FLAG_ADVANCED,
4043 .label = "remote browse sync",
4045 .p_class = P_GLOBAL,
4046 .ptr = &Globals.szRemoteBrowseSync,
4049 .flags = FLAG_ADVANCED,
4052 .label = "socket address",
4054 .p_class = P_GLOBAL,
4055 .ptr = &Globals.szSocketAddress,
4058 .flags = FLAG_ADVANCED,
4061 .label = "nmbd bind explicit broadcast",
4063 .p_class = P_GLOBAL,
4064 .ptr = &Globals.bNmbdBindExplicitBroadcast,
4067 .flags = FLAG_ADVANCED,
4070 .label = "homedir map",
4072 .p_class = P_GLOBAL,
4073 .ptr = &Globals.szNISHomeMapName,
4076 .flags = FLAG_ADVANCED,
4079 .label = "afs username map",
4081 .p_class = P_GLOBAL,
4082 .ptr = &Globals.szAfsUsernameMap,
4085 .flags = FLAG_ADVANCED,
4088 .label = "afs token lifetime",
4090 .p_class = P_GLOBAL,
4091 .ptr = &Globals.iAfsTokenLifetime,
4094 .flags = FLAG_ADVANCED,
4097 .label = "log nt token command",
4099 .p_class = P_GLOBAL,
4100 .ptr = &Globals.szLogNtTokenCommand,
4103 .flags = FLAG_ADVANCED,
4106 .label = "NIS homedir",
4108 .p_class = P_GLOBAL,
4109 .ptr = &Globals.bNISHomeMap,
4112 .flags = FLAG_ADVANCED,
4118 .ptr = &sDefault.valid,
4127 .ptr = &sDefault.szCopy,
4128 .special = handle_copy,
4136 .ptr = &sDefault.szInclude,
4137 .special = handle_include,
4139 .flags = FLAG_HIDE|FLAG_META,
4145 .ptr = &sDefault.szPreExec,
4148 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4154 .ptr = &sDefault.szPreExec,
4157 .flags = FLAG_ADVANCED,
4160 .label = "preexec close",
4163 .ptr = &sDefault.bPreexecClose,
4166 .flags = FLAG_ADVANCED | FLAG_SHARE,
4169 .label = "postexec",
4172 .ptr = &sDefault.szPostExec,
4175 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4178 .label = "root preexec",
4181 .ptr = &sDefault.szRootPreExec,
4184 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4187 .label = "root preexec close",
4190 .ptr = &sDefault.bRootpreexecClose,
4193 .flags = FLAG_ADVANCED | FLAG_SHARE,
4196 .label = "root postexec",
4199 .ptr = &sDefault.szRootPostExec,
4202 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4205 .label = "available",
4208 .ptr = &sDefault.bAvailable,
4211 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4214 .label = "registry shares",
4216 .p_class = P_GLOBAL,
4217 .ptr = &Globals.bRegistryShares,
4220 .flags = FLAG_ADVANCED,
4223 .label = "usershare allow guests",
4225 .p_class = P_GLOBAL,
4226 .ptr = &Globals.bUsershareAllowGuests,
4229 .flags = FLAG_ADVANCED,
4232 .label = "usershare max shares",
4234 .p_class = P_GLOBAL,
4235 .ptr = &Globals.iUsershareMaxShares,
4238 .flags = FLAG_ADVANCED,
4241 .label = "usershare owner only",
4243 .p_class = P_GLOBAL,
4244 .ptr = &Globals.bUsershareOwnerOnly,
4247 .flags = FLAG_ADVANCED,
4250 .label = "usershare path",
4252 .p_class = P_GLOBAL,
4253 .ptr = &Globals.szUsersharePath,
4256 .flags = FLAG_ADVANCED,
4259 .label = "usershare prefix allow list",
4261 .p_class = P_GLOBAL,
4262 .ptr = &Globals.szUsersharePrefixAllowList,
4265 .flags = FLAG_ADVANCED,
4268 .label = "usershare prefix deny list",
4270 .p_class = P_GLOBAL,
4271 .ptr = &Globals.szUsersharePrefixDenyList,
4274 .flags = FLAG_ADVANCED,
4277 .label = "usershare template share",
4279 .p_class = P_GLOBAL,
4280 .ptr = &Globals.szUsershareTemplateShare,
4283 .flags = FLAG_ADVANCED,
4289 .ptr = &sDefault.volume,
4292 .flags = FLAG_ADVANCED | FLAG_SHARE,
4298 .ptr = &sDefault.fstype,
4301 .flags = FLAG_ADVANCED | FLAG_SHARE,
4304 .label = "set directory",
4307 .ptr = &sDefault.bNo_set_dir,
4310 .flags = FLAG_ADVANCED | FLAG_SHARE,
4313 .label = "wide links",
4316 .ptr = &sDefault.bWidelinks,
4319 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4322 .label = "follow symlinks",
4325 .ptr = &sDefault.bSymlinks,
4328 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4331 .label = "dont descend",
4334 .ptr = &sDefault.szDontdescend,
4337 .flags = FLAG_ADVANCED | FLAG_SHARE,
4340 .label = "magic script",
4343 .ptr = &sDefault.szMagicScript,
4346 .flags = FLAG_ADVANCED | FLAG_SHARE,
4349 .label = "magic output",
4352 .ptr = &sDefault.szMagicOutput,
4355 .flags = FLAG_ADVANCED | FLAG_SHARE,
4358 .label = "delete readonly",
4361 .ptr = &sDefault.bDeleteReadonly,
4364 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4367 .label = "dos filemode",
4370 .ptr = &sDefault.bDosFilemode,
4373 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4376 .label = "dos filetimes",
4379 .ptr = &sDefault.bDosFiletimes,
4382 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4385 .label = "dos filetime resolution",
4388 .ptr = &sDefault.bDosFiletimeResolution,
4391 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4394 .label = "fake directory create times",
4397 .ptr = &sDefault.bFakeDirCreateTimes,
4400 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4403 .label = "async smb echo handler",
4405 .p_class = P_GLOBAL,
4406 .ptr = &Globals.bAsyncSMBEchoHandler,
4409 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4412 .label = "multicast dns register",
4414 .p_class = P_GLOBAL,
4415 .ptr = &Globals.bMulticastDnsRegister,
4418 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4421 .label = "panic action",
4423 .p_class = P_GLOBAL,
4424 .ptr = &Globals.szPanicAction,
4427 .flags = FLAG_ADVANCED,
4430 .label = "perfcount module",
4432 .p_class = P_GLOBAL,
4433 .ptr = &Globals.szSMBPerfcountModule,
4436 .flags = FLAG_ADVANCED,
4439 {N_("VFS module options"), P_SEP, P_SEPARATOR},
4442 .label = "vfs objects",
4445 .ptr = &sDefault.szVfsObjects,
4448 .flags = FLAG_ADVANCED | FLAG_SHARE,
4451 .label = "vfs object",
4454 .ptr = &sDefault.szVfsObjects,
4461 {N_("MSDFS options"), P_SEP, P_SEPARATOR},
4464 .label = "msdfs root",
4467 .ptr = &sDefault.bMSDfsRoot,
4470 .flags = FLAG_ADVANCED | FLAG_SHARE,
4473 .label = "msdfs proxy",
4476 .ptr = &sDefault.szMSDfsProxy,
4479 .flags = FLAG_ADVANCED | FLAG_SHARE,
4482 .label = "host msdfs",
4484 .p_class = P_GLOBAL,
4485 .ptr = &Globals.bHostMSDfs,
4488 .flags = FLAG_ADVANCED,
4491 {N_("Winbind options"), P_SEP, P_SEPARATOR},
4494 .label = "passdb expand explicit",
4496 .p_class = P_GLOBAL,
4497 .ptr = &Globals.bPassdbExpandExplicit,
4500 .flags = FLAG_ADVANCED,
4503 .label = "idmap backend",
4505 .p_class = P_GLOBAL,
4506 .ptr = &Globals.szIdmapBackend,
4507 .special = handle_idmap_backend,
4509 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
4512 .label = "idmap cache time",
4514 .p_class = P_GLOBAL,
4515 .ptr = &Globals.iIdmapCacheTime,
4518 .flags = FLAG_ADVANCED,
4521 .label = "idmap negative cache time",
4523 .p_class = P_GLOBAL,
4524 .ptr = &Globals.iIdmapNegativeCacheTime,
4527 .flags = FLAG_ADVANCED,
4530 .label = "idmap uid",
4532 .p_class = P_GLOBAL,
4533 .ptr = &Globals.szIdmapUID,
4534 .special = handle_idmap_uid,
4536 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
4539 .label = "winbind uid",
4541 .p_class = P_GLOBAL,
4542 .ptr = &Globals.szIdmapUID,
4543 .special = handle_idmap_uid,
4548 .label = "idmap gid",
4550 .p_class = P_GLOBAL,
4551 .ptr = &Globals.szIdmapGID,
4552 .special = handle_idmap_gid,
4554 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
4557 .label = "winbind gid",
4559 .p_class = P_GLOBAL,
4560 .ptr = &Globals.szIdmapGID,
4561 .special = handle_idmap_gid,
4566 .label = "template homedir",
4568 .p_class = P_GLOBAL,
4569 .ptr = &Globals.szTemplateHomedir,
4572 .flags = FLAG_ADVANCED,
4575 .label = "template shell",
4577 .p_class = P_GLOBAL,
4578 .ptr = &Globals.szTemplateShell,
4581 .flags = FLAG_ADVANCED,
4584 .label = "winbind separator",
4586 .p_class = P_GLOBAL,
4587 .ptr = &Globals.szWinbindSeparator,
4590 .flags = FLAG_ADVANCED,
4593 .label = "winbind cache time",
4595 .p_class = P_GLOBAL,
4596 .ptr = &Globals.winbind_cache_time,
4599 .flags = FLAG_ADVANCED,
4602 .label = "winbind reconnect delay",
4604 .p_class = P_GLOBAL,
4605 .ptr = &Globals.winbind_reconnect_delay,
4608 .flags = FLAG_ADVANCED,
4611 .label = "winbind max clients",
4613 .p_class = P_GLOBAL,
4614 .ptr = &Globals.winbind_max_clients,
4617 .flags = FLAG_ADVANCED,
4620 .label = "winbind enum users",
4622 .p_class = P_GLOBAL,
4623 .ptr = &Globals.bWinbindEnumUsers,
4626 .flags = FLAG_ADVANCED,
4629 .label = "winbind enum groups",
4631 .p_class = P_GLOBAL,
4632 .ptr = &Globals.bWinbindEnumGroups,
4635 .flags = FLAG_ADVANCED,
4638 .label = "winbind use default domain",
4640 .p_class = P_GLOBAL,
4641 .ptr = &Globals.bWinbindUseDefaultDomain,
4644 .flags = FLAG_ADVANCED,
4647 .label = "winbind trusted domains only",
4649 .p_class = P_GLOBAL,
4650 .ptr = &Globals.bWinbindTrustedDomainsOnly,
4653 .flags = FLAG_ADVANCED,
4656 .label = "winbind nested groups",
4658 .p_class = P_GLOBAL,
4659 .ptr = &Globals.bWinbindNestedGroups,
4662 .flags = FLAG_ADVANCED,
4665 .label = "winbind expand groups",
4667 .p_class = P_GLOBAL,
4668 .ptr = &Globals.winbind_expand_groups,
4671 .flags = FLAG_ADVANCED,
4674 .label = "winbind nss info",
4676 .p_class = P_GLOBAL,
4677 .ptr = &Globals.szWinbindNssInfo,
4680 .flags = FLAG_ADVANCED,
4683 .label = "winbind refresh tickets",
4685 .p_class = P_GLOBAL,
4686 .ptr = &Globals.bWinbindRefreshTickets,
4689 .flags = FLAG_ADVANCED,
4692 .label = "winbind offline logon",
4694 .p_class = P_GLOBAL,
4695 .ptr = &Globals.bWinbindOfflineLogon,
4698 .flags = FLAG_ADVANCED,
4701 .label = "winbind normalize names",
4703 .p_class = P_GLOBAL,
4704 .ptr = &Globals.bWinbindNormalizeNames,
4707 .flags = FLAG_ADVANCED,
4710 .label = "winbind rpc only",
4712 .p_class = P_GLOBAL,
4713 .ptr = &Globals.bWinbindRpcOnly,
4716 .flags = FLAG_ADVANCED,
4719 .label = "create krb5 conf",
4721 .p_class = P_GLOBAL,
4722 .ptr = &Globals.bCreateKrb5Conf,
4725 .flags = FLAG_ADVANCED,
4728 .label = "ncalrpc dir",
4730 .p_class = P_GLOBAL,
4731 .ptr = &Globals.ncalrpc_dir,
4734 .flags = FLAG_ADVANCED,
4737 .label = "winbind max domain connections",
4739 .p_class = P_GLOBAL,
4740 .ptr = &Globals.winbindMaxDomainConnections,
4743 .flags = FLAG_ADVANCED,
4746 {NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
4749 /***************************************************************************
4750 Initialise the sDefault parameter structure for the printer values.
4751 ***************************************************************************/
4753 static void init_printer_values(struct service *pService)
4755 /* choose defaults depending on the type of printing */
4756 switch (pService->iPrinting) {
4761 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4762 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4763 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4768 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4769 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4770 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4771 string_set(&pService->szQueuepausecommand, "lpc stop '%p'");
4772 string_set(&pService->szQueueresumecommand, "lpc start '%p'");
4773 string_set(&pService->szLppausecommand, "lpc hold '%p' %j");
4774 string_set(&pService->szLpresumecommand, "lpc release '%p' %j");
4780 /* set the lpq command to contain the destination printer
4781 name only. This is used by cups_queue_get() */
4782 string_set(&pService->szLpqcommand, "%p");
4783 string_set(&pService->szLprmcommand, "");
4784 string_set(&pService->szPrintcommand, "");
4785 string_set(&pService->szLppausecommand, "");
4786 string_set(&pService->szLpresumecommand, "");
4787 string_set(&pService->szQueuepausecommand, "");
4788 string_set(&pService->szQueueresumecommand, "");
4790 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4791 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4792 string_set(&pService->szPrintcommand, "lpr -P'%p' %s; rm %s");
4793 string_set(&pService->szLppausecommand, "lp -i '%p-%j' -H hold");
4794 string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
4795 string_set(&pService->szQueuepausecommand, "disable '%p'");
4796 string_set(&pService->szQueueresumecommand, "enable '%p'");
4797 #endif /* HAVE_CUPS */
4802 string_set(&pService->szLpqcommand, "lpstat -o%p");
4803 string_set(&pService->szLprmcommand, "cancel %p-%j");
4804 string_set(&pService->szPrintcommand, "lp -c -d%p %s; rm %s");
4805 string_set(&pService->szQueuepausecommand, "disable %p");
4806 string_set(&pService->szQueueresumecommand, "enable %p");
4808 string_set(&pService->szLppausecommand, "lp -i %p-%j -H hold");
4809 string_set(&pService->szLpresumecommand, "lp -i %p-%j -H resume");
4814 string_set(&pService->szLpqcommand, "lpq -P%p");
4815 string_set(&pService->szLprmcommand, "lprm -P%p %j");
4816 string_set(&pService->szPrintcommand, "lp -r -P%p %s");
4819 #if defined(DEVELOPER) || defined(ENABLE_BUILD_FARM_HACKS)
4823 const char *tdbfile;
4826 tdbfile = talloc_asprintf(
4827 talloc_tos(), "tdbfile=%s",
4828 lp_parm_const_string(-1, "vlp", "tdbfile",
4830 if (tdbfile == NULL) {
4831 tdbfile="tdbfile=/tmp/vlp.tdb";
4834 tmp = talloc_asprintf(talloc_tos(), "vlp %s print %%p %%s",
4836 string_set(&pService->szPrintcommand,
4837 tmp ? tmp : "vlp print %p %s");
4840 tmp = talloc_asprintf(talloc_tos(), "vlp %s lpq %%p",
4842 string_set(&pService->szLpqcommand,
4843 tmp ? tmp : "vlp lpq %p");
4846 tmp = talloc_asprintf(talloc_tos(), "vlp %s lprm %%p %%j",
4848 string_set(&pService->szLprmcommand,
4849 tmp ? tmp : "vlp lprm %p %j");
4852 tmp = talloc_asprintf(talloc_tos(), "vlp %s lppause %%p %%j",
4854 string_set(&pService->szLppausecommand,
4855 tmp ? tmp : "vlp lppause %p %j");
4858 tmp = talloc_asprintf(talloc_tos(), "vlp %s lpresume %%p %%j",
4860 string_set(&pService->szLpresumecommand,
4861 tmp ? tmp : "vlp lpresume %p %j");
4864 tmp = talloc_asprintf(talloc_tos(), "vlp %s queuepause %%p",
4866 string_set(&pService->szQueuepausecommand,
4867 tmp ? tmp : "vlp queuepause %p");
4870 tmp = talloc_asprintf(talloc_tos(), "vlp %s queueresume %%p",
4872 string_set(&pService->szQueueresumecommand,
4873 tmp ? tmp : "vlp queueresume %p");
4878 #endif /* DEVELOPER */
4883 * Function to return the default value for the maximum number of open
4884 * file descriptors permitted. This function tries to consult the
4885 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4886 * the smaller of those.
4888 static int max_open_files(void)
4890 int sysctl_max = MAX_OPEN_FILES;
4891 int rlimit_max = MAX_OPEN_FILES;
4893 #ifdef HAVE_SYSCTLBYNAME
4895 size_t size = sizeof(sysctl_max);
4896 sysctlbyname("kern.maxfilesperproc", &sysctl_max, &size, NULL,
4901 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4907 if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
4908 rlimit_max = rl.rlim_cur;
4910 #if defined(RLIM_INFINITY)
4911 if(rl.rlim_cur == RLIM_INFINITY)
4912 rlimit_max = MAX_OPEN_FILES;
4917 if (sysctl_max < MIN_OPEN_FILES_WINDOWS) {
4918 DEBUG(2,("max_open_files: increasing sysctl_max (%d) to "
4919 "minimum Windows limit (%d)\n",
4921 MIN_OPEN_FILES_WINDOWS));
4922 sysctl_max = MIN_OPEN_FILES_WINDOWS;
4925 if (rlimit_max < MIN_OPEN_FILES_WINDOWS) {
4926 DEBUG(2,("rlimit_max: increasing rlimit_max (%d) to "
4927 "minimum Windows limit (%d)\n",
4929 MIN_OPEN_FILES_WINDOWS));
4930 rlimit_max = MIN_OPEN_FILES_WINDOWS;
4933 return MIN(sysctl_max, rlimit_max);
4937 * Common part of freeing allocated data for one parameter.
4939 static void free_one_parameter_common(void *parm_ptr,
4940 struct parm_struct parm)
4942 if ((parm.type == P_STRING) ||
4943 (parm.type == P_USTRING))
4945 string_free((char**)parm_ptr);
4946 } else if (parm.type == P_LIST) {
4947 TALLOC_FREE(*((char***)parm_ptr));
4952 * Free the allocated data for one parameter for a share
4953 * given as a service struct.
4955 static void free_one_parameter(struct service *service,
4956 struct parm_struct parm)
4960 if (parm.p_class != P_LOCAL) {
4964 parm_ptr = lp_local_ptr(service, parm.ptr);
4966 free_one_parameter_common(parm_ptr, parm);
4970 * Free the allocated parameter data of a share given
4971 * as a service struct.
4973 static void free_parameters(struct service *service)
4977 for (i=0; parm_table[i].label; i++) {
4978 free_one_parameter(service, parm_table[i]);
4983 * Free the allocated data for one parameter for a given share
4984 * specified by an snum.
4986 static void free_one_parameter_by_snum(int snum, struct parm_struct parm)
4990 if (parm.ptr == NULL) {
4995 parm_ptr = parm.ptr;
4996 } else if (parm.p_class != P_LOCAL) {
4999 parm_ptr = lp_local_ptr_by_snum(snum, parm.ptr);
5002 free_one_parameter_common(parm_ptr, parm);
5006 * Free the allocated parameter data for a share specified
5009 static void free_parameters_by_snum(int snum)
5013 for (i=0; parm_table[i].label; i++) {
5014 free_one_parameter_by_snum(snum, parm_table[i]);
5019 * Free the allocated global parameters.
5021 static void free_global_parameters(void)
5023 free_parameters_by_snum(GLOBAL_SECTION_SNUM);
5026 static int map_parameter(const char *pszParmName);
5028 struct lp_stored_option {
5029 struct lp_stored_option *prev, *next;
5034 static struct lp_stored_option *stored_options;
5037 save options set by lp_set_cmdline() into a list. This list is
5038 re-applied when we do a globals reset, so that cmdline set options
5039 are sticky across reloads of smb.conf
5041 static bool store_lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
5043 struct lp_stored_option *entry, *entry_next;
5044 for (entry = stored_options; entry != NULL; entry = entry_next) {
5045 entry_next = entry->next;
5046 if (strcmp(pszParmName, entry->label) == 0) {
5047 DLIST_REMOVE(stored_options, entry);
5053 entry = talloc(NULL, struct lp_stored_option);
5058 entry->label = talloc_strdup(entry, pszParmName);
5059 if (!entry->label) {
5064 entry->value = talloc_strdup(entry, pszParmValue);
5065 if (!entry->value) {
5070 DLIST_ADD_END(stored_options, entry, struct lp_stored_option);
5075 static bool apply_lp_set_cmdline(void)
5077 struct lp_stored_option *entry = NULL;
5078 for (entry = stored_options; entry != NULL; entry = entry->next) {
5079 if (!lp_set_cmdline_helper(entry->label, entry->value, false)) {
5080 DEBUG(0, ("Failed to re-apply cmdline parameter %s = %s\n",
5081 entry->label, entry->value));
5088 /***************************************************************************
5089 Initialise the global parameter structure.
5090 ***************************************************************************/
5092 static void init_globals(bool reinit_globals)
5094 static bool done_init = False;
5098 /* If requested to initialize only once and we've already done it... */
5099 if (!reinit_globals && done_init) {
5100 /* ... then we have nothing more to do */
5105 /* The logfile can be set before this is invoked. Free it if so. */
5106 if (Globals.szLogFile != NULL) {
5107 string_free(&Globals.szLogFile);
5108 Globals.szLogFile = NULL;
5112 free_global_parameters();
5115 /* This memset and the free_global_parameters() above will
5116 * wipe out smb.conf options set with lp_set_cmdline(). The
5117 * apply_lp_set_cmdline() call puts these values back in the
5118 * table once the defaults are set */
5119 memset((void *)&Globals, '\0', sizeof(Globals));
5121 for (i = 0; parm_table[i].label; i++) {
5122 if ((parm_table[i].type == P_STRING ||
5123 parm_table[i].type == P_USTRING) &&
5126 string_set((char **)parm_table[i].ptr, "");
5131 string_set(&sDefault.fstype, FSTYPE_STRING);
5132 string_set(&sDefault.szPrintjobUsername, "%U");
5134 init_printer_values(&sDefault);
5137 DEBUG(3, ("Initialising global parameters\n"));
5139 /* Must manually force to upper case here, as this does not go via the handler */
5140 string_set(&Globals.szNetbiosName, myhostname_upper());
5142 string_set(&Globals.szSMBPasswdFile, get_dyn_SMB_PASSWD_FILE());
5143 string_set(&Globals.szPrivateDir, get_dyn_PRIVATE_DIR());
5145 /* use the new 'hash2' method by default, with a prefix of 1 */
5146 string_set(&Globals.szManglingMethod, "hash2");
5147 Globals.mangle_prefix = 1;
5149 string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
5151 /* using UTF8 by default allows us to support all chars */
5152 string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
5154 /* Use codepage 850 as a default for the dos character set */
5155 string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
5158 * Allow the default PASSWD_CHAT to be overridden in local.h.
5160 string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
5162 string_set(&Globals.szWorkgroup, WORKGROUP);
5164 string_set(&Globals.szPasswdProgram, "");
5165 string_set(&Globals.szLockDir, get_dyn_LOCKDIR());
5166 string_set(&Globals.szStateDir, get_dyn_STATEDIR());
5167 string_set(&Globals.szCacheDir, get_dyn_CACHEDIR());
5168 string_set(&Globals.szPidDir, get_dyn_PIDDIR());
5169 string_set(&Globals.szSocketAddress, "0.0.0.0");
5171 * By default support explicit binding to broadcast
5174 Globals.bNmbdBindExplicitBroadcast = true;
5176 if (asprintf(&s, "Samba %s", samba_version_string()) < 0) {
5177 smb_panic("init_globals: ENOMEM");
5179 string_set(&Globals.szServerString, s);
5181 if (asprintf(&s, "%d.%d", DEFAULT_MAJOR_VERSION,
5182 DEFAULT_MINOR_VERSION) < 0) {
5183 smb_panic("init_globals: ENOMEM");
5185 string_set(&Globals.szAnnounceVersion, s);
5188 string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
5191 string_set(&Globals.szSocketOptions, DEFAULT_SOCKET_OPTIONS);
5193 string_set(&Globals.szLogonDrive, "");
5194 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
5195 string_set(&Globals.szLogonHome, "\\\\%N\\%U");
5196 string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
5198 string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
5199 string_set(&Globals.szPasswordServer, "*");
5201 Globals.AlgorithmicRidBase = BASE_RID;
5203 Globals.bLoadPrinters = True;
5204 Globals.PrintcapCacheTime = 750; /* 12.5 minutes */
5206 Globals.ConfigBackend = config_backend;
5208 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
5209 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
5210 Globals.max_xmit = 0x4104;
5211 Globals.max_mux = 50; /* This is *needed* for profile support. */
5212 Globals.lpqcachetime = 30; /* changed to handle large print servers better -- jerry */
5213 Globals.bDisableSpoolss = False;
5214 Globals.iMaxSmbdProcesses = 0;/* no limit specified */
5215 Globals.pwordlevel = 0;
5216 Globals.unamelevel = 0;
5217 Globals.deadtime = 0;
5218 Globals.getwd_cache = true;
5219 Globals.bLargeReadwrite = True;
5220 Globals.max_log_size = 5000;
5221 Globals.max_open_files = max_open_files();
5222 Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
5223 Globals.maxprotocol = PROTOCOL_NT1;
5224 Globals.minprotocol = PROTOCOL_CORE;
5225 Globals.security = SEC_USER;
5226 Globals.paranoid_server_security = True;
5227 Globals.bEncryptPasswords = True;
5228 Globals.bUpdateEncrypt = False;
5229 Globals.clientSchannel = Auto;
5230 Globals.serverSchannel = Auto;
5231 Globals.bReadRaw = True;
5232 Globals.bWriteRaw = True;
5233 Globals.bNullPasswords = False;
5234 Globals.bObeyPamRestrictions = False;
5236 Globals.bSyslogOnly = False;
5237 Globals.bTimestampLogs = True;
5238 string_set(&Globals.szLogLevel, "0");
5239 Globals.bDebugPrefixTimestamp = False;
5240 Globals.bDebugHiresTimestamp = true;
5241 Globals.bDebugPid = False;
5242 Globals.bDebugUid = False;
5243 Globals.bDebugClass = False;
5244 Globals.bEnableCoreFiles = True;
5245 Globals.max_ttl = 60 * 60 * 24 * 3; /* 3 days default. */
5246 Globals.max_wins_ttl = 60 * 60 * 24 * 6; /* 6 days default. */
5247 Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
5248 Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
5249 Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
5250 Globals.lm_interval = 60;
5251 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
5252 Globals.bNISHomeMap = False;
5253 #ifdef WITH_NISPLUS_HOME
5254 string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
5256 string_set(&Globals.szNISHomeMapName, "auto.home");
5259 Globals.bTimeServer = False;
5260 Globals.bBindInterfacesOnly = False;
5261 Globals.bUnixPasswdSync = False;
5262 Globals.bPamPasswordChange = False;
5263 Globals.bPasswdChatDebug = False;
5264 Globals.iPasswdChatTimeout = 2; /* 2 second default. */
5265 Globals.bNTPipeSupport = True; /* Do NT pipes by default. */
5266 Globals.bNTStatusSupport = True; /* Use NT status by default. */
5267 Globals.bStatCache = True; /* use stat cache by default */
5268 Globals.iMaxStatCacheSize = 256; /* 256k by default */
5269 Globals.restrict_anonymous = 0;
5270 Globals.bClientLanManAuth = False; /* Do NOT use the LanMan hash if it is available */
5271 Globals.bClientPlaintextAuth = False; /* Do NOT use a plaintext password even if is requested by the server */
5272 Globals.bLanmanAuth = False; /* Do NOT use the LanMan hash, even if it is supplied */
5273 Globals.bNTLMAuth = True; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
5274 Globals.bClientNTLMv2Auth = True; /* Client should always use use NTLMv2, as we can't tell that the server supports it, but most modern servers do */
5275 /* Note, that we will also use NTLM2 session security (which is different), if it is available */
5277 Globals.map_to_guest = 0; /* By Default, "Never" */
5278 Globals.oplock_break_wait_time = 0; /* By Default, 0 msecs. */
5279 Globals.enhanced_browsing = true;
5280 Globals.iLockSpinTime = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
5281 #ifdef MMAP_BLACKLIST
5282 Globals.bUseMmap = False;
5284 Globals.bUseMmap = True;
5286 Globals.bUnixExtensions = True;
5287 Globals.bResetOnZeroVC = False;
5288 Globals.bLogWriteableFilesOnExit = False;
5289 Globals.bCreateKrb5Conf = true;
5290 Globals.winbindMaxDomainConnections = 1;
5292 /* hostname lookups can be very expensive and are broken on
5293 a large number of sites (tridge) */
5294 Globals.bHostnameLookups = False;
5296 string_set(&Globals.szPassdbBackend, "tdbsam");
5297 string_set(&Globals.szLdapSuffix, "");
5298 string_set(&Globals.szLdapMachineSuffix, "");
5299 string_set(&Globals.szLdapUserSuffix, "");
5300 string_set(&Globals.szLdapGroupSuffix, "");
5301 string_set(&Globals.szLdapIdmapSuffix, "");
5303 string_set(&Globals.szLdapAdminDn, "");
5304 Globals.ldap_ssl = LDAP_SSL_START_TLS;
5305 Globals.ldap_ssl_ads = False;
5306 Globals.ldap_deref = -1;
5307 Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
5308 Globals.ldap_delete_dn = False;
5309 Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
5310 Globals.ldap_follow_referral = Auto;
5311 Globals.ldap_timeout = LDAP_DEFAULT_TIMEOUT;
5312 Globals.ldap_connection_timeout = LDAP_CONNECTION_DEFAULT_TIMEOUT;
5313 Globals.ldap_page_size = LDAP_PAGE_SIZE;
5315 Globals.ldap_debug_level = 0;
5316 Globals.ldap_debug_threshold = 10;
5318 /* This is what we tell the afs client. in reality we set the token
5319 * to never expire, though, when this runs out the afs client will
5320 * forget the token. Set to 0 to get NEVERDATE.*/
5321 Globals.iAfsTokenLifetime = 604800;
5322 Globals.cups_connection_timeout = CUPS_DEFAULT_CONNECTION_TIMEOUT;
5324 /* these parameters are set to defaults that are more appropriate
5325 for the increasing samba install base:
5327 as a member of the workgroup, that will possibly become a
5328 _local_ master browser (lm = True). this is opposed to a forced
5329 local master browser startup (pm = True).
5331 doesn't provide WINS server service by default (wsupp = False),
5332 and doesn't provide domain master browser services by default, either.
5336 Globals.bMsAddPrinterWizard = True;
5337 Globals.os_level = 20;
5338 Globals.bLocalMaster = True;
5339 Globals.iDomainMaster = Auto; /* depending on bDomainLogons */
5340 Globals.bDomainLogons = False;
5341 Globals.bBrowseList = True;
5342 Globals.bWINSsupport = False;
5343 Globals.bWINSproxy = False;
5345 TALLOC_FREE(Globals.szInitLogonDelayedHosts);
5346 Globals.InitLogonDelay = 100; /* 100 ms default delay */
5348 Globals.bDNSproxy = True;
5350 /* this just means to use them if they exist */
5351 Globals.bKernelOplocks = True;
5353 Globals.bAllowTrustedDomains = True;
5354 string_set(&Globals.szIdmapBackend, "tdb");
5355 Globals.bIdmapReadOnly = false;
5357 string_set(&Globals.szTemplateShell, "/bin/false");
5358 string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
5359 string_set(&Globals.szWinbindSeparator, "\\");
5361 string_set(&Globals.szCupsServer, "");
5362 string_set(&Globals.szIPrintServer, "");
5364 string_set(&Globals.ctdbdSocket, "");
5365 Globals.szClusterAddresses = NULL;
5366 Globals.clustering = False;
5367 Globals.ctdb_timeout = 0;
5368 Globals.ctdb_locktime_warn_threshold = 0;
5370 Globals.winbind_cache_time = 300; /* 5 minutes */
5371 Globals.winbind_reconnect_delay = 30; /* 30 seconds */
5372 Globals.winbind_max_clients = 200;
5373 Globals.bWinbindEnumUsers = False;
5374 Globals.bWinbindEnumGroups = False;
5375 Globals.bWinbindUseDefaultDomain = False;
5376 Globals.bWinbindTrustedDomainsOnly = False;
5377 Globals.bWinbindNestedGroups = True;
5378 Globals.winbind_expand_groups = 1;
5379 Globals.szWinbindNssInfo = str_list_make_v3(NULL, "template", NULL);
5380 Globals.bWinbindRefreshTickets = False;
5381 Globals.bWinbindOfflineLogon = False;
5383 Globals.iIdmapCacheTime = 86400 * 7; /* a week by default */
5384 Globals.iIdmapNegativeCacheTime = 120; /* 2 minutes by default */
5386 Globals.bPassdbExpandExplicit = False;
5388 Globals.name_cache_timeout = 660; /* In seconds */
5390 Globals.bUseSpnego = True;
5391 Globals.bClientUseSpnego = True;
5393 Globals.client_signing = Auto;
5394 Globals.server_signing = False;
5396 Globals.bDeferSharingViolations = True;
5397 string_set(&Globals.smb_ports, SMB_PORTS);
5399 Globals.bEnablePrivileges = True;
5400 Globals.bHostMSDfs = True;
5401 Globals.bASUSupport = False;
5403 /* User defined shares. */
5404 if (asprintf(&s, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5405 smb_panic("init_globals: ENOMEM");
5407 string_set(&Globals.szUsersharePath, s);
5409 string_set(&Globals.szUsershareTemplateShare, "");
5410 Globals.iUsershareMaxShares = 0;
5411 /* By default disallow sharing of directories not owned by the sharer. */
5412 Globals.bUsershareOwnerOnly = True;
5413 /* By default disallow guest access to usershares. */
5414 Globals.bUsershareAllowGuests = False;
5416 Globals.iKeepalive = DEFAULT_KEEPALIVE;
5418 /* By default no shares out of the registry */
5419 Globals.bRegistryShares = False;
5421 Globals.iminreceivefile = 0;
5423 Globals.bMapUntrustedToDomain = false;
5424 Globals.bMulticastDnsRegister = true;
5426 Globals.ismb2_max_read = DEFAULT_SMB2_MAX_READ;
5427 Globals.ismb2_max_write = DEFAULT_SMB2_MAX_WRITE;
5428 Globals.ismb2_max_trans = DEFAULT_SMB2_MAX_TRANSACT;
5429 Globals.ismb2_max_credits = DEFAULT_SMB2_MAX_CREDITS;
5431 string_set(&Globals.ncalrpc_dir, get_dyn_NCALRPCDIR());
5433 /* Now put back the settings that were set with lp_set_cmdline() */
5434 apply_lp_set_cmdline();
5437 /*******************************************************************
5438 Convenience routine to grab string parameters into temporary memory
5439 and run standard_sub_basic on them. The buffers can be written to by
5440 callers without affecting the source string.
5441 ********************************************************************/
5443 static char *lp_string(const char *s)
5446 TALLOC_CTX *ctx = talloc_tos();
5448 /* The follow debug is useful for tracking down memory problems
5449 especially if you have an inner loop that is calling a lp_*()
5450 function that returns a string. Perhaps this debug should be
5451 present all the time? */
5454 DEBUG(10, ("lp_string(%s)\n", s));
5460 ret = talloc_sub_basic(ctx,
5461 get_current_username(),
5462 current_user_info.domain,
5464 if (trim_char(ret, '\"', '\"')) {
5465 if (strchr(ret,'\"') != NULL) {
5467 ret = talloc_sub_basic(ctx,
5468 get_current_username(),
5469 current_user_info.domain,
5477 In this section all the functions that are used to access the
5478 parameters from the rest of the program are defined
5481 #define FN_GLOBAL_STRING(fn_name,ptr) \
5482 char *fn_name(void) {return(lp_string(*(char **)(&Globals.ptr) ? *(char **)(&Globals.ptr) : ""));}
5483 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5484 const char *fn_name(void) {return(*(const char **)(&Globals.ptr) ? *(const char **)(&Globals.ptr) : "");}
5485 #define FN_GLOBAL_LIST(fn_name,ptr) \
5486 const char **fn_name(void) {return(*(const char ***)(&Globals.ptr));}
5487 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5488 bool fn_name(void) {return(*(bool *)(&Globals.ptr));}
5489 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5490 char fn_name(void) {return(*(char *)(&Globals.ptr));}
5491 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5492 int fn_name(void) {return(*(int *)(&Globals.ptr));}
5494 #define FN_LOCAL_STRING(fn_name,val) \
5495 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5496 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5497 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5498 #define FN_LOCAL_LIST(fn_name,val) \
5499 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5500 #define FN_LOCAL_BOOL(fn_name,val) \
5501 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5502 #define FN_LOCAL_INTEGER(fn_name,val) \
5503 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5505 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5506 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5507 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5508 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5509 #define FN_LOCAL_CHAR(fn_name,val) \
5510 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5512 FN_GLOBAL_CONST_STRING(lp_smb_ports, smb_ports)
5513 FN_GLOBAL_CONST_STRING(lp_dos_charset, dos_charset)
5514 FN_GLOBAL_CONST_STRING(lp_unix_charset, unix_charset)
5515 FN_GLOBAL_STRING(lp_logfile, szLogFile)
5516 FN_GLOBAL_STRING(lp_configfile, szConfigFile)
5517 FN_GLOBAL_CONST_STRING(lp_smb_passwd_file, szSMBPasswdFile)
5518 FN_GLOBAL_CONST_STRING(lp_private_dir, szPrivateDir)
5519 FN_GLOBAL_STRING(lp_serverstring, szServerString)
5520 FN_GLOBAL_INTEGER(lp_printcap_cache_time, PrintcapCacheTime)
5521 FN_GLOBAL_STRING(lp_addport_cmd, szAddPortCommand)
5522 FN_GLOBAL_STRING(lp_enumports_cmd, szEnumPortsCommand)
5523 FN_GLOBAL_STRING(lp_addprinter_cmd, szAddPrinterCommand)
5524 FN_GLOBAL_STRING(lp_deleteprinter_cmd, szDeletePrinterCommand)
5525 FN_GLOBAL_STRING(lp_os2_driver_map, szOs2DriverMap)
5526 FN_GLOBAL_CONST_STRING(lp_lockdir, szLockDir)
5527 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5528 * build process or in smb.conf, we use that value. Otherwise they
5529 * default to the value of lp_lockdir(). */
5530 const char *lp_statedir(void) {
5531 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5532 (strcmp(get_dyn_STATEDIR(), Globals.szStateDir) != 0))
5533 return(*(char **)(&Globals.szStateDir) ?
5534 *(char **)(&Globals.szStateDir) : "");
5536 return(*(char **)(&Globals.szLockDir) ?
5537 *(char **)(&Globals.szLockDir) : "");
5539 const char *lp_cachedir(void) {
5540 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5541 (strcmp(get_dyn_CACHEDIR(), Globals.szCacheDir) != 0))
5542 return(*(char **)(&Globals.szCacheDir) ?
5543 *(char **)(&Globals.szCacheDir) : "");
5545 return(*(char **)(&Globals.szLockDir) ?
5546 *(char **)(&Globals.szLockDir) : "");
5548 FN_GLOBAL_CONST_STRING(lp_piddir, szPidDir)
5549 FN_GLOBAL_STRING(lp_mangling_method, szManglingMethod)
5550 FN_GLOBAL_INTEGER(lp_mangle_prefix, mangle_prefix)
5551 FN_GLOBAL_CONST_STRING(lp_utmpdir, szUtmpDir)
5552 FN_GLOBAL_CONST_STRING(lp_wtmpdir, szWtmpDir)
5553 FN_GLOBAL_BOOL(lp_utmp, bUtmp)
5554 FN_GLOBAL_STRING(lp_rootdir, szRootdir)
5555 FN_GLOBAL_STRING(lp_perfcount_module, szSMBPerfcountModule)
5556 FN_GLOBAL_STRING(lp_defaultservice, szDefaultService)
5557 FN_GLOBAL_STRING(lp_msg_command, szMsgCommand)
5558 FN_GLOBAL_STRING(lp_get_quota_command, szGetQuota)
5559 FN_GLOBAL_STRING(lp_set_quota_command, szSetQuota)
5560 FN_GLOBAL_STRING(lp_auto_services, szAutoServices)
5561 FN_GLOBAL_STRING(lp_passwd_program, szPasswdProgram)
5562 FN_GLOBAL_STRING(lp_passwd_chat, szPasswdChat)
5563 FN_GLOBAL_CONST_STRING(lp_passwordserver, szPasswordServer)
5564 FN_GLOBAL_CONST_STRING(lp_name_resolve_order, szNameResolveOrder)
5565 FN_GLOBAL_CONST_STRING(lp_workgroup, szWorkgroup)
5566 FN_GLOBAL_CONST_STRING(lp_netbios_name, szNetbiosName)
5567 FN_GLOBAL_CONST_STRING(lp_netbios_scope, szNetbiosScope)
5568 FN_GLOBAL_CONST_STRING(lp_realm, szRealmUpper)
5569 FN_GLOBAL_CONST_STRING(lp_dnsdomain, szDnsDomain)
5570 FN_GLOBAL_CONST_STRING(lp_afs_username_map, szAfsUsernameMap)
5571 FN_GLOBAL_INTEGER(lp_afs_token_lifetime, iAfsTokenLifetime)
5572 FN_GLOBAL_STRING(lp_log_nt_token_command, szLogNtTokenCommand)
5573 FN_GLOBAL_STRING(lp_username_map, szUsernameMap)
5574 FN_GLOBAL_CONST_STRING(lp_logon_script, szLogonScript)
5575 FN_GLOBAL_CONST_STRING(lp_logon_path, szLogonPath)
5576 FN_GLOBAL_CONST_STRING(lp_logon_drive, szLogonDrive)
5577 FN_GLOBAL_CONST_STRING(lp_logon_home, szLogonHome)
5578 FN_GLOBAL_STRING(lp_remote_announce, szRemoteAnnounce)
5579 FN_GLOBAL_STRING(lp_remote_browse_sync, szRemoteBrowseSync)
5580 FN_GLOBAL_BOOL(lp_nmbd_bind_explicit_broadcast, bNmbdBindExplicitBroadcast)
5581 FN_GLOBAL_LIST(lp_wins_server_list, szWINSservers)
5582 FN_GLOBAL_LIST(lp_interfaces, szInterfaces)
5583 FN_GLOBAL_STRING(lp_nis_home_map_name, szNISHomeMapName)
5584 static FN_GLOBAL_STRING(lp_announce_version, szAnnounceVersion)
5585 FN_GLOBAL_LIST(lp_netbios_aliases, szNetbiosAliases)
5586 /* FN_GLOBAL_STRING(lp_passdb_backend, szPassdbBackend)
5587 * lp_passdb_backend() should be replace by the this macro again after
5590 const char *lp_passdb_backend(void)
5592 char *delim, *quote;
5594 delim = strchr( Globals.szPassdbBackend, ' ');
5595 /* no space at all */
5596 if (delim == NULL) {
5600 quote = strchr(Globals.szPassdbBackend, '"');
5601 /* no quote char or non in the first part */
5602 if (quote == NULL || quote > delim) {
5607 quote = strchr(quote+1, '"');
5608 if (quote == NULL) {
5609 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
5611 } else if (*(quote+1) == '\0') {
5612 /* space, fitting quote char, and one backend only */
5615 /* terminate string after the fitting quote char */
5620 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5621 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5622 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5623 "backend (%s) is used. The rest is ignored.\n", Globals.szPassdbBackend));
5626 return Globals.szPassdbBackend;
5628 FN_GLOBAL_LIST(lp_preload_modules, szPreloadModules)
5629 FN_GLOBAL_STRING(lp_panic_action, szPanicAction)
5630 FN_GLOBAL_STRING(lp_adduser_script, szAddUserScript)
5631 FN_GLOBAL_STRING(lp_renameuser_script, szRenameUserScript)
5632 FN_GLOBAL_STRING(lp_deluser_script, szDelUserScript)
5634 FN_GLOBAL_CONST_STRING(lp_guestaccount, szGuestaccount)
5635 FN_GLOBAL_STRING(lp_addgroup_script, szAddGroupScript)
5636 FN_GLOBAL_STRING(lp_delgroup_script, szDelGroupScript)
5637 FN_GLOBAL_STRING(lp_addusertogroup_script, szAddUserToGroupScript)
5638 FN_GLOBAL_STRING(lp_deluserfromgroup_script, szDelUserFromGroupScript)
5639 FN_GLOBAL_STRING(lp_setprimarygroup_script, szSetPrimaryGroupScript)
5641 FN_GLOBAL_STRING(lp_addmachine_script, szAddMachineScript)
5643 FN_GLOBAL_STRING(lp_shutdown_script, szShutdownScript)
5644 FN_GLOBAL_STRING(lp_abort_shutdown_script, szAbortShutdownScript)
5645 FN_GLOBAL_STRING(lp_username_map_script, szUsernameMapScript)
5646 FN_GLOBAL_INTEGER(lp_username_map_cache_time, iUsernameMapCacheTime)
5648 FN_GLOBAL_STRING(lp_check_password_script, szCheckPasswordScript)
5650 FN_GLOBAL_STRING(lp_wins_hook, szWINSHook)
5651 FN_GLOBAL_CONST_STRING(lp_template_homedir, szTemplateHomedir)
5652 FN_GLOBAL_CONST_STRING(lp_template_shell, szTemplateShell)
5653 FN_GLOBAL_CONST_STRING(lp_winbind_separator, szWinbindSeparator)
5654 FN_GLOBAL_INTEGER(lp_acl_compatibility, iAclCompat)
5655 FN_GLOBAL_BOOL(lp_winbind_enum_users, bWinbindEnumUsers)
5656 FN_GLOBAL_BOOL(lp_winbind_enum_groups, bWinbindEnumGroups)
5657 FN_GLOBAL_BOOL(lp_winbind_use_default_domain, bWinbindUseDefaultDomain)
5658 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, bWinbindTrustedDomainsOnly)
5659 FN_GLOBAL_BOOL(lp_winbind_nested_groups, bWinbindNestedGroups)
5660 FN_GLOBAL_INTEGER(lp_winbind_expand_groups, winbind_expand_groups)
5661 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets, bWinbindRefreshTickets)
5662 FN_GLOBAL_BOOL(lp_winbind_offline_logon, bWinbindOfflineLogon)
5663 FN_GLOBAL_BOOL(lp_winbind_normalize_names, bWinbindNormalizeNames)
5664 FN_GLOBAL_BOOL(lp_winbind_rpc_only, bWinbindRpcOnly)
5665 FN_GLOBAL_BOOL(lp_create_krb5_conf, bCreateKrb5Conf)
5666 static FN_GLOBAL_INTEGER(lp_winbind_max_domain_connections_int,
5667 winbindMaxDomainConnections)
5669 int lp_winbind_max_domain_connections(void)
5671 if (lp_winbind_offline_logon() &&
5672 lp_winbind_max_domain_connections_int() > 1) {
5673 DEBUG(1, ("offline logons active, restricting max domain "
5674 "connections to 1\n"));
5677 return MAX(1, lp_winbind_max_domain_connections_int());
5680 FN_GLOBAL_CONST_STRING(lp_idmap_backend, szIdmapBackend)
5681 FN_GLOBAL_INTEGER(lp_idmap_cache_time, iIdmapCacheTime)
5682 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time, iIdmapNegativeCacheTime)
5683 FN_GLOBAL_INTEGER(lp_keepalive, iKeepalive)
5684 FN_GLOBAL_BOOL(lp_passdb_expand_explicit, bPassdbExpandExplicit)
5686 FN_GLOBAL_STRING(lp_ldap_suffix, szLdapSuffix)
5687 FN_GLOBAL_STRING(lp_ldap_admin_dn, szLdapAdminDn)
5688 FN_GLOBAL_INTEGER(lp_ldap_ssl, ldap_ssl)
5689 FN_GLOBAL_BOOL(lp_ldap_ssl_ads, ldap_ssl_ads)
5690 FN_GLOBAL_INTEGER(lp_ldap_deref, ldap_deref)
5691 FN_GLOBAL_INTEGER(lp_ldap_follow_referral, ldap_follow_referral)
5692 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, ldap_passwd_sync)
5693 FN_GLOBAL_BOOL(lp_ldap_delete_dn, ldap_delete_dn)
5694 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep, ldap_replication_sleep)
5695 FN_GLOBAL_INTEGER(lp_ldap_timeout, ldap_timeout)
5696 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout, ldap_connection_timeout)
5697 FN_GLOBAL_INTEGER(lp_ldap_page_size, ldap_page_size)
5698 FN_GLOBAL_INTEGER(lp_ldap_debug_level, ldap_debug_level)
5699 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold, ldap_debug_threshold)
5700 FN_GLOBAL_STRING(lp_add_share_cmd, szAddShareCommand)
5701 FN_GLOBAL_STRING(lp_change_share_cmd, szChangeShareCommand)
5702 FN_GLOBAL_STRING(lp_delete_share_cmd, szDeleteShareCommand)
5703 FN_GLOBAL_STRING(lp_usershare_path, szUsersharePath)
5704 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list, szUsersharePrefixAllowList)
5705 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list, szUsersharePrefixDenyList)
5707 FN_GLOBAL_LIST(lp_eventlog_list, szEventLogs)
5709 FN_GLOBAL_BOOL(lp_registry_shares, bRegistryShares)
5710 FN_GLOBAL_BOOL(lp_usershare_allow_guests, bUsershareAllowGuests)
5711 FN_GLOBAL_BOOL(lp_usershare_owner_only, bUsershareOwnerOnly)
5712 FN_GLOBAL_BOOL(lp_disable_netbios, bDisableNetbios)
5713 FN_GLOBAL_BOOL(lp_reset_on_zero_vc, bResetOnZeroVC)
5714 FN_GLOBAL_BOOL(lp_log_writeable_files_on_exit,
5715 bLogWriteableFilesOnExit)
5716 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, bMsAddPrinterWizard)
5717 FN_GLOBAL_BOOL(lp_dns_proxy, bDNSproxy)
5718 FN_GLOBAL_BOOL(lp_wins_support, bWINSsupport)
5719 FN_GLOBAL_BOOL(lp_we_are_a_wins_server, bWINSsupport)
5720 FN_GLOBAL_BOOL(lp_wins_proxy, bWINSproxy)
5721 FN_GLOBAL_BOOL(lp_local_master, bLocalMaster)
5722 FN_GLOBAL_BOOL(lp_domain_logons, bDomainLogons)
5723 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts, szInitLogonDelayedHosts)
5724 FN_GLOBAL_INTEGER(lp_init_logon_delay, InitLogonDelay)
5725 FN_GLOBAL_BOOL(lp_load_printers, bLoadPrinters)
5726 FN_GLOBAL_BOOL(_lp_readraw, bReadRaw)
5727 FN_GLOBAL_BOOL(lp_large_readwrite, bLargeReadwrite)
5728 FN_GLOBAL_BOOL(_lp_writeraw, bWriteRaw)
5729 FN_GLOBAL_BOOL(lp_null_passwords, bNullPasswords)
5730 FN_GLOBAL_BOOL(lp_obey_pam_restrictions, bObeyPamRestrictions)
5731 FN_GLOBAL_BOOL(lp_encrypted_passwords, bEncryptPasswords)
5732 FN_GLOBAL_INTEGER(lp_client_schannel, clientSchannel)
5733 FN_GLOBAL_INTEGER(lp_server_schannel, serverSchannel)
5734 FN_GLOBAL_BOOL(lp_syslog_only, bSyslogOnly)
5735 FN_GLOBAL_BOOL(lp_timestamp_logs, bTimestampLogs)
5736 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, bDebugPrefixTimestamp)
5737 FN_GLOBAL_BOOL(lp_debug_hires_timestamp, bDebugHiresTimestamp)
5738 FN_GLOBAL_BOOL(lp_debug_pid, bDebugPid)
5739 FN_GLOBAL_BOOL(lp_debug_uid, bDebugUid)
5740 FN_GLOBAL_BOOL(lp_debug_class, bDebugClass)
5741 FN_GLOBAL_BOOL(lp_enable_core_files, bEnableCoreFiles)
5742 FN_GLOBAL_BOOL(lp_browse_list, bBrowseList)
5743 FN_GLOBAL_BOOL(lp_nis_home_map, bNISHomeMap)
5744 static FN_GLOBAL_BOOL(lp_time_server, bTimeServer)
5745 FN_GLOBAL_BOOL(lp_bind_interfaces_only, bBindInterfacesOnly)
5746 FN_GLOBAL_BOOL(lp_pam_password_change, bPamPasswordChange)
5747 FN_GLOBAL_BOOL(lp_unix_password_sync, bUnixPasswdSync)
5748 FN_GLOBAL_BOOL(lp_passwd_chat_debug, bPasswdChatDebug)
5749 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, iPasswdChatTimeout)
5750 FN_GLOBAL_BOOL(lp_nt_pipe_support, bNTPipeSupport)
5751 FN_GLOBAL_BOOL(lp_nt_status_support, bNTStatusSupport)
5752 FN_GLOBAL_BOOL(lp_stat_cache, bStatCache)
5753 FN_GLOBAL_INTEGER(lp_max_stat_cache_size, iMaxStatCacheSize)
5754 FN_GLOBAL_BOOL(lp_allow_trusted_domains, bAllowTrustedDomains)
5755 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain, bMapUntrustedToDomain)
5756 FN_GLOBAL_INTEGER(lp_restrict_anonymous, restrict_anonymous)
5757 FN_GLOBAL_BOOL(lp_lanman_auth, bLanmanAuth)
5758 FN_GLOBAL_BOOL(lp_ntlm_auth, bNTLMAuth)
5759 FN_GLOBAL_BOOL(lp_client_plaintext_auth, bClientPlaintextAuth)
5760 FN_GLOBAL_BOOL(lp_client_lanman_auth, bClientLanManAuth)
5761 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, bClientNTLMv2Auth)
5762 FN_GLOBAL_BOOL(lp_host_msdfs, bHostMSDfs)
5763 FN_GLOBAL_BOOL(lp_kernel_oplocks, bKernelOplocks)
5764 FN_GLOBAL_BOOL(lp_enhanced_browsing, enhanced_browsing)
5765 FN_GLOBAL_BOOL(lp_use_mmap, bUseMmap)
5766 FN_GLOBAL_BOOL(lp_unix_extensions, bUnixExtensions)
5767 FN_GLOBAL_BOOL(lp_use_spnego, bUseSpnego)
5768 FN_GLOBAL_BOOL(lp_client_use_spnego, bClientUseSpnego)
5769 FN_GLOBAL_BOOL(lp_client_use_spnego_principal, client_use_spnego_principal)
5770 FN_GLOBAL_BOOL(lp_send_spnego_principal, send_spnego_principal)
5771 FN_GLOBAL_BOOL(lp_hostname_lookups, bHostnameLookups)
5772 FN_LOCAL_PARM_BOOL(lp_change_notify, bChangeNotify)
5773 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify, bKernelChangeNotify)
5774 FN_GLOBAL_CONST_STRING(lp_dedicated_keytab_file, szDedicatedKeytabFile)
5775 FN_GLOBAL_INTEGER(lp_kerberos_method, iKerberosMethod)
5776 FN_GLOBAL_BOOL(lp_defer_sharing_violations, bDeferSharingViolations)
5777 FN_GLOBAL_BOOL(lp_enable_privileges, bEnablePrivileges)
5778 FN_GLOBAL_BOOL(lp_enable_asu_support, bASUSupport)
5779 FN_GLOBAL_INTEGER(lp_os_level, os_level)
5780 FN_GLOBAL_INTEGER(lp_max_ttl, max_ttl)
5781 FN_GLOBAL_INTEGER(lp_max_wins_ttl, max_wins_ttl)
5782 FN_GLOBAL_INTEGER(lp_min_wins_ttl, min_wins_ttl)
5783 FN_GLOBAL_INTEGER(lp_max_log_size, max_log_size)
5784 FN_GLOBAL_INTEGER(lp_max_open_files, max_open_files)
5785 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size, open_files_db_hash_size)
5786 FN_GLOBAL_INTEGER(lp_maxxmit, max_xmit)
5787 FN_GLOBAL_INTEGER(lp_maxmux, max_mux)
5788 FN_GLOBAL_INTEGER(lp_passwordlevel, pwordlevel)
5789 FN_GLOBAL_INTEGER(lp_usernamelevel, unamelevel)
5790 FN_GLOBAL_INTEGER(lp_deadtime, deadtime)
5791 FN_GLOBAL_BOOL(lp_getwd_cache, getwd_cache)
5792 static FN_GLOBAL_INTEGER(_lp_maxprotocol, maxprotocol)
5793 int lp_maxprotocol(void)
5795 int ret = _lp_maxprotocol();
5796 if ((ret == PROTOCOL_SMB2) && (lp_security() == SEC_SHARE)) {
5797 DEBUG(2,("WARNING!!: \"security = share\" is incompatible "
5798 "with the SMB2 protocol. Resetting to SMB1.\n" ));
5799 lp_do_parameter(-1, "max protocol", "NT1");
5800 return PROTOCOL_NT1;
5804 FN_GLOBAL_INTEGER(lp_minprotocol, minprotocol)
5805 FN_GLOBAL_INTEGER(lp_security, security)
5806 FN_GLOBAL_LIST(lp_auth_methods, AuthMethods)
5807 FN_GLOBAL_BOOL(lp_paranoid_server_security, paranoid_server_security)
5808 FN_GLOBAL_INTEGER(lp_maxdisksize, maxdisksize)
5809 FN_GLOBAL_INTEGER(lp_lpqcachetime, lpqcachetime)
5810 FN_GLOBAL_INTEGER(lp_max_smbd_processes, iMaxSmbdProcesses)
5811 FN_GLOBAL_BOOL(_lp_disable_spoolss, bDisableSpoolss)
5812 FN_GLOBAL_INTEGER(lp_syslog, syslog)
5813 FN_GLOBAL_INTEGER(lp_lm_announce, lm_announce)
5814 FN_GLOBAL_INTEGER(lp_lm_interval, lm_interval)
5815 FN_GLOBAL_INTEGER(lp_machine_password_timeout, machine_password_timeout)
5816 FN_GLOBAL_INTEGER(lp_map_to_guest, map_to_guest)
5817 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, oplock_break_wait_time)
5818 FN_GLOBAL_INTEGER(lp_lock_spin_time, iLockSpinTime)
5819 FN_GLOBAL_INTEGER(lp_usershare_max_shares, iUsershareMaxShares)
5820 FN_GLOBAL_CONST_STRING(lp_socket_options, szSocketOptions)
5821 FN_GLOBAL_INTEGER(lp_config_backend, ConfigBackend)
5822 FN_GLOBAL_INTEGER(lp_smb2_max_read, ismb2_max_read)
5823 FN_GLOBAL_INTEGER(lp_smb2_max_write, ismb2_max_write)
5824 FN_GLOBAL_INTEGER(lp_smb2_max_trans, ismb2_max_trans)
5825 int lp_smb2_max_credits(void)
5827 if (Globals.ismb2_max_credits == 0) {
5828 Globals.ismb2_max_credits = DEFAULT_SMB2_MAX_CREDITS;
5830 return Globals.ismb2_max_credits;
5832 FN_LOCAL_STRING(lp_preexec, szPreExec)
5833 FN_LOCAL_STRING(lp_postexec, szPostExec)
5834 FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
5835 FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
5836 FN_LOCAL_STRING(lp_servicename, szService)
5837 FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
5838 FN_LOCAL_STRING(lp_pathname, szPath)
5839 FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
5840 FN_LOCAL_STRING(lp_username, szUsername)
5841 FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers)
5842 FN_LOCAL_LIST(lp_valid_users, szValidUsers)
5843 FN_LOCAL_LIST(lp_admin_users, szAdminUsers)
5844 FN_GLOBAL_LIST(lp_svcctl_list, szServicesList)
5845 FN_LOCAL_STRING(lp_cups_options, szCupsOptions)
5846 FN_GLOBAL_STRING(lp_cups_server, szCupsServer)
5847 int lp_cups_encrypt(void)
5850 #ifdef HAVE_HTTPCONNECTENCRYPT
5851 switch (Globals.CupsEncrypt) {
5853 result = HTTP_ENCRYPT_REQUIRED;
5856 result = HTTP_ENCRYPT_ALWAYS;
5859 result = HTTP_ENCRYPT_NEVER;
5865 FN_GLOBAL_STRING(lp_iprint_server, szIPrintServer)
5866 FN_GLOBAL_INTEGER(lp_cups_connection_timeout, cups_connection_timeout)
5867 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket, ctdbdSocket)
5868 FN_GLOBAL_LIST(lp_cluster_addresses, szClusterAddresses)
5869 FN_GLOBAL_BOOL(lp_clustering, clustering)
5870 FN_GLOBAL_INTEGER(lp_ctdb_timeout, ctdb_timeout)
5871 FN_GLOBAL_INTEGER(lp_ctdb_locktime_warn_threshold, ctdb_locktime_warn_threshold)
5872 FN_LOCAL_STRING(lp_printcommand, szPrintcommand)
5873 FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand)
5874 FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand)
5875 FN_LOCAL_STRING(lp_lppausecommand, szLppausecommand)
5876 FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
5877 FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
5878 FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
5879 static FN_LOCAL_STRING(_lp_printername, szPrintername)
5880 FN_LOCAL_CONST_STRING(lp_printjob_username, szPrintjobUsername)
5881 FN_LOCAL_LIST(lp_hostsallow, szHostsallow)
5882 FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny)
5883 FN_LOCAL_STRING(lp_magicscript, szMagicScript)
5884 FN_LOCAL_STRING(lp_magicoutput, szMagicOutput)
5885 FN_LOCAL_STRING(lp_comment, comment)
5886 FN_LOCAL_STRING(lp_force_user, force_user)
5887 FN_LOCAL_STRING(lp_force_group, force_group)
5888 FN_LOCAL_LIST(lp_readlist, readlist)
5889 FN_LOCAL_LIST(lp_writelist, writelist)
5890 FN_LOCAL_LIST(lp_printer_admin, printer_admin)
5891 FN_LOCAL_STRING(lp_fstype, fstype)
5892 FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects)
5893 FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
5894 static FN_LOCAL_STRING(lp_volume, volume)
5895 FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
5896 FN_LOCAL_STRING(lp_hide_files, szHideFiles)
5897 FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
5898 FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
5899 FN_LOCAL_STRING(lp_aio_write_behind, szAioWriteBehind)
5900 FN_LOCAL_STRING(lp_dfree_command, szDfree)
5901 FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
5902 FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
5903 FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
5904 FN_LOCAL_INTEGER(lp_casesensitive, iCaseSensitive)
5905 FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
5906 FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
5907 FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
5908 FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles)
5909 FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable)
5910 FN_LOCAL_BOOL(lp_hideunwriteable_files, bHideUnWriteableFiles)
5911 FN_LOCAL_BOOL(lp_browseable, bBrowseable)
5912 FN_LOCAL_BOOL(lp_access_based_share_enum, bAccessBasedShareEnum)
5913 FN_LOCAL_BOOL(lp_readonly, bRead_only)
5914 FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir)
5915 FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok)
5916 FN_LOCAL_BOOL(lp_guest_only, bGuest_only)
5917 FN_LOCAL_BOOL(lp_administrative_share, bAdministrative_share)
5918 FN_LOCAL_BOOL(lp_print_ok, bPrint_ok)
5919 FN_LOCAL_BOOL(lp_print_notify_backchannel, bPrintNotifyBackchannel)
5920 FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
5921 FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
5922 FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes)
5923 FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport)
5924 FN_LOCAL_PARM_BOOL(lp_locking, bLocking)
5925 FN_LOCAL_PARM_INTEGER(lp_strict_locking, iStrictLocking)
5926 FN_LOCAL_PARM_BOOL(lp_posix_locking, bPosixLocking)
5927 FN_LOCAL_BOOL(lp_share_modes, bShareModes)
5928 FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
5929 FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
5930 FN_LOCAL_BOOL(lp_onlyuser, bOnlyUser)
5931 FN_LOCAL_PARM_BOOL(lp_manglednames, bMangledNames)
5932 FN_LOCAL_BOOL(lp_symlinks, bSymlinks)
5933 FN_LOCAL_BOOL(lp_syncalways, bSyncAlways)
5934 FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate)
5935 FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
5936 FN_LOCAL_BOOL(lp_map_system, bMap_system)
5937 FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly)
5938 FN_LOCAL_BOOL(lp_fake_oplocks, bFakeOplocks)
5939 FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles)
5940 FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode)
5941 FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes)
5942 FN_LOCAL_BOOL(lp_dos_filetime_resolution, bDosFiletimeResolution)
5943 FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes)
5944 FN_GLOBAL_BOOL(lp_async_smb_echo_handler, bAsyncSMBEchoHandler)
5945 FN_GLOBAL_BOOL(lp_multicast_dns_register, bMulticastDnsRegister)
5946 FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks)
5947 FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms)
5948 FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS)
5949 FN_LOCAL_BOOL(lp_inherit_owner, bInheritOwner)
5950 FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver)
5951 FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode)
5952 FN_LOCAL_BOOL(lp_force_printername, bForcePrintername)
5953 FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport)
5954 FN_LOCAL_BOOL(lp_force_unknown_acl_user, bForceUnknownAclUser)
5955 FN_LOCAL_BOOL(lp_ea_support, bEASupport)
5956 FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile)
5957 FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls)
5958 FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit)
5959 FN_LOCAL_BOOL(lp_afs_share, bAfs_Share)
5960 FN_LOCAL_BOOL(lp_acl_check_permissions, bAclCheckPermissions)
5961 FN_LOCAL_BOOL(lp_acl_group_control, bAclGroupControl)
5962 FN_LOCAL_BOOL(lp_acl_map_full_control, bAclMapFullControl)
5963 FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask)
5964 FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode)
5965 FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask)
5966 FN_LOCAL_INTEGER(lp_force_security_mode, iSecurity_force_mode)
5967 FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask)
5968 FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode)
5969 FN_LOCAL_INTEGER(lp_dir_security_mask, iDir_Security_mask)
5970 FN_LOCAL_INTEGER(lp_force_dir_security_mode, iDir_Security_force_mode)
5971 FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections)
5972 FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
5973 FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
5974 FN_LOCAL_INTEGER(lp_printing, iPrinting)
5975 FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
5976 FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
5977 FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
5978 FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
5979 FN_LOCAL_INTEGER(lp_block_size, iBlock_size)
5980 FN_LOCAL_INTEGER(lp_dfree_cache_time, iDfreeCacheTime)
5981 FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size)
5982 FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize)
5983 FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize)
5984 FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly)
5985 FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize)
5986 FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt)
5987 FN_LOCAL_CHAR(lp_magicchar, magic_char)
5988 FN_GLOBAL_INTEGER(lp_winbind_cache_time, winbind_cache_time)
5989 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay, winbind_reconnect_delay)
5990 FN_GLOBAL_INTEGER(lp_winbind_max_clients, winbind_max_clients)
5991 FN_GLOBAL_LIST(lp_winbind_nss_info, szWinbindNssInfo)
5992 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, AlgorithmicRidBase)
5993 FN_GLOBAL_INTEGER(lp_name_cache_timeout, name_cache_timeout)
5994 FN_GLOBAL_INTEGER(lp_client_signing, client_signing)
5995 FN_GLOBAL_INTEGER(lp_server_signing, server_signing)
5996 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping, client_ldap_sasl_wrapping)
5998 FN_GLOBAL_CONST_STRING(lp_ncalrpc_dir, ncalrpc_dir)
6000 /* local prototypes */
6002 static int map_parameter_canonical(const char *pszParmName, bool *inverse);
6003 static const char *get_boolean(bool bool_value);
6004 static int getservicebyname(const char *pszServiceName,
6005 struct service *pserviceDest);
6006 static void copy_service(struct service *pserviceDest,
6007 struct service *pserviceSource,
6008 struct bitmap *pcopymapDest);
6009 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
6011 static bool do_section(const char *pszSectionName, void *userdata);
6012 static void init_copymap(struct service *pservice);
6013 static bool hash_a_service(const char *name, int number);
6014 static void free_service_byindex(int iService);
6015 static void free_param_opts(struct param_opt_struct **popts);
6016 static void show_parameter(int parmIndex);
6017 static bool is_synonym_of(int parm1, int parm2, bool *inverse);
6020 * This is a helper function for parametrical options support. It returns a
6021 * pointer to parametrical option value if it exists or NULL otherwise. Actual
6022 * parametrical functions are quite simple
6024 static struct param_opt_struct *get_parametrics(int snum, const char *type,
6027 bool global_section = False;
6029 struct param_opt_struct *data;
6031 if (snum >= iNumServices) return NULL;
6034 data = Globals.param_opt;
6035 global_section = True;
6037 data = ServicePtrs[snum]->param_opt;
6040 if (asprintf(¶m_key, "%s:%s", type, option) == -1) {
6041 DEBUG(0,("asprintf failed!\n"));
6046 if (strwicmp(data->key, param_key) == 0) {
6047 string_free(¶m_key);
6053 if (!global_section) {
6054 /* Try to fetch the same option but from globals */
6055 /* but only if we are not already working with Globals */
6056 data = Globals.param_opt;
6058 if (strwicmp(data->key, param_key) == 0) {
6059 string_free(¶m_key);
6066 string_free(¶m_key);
6072 #define MISSING_PARAMETER(name) \
6073 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
6075 /*******************************************************************
6076 convenience routine to return int parameters.
6077 ********************************************************************/
6078 static int lp_int(const char *s)
6082 MISSING_PARAMETER(lp_int);
6086 return (int)strtol(s, NULL, 0);
6089 /*******************************************************************
6090 convenience routine to return unsigned long parameters.
6091 ********************************************************************/
6092 static unsigned long lp_ulong(const char *s)
6096 MISSING_PARAMETER(lp_ulong);
6100 return strtoul(s, NULL, 0);
6103 /*******************************************************************
6104 convenience routine to return boolean parameters.
6105 ********************************************************************/
6106 static bool lp_bool(const char *s)
6111 MISSING_PARAMETER(lp_bool);
6115 if (!set_boolean(s, &ret)) {
6116 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
6123 /*******************************************************************
6124 convenience routine to return enum parameters.
6125 ********************************************************************/
6126 static int lp_enum(const char *s,const struct enum_list *_enum)
6130 if (!s || !*s || !_enum) {
6131 MISSING_PARAMETER(lp_enum);
6135 for (i=0; _enum[i].name; i++) {
6136 if (strequal(_enum[i].name,s))
6137 return _enum[i].value;
6140 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
6144 #undef MISSING_PARAMETER
6146 /* DO NOT USE lp_parm_string ANYMORE!!!!
6147 * use lp_parm_const_string or lp_parm_talloc_string
6149 * lp_parm_string is only used to let old modules find this symbol
6151 #undef lp_parm_string
6152 char *lp_parm_string(const char *servicename, const char *type, const char *option);
6153 char *lp_parm_string(const char *servicename, const char *type, const char *option)
6155 return lp_parm_talloc_string(lp_servicenumber(servicename), type, option, NULL);
6158 /* Return parametric option from a given service. Type is a part of option before ':' */
6159 /* Parametric option has following syntax: 'Type: option = value' */
6160 /* the returned value is talloced on the talloc_tos() */
6161 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def)
6163 struct param_opt_struct *data = get_parametrics(snum, type, option);
6165 if (data == NULL||data->value==NULL) {
6167 return lp_string(def);
6173 return lp_string(data->value);
6176 /* Return parametric option from a given service. Type is a part of option before ':' */
6177 /* Parametric option has following syntax: 'Type: option = value' */
6178 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
6180 struct param_opt_struct *data = get_parametrics(snum, type, option);
6182 if (data == NULL||data->value==NULL)
6188 /* Return parametric option from a given service. Type is a part of option before ':' */
6189 /* Parametric option has following syntax: 'Type: option = value' */
6191 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
6193 struct param_opt_struct *data = get_parametrics(snum, type, option);
6195 if (data == NULL||data->value==NULL)
6196 return (const char **)def;
6198 if (data->list==NULL) {
6199 data->list = str_list_make_v3(NULL, data->value, NULL);
6202 return (const char **)data->list;
6205 /* Return parametric option from a given service. Type is a part of option before ':' */
6206 /* Parametric option has following syntax: 'Type: option = value' */
6208 int lp_parm_int(int snum, const char *type, const char *option, int def)
6210 struct param_opt_struct *data = get_parametrics(snum, type, option);
6212 if (data && data->value && *data->value)
6213 return lp_int(data->value);
6218 /* Return parametric option from a given service. Type is a part of option before ':' */
6219 /* Parametric option has following syntax: 'Type: option = value' */
6221 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
6223 struct param_opt_struct *data = get_parametrics(snum, type, option);
6225 if (data && data->value && *data->value)
6226 return lp_ulong(data->value);
6231 /* Return parametric option from a given service. Type is a part of option before ':' */
6232 /* Parametric option has following syntax: 'Type: option = value' */
6234 bool lp_parm_bool(int snum, const char *type, const char *option, bool def)
6236 struct param_opt_struct *data = get_parametrics(snum, type, option);
6238 if (data && data->value && *data->value)
6239 return lp_bool(data->value);
6244 /* Return parametric option from a given service. Type is a part of option before ':' */
6245 /* Parametric option has following syntax: 'Type: option = value' */
6247 int lp_parm_enum(int snum, const char *type, const char *option,
6248 const struct enum_list *_enum, int def)
6250 struct param_opt_struct *data = get_parametrics(snum, type, option);
6252 if (data && data->value && *data->value && _enum)
6253 return lp_enum(data->value, _enum);
6259 /***************************************************************************
6260 Initialise a service to the defaults.
6261 ***************************************************************************/
6263 static void init_service(struct service *pservice)
6265 memset((char *)pservice, '\0', sizeof(struct service));
6266 copy_service(pservice, &sDefault, NULL);
6271 * free a param_opts structure.
6272 * param_opts handling should be moved to talloc;
6273 * then this whole functions reduces to a TALLOC_FREE().
6276 static void free_param_opts(struct param_opt_struct **popts)
6278 struct param_opt_struct *opt, *next_opt;
6280 if (popts == NULL) {
6284 if (*popts != NULL) {
6285 DEBUG(5, ("Freeing parametrics:\n"));
6288 while (opt != NULL) {
6289 string_free(&opt->key);
6290 string_free(&opt->value);
6291 TALLOC_FREE(opt->list);
6292 next_opt = opt->next;
6299 /***************************************************************************
6300 Free the dynamically allocated parts of a service struct.
6301 ***************************************************************************/
6303 static void free_service(struct service *pservice)
6308 if (pservice->szService)
6309 DEBUG(5, ("free_service: Freeing service %s\n",
6310 pservice->szService));
6312 free_parameters(pservice);
6314 string_free(&pservice->szService);
6315 TALLOC_FREE(pservice->copymap);
6317 free_param_opts(&pservice->param_opt);
6319 ZERO_STRUCTP(pservice);
6323 /***************************************************************************
6324 remove a service indexed in the ServicePtrs array from the ServiceHash
6325 and free the dynamically allocated parts
6326 ***************************************************************************/
6328 static void free_service_byindex(int idx)
6330 if ( !LP_SNUM_OK(idx) )
6333 ServicePtrs[idx]->valid = False;
6334 invalid_services[num_invalid_services++] = idx;
6336 /* we have to cleanup the hash record */
6338 if (ServicePtrs[idx]->szService) {
6339 char *canon_name = canonicalize_servicename(
6341 ServicePtrs[idx]->szService );
6343 dbwrap_delete_bystring(ServiceHash, canon_name );
6344 TALLOC_FREE(canon_name);
6347 free_service(ServicePtrs[idx]);
6350 /***************************************************************************
6351 Add a new service to the services array initialising it with the given
6353 ***************************************************************************/
6355 static int add_a_service(const struct service *pservice, const char *name)
6358 struct service tservice;
6359 int num_to_alloc = iNumServices + 1;
6361 tservice = *pservice;
6363 /* it might already exist */
6365 i = getservicebyname(name, NULL);
6371 /* find an invalid one */
6373 if (num_invalid_services > 0) {
6374 i = invalid_services[--num_invalid_services];
6377 /* if not, then create one */
6378 if (i == iNumServices) {
6379 struct service **tsp;
6382 tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct service *, num_to_alloc);
6384 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
6388 ServicePtrs[iNumServices] = SMB_MALLOC_P(struct service);
6389 if (!ServicePtrs[iNumServices]) {
6390 DEBUG(0,("add_a_service: out of memory!\n"));
6395 /* enlarge invalid_services here for now... */
6396 tinvalid = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services, int,
6398 if (tinvalid == NULL) {
6399 DEBUG(0,("add_a_service: failed to enlarge "
6400 "invalid_services!\n"));
6403 invalid_services = tinvalid;
6405 free_service_byindex(i);
6408 ServicePtrs[i]->valid = True;
6410 init_service(ServicePtrs[i]);
6411 copy_service(ServicePtrs[i], &tservice, NULL);
6413 string_set(&ServicePtrs[i]->szService, name);
6415 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
6416 i, ServicePtrs[i]->szService));
6418 if (!hash_a_service(ServicePtrs[i]->szService, i)) {
6425 /***************************************************************************
6426 Convert a string to uppercase and remove whitespaces.
6427 ***************************************************************************/
6429 char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src)
6434 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
6438 result = talloc_strdup(ctx, src);
6439 SMB_ASSERT(result != NULL);
6445 /***************************************************************************
6446 Add a name/index pair for the services array to the hash table.
6447 ***************************************************************************/
6449 static bool hash_a_service(const char *name, int idx)
6453 if ( !ServiceHash ) {
6454 DEBUG(10,("hash_a_service: creating servicehash\n"));
6455 ServiceHash = db_open_rbt(NULL);
6456 if ( !ServiceHash ) {
6457 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
6462 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
6465 canon_name = canonicalize_servicename(talloc_tos(), name );
6467 dbwrap_store_bystring(ServiceHash, canon_name,
6468 make_tdb_data((uint8 *)&idx, sizeof(idx)),
6471 TALLOC_FREE(canon_name);
6476 /***************************************************************************
6477 Add a new home service, with the specified home directory, defaults coming
6479 ***************************************************************************/
6481 bool lp_add_home(const char *pszHomename, int iDefaultService,
6482 const char *user, const char *pszHomedir)
6486 if (pszHomename == NULL || user == NULL || pszHomedir == NULL ||
6487 pszHomedir[0] == '\0') {
6491 i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
6496 if (!(*(ServicePtrs[iDefaultService]->szPath))
6497 || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
6498 string_set(&ServicePtrs[i]->szPath, pszHomedir);
6501 if (!(*(ServicePtrs[i]->comment))) {
6502 char *comment = NULL;
6503 if (asprintf(&comment, "Home directory of %s", user) < 0) {
6506 string_set(&ServicePtrs[i]->comment, comment);
6510 /* set the browseable flag from the global default */
6512 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6513 ServicePtrs[i]->bAccessBasedShareEnum = sDefault.bAccessBasedShareEnum;
6515 ServicePtrs[i]->autoloaded = True;
6517 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
6518 user, ServicePtrs[i]->szPath ));
6523 /***************************************************************************
6524 Add a new service, based on an old one.
6525 ***************************************************************************/
6527 int lp_add_service(const char *pszService, int iDefaultService)
6529 if (iDefaultService < 0) {
6530 return add_a_service(&sDefault, pszService);
6533 return (add_a_service(ServicePtrs[iDefaultService], pszService));
6536 /***************************************************************************
6537 Add the IPC service.
6538 ***************************************************************************/
6540 static bool lp_add_ipc(const char *ipc_name, bool guest_ok)
6542 char *comment = NULL;
6543 int i = add_a_service(&sDefault, ipc_name);
6548 if (asprintf(&comment, "IPC Service (%s)",
6549 Globals.szServerString) < 0) {
6553 string_set(&ServicePtrs[i]->szPath, tmpdir());
6554 string_set(&ServicePtrs[i]->szUsername, "");
6555 string_set(&ServicePtrs[i]->comment, comment);
6556 string_set(&ServicePtrs[i]->fstype, "IPC");
6557 ServicePtrs[i]->iMaxConnections = 0;
6558 ServicePtrs[i]->bAvailable = True;
6559 ServicePtrs[i]->bRead_only = True;
6560 ServicePtrs[i]->bGuest_only = False;
6561 ServicePtrs[i]->bAdministrative_share = True;
6562 ServicePtrs[i]->bGuest_ok = guest_ok;
6563 ServicePtrs[i]->bPrint_ok = False;
6564 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6566 DEBUG(3, ("adding IPC service\n"));
6572 /***************************************************************************
6573 Add a new printer service, with defaults coming from service iFrom.
6574 ***************************************************************************/
6576 bool lp_add_printer(const char *pszPrintername, int iDefaultService)
6578 const char *comment = "From Printcap";
6579 int i = add_a_service(ServicePtrs[iDefaultService], pszPrintername);
6584 /* note that we do NOT default the availability flag to True - */
6585 /* we take it from the default service passed. This allows all */
6586 /* dynamic printers to be disabled by disabling the [printers] */
6587 /* entry (if/when the 'available' keyword is implemented!). */
6589 /* the printer name is set to the service name. */
6590 string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
6591 string_set(&ServicePtrs[i]->comment, comment);
6593 /* set the browseable flag from the gloabl default */
6594 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6596 /* Printers cannot be read_only. */
6597 ServicePtrs[i]->bRead_only = False;
6598 /* No share modes on printer services. */
6599 ServicePtrs[i]->bShareModes = False;
6600 /* No oplocks on printer services. */
6601 ServicePtrs[i]->bOpLocks = False;
6602 /* Printer services must be printable. */
6603 ServicePtrs[i]->bPrint_ok = True;
6605 DEBUG(3, ("adding printer service %s\n", pszPrintername));
6611 /***************************************************************************
6612 Check whether the given parameter name is valid.
6613 Parametric options (names containing a colon) are considered valid.
6614 ***************************************************************************/
6616 bool lp_parameter_is_valid(const char *pszParmName)
6618 return ((map_parameter(pszParmName) != -1) ||
6619 (strchr(pszParmName, ':') != NULL));
6622 /***************************************************************************
6623 Check whether the given name is the name of a global parameter.
6624 Returns True for strings belonging to parameters of class
6625 P_GLOBAL, False for all other strings, also for parametric options
6626 and strings not belonging to any option.
6627 ***************************************************************************/
6629 bool lp_parameter_is_global(const char *pszParmName)
6631 int num = map_parameter(pszParmName);
6634 return (parm_table[num].p_class == P_GLOBAL);
6640 /**************************************************************************
6641 Check whether the given name is the canonical name of a parameter.
6642 Returns False if it is not a valid parameter Name.
6643 For parametric options, True is returned.
6644 **************************************************************************/
6646 bool lp_parameter_is_canonical(const char *parm_name)
6648 if (!lp_parameter_is_valid(parm_name)) {
6652 return (map_parameter(parm_name) ==
6653 map_parameter_canonical(parm_name, NULL));
6656 /**************************************************************************
6657 Determine the canonical name for a parameter.
6658 Indicate when it is an inverse (boolean) synonym instead of a
6660 **************************************************************************/
6662 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
6667 if (!lp_parameter_is_valid(parm_name)) {
6672 num = map_parameter_canonical(parm_name, inverse);
6674 /* parametric option */
6675 *canon_parm = parm_name;
6677 *canon_parm = parm_table[num].label;
6684 /**************************************************************************
6685 Determine the canonical name for a parameter.
6686 Turn the value given into the inverse boolean expression when
6687 the synonym is an invers boolean synonym.
6689 Return True if parm_name is a valid parameter name and
6690 in case it is an invers boolean synonym, if the val string could
6691 successfully be converted to the reverse bool.
6692 Return false in all other cases.
6693 **************************************************************************/
6695 bool lp_canonicalize_parameter_with_value(const char *parm_name,
6697 const char **canon_parm,
6698 const char **canon_val)
6703 if (!lp_parameter_is_valid(parm_name)) {
6709 num = map_parameter_canonical(parm_name, &inverse);
6711 /* parametric option */
6712 *canon_parm = parm_name;
6715 *canon_parm = parm_table[num].label;
6717 if (!lp_invert_boolean(val, canon_val)) {
6729 /***************************************************************************
6730 Map a parameter's string representation to something we can use.
6731 Returns False if the parameter string is not recognised, else TRUE.
6732 ***************************************************************************/
6734 static int map_parameter(const char *pszParmName)
6738 if (*pszParmName == '-' && !strequal(pszParmName, "-valid"))
6741 for (iIndex = 0; parm_table[iIndex].label; iIndex++)
6742 if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
6745 /* Warn only if it isn't parametric option */
6746 if (strchr(pszParmName, ':') == NULL)
6747 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
6748 /* We do return 'fail' for parametric options as well because they are
6749 stored in different storage
6754 /***************************************************************************
6755 Map a parameter's string representation to the index of the canonical
6756 form of the parameter (it might be a synonym).
6757 Returns -1 if the parameter string is not recognised.
6758 ***************************************************************************/
6760 static int map_parameter_canonical(const char *pszParmName, bool *inverse)
6762 int parm_num, canon_num;
6763 bool loc_inverse = False;
6765 parm_num = map_parameter(pszParmName);
6766 if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_HIDE)) {
6767 /* invalid, parametric or no canidate for synonyms ... */
6771 for (canon_num = 0; parm_table[canon_num].label; canon_num++) {
6772 if (is_synonym_of(parm_num, canon_num, &loc_inverse)) {
6773 parm_num = canon_num;
6779 if (inverse != NULL) {
6780 *inverse = loc_inverse;
6785 /***************************************************************************
6786 return true if parameter number parm1 is a synonym of parameter
6787 number parm2 (parm2 being the principal name).
6788 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6790 ***************************************************************************/
6792 static bool is_synonym_of(int parm1, int parm2, bool *inverse)
6794 if ((parm_table[parm1].ptr == parm_table[parm2].ptr) &&
6795 (parm_table[parm1].flags & FLAG_HIDE) &&
6796 !(parm_table[parm2].flags & FLAG_HIDE))
6798 if (inverse != NULL) {
6799 if ((parm_table[parm1].type == P_BOOLREV) &&
6800 (parm_table[parm2].type == P_BOOL))
6812 /***************************************************************************
6813 Show one parameter's name, type, [values,] and flags.
6814 (helper functions for show_parameter_list)
6815 ***************************************************************************/
6817 static void show_parameter(int parmIndex)
6819 int enumIndex, flagIndex;
6824 const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6825 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6827 unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
6828 FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
6829 FLAG_HIDE, FLAG_DOS_STRING};
6830 const char *flag_names[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6831 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6832 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL};
6834 printf("%s=%s", parm_table[parmIndex].label,
6835 type[parm_table[parmIndex].type]);
6836 if (parm_table[parmIndex].type == P_ENUM) {
6839 parm_table[parmIndex].enum_list[enumIndex].name;
6843 enumIndex ? "|" : "",
6844 parm_table[parmIndex].enum_list[enumIndex].name);
6849 for (flagIndex=0; flag_names[flagIndex]; flagIndex++) {
6850 if (parm_table[parmIndex].flags & flags[flagIndex]) {
6853 flag_names[flagIndex]);
6858 /* output synonyms */
6860 for (parmIndex2=0; parm_table[parmIndex2].label; parmIndex2++) {
6861 if (is_synonym_of(parmIndex, parmIndex2, &inverse)) {
6862 printf(" (%ssynonym of %s)", inverse ? "inverse " : "",
6863 parm_table[parmIndex2].label);
6864 } else if (is_synonym_of(parmIndex2, parmIndex, &inverse)) {
6866 printf(" (synonyms: ");
6871 printf("%s%s", parm_table[parmIndex2].label,
6872 inverse ? "[i]" : "");
6882 /***************************************************************************
6883 Show all parameter's name, type, [values,] and flags.
6884 ***************************************************************************/
6886 void show_parameter_list(void)
6888 int classIndex, parmIndex;
6889 const char *section_names[] = { "local", "global", NULL};
6891 for (classIndex=0; section_names[classIndex]; classIndex++) {
6892 printf("[%s]\n", section_names[classIndex]);
6893 for (parmIndex = 0; parm_table[parmIndex].label; parmIndex++) {
6894 if (parm_table[parmIndex].p_class == classIndex) {
6895 show_parameter(parmIndex);
6901 /***************************************************************************
6902 Check if a given string correctly represents a boolean value.
6903 ***************************************************************************/
6905 bool lp_string_is_valid_boolean(const char *parm_value)
6907 return set_boolean(parm_value, NULL);
6910 /***************************************************************************
6911 Get the standard string representation of a boolean value ("yes" or "no")
6912 ***************************************************************************/
6914 static const char *get_boolean(bool bool_value)
6916 static const char *yes_str = "yes";
6917 static const char *no_str = "no";
6919 return (bool_value ? yes_str : no_str);
6922 /***************************************************************************
6923 Provide the string of the negated boolean value associated to the boolean
6924 given as a string. Returns False if the passed string does not correctly
6925 represent a boolean.
6926 ***************************************************************************/
6928 bool lp_invert_boolean(const char *str, const char **inverse_str)
6932 if (!set_boolean(str, &val)) {
6936 *inverse_str = get_boolean(!val);
6940 /***************************************************************************
6941 Provide the canonical string representation of a boolean value given
6942 as a string. Return True on success, False if the string given does
6943 not correctly represent a boolean.
6944 ***************************************************************************/
6946 bool lp_canonicalize_boolean(const char *str, const char**canon_str)
6950 if (!set_boolean(str, &val)) {
6954 *canon_str = get_boolean(val);
6958 /***************************************************************************
6959 Find a service by name. Otherwise works like get_service.
6960 ***************************************************************************/
6962 static int getservicebyname(const char *pszServiceName, struct service *pserviceDest)
6968 if (ServiceHash == NULL) {
6972 canon_name = canonicalize_servicename(talloc_tos(), pszServiceName);
6974 data = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name);
6976 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
6977 iService = *(int *)data.dptr;
6980 TALLOC_FREE(canon_name);
6982 if ((iService != -1) && (LP_SNUM_OK(iService))
6983 && (pserviceDest != NULL)) {
6984 copy_service(pserviceDest, ServicePtrs[iService], NULL);
6990 /***************************************************************************
6991 Copy a service structure to another.
6992 If pcopymapDest is NULL then copy all fields
6993 ***************************************************************************/
6996 * Add a parametric option to a param_opt_struct,
6997 * replacing old value, if already present.
6999 static void set_param_opt(struct param_opt_struct **opt_list,
7000 const char *opt_name,
7001 const char *opt_value,
7004 struct param_opt_struct *new_opt, *opt;
7007 if (opt_list == NULL) {
7014 /* Traverse destination */
7016 /* If we already have same option, override it */
7017 if (strwicmp(opt->key, opt_name) == 0) {
7018 if ((opt->flags & FLAG_CMDLINE) &&
7019 !(flags & FLAG_CMDLINE)) {
7020 /* it's been marked as not to be
7024 string_free(&opt->value);
7025 TALLOC_FREE(opt->list);
7026 opt->value = SMB_STRDUP(opt_value);
7034 new_opt = SMB_XMALLOC_P(struct param_opt_struct);
7035 new_opt->key = SMB_STRDUP(opt_name);
7036 new_opt->value = SMB_STRDUP(opt_value);
7037 new_opt->list = NULL;
7038 new_opt->flags = flags;
7039 DLIST_ADD(*opt_list, new_opt);
7043 static void copy_service(struct service *pserviceDest, struct service *pserviceSource,
7044 struct bitmap *pcopymapDest)
7047 bool bcopyall = (pcopymapDest == NULL);
7048 struct param_opt_struct *data;
7050 for (i = 0; parm_table[i].label; i++)
7051 if (parm_table[i].ptr && parm_table[i].p_class == P_LOCAL &&
7052 (bcopyall || bitmap_query(pcopymapDest,i))) {
7053 void *def_ptr = parm_table[i].ptr;
7055 ((char *)pserviceSource) + PTR_DIFF(def_ptr,
7058 ((char *)pserviceDest) + PTR_DIFF(def_ptr,
7061 switch (parm_table[i].type) {
7064 *(bool *)dest_ptr = *(bool *)src_ptr;
7070 *(int *)dest_ptr = *(int *)src_ptr;
7074 *(char *)dest_ptr = *(char *)src_ptr;
7078 string_set((char **)dest_ptr,
7084 char *upper_string = strupper_talloc(talloc_tos(),
7086 string_set((char **)dest_ptr,
7088 TALLOC_FREE(upper_string);
7092 TALLOC_FREE(*((char ***)dest_ptr));
7093 *((char ***)dest_ptr) = str_list_copy(NULL,
7094 *(const char ***)src_ptr);
7102 init_copymap(pserviceDest);
7103 if (pserviceSource->copymap)
7104 bitmap_copy(pserviceDest->copymap,
7105 pserviceSource->copymap);
7108 data = pserviceSource->param_opt;
7110 set_param_opt(&pserviceDest->param_opt, data->key, data->value, data->flags);
7115 /***************************************************************************
7116 Check a service for consistency. Return False if the service is in any way
7117 incomplete or faulty, else True.
7118 ***************************************************************************/
7120 bool service_ok(int iService)
7125 if (ServicePtrs[iService]->szService[0] == '\0') {
7126 DEBUG(0, ("The following message indicates an internal error:\n"));
7127 DEBUG(0, ("No service name in service entry.\n"));
7131 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
7132 /* I can't see why you'd want a non-printable printer service... */
7133 if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
7134 if (!ServicePtrs[iService]->bPrint_ok) {
7135 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
7136 ServicePtrs[iService]->szService));
7137 ServicePtrs[iService]->bPrint_ok = True;
7139 /* [printers] service must also be non-browsable. */
7140 if (ServicePtrs[iService]->bBrowseable)
7141 ServicePtrs[iService]->bBrowseable = False;
7144 if (ServicePtrs[iService]->szPath[0] == '\0' &&
7145 strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0 &&
7146 ServicePtrs[iService]->szMSDfsProxy[0] == '\0'
7148 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
7149 ServicePtrs[iService]->szService));
7150 ServicePtrs[iService]->bAvailable = False;
7153 /* If a service is flagged unavailable, log the fact at level 1. */
7154 if (!ServicePtrs[iService]->bAvailable)
7155 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
7156 ServicePtrs[iService]->szService));
7161 static struct smbconf_ctx *lp_smbconf_ctx(void)
7164 static struct smbconf_ctx *conf_ctx = NULL;
7166 if (conf_ctx == NULL) {
7167 err = smbconf_init(NULL, &conf_ctx, "registry:");
7168 if (!SBC_ERROR_IS_OK(err)) {
7169 DEBUG(1, ("error initializing registry configuration: "
7170 "%s\n", sbcErrorString(err)));
7178 static bool process_smbconf_service(struct smbconf_service *service)
7183 if (service == NULL) {
7187 ret = do_section(service->name, NULL);
7191 for (count = 0; count < service->num_params; count++) {
7192 ret = do_parameter(service->param_names[count],
7193 service->param_values[count],
7199 if (iServiceIndex >= 0) {
7200 return service_ok(iServiceIndex);
7206 * load a service from registry and activate it
7208 bool process_registry_service(const char *service_name)
7211 struct smbconf_service *service = NULL;
7212 TALLOC_CTX *mem_ctx = talloc_stackframe();
7213 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7216 if (conf_ctx == NULL) {
7220 DEBUG(5, ("process_registry_service: service name %s\n", service_name));
7222 if (!smbconf_share_exists(conf_ctx, service_name)) {
7224 * Registry does not contain data for this service (yet),
7225 * but make sure lp_load doesn't return false.
7231 err = smbconf_get_share(conf_ctx, mem_ctx, service_name, &service);
7232 if (!SBC_ERROR_IS_OK(err)) {
7236 ret = process_smbconf_service(service);
7242 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7245 TALLOC_FREE(mem_ctx);
7250 * process_registry_globals
7252 static bool process_registry_globals(void)
7256 add_to_file_list(INCLUDE_REGISTRY_NAME, INCLUDE_REGISTRY_NAME);
7258 ret = do_parameter("registry shares", "yes", NULL);
7263 return process_registry_service(GLOBAL_NAME);
7266 bool process_registry_shares(void)
7270 struct smbconf_service **service = NULL;
7271 uint32_t num_shares = 0;
7272 TALLOC_CTX *mem_ctx = talloc_stackframe();
7273 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7276 if (conf_ctx == NULL) {
7280 err = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &service);
7281 if (!SBC_ERROR_IS_OK(err)) {
7287 for (count = 0; count < num_shares; count++) {
7288 if (strequal(service[count]->name, GLOBAL_NAME)) {
7291 ret = process_smbconf_service(service[count]);
7298 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7301 TALLOC_FREE(mem_ctx);
7305 #define MAX_INCLUDE_DEPTH 100
7307 static uint8_t include_depth;
7309 static struct file_lists {
7310 struct file_lists *next;
7314 } *file_lists = NULL;
7316 /*******************************************************************
7317 Keep a linked list of all config files so we know when one has changed
7318 it's date and needs to be reloaded.
7319 ********************************************************************/
7321 static void add_to_file_list(const char *fname, const char *subfname)
7323 struct file_lists *f = file_lists;
7326 if (f->name && !strcmp(f->name, fname))
7332 f = SMB_MALLOC_P(struct file_lists);
7335 f->next = file_lists;
7336 f->name = SMB_STRDUP(fname);
7341 f->subfname = SMB_STRDUP(subfname);
7348 f->modtime = file_modtime(subfname);
7350 time_t t = file_modtime(subfname);
7358 * Free the file lists
7360 static void free_file_list(void)
7362 struct file_lists *f;
7363 struct file_lists *next;
7368 SAFE_FREE( f->name );
7369 SAFE_FREE( f->subfname );
7378 * Utility function for outsiders to check if we're running on registry.
7380 bool lp_config_backend_is_registry(void)
7382 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY);
7386 * Utility function to check if the config backend is FILE.
7388 bool lp_config_backend_is_file(void)
7390 return (lp_config_backend() == CONFIG_BACKEND_FILE);
7393 /*******************************************************************
7394 Check if a config file has changed date.
7395 ********************************************************************/
7397 bool lp_file_list_changed(void)
7399 struct file_lists *f = file_lists;
7401 DEBUG(6, ("lp_file_list_changed()\n"));
7406 if (strequal(f->name, INCLUDE_REGISTRY_NAME)) {
7407 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7409 if (conf_ctx == NULL) {
7412 if (smbconf_changed(conf_ctx, &conf_last_csn, NULL,
7415 DEBUGADD(6, ("registry config changed\n"));
7420 n2 = talloc_sub_basic(talloc_tos(),
7421 get_current_username(),
7422 current_user_info.domain,
7427 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
7428 f->name, n2, ctime(&f->modtime)));
7430 mod_time = file_modtime(n2);
7433 ((f->modtime != mod_time) ||
7434 (f->subfname == NULL) ||
7435 (strcmp(n2, f->subfname) != 0)))
7438 ("file %s modified: %s\n", n2,
7440 f->modtime = mod_time;
7441 SAFE_FREE(f->subfname);
7442 f->subfname = SMB_STRDUP(n2);
7455 * Initialize iconv conversion descriptors.
7457 * This is called the first time it is needed, and also called again
7458 * every time the configuration is reloaded, because the charset or
7459 * codepage might have changed.
7461 static void init_iconv(void)
7463 global_iconv_handle = smb_iconv_handle_reinit(NULL, lp_dos_charset(),
7465 true, global_iconv_handle);
7468 static bool handle_charset(int snum, const char *pszParmValue, char **ptr)
7470 if (strcmp(*ptr, pszParmValue) != 0) {
7471 string_set(ptr, pszParmValue);
7477 static bool handle_dos_charset(int snum, const char *pszParmValue, char **ptr)
7479 bool is_utf8 = false;
7480 size_t len = strlen(pszParmValue);
7482 if (len == 4 || len == 5) {
7483 /* Don't use StrCaseCmp here as we don't want to
7484 initialize iconv. */
7485 if ((toupper_ascii(pszParmValue[0]) == 'U') &&
7486 (toupper_ascii(pszParmValue[1]) == 'T') &&
7487 (toupper_ascii(pszParmValue[2]) == 'F')) {
7489 if (pszParmValue[3] == '8') {
7493 if (pszParmValue[3] == '-' &&
7494 pszParmValue[4] == '8') {
7501 if (strcmp(*ptr, pszParmValue) != 0) {
7503 DEBUG(0,("ERROR: invalid DOS charset: 'dos charset' must not "
7504 "be UTF8, using (default value) %s instead.\n",
7505 DEFAULT_DOS_CHARSET));
7506 pszParmValue = DEFAULT_DOS_CHARSET;
7508 string_set(ptr, pszParmValue);
7514 static bool handle_realm(int snum, const char *pszParmValue, char **ptr)
7517 char *realm = strupper_talloc(talloc_tos(), pszParmValue);
7518 char *dnsdomain = strlower_talloc(talloc_tos(), pszParmValue);
7520 ret &= string_set(&Globals.szRealm, pszParmValue);
7521 ret &= string_set(&Globals.szRealmUpper, realm);
7522 ret &= string_set(&Globals.szDnsDomain, dnsdomain);
7524 TALLOC_FREE(dnsdomain);
7529 static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
7531 TALLOC_FREE(Globals.szNetbiosAliases);
7532 Globals.szNetbiosAliases = str_list_make_v3(NULL, pszParmValue, NULL);
7533 return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
7536 /***************************************************************************
7537 Handle the include operation.
7538 ***************************************************************************/
7539 static bool bAllowIncludeRegistry = true;
7541 static bool handle_include(int snum, const char *pszParmValue, char **ptr)
7545 if (include_depth >= MAX_INCLUDE_DEPTH) {
7546 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7551 if (strequal(pszParmValue, INCLUDE_REGISTRY_NAME)) {
7552 if (!bAllowIncludeRegistry) {
7555 if (bInGlobalSection) {
7558 ret = process_registry_globals();
7562 DEBUG(1, ("\"include = registry\" only effective "
7563 "in %s section\n", GLOBAL_NAME));
7568 fname = talloc_sub_basic(talloc_tos(), get_current_username(),
7569 current_user_info.domain,
7572 add_to_file_list(pszParmValue, fname);
7574 string_set(ptr, fname);
7576 if (file_exist(fname)) {
7579 ret = pm_process(fname, do_section, do_parameter, NULL);
7585 DEBUG(2, ("Can't find include file %s\n", fname));
7590 /***************************************************************************
7591 Handle the interpretation of the copy parameter.
7592 ***************************************************************************/
7594 static bool handle_copy(int snum, const char *pszParmValue, char **ptr)
7598 struct service serviceTemp;
7600 string_set(ptr, pszParmValue);
7602 init_service(&serviceTemp);
7606 DEBUG(3, ("Copying service from service %s\n", pszParmValue));
7608 if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) {
7609 if (iTemp == iServiceIndex) {
7610 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
7612 copy_service(ServicePtrs[iServiceIndex],
7614 ServicePtrs[iServiceIndex]->copymap);
7618 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
7622 free_service(&serviceTemp);
7626 static bool handle_ldap_debug_level(int snum, const char *pszParmValue, char **ptr)
7628 Globals.ldap_debug_level = lp_int(pszParmValue);
7629 init_ldap_debugging();
7633 /***************************************************************************
7634 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7639 idmap uid = 1000-1999
7642 We only do simple parsing checks here. The strings are parsed into useful
7643 structures in the idmap daemon code.
7645 ***************************************************************************/
7647 /* Some lp_ routines to return idmap [ug]id information */
7649 static uid_t idmap_uid_low, idmap_uid_high;
7650 static gid_t idmap_gid_low, idmap_gid_high;
7652 bool lp_idmap_uid(uid_t *low, uid_t *high)
7654 if (idmap_uid_low == 0 || idmap_uid_high == 0)
7658 *low = idmap_uid_low;
7661 *high = idmap_uid_high;
7666 bool lp_idmap_gid(gid_t *low, gid_t *high)
7668 if (idmap_gid_low == 0 || idmap_gid_high == 0)
7672 *low = idmap_gid_low;
7675 *high = idmap_gid_high;
7680 static bool handle_idmap_backend(int snum, const char *pszParmValue, char **ptr)
7682 lp_do_parameter(snum, "idmap config * : backend", pszParmValue);
7687 /* Do some simple checks on "idmap [ug]id" parameter values */
7689 static bool handle_idmap_uid(int snum, const char *pszParmValue, char **ptr)
7691 lp_do_parameter(snum, "idmap config * : range", pszParmValue);
7696 static bool handle_idmap_gid(int snum, const char *pszParmValue, char **ptr)
7698 lp_do_parameter(snum, "idmap config * : range", pszParmValue);
7703 /***************************************************************************
7704 Handle the DEBUG level list.
7705 ***************************************************************************/
7707 static bool handle_debug_list( int snum, const char *pszParmValueIn, char **ptr )
7709 string_set(ptr, pszParmValueIn);
7710 return debug_parse_levels(pszParmValueIn);
7713 /***************************************************************************
7714 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7715 ***************************************************************************/
7717 static const char *append_ldap_suffix( const char *str )
7719 const char *suffix_string;
7722 suffix_string = talloc_asprintf(talloc_tos(), "%s,%s", str,
7723 Globals.szLdapSuffix );
7724 if ( !suffix_string ) {
7725 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7729 return suffix_string;
7732 const char *lp_ldap_machine_suffix(void)
7734 if (Globals.szLdapMachineSuffix[0])
7735 return append_ldap_suffix(Globals.szLdapMachineSuffix);
7737 return lp_string(Globals.szLdapSuffix);
7740 const char *lp_ldap_user_suffix(void)
7742 if (Globals.szLdapUserSuffix[0])
7743 return append_ldap_suffix(Globals.szLdapUserSuffix);
7745 return lp_string(Globals.szLdapSuffix);
7748 const char *lp_ldap_group_suffix(void)
7750 if (Globals.szLdapGroupSuffix[0])
7751 return append_ldap_suffix(Globals.szLdapGroupSuffix);
7753 return lp_string(Globals.szLdapSuffix);
7756 const char *lp_ldap_idmap_suffix(void)
7758 if (Globals.szLdapIdmapSuffix[0])
7759 return append_ldap_suffix(Globals.szLdapIdmapSuffix);
7761 return lp_string(Globals.szLdapSuffix);
7764 /****************************************************************************
7765 set the value for a P_ENUM
7766 ***************************************************************************/
7768 static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue,
7773 for (i = 0; parm->enum_list[i].name; i++) {
7774 if ( strequal(pszParmValue, parm->enum_list[i].name)) {
7775 *ptr = parm->enum_list[i].value;
7779 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7780 pszParmValue, parm->label));
7783 /***************************************************************************
7784 ***************************************************************************/
7786 static bool handle_printing(int snum, const char *pszParmValue, char **ptr)
7788 static int parm_num = -1;
7791 if ( parm_num == -1 )
7792 parm_num = map_parameter( "printing" );
7794 lp_set_enum_parm( &parm_table[parm_num], pszParmValue, (int*)ptr );
7799 s = ServicePtrs[snum];
7801 init_printer_values( s );
7807 /***************************************************************************
7808 Initialise a copymap.
7809 ***************************************************************************/
7811 static void init_copymap(struct service *pservice)
7815 TALLOC_FREE(pservice->copymap);
7817 pservice->copymap = bitmap_talloc(NULL, NUMPARAMETERS);
7818 if (!pservice->copymap)
7820 ("Couldn't allocate copymap!! (size %d)\n",
7821 (int)NUMPARAMETERS));
7823 for (i = 0; i < NUMPARAMETERS; i++)
7824 bitmap_set(pservice->copymap, i);
7827 /***************************************************************************
7828 Return the local pointer to a parameter given a service struct and the
7829 pointer into the default structure.
7830 ***************************************************************************/
7832 static void *lp_local_ptr(struct service *service, void *ptr)
7834 return (void *)(((char *)service) + PTR_DIFF(ptr, &sDefault));
7837 /***************************************************************************
7838 Return the local pointer to a parameter given the service number and the
7839 pointer into the default structure.
7840 ***************************************************************************/
7842 void *lp_local_ptr_by_snum(int snum, void *ptr)
7844 return lp_local_ptr(ServicePtrs[snum], ptr);
7847 /***************************************************************************
7848 Process a parameter for a particular service number. If snum < 0
7849 then assume we are in the globals.
7850 ***************************************************************************/
7852 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
7855 void *parm_ptr = NULL; /* where we are going to store the result */
7856 void *def_ptr = NULL;
7857 struct param_opt_struct **opt_list;
7859 parmnum = map_parameter(pszParmName);
7862 if (strchr(pszParmName, ':') == NULL) {
7863 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7869 * We've got a parametric option
7872 opt_list = (snum < 0)
7873 ? &Globals.param_opt : &ServicePtrs[snum]->param_opt;
7874 set_param_opt(opt_list, pszParmName, pszParmValue, 0);
7879 /* if it's already been set by the command line, then we don't
7881 if (parm_table[parmnum].flags & FLAG_CMDLINE) {
7885 if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
7886 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7890 def_ptr = parm_table[parmnum].ptr;
7892 /* we might point at a service, the default service or a global */
7896 if (parm_table[parmnum].p_class == P_GLOBAL) {
7898 ("Global parameter %s found in service section!\n",
7902 parm_ptr = lp_local_ptr_by_snum(snum, def_ptr);
7906 if (!ServicePtrs[snum]->copymap)
7907 init_copymap(ServicePtrs[snum]);
7909 /* this handles the aliases - set the copymap for other entries with
7910 the same data pointer */
7911 for (i = 0; parm_table[i].label; i++)
7912 if (parm_table[i].ptr == parm_table[parmnum].ptr)
7913 bitmap_clear(ServicePtrs[snum]->copymap, i);
7916 /* if it is a special case then go ahead */
7917 if (parm_table[parmnum].special) {
7918 return parm_table[parmnum].special(snum, pszParmValue,
7922 /* now switch on the type of variable it is */
7923 switch (parm_table[parmnum].type)
7926 *(bool *)parm_ptr = lp_bool(pszParmValue);
7930 *(bool *)parm_ptr = !lp_bool(pszParmValue);
7934 *(int *)parm_ptr = lp_int(pszParmValue);
7938 *(char *)parm_ptr = *pszParmValue;
7942 i = sscanf(pszParmValue, "%o", (int *)parm_ptr);
7944 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName ));
7949 TALLOC_FREE(*((char ***)parm_ptr));
7950 *(char ***)parm_ptr = str_list_make_v3(
7951 NULL, pszParmValue, NULL);
7955 string_set((char **)parm_ptr, pszParmValue);
7960 char *upper_string = strupper_talloc(talloc_tos(),
7962 string_set((char **)parm_ptr, upper_string);
7963 TALLOC_FREE(upper_string);
7967 lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
7976 /***************************************************************************
7977 set a parameter, marking it with FLAG_CMDLINE. Parameters marked as
7978 FLAG_CMDLINE won't be overridden by loads from smb.conf.
7979 ***************************************************************************/
7981 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values)
7984 parmnum = map_parameter(pszParmName);
7986 parm_table[parmnum].flags &= ~FLAG_CMDLINE;
7987 if (!lp_do_parameter(-1, pszParmName, pszParmValue)) {
7990 parm_table[parmnum].flags |= FLAG_CMDLINE;
7992 /* we have to also set FLAG_CMDLINE on aliases. Aliases must
7993 * be grouped in the table, so we don't have to search the
7995 for (i=parmnum-1;i>=0 && parm_table[i].ptr == parm_table[parmnum].ptr;i--) {
7996 parm_table[i].flags |= FLAG_CMDLINE;
7998 for (i=parmnum+1;i<NUMPARAMETERS && parm_table[i].ptr == parm_table[parmnum].ptr;i++) {
7999 parm_table[i].flags |= FLAG_CMDLINE;
8003 store_lp_set_cmdline(pszParmName, pszParmValue);
8008 /* it might be parametric */
8009 if (strchr(pszParmName, ':') != NULL) {
8010 set_param_opt(&Globals.param_opt, pszParmName, pszParmValue, FLAG_CMDLINE);
8012 store_lp_set_cmdline(pszParmName, pszParmValue);
8017 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName));
8021 bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
8023 return lp_set_cmdline_helper(pszParmName, pszParmValue, true);
8026 /***************************************************************************
8027 Process a parameter.
8028 ***************************************************************************/
8030 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
8033 if (!bInGlobalSection && bGlobalOnly)
8036 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
8038 return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
8039 pszParmName, pszParmValue));
8043 set a option from the commandline in 'a=b' format. Use to support --option
8045 bool lp_set_option(const char *option)
8050 s = talloc_strdup(NULL, option);
8063 /* skip white spaces after the = sign */
8066 } while (*p == ' ');
8068 ret = lp_set_cmdline(s, p);
8073 /**************************************************************************
8074 Print a parameter of the specified type.
8075 ***************************************************************************/
8077 static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
8083 for (i = 0; p->enum_list[i].name; i++) {
8084 if (*(int *)ptr == p->enum_list[i].value) {
8086 p->enum_list[i].name);
8093 fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
8097 fprintf(f, "%s", BOOLSTR(!*(bool *)ptr));
8101 fprintf(f, "%d", *(int *)ptr);
8105 fprintf(f, "%c", *(char *)ptr);
8109 char *o = octal_string(*(int *)ptr);
8110 fprintf(f, "%s", o);
8116 if ((char ***)ptr && *(char ***)ptr) {
8117 char **list = *(char ***)ptr;
8118 for (; *list; list++) {
8119 /* surround strings with whitespace in double quotes */
8120 if ( strchr_m( *list, ' ' ) )
8121 fprintf(f, "\"%s\"%s", *list, ((*(list+1))?", ":""));
8123 fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
8130 if (*(char **)ptr) {
8131 fprintf(f, "%s", *(char **)ptr);
8139 /***************************************************************************
8140 Check if two parameters are equal.
8141 ***************************************************************************/
8143 static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
8148 return (*((bool *)ptr1) == *((bool *)ptr2));
8153 return (*((int *)ptr1) == *((int *)ptr2));
8156 return (*((char *)ptr1) == *((char *)ptr2));
8159 return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2);
8164 char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
8169 return (p1 == p2 || strequal(p1, p2));
8177 /***************************************************************************
8178 Initialize any local varients in the sDefault table.
8179 ***************************************************************************/
8181 void init_locals(void)
8186 /***************************************************************************
8187 Process a new section (service). At this stage all sections are services.
8188 Later we'll have special sections that permit server parameters to be set.
8189 Returns True on success, False on failure.
8190 ***************************************************************************/
8192 static bool do_section(const char *pszSectionName, void *userdata)
8195 bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
8196 (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
8199 /* if we were in a global section then do the local inits */
8200 if (bInGlobalSection && !isglobal)
8203 /* if we've just struck a global section, note the fact. */
8204 bInGlobalSection = isglobal;
8206 /* check for multiple global sections */
8207 if (bInGlobalSection) {
8208 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
8212 if (!bInGlobalSection && bGlobalOnly)
8215 /* if we have a current service, tidy it up before moving on */
8218 if (iServiceIndex >= 0)
8219 bRetval = service_ok(iServiceIndex);
8221 /* if all is still well, move to the next record in the services array */
8223 /* We put this here to avoid an odd message order if messages are */
8224 /* issued by the post-processing of a previous section. */
8225 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName));
8227 if ((iServiceIndex = add_a_service(&sDefault, pszSectionName))
8229 DEBUG(0, ("Failed to add a new service\n"));
8232 /* Clean all parametric options for service */
8233 /* They will be added during parsing again */
8234 free_param_opts(&ServicePtrs[iServiceIndex]->param_opt);
8241 /***************************************************************************
8242 Determine if a partcular base parameter is currentl set to the default value.
8243 ***************************************************************************/
8245 static bool is_default(int i)
8247 if (!defaults_saved)
8249 switch (parm_table[i].type) {
8251 return str_list_equal((const char **)parm_table[i].def.lvalue,
8252 *(const char ***)parm_table[i].ptr);
8255 return strequal(parm_table[i].def.svalue,
8256 *(char **)parm_table[i].ptr);
8259 return parm_table[i].def.bvalue ==
8260 *(bool *)parm_table[i].ptr;
8262 return parm_table[i].def.cvalue ==
8263 *(char *)parm_table[i].ptr;
8267 return parm_table[i].def.ivalue ==
8268 *(int *)parm_table[i].ptr;
8275 /***************************************************************************
8276 Display the contents of the global structure.
8277 ***************************************************************************/
8279 static void dump_globals(FILE *f)
8282 struct param_opt_struct *data;
8284 fprintf(f, "[global]\n");
8286 for (i = 0; parm_table[i].label; i++)
8287 if (parm_table[i].p_class == P_GLOBAL &&
8288 !(parm_table[i].flags & FLAG_META) &&
8289 parm_table[i].ptr &&
8290 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
8291 if (defaults_saved && is_default(i))
8293 fprintf(f, "\t%s = ", parm_table[i].label);
8294 print_parameter(&parm_table[i], parm_table[i].ptr, f);
8297 if (Globals.param_opt != NULL) {
8298 data = Globals.param_opt;
8300 fprintf(f, "\t%s = %s\n", data->key, data->value);
8307 /***************************************************************************
8308 Return True if a local parameter is currently set to the global default.
8309 ***************************************************************************/
8311 bool lp_is_default(int snum, struct parm_struct *parm)
8313 int pdiff = PTR_DIFF(parm->ptr, &sDefault);
8315 return equal_parameter(parm->type,
8316 ((char *)ServicePtrs[snum]) + pdiff,
8317 ((char *)&sDefault) + pdiff);
8320 /***************************************************************************
8321 Display the contents of a single services record.
8322 ***************************************************************************/
8324 static void dump_a_service(struct service *pService, FILE * f)
8327 struct param_opt_struct *data;
8329 if (pService != &sDefault)
8330 fprintf(f, "[%s]\n", pService->szService);
8332 for (i = 0; parm_table[i].label; i++) {
8334 if (parm_table[i].p_class == P_LOCAL &&
8335 !(parm_table[i].flags & FLAG_META) &&
8336 parm_table[i].ptr &&
8337 (*parm_table[i].label != '-') &&
8338 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8340 int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault);
8342 if (pService == &sDefault) {
8343 if (defaults_saved && is_default(i))
8346 if (equal_parameter(parm_table[i].type,
8347 ((char *)pService) +
8349 ((char *)&sDefault) +
8354 fprintf(f, "\t%s = ", parm_table[i].label);
8355 print_parameter(&parm_table[i],
8356 ((char *)pService) + pdiff, f);
8361 if (pService->param_opt != NULL) {
8362 data = pService->param_opt;
8364 fprintf(f, "\t%s = %s\n", data->key, data->value);
8370 /***************************************************************************
8371 Display the contents of a parameter of a single services record.
8372 ***************************************************************************/
8374 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
8377 bool result = False;
8380 fstring local_parm_name;
8382 const char *parm_opt_value;
8384 /* check for parametrical option */
8385 fstrcpy( local_parm_name, parm_name);
8386 parm_opt = strchr( local_parm_name, ':');
8391 if (strlen(parm_opt)) {
8392 parm_opt_value = lp_parm_const_string( snum,
8393 local_parm_name, parm_opt, NULL);
8394 if (parm_opt_value) {
8395 printf( "%s\n", parm_opt_value);
8402 /* check for a key and print the value */
8409 for (i = 0; parm_table[i].label; i++) {
8410 if (strwicmp(parm_table[i].label, parm_name) == 0 &&
8411 !(parm_table[i].flags & FLAG_META) &&
8412 (parm_table[i].p_class == p_class || parm_table[i].flags & flag) &&
8413 parm_table[i].ptr &&
8414 (*parm_table[i].label != '-') &&
8415 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8420 ptr = parm_table[i].ptr;
8422 struct service *pService = ServicePtrs[snum];
8423 ptr = ((char *)pService) +
8424 PTR_DIFF(parm_table[i].ptr, &sDefault);
8427 print_parameter(&parm_table[i],
8438 /***************************************************************************
8439 Return info about the requested parameter (given as a string).
8440 Return NULL when the string is not a valid parameter name.
8441 ***************************************************************************/
8443 struct parm_struct *lp_get_parameter(const char *param_name)
8445 int num = map_parameter(param_name);
8451 return &parm_table[num];
8454 /***************************************************************************
8455 Return info about the next parameter in a service.
8456 snum==GLOBAL_SECTION_SNUM gives the globals.
8457 Return NULL when out of parameters.
8458 ***************************************************************************/
8460 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
8463 /* do the globals */
8464 for (; parm_table[*i].label; (*i)++) {
8465 if (parm_table[*i].p_class == P_SEPARATOR)
8466 return &parm_table[(*i)++];
8468 if (!parm_table[*i].ptr
8469 || (*parm_table[*i].label == '-'))
8473 && (parm_table[*i].ptr ==
8474 parm_table[(*i) - 1].ptr))
8477 if (is_default(*i) && !allparameters)
8480 return &parm_table[(*i)++];
8483 struct service *pService = ServicePtrs[snum];
8485 for (; parm_table[*i].label; (*i)++) {
8486 if (parm_table[*i].p_class == P_SEPARATOR)
8487 return &parm_table[(*i)++];
8489 if (parm_table[*i].p_class == P_LOCAL &&
8490 parm_table[*i].ptr &&
8491 (*parm_table[*i].label != '-') &&
8493 (parm_table[*i].ptr !=
8494 parm_table[(*i) - 1].ptr)))
8497 PTR_DIFF(parm_table[*i].ptr,
8500 if (allparameters ||
8501 !equal_parameter(parm_table[*i].type,
8502 ((char *)pService) +
8504 ((char *)&sDefault) +
8507 return &parm_table[(*i)++];
8518 /***************************************************************************
8519 Display the contents of a single copy structure.
8520 ***************************************************************************/
8521 static void dump_copy_map(bool *pcopymap)
8527 printf("\n\tNon-Copied parameters:\n");
8529 for (i = 0; parm_table[i].label; i++)
8530 if (parm_table[i].p_class == P_LOCAL &&
8531 parm_table[i].ptr && !pcopymap[i] &&
8532 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8534 printf("\t\t%s\n", parm_table[i].label);
8539 /***************************************************************************
8540 Return TRUE if the passed service number is within range.
8541 ***************************************************************************/
8543 bool lp_snum_ok(int iService)
8545 return (LP_SNUM_OK(iService) && ServicePtrs[iService]->bAvailable);
8548 /***************************************************************************
8549 Auto-load some home services.
8550 ***************************************************************************/
8552 static void lp_add_auto_services(char *str)
8562 s = SMB_STRDUP(str);
8566 homes = lp_servicenumber(HOMES_NAME);
8568 for (p = strtok_r(s, LIST_SEP, &saveptr); p;
8569 p = strtok_r(NULL, LIST_SEP, &saveptr)) {
8572 if (lp_servicenumber(p) >= 0)
8575 home = get_user_home_dir(talloc_tos(), p);
8577 if (home && home[0] && homes >= 0)
8578 lp_add_home(p, homes, p, home);
8585 /***************************************************************************
8586 Auto-load one printer.
8587 ***************************************************************************/
8589 void lp_add_one_printer(const char *name, const char *comment,
8590 const char *location, void *pdata)
8592 int printers = lp_servicenumber(PRINTERS_NAME);
8595 if (lp_servicenumber(name) < 0) {
8596 lp_add_printer(name, printers);
8597 if ((i = lp_servicenumber(name)) >= 0) {
8598 string_set(&ServicePtrs[i]->comment, comment);
8599 ServicePtrs[i]->autoloaded = True;
8604 /***************************************************************************
8605 Have we loaded a services file yet?
8606 ***************************************************************************/
8608 bool lp_loaded(void)
8613 /***************************************************************************
8614 Unload unused services.
8615 ***************************************************************************/
8617 void lp_killunused(struct smbd_server_connection *sconn,
8618 bool (*snumused) (struct smbd_server_connection *, int))
8621 for (i = 0; i < iNumServices; i++) {
8625 /* don't kill autoloaded or usershare services */
8626 if ( ServicePtrs[i]->autoloaded ||
8627 ServicePtrs[i]->usershare == USERSHARE_VALID) {
8631 if (!snumused || !snumused(sconn, i)) {
8632 free_service_byindex(i);
8638 * Kill all except autoloaded and usershare services - convenience wrapper
8640 void lp_kill_all_services(void)
8642 lp_killunused(NULL, NULL);
8645 /***************************************************************************
8647 ***************************************************************************/
8649 void lp_killservice(int iServiceIn)
8651 if (VALID(iServiceIn)) {
8652 free_service_byindex(iServiceIn);
8656 /***************************************************************************
8657 Save the curent values of all global and sDefault parameters into the
8658 defaults union. This allows swat and testparm to show only the
8659 changed (ie. non-default) parameters.
8660 ***************************************************************************/
8662 static void lp_save_defaults(void)
8665 for (i = 0; parm_table[i].label; i++) {
8666 if (i > 0 && parm_table[i].ptr == parm_table[i - 1].ptr)
8668 switch (parm_table[i].type) {
8670 parm_table[i].def.lvalue = str_list_copy(
8671 NULL, *(const char ***)parm_table[i].ptr);
8675 if (parm_table[i].ptr) {
8676 parm_table[i].def.svalue = SMB_STRDUP(*(char **)parm_table[i].ptr);
8678 parm_table[i].def.svalue = NULL;
8683 parm_table[i].def.bvalue =
8684 *(bool *)parm_table[i].ptr;
8687 parm_table[i].def.cvalue =
8688 *(char *)parm_table[i].ptr;
8693 parm_table[i].def.ivalue =
8694 *(int *)parm_table[i].ptr;
8700 defaults_saved = True;
8703 /***********************************************************
8704 If we should send plaintext/LANMAN passwords in the clinet
8705 ************************************************************/
8707 static void set_allowed_client_auth(void)
8709 if (Globals.bClientNTLMv2Auth) {
8710 Globals.bClientLanManAuth = False;
8712 if (!Globals.bClientLanManAuth) {
8713 Globals.bClientPlaintextAuth = False;
8717 /***************************************************************************
8719 The following code allows smbd to read a user defined share file.
8720 Yes, this is my intent. Yes, I'm comfortable with that...
8722 THE FOLLOWING IS SECURITY CRITICAL CODE.
8724 It washes your clothes, it cleans your house, it guards you while you sleep...
8725 Do not f%^k with it....
8726 ***************************************************************************/
8728 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8730 /***************************************************************************
8731 Check allowed stat state of a usershare file.
8732 Ensure we print out who is dicking with us so the admin can
8733 get their sorry ass fired.
8734 ***************************************************************************/
8736 static bool check_usershare_stat(const char *fname,
8737 const SMB_STRUCT_STAT *psbuf)
8739 if (!S_ISREG(psbuf->st_ex_mode)) {
8740 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8741 "not a regular file\n",
8742 fname, (unsigned int)psbuf->st_ex_uid ));
8746 /* Ensure this doesn't have the other write bit set. */
8747 if (psbuf->st_ex_mode & S_IWOTH) {
8748 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8749 "public write. Refusing to allow as a usershare file.\n",
8750 fname, (unsigned int)psbuf->st_ex_uid ));
8754 /* Should be 10k or less. */
8755 if (psbuf->st_ex_size > MAX_USERSHARE_FILE_SIZE) {
8756 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8757 "too large (%u) to be a user share file.\n",
8758 fname, (unsigned int)psbuf->st_ex_uid,
8759 (unsigned int)psbuf->st_ex_size ));
8766 /***************************************************************************
8767 Parse the contents of a usershare file.
8768 ***************************************************************************/
8770 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
8771 SMB_STRUCT_STAT *psbuf,
8772 const char *servicename,
8776 char **pp_sharepath,
8778 char **pp_cp_servicename,
8779 struct security_descriptor **ppsd,
8782 const char **prefixallowlist = lp_usershare_prefix_allow_list();
8783 const char **prefixdenylist = lp_usershare_prefix_deny_list();
8786 SMB_STRUCT_STAT sbuf;
8787 char *sharepath = NULL;
8788 char *comment = NULL;
8790 *pp_sharepath = NULL;
8793 *pallow_guest = False;
8796 return USERSHARE_MALFORMED_FILE;
8799 if (strcmp(lines[0], "#VERSION 1") == 0) {
8801 } else if (strcmp(lines[0], "#VERSION 2") == 0) {
8804 return USERSHARE_MALFORMED_FILE;
8807 return USERSHARE_BAD_VERSION;
8810 if (strncmp(lines[1], "path=", 5) != 0) {
8811 return USERSHARE_MALFORMED_PATH;
8814 sharepath = talloc_strdup(ctx, &lines[1][5]);
8816 return USERSHARE_POSIX_ERR;
8818 trim_string(sharepath, " ", " ");
8820 if (strncmp(lines[2], "comment=", 8) != 0) {
8821 return USERSHARE_MALFORMED_COMMENT_DEF;
8824 comment = talloc_strdup(ctx, &lines[2][8]);
8826 return USERSHARE_POSIX_ERR;
8828 trim_string(comment, " ", " ");
8829 trim_char(comment, '"', '"');
8831 if (strncmp(lines[3], "usershare_acl=", 14) != 0) {
8832 return USERSHARE_MALFORMED_ACL_DEF;
8835 if (!parse_usershare_acl(ctx, &lines[3][14], ppsd)) {
8836 return USERSHARE_ACL_ERR;
8840 if (strncmp(lines[4], "guest_ok=", 9) != 0) {
8841 return USERSHARE_MALFORMED_ACL_DEF;
8843 if (lines[4][9] == 'y') {
8844 *pallow_guest = True;
8847 /* Backwards compatible extension to file version #2. */
8849 if (strncmp(lines[5], "sharename=", 10) != 0) {
8850 return USERSHARE_MALFORMED_SHARENAME_DEF;
8852 if (!strequal(&lines[5][10], servicename)) {
8853 return USERSHARE_BAD_SHARENAME;
8855 *pp_cp_servicename = talloc_strdup(ctx, &lines[5][10]);
8856 if (!*pp_cp_servicename) {
8857 return USERSHARE_POSIX_ERR;
8862 if (*pp_cp_servicename == NULL) {
8863 *pp_cp_servicename = talloc_strdup(ctx, servicename);
8864 if (!*pp_cp_servicename) {
8865 return USERSHARE_POSIX_ERR;
8869 if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->szPath) == 0)) {
8870 /* Path didn't change, no checks needed. */
8871 *pp_sharepath = sharepath;
8872 *pp_comment = comment;
8873 return USERSHARE_OK;
8876 /* The path *must* be absolute. */
8877 if (sharepath[0] != '/') {
8878 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8879 servicename, sharepath));
8880 return USERSHARE_PATH_NOT_ABSOLUTE;
8883 /* If there is a usershare prefix deny list ensure one of these paths
8884 doesn't match the start of the user given path. */
8885 if (prefixdenylist) {
8887 for ( i=0; prefixdenylist[i]; i++ ) {
8888 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8889 servicename, i, prefixdenylist[i], sharepath ));
8890 if (memcmp( sharepath, prefixdenylist[i], strlen(prefixdenylist[i])) == 0) {
8891 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8892 "usershare prefix deny list entries.\n",
8893 servicename, sharepath));
8894 return USERSHARE_PATH_IS_DENIED;
8899 /* If there is a usershare prefix allow list ensure one of these paths
8900 does match the start of the user given path. */
8902 if (prefixallowlist) {
8904 for ( i=0; prefixallowlist[i]; i++ ) {
8905 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8906 servicename, i, prefixallowlist[i], sharepath ));
8907 if (memcmp( sharepath, prefixallowlist[i], strlen(prefixallowlist[i])) == 0) {
8911 if (prefixallowlist[i] == NULL) {
8912 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8913 "usershare prefix allow list entries.\n",
8914 servicename, sharepath));
8915 return USERSHARE_PATH_NOT_ALLOWED;
8919 /* Ensure this is pointing to a directory. */
8920 dp = sys_opendir(sharepath);
8923 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8924 servicename, sharepath));
8925 return USERSHARE_PATH_NOT_DIRECTORY;
8928 /* Ensure the owner of the usershare file has permission to share
8931 if (sys_stat(sharepath, &sbuf, false) == -1) {
8932 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8933 servicename, sharepath, strerror(errno) ));
8935 return USERSHARE_POSIX_ERR;
8940 if (!S_ISDIR(sbuf.st_ex_mode)) {
8941 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8942 servicename, sharepath ));
8943 return USERSHARE_PATH_NOT_DIRECTORY;
8946 /* Check if sharing is restricted to owner-only. */
8947 /* psbuf is the stat of the usershare definition file,
8948 sbuf is the stat of the target directory to be shared. */
8950 if (lp_usershare_owner_only()) {
8951 /* root can share anything. */
8952 if ((psbuf->st_ex_uid != 0) && (sbuf.st_ex_uid != psbuf->st_ex_uid)) {
8953 return USERSHARE_PATH_NOT_ALLOWED;
8957 *pp_sharepath = sharepath;
8958 *pp_comment = comment;
8959 return USERSHARE_OK;
8962 /***************************************************************************
8963 Deal with a usershare file.
8966 -1 - Bad name, invalid contents.
8967 - service name already existed and not a usershare, problem
8968 with permissions to share directory etc.
8969 ***************************************************************************/
8971 static int process_usershare_file(const char *dir_name, const char *file_name, int snum_template)
8973 SMB_STRUCT_STAT sbuf;
8974 SMB_STRUCT_STAT lsbuf;
8976 char *sharepath = NULL;
8977 char *comment = NULL;
8978 char *cp_service_name = NULL;
8979 char **lines = NULL;
8983 TALLOC_CTX *ctx = talloc_stackframe();
8984 struct security_descriptor *psd = NULL;
8985 bool guest_ok = False;
8986 char *canon_name = NULL;
8987 bool added_service = false;
8990 /* Ensure share name doesn't contain invalid characters. */
8991 if (!validate_net_name(file_name, INVALID_SHARENAME_CHARS, strlen(file_name))) {
8992 DEBUG(0,("process_usershare_file: share name %s contains "
8993 "invalid characters (any of %s)\n",
8994 file_name, INVALID_SHARENAME_CHARS ));
8998 canon_name = canonicalize_servicename(ctx, file_name);
9003 fname = talloc_asprintf(ctx, "%s/%s", dir_name, file_name);
9008 /* Minimize the race condition by doing an lstat before we
9009 open and fstat. Ensure this isn't a symlink link. */
9011 if (sys_lstat(fname, &lsbuf, false) != 0) {
9012 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
9013 fname, strerror(errno) ));
9017 /* This must be a regular file, not a symlink, directory or
9018 other strange filetype. */
9019 if (!check_usershare_stat(fname, &lsbuf)) {
9024 TDB_DATA data = dbwrap_fetch_bystring(
9025 ServiceHash, canon_name, canon_name);
9029 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
9030 iService = *(int *)data.dptr;
9034 if (iService != -1 &&
9035 timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
9036 &lsbuf.st_ex_mtime) == 0) {
9037 /* Nothing changed - Mark valid and return. */
9038 DEBUG(10,("process_usershare_file: service %s not changed.\n",
9040 ServicePtrs[iService]->usershare = USERSHARE_VALID;
9045 /* Try and open the file read only - no symlinks allowed. */
9047 fd = sys_open(fname, O_RDONLY|O_NOFOLLOW, 0);
9049 fd = sys_open(fname, O_RDONLY, 0);
9053 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
9054 fname, strerror(errno) ));
9058 /* Now fstat to be *SURE* it's a regular file. */
9059 if (sys_fstat(fd, &sbuf, false) != 0) {
9061 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
9062 fname, strerror(errno) ));
9066 /* Is it the same dev/inode as was lstated ? */
9067 if (lsbuf.st_ex_dev != sbuf.st_ex_dev || lsbuf.st_ex_ino != sbuf.st_ex_ino) {
9069 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
9070 "Symlink spoofing going on ?\n", fname ));
9074 /* This must be a regular file, not a symlink, directory or
9075 other strange filetype. */
9076 if (!check_usershare_stat(fname, &sbuf)) {
9080 lines = fd_lines_load(fd, &numlines, MAX_USERSHARE_FILE_SIZE, NULL);
9083 if (lines == NULL) {
9084 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
9085 fname, (unsigned int)sbuf.st_ex_uid ));
9089 if (parse_usershare_file(ctx, &sbuf, file_name,
9090 iService, lines, numlines, &sharepath,
9091 &comment, &cp_service_name,
9092 &psd, &guest_ok) != USERSHARE_OK) {
9096 /* Everything ok - add the service possibly using a template. */
9098 const struct service *sp = &sDefault;
9099 if (snum_template != -1) {
9100 sp = ServicePtrs[snum_template];
9103 if ((iService = add_a_service(sp, cp_service_name)) < 0) {
9104 DEBUG(0, ("process_usershare_file: Failed to add "
9105 "new service %s\n", cp_service_name));
9109 added_service = true;
9111 /* Read only is controlled by usershare ACL below. */
9112 ServicePtrs[iService]->bRead_only = False;
9115 /* Write the ACL of the new/modified share. */
9116 if (!set_share_security(canon_name, psd)) {
9117 DEBUG(0, ("process_usershare_file: Failed to set share "
9118 "security for user share %s\n",
9123 /* If from a template it may be marked invalid. */
9124 ServicePtrs[iService]->valid = True;
9126 /* Set the service as a valid usershare. */
9127 ServicePtrs[iService]->usershare = USERSHARE_VALID;
9129 /* Set guest access. */
9130 if (lp_usershare_allow_guests()) {
9131 ServicePtrs[iService]->bGuest_ok = guest_ok;
9134 /* And note when it was loaded. */
9135 ServicePtrs[iService]->usershare_last_mod = sbuf.st_ex_mtime;
9136 string_set(&ServicePtrs[iService]->szPath, sharepath);
9137 string_set(&ServicePtrs[iService]->comment, comment);
9143 if (ret == -1 && iService != -1 && added_service) {
9144 lp_remove_service(iService);
9152 /***************************************************************************
9153 Checks if a usershare entry has been modified since last load.
9154 ***************************************************************************/
9156 static bool usershare_exists(int iService, struct timespec *last_mod)
9158 SMB_STRUCT_STAT lsbuf;
9159 const char *usersharepath = Globals.szUsersharePath;
9162 if (asprintf(&fname, "%s/%s",
9164 ServicePtrs[iService]->szService) < 0) {
9168 if (sys_lstat(fname, &lsbuf, false) != 0) {
9173 if (!S_ISREG(lsbuf.st_ex_mode)) {
9179 *last_mod = lsbuf.st_ex_mtime;
9183 /***************************************************************************
9184 Load a usershare service by name. Returns a valid servicenumber or -1.
9185 ***************************************************************************/
9187 int load_usershare_service(const char *servicename)
9189 SMB_STRUCT_STAT sbuf;
9190 const char *usersharepath = Globals.szUsersharePath;
9191 int max_user_shares = Globals.iUsershareMaxShares;
9192 int snum_template = -1;
9194 if (*usersharepath == 0 || max_user_shares == 0) {
9198 if (sys_stat(usersharepath, &sbuf, false) != 0) {
9199 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
9200 usersharepath, strerror(errno) ));
9204 if (!S_ISDIR(sbuf.st_ex_mode)) {
9205 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
9211 * This directory must be owned by root, and have the 't' bit set.
9212 * It also must not be writable by "other".
9216 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
9218 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
9220 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
9221 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9226 /* Ensure the template share exists if it's set. */
9227 if (Globals.szUsershareTemplateShare[0]) {
9228 /* We can't use lp_servicenumber here as we are recommending that
9229 template shares have -valid=False set. */
9230 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
9231 if (ServicePtrs[snum_template]->szService &&
9232 strequal(ServicePtrs[snum_template]->szService,
9233 Globals.szUsershareTemplateShare)) {
9238 if (snum_template == -1) {
9239 DEBUG(0,("load_usershare_service: usershare template share %s "
9240 "does not exist.\n",
9241 Globals.szUsershareTemplateShare ));
9246 return process_usershare_file(usersharepath, servicename, snum_template);
9249 /***************************************************************************
9250 Load all user defined shares from the user share directory.
9251 We only do this if we're enumerating the share list.
9252 This is the function that can delete usershares that have
9254 ***************************************************************************/
9256 int load_usershare_shares(struct smbd_server_connection *sconn)
9259 SMB_STRUCT_STAT sbuf;
9260 SMB_STRUCT_DIRENT *de;
9261 int num_usershares = 0;
9262 int max_user_shares = Globals.iUsershareMaxShares;
9263 unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries;
9264 unsigned int allowed_bad_entries = ((2*max_user_shares)/10);
9265 unsigned int allowed_tmp_entries = ((2*max_user_shares)/10);
9267 int snum_template = -1;
9268 const char *usersharepath = Globals.szUsersharePath;
9269 int ret = lp_numservices();
9271 if (max_user_shares == 0 || *usersharepath == '\0') {
9272 return lp_numservices();
9275 if (sys_stat(usersharepath, &sbuf, false) != 0) {
9276 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
9277 usersharepath, strerror(errno) ));
9282 * This directory must be owned by root, and have the 't' bit set.
9283 * It also must not be writable by "other".
9287 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
9289 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
9291 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
9292 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9297 /* Ensure the template share exists if it's set. */
9298 if (Globals.szUsershareTemplateShare[0]) {
9299 /* We can't use lp_servicenumber here as we are recommending that
9300 template shares have -valid=False set. */
9301 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
9302 if (ServicePtrs[snum_template]->szService &&
9303 strequal(ServicePtrs[snum_template]->szService,
9304 Globals.szUsershareTemplateShare)) {
9309 if (snum_template == -1) {
9310 DEBUG(0,("load_usershare_shares: usershare template share %s "
9311 "does not exist.\n",
9312 Globals.szUsershareTemplateShare ));
9317 /* Mark all existing usershares as pending delete. */
9318 for (iService = iNumServices - 1; iService >= 0; iService--) {
9319 if (VALID(iService) && ServicePtrs[iService]->usershare) {
9320 ServicePtrs[iService]->usershare = USERSHARE_PENDING_DELETE;
9324 dp = sys_opendir(usersharepath);
9326 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
9327 usersharepath, strerror(errno) ));
9331 for (num_dir_entries = 0, num_bad_dir_entries = 0, num_tmp_dir_entries = 0;
9332 (de = sys_readdir(dp));
9333 num_dir_entries++ ) {
9335 const char *n = de->d_name;
9337 /* Ignore . and .. */
9339 if ((n[1] == '\0') || (n[1] == '.' && n[2] == '\0')) {
9345 /* Temporary file used when creating a share. */
9346 num_tmp_dir_entries++;
9349 /* Allow 20% tmp entries. */
9350 if (num_tmp_dir_entries > allowed_tmp_entries) {
9351 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
9352 "in directory %s\n",
9353 num_tmp_dir_entries, usersharepath));
9357 r = process_usershare_file(usersharepath, n, snum_template);
9359 /* Update the services count. */
9361 if (num_usershares >= max_user_shares) {
9362 DEBUG(0,("load_usershare_shares: max user shares reached "
9363 "on file %s in directory %s\n",
9364 n, usersharepath ));
9367 } else if (r == -1) {
9368 num_bad_dir_entries++;
9371 /* Allow 20% bad entries. */
9372 if (num_bad_dir_entries > allowed_bad_entries) {
9373 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
9374 "in directory %s\n",
9375 num_bad_dir_entries, usersharepath));
9379 /* Allow 20% bad entries. */
9380 if (num_dir_entries > max_user_shares + allowed_bad_entries) {
9381 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
9382 "in directory %s\n",
9383 num_dir_entries, usersharepath));
9390 /* Sweep through and delete any non-refreshed usershares that are
9391 not currently in use. */
9392 for (iService = iNumServices - 1; iService >= 0; iService--) {
9393 if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
9394 if (conn_snum_used(sconn, iService)) {
9397 /* Remove from the share ACL db. */
9398 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
9399 lp_servicename(iService) ));
9400 delete_share_security(lp_servicename(iService));
9401 free_service_byindex(iService);
9405 return lp_numservices();
9408 /********************************************************
9409 Destroy global resources allocated in this file
9410 ********************************************************/
9412 void gfree_loadparm(void)
9418 /* Free resources allocated to services */
9420 for ( i = 0; i < iNumServices; i++ ) {
9422 free_service_byindex(i);
9426 SAFE_FREE( ServicePtrs );
9429 /* Now release all resources allocated to global
9430 parameters and the default service */
9432 free_global_parameters();
9436 /***************************************************************************
9437 Allow client apps to specify that they are a client
9438 ***************************************************************************/
9439 void lp_set_in_client(bool b)
9445 /***************************************************************************
9446 Determine if we're running in a client app
9447 ***************************************************************************/
9448 bool lp_is_in_client(void)
9453 /***************************************************************************
9454 Load the services array from the services file. Return True on success,
9456 ***************************************************************************/
9458 static bool lp_load_ex(const char *pszFname,
9462 bool initialize_globals,
9463 bool allow_include_registry,
9464 bool allow_registry_shares)
9471 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9473 bInGlobalSection = True;
9474 bGlobalOnly = global_only;
9475 bAllowIncludeRegistry = allow_include_registry;
9477 init_globals(initialize_globals);
9481 if (save_defaults) {
9486 free_param_opts(&Globals.param_opt);
9488 lp_do_parameter(-1, "idmap config * : backend", Globals.szIdmapBackend);
9490 /* We get sections first, so have to start 'behind' to make up */
9493 if (lp_config_backend_is_file()) {
9494 n2 = talloc_sub_basic(talloc_tos(), get_current_username(),
9495 current_user_info.domain,
9498 smb_panic("lp_load_ex: out of memory");
9501 add_to_file_list(pszFname, n2);
9503 bRetval = pm_process(n2, do_section, do_parameter, NULL);
9506 /* finish up the last section */
9507 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
9509 if (iServiceIndex >= 0) {
9510 bRetval = service_ok(iServiceIndex);
9514 if (lp_config_backend_is_registry()) {
9515 /* config backend changed to registry in config file */
9517 * We need to use this extra global variable here to
9518 * survive restart: init_globals uses this as a default
9519 * for ConfigBackend. Otherwise, init_globals would
9520 * send us into an endless loop here.
9522 config_backend = CONFIG_BACKEND_REGISTRY;
9524 DEBUG(1, ("lp_load_ex: changing to config backend "
9527 lp_kill_all_services();
9528 return lp_load_ex(pszFname, global_only, save_defaults,
9529 add_ipc, initialize_globals,
9530 allow_include_registry,
9531 allow_registry_shares);
9533 } else if (lp_config_backend_is_registry()) {
9534 bRetval = process_registry_globals();
9536 DEBUG(0, ("Illegal config backend given: %d\n",
9537 lp_config_backend()));
9541 if (bRetval && lp_registry_shares() && allow_registry_shares) {
9542 bRetval = process_registry_shares();
9545 lp_add_auto_services(lp_auto_services());
9548 /* When 'restrict anonymous = 2' guest connections to ipc$
9550 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9551 if ( lp_enable_asu_support() ) {
9552 lp_add_ipc("ADMIN$", false);
9557 set_default_server_announce_type();
9558 set_allowed_client_auth();
9560 if (lp_security() == SEC_SHARE) {
9561 DEBUG(1, ("WARNING: The security=share option is deprecated\n"));
9562 } else if (lp_security() == SEC_SERVER) {
9563 DEBUG(1, ("WARNING: The security=server option is deprecated\n"));
9566 if (lp_security() == SEC_ADS && strchr(lp_passwordserver(), ':')) {
9567 DEBUG(1, ("WARNING: The optional ':port' in password server = %s is deprecated\n",
9568 lp_passwordserver()));
9573 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9574 /* if bWINSsupport is true and we are in the client */
9575 if (lp_is_in_client() && Globals.bWINSsupport) {
9576 lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
9581 fault_configure(smb_panic_s3);
9583 bAllowIncludeRegistry = true;
9588 bool lp_load(const char *pszFname,
9592 bool initialize_globals)
9594 return lp_load_ex(pszFname,
9599 true, /* allow_include_registry */
9600 false); /* allow_registry_shares*/
9603 bool lp_load_initial_only(const char *pszFname)
9605 return lp_load_ex(pszFname,
9606 true, /* global only */
9607 false, /* save_defaults */
9608 false, /* add_ipc */
9609 true, /* initialize_globals */
9610 false, /* allow_include_registry */
9611 false); /* allow_registry_shares*/
9614 bool lp_load_with_registry_shares(const char *pszFname,
9618 bool initialize_globals)
9620 return lp_load_ex(pszFname,
9625 true, /* allow_include_registry */
9626 true); /* allow_registry_shares*/
9629 /***************************************************************************
9630 Return the max number of services.
9631 ***************************************************************************/
9633 int lp_numservices(void)
9635 return (iNumServices);
9638 /***************************************************************************
9639 Display the contents of the services array in human-readable form.
9640 ***************************************************************************/
9642 void lp_dump(FILE *f, bool show_defaults, int maxtoprint)
9647 defaults_saved = False;
9651 dump_a_service(&sDefault, f);
9653 for (iService = 0; iService < maxtoprint; iService++) {
9655 lp_dump_one(f, show_defaults, iService);
9659 /***************************************************************************
9660 Display the contents of one service in human-readable form.
9661 ***************************************************************************/
9663 void lp_dump_one(FILE * f, bool show_defaults, int snum)
9666 if (ServicePtrs[snum]->szService[0] == '\0')
9668 dump_a_service(ServicePtrs[snum], f);
9672 /***************************************************************************
9673 Return the number of the service with the given name, or -1 if it doesn't
9674 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9675 getservicebyname()! This works ONLY if all services have been loaded, and
9676 does not copy the found service.
9677 ***************************************************************************/
9679 int lp_servicenumber(const char *pszServiceName)
9682 fstring serviceName;
9684 if (!pszServiceName) {
9685 return GLOBAL_SECTION_SNUM;
9688 for (iService = iNumServices - 1; iService >= 0; iService--) {
9689 if (VALID(iService) && ServicePtrs[iService]->szService) {
9691 * The substitution here is used to support %U is
9694 fstrcpy(serviceName, ServicePtrs[iService]->szService);
9695 standard_sub_basic(get_current_username(),
9696 current_user_info.domain,
9697 serviceName,sizeof(serviceName));
9698 if (strequal(serviceName, pszServiceName)) {
9704 if (iService >= 0 && ServicePtrs[iService]->usershare == USERSHARE_VALID) {
9705 struct timespec last_mod;
9707 if (!usershare_exists(iService, &last_mod)) {
9708 /* Remove the share security tdb entry for it. */
9709 delete_share_security(lp_servicename(iService));
9710 /* Remove it from the array. */
9711 free_service_byindex(iService);
9712 /* Doesn't exist anymore. */
9713 return GLOBAL_SECTION_SNUM;
9716 /* Has it been modified ? If so delete and reload. */
9717 if (timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
9719 /* Remove it from the array. */
9720 free_service_byindex(iService);
9721 /* and now reload it. */
9722 iService = load_usershare_service(pszServiceName);
9727 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
9728 return GLOBAL_SECTION_SNUM;
9734 bool share_defined(const char *service_name)
9736 return (lp_servicenumber(service_name) != -1);
9739 /*******************************************************************
9740 A useful volume label function.
9741 ********************************************************************/
9743 const char *volume_label(int snum)
9746 const char *label = lp_volume(snum);
9748 label = lp_servicename(snum);
9751 /* This returns a 33 byte guarenteed null terminated string. */
9752 ret = talloc_strndup(talloc_tos(), label, 32);
9759 /*******************************************************************
9760 Set the server type we will announce as via nmbd.
9761 ********************************************************************/
9763 static void set_default_server_announce_type(void)
9765 default_server_announce = 0;
9766 default_server_announce |= SV_TYPE_WORKSTATION;
9767 default_server_announce |= SV_TYPE_SERVER;
9768 default_server_announce |= SV_TYPE_SERVER_UNIX;
9770 /* note that the flag should be set only if we have a
9771 printer service but nmbd doesn't actually load the
9772 services so we can't tell --jerry */
9774 default_server_announce |= SV_TYPE_PRINTQ_SERVER;
9776 default_server_announce |= SV_TYPE_SERVER_NT;
9777 default_server_announce |= SV_TYPE_NT;
9779 switch (lp_server_role()) {
9780 case ROLE_DOMAIN_MEMBER:
9781 default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
9783 case ROLE_DOMAIN_PDC:
9784 default_server_announce |= SV_TYPE_DOMAIN_CTRL;
9786 case ROLE_DOMAIN_BDC:
9787 default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL;
9789 case ROLE_STANDALONE:
9793 if (lp_time_server())
9794 default_server_announce |= SV_TYPE_TIME_SOURCE;
9796 if (lp_host_msdfs())
9797 default_server_announce |= SV_TYPE_DFS_SERVER;
9800 /***********************************************************
9801 If we are PDC then prefer us as DMB
9802 ************************************************************/
9804 bool lp_domain_master(void)
9806 if (Globals.iDomainMaster == Auto)
9807 return (lp_server_role() == ROLE_DOMAIN_PDC);
9809 return (bool)Globals.iDomainMaster;
9812 /***********************************************************
9813 If we are PDC then prefer us as DMB
9814 ************************************************************/
9816 bool lp_domain_master_true_or_auto(void)
9818 if (Globals.iDomainMaster) /* auto or yes */
9824 /***********************************************************
9825 If we are DMB then prefer us as LMB
9826 ************************************************************/
9828 bool lp_preferred_master(void)
9830 if (Globals.iPreferredMaster == Auto)
9831 return (lp_local_master() && lp_domain_master());
9833 return (bool)Globals.iPreferredMaster;
9836 /*******************************************************************
9838 ********************************************************************/
9840 void lp_remove_service(int snum)
9842 ServicePtrs[snum]->valid = False;
9843 invalid_services[num_invalid_services++] = snum;
9846 /*******************************************************************
9848 ********************************************************************/
9850 void lp_copy_service(int snum, const char *new_name)
9852 do_section(new_name, NULL);
9854 snum = lp_servicenumber(new_name);
9856 lp_do_parameter(snum, "copy", lp_servicename(snum));
9861 /*******************************************************************
9862 Get the default server type we will announce as via nmbd.
9863 ********************************************************************/
9865 int lp_default_server_announce(void)
9867 return default_server_announce;
9870 /*******************************************************************
9871 Split the announce version into major and minor numbers.
9872 ********************************************************************/
9874 int lp_major_announce_version(void)
9876 static bool got_major = False;
9877 static int major_version = DEFAULT_MAJOR_VERSION;
9882 return major_version;
9885 if ((vers = lp_announce_version()) == NULL)
9886 return major_version;
9888 if ((p = strchr_m(vers, '.')) == 0)
9889 return major_version;
9892 major_version = atoi(vers);
9893 return major_version;
9896 int lp_minor_announce_version(void)
9898 static bool got_minor = False;
9899 static int minor_version = DEFAULT_MINOR_VERSION;
9904 return minor_version;
9907 if ((vers = lp_announce_version()) == NULL)
9908 return minor_version;
9910 if ((p = strchr_m(vers, '.')) == 0)
9911 return minor_version;
9914 minor_version = atoi(p);
9915 return minor_version;
9918 /***********************************************************
9919 Set the global name resolution order (used in smbclient).
9920 ************************************************************/
9922 void lp_set_name_resolve_order(const char *new_order)
9924 string_set(&Globals.szNameResolveOrder, new_order);
9927 const char *lp_printername(int snum)
9929 const char *ret = _lp_printername(snum);
9930 if (ret == NULL || (ret != NULL && *ret == '\0'))
9931 ret = lp_const_servicename(snum);
9937 /***********************************************************
9938 Allow daemons such as winbindd to fix their logfile name.
9939 ************************************************************/
9941 void lp_set_logfile(const char *name)
9943 string_set(&Globals.szLogFile, name);
9944 debug_set_logfile(name);
9947 /*******************************************************************
9948 Return the max print jobs per queue.
9949 ********************************************************************/
9951 int lp_maxprintjobs(int snum)
9953 int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
9954 if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
9955 maxjobs = PRINT_MAX_JOBID - 1;
9960 const char *lp_printcapname(void)
9962 if ((Globals.szPrintcapname != NULL) &&
9963 (Globals.szPrintcapname[0] != '\0'))
9964 return Globals.szPrintcapname;
9966 if (sDefault.iPrinting == PRINT_CUPS) {
9974 if (sDefault.iPrinting == PRINT_BSD)
9975 return "/etc/printcap";
9977 return PRINTCAP_NAME;
9980 static uint32 spoolss_state;
9982 bool lp_disable_spoolss( void )
9984 if ( spoolss_state == SVCCTL_STATE_UNKNOWN )
9985 spoolss_state = _lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9987 return spoolss_state == SVCCTL_STOPPED ? True : False;
9990 void lp_set_spoolss_state( uint32 state )
9992 SMB_ASSERT( (state == SVCCTL_STOPPED) || (state == SVCCTL_RUNNING) );
9994 spoolss_state = state;
9997 uint32 lp_get_spoolss_state( void )
9999 return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
10002 /*******************************************************************
10003 Ensure we don't use sendfile if server smb signing is active.
10004 ********************************************************************/
10006 bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state)
10008 bool sign_active = false;
10010 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
10011 if (get_Protocol() < PROTOCOL_NT1) {
10014 if (signing_state) {
10015 sign_active = smb_signing_is_active(signing_state);
10017 return (_lp_use_sendfile(snum) &&
10018 (get_remote_arch() != RA_WIN95) &&
10022 /*******************************************************************
10023 Turn off sendfile if we find the underlying OS doesn't support it.
10024 ********************************************************************/
10026 void set_use_sendfile(int snum, bool val)
10028 if (LP_SNUM_OK(snum))
10029 ServicePtrs[snum]->bUseSendfile = val;
10031 sDefault.bUseSendfile = val;
10034 /*******************************************************************
10035 Turn off storing DOS attributes if this share doesn't support it.
10036 ********************************************************************/
10038 void set_store_dos_attributes(int snum, bool val)
10040 if (!LP_SNUM_OK(snum))
10042 ServicePtrs[(snum)]->bStoreDosAttributes = val;
10045 void lp_set_mangling_method(const char *new_method)
10047 string_set(&Globals.szManglingMethod, new_method);
10050 /*******************************************************************
10051 Global state for POSIX pathname processing.
10052 ********************************************************************/
10054 static bool posix_pathnames;
10056 bool lp_posix_pathnames(void)
10058 return posix_pathnames;
10061 /*******************************************************************
10062 Change everything needed to ensure POSIX pathname processing (currently
10064 ********************************************************************/
10066 void lp_set_posix_pathnames(void)
10068 posix_pathnames = True;
10071 /*******************************************************************
10072 Global state for POSIX lock processing - CIFS unix extensions.
10073 ********************************************************************/
10075 bool posix_default_lock_was_set;
10076 static enum brl_flavour posix_cifsx_locktype; /* By default 0 == WINDOWS_LOCK */
10078 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp)
10080 if (posix_default_lock_was_set) {
10081 return posix_cifsx_locktype;
10083 return fsp->posix_open ? POSIX_LOCK : WINDOWS_LOCK;
10087 /*******************************************************************
10088 ********************************************************************/
10090 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val)
10092 posix_default_lock_was_set = True;
10093 posix_cifsx_locktype = val;
10096 int lp_min_receive_file_size(void)
10098 if (Globals.iminreceivefile < 0) {
10101 return MIN(Globals.iminreceivefile, BUFFER_SIZE);
10104 /*******************************************************************
10105 If socket address is an empty character string, it is necessary to
10106 define it as "0.0.0.0".
10107 ********************************************************************/
10109 const char *lp_socket_address(void)
10111 char *sock_addr = Globals.szSocketAddress;
10113 if (sock_addr[0] == '\0'){
10114 string_set(&Globals.szSocketAddress, "0.0.0.0");
10116 return Globals.szSocketAddress;
10119 void lp_set_passdb_backend(const char *backend)
10121 string_set(&Globals.szPassdbBackend, backend);
10124 /*******************************************************************
10125 Safe wide links checks.
10126 This helper function always verify the validity of wide links,
10127 even after a configuration file reload.
10128 ********************************************************************/
10130 static bool lp_widelinks_internal(int snum)
10132 return (bool)(LP_SNUM_OK(snum)? ServicePtrs[(snum)]->bWidelinks :
10133 sDefault.bWidelinks);
10136 void widelinks_warning(int snum)
10138 if (lp_unix_extensions() && lp_widelinks_internal(snum)) {
10139 DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
10140 "These parameters are incompatible. "
10141 "Wide links will be disabled for this share.\n",
10142 lp_servicename(snum) ));
10146 bool lp_widelinks(int snum)
10148 /* wide links is always incompatible with unix extensions */
10149 if (lp_unix_extensions()) {
10153 return lp_widelinks_internal(snum);
10156 bool lp_writeraw(void)
10158 if (lp_async_smb_echo_handler()) {
10161 return _lp_writeraw();
10164 bool lp_readraw(void)
10166 if (lp_async_smb_echo_handler()) {
10169 return _lp_readraw();