2 Unix SMB/CIFS implementation.
3 Parameter loading functions
4 Copyright (C) Karl Auer 1993-1998
6 Largely re-written by Andrew Tridgell, September 1994
8 Copyright (C) Simo Sorce 2001
9 Copyright (C) Alexander Bokovoy 2002
10 Copyright (C) Stefan (metze) Metzmacher 2002
11 Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
12 Copyright (C) Michael Adam 2008
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 3 of the License, or
17 (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>.
31 * This module provides suitable callback functions for the params
32 * module. It builds the internal table of service details which is
33 * then used by the rest of the server.
37 * 1) add it to the global or service structure definition
38 * 2) add it to the parm_table
39 * 3) add it to the list of available functions (eg: using FN_GLOBAL_STRING())
40 * 4) If it's a global then initialise it in init_globals. If a local
41 * (ie. service) parameter then initialise it in the sDefault structure
45 * The configuration file is processed sequentially for speed. It is NOT
46 * accessed randomly as happens in 'real' Windows. For this reason, there
47 * is a fair bit of sequence-dependent code here - ie., code which assumes
48 * that certain things happen before others. In particular, the code which
49 * happens at the boundary between sections is delicately poised, so be
56 #include "lib/smbconf/smbconf.h"
57 #include "lib/smbconf/smbconf_init.h"
58 #include "lib/smbconf/smbconf_reg.h"
61 #include "../librpc/gen_ndr/svcctl.h"
63 #include "smb_signing.h"
67 #ifdef HAVE_SYS_SYSCTL_H
68 #include <sys/sysctl.h>
71 #ifdef HAVE_HTTPCONNECTENCRYPT
72 #include <cups/http.h>
77 extern userdom_struct current_user_info;
80 #define GLOBAL_NAME "global"
84 #define PRINTERS_NAME "printers"
88 #define HOMES_NAME "homes"
91 /* the special value for the include parameter
92 * to be interpreted not as a file name but to
93 * trigger loading of the global smb.conf options
95 #ifndef INCLUDE_REGISTRY_NAME
96 #define INCLUDE_REGISTRY_NAME "registry"
99 static bool in_client = False; /* Not in the client by default */
100 static struct smbconf_csn conf_last_csn;
102 #define CONFIG_BACKEND_FILE 0
103 #define CONFIG_BACKEND_REGISTRY 1
105 static int config_backend = CONFIG_BACKEND_FILE;
107 /* some helpful bits */
108 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
109 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
111 #define USERSHARE_VALID 1
112 #define USERSHARE_PENDING_DELETE 2
114 static bool defaults_saved = False;
116 struct param_opt_struct {
117 struct param_opt_struct *prev, *next;
125 * This structure describes global (ie., server-wide) parameters.
132 char *display_charset;
133 char *szPrintcapname;
134 char *szAddPortCommand;
135 char *szEnumPortsCommand;
136 char *szAddPrinterCommand;
137 char *szDeletePrinterCommand;
138 char *szOs2DriverMap;
144 char *szDefaultService;
148 char *szServerString;
149 char *szAutoServices;
150 char *szPasswdProgram;
154 char *szSMBPasswdFile;
156 char *szPassdbBackend;
157 char **szPreloadModules;
158 char *szPasswordServer;
159 char *szSocketOptions;
161 char *szAfsUsernameMap;
162 int iAfsTokenLifetime;
163 char *szLogNtTokenCommand;
169 char **szWINSservers;
171 char *szRemoteAnnounce;
172 char *szRemoteBrowseSync;
173 char *szSocketAddress;
174 bool bNmbdBindExplicitBroadcast;
175 char *szNISHomeMapName;
176 char *szAnnounceVersion; /* This is initialised in init_globals */
179 char **szNetbiosAliases;
180 char *szNetbiosScope;
181 char *szNameResolveOrder;
183 char *szAddUserScript;
184 char *szRenameUserScript;
185 char *szDelUserScript;
186 char *szAddGroupScript;
187 char *szDelGroupScript;
188 char *szAddUserToGroupScript;
189 char *szDelUserFromGroupScript;
190 char *szSetPrimaryGroupScript;
191 char *szAddMachineScript;
192 char *szShutdownScript;
193 char *szAbortShutdownScript;
194 char *szUsernameMapScript;
195 int iUsernameMapCacheTime;
196 char *szCheckPasswordScript;
203 bool bPassdbExpandExplicit;
204 int AlgorithmicRidBase;
205 char *szTemplateHomedir;
206 char *szTemplateShell;
207 char *szWinbindSeparator;
208 bool bWinbindEnumUsers;
209 bool bWinbindEnumGroups;
210 bool bWinbindUseDefaultDomain;
211 bool bWinbindTrustedDomainsOnly;
212 bool bWinbindNestedGroups;
213 int winbind_expand_groups;
214 bool bWinbindRefreshTickets;
215 bool bWinbindOfflineLogon;
216 bool bWinbindNormalizeNames;
217 bool bWinbindRpcOnly;
218 bool bCreateKrb5Conf;
219 char *szIdmapBackend;
221 char *szAddShareCommand;
222 char *szChangeShareCommand;
223 char *szDeleteShareCommand;
225 char *szGuestaccount;
226 char *szManglingMethod;
227 char **szServicesList;
228 char *szUsersharePath;
229 char *szUsershareTemplateShare;
230 char **szUsersharePrefixAllowList;
231 char **szUsersharePrefixDenyList;
238 int open_files_db_hash_size;
247 bool paranoid_server_security;
250 int iMaxSmbdProcesses;
251 bool bDisableSpoolss;
254 bool enhanced_browsing;
260 int announce_as; /* This is initialised in init_globals */
261 int machine_password_timeout;
263 int oplock_break_wait_time;
264 int winbind_cache_time;
265 int winbind_reconnect_delay;
266 int winbind_max_clients;
267 char **szWinbindNssInfo;
269 char *szLdapMachineSuffix;
270 char *szLdapUserSuffix;
271 char *szLdapIdmapSuffix;
272 char *szLdapGroupSuffix;
276 int ldap_follow_referral;
279 int ldap_debug_level;
280 int ldap_debug_threshold;
284 char *szIPrintServer;
286 char **szClusterAddresses;
289 int ctdb_locktime_warn_threshold;
290 int ldap_passwd_sync;
291 int ldap_replication_sleep;
292 int ldap_timeout; /* This is initialised in init_globals */
293 int ldap_connection_timeout;
296 bool bMsAddPrinterWizard;
301 int iPreferredMaster;
304 char **szInitLogonDelayedHosts;
306 bool bEncryptPasswords;
311 bool bObeyPamRestrictions;
313 int PrintcapCacheTime;
314 bool bLargeReadwrite;
321 bool bBindInterfacesOnly;
322 bool bPamPasswordChange;
323 bool bUnixPasswdSync;
324 bool bPasswdChatDebug;
325 int iPasswdChatTimeout;
329 bool bNTStatusSupport;
331 int iMaxStatCacheSize;
333 bool bAllowTrustedDomains;
337 bool bClientLanManAuth;
338 bool bClientNTLMv2Auth;
339 bool bClientPlaintextAuth;
340 bool bClientUseSpnego;
341 bool client_use_spnego_principal;
342 bool bDebugPrefixTimestamp;
343 bool bDebugHiresTimestamp;
347 bool bEnableCoreFiles;
350 bool bHostnameLookups;
351 bool bUnixExtensions;
352 bool bDisableNetbios;
353 char * szDedicatedKeytabFile;
355 bool bDeferSharingViolations;
356 bool bEnablePrivileges;
358 bool bUsershareOwnerOnly;
359 bool bUsershareAllowGuests;
360 bool bRegistryShares;
361 int restrict_anonymous;
362 int name_cache_timeout;
365 int client_ldap_sasl_wrapping;
366 int iUsershareMaxShares;
368 int iIdmapNegativeCacheTime;
370 bool bLogWriteableFilesOnExit;
373 struct param_opt_struct *param_opt;
374 int cups_connection_timeout;
375 char *szSMBPerfcountModule;
376 bool bMapUntrustedToDomain;
377 bool bAsyncSMBEchoHandler;
378 bool bMulticastDnsRegister;
385 static struct global Globals;
388 * This structure describes a single service.
394 struct timespec usershare_last_mod;
398 char **szInvalidUsers;
406 char *szRootPostExec;
408 char *szPrintcommand;
411 char *szLppausecommand;
412 char *szLpresumecommand;
413 char *szQueuepausecommand;
414 char *szQueueresumecommand;
416 char *szPrintjobUsername;
424 char *szVetoOplockFiles;
430 char **printer_admin;
435 char *szAioWriteBehind;
439 int iMaxReportedPrintJobs;
442 int iCreate_force_mode;
444 int iSecurity_force_mode;
447 int iDir_Security_mask;
448 int iDir_Security_force_mode;
452 int iOplockContentionLimit;
457 bool bRootpreexecClose;
460 bool bShortCasePreserve;
462 bool bHideSpecialFiles;
463 bool bHideUnReadable;
464 bool bHideUnWriteableFiles;
466 bool bAccessBasedShareEnum;
471 bool bAdministrative_share;
477 bool bStoreDosAttributes;
490 bool bStrictAllocate;
493 struct bitmap *copymap;
494 bool bDeleteReadonly;
496 bool bDeleteVetoFiles;
499 bool bDosFiletimeResolution;
500 bool bFakeDirCreateTimes;
506 bool bUseClientDriver;
507 bool bDefaultDevmode;
508 bool bForcePrintername;
510 bool bForceUnknownAclUser;
513 bool bMap_acl_inherit;
516 bool bAclCheckPermissions;
517 bool bAclMapFullControl;
518 bool bAclGroupControl;
520 bool bKernelChangeNotify;
521 int iallocation_roundup_size;
525 int iDirectoryNameCacheSize;
527 struct param_opt_struct *param_opt;
529 char dummy[3]; /* for alignment */
533 /* This is a default service used to prime a services structure */
534 static struct service sDefault = {
536 False, /* not autoloaded */
537 0, /* not a usershare */
538 {0, }, /* No last mod time */
539 NULL, /* szService */
541 NULL, /* szUsername */
542 NULL, /* szInvalidUsers */
543 NULL, /* szValidUsers */
544 NULL, /* szAdminUsers */
546 NULL, /* szInclude */
547 NULL, /* szPreExec */
548 NULL, /* szPostExec */
549 NULL, /* szRootPreExec */
550 NULL, /* szRootPostExec */
551 NULL, /* szCupsOptions */
552 NULL, /* szPrintcommand */
553 NULL, /* szLpqcommand */
554 NULL, /* szLprmcommand */
555 NULL, /* szLppausecommand */
556 NULL, /* szLpresumecommand */
557 NULL, /* szQueuepausecommand */
558 NULL, /* szQueueresumecommand */
559 NULL, /* szPrintername */
560 NULL, /* szPrintjobUsername */
561 NULL, /* szDontdescend */
562 NULL, /* szHostsallow */
563 NULL, /* szHostsdeny */
564 NULL, /* szMagicScript */
565 NULL, /* szMagicOutput */
566 NULL, /* szVetoFiles */
567 NULL, /* szHideFiles */
568 NULL, /* szVetoOplockFiles */
570 NULL, /* force user */
571 NULL, /* force group */
573 NULL, /* writelist */
574 NULL, /* printer admin */
577 NULL, /* vfs objects */
578 NULL, /* szMSDfsProxy */
579 NULL, /* szAioWriteBehind */
581 0, /* iMinPrintSpace */
582 1000, /* iMaxPrintJobs */
583 0, /* iMaxReportedPrintJobs */
584 0, /* iWriteCacheSize */
585 0744, /* iCreate_mask */
586 0000, /* iCreate_force_mode */
587 0777, /* iSecurity_mask */
588 0, /* iSecurity_force_mode */
589 0755, /* iDir_mask */
590 0000, /* iDir_force_mode */
591 0777, /* iDir_Security_mask */
592 0, /* iDir_Security_force_mode */
593 0, /* iMaxConnections */
594 CASE_LOWER, /* iDefaultCase */
595 DEFAULT_PRINTING, /* iPrinting */
596 2, /* iOplockContentionLimit */
598 1024, /* iBlock_size */
599 0, /* iDfreeCacheTime */
600 False, /* bPreexecClose */
601 False, /* bRootpreexecClose */
602 Auto, /* case sensitive */
603 True, /* case preserve */
604 True, /* short case preserve */
605 True, /* bHideDotFiles */
606 False, /* bHideSpecialFiles */
607 False, /* bHideUnReadable */
608 False, /* bHideUnWriteableFiles */
609 True, /* bBrowseable */
610 False, /* bAccessBasedShareEnum */
611 True, /* bAvailable */
612 True, /* bRead_only */
613 True, /* bNo_set_dir */
614 False, /* bGuest_only */
615 False, /* bAdministrative_share */
616 False, /* bGuest_ok */
617 False, /* bPrint_ok */
618 False, /* bMap_system */
619 False, /* bMap_hidden */
620 True, /* bMap_archive */
621 False, /* bStoreDosAttributes */
622 False, /* bDmapiSupport */
624 Auto, /* iStrictLocking */
625 True, /* bPosixLocking */
626 True, /* bShareModes */
628 True, /* bLevel2OpLocks */
629 False, /* bOnlyUser */
630 True, /* bMangledNames */
631 false, /* bWidelinks */
632 True, /* bSymlinks */
633 False, /* bSyncAlways */
634 False, /* bStrictAllocate */
635 False, /* bStrictSync */
636 '~', /* magic char */
638 False, /* bDeleteReadonly */
639 False, /* bFakeOplocks */
640 False, /* bDeleteVetoFiles */
641 False, /* bDosFilemode */
642 True, /* bDosFiletimes */
643 False, /* bDosFiletimeResolution */
644 False, /* bFakeDirCreateTimes */
645 True, /* bBlockingLocks */
646 False, /* bInheritPerms */
647 False, /* bInheritACLS */
648 False, /* bInheritOwner */
649 False, /* bMSDfsRoot */
650 False, /* bUseClientDriver */
651 True, /* bDefaultDevmode */
652 False, /* bForcePrintername */
653 True, /* bNTAclSupport */
654 False, /* bForceUnknownAclUser */
655 False, /* bUseSendfile */
656 False, /* bProfileAcls */
657 False, /* bMap_acl_inherit */
658 False, /* bAfs_Share */
659 False, /* bEASupport */
660 True, /* bAclCheckPermissions */
661 True, /* bAclMapFullControl */
662 False, /* bAclGroupControl */
663 True, /* bChangeNotify */
664 True, /* bKernelChangeNotify */
665 SMB_ROUNDUP_ALLOCATION_SIZE, /* iallocation_roundup_size */
666 0, /* iAioReadSize */
667 0, /* iAioWriteSize */
668 MAP_READONLY_YES, /* iMap_readonly */
669 #ifdef BROKEN_DIRECTORY_HANDLING
670 0, /* iDirectoryNameCacheSize */
672 100, /* iDirectoryNameCacheSize */
674 Auto, /* ismb_encrypt */
675 NULL, /* Parametric options */
680 /* local variables */
681 static struct service **ServicePtrs = NULL;
682 static int iNumServices = 0;
683 static int iServiceIndex = 0;
684 static struct db_context *ServiceHash;
685 static int *invalid_services = NULL;
686 static int num_invalid_services = 0;
687 static bool bInGlobalSection = True;
688 static bool bGlobalOnly = False;
689 static int default_server_announce;
691 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
693 /* prototypes for the special type handlers */
694 static bool handle_include( int snum, const char *pszParmValue, char **ptr);
695 static bool handle_copy( int snum, const char *pszParmValue, char **ptr);
696 static bool handle_netbios_name( int snum, const char *pszParmValue, char **ptr);
697 static bool handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);
698 static bool handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);
699 static bool handle_debug_list( int snum, const char *pszParmValue, char **ptr );
700 static bool handle_workgroup( int snum, const char *pszParmValue, char **ptr );
701 static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
702 static bool handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );
703 static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
704 static bool handle_printing( int snum, const char *pszParmValue, char **ptr);
705 static bool handle_ldap_debug_level( int snum, const char *pszParmValue, char **ptr);
707 static void set_default_server_announce_type(void);
708 static void set_allowed_client_auth(void);
710 static void *lp_local_ptr(struct service *service, void *ptr);
712 static void add_to_file_list(const char *fname, const char *subfname);
713 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values);
715 static const struct enum_list enum_protocol[] = {
716 {PROTOCOL_SMB2, "SMB2"},
717 {PROTOCOL_NT1, "NT1"},
718 {PROTOCOL_LANMAN2, "LANMAN2"},
719 {PROTOCOL_LANMAN1, "LANMAN1"},
720 {PROTOCOL_CORE, "CORE"},
721 {PROTOCOL_COREPLUS, "COREPLUS"},
722 {PROTOCOL_COREPLUS, "CORE+"},
726 static const struct enum_list enum_security[] = {
727 {SEC_SHARE, "SHARE"},
729 {SEC_SERVER, "SERVER"},
730 {SEC_DOMAIN, "DOMAIN"},
737 static const struct enum_list enum_printing[] = {
738 {PRINT_SYSV, "sysv"},
740 {PRINT_HPUX, "hpux"},
744 {PRINT_LPRNG, "lprng"},
745 {PRINT_CUPS, "cups"},
746 {PRINT_IPRINT, "iprint"},
748 {PRINT_LPROS2, "os2"},
750 {PRINT_TEST, "test"},
752 #endif /* DEVELOPER */
756 static const struct enum_list enum_ldap_sasl_wrapping[] = {
758 {ADS_AUTH_SASL_SIGN, "sign"},
759 {ADS_AUTH_SASL_SEAL, "seal"},
763 static const struct enum_list enum_ldap_ssl[] = {
764 {LDAP_SSL_OFF, "no"},
765 {LDAP_SSL_OFF, "off"},
766 {LDAP_SSL_START_TLS, "start tls"},
767 {LDAP_SSL_START_TLS, "start_tls"},
771 /* LDAP Dereferencing Alias types */
772 #define SAMBA_LDAP_DEREF_NEVER 0
773 #define SAMBA_LDAP_DEREF_SEARCHING 1
774 #define SAMBA_LDAP_DEREF_FINDING 2
775 #define SAMBA_LDAP_DEREF_ALWAYS 3
777 static const struct enum_list enum_ldap_deref[] = {
778 {SAMBA_LDAP_DEREF_NEVER, "never"},
779 {SAMBA_LDAP_DEREF_SEARCHING, "searching"},
780 {SAMBA_LDAP_DEREF_FINDING, "finding"},
781 {SAMBA_LDAP_DEREF_ALWAYS, "always"},
785 static const struct enum_list enum_ldap_passwd_sync[] = {
786 {LDAP_PASSWD_SYNC_OFF, "no"},
787 {LDAP_PASSWD_SYNC_OFF, "off"},
788 {LDAP_PASSWD_SYNC_ON, "yes"},
789 {LDAP_PASSWD_SYNC_ON, "on"},
790 {LDAP_PASSWD_SYNC_ONLY, "only"},
794 /* Types of machine we can announce as. */
795 #define ANNOUNCE_AS_NT_SERVER 1
796 #define ANNOUNCE_AS_WIN95 2
797 #define ANNOUNCE_AS_WFW 3
798 #define ANNOUNCE_AS_NT_WORKSTATION 4
800 static const struct enum_list enum_announce_as[] = {
801 {ANNOUNCE_AS_NT_SERVER, "NT"},
802 {ANNOUNCE_AS_NT_SERVER, "NT Server"},
803 {ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},
804 {ANNOUNCE_AS_WIN95, "win95"},
805 {ANNOUNCE_AS_WFW, "WfW"},
809 static const struct enum_list enum_map_readonly[] = {
810 {MAP_READONLY_NO, "no"},
811 {MAP_READONLY_NO, "false"},
812 {MAP_READONLY_NO, "0"},
813 {MAP_READONLY_YES, "yes"},
814 {MAP_READONLY_YES, "true"},
815 {MAP_READONLY_YES, "1"},
816 {MAP_READONLY_PERMISSIONS, "permissions"},
817 {MAP_READONLY_PERMISSIONS, "perms"},
821 static const struct enum_list enum_case[] = {
822 {CASE_LOWER, "lower"},
823 {CASE_UPPER, "upper"},
829 static const struct enum_list enum_bool_auto[] = {
840 static const struct enum_list enum_csc_policy[] = {
841 {CSC_POLICY_MANUAL, "manual"},
842 {CSC_POLICY_DOCUMENTS, "documents"},
843 {CSC_POLICY_PROGRAMS, "programs"},
844 {CSC_POLICY_DISABLE, "disable"},
848 /* SMB signing types. */
849 static const struct enum_list enum_smb_signing_vals[] = {
861 {Required, "required"},
862 {Required, "mandatory"},
864 {Required, "forced"},
865 {Required, "enforced"},
869 /* ACL compatibility options. */
870 static const struct enum_list enum_acl_compat_vals[] = {
871 { ACL_COMPAT_AUTO, "auto" },
872 { ACL_COMPAT_WINNT, "winnt" },
873 { ACL_COMPAT_WIN2K, "win2k" },
878 Do you want session setups at user level security with a invalid
879 password to be rejected or allowed in as guest? WinNT rejects them
880 but it can be a pain as it means "net view" needs to use a password
882 You have 3 choices in the setting of map_to_guest:
884 "Never" means session setups with an invalid password
885 are rejected. This is the default.
887 "Bad User" means session setups with an invalid password
888 are rejected, unless the username does not exist, in which case it
889 is treated as a guest login
891 "Bad Password" means session setups with an invalid password
892 are treated as a guest login
894 Note that map_to_guest only has an effect in user or server
898 static const struct enum_list enum_map_to_guest[] = {
899 {NEVER_MAP_TO_GUEST, "Never"},
900 {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
901 {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
902 {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},
906 /* Config backend options */
908 static const struct enum_list enum_config_backend[] = {
909 {CONFIG_BACKEND_FILE, "file"},
910 {CONFIG_BACKEND_REGISTRY, "registry"},
914 /* ADS kerberos ticket verification options */
916 static const struct enum_list enum_kerberos_method[] = {
917 {KERBEROS_VERIFY_SECRETS, "default"},
918 {KERBEROS_VERIFY_SECRETS, "secrets only"},
919 {KERBEROS_VERIFY_SYSTEM_KEYTAB, "system keytab"},
920 {KERBEROS_VERIFY_DEDICATED_KEYTAB, "dedicated keytab"},
921 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB, "secrets and keytab"},
925 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
927 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
928 * screen in SWAT. This is used to exclude parameters as well as to squash all
929 * parameters that have been duplicated by pseudonyms.
931 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
932 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
933 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
936 * NOTE2: Handling of duplicated (synonym) parameters:
937 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
938 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
939 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
940 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
943 static struct parm_struct parm_table[] = {
944 {N_("Base Options"), P_SEP, P_SEPARATOR},
947 .label = "dos charset",
950 .ptr = &Globals.dos_charset,
951 .special = handle_charset,
953 .flags = FLAG_ADVANCED
956 .label = "unix charset",
959 .ptr = &Globals.unix_charset,
960 .special = handle_charset,
962 .flags = FLAG_ADVANCED
965 .label = "display charset",
968 .ptr = &Globals.display_charset,
969 .special = handle_charset,
971 .flags = FLAG_ADVANCED
977 .ptr = &sDefault.comment,
980 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT
986 .ptr = &sDefault.szPath,
989 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
992 .label = "directory",
995 .ptr = &sDefault.szPath,
1001 .label = "workgroup",
1003 .p_class = P_GLOBAL,
1004 .ptr = &Globals.szWorkgroup,
1005 .special = handle_workgroup,
1007 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1013 .p_class = P_GLOBAL,
1014 .ptr = &Globals.szRealm,
1017 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1021 .label = "netbios name",
1023 .p_class = P_GLOBAL,
1024 .ptr = &Globals.szNetbiosName,
1025 .special = handle_netbios_name,
1027 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1030 .label = "netbios aliases",
1032 .p_class = P_GLOBAL,
1033 .ptr = &Globals.szNetbiosAliases,
1034 .special = handle_netbios_aliases,
1036 .flags = FLAG_ADVANCED,
1039 .label = "netbios scope",
1041 .p_class = P_GLOBAL,
1042 .ptr = &Globals.szNetbiosScope,
1043 .special = handle_netbios_scope,
1045 .flags = FLAG_ADVANCED,
1048 .label = "server string",
1050 .p_class = P_GLOBAL,
1051 .ptr = &Globals.szServerString,
1054 .flags = FLAG_BASIC | FLAG_ADVANCED,
1057 .label = "interfaces",
1059 .p_class = P_GLOBAL,
1060 .ptr = &Globals.szInterfaces,
1063 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1066 .label = "bind interfaces only",
1068 .p_class = P_GLOBAL,
1069 .ptr = &Globals.bBindInterfacesOnly,
1072 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1075 .label = "config backend",
1077 .p_class = P_GLOBAL,
1078 .ptr = &Globals.ConfigBackend,
1080 .enum_list = enum_config_backend,
1081 .flags = FLAG_HIDE|FLAG_ADVANCED|FLAG_META,
1084 {N_("Security Options"), P_SEP, P_SEPARATOR},
1087 .label = "security",
1089 .p_class = P_GLOBAL,
1090 .ptr = &Globals.security,
1092 .enum_list = enum_security,
1093 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1096 .label = "auth methods",
1098 .p_class = P_GLOBAL,
1099 .ptr = &Globals.AuthMethods,
1102 .flags = FLAG_ADVANCED,
1105 .label = "encrypt passwords",
1107 .p_class = P_GLOBAL,
1108 .ptr = &Globals.bEncryptPasswords,
1111 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1114 .label = "client schannel",
1116 .p_class = P_GLOBAL,
1117 .ptr = &Globals.clientSchannel,
1119 .enum_list = enum_bool_auto,
1120 .flags = FLAG_BASIC | FLAG_ADVANCED,
1123 .label = "server schannel",
1125 .p_class = P_GLOBAL,
1126 .ptr = &Globals.serverSchannel,
1128 .enum_list = enum_bool_auto,
1129 .flags = FLAG_BASIC | FLAG_ADVANCED,
1132 .label = "allow trusted domains",
1134 .p_class = P_GLOBAL,
1135 .ptr = &Globals.bAllowTrustedDomains,
1138 .flags = FLAG_ADVANCED,
1141 .label = "map to guest",
1143 .p_class = P_GLOBAL,
1144 .ptr = &Globals.map_to_guest,
1146 .enum_list = enum_map_to_guest,
1147 .flags = FLAG_ADVANCED,
1150 .label = "null passwords",
1152 .p_class = P_GLOBAL,
1153 .ptr = &Globals.bNullPasswords,
1156 .flags = FLAG_ADVANCED,
1159 .label = "obey pam restrictions",
1161 .p_class = P_GLOBAL,
1162 .ptr = &Globals.bObeyPamRestrictions,
1165 .flags = FLAG_ADVANCED,
1168 .label = "password server",
1170 .p_class = P_GLOBAL,
1171 .ptr = &Globals.szPasswordServer,
1174 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1177 .label = "smb passwd file",
1179 .p_class = P_GLOBAL,
1180 .ptr = &Globals.szSMBPasswdFile,
1183 .flags = FLAG_ADVANCED,
1186 .label = "private dir",
1188 .p_class = P_GLOBAL,
1189 .ptr = &Globals.szPrivateDir,
1192 .flags = FLAG_ADVANCED,
1195 .label = "passdb backend",
1197 .p_class = P_GLOBAL,
1198 .ptr = &Globals.szPassdbBackend,
1201 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1204 .label = "algorithmic rid base",
1206 .p_class = P_GLOBAL,
1207 .ptr = &Globals.AlgorithmicRidBase,
1210 .flags = FLAG_ADVANCED,
1213 .label = "root directory",
1215 .p_class = P_GLOBAL,
1216 .ptr = &Globals.szRootdir,
1219 .flags = FLAG_ADVANCED,
1222 .label = "root dir",
1224 .p_class = P_GLOBAL,
1225 .ptr = &Globals.szRootdir,
1233 .p_class = P_GLOBAL,
1234 .ptr = &Globals.szRootdir,
1240 .label = "guest account",
1242 .p_class = P_GLOBAL,
1243 .ptr = &Globals.szGuestaccount,
1246 .flags = FLAG_BASIC | FLAG_ADVANCED,
1249 .label = "enable privileges",
1251 .p_class = P_GLOBAL,
1252 .ptr = &Globals.bEnablePrivileges,
1255 .flags = FLAG_ADVANCED,
1259 .label = "pam password change",
1261 .p_class = P_GLOBAL,
1262 .ptr = &Globals.bPamPasswordChange,
1265 .flags = FLAG_ADVANCED,
1268 .label = "passwd program",
1270 .p_class = P_GLOBAL,
1271 .ptr = &Globals.szPasswdProgram,
1274 .flags = FLAG_ADVANCED,
1277 .label = "passwd chat",
1279 .p_class = P_GLOBAL,
1280 .ptr = &Globals.szPasswdChat,
1283 .flags = FLAG_ADVANCED,
1286 .label = "passwd chat debug",
1288 .p_class = P_GLOBAL,
1289 .ptr = &Globals.bPasswdChatDebug,
1292 .flags = FLAG_ADVANCED,
1295 .label = "passwd chat timeout",
1297 .p_class = P_GLOBAL,
1298 .ptr = &Globals.iPasswdChatTimeout,
1301 .flags = FLAG_ADVANCED,
1304 .label = "check password script",
1306 .p_class = P_GLOBAL,
1307 .ptr = &Globals.szCheckPasswordScript,
1310 .flags = FLAG_ADVANCED,
1313 .label = "username map",
1315 .p_class = P_GLOBAL,
1316 .ptr = &Globals.szUsernameMap,
1319 .flags = FLAG_ADVANCED,
1322 .label = "password level",
1324 .p_class = P_GLOBAL,
1325 .ptr = &Globals.pwordlevel,
1328 .flags = FLAG_ADVANCED,
1331 .label = "username level",
1333 .p_class = P_GLOBAL,
1334 .ptr = &Globals.unamelevel,
1337 .flags = FLAG_ADVANCED,
1340 .label = "unix password sync",
1342 .p_class = P_GLOBAL,
1343 .ptr = &Globals.bUnixPasswdSync,
1346 .flags = FLAG_ADVANCED,
1349 .label = "restrict anonymous",
1351 .p_class = P_GLOBAL,
1352 .ptr = &Globals.restrict_anonymous,
1355 .flags = FLAG_ADVANCED,
1358 .label = "lanman auth",
1360 .p_class = P_GLOBAL,
1361 .ptr = &Globals.bLanmanAuth,
1364 .flags = FLAG_ADVANCED,
1367 .label = "ntlm auth",
1369 .p_class = P_GLOBAL,
1370 .ptr = &Globals.bNTLMAuth,
1373 .flags = FLAG_ADVANCED,
1376 .label = "client NTLMv2 auth",
1378 .p_class = P_GLOBAL,
1379 .ptr = &Globals.bClientNTLMv2Auth,
1382 .flags = FLAG_ADVANCED,
1385 .label = "client lanman auth",
1387 .p_class = P_GLOBAL,
1388 .ptr = &Globals.bClientLanManAuth,
1391 .flags = FLAG_ADVANCED,
1394 .label = "client plaintext auth",
1396 .p_class = P_GLOBAL,
1397 .ptr = &Globals.bClientPlaintextAuth,
1400 .flags = FLAG_ADVANCED,
1403 .label = "client use spnego principal",
1405 .p_class = P_GLOBAL,
1406 .ptr = &Globals.client_use_spnego_principal,
1409 .flags = FLAG_ADVANCED,
1412 .label = "username",
1415 .ptr = &sDefault.szUsername,
1418 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1424 .ptr = &sDefault.szUsername,
1433 .ptr = &sDefault.szUsername,
1439 .label = "invalid users",
1442 .ptr = &sDefault.szInvalidUsers,
1445 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1448 .label = "valid users",
1451 .ptr = &sDefault.szValidUsers,
1454 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1457 .label = "admin users",
1460 .ptr = &sDefault.szAdminUsers,
1463 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1466 .label = "read list",
1469 .ptr = &sDefault.readlist,
1472 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1475 .label = "write list",
1478 .ptr = &sDefault.writelist,
1481 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1484 .label = "printer admin",
1487 .ptr = &sDefault.printer_admin,
1490 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_PRINT | FLAG_DEPRECATED,
1493 .label = "force user",
1496 .ptr = &sDefault.force_user,
1499 .flags = FLAG_ADVANCED | FLAG_SHARE,
1502 .label = "force group",
1505 .ptr = &sDefault.force_group,
1508 .flags = FLAG_ADVANCED | FLAG_SHARE,
1514 .ptr = &sDefault.force_group,
1517 .flags = FLAG_ADVANCED,
1520 .label = "read only",
1523 .ptr = &sDefault.bRead_only,
1526 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE,
1529 .label = "write ok",
1532 .ptr = &sDefault.bRead_only,
1538 .label = "writeable",
1541 .ptr = &sDefault.bRead_only,
1547 .label = "writable",
1550 .ptr = &sDefault.bRead_only,
1556 .label = "acl check permissions",
1559 .ptr = &sDefault.bAclCheckPermissions,
1562 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1565 .label = "acl group control",
1568 .ptr = &sDefault.bAclGroupControl,
1571 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1574 .label = "acl map full control",
1577 .ptr = &sDefault.bAclMapFullControl,
1580 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1583 .label = "create mask",
1586 .ptr = &sDefault.iCreate_mask,
1589 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1592 .label = "create mode",
1595 .ptr = &sDefault.iCreate_mask,
1601 .label = "force create mode",
1604 .ptr = &sDefault.iCreate_force_mode,
1607 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1610 .label = "security mask",
1613 .ptr = &sDefault.iSecurity_mask,
1616 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1619 .label = "force security mode",
1622 .ptr = &sDefault.iSecurity_force_mode,
1625 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1628 .label = "directory mask",
1631 .ptr = &sDefault.iDir_mask,
1634 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1637 .label = "directory mode",
1640 .ptr = &sDefault.iDir_mask,
1643 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1646 .label = "force directory mode",
1649 .ptr = &sDefault.iDir_force_mode,
1652 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1655 .label = "directory security mask",
1658 .ptr = &sDefault.iDir_Security_mask,
1661 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1664 .label = "force directory security mode",
1667 .ptr = &sDefault.iDir_Security_force_mode,
1670 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1673 .label = "force unknown acl user",
1676 .ptr = &sDefault.bForceUnknownAclUser,
1679 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1682 .label = "inherit permissions",
1685 .ptr = &sDefault.bInheritPerms,
1688 .flags = FLAG_ADVANCED | FLAG_SHARE,
1691 .label = "inherit acls",
1694 .ptr = &sDefault.bInheritACLS,
1697 .flags = FLAG_ADVANCED | FLAG_SHARE,
1700 .label = "inherit owner",
1703 .ptr = &sDefault.bInheritOwner,
1706 .flags = FLAG_ADVANCED | FLAG_SHARE,
1709 .label = "guest only",
1712 .ptr = &sDefault.bGuest_only,
1715 .flags = FLAG_ADVANCED | FLAG_SHARE,
1718 .label = "only guest",
1721 .ptr = &sDefault.bGuest_only,
1727 .label = "administrative share",
1730 .ptr = &sDefault.bAdministrative_share,
1733 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1737 .label = "guest ok",
1740 .ptr = &sDefault.bGuest_ok,
1743 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1749 .ptr = &sDefault.bGuest_ok,
1755 .label = "only user",
1758 .ptr = &sDefault.bOnlyUser,
1761 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED,
1764 .label = "hosts allow",
1767 .ptr = &sDefault.szHostsallow,
1770 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1773 .label = "allow hosts",
1776 .ptr = &sDefault.szHostsallow,
1782 .label = "hosts deny",
1785 .ptr = &sDefault.szHostsdeny,
1788 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1791 .label = "deny hosts",
1794 .ptr = &sDefault.szHostsdeny,
1800 .label = "preload modules",
1802 .p_class = P_GLOBAL,
1803 .ptr = &Globals.szPreloadModules,
1806 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1809 .label = "dedicated keytab file",
1811 .p_class = P_GLOBAL,
1812 .ptr = &Globals.szDedicatedKeytabFile,
1815 .flags = FLAG_ADVANCED,
1818 .label = "kerberos method",
1820 .p_class = P_GLOBAL,
1821 .ptr = &Globals.iKerberosMethod,
1823 .enum_list = enum_kerberos_method,
1824 .flags = FLAG_ADVANCED,
1827 .label = "map untrusted to domain",
1829 .p_class = P_GLOBAL,
1830 .ptr = &Globals.bMapUntrustedToDomain,
1833 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1837 {N_("Logging Options"), P_SEP, P_SEPARATOR},
1840 .label = "log level",
1842 .p_class = P_GLOBAL,
1843 .ptr = &Globals.szLogLevel,
1844 .special = handle_debug_list,
1846 .flags = FLAG_ADVANCED,
1849 .label = "debuglevel",
1851 .p_class = P_GLOBAL,
1852 .ptr = &Globals.szLogLevel,
1853 .special = handle_debug_list,
1860 .p_class = P_GLOBAL,
1861 .ptr = &Globals.syslog,
1864 .flags = FLAG_ADVANCED,
1867 .label = "syslog only",
1869 .p_class = P_GLOBAL,
1870 .ptr = &Globals.bSyslogOnly,
1873 .flags = FLAG_ADVANCED,
1876 .label = "log file",
1878 .p_class = P_GLOBAL,
1879 .ptr = &Globals.szLogFile,
1882 .flags = FLAG_ADVANCED,
1885 .label = "max log size",
1887 .p_class = P_GLOBAL,
1888 .ptr = &Globals.max_log_size,
1891 .flags = FLAG_ADVANCED,
1894 .label = "debug timestamp",
1896 .p_class = P_GLOBAL,
1897 .ptr = &Globals.bTimestampLogs,
1900 .flags = FLAG_ADVANCED,
1903 .label = "timestamp logs",
1905 .p_class = P_GLOBAL,
1906 .ptr = &Globals.bTimestampLogs,
1909 .flags = FLAG_ADVANCED,
1912 .label = "debug prefix timestamp",
1914 .p_class = P_GLOBAL,
1915 .ptr = &Globals.bDebugPrefixTimestamp,
1918 .flags = FLAG_ADVANCED,
1921 .label = "debug hires timestamp",
1923 .p_class = P_GLOBAL,
1924 .ptr = &Globals.bDebugHiresTimestamp,
1927 .flags = FLAG_ADVANCED,
1930 .label = "debug pid",
1932 .p_class = P_GLOBAL,
1933 .ptr = &Globals.bDebugPid,
1936 .flags = FLAG_ADVANCED,
1939 .label = "debug uid",
1941 .p_class = P_GLOBAL,
1942 .ptr = &Globals.bDebugUid,
1945 .flags = FLAG_ADVANCED,
1948 .label = "debug class",
1950 .p_class = P_GLOBAL,
1951 .ptr = &Globals.bDebugClass,
1954 .flags = FLAG_ADVANCED,
1957 .label = "enable core files",
1959 .p_class = P_GLOBAL,
1960 .ptr = &Globals.bEnableCoreFiles,
1963 .flags = FLAG_ADVANCED,
1966 {N_("Protocol Options"), P_SEP, P_SEPARATOR},
1969 .label = "allocation roundup size",
1972 .ptr = &sDefault.iallocation_roundup_size,
1975 .flags = FLAG_ADVANCED,
1978 .label = "aio read size",
1981 .ptr = &sDefault.iAioReadSize,
1984 .flags = FLAG_ADVANCED,
1987 .label = "aio write size",
1990 .ptr = &sDefault.iAioWriteSize,
1993 .flags = FLAG_ADVANCED,
1996 .label = "aio write behind",
1999 .ptr = &sDefault.szAioWriteBehind,
2002 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2005 .label = "smb ports",
2007 .p_class = P_GLOBAL,
2008 .ptr = &Globals.smb_ports,
2011 .flags = FLAG_ADVANCED,
2014 .label = "large readwrite",
2016 .p_class = P_GLOBAL,
2017 .ptr = &Globals.bLargeReadwrite,
2020 .flags = FLAG_ADVANCED,
2023 .label = "max protocol",
2025 .p_class = P_GLOBAL,
2026 .ptr = &Globals.maxprotocol,
2028 .enum_list = enum_protocol,
2029 .flags = FLAG_ADVANCED,
2032 .label = "protocol",
2034 .p_class = P_GLOBAL,
2035 .ptr = &Globals.maxprotocol,
2037 .enum_list = enum_protocol,
2038 .flags = FLAG_ADVANCED,
2041 .label = "min protocol",
2043 .p_class = P_GLOBAL,
2044 .ptr = &Globals.minprotocol,
2046 .enum_list = enum_protocol,
2047 .flags = FLAG_ADVANCED,
2050 .label = "min receivefile size",
2052 .p_class = P_GLOBAL,
2053 .ptr = &Globals.iminreceivefile,
2056 .flags = FLAG_ADVANCED,
2059 .label = "read raw",
2061 .p_class = P_GLOBAL,
2062 .ptr = &Globals.bReadRaw,
2065 .flags = FLAG_ADVANCED,
2068 .label = "write raw",
2070 .p_class = P_GLOBAL,
2071 .ptr = &Globals.bWriteRaw,
2074 .flags = FLAG_ADVANCED,
2077 .label = "disable netbios",
2079 .p_class = P_GLOBAL,
2080 .ptr = &Globals.bDisableNetbios,
2083 .flags = FLAG_ADVANCED,
2086 .label = "reset on zero vc",
2088 .p_class = P_GLOBAL,
2089 .ptr = &Globals.bResetOnZeroVC,
2092 .flags = FLAG_ADVANCED,
2095 .label = "log writeable files on exit",
2097 .p_class = P_GLOBAL,
2098 .ptr = &Globals.bLogWriteableFilesOnExit,
2101 .flags = FLAG_ADVANCED,
2104 .label = "acl compatibility",
2106 .p_class = P_GLOBAL,
2107 .ptr = &Globals.iAclCompat,
2109 .enum_list = enum_acl_compat_vals,
2110 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2113 .label = "defer sharing violations",
2115 .p_class = P_GLOBAL,
2116 .ptr = &Globals.bDeferSharingViolations,
2119 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2122 .label = "ea support",
2125 .ptr = &sDefault.bEASupport,
2128 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2131 .label = "nt acl support",
2134 .ptr = &sDefault.bNTAclSupport,
2137 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2140 .label = "nt pipe support",
2142 .p_class = P_GLOBAL,
2143 .ptr = &Globals.bNTPipeSupport,
2146 .flags = FLAG_ADVANCED,
2149 .label = "nt status support",
2151 .p_class = P_GLOBAL,
2152 .ptr = &Globals.bNTStatusSupport,
2155 .flags = FLAG_ADVANCED,
2158 .label = "profile acls",
2161 .ptr = &sDefault.bProfileAcls,
2164 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
2167 .label = "announce version",
2169 .p_class = P_GLOBAL,
2170 .ptr = &Globals.szAnnounceVersion,
2173 .flags = FLAG_ADVANCED,
2176 .label = "announce as",
2178 .p_class = P_GLOBAL,
2179 .ptr = &Globals.announce_as,
2181 .enum_list = enum_announce_as,
2182 .flags = FLAG_ADVANCED,
2185 .label = "map acl inherit",
2188 .ptr = &sDefault.bMap_acl_inherit,
2191 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2194 .label = "afs share",
2197 .ptr = &sDefault.bAfs_Share,
2200 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2205 .p_class = P_GLOBAL,
2206 .ptr = &Globals.max_mux,
2209 .flags = FLAG_ADVANCED,
2212 .label = "max xmit",
2214 .p_class = P_GLOBAL,
2215 .ptr = &Globals.max_xmit,
2218 .flags = FLAG_ADVANCED,
2221 .label = "name resolve order",
2223 .p_class = P_GLOBAL,
2224 .ptr = &Globals.szNameResolveOrder,
2227 .flags = FLAG_ADVANCED | FLAG_WIZARD,
2232 .p_class = P_GLOBAL,
2233 .ptr = &Globals.max_ttl,
2236 .flags = FLAG_ADVANCED,
2239 .label = "max wins ttl",
2241 .p_class = P_GLOBAL,
2242 .ptr = &Globals.max_wins_ttl,
2245 .flags = FLAG_ADVANCED,
2248 .label = "min wins ttl",
2250 .p_class = P_GLOBAL,
2251 .ptr = &Globals.min_wins_ttl,
2254 .flags = FLAG_ADVANCED,
2257 .label = "time server",
2259 .p_class = P_GLOBAL,
2260 .ptr = &Globals.bTimeServer,
2263 .flags = FLAG_ADVANCED,
2266 .label = "unix extensions",
2268 .p_class = P_GLOBAL,
2269 .ptr = &Globals.bUnixExtensions,
2272 .flags = FLAG_ADVANCED,
2275 .label = "use spnego",
2277 .p_class = P_GLOBAL,
2278 .ptr = &Globals.bUseSpnego,
2281 .flags = FLAG_ADVANCED,
2284 .label = "client signing",
2286 .p_class = P_GLOBAL,
2287 .ptr = &Globals.client_signing,
2289 .enum_list = enum_smb_signing_vals,
2290 .flags = FLAG_ADVANCED,
2293 .label = "server signing",
2295 .p_class = P_GLOBAL,
2296 .ptr = &Globals.server_signing,
2298 .enum_list = enum_smb_signing_vals,
2299 .flags = FLAG_ADVANCED,
2302 .label = "smb encrypt",
2305 .ptr = &sDefault.ismb_encrypt,
2307 .enum_list = enum_smb_signing_vals,
2308 .flags = FLAG_ADVANCED,
2311 .label = "client use spnego",
2313 .p_class = P_GLOBAL,
2314 .ptr = &Globals.bClientUseSpnego,
2317 .flags = FLAG_ADVANCED,
2320 .label = "client ldap sasl wrapping",
2322 .p_class = P_GLOBAL,
2323 .ptr = &Globals.client_ldap_sasl_wrapping,
2325 .enum_list = enum_ldap_sasl_wrapping,
2326 .flags = FLAG_ADVANCED,
2329 .label = "enable asu support",
2331 .p_class = P_GLOBAL,
2332 .ptr = &Globals.bASUSupport,
2335 .flags = FLAG_ADVANCED,
2338 .label = "svcctl list",
2340 .p_class = P_GLOBAL,
2341 .ptr = &Globals.szServicesList,
2344 .flags = FLAG_ADVANCED,
2347 {N_("Tuning Options"), P_SEP, P_SEPARATOR},
2350 .label = "block size",
2353 .ptr = &sDefault.iBlock_size,
2356 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2359 .label = "deadtime",
2361 .p_class = P_GLOBAL,
2362 .ptr = &Globals.deadtime,
2365 .flags = FLAG_ADVANCED,
2368 .label = "getwd cache",
2370 .p_class = P_GLOBAL,
2371 .ptr = &Globals.getwd_cache,
2374 .flags = FLAG_ADVANCED,
2377 .label = "keepalive",
2379 .p_class = P_GLOBAL,
2380 .ptr = &Globals.iKeepalive,
2383 .flags = FLAG_ADVANCED,
2386 .label = "change notify",
2389 .ptr = &sDefault.bChangeNotify,
2392 .flags = FLAG_ADVANCED | FLAG_SHARE,
2395 .label = "directory name cache size",
2398 .ptr = &sDefault.iDirectoryNameCacheSize,
2401 .flags = FLAG_ADVANCED | FLAG_SHARE,
2404 .label = "kernel change notify",
2407 .ptr = &sDefault.bKernelChangeNotify,
2410 .flags = FLAG_ADVANCED | FLAG_SHARE,
2413 .label = "lpq cache time",
2415 .p_class = P_GLOBAL,
2416 .ptr = &Globals.lpqcachetime,
2419 .flags = FLAG_ADVANCED,
2422 .label = "max smbd processes",
2424 .p_class = P_GLOBAL,
2425 .ptr = &Globals.iMaxSmbdProcesses,
2428 .flags = FLAG_ADVANCED,
2431 .label = "max connections",
2434 .ptr = &sDefault.iMaxConnections,
2437 .flags = FLAG_ADVANCED | FLAG_SHARE,
2440 .label = "paranoid server security",
2442 .p_class = P_GLOBAL,
2443 .ptr = &Globals.paranoid_server_security,
2446 .flags = FLAG_ADVANCED,
2449 .label = "max disk size",
2451 .p_class = P_GLOBAL,
2452 .ptr = &Globals.maxdisksize,
2455 .flags = FLAG_ADVANCED,
2458 .label = "max open files",
2460 .p_class = P_GLOBAL,
2461 .ptr = &Globals.max_open_files,
2464 .flags = FLAG_ADVANCED,
2467 .label = "min print space",
2470 .ptr = &sDefault.iMinPrintSpace,
2473 .flags = FLAG_ADVANCED | FLAG_PRINT,
2476 .label = "socket options",
2478 .p_class = P_GLOBAL,
2479 .ptr = &Globals.szSocketOptions,
2482 .flags = FLAG_ADVANCED,
2485 .label = "strict allocate",
2488 .ptr = &sDefault.bStrictAllocate,
2491 .flags = FLAG_ADVANCED | FLAG_SHARE,
2494 .label = "strict sync",
2497 .ptr = &sDefault.bStrictSync,
2500 .flags = FLAG_ADVANCED | FLAG_SHARE,
2503 .label = "sync always",
2506 .ptr = &sDefault.bSyncAlways,
2509 .flags = FLAG_ADVANCED | FLAG_SHARE,
2512 .label = "use mmap",
2514 .p_class = P_GLOBAL,
2515 .ptr = &Globals.bUseMmap,
2518 .flags = FLAG_ADVANCED,
2521 .label = "use sendfile",
2524 .ptr = &sDefault.bUseSendfile,
2527 .flags = FLAG_ADVANCED | FLAG_SHARE,
2530 .label = "hostname lookups",
2532 .p_class = P_GLOBAL,
2533 .ptr = &Globals.bHostnameLookups,
2536 .flags = FLAG_ADVANCED,
2539 .label = "write cache size",
2542 .ptr = &sDefault.iWriteCacheSize,
2545 .flags = FLAG_ADVANCED | FLAG_SHARE,
2548 .label = "name cache timeout",
2550 .p_class = P_GLOBAL,
2551 .ptr = &Globals.name_cache_timeout,
2554 .flags = FLAG_ADVANCED,
2557 .label = "ctdbd socket",
2559 .p_class = P_GLOBAL,
2560 .ptr = &Globals.ctdbdSocket,
2563 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2566 .label = "cluster addresses",
2568 .p_class = P_GLOBAL,
2569 .ptr = &Globals.szClusterAddresses,
2572 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2575 .label = "clustering",
2577 .p_class = P_GLOBAL,
2578 .ptr = &Globals.clustering,
2581 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2584 .label = "ctdb timeout",
2586 .p_class = P_GLOBAL,
2587 .ptr = &Globals.ctdb_timeout,
2590 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2593 .label = "ctdb locktime warn threshold",
2595 .p_class = P_GLOBAL,
2596 .ptr = &Globals.ctdb_locktime_warn_threshold,
2599 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2602 .label = "smb2 max read",
2604 .p_class = P_GLOBAL,
2605 .ptr = &Globals.ismb2_max_read,
2608 .flags = FLAG_ADVANCED,
2611 .label = "smb2 max write",
2613 .p_class = P_GLOBAL,
2614 .ptr = &Globals.ismb2_max_write,
2617 .flags = FLAG_ADVANCED,
2620 .label = "smb2 max trans",
2622 .p_class = P_GLOBAL,
2623 .ptr = &Globals.ismb2_max_trans,
2626 .flags = FLAG_ADVANCED,
2629 {N_("Printing Options"), P_SEP, P_SEPARATOR},
2632 .label = "max reported print jobs",
2635 .ptr = &sDefault.iMaxReportedPrintJobs,
2638 .flags = FLAG_ADVANCED | FLAG_PRINT,
2641 .label = "max print jobs",
2644 .ptr = &sDefault.iMaxPrintJobs,
2647 .flags = FLAG_ADVANCED | FLAG_PRINT,
2650 .label = "load printers",
2652 .p_class = P_GLOBAL,
2653 .ptr = &Globals.bLoadPrinters,
2656 .flags = FLAG_ADVANCED | FLAG_PRINT,
2659 .label = "printcap cache time",
2661 .p_class = P_GLOBAL,
2662 .ptr = &Globals.PrintcapCacheTime,
2665 .flags = FLAG_ADVANCED | FLAG_PRINT,
2668 .label = "printcap name",
2670 .p_class = P_GLOBAL,
2671 .ptr = &Globals.szPrintcapname,
2674 .flags = FLAG_ADVANCED | FLAG_PRINT,
2677 .label = "printcap",
2679 .p_class = P_GLOBAL,
2680 .ptr = &Globals.szPrintcapname,
2686 .label = "printable",
2689 .ptr = &sDefault.bPrint_ok,
2692 .flags = FLAG_ADVANCED | FLAG_PRINT,
2695 .label = "print ok",
2698 .ptr = &sDefault.bPrint_ok,
2704 .label = "printing",
2707 .ptr = &sDefault.iPrinting,
2708 .special = handle_printing,
2709 .enum_list = enum_printing,
2710 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2713 .label = "cups options",
2716 .ptr = &sDefault.szCupsOptions,
2719 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2722 .label = "cups server",
2724 .p_class = P_GLOBAL,
2725 .ptr = &Globals.szCupsServer,
2728 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2731 .label = "cups encrypt",
2733 .p_class = P_GLOBAL,
2734 .ptr = &Globals.CupsEncrypt,
2736 .enum_list = enum_bool_auto,
2737 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2741 .label = "cups connection timeout",
2743 .p_class = P_GLOBAL,
2744 .ptr = &Globals.cups_connection_timeout,
2747 .flags = FLAG_ADVANCED,
2750 .label = "iprint server",
2752 .p_class = P_GLOBAL,
2753 .ptr = &Globals.szIPrintServer,
2756 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2759 .label = "print command",
2762 .ptr = &sDefault.szPrintcommand,
2765 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2768 .label = "disable spoolss",
2770 .p_class = P_GLOBAL,
2771 .ptr = &Globals.bDisableSpoolss,
2774 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2777 .label = "enable spoolss",
2779 .p_class = P_GLOBAL,
2780 .ptr = &Globals.bDisableSpoolss,
2786 .label = "lpq command",
2789 .ptr = &sDefault.szLpqcommand,
2792 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2795 .label = "lprm command",
2798 .ptr = &sDefault.szLprmcommand,
2801 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2804 .label = "lppause command",
2807 .ptr = &sDefault.szLppausecommand,
2810 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2813 .label = "lpresume command",
2816 .ptr = &sDefault.szLpresumecommand,
2819 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2822 .label = "queuepause command",
2825 .ptr = &sDefault.szQueuepausecommand,
2828 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2831 .label = "queueresume command",
2834 .ptr = &sDefault.szQueueresumecommand,
2837 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2840 .label = "addport command",
2842 .p_class = P_GLOBAL,
2843 .ptr = &Globals.szAddPortCommand,
2846 .flags = FLAG_ADVANCED,
2849 .label = "enumports command",
2851 .p_class = P_GLOBAL,
2852 .ptr = &Globals.szEnumPortsCommand,
2855 .flags = FLAG_ADVANCED,
2858 .label = "addprinter command",
2860 .p_class = P_GLOBAL,
2861 .ptr = &Globals.szAddPrinterCommand,
2864 .flags = FLAG_ADVANCED,
2867 .label = "deleteprinter command",
2869 .p_class = P_GLOBAL,
2870 .ptr = &Globals.szDeletePrinterCommand,
2873 .flags = FLAG_ADVANCED,
2876 .label = "show add printer wizard",
2878 .p_class = P_GLOBAL,
2879 .ptr = &Globals.bMsAddPrinterWizard,
2882 .flags = FLAG_ADVANCED,
2885 .label = "os2 driver map",
2887 .p_class = P_GLOBAL,
2888 .ptr = &Globals.szOs2DriverMap,
2891 .flags = FLAG_ADVANCED,
2895 .label = "printer name",
2898 .ptr = &sDefault.szPrintername,
2901 .flags = FLAG_ADVANCED | FLAG_PRINT,
2907 .ptr = &sDefault.szPrintername,
2913 .label = "use client driver",
2916 .ptr = &sDefault.bUseClientDriver,
2919 .flags = FLAG_ADVANCED | FLAG_PRINT,
2922 .label = "default devmode",
2925 .ptr = &sDefault.bDefaultDevmode,
2928 .flags = FLAG_ADVANCED | FLAG_PRINT,
2931 .label = "force printername",
2934 .ptr = &sDefault.bForcePrintername,
2937 .flags = FLAG_ADVANCED | FLAG_PRINT,
2940 .label = "printjob username",
2943 .ptr = &sDefault.szPrintjobUsername,
2946 .flags = FLAG_ADVANCED | FLAG_PRINT,
2949 {N_("Filename Handling"), P_SEP, P_SEPARATOR},
2952 .label = "mangling method",
2954 .p_class = P_GLOBAL,
2955 .ptr = &Globals.szManglingMethod,
2958 .flags = FLAG_ADVANCED,
2961 .label = "mangle prefix",
2963 .p_class = P_GLOBAL,
2964 .ptr = &Globals.mangle_prefix,
2967 .flags = FLAG_ADVANCED,
2971 .label = "default case",
2974 .ptr = &sDefault.iDefaultCase,
2976 .enum_list = enum_case,
2977 .flags = FLAG_ADVANCED | FLAG_SHARE,
2980 .label = "case sensitive",
2983 .ptr = &sDefault.iCaseSensitive,
2985 .enum_list = enum_bool_auto,
2986 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2989 .label = "casesignames",
2992 .ptr = &sDefault.iCaseSensitive,
2994 .enum_list = enum_bool_auto,
2995 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_HIDE,
2998 .label = "preserve case",
3001 .ptr = &sDefault.bCasePreserve,
3004 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3007 .label = "short preserve case",
3010 .ptr = &sDefault.bShortCasePreserve,
3013 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3016 .label = "mangling char",
3019 .ptr = &sDefault.magic_char,
3022 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3025 .label = "hide dot files",
3028 .ptr = &sDefault.bHideDotFiles,
3031 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3034 .label = "hide special files",
3037 .ptr = &sDefault.bHideSpecialFiles,
3040 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3043 .label = "hide unreadable",
3046 .ptr = &sDefault.bHideUnReadable,
3049 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3052 .label = "hide unwriteable files",
3055 .ptr = &sDefault.bHideUnWriteableFiles,
3058 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3061 .label = "delete veto files",
3064 .ptr = &sDefault.bDeleteVetoFiles,
3067 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3070 .label = "veto files",
3073 .ptr = &sDefault.szVetoFiles,
3076 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3079 .label = "hide files",
3082 .ptr = &sDefault.szHideFiles,
3085 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3088 .label = "veto oplock files",
3091 .ptr = &sDefault.szVetoOplockFiles,
3094 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3097 .label = "map archive",
3100 .ptr = &sDefault.bMap_archive,
3103 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3106 .label = "map hidden",
3109 .ptr = &sDefault.bMap_hidden,
3112 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3115 .label = "map system",
3118 .ptr = &sDefault.bMap_system,
3121 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3124 .label = "map readonly",
3127 .ptr = &sDefault.iMap_readonly,
3129 .enum_list = enum_map_readonly,
3130 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3133 .label = "mangled names",
3136 .ptr = &sDefault.bMangledNames,
3139 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3142 .label = "max stat cache size",
3144 .p_class = P_GLOBAL,
3145 .ptr = &Globals.iMaxStatCacheSize,
3148 .flags = FLAG_ADVANCED,
3151 .label = "stat cache",
3153 .p_class = P_GLOBAL,
3154 .ptr = &Globals.bStatCache,
3157 .flags = FLAG_ADVANCED,
3160 .label = "store dos attributes",
3163 .ptr = &sDefault.bStoreDosAttributes,
3166 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3169 .label = "dmapi support",
3172 .ptr = &sDefault.bDmapiSupport,
3175 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3179 {N_("Domain Options"), P_SEP, P_SEPARATOR},
3182 .label = "machine password timeout",
3184 .p_class = P_GLOBAL,
3185 .ptr = &Globals.machine_password_timeout,
3188 .flags = FLAG_ADVANCED | FLAG_WIZARD,
3191 {N_("Logon Options"), P_SEP, P_SEPARATOR},
3194 .label = "add user script",
3196 .p_class = P_GLOBAL,
3197 .ptr = &Globals.szAddUserScript,
3200 .flags = FLAG_ADVANCED,
3203 .label = "rename user script",
3205 .p_class = P_GLOBAL,
3206 .ptr = &Globals.szRenameUserScript,
3209 .flags = FLAG_ADVANCED,
3212 .label = "delete user script",
3214 .p_class = P_GLOBAL,
3215 .ptr = &Globals.szDelUserScript,
3218 .flags = FLAG_ADVANCED,
3221 .label = "add group script",
3223 .p_class = P_GLOBAL,
3224 .ptr = &Globals.szAddGroupScript,
3227 .flags = FLAG_ADVANCED,
3230 .label = "delete group script",
3232 .p_class = P_GLOBAL,
3233 .ptr = &Globals.szDelGroupScript,
3236 .flags = FLAG_ADVANCED,
3239 .label = "add user to group script",
3241 .p_class = P_GLOBAL,
3242 .ptr = &Globals.szAddUserToGroupScript,
3245 .flags = FLAG_ADVANCED,
3248 .label = "delete user from group script",
3250 .p_class = P_GLOBAL,
3251 .ptr = &Globals.szDelUserFromGroupScript,
3254 .flags = FLAG_ADVANCED,
3257 .label = "set primary group script",
3259 .p_class = P_GLOBAL,
3260 .ptr = &Globals.szSetPrimaryGroupScript,
3263 .flags = FLAG_ADVANCED,
3266 .label = "add machine script",
3268 .p_class = P_GLOBAL,
3269 .ptr = &Globals.szAddMachineScript,
3272 .flags = FLAG_ADVANCED,
3275 .label = "shutdown script",
3277 .p_class = P_GLOBAL,
3278 .ptr = &Globals.szShutdownScript,
3281 .flags = FLAG_ADVANCED,
3284 .label = "abort shutdown script",
3286 .p_class = P_GLOBAL,
3287 .ptr = &Globals.szAbortShutdownScript,
3290 .flags = FLAG_ADVANCED,
3293 .label = "username map script",
3295 .p_class = P_GLOBAL,
3296 .ptr = &Globals.szUsernameMapScript,
3299 .flags = FLAG_ADVANCED,
3302 .label = "username map cache time",
3304 .p_class = P_GLOBAL,
3305 .ptr = &Globals.iUsernameMapCacheTime,
3308 .flags = FLAG_ADVANCED,
3311 .label = "logon script",
3313 .p_class = P_GLOBAL,
3314 .ptr = &Globals.szLogonScript,
3317 .flags = FLAG_ADVANCED,
3320 .label = "logon path",
3322 .p_class = P_GLOBAL,
3323 .ptr = &Globals.szLogonPath,
3326 .flags = FLAG_ADVANCED,
3329 .label = "logon drive",
3331 .p_class = P_GLOBAL,
3332 .ptr = &Globals.szLogonDrive,
3335 .flags = FLAG_ADVANCED,
3338 .label = "logon home",
3340 .p_class = P_GLOBAL,
3341 .ptr = &Globals.szLogonHome,
3344 .flags = FLAG_ADVANCED,
3347 .label = "domain logons",
3349 .p_class = P_GLOBAL,
3350 .ptr = &Globals.bDomainLogons,
3353 .flags = FLAG_ADVANCED,
3357 .label = "init logon delayed hosts",
3359 .p_class = P_GLOBAL,
3360 .ptr = &Globals.szInitLogonDelayedHosts,
3363 .flags = FLAG_ADVANCED,
3367 .label = "init logon delay",
3369 .p_class = P_GLOBAL,
3370 .ptr = &Globals.InitLogonDelay,
3373 .flags = FLAG_ADVANCED,
3377 {N_("Browse Options"), P_SEP, P_SEPARATOR},
3380 .label = "os level",
3382 .p_class = P_GLOBAL,
3383 .ptr = &Globals.os_level,
3386 .flags = FLAG_BASIC | FLAG_ADVANCED,
3389 .label = "lm announce",
3391 .p_class = P_GLOBAL,
3392 .ptr = &Globals.lm_announce,
3394 .enum_list = enum_bool_auto,
3395 .flags = FLAG_ADVANCED,
3398 .label = "lm interval",
3400 .p_class = P_GLOBAL,
3401 .ptr = &Globals.lm_interval,
3404 .flags = FLAG_ADVANCED,
3407 .label = "preferred master",
3409 .p_class = P_GLOBAL,
3410 .ptr = &Globals.iPreferredMaster,
3412 .enum_list = enum_bool_auto,
3413 .flags = FLAG_BASIC | FLAG_ADVANCED,
3416 .label = "prefered master",
3418 .p_class = P_GLOBAL,
3419 .ptr = &Globals.iPreferredMaster,
3421 .enum_list = enum_bool_auto,
3425 .label = "local master",
3427 .p_class = P_GLOBAL,
3428 .ptr = &Globals.bLocalMaster,
3431 .flags = FLAG_BASIC | FLAG_ADVANCED,
3434 .label = "domain master",
3436 .p_class = P_GLOBAL,
3437 .ptr = &Globals.iDomainMaster,
3439 .enum_list = enum_bool_auto,
3440 .flags = FLAG_BASIC | FLAG_ADVANCED,
3443 .label = "browse list",
3445 .p_class = P_GLOBAL,
3446 .ptr = &Globals.bBrowseList,
3449 .flags = FLAG_ADVANCED,
3452 .label = "browseable",
3455 .ptr = &sDefault.bBrowseable,
3458 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3461 .label = "browsable",
3464 .ptr = &sDefault.bBrowseable,
3470 .label = "access based share enum",
3473 .ptr = &sDefault.bAccessBasedShareEnum,
3476 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE
3479 .label = "enhanced browsing",
3481 .p_class = P_GLOBAL,
3482 .ptr = &Globals.enhanced_browsing,
3485 .flags = FLAG_ADVANCED,
3488 {N_("WINS Options"), P_SEP, P_SEPARATOR},
3491 .label = "dns proxy",
3493 .p_class = P_GLOBAL,
3494 .ptr = &Globals.bDNSproxy,
3497 .flags = FLAG_ADVANCED,
3500 .label = "wins proxy",
3502 .p_class = P_GLOBAL,
3503 .ptr = &Globals.bWINSproxy,
3506 .flags = FLAG_ADVANCED,
3509 .label = "wins server",
3511 .p_class = P_GLOBAL,
3512 .ptr = &Globals.szWINSservers,
3515 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3518 .label = "wins support",
3520 .p_class = P_GLOBAL,
3521 .ptr = &Globals.bWINSsupport,
3524 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3527 .label = "wins hook",
3529 .p_class = P_GLOBAL,
3530 .ptr = &Globals.szWINSHook,
3533 .flags = FLAG_ADVANCED,
3536 {N_("Locking Options"), P_SEP, P_SEPARATOR},
3539 .label = "blocking locks",
3542 .ptr = &sDefault.bBlockingLocks,
3545 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3548 .label = "csc policy",
3551 .ptr = &sDefault.iCSCPolicy,
3553 .enum_list = enum_csc_policy,
3554 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3557 .label = "fake oplocks",
3560 .ptr = &sDefault.bFakeOplocks,
3563 .flags = FLAG_ADVANCED | FLAG_SHARE,
3566 .label = "kernel oplocks",
3568 .p_class = P_GLOBAL,
3569 .ptr = &Globals.bKernelOplocks,
3572 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3578 .ptr = &sDefault.bLocking,
3581 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3584 .label = "lock spin time",
3586 .p_class = P_GLOBAL,
3587 .ptr = &Globals.iLockSpinTime,
3590 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3596 .ptr = &sDefault.bOpLocks,
3599 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3602 .label = "level2 oplocks",
3605 .ptr = &sDefault.bLevel2OpLocks,
3608 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3611 .label = "oplock break wait time",
3613 .p_class = P_GLOBAL,
3614 .ptr = &Globals.oplock_break_wait_time,
3617 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3620 .label = "oplock contention limit",
3623 .ptr = &sDefault.iOplockContentionLimit,
3626 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3629 .label = "posix locking",
3632 .ptr = &sDefault.bPosixLocking,
3635 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3638 .label = "strict locking",
3641 .ptr = &sDefault.iStrictLocking,
3643 .enum_list = enum_bool_auto,
3644 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3647 .label = "share modes",
3650 .ptr = &sDefault.bShareModes,
3653 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_DEPRECATED,
3656 {N_("Ldap Options"), P_SEP, P_SEPARATOR},
3659 .label = "ldap admin dn",
3661 .p_class = P_GLOBAL,
3662 .ptr = &Globals.szLdapAdminDn,
3665 .flags = FLAG_ADVANCED,
3668 .label = "ldap delete dn",
3670 .p_class = P_GLOBAL,
3671 .ptr = &Globals.ldap_delete_dn,
3674 .flags = FLAG_ADVANCED,
3677 .label = "ldap group suffix",
3679 .p_class = P_GLOBAL,
3680 .ptr = &Globals.szLdapGroupSuffix,
3683 .flags = FLAG_ADVANCED,
3686 .label = "ldap idmap suffix",
3688 .p_class = P_GLOBAL,
3689 .ptr = &Globals.szLdapIdmapSuffix,
3692 .flags = FLAG_ADVANCED,
3695 .label = "ldap machine suffix",
3697 .p_class = P_GLOBAL,
3698 .ptr = &Globals.szLdapMachineSuffix,
3701 .flags = FLAG_ADVANCED,
3704 .label = "ldap passwd sync",
3706 .p_class = P_GLOBAL,
3707 .ptr = &Globals.ldap_passwd_sync,
3709 .enum_list = enum_ldap_passwd_sync,
3710 .flags = FLAG_ADVANCED,
3713 .label = "ldap password sync",
3715 .p_class = P_GLOBAL,
3716 .ptr = &Globals.ldap_passwd_sync,
3718 .enum_list = enum_ldap_passwd_sync,
3722 .label = "ldap replication sleep",
3724 .p_class = P_GLOBAL,
3725 .ptr = &Globals.ldap_replication_sleep,
3728 .flags = FLAG_ADVANCED,
3731 .label = "ldap suffix",
3733 .p_class = P_GLOBAL,
3734 .ptr = &Globals.szLdapSuffix,
3737 .flags = FLAG_ADVANCED,
3740 .label = "ldap ssl",
3742 .p_class = P_GLOBAL,
3743 .ptr = &Globals.ldap_ssl,
3745 .enum_list = enum_ldap_ssl,
3746 .flags = FLAG_ADVANCED,
3749 .label = "ldap ssl ads",
3751 .p_class = P_GLOBAL,
3752 .ptr = &Globals.ldap_ssl_ads,
3755 .flags = FLAG_ADVANCED,
3758 .label = "ldap deref",
3760 .p_class = P_GLOBAL,
3761 .ptr = &Globals.ldap_deref,
3763 .enum_list = enum_ldap_deref,
3764 .flags = FLAG_ADVANCED,
3767 .label = "ldap follow referral",
3769 .p_class = P_GLOBAL,
3770 .ptr = &Globals.ldap_follow_referral,
3772 .enum_list = enum_bool_auto,
3773 .flags = FLAG_ADVANCED,
3776 .label = "ldap timeout",
3778 .p_class = P_GLOBAL,
3779 .ptr = &Globals.ldap_timeout,
3782 .flags = FLAG_ADVANCED,
3785 .label = "ldap connection timeout",
3787 .p_class = P_GLOBAL,
3788 .ptr = &Globals.ldap_connection_timeout,
3791 .flags = FLAG_ADVANCED,
3794 .label = "ldap page size",
3796 .p_class = P_GLOBAL,
3797 .ptr = &Globals.ldap_page_size,
3800 .flags = FLAG_ADVANCED,
3803 .label = "ldap user suffix",
3805 .p_class = P_GLOBAL,
3806 .ptr = &Globals.szLdapUserSuffix,
3809 .flags = FLAG_ADVANCED,
3812 .label = "ldap debug level",
3814 .p_class = P_GLOBAL,
3815 .ptr = &Globals.ldap_debug_level,
3816 .special = handle_ldap_debug_level,
3818 .flags = FLAG_ADVANCED,
3821 .label = "ldap debug threshold",
3823 .p_class = P_GLOBAL,
3824 .ptr = &Globals.ldap_debug_threshold,
3827 .flags = FLAG_ADVANCED,
3830 {N_("EventLog Options"), P_SEP, P_SEPARATOR},
3833 .label = "eventlog list",
3835 .p_class = P_GLOBAL,
3836 .ptr = &Globals.szEventLogs,
3839 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
3842 {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
3845 .label = "add share command",
3847 .p_class = P_GLOBAL,
3848 .ptr = &Globals.szAddShareCommand,
3851 .flags = FLAG_ADVANCED,
3854 .label = "change share command",
3856 .p_class = P_GLOBAL,
3857 .ptr = &Globals.szChangeShareCommand,
3860 .flags = FLAG_ADVANCED,
3863 .label = "delete share command",
3865 .p_class = P_GLOBAL,
3866 .ptr = &Globals.szDeleteShareCommand,
3869 .flags = FLAG_ADVANCED,
3872 .label = "config file",
3874 .p_class = P_GLOBAL,
3875 .ptr = &Globals.szConfigFile,
3878 .flags = FLAG_HIDE|FLAG_META,
3883 .p_class = P_GLOBAL,
3884 .ptr = &Globals.szAutoServices,
3887 .flags = FLAG_ADVANCED,
3890 .label = "auto services",
3892 .p_class = P_GLOBAL,
3893 .ptr = &Globals.szAutoServices,
3896 .flags = FLAG_ADVANCED,
3899 .label = "lock directory",
3901 .p_class = P_GLOBAL,
3902 .ptr = &Globals.szLockDir,
3905 .flags = FLAG_ADVANCED,
3908 .label = "lock dir",
3910 .p_class = P_GLOBAL,
3911 .ptr = &Globals.szLockDir,
3917 .label = "state directory",
3919 .p_class = P_GLOBAL,
3920 .ptr = &Globals.szStateDir,
3923 .flags = FLAG_ADVANCED,
3926 .label = "cache directory",
3928 .p_class = P_GLOBAL,
3929 .ptr = &Globals.szCacheDir,
3932 .flags = FLAG_ADVANCED,
3935 .label = "pid directory",
3937 .p_class = P_GLOBAL,
3938 .ptr = &Globals.szPidDir,
3941 .flags = FLAG_ADVANCED,
3945 .label = "utmp directory",
3947 .p_class = P_GLOBAL,
3948 .ptr = &Globals.szUtmpDir,
3951 .flags = FLAG_ADVANCED,
3954 .label = "wtmp directory",
3956 .p_class = P_GLOBAL,
3957 .ptr = &Globals.szWtmpDir,
3960 .flags = FLAG_ADVANCED,
3965 .p_class = P_GLOBAL,
3966 .ptr = &Globals.bUtmp,
3969 .flags = FLAG_ADVANCED,
3973 .label = "default service",
3975 .p_class = P_GLOBAL,
3976 .ptr = &Globals.szDefaultService,
3979 .flags = FLAG_ADVANCED,
3984 .p_class = P_GLOBAL,
3985 .ptr = &Globals.szDefaultService,
3988 .flags = FLAG_ADVANCED,
3991 .label = "message command",
3993 .p_class = P_GLOBAL,
3994 .ptr = &Globals.szMsgCommand,
3997 .flags = FLAG_ADVANCED,
4000 .label = "dfree cache time",
4003 .ptr = &sDefault.iDfreeCacheTime,
4006 .flags = FLAG_ADVANCED,
4009 .label = "dfree command",
4012 .ptr = &sDefault.szDfree,
4015 .flags = FLAG_ADVANCED,
4018 .label = "get quota command",
4020 .p_class = P_GLOBAL,
4021 .ptr = &Globals.szGetQuota,
4024 .flags = FLAG_ADVANCED,
4027 .label = "set quota command",
4029 .p_class = P_GLOBAL,
4030 .ptr = &Globals.szSetQuota,
4033 .flags = FLAG_ADVANCED,
4036 .label = "remote announce",
4038 .p_class = P_GLOBAL,
4039 .ptr = &Globals.szRemoteAnnounce,
4042 .flags = FLAG_ADVANCED,
4045 .label = "remote browse sync",
4047 .p_class = P_GLOBAL,
4048 .ptr = &Globals.szRemoteBrowseSync,
4051 .flags = FLAG_ADVANCED,
4054 .label = "socket address",
4056 .p_class = P_GLOBAL,
4057 .ptr = &Globals.szSocketAddress,
4060 .flags = FLAG_ADVANCED,
4063 .label = "nmbd bind explicit broadcast",
4065 .p_class = P_GLOBAL,
4066 .ptr = &Globals.bNmbdBindExplicitBroadcast,
4069 .flags = FLAG_ADVANCED,
4072 .label = "homedir map",
4074 .p_class = P_GLOBAL,
4075 .ptr = &Globals.szNISHomeMapName,
4078 .flags = FLAG_ADVANCED,
4081 .label = "afs username map",
4083 .p_class = P_GLOBAL,
4084 .ptr = &Globals.szAfsUsernameMap,
4087 .flags = FLAG_ADVANCED,
4090 .label = "afs token lifetime",
4092 .p_class = P_GLOBAL,
4093 .ptr = &Globals.iAfsTokenLifetime,
4096 .flags = FLAG_ADVANCED,
4099 .label = "log nt token command",
4101 .p_class = P_GLOBAL,
4102 .ptr = &Globals.szLogNtTokenCommand,
4105 .flags = FLAG_ADVANCED,
4108 .label = "time offset",
4110 .p_class = P_GLOBAL,
4111 .ptr = &extra_time_offset,
4114 .flags = FLAG_ADVANCED,
4117 .label = "NIS homedir",
4119 .p_class = P_GLOBAL,
4120 .ptr = &Globals.bNISHomeMap,
4123 .flags = FLAG_ADVANCED,
4129 .ptr = &sDefault.valid,
4138 .ptr = &sDefault.szCopy,
4139 .special = handle_copy,
4147 .ptr = &sDefault.szInclude,
4148 .special = handle_include,
4150 .flags = FLAG_HIDE|FLAG_META,
4156 .ptr = &sDefault.szPreExec,
4159 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4165 .ptr = &sDefault.szPreExec,
4168 .flags = FLAG_ADVANCED,
4171 .label = "preexec close",
4174 .ptr = &sDefault.bPreexecClose,
4177 .flags = FLAG_ADVANCED | FLAG_SHARE,
4180 .label = "postexec",
4183 .ptr = &sDefault.szPostExec,
4186 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4189 .label = "root preexec",
4192 .ptr = &sDefault.szRootPreExec,
4195 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4198 .label = "root preexec close",
4201 .ptr = &sDefault.bRootpreexecClose,
4204 .flags = FLAG_ADVANCED | FLAG_SHARE,
4207 .label = "root postexec",
4210 .ptr = &sDefault.szRootPostExec,
4213 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4216 .label = "available",
4219 .ptr = &sDefault.bAvailable,
4222 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4225 .label = "registry shares",
4227 .p_class = P_GLOBAL,
4228 .ptr = &Globals.bRegistryShares,
4231 .flags = FLAG_ADVANCED,
4234 .label = "usershare allow guests",
4236 .p_class = P_GLOBAL,
4237 .ptr = &Globals.bUsershareAllowGuests,
4240 .flags = FLAG_ADVANCED,
4243 .label = "usershare max shares",
4245 .p_class = P_GLOBAL,
4246 .ptr = &Globals.iUsershareMaxShares,
4249 .flags = FLAG_ADVANCED,
4252 .label = "usershare owner only",
4254 .p_class = P_GLOBAL,
4255 .ptr = &Globals.bUsershareOwnerOnly,
4258 .flags = FLAG_ADVANCED,
4261 .label = "usershare path",
4263 .p_class = P_GLOBAL,
4264 .ptr = &Globals.szUsersharePath,
4267 .flags = FLAG_ADVANCED,
4270 .label = "usershare prefix allow list",
4272 .p_class = P_GLOBAL,
4273 .ptr = &Globals.szUsersharePrefixAllowList,
4276 .flags = FLAG_ADVANCED,
4279 .label = "usershare prefix deny list",
4281 .p_class = P_GLOBAL,
4282 .ptr = &Globals.szUsersharePrefixDenyList,
4285 .flags = FLAG_ADVANCED,
4288 .label = "usershare template share",
4290 .p_class = P_GLOBAL,
4291 .ptr = &Globals.szUsershareTemplateShare,
4294 .flags = FLAG_ADVANCED,
4300 .ptr = &sDefault.volume,
4303 .flags = FLAG_ADVANCED | FLAG_SHARE,
4309 .ptr = &sDefault.fstype,
4312 .flags = FLAG_ADVANCED | FLAG_SHARE,
4315 .label = "set directory",
4318 .ptr = &sDefault.bNo_set_dir,
4321 .flags = FLAG_ADVANCED | FLAG_SHARE,
4324 .label = "wide links",
4327 .ptr = &sDefault.bWidelinks,
4330 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4333 .label = "follow symlinks",
4336 .ptr = &sDefault.bSymlinks,
4339 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4342 .label = "dont descend",
4345 .ptr = &sDefault.szDontdescend,
4348 .flags = FLAG_ADVANCED | FLAG_SHARE,
4351 .label = "magic script",
4354 .ptr = &sDefault.szMagicScript,
4357 .flags = FLAG_ADVANCED | FLAG_SHARE,
4360 .label = "magic output",
4363 .ptr = &sDefault.szMagicOutput,
4366 .flags = FLAG_ADVANCED | FLAG_SHARE,
4369 .label = "delete readonly",
4372 .ptr = &sDefault.bDeleteReadonly,
4375 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4378 .label = "dos filemode",
4381 .ptr = &sDefault.bDosFilemode,
4384 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4387 .label = "dos filetimes",
4390 .ptr = &sDefault.bDosFiletimes,
4393 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4396 .label = "dos filetime resolution",
4399 .ptr = &sDefault.bDosFiletimeResolution,
4402 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4405 .label = "fake directory create times",
4408 .ptr = &sDefault.bFakeDirCreateTimes,
4411 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4414 .label = "async smb echo handler",
4416 .p_class = P_GLOBAL,
4417 .ptr = &Globals.bAsyncSMBEchoHandler,
4420 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4423 .label = "multicast dns register",
4425 .p_class = P_GLOBAL,
4426 .ptr = &Globals.bMulticastDnsRegister,
4429 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4432 .label = "panic action",
4434 .p_class = P_GLOBAL,
4435 .ptr = &Globals.szPanicAction,
4438 .flags = FLAG_ADVANCED,
4441 .label = "perfcount module",
4443 .p_class = P_GLOBAL,
4444 .ptr = &Globals.szSMBPerfcountModule,
4447 .flags = FLAG_ADVANCED,
4450 {N_("VFS module options"), P_SEP, P_SEPARATOR},
4453 .label = "vfs objects",
4456 .ptr = &sDefault.szVfsObjects,
4459 .flags = FLAG_ADVANCED | FLAG_SHARE,
4462 .label = "vfs object",
4465 .ptr = &sDefault.szVfsObjects,
4472 {N_("MSDFS options"), P_SEP, P_SEPARATOR},
4475 .label = "msdfs root",
4478 .ptr = &sDefault.bMSDfsRoot,
4481 .flags = FLAG_ADVANCED | FLAG_SHARE,
4484 .label = "msdfs proxy",
4487 .ptr = &sDefault.szMSDfsProxy,
4490 .flags = FLAG_ADVANCED | FLAG_SHARE,
4493 .label = "host msdfs",
4495 .p_class = P_GLOBAL,
4496 .ptr = &Globals.bHostMSDfs,
4499 .flags = FLAG_ADVANCED,
4502 {N_("Winbind options"), P_SEP, P_SEPARATOR},
4505 .label = "passdb expand explicit",
4507 .p_class = P_GLOBAL,
4508 .ptr = &Globals.bPassdbExpandExplicit,
4511 .flags = FLAG_ADVANCED,
4514 .label = "idmap backend",
4516 .p_class = P_GLOBAL,
4517 .ptr = &Globals.szIdmapBackend,
4520 .flags = FLAG_ADVANCED,
4523 .label = "idmap read only",
4525 .p_class = P_GLOBAL,
4526 .ptr = &Globals.bIdmapReadOnly,
4529 .flags = FLAG_ADVANCED,
4532 .label = "idmap cache time",
4534 .p_class = P_GLOBAL,
4535 .ptr = &Globals.iIdmapCacheTime,
4538 .flags = FLAG_ADVANCED,
4541 .label = "idmap negative cache time",
4543 .p_class = P_GLOBAL,
4544 .ptr = &Globals.iIdmapNegativeCacheTime,
4547 .flags = FLAG_ADVANCED,
4550 .label = "idmap uid",
4552 .p_class = P_GLOBAL,
4553 .ptr = &Globals.szIdmapUID,
4554 .special = handle_idmap_uid,
4556 .flags = FLAG_ADVANCED,
4559 .label = "winbind uid",
4561 .p_class = P_GLOBAL,
4562 .ptr = &Globals.szIdmapUID,
4563 .special = handle_idmap_uid,
4568 .label = "idmap gid",
4570 .p_class = P_GLOBAL,
4571 .ptr = &Globals.szIdmapGID,
4572 .special = handle_idmap_gid,
4574 .flags = FLAG_ADVANCED,
4577 .label = "winbind gid",
4579 .p_class = P_GLOBAL,
4580 .ptr = &Globals.szIdmapGID,
4581 .special = handle_idmap_gid,
4586 .label = "template homedir",
4588 .p_class = P_GLOBAL,
4589 .ptr = &Globals.szTemplateHomedir,
4592 .flags = FLAG_ADVANCED,
4595 .label = "template shell",
4597 .p_class = P_GLOBAL,
4598 .ptr = &Globals.szTemplateShell,
4601 .flags = FLAG_ADVANCED,
4604 .label = "winbind separator",
4606 .p_class = P_GLOBAL,
4607 .ptr = &Globals.szWinbindSeparator,
4610 .flags = FLAG_ADVANCED,
4613 .label = "winbind cache time",
4615 .p_class = P_GLOBAL,
4616 .ptr = &Globals.winbind_cache_time,
4619 .flags = FLAG_ADVANCED,
4622 .label = "winbind reconnect delay",
4624 .p_class = P_GLOBAL,
4625 .ptr = &Globals.winbind_reconnect_delay,
4628 .flags = FLAG_ADVANCED,
4631 .label = "winbind max clients",
4633 .p_class = P_GLOBAL,
4634 .ptr = &Globals.winbind_max_clients,
4637 .flags = FLAG_ADVANCED,
4640 .label = "winbind enum users",
4642 .p_class = P_GLOBAL,
4643 .ptr = &Globals.bWinbindEnumUsers,
4646 .flags = FLAG_ADVANCED,
4649 .label = "winbind enum groups",
4651 .p_class = P_GLOBAL,
4652 .ptr = &Globals.bWinbindEnumGroups,
4655 .flags = FLAG_ADVANCED,
4658 .label = "winbind use default domain",
4660 .p_class = P_GLOBAL,
4661 .ptr = &Globals.bWinbindUseDefaultDomain,
4664 .flags = FLAG_ADVANCED,
4667 .label = "winbind trusted domains only",
4669 .p_class = P_GLOBAL,
4670 .ptr = &Globals.bWinbindTrustedDomainsOnly,
4673 .flags = FLAG_ADVANCED,
4676 .label = "winbind nested groups",
4678 .p_class = P_GLOBAL,
4679 .ptr = &Globals.bWinbindNestedGroups,
4682 .flags = FLAG_ADVANCED,
4685 .label = "winbind expand groups",
4687 .p_class = P_GLOBAL,
4688 .ptr = &Globals.winbind_expand_groups,
4691 .flags = FLAG_ADVANCED,
4694 .label = "winbind nss info",
4696 .p_class = P_GLOBAL,
4697 .ptr = &Globals.szWinbindNssInfo,
4700 .flags = FLAG_ADVANCED,
4703 .label = "winbind refresh tickets",
4705 .p_class = P_GLOBAL,
4706 .ptr = &Globals.bWinbindRefreshTickets,
4709 .flags = FLAG_ADVANCED,
4712 .label = "winbind offline logon",
4714 .p_class = P_GLOBAL,
4715 .ptr = &Globals.bWinbindOfflineLogon,
4718 .flags = FLAG_ADVANCED,
4721 .label = "winbind normalize names",
4723 .p_class = P_GLOBAL,
4724 .ptr = &Globals.bWinbindNormalizeNames,
4727 .flags = FLAG_ADVANCED,
4730 .label = "winbind rpc only",
4732 .p_class = P_GLOBAL,
4733 .ptr = &Globals.bWinbindRpcOnly,
4736 .flags = FLAG_ADVANCED,
4739 .label = "create krb5 conf",
4741 .p_class = P_GLOBAL,
4742 .ptr = &Globals.bCreateKrb5Conf,
4745 .flags = FLAG_ADVANCED,
4748 .label = "ncalrpc dir",
4750 .p_class = P_GLOBAL,
4751 .ptr = &Globals.ncalrpc_dir,
4754 .flags = FLAG_ADVANCED,
4757 {NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
4760 /***************************************************************************
4761 Initialise the sDefault parameter structure for the printer values.
4762 ***************************************************************************/
4764 static void init_printer_values(struct service *pService)
4766 /* choose defaults depending on the type of printing */
4767 switch (pService->iPrinting) {
4772 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4773 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4774 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4779 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4780 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4781 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4782 string_set(&pService->szQueuepausecommand, "lpc stop '%p'");
4783 string_set(&pService->szQueueresumecommand, "lpc start '%p'");
4784 string_set(&pService->szLppausecommand, "lpc hold '%p' %j");
4785 string_set(&pService->szLpresumecommand, "lpc release '%p' %j");
4791 /* set the lpq command to contain the destination printer
4792 name only. This is used by cups_queue_get() */
4793 string_set(&pService->szLpqcommand, "%p");
4794 string_set(&pService->szLprmcommand, "");
4795 string_set(&pService->szPrintcommand, "");
4796 string_set(&pService->szLppausecommand, "");
4797 string_set(&pService->szLpresumecommand, "");
4798 string_set(&pService->szQueuepausecommand, "");
4799 string_set(&pService->szQueueresumecommand, "");
4801 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4802 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4803 string_set(&pService->szPrintcommand, "lpr -P'%p' %s; rm %s");
4804 string_set(&pService->szLppausecommand, "lp -i '%p-%j' -H hold");
4805 string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
4806 string_set(&pService->szQueuepausecommand, "disable '%p'");
4807 string_set(&pService->szQueueresumecommand, "enable '%p'");
4808 #endif /* HAVE_CUPS */
4813 string_set(&pService->szLpqcommand, "lpstat -o%p");
4814 string_set(&pService->szLprmcommand, "cancel %p-%j");
4815 string_set(&pService->szPrintcommand, "lp -c -d%p %s; rm %s");
4816 string_set(&pService->szQueuepausecommand, "disable %p");
4817 string_set(&pService->szQueueresumecommand, "enable %p");
4819 string_set(&pService->szLppausecommand, "lp -i %p-%j -H hold");
4820 string_set(&pService->szLpresumecommand, "lp -i %p-%j -H resume");
4825 string_set(&pService->szLpqcommand, "lpq -P%p");
4826 string_set(&pService->szLprmcommand, "lprm -P%p %j");
4827 string_set(&pService->szPrintcommand, "lp -r -P%p %s");
4833 string_set(&pService->szPrintcommand, "vlp print %p %s");
4834 string_set(&pService->szLpqcommand, "vlp lpq %p");
4835 string_set(&pService->szLprmcommand, "vlp lprm %p %j");
4836 string_set(&pService->szLppausecommand, "vlp lppause %p %j");
4837 string_set(&pService->szLpresumecommand, "vlp lpresume %p %j");
4838 string_set(&pService->szQueuepausecommand, "vlp queuepause %p");
4839 string_set(&pService->szQueueresumecommand, "vlp queueresume %p");
4841 #endif /* DEVELOPER */
4846 * Function to return the default value for the maximum number of open
4847 * file descriptors permitted. This function tries to consult the
4848 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4849 * the smaller of those.
4851 static int max_open_files(void)
4853 int sysctl_max = MAX_OPEN_FILES;
4854 int rlimit_max = MAX_OPEN_FILES;
4856 #ifdef HAVE_SYSCTLBYNAME
4858 size_t size = sizeof(sysctl_max);
4859 sysctlbyname("kern.maxfilesperproc", &sysctl_max, &size, NULL,
4864 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4870 if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
4871 rlimit_max = rl.rlim_cur;
4873 #if defined(RLIM_INFINITY)
4874 if(rl.rlim_cur == RLIM_INFINITY)
4875 rlimit_max = MAX_OPEN_FILES;
4880 if (sysctl_max < MIN_OPEN_FILES_WINDOWS) {
4881 DEBUG(2,("max_open_files: sysctl_max (%d) below "
4882 "minimum Windows limit (%d)\n",
4884 MIN_OPEN_FILES_WINDOWS));
4885 sysctl_max = MIN_OPEN_FILES_WINDOWS;
4888 if (rlimit_max < MIN_OPEN_FILES_WINDOWS) {
4889 DEBUG(2,("rlimit_max: rlimit_max (%d) below "
4890 "minimum Windows limit (%d)\n",
4892 MIN_OPEN_FILES_WINDOWS));
4893 rlimit_max = MIN_OPEN_FILES_WINDOWS;
4896 return MIN(sysctl_max, rlimit_max);
4900 * Common part of freeing allocated data for one parameter.
4902 static void free_one_parameter_common(void *parm_ptr,
4903 struct parm_struct parm)
4905 if ((parm.type == P_STRING) ||
4906 (parm.type == P_USTRING))
4908 string_free((char**)parm_ptr);
4909 } else if (parm.type == P_LIST) {
4910 TALLOC_FREE(*((char***)parm_ptr));
4915 * Free the allocated data for one parameter for a share
4916 * given as a service struct.
4918 static void free_one_parameter(struct service *service,
4919 struct parm_struct parm)
4923 if (parm.p_class != P_LOCAL) {
4927 parm_ptr = lp_local_ptr(service, parm.ptr);
4929 free_one_parameter_common(parm_ptr, parm);
4933 * Free the allocated parameter data of a share given
4934 * as a service struct.
4936 static void free_parameters(struct service *service)
4940 for (i=0; parm_table[i].label; i++) {
4941 free_one_parameter(service, parm_table[i]);
4946 * Free the allocated data for one parameter for a given share
4947 * specified by an snum.
4949 static void free_one_parameter_by_snum(int snum, struct parm_struct parm)
4953 if (parm.ptr == NULL) {
4958 parm_ptr = parm.ptr;
4959 } else if (parm.p_class != P_LOCAL) {
4962 parm_ptr = lp_local_ptr_by_snum(snum, parm.ptr);
4965 free_one_parameter_common(parm_ptr, parm);
4969 * Free the allocated parameter data for a share specified
4972 static void free_parameters_by_snum(int snum)
4976 for (i=0; parm_table[i].label; i++) {
4977 free_one_parameter_by_snum(snum, parm_table[i]);
4982 * Free the allocated global parameters.
4984 static void free_global_parameters(void)
4986 free_parameters_by_snum(GLOBAL_SECTION_SNUM);
4989 static int map_parameter(const char *pszParmName);
4991 struct lp_stored_option {
4992 struct lp_stored_option *prev, *next;
4997 static struct lp_stored_option *stored_options;
5000 save options set by lp_set_cmdline() into a list. This list is
5001 re-applied when we do a globals reset, so that cmdline set options
5002 are sticky across reloads of smb.conf
5004 static bool store_lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
5006 struct lp_stored_option *entry, *entry_next;
5007 for (entry = stored_options; entry != NULL; entry = entry_next) {
5008 entry_next = entry->next;
5009 if (strcmp(pszParmName, entry->label) == 0) {
5010 DLIST_REMOVE(stored_options, entry);
5016 entry = talloc(NULL, struct lp_stored_option);
5021 entry->label = talloc_strdup(entry, pszParmName);
5022 if (!entry->label) {
5027 entry->value = talloc_strdup(entry, pszParmValue);
5028 if (!entry->value) {
5033 DLIST_ADD_END(stored_options, entry, struct lp_stored_option);
5038 static bool apply_lp_set_cmdline(void)
5040 struct lp_stored_option *entry = NULL;
5041 for (entry = stored_options; entry != NULL; entry = entry->next) {
5042 if (!lp_set_cmdline_helper(entry->label, entry->value, false)) {
5043 DEBUG(0, ("Failed to re-apply cmdline parameter %s = %s\n",
5044 entry->label, entry->value));
5051 /***************************************************************************
5052 Initialise the global parameter structure.
5053 ***************************************************************************/
5055 static void init_globals(bool reinit_globals)
5057 static bool done_init = False;
5061 /* If requested to initialize only once and we've already done it... */
5062 if (!reinit_globals && done_init) {
5063 /* ... then we have nothing more to do */
5068 /* The logfile can be set before this is invoked. Free it if so. */
5069 if (Globals.szLogFile != NULL) {
5070 string_free(&Globals.szLogFile);
5071 Globals.szLogFile = NULL;
5075 free_global_parameters();
5078 /* This memset and the free_global_parameters() above will
5079 * wipe out smb.conf options set with lp_set_cmdline(). The
5080 * apply_lp_set_cmdline() call puts these values back in the
5081 * table once the defaults are set */
5082 memset((void *)&Globals, '\0', sizeof(Globals));
5084 for (i = 0; parm_table[i].label; i++) {
5085 if ((parm_table[i].type == P_STRING ||
5086 parm_table[i].type == P_USTRING) &&
5089 string_set((char **)parm_table[i].ptr, "");
5093 string_set(&sDefault.fstype, FSTYPE_STRING);
5094 string_set(&sDefault.szPrintjobUsername, "%U");
5096 init_printer_values(&sDefault);
5099 DEBUG(3, ("Initialising global parameters\n"));
5101 string_set(&Globals.szSMBPasswdFile, get_dyn_SMB_PASSWD_FILE());
5102 string_set(&Globals.szPrivateDir, get_dyn_PRIVATE_DIR());
5104 /* use the new 'hash2' method by default, with a prefix of 1 */
5105 string_set(&Globals.szManglingMethod, "hash2");
5106 Globals.mangle_prefix = 1;
5108 string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
5110 /* using UTF8 by default allows us to support all chars */
5111 string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
5113 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
5114 /* If the system supports nl_langinfo(), try to grab the value
5115 from the user's locale */
5116 string_set(&Globals.display_charset, "LOCALE");
5118 string_set(&Globals.display_charset, DEFAULT_DISPLAY_CHARSET);
5121 /* Use codepage 850 as a default for the dos character set */
5122 string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
5125 * Allow the default PASSWD_CHAT to be overridden in local.h.
5127 string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
5129 set_global_myname(myhostname());
5130 string_set(&Globals.szNetbiosName,global_myname());
5132 set_global_myworkgroup(WORKGROUP);
5133 string_set(&Globals.szWorkgroup, lp_workgroup());
5135 string_set(&Globals.szPasswdProgram, "");
5136 string_set(&Globals.szLockDir, get_dyn_LOCKDIR());
5137 string_set(&Globals.szStateDir, get_dyn_STATEDIR());
5138 string_set(&Globals.szCacheDir, get_dyn_CACHEDIR());
5139 string_set(&Globals.szPidDir, get_dyn_PIDDIR());
5140 string_set(&Globals.szSocketAddress, "0.0.0.0");
5142 * By default support explicit binding to broadcast
5145 Globals.bNmbdBindExplicitBroadcast = true;
5147 if (asprintf(&s, "Samba %s", samba_version_string()) < 0) {
5148 smb_panic("init_globals: ENOMEM");
5150 string_set(&Globals.szServerString, s);
5152 if (asprintf(&s, "%d.%d", DEFAULT_MAJOR_VERSION,
5153 DEFAULT_MINOR_VERSION) < 0) {
5154 smb_panic("init_globals: ENOMEM");
5156 string_set(&Globals.szAnnounceVersion, s);
5159 string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
5162 string_set(&Globals.szSocketOptions, DEFAULT_SOCKET_OPTIONS);
5164 string_set(&Globals.szLogonDrive, "");
5165 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
5166 string_set(&Globals.szLogonHome, "\\\\%N\\%U");
5167 string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
5169 string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
5170 string_set(&Globals.szPasswordServer, "*");
5172 Globals.AlgorithmicRidBase = BASE_RID;
5174 Globals.bLoadPrinters = True;
5175 Globals.PrintcapCacheTime = 750; /* 12.5 minutes */
5177 Globals.ConfigBackend = config_backend;
5179 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
5180 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
5181 Globals.max_xmit = 0x4104;
5182 Globals.max_mux = 50; /* This is *needed* for profile support. */
5183 Globals.lpqcachetime = 30; /* changed to handle large print servers better -- jerry */
5184 Globals.bDisableSpoolss = False;
5185 Globals.iMaxSmbdProcesses = 0;/* no limit specified */
5186 Globals.pwordlevel = 0;
5187 Globals.unamelevel = 0;
5188 Globals.deadtime = 0;
5189 Globals.getwd_cache = true;
5190 Globals.bLargeReadwrite = True;
5191 Globals.max_log_size = 5000;
5192 Globals.max_open_files = max_open_files();
5193 Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
5194 Globals.maxprotocol = PROTOCOL_NT1;
5195 Globals.minprotocol = PROTOCOL_CORE;
5196 Globals.security = SEC_USER;
5197 Globals.paranoid_server_security = True;
5198 Globals.bEncryptPasswords = True;
5199 Globals.bUpdateEncrypt = False;
5200 Globals.clientSchannel = Auto;
5201 Globals.serverSchannel = Auto;
5202 Globals.bReadRaw = True;
5203 Globals.bWriteRaw = True;
5204 Globals.bNullPasswords = False;
5205 Globals.bObeyPamRestrictions = False;
5207 Globals.bSyslogOnly = False;
5208 Globals.bTimestampLogs = True;
5209 string_set(&Globals.szLogLevel, "0");
5210 Globals.bDebugPrefixTimestamp = False;
5211 Globals.bDebugHiresTimestamp = true;
5212 Globals.bDebugPid = False;
5213 Globals.bDebugUid = False;
5214 Globals.bDebugClass = False;
5215 Globals.bEnableCoreFiles = True;
5216 Globals.max_ttl = 60 * 60 * 24 * 3; /* 3 days default. */
5217 Globals.max_wins_ttl = 60 * 60 * 24 * 6; /* 6 days default. */
5218 Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
5219 Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
5220 Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
5221 Globals.lm_interval = 60;
5222 Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
5223 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
5224 Globals.bNISHomeMap = False;
5225 #ifdef WITH_NISPLUS_HOME
5226 string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
5228 string_set(&Globals.szNISHomeMapName, "auto.home");
5231 Globals.bTimeServer = False;
5232 Globals.bBindInterfacesOnly = False;
5233 Globals.bUnixPasswdSync = False;
5234 Globals.bPamPasswordChange = False;
5235 Globals.bPasswdChatDebug = False;
5236 Globals.iPasswdChatTimeout = 2; /* 2 second default. */
5237 Globals.bNTPipeSupport = True; /* Do NT pipes by default. */
5238 Globals.bNTStatusSupport = True; /* Use NT status by default. */
5239 Globals.bStatCache = True; /* use stat cache by default */
5240 Globals.iMaxStatCacheSize = 256; /* 256k by default */
5241 Globals.restrict_anonymous = 0;
5242 Globals.bClientLanManAuth = False; /* Do NOT use the LanMan hash if it is available */
5243 Globals.bClientPlaintextAuth = False; /* Do NOT use a plaintext password even if is requested by the server */
5244 Globals.bLanmanAuth = False; /* Do NOT use the LanMan hash, even if it is supplied */
5245 Globals.bNTLMAuth = True; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
5246 Globals.bClientNTLMv2Auth = False; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
5247 /* Note, that we will use NTLM2 session security (which is different), if it is available */
5249 Globals.map_to_guest = 0; /* By Default, "Never" */
5250 Globals.oplock_break_wait_time = 0; /* By Default, 0 msecs. */
5251 Globals.enhanced_browsing = true;
5252 Globals.iLockSpinTime = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
5253 #ifdef MMAP_BLACKLIST
5254 Globals.bUseMmap = False;
5256 Globals.bUseMmap = True;
5258 Globals.bUnixExtensions = True;
5259 Globals.bResetOnZeroVC = False;
5260 Globals.bLogWriteableFilesOnExit = False;
5261 Globals.bCreateKrb5Conf = true;
5263 /* hostname lookups can be very expensive and are broken on
5264 a large number of sites (tridge) */
5265 Globals.bHostnameLookups = False;
5267 string_set(&Globals.szPassdbBackend, "tdbsam");
5268 string_set(&Globals.szLdapSuffix, "");
5269 string_set(&Globals.szLdapMachineSuffix, "");
5270 string_set(&Globals.szLdapUserSuffix, "");
5271 string_set(&Globals.szLdapGroupSuffix, "");
5272 string_set(&Globals.szLdapIdmapSuffix, "");
5274 string_set(&Globals.szLdapAdminDn, "");
5275 Globals.ldap_ssl = LDAP_SSL_START_TLS;
5276 Globals.ldap_ssl_ads = False;
5277 Globals.ldap_deref = -1;
5278 Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
5279 Globals.ldap_delete_dn = False;
5280 Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
5281 Globals.ldap_follow_referral = Auto;
5282 Globals.ldap_timeout = LDAP_DEFAULT_TIMEOUT;
5283 Globals.ldap_connection_timeout = LDAP_CONNECTION_DEFAULT_TIMEOUT;
5284 Globals.ldap_page_size = LDAP_PAGE_SIZE;
5286 Globals.ldap_debug_level = 0;
5287 Globals.ldap_debug_threshold = 10;
5289 /* This is what we tell the afs client. in reality we set the token
5290 * to never expire, though, when this runs out the afs client will
5291 * forget the token. Set to 0 to get NEVERDATE.*/
5292 Globals.iAfsTokenLifetime = 604800;
5293 Globals.cups_connection_timeout = CUPS_DEFAULT_CONNECTION_TIMEOUT;
5295 /* these parameters are set to defaults that are more appropriate
5296 for the increasing samba install base:
5298 as a member of the workgroup, that will possibly become a
5299 _local_ master browser (lm = True). this is opposed to a forced
5300 local master browser startup (pm = True).
5302 doesn't provide WINS server service by default (wsupp = False),
5303 and doesn't provide domain master browser services by default, either.
5307 Globals.bMsAddPrinterWizard = True;
5308 Globals.os_level = 20;
5309 Globals.bLocalMaster = True;
5310 Globals.iDomainMaster = Auto; /* depending on bDomainLogons */
5311 Globals.bDomainLogons = False;
5312 Globals.bBrowseList = True;
5313 Globals.bWINSsupport = False;
5314 Globals.bWINSproxy = False;
5316 TALLOC_FREE(Globals.szInitLogonDelayedHosts);
5317 Globals.InitLogonDelay = 100; /* 100 ms default delay */
5319 Globals.bDNSproxy = True;
5321 /* this just means to use them if they exist */
5322 Globals.bKernelOplocks = True;
5324 Globals.bAllowTrustedDomains = True;
5325 string_set(&Globals.szIdmapBackend, "tdb");
5326 Globals.bIdmapReadOnly = false;
5328 string_set(&Globals.szTemplateShell, "/bin/false");
5329 string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
5330 string_set(&Globals.szWinbindSeparator, "\\");
5332 string_set(&Globals.szCupsServer, "");
5333 string_set(&Globals.szIPrintServer, "");
5335 string_set(&Globals.ctdbdSocket, "");
5336 Globals.szClusterAddresses = NULL;
5337 Globals.clustering = False;
5338 Globals.ctdb_timeout = 0;
5339 Globals.ctdb_locktime_warn_threshold = 0;
5341 Globals.winbind_cache_time = 300; /* 5 minutes */
5342 Globals.winbind_reconnect_delay = 30; /* 30 seconds */
5343 Globals.winbind_max_clients = 200;
5344 Globals.bWinbindEnumUsers = False;
5345 Globals.bWinbindEnumGroups = False;
5346 Globals.bWinbindUseDefaultDomain = False;
5347 Globals.bWinbindTrustedDomainsOnly = False;
5348 Globals.bWinbindNestedGroups = True;
5349 Globals.winbind_expand_groups = 1;
5350 Globals.szWinbindNssInfo = str_list_make_v3(NULL, "template", NULL);
5351 Globals.bWinbindRefreshTickets = False;
5352 Globals.bWinbindOfflineLogon = False;
5354 Globals.iIdmapCacheTime = 86400 * 7; /* a week by default */
5355 Globals.iIdmapNegativeCacheTime = 120; /* 2 minutes by default */
5357 Globals.bPassdbExpandExplicit = False;
5359 Globals.name_cache_timeout = 660; /* In seconds */
5361 Globals.bUseSpnego = True;
5362 Globals.bClientUseSpnego = True;
5364 Globals.client_signing = Auto;
5365 Globals.server_signing = False;
5367 Globals.bDeferSharingViolations = True;
5368 string_set(&Globals.smb_ports, SMB_PORTS);
5370 Globals.bEnablePrivileges = True;
5371 Globals.bHostMSDfs = True;
5372 Globals.bASUSupport = False;
5374 /* User defined shares. */
5375 if (asprintf(&s, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5376 smb_panic("init_globals: ENOMEM");
5378 string_set(&Globals.szUsersharePath, s);
5380 string_set(&Globals.szUsershareTemplateShare, "");
5381 Globals.iUsershareMaxShares = 0;
5382 /* By default disallow sharing of directories not owned by the sharer. */
5383 Globals.bUsershareOwnerOnly = True;
5384 /* By default disallow guest access to usershares. */
5385 Globals.bUsershareAllowGuests = False;
5387 Globals.iKeepalive = DEFAULT_KEEPALIVE;
5389 /* By default no shares out of the registry */
5390 Globals.bRegistryShares = False;
5392 Globals.iminreceivefile = 0;
5394 Globals.bMapUntrustedToDomain = false;
5395 Globals.bMulticastDnsRegister = true;
5397 Globals.ismb2_max_read = 1024*1024;
5398 Globals.ismb2_max_write = 1024*1024;
5399 Globals.ismb2_max_trans = 1024*1024;
5401 string_set(&Globals.ncalrpc_dir, get_dyn_NCALRPCDIR());
5403 /* Now put back the settings that were set with lp_set_cmdline() */
5404 apply_lp_set_cmdline();
5407 /*******************************************************************
5408 Convenience routine to grab string parameters into temporary memory
5409 and run standard_sub_basic on them. The buffers can be written to by
5410 callers without affecting the source string.
5411 ********************************************************************/
5413 static char *lp_string(const char *s)
5416 TALLOC_CTX *ctx = talloc_tos();
5418 /* The follow debug is useful for tracking down memory problems
5419 especially if you have an inner loop that is calling a lp_*()
5420 function that returns a string. Perhaps this debug should be
5421 present all the time? */
5424 DEBUG(10, ("lp_string(%s)\n", s));
5430 ret = talloc_sub_basic(ctx,
5431 get_current_username(),
5432 current_user_info.domain,
5434 if (trim_char(ret, '\"', '\"')) {
5435 if (strchr(ret,'\"') != NULL) {
5437 ret = talloc_sub_basic(ctx,
5438 get_current_username(),
5439 current_user_info.domain,
5447 In this section all the functions that are used to access the
5448 parameters from the rest of the program are defined
5451 #define FN_GLOBAL_STRING(fn_name,ptr) \
5452 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
5453 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5454 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
5455 #define FN_GLOBAL_LIST(fn_name,ptr) \
5456 const char **fn_name(void) {return(*(const char ***)(ptr));}
5457 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5458 bool fn_name(void) {return(*(bool *)(ptr));}
5459 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5460 char fn_name(void) {return(*(char *)(ptr));}
5461 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5462 int fn_name(void) {return(*(int *)(ptr));}
5464 #define FN_LOCAL_STRING(fn_name,val) \
5465 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5466 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5467 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5468 #define FN_LOCAL_LIST(fn_name,val) \
5469 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5470 #define FN_LOCAL_BOOL(fn_name,val) \
5471 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5472 #define FN_LOCAL_INTEGER(fn_name,val) \
5473 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5475 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5476 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5477 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5478 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5479 #define FN_LOCAL_CHAR(fn_name,val) \
5480 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5482 FN_GLOBAL_STRING(lp_smb_ports, &Globals.smb_ports)
5483 FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset)
5484 FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset)
5485 FN_GLOBAL_STRING(lp_display_charset, &Globals.display_charset)
5486 FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile)
5487 FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
5488 FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
5489 FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)
5490 FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString)
5491 FN_GLOBAL_INTEGER(lp_printcap_cache_time, &Globals.PrintcapCacheTime)
5492 FN_GLOBAL_STRING(lp_addport_cmd, &Globals.szAddPortCommand)
5493 FN_GLOBAL_STRING(lp_enumports_cmd, &Globals.szEnumPortsCommand)
5494 FN_GLOBAL_STRING(lp_addprinter_cmd, &Globals.szAddPrinterCommand)
5495 FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
5496 FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap)
5497 FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
5498 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5499 * build process or in smb.conf, we use that value. Otherwise they
5500 * default to the value of lp_lockdir(). */
5501 char *lp_statedir(void) {
5502 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5503 (strcmp(get_dyn_STATEDIR(), Globals.szStateDir) != 0))
5504 return(lp_string(*(char **)(&Globals.szStateDir) ?
5505 *(char **)(&Globals.szStateDir) : ""));
5507 return(lp_string(*(char **)(&Globals.szLockDir) ?
5508 *(char **)(&Globals.szLockDir) : ""));
5510 char *lp_cachedir(void) {
5511 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5512 (strcmp(get_dyn_CACHEDIR(), Globals.szCacheDir) != 0))
5513 return(lp_string(*(char **)(&Globals.szCacheDir) ?
5514 *(char **)(&Globals.szCacheDir) : ""));
5516 return(lp_string(*(char **)(&Globals.szLockDir) ?
5517 *(char **)(&Globals.szLockDir) : ""));
5519 FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
5520 FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
5521 FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
5522 FN_GLOBAL_STRING(lp_utmpdir, &Globals.szUtmpDir)
5523 FN_GLOBAL_STRING(lp_wtmpdir, &Globals.szWtmpDir)
5524 FN_GLOBAL_BOOL(lp_utmp, &Globals.bUtmp)
5525 FN_GLOBAL_STRING(lp_rootdir, &Globals.szRootdir)
5526 FN_GLOBAL_STRING(lp_perfcount_module, &Globals.szSMBPerfcountModule)
5527 FN_GLOBAL_STRING(lp_defaultservice, &Globals.szDefaultService)
5528 FN_GLOBAL_STRING(lp_msg_command, &Globals.szMsgCommand)
5529 FN_GLOBAL_STRING(lp_get_quota_command, &Globals.szGetQuota)
5530 FN_GLOBAL_STRING(lp_set_quota_command, &Globals.szSetQuota)
5531 FN_GLOBAL_STRING(lp_auto_services, &Globals.szAutoServices)
5532 FN_GLOBAL_STRING(lp_passwd_program, &Globals.szPasswdProgram)
5533 FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat)
5534 FN_GLOBAL_STRING(lp_passwordserver, &Globals.szPasswordServer)
5535 FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
5536 FN_GLOBAL_STRING(lp_realm, &Globals.szRealm)
5537 FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap)
5538 FN_GLOBAL_INTEGER(lp_afs_token_lifetime, &Globals.iAfsTokenLifetime)
5539 FN_GLOBAL_STRING(lp_log_nt_token_command, &Globals.szLogNtTokenCommand)
5540 FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap)
5541 FN_GLOBAL_CONST_STRING(lp_logon_script, &Globals.szLogonScript)
5542 FN_GLOBAL_CONST_STRING(lp_logon_path, &Globals.szLogonPath)
5543 FN_GLOBAL_CONST_STRING(lp_logon_drive, &Globals.szLogonDrive)
5544 FN_GLOBAL_CONST_STRING(lp_logon_home, &Globals.szLogonHome)
5545 FN_GLOBAL_STRING(lp_remote_announce, &Globals.szRemoteAnnounce)
5546 FN_GLOBAL_STRING(lp_remote_browse_sync, &Globals.szRemoteBrowseSync)
5547 FN_GLOBAL_BOOL(lp_nmbd_bind_explicit_broadcast, &Globals.bNmbdBindExplicitBroadcast)
5548 FN_GLOBAL_LIST(lp_wins_server_list, &Globals.szWINSservers)
5549 FN_GLOBAL_LIST(lp_interfaces, &Globals.szInterfaces)
5550 FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName)
5551 static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
5552 FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
5553 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
5554 * lp_passdb_backend() should be replace by the this macro again after
5557 const char *lp_passdb_backend(void)
5559 char *delim, *quote;
5561 delim = strchr( Globals.szPassdbBackend, ' ');
5562 /* no space at all */
5563 if (delim == NULL) {
5567 quote = strchr(Globals.szPassdbBackend, '"');
5568 /* no quote char or non in the first part */
5569 if (quote == NULL || quote > delim) {
5574 quote = strchr(quote+1, '"');
5575 if (quote == NULL) {
5576 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
5578 } else if (*(quote+1) == '\0') {
5579 /* space, fitting quote char, and one backend only */
5582 /* terminate string after the fitting quote char */
5587 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5588 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5589 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5590 "backend (%s) is used. The rest is ignored.\n", Globals.szPassdbBackend));
5593 return Globals.szPassdbBackend;
5595 FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
5596 FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
5597 FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
5598 FN_GLOBAL_STRING(lp_renameuser_script, &Globals.szRenameUserScript)
5599 FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
5601 FN_GLOBAL_CONST_STRING(lp_guestaccount, &Globals.szGuestaccount)
5602 FN_GLOBAL_STRING(lp_addgroup_script, &Globals.szAddGroupScript)
5603 FN_GLOBAL_STRING(lp_delgroup_script, &Globals.szDelGroupScript)
5604 FN_GLOBAL_STRING(lp_addusertogroup_script, &Globals.szAddUserToGroupScript)
5605 FN_GLOBAL_STRING(lp_deluserfromgroup_script, &Globals.szDelUserFromGroupScript)
5606 FN_GLOBAL_STRING(lp_setprimarygroup_script, &Globals.szSetPrimaryGroupScript)
5608 FN_GLOBAL_STRING(lp_addmachine_script, &Globals.szAddMachineScript)
5610 FN_GLOBAL_STRING(lp_shutdown_script, &Globals.szShutdownScript)
5611 FN_GLOBAL_STRING(lp_abort_shutdown_script, &Globals.szAbortShutdownScript)
5612 FN_GLOBAL_STRING(lp_username_map_script, &Globals.szUsernameMapScript)
5613 FN_GLOBAL_INTEGER(lp_username_map_cache_time, &Globals.iUsernameMapCacheTime)
5615 FN_GLOBAL_STRING(lp_check_password_script, &Globals.szCheckPasswordScript)
5617 FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
5618 FN_GLOBAL_CONST_STRING(lp_template_homedir, &Globals.szTemplateHomedir)
5619 FN_GLOBAL_CONST_STRING(lp_template_shell, &Globals.szTemplateShell)
5620 FN_GLOBAL_CONST_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
5621 FN_GLOBAL_INTEGER(lp_acl_compatibility, &Globals.iAclCompat)
5622 FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
5623 FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
5624 FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
5625 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, &Globals.bWinbindTrustedDomainsOnly)
5626 FN_GLOBAL_BOOL(lp_winbind_nested_groups, &Globals.bWinbindNestedGroups)
5627 FN_GLOBAL_INTEGER(lp_winbind_expand_groups, &Globals.winbind_expand_groups)
5628 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets, &Globals.bWinbindRefreshTickets)
5629 FN_GLOBAL_BOOL(lp_winbind_offline_logon, &Globals.bWinbindOfflineLogon)
5630 FN_GLOBAL_BOOL(lp_winbind_normalize_names, &Globals.bWinbindNormalizeNames)
5631 FN_GLOBAL_BOOL(lp_winbind_rpc_only, &Globals.bWinbindRpcOnly)
5632 FN_GLOBAL_BOOL(lp_create_krb5_conf, &Globals.bCreateKrb5Conf)
5634 FN_GLOBAL_CONST_STRING(lp_idmap_backend, &Globals.szIdmapBackend)
5635 FN_GLOBAL_BOOL(lp_idmap_read_only, &Globals.bIdmapReadOnly)
5636 FN_GLOBAL_INTEGER(lp_idmap_cache_time, &Globals.iIdmapCacheTime)
5637 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time, &Globals.iIdmapNegativeCacheTime)
5638 FN_GLOBAL_INTEGER(lp_keepalive, &Globals.iKeepalive)
5639 FN_GLOBAL_BOOL(lp_passdb_expand_explicit, &Globals.bPassdbExpandExplicit)
5641 FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix)
5642 FN_GLOBAL_STRING(lp_ldap_admin_dn, &Globals.szLdapAdminDn)
5643 FN_GLOBAL_INTEGER(lp_ldap_ssl, &Globals.ldap_ssl)
5644 FN_GLOBAL_BOOL(lp_ldap_ssl_ads, &Globals.ldap_ssl_ads)
5645 FN_GLOBAL_INTEGER(lp_ldap_deref, &Globals.ldap_deref)
5646 FN_GLOBAL_INTEGER(lp_ldap_follow_referral, &Globals.ldap_follow_referral)
5647 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, &Globals.ldap_passwd_sync)
5648 FN_GLOBAL_BOOL(lp_ldap_delete_dn, &Globals.ldap_delete_dn)
5649 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep, &Globals.ldap_replication_sleep)
5650 FN_GLOBAL_INTEGER(lp_ldap_timeout, &Globals.ldap_timeout)
5651 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout, &Globals.ldap_connection_timeout)
5652 FN_GLOBAL_INTEGER(lp_ldap_page_size, &Globals.ldap_page_size)
5653 FN_GLOBAL_INTEGER(lp_ldap_debug_level, &Globals.ldap_debug_level)
5654 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold, &Globals.ldap_debug_threshold)
5655 FN_GLOBAL_STRING(lp_add_share_cmd, &Globals.szAddShareCommand)
5656 FN_GLOBAL_STRING(lp_change_share_cmd, &Globals.szChangeShareCommand)
5657 FN_GLOBAL_STRING(lp_delete_share_cmd, &Globals.szDeleteShareCommand)
5658 FN_GLOBAL_STRING(lp_usershare_path, &Globals.szUsersharePath)
5659 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list, &Globals.szUsersharePrefixAllowList)
5660 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list, &Globals.szUsersharePrefixDenyList)
5662 FN_GLOBAL_LIST(lp_eventlog_list, &Globals.szEventLogs)
5664 FN_GLOBAL_BOOL(lp_registry_shares, &Globals.bRegistryShares)
5665 FN_GLOBAL_BOOL(lp_usershare_allow_guests, &Globals.bUsershareAllowGuests)
5666 FN_GLOBAL_BOOL(lp_usershare_owner_only, &Globals.bUsershareOwnerOnly)
5667 FN_GLOBAL_BOOL(lp_disable_netbios, &Globals.bDisableNetbios)
5668 FN_GLOBAL_BOOL(lp_reset_on_zero_vc, &Globals.bResetOnZeroVC)
5669 FN_GLOBAL_BOOL(lp_log_writeable_files_on_exit,
5670 &Globals.bLogWriteableFilesOnExit)
5671 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, &Globals.bMsAddPrinterWizard)
5672 FN_GLOBAL_BOOL(lp_dns_proxy, &Globals.bDNSproxy)
5673 FN_GLOBAL_BOOL(lp_wins_support, &Globals.bWINSsupport)
5674 FN_GLOBAL_BOOL(lp_we_are_a_wins_server, &Globals.bWINSsupport)
5675 FN_GLOBAL_BOOL(lp_wins_proxy, &Globals.bWINSproxy)
5676 FN_GLOBAL_BOOL(lp_local_master, &Globals.bLocalMaster)
5677 FN_GLOBAL_BOOL(lp_domain_logons, &Globals.bDomainLogons)
5678 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts, &Globals.szInitLogonDelayedHosts)
5679 FN_GLOBAL_INTEGER(lp_init_logon_delay, &Globals.InitLogonDelay)
5680 FN_GLOBAL_BOOL(lp_load_printers, &Globals.bLoadPrinters)
5681 FN_GLOBAL_BOOL(_lp_readraw, &Globals.bReadRaw)
5682 FN_GLOBAL_BOOL(lp_large_readwrite, &Globals.bLargeReadwrite)
5683 FN_GLOBAL_BOOL(_lp_writeraw, &Globals.bWriteRaw)
5684 FN_GLOBAL_BOOL(lp_null_passwords, &Globals.bNullPasswords)
5685 FN_GLOBAL_BOOL(lp_obey_pam_restrictions, &Globals.bObeyPamRestrictions)
5686 FN_GLOBAL_BOOL(lp_encrypted_passwords, &Globals.bEncryptPasswords)
5687 FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
5688 FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
5689 FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
5690 FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
5691 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, &Globals.bDebugPrefixTimestamp)
5692 FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
5693 FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
5694 FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
5695 FN_GLOBAL_BOOL(lp_debug_class, &Globals.bDebugClass)
5696 FN_GLOBAL_BOOL(lp_enable_core_files, &Globals.bEnableCoreFiles)
5697 FN_GLOBAL_BOOL(lp_browse_list, &Globals.bBrowseList)
5698 FN_GLOBAL_BOOL(lp_nis_home_map, &Globals.bNISHomeMap)
5699 static FN_GLOBAL_BOOL(lp_time_server, &Globals.bTimeServer)
5700 FN_GLOBAL_BOOL(lp_bind_interfaces_only, &Globals.bBindInterfacesOnly)
5701 FN_GLOBAL_BOOL(lp_pam_password_change, &Globals.bPamPasswordChange)
5702 FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)
5703 FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)
5704 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout)
5705 FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport)
5706 FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)
5707 FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache)
5708 FN_GLOBAL_INTEGER(lp_max_stat_cache_size, &Globals.iMaxStatCacheSize)
5709 FN_GLOBAL_BOOL(lp_allow_trusted_domains, &Globals.bAllowTrustedDomains)
5710 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain, &Globals.bMapUntrustedToDomain)
5711 FN_GLOBAL_INTEGER(lp_restrict_anonymous, &Globals.restrict_anonymous)
5712 FN_GLOBAL_BOOL(lp_lanman_auth, &Globals.bLanmanAuth)
5713 FN_GLOBAL_BOOL(lp_ntlm_auth, &Globals.bNTLMAuth)
5714 FN_GLOBAL_BOOL(lp_client_plaintext_auth, &Globals.bClientPlaintextAuth)
5715 FN_GLOBAL_BOOL(lp_client_lanman_auth, &Globals.bClientLanManAuth)
5716 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, &Globals.bClientNTLMv2Auth)
5717 FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
5718 FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
5719 FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
5720 FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
5721 FN_GLOBAL_BOOL(lp_unix_extensions, &Globals.bUnixExtensions)
5722 FN_GLOBAL_BOOL(lp_use_spnego, &Globals.bUseSpnego)
5723 FN_GLOBAL_BOOL(lp_client_use_spnego, &Globals.bClientUseSpnego)
5724 FN_GLOBAL_BOOL(lp_client_use_spnego_principal, &Globals.client_use_spnego_principal)
5725 FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups)
5726 FN_LOCAL_PARM_BOOL(lp_change_notify, bChangeNotify)
5727 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify, bKernelChangeNotify)
5728 FN_GLOBAL_STRING(lp_dedicated_keytab_file, &Globals.szDedicatedKeytabFile)
5729 FN_GLOBAL_INTEGER(lp_kerberos_method, &Globals.iKerberosMethod)
5730 FN_GLOBAL_BOOL(lp_defer_sharing_violations, &Globals.bDeferSharingViolations)
5731 FN_GLOBAL_BOOL(lp_enable_privileges, &Globals.bEnablePrivileges)
5732 FN_GLOBAL_BOOL(lp_enable_asu_support, &Globals.bASUSupport)
5733 FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
5734 FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
5735 FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
5736 FN_GLOBAL_INTEGER(lp_min_wins_ttl, &Globals.min_wins_ttl)
5737 FN_GLOBAL_INTEGER(lp_max_log_size, &Globals.max_log_size)
5738 FN_GLOBAL_INTEGER(lp_max_open_files, &Globals.max_open_files)
5739 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size, &Globals.open_files_db_hash_size)
5740 FN_GLOBAL_INTEGER(lp_maxxmit, &Globals.max_xmit)
5741 FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux)
5742 FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel)
5743 FN_GLOBAL_INTEGER(lp_usernamelevel, &Globals.unamelevel)
5744 FN_GLOBAL_INTEGER(lp_deadtime, &Globals.deadtime)
5745 FN_GLOBAL_BOOL(lp_getwd_cache, &Globals.getwd_cache)
5746 FN_GLOBAL_INTEGER(lp_maxprotocol, &Globals.maxprotocol)
5747 FN_GLOBAL_INTEGER(lp_minprotocol, &Globals.minprotocol)
5748 FN_GLOBAL_INTEGER(lp_security, &Globals.security)
5749 FN_GLOBAL_LIST(lp_auth_methods, &Globals.AuthMethods)
5750 FN_GLOBAL_BOOL(lp_paranoid_server_security, &Globals.paranoid_server_security)
5751 FN_GLOBAL_INTEGER(lp_maxdisksize, &Globals.maxdisksize)
5752 FN_GLOBAL_INTEGER(lp_lpqcachetime, &Globals.lpqcachetime)
5753 FN_GLOBAL_INTEGER(lp_max_smbd_processes, &Globals.iMaxSmbdProcesses)
5754 FN_GLOBAL_BOOL(_lp_disable_spoolss, &Globals.bDisableSpoolss)
5755 FN_GLOBAL_INTEGER(lp_syslog, &Globals.syslog)
5756 static FN_GLOBAL_INTEGER(lp_announce_as, &Globals.announce_as)
5757 FN_GLOBAL_INTEGER(lp_lm_announce, &Globals.lm_announce)
5758 FN_GLOBAL_INTEGER(lp_lm_interval, &Globals.lm_interval)
5759 FN_GLOBAL_INTEGER(lp_machine_password_timeout, &Globals.machine_password_timeout)
5760 FN_GLOBAL_INTEGER(lp_map_to_guest, &Globals.map_to_guest)
5761 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time)
5762 FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime)
5763 FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares)
5764 FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions)
5765 FN_GLOBAL_INTEGER(lp_config_backend, &Globals.ConfigBackend)
5766 FN_GLOBAL_INTEGER(lp_smb2_max_read, &Globals.ismb2_max_read)
5767 FN_GLOBAL_INTEGER(lp_smb2_max_write, &Globals.ismb2_max_write)
5768 FN_GLOBAL_INTEGER(lp_smb2_max_trans, &Globals.ismb2_max_trans)
5770 FN_LOCAL_STRING(lp_preexec, szPreExec)
5771 FN_LOCAL_STRING(lp_postexec, szPostExec)
5772 FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
5773 FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
5774 FN_LOCAL_STRING(lp_servicename, szService)
5775 FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
5776 FN_LOCAL_STRING(lp_pathname, szPath)
5777 FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
5778 FN_LOCAL_STRING(lp_username, szUsername)
5779 FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers)
5780 FN_LOCAL_LIST(lp_valid_users, szValidUsers)
5781 FN_LOCAL_LIST(lp_admin_users, szAdminUsers)
5782 FN_GLOBAL_LIST(lp_svcctl_list, &Globals.szServicesList)
5783 FN_LOCAL_STRING(lp_cups_options, szCupsOptions)
5784 FN_GLOBAL_STRING(lp_cups_server, &Globals.szCupsServer)
5785 int lp_cups_encrypt(void)
5788 #ifdef HAVE_HTTPCONNECTENCRYPT
5789 switch (Globals.CupsEncrypt) {
5791 result = HTTP_ENCRYPT_REQUIRED;
5794 result = HTTP_ENCRYPT_ALWAYS;
5797 result = HTTP_ENCRYPT_NEVER;
5803 FN_GLOBAL_STRING(lp_iprint_server, &Globals.szIPrintServer)
5804 FN_GLOBAL_INTEGER(lp_cups_connection_timeout, &Globals.cups_connection_timeout)
5805 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket, &Globals.ctdbdSocket)
5806 FN_GLOBAL_LIST(lp_cluster_addresses, &Globals.szClusterAddresses)
5807 FN_GLOBAL_BOOL(lp_clustering, &Globals.clustering)
5808 FN_GLOBAL_INTEGER(lp_ctdb_timeout, &Globals.ctdb_timeout)
5809 FN_GLOBAL_INTEGER(lp_ctdb_locktime_warn_threshold, &Globals.ctdb_locktime_warn_threshold)
5810 FN_LOCAL_STRING(lp_printcommand, szPrintcommand)
5811 FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand)
5812 FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand)
5813 FN_LOCAL_STRING(lp_lppausecommand, szLppausecommand)
5814 FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
5815 FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
5816 FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
5817 static FN_LOCAL_STRING(_lp_printername, szPrintername)
5818 FN_LOCAL_CONST_STRING(lp_printjob_username, szPrintjobUsername)
5819 FN_LOCAL_LIST(lp_hostsallow, szHostsallow)
5820 FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny)
5821 FN_LOCAL_STRING(lp_magicscript, szMagicScript)
5822 FN_LOCAL_STRING(lp_magicoutput, szMagicOutput)
5823 FN_LOCAL_STRING(lp_comment, comment)
5824 FN_LOCAL_STRING(lp_force_user, force_user)
5825 FN_LOCAL_STRING(lp_force_group, force_group)
5826 FN_LOCAL_LIST(lp_readlist, readlist)
5827 FN_LOCAL_LIST(lp_writelist, writelist)
5828 FN_LOCAL_LIST(lp_printer_admin, printer_admin)
5829 FN_LOCAL_STRING(lp_fstype, fstype)
5830 FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects)
5831 FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
5832 static FN_LOCAL_STRING(lp_volume, volume)
5833 FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
5834 FN_LOCAL_STRING(lp_hide_files, szHideFiles)
5835 FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
5836 FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
5837 FN_LOCAL_STRING(lp_aio_write_behind, szAioWriteBehind)
5838 FN_LOCAL_STRING(lp_dfree_command, szDfree)
5839 FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
5840 FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
5841 FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
5842 FN_LOCAL_INTEGER(lp_casesensitive, iCaseSensitive)
5843 FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
5844 FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
5845 FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
5846 FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles)
5847 FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable)
5848 FN_LOCAL_BOOL(lp_hideunwriteable_files, bHideUnWriteableFiles)
5849 FN_LOCAL_BOOL(lp_browseable, bBrowseable)
5850 FN_LOCAL_BOOL(lp_access_based_share_enum, bAccessBasedShareEnum)
5851 FN_LOCAL_BOOL(lp_readonly, bRead_only)
5852 FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir)
5853 FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok)
5854 FN_LOCAL_BOOL(lp_guest_only, bGuest_only)
5855 FN_LOCAL_BOOL(lp_administrative_share, bAdministrative_share)
5856 FN_LOCAL_BOOL(lp_print_ok, bPrint_ok)
5857 FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
5858 FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
5859 FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes)
5860 FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport)
5861 FN_LOCAL_PARM_BOOL(lp_locking, bLocking)
5862 FN_LOCAL_PARM_INTEGER(lp_strict_locking, iStrictLocking)
5863 FN_LOCAL_PARM_BOOL(lp_posix_locking, bPosixLocking)
5864 FN_LOCAL_BOOL(lp_share_modes, bShareModes)
5865 FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
5866 FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
5867 FN_LOCAL_BOOL(lp_onlyuser, bOnlyUser)
5868 FN_LOCAL_PARM_BOOL(lp_manglednames, bMangledNames)
5869 FN_LOCAL_BOOL(lp_symlinks, bSymlinks)
5870 FN_LOCAL_BOOL(lp_syncalways, bSyncAlways)
5871 FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate)
5872 FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
5873 FN_LOCAL_BOOL(lp_map_system, bMap_system)
5874 FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly)
5875 FN_LOCAL_BOOL(lp_fake_oplocks, bFakeOplocks)
5876 FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles)
5877 FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode)
5878 FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes)
5879 FN_LOCAL_BOOL(lp_dos_filetime_resolution, bDosFiletimeResolution)
5880 FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes)
5881 FN_GLOBAL_BOOL(lp_async_smb_echo_handler, &Globals.bAsyncSMBEchoHandler)
5882 FN_GLOBAL_BOOL(lp_multicast_dns_register, &Globals.bMulticastDnsRegister)
5883 FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks)
5884 FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms)
5885 FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS)
5886 FN_LOCAL_BOOL(lp_inherit_owner, bInheritOwner)
5887 FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver)
5888 FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode)
5889 FN_LOCAL_BOOL(lp_force_printername, bForcePrintername)
5890 FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport)
5891 FN_LOCAL_BOOL(lp_force_unknown_acl_user, bForceUnknownAclUser)
5892 FN_LOCAL_BOOL(lp_ea_support, bEASupport)
5893 FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile)
5894 FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls)
5895 FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit)
5896 FN_LOCAL_BOOL(lp_afs_share, bAfs_Share)
5897 FN_LOCAL_BOOL(lp_acl_check_permissions, bAclCheckPermissions)
5898 FN_LOCAL_BOOL(lp_acl_group_control, bAclGroupControl)
5899 FN_LOCAL_BOOL(lp_acl_map_full_control, bAclMapFullControl)
5900 FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask)
5901 FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode)
5902 FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask)
5903 FN_LOCAL_INTEGER(lp_force_security_mode, iSecurity_force_mode)
5904 FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask)
5905 FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode)
5906 FN_LOCAL_INTEGER(lp_dir_security_mask, iDir_Security_mask)
5907 FN_LOCAL_INTEGER(lp_force_dir_security_mode, iDir_Security_force_mode)
5908 FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections)
5909 FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
5910 FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
5911 FN_LOCAL_INTEGER(lp_printing, iPrinting)
5912 FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
5913 FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
5914 FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
5915 FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
5916 FN_LOCAL_INTEGER(lp_block_size, iBlock_size)
5917 FN_LOCAL_INTEGER(lp_dfree_cache_time, iDfreeCacheTime)
5918 FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size)
5919 FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize)
5920 FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize)
5921 FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly)
5922 FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize)
5923 FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt)
5924 FN_LOCAL_CHAR(lp_magicchar, magic_char)
5925 FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
5926 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay, &Globals.winbind_reconnect_delay)
5927 FN_GLOBAL_INTEGER(lp_winbind_max_clients, &Globals.winbind_max_clients)
5928 FN_GLOBAL_LIST(lp_winbind_nss_info, &Globals.szWinbindNssInfo)
5929 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
5930 FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
5931 FN_GLOBAL_INTEGER(lp_client_signing, &Globals.client_signing)
5932 FN_GLOBAL_INTEGER(lp_server_signing, &Globals.server_signing)
5933 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping, &Globals.client_ldap_sasl_wrapping)
5935 FN_GLOBAL_STRING(lp_ncalrpc_dir, &Globals.ncalrpc_dir)
5937 /* local prototypes */
5939 static int map_parameter_canonical(const char *pszParmName, bool *inverse);
5940 static const char *get_boolean(bool bool_value);
5941 static int getservicebyname(const char *pszServiceName,
5942 struct service *pserviceDest);
5943 static void copy_service(struct service *pserviceDest,
5944 struct service *pserviceSource,
5945 struct bitmap *pcopymapDest);
5946 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
5948 static bool do_section(const char *pszSectionName, void *userdata);
5949 static void init_copymap(struct service *pservice);
5950 static bool hash_a_service(const char *name, int number);
5951 static void free_service_byindex(int iService);
5952 static void free_param_opts(struct param_opt_struct **popts);
5953 static void show_parameter(int parmIndex);
5954 static bool is_synonym_of(int parm1, int parm2, bool *inverse);
5957 * This is a helper function for parametrical options support. It returns a
5958 * pointer to parametrical option value if it exists or NULL otherwise. Actual
5959 * parametrical functions are quite simple
5961 static struct param_opt_struct *get_parametrics(int snum, const char *type,
5964 bool global_section = False;
5966 struct param_opt_struct *data;
5968 if (snum >= iNumServices) return NULL;
5971 data = Globals.param_opt;
5972 global_section = True;
5974 data = ServicePtrs[snum]->param_opt;
5977 if (asprintf(¶m_key, "%s:%s", type, option) == -1) {
5978 DEBUG(0,("asprintf failed!\n"));
5983 if (strwicmp(data->key, param_key) == 0) {
5984 string_free(¶m_key);
5990 if (!global_section) {
5991 /* Try to fetch the same option but from globals */
5992 /* but only if we are not already working with Globals */
5993 data = Globals.param_opt;
5995 if (strwicmp(data->key, param_key) == 0) {
5996 string_free(¶m_key);
6003 string_free(¶m_key);
6009 #define MISSING_PARAMETER(name) \
6010 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
6012 /*******************************************************************
6013 convenience routine to return int parameters.
6014 ********************************************************************/
6015 static int lp_int(const char *s)
6019 MISSING_PARAMETER(lp_int);
6023 return (int)strtol(s, NULL, 0);
6026 /*******************************************************************
6027 convenience routine to return unsigned long parameters.
6028 ********************************************************************/
6029 static unsigned long lp_ulong(const char *s)
6033 MISSING_PARAMETER(lp_ulong);
6037 return strtoul(s, NULL, 0);
6040 /*******************************************************************
6041 convenience routine to return boolean parameters.
6042 ********************************************************************/
6043 static bool lp_bool(const char *s)
6048 MISSING_PARAMETER(lp_bool);
6052 if (!set_boolean(s, &ret)) {
6053 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
6060 /*******************************************************************
6061 convenience routine to return enum parameters.
6062 ********************************************************************/
6063 static int lp_enum(const char *s,const struct enum_list *_enum)
6067 if (!s || !*s || !_enum) {
6068 MISSING_PARAMETER(lp_enum);
6072 for (i=0; _enum[i].name; i++) {
6073 if (strequal(_enum[i].name,s))
6074 return _enum[i].value;
6077 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
6081 #undef MISSING_PARAMETER
6083 /* DO NOT USE lp_parm_string ANYMORE!!!!
6084 * use lp_parm_const_string or lp_parm_talloc_string
6086 * lp_parm_string is only used to let old modules find this symbol
6088 #undef lp_parm_string
6089 char *lp_parm_string(const char *servicename, const char *type, const char *option);
6090 char *lp_parm_string(const char *servicename, const char *type, const char *option)
6092 return lp_parm_talloc_string(lp_servicenumber(servicename), type, option, NULL);
6095 /* Return parametric option from a given service. Type is a part of option before ':' */
6096 /* Parametric option has following syntax: 'Type: option = value' */
6097 /* the returned value is talloced on the talloc_tos() */
6098 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def)
6100 struct param_opt_struct *data = get_parametrics(snum, type, option);
6102 if (data == NULL||data->value==NULL) {
6104 return lp_string(def);
6110 return lp_string(data->value);
6113 /* Return parametric option from a given service. Type is a part of option before ':' */
6114 /* Parametric option has following syntax: 'Type: option = value' */
6115 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
6117 struct param_opt_struct *data = get_parametrics(snum, type, option);
6119 if (data == NULL||data->value==NULL)
6125 /* Return parametric option from a given service. Type is a part of option before ':' */
6126 /* Parametric option has following syntax: 'Type: option = value' */
6128 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
6130 struct param_opt_struct *data = get_parametrics(snum, type, option);
6132 if (data == NULL||data->value==NULL)
6133 return (const char **)def;
6135 if (data->list==NULL) {
6136 data->list = str_list_make_v3(NULL, data->value, NULL);
6139 return (const char **)data->list;
6142 /* Return parametric option from a given service. Type is a part of option before ':' */
6143 /* Parametric option has following syntax: 'Type: option = value' */
6145 int lp_parm_int(int snum, const char *type, const char *option, int def)
6147 struct param_opt_struct *data = get_parametrics(snum, type, option);
6149 if (data && data->value && *data->value)
6150 return lp_int(data->value);
6155 /* Return parametric option from a given service. Type is a part of option before ':' */
6156 /* Parametric option has following syntax: 'Type: option = value' */
6158 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
6160 struct param_opt_struct *data = get_parametrics(snum, type, option);
6162 if (data && data->value && *data->value)
6163 return lp_ulong(data->value);
6168 /* Return parametric option from a given service. Type is a part of option before ':' */
6169 /* Parametric option has following syntax: 'Type: option = value' */
6171 bool lp_parm_bool(int snum, const char *type, const char *option, bool def)
6173 struct param_opt_struct *data = get_parametrics(snum, type, option);
6175 if (data && data->value && *data->value)
6176 return lp_bool(data->value);
6181 /* Return parametric option from a given service. Type is a part of option before ':' */
6182 /* Parametric option has following syntax: 'Type: option = value' */
6184 int lp_parm_enum(int snum, const char *type, const char *option,
6185 const struct enum_list *_enum, int def)
6187 struct param_opt_struct *data = get_parametrics(snum, type, option);
6189 if (data && data->value && *data->value && _enum)
6190 return lp_enum(data->value, _enum);
6196 /***************************************************************************
6197 Initialise a service to the defaults.
6198 ***************************************************************************/
6200 static void init_service(struct service *pservice)
6202 memset((char *)pservice, '\0', sizeof(struct service));
6203 copy_service(pservice, &sDefault, NULL);
6208 * free a param_opts structure.
6209 * param_opts handling should be moved to talloc;
6210 * then this whole functions reduces to a TALLOC_FREE().
6213 static void free_param_opts(struct param_opt_struct **popts)
6215 struct param_opt_struct *opt, *next_opt;
6217 if (popts == NULL) {
6221 if (*popts != NULL) {
6222 DEBUG(5, ("Freeing parametrics:\n"));
6225 while (opt != NULL) {
6226 string_free(&opt->key);
6227 string_free(&opt->value);
6228 TALLOC_FREE(opt->list);
6229 next_opt = opt->next;
6236 /***************************************************************************
6237 Free the dynamically allocated parts of a service struct.
6238 ***************************************************************************/
6240 static void free_service(struct service *pservice)
6245 if (pservice->szService)
6246 DEBUG(5, ("free_service: Freeing service %s\n",
6247 pservice->szService));
6249 free_parameters(pservice);
6251 string_free(&pservice->szService);
6252 TALLOC_FREE(pservice->copymap);
6254 free_param_opts(&pservice->param_opt);
6256 ZERO_STRUCTP(pservice);
6260 /***************************************************************************
6261 remove a service indexed in the ServicePtrs array from the ServiceHash
6262 and free the dynamically allocated parts
6263 ***************************************************************************/
6265 static void free_service_byindex(int idx)
6267 if ( !LP_SNUM_OK(idx) )
6270 ServicePtrs[idx]->valid = False;
6271 invalid_services[num_invalid_services++] = idx;
6273 /* we have to cleanup the hash record */
6275 if (ServicePtrs[idx]->szService) {
6276 char *canon_name = canonicalize_servicename(
6278 ServicePtrs[idx]->szService );
6280 dbwrap_delete_bystring(ServiceHash, canon_name );
6281 TALLOC_FREE(canon_name);
6284 free_service(ServicePtrs[idx]);
6287 /***************************************************************************
6288 Add a new service to the services array initialising it with the given
6290 ***************************************************************************/
6292 static int add_a_service(const struct service *pservice, const char *name)
6295 struct service tservice;
6296 int num_to_alloc = iNumServices + 1;
6298 tservice = *pservice;
6300 /* it might already exist */
6302 i = getservicebyname(name, NULL);
6308 /* find an invalid one */
6310 if (num_invalid_services > 0) {
6311 i = invalid_services[--num_invalid_services];
6314 /* if not, then create one */
6315 if (i == iNumServices) {
6316 struct service **tsp;
6319 tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct service *, num_to_alloc);
6321 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
6325 ServicePtrs[iNumServices] = SMB_MALLOC_P(struct service);
6326 if (!ServicePtrs[iNumServices]) {
6327 DEBUG(0,("add_a_service: out of memory!\n"));
6332 /* enlarge invalid_services here for now... */
6333 tinvalid = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services, int,
6335 if (tinvalid == NULL) {
6336 DEBUG(0,("add_a_service: failed to enlarge "
6337 "invalid_services!\n"));
6340 invalid_services = tinvalid;
6342 free_service_byindex(i);
6345 ServicePtrs[i]->valid = True;
6347 init_service(ServicePtrs[i]);
6348 copy_service(ServicePtrs[i], &tservice, NULL);
6350 string_set(&ServicePtrs[i]->szService, name);
6352 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
6353 i, ServicePtrs[i]->szService));
6355 if (!hash_a_service(ServicePtrs[i]->szService, i)) {
6362 /***************************************************************************
6363 Convert a string to uppercase and remove whitespaces.
6364 ***************************************************************************/
6366 char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src)
6371 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
6375 result = talloc_strdup(ctx, src);
6376 SMB_ASSERT(result != NULL);
6382 /***************************************************************************
6383 Add a name/index pair for the services array to the hash table.
6384 ***************************************************************************/
6386 static bool hash_a_service(const char *name, int idx)
6390 if ( !ServiceHash ) {
6391 DEBUG(10,("hash_a_service: creating servicehash\n"));
6392 ServiceHash = db_open_rbt(NULL);
6393 if ( !ServiceHash ) {
6394 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
6399 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
6402 canon_name = canonicalize_servicename(talloc_tos(), name );
6404 dbwrap_store_bystring(ServiceHash, canon_name,
6405 make_tdb_data((uint8 *)&idx, sizeof(idx)),
6408 TALLOC_FREE(canon_name);
6413 /***************************************************************************
6414 Add a new home service, with the specified home directory, defaults coming
6416 ***************************************************************************/
6418 bool lp_add_home(const char *pszHomename, int iDefaultService,
6419 const char *user, const char *pszHomedir)
6423 if (pszHomename == NULL || user == NULL || pszHomedir == NULL ||
6424 pszHomedir[0] == '\0') {
6428 i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
6433 if (!(*(ServicePtrs[iDefaultService]->szPath))
6434 || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
6435 string_set(&ServicePtrs[i]->szPath, pszHomedir);
6438 if (!(*(ServicePtrs[i]->comment))) {
6439 char *comment = NULL;
6440 if (asprintf(&comment, "Home directory of %s", user) < 0) {
6443 string_set(&ServicePtrs[i]->comment, comment);
6447 /* set the browseable flag from the global default */
6449 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6450 ServicePtrs[i]->bAccessBasedShareEnum = sDefault.bAccessBasedShareEnum;
6452 ServicePtrs[i]->autoloaded = True;
6454 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
6455 user, ServicePtrs[i]->szPath ));
6460 /***************************************************************************
6461 Add a new service, based on an old one.
6462 ***************************************************************************/
6464 int lp_add_service(const char *pszService, int iDefaultService)
6466 if (iDefaultService < 0) {
6467 return add_a_service(&sDefault, pszService);
6470 return (add_a_service(ServicePtrs[iDefaultService], pszService));
6473 /***************************************************************************
6474 Add the IPC service.
6475 ***************************************************************************/
6477 static bool lp_add_ipc(const char *ipc_name, bool guest_ok)
6479 char *comment = NULL;
6480 int i = add_a_service(&sDefault, ipc_name);
6485 if (asprintf(&comment, "IPC Service (%s)",
6486 Globals.szServerString) < 0) {
6490 string_set(&ServicePtrs[i]->szPath, tmpdir());
6491 string_set(&ServicePtrs[i]->szUsername, "");
6492 string_set(&ServicePtrs[i]->comment, comment);
6493 string_set(&ServicePtrs[i]->fstype, "IPC");
6494 ServicePtrs[i]->iMaxConnections = 0;
6495 ServicePtrs[i]->bAvailable = True;
6496 ServicePtrs[i]->bRead_only = True;
6497 ServicePtrs[i]->bGuest_only = False;
6498 ServicePtrs[i]->bAdministrative_share = True;
6499 ServicePtrs[i]->bGuest_ok = guest_ok;
6500 ServicePtrs[i]->bPrint_ok = False;
6501 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6503 DEBUG(3, ("adding IPC service\n"));
6509 /***************************************************************************
6510 Add a new printer service, with defaults coming from service iFrom.
6511 ***************************************************************************/
6513 bool lp_add_printer(const char *pszPrintername, int iDefaultService)
6515 const char *comment = "From Printcap";
6516 int i = add_a_service(ServicePtrs[iDefaultService], pszPrintername);
6521 /* note that we do NOT default the availability flag to True - */
6522 /* we take it from the default service passed. This allows all */
6523 /* dynamic printers to be disabled by disabling the [printers] */
6524 /* entry (if/when the 'available' keyword is implemented!). */
6526 /* the printer name is set to the service name. */
6527 string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
6528 string_set(&ServicePtrs[i]->comment, comment);
6530 /* set the browseable flag from the gloabl default */
6531 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6533 /* Printers cannot be read_only. */
6534 ServicePtrs[i]->bRead_only = False;
6535 /* No share modes on printer services. */
6536 ServicePtrs[i]->bShareModes = False;
6537 /* No oplocks on printer services. */
6538 ServicePtrs[i]->bOpLocks = False;
6539 /* Printer services must be printable. */
6540 ServicePtrs[i]->bPrint_ok = True;
6542 DEBUG(3, ("adding printer service %s\n", pszPrintername));
6548 /***************************************************************************
6549 Check whether the given parameter name is valid.
6550 Parametric options (names containing a colon) are considered valid.
6551 ***************************************************************************/
6553 bool lp_parameter_is_valid(const char *pszParmName)
6555 return ((map_parameter(pszParmName) != -1) ||
6556 (strchr(pszParmName, ':') != NULL));
6559 /***************************************************************************
6560 Check whether the given name is the name of a global parameter.
6561 Returns True for strings belonging to parameters of class
6562 P_GLOBAL, False for all other strings, also for parametric options
6563 and strings not belonging to any option.
6564 ***************************************************************************/
6566 bool lp_parameter_is_global(const char *pszParmName)
6568 int num = map_parameter(pszParmName);
6571 return (parm_table[num].p_class == P_GLOBAL);
6577 /**************************************************************************
6578 Check whether the given name is the canonical name of a parameter.
6579 Returns False if it is not a valid parameter Name.
6580 For parametric options, True is returned.
6581 **************************************************************************/
6583 bool lp_parameter_is_canonical(const char *parm_name)
6585 if (!lp_parameter_is_valid(parm_name)) {
6589 return (map_parameter(parm_name) ==
6590 map_parameter_canonical(parm_name, NULL));
6593 /**************************************************************************
6594 Determine the canonical name for a parameter.
6595 Indicate when it is an inverse (boolean) synonym instead of a
6597 **************************************************************************/
6599 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
6604 if (!lp_parameter_is_valid(parm_name)) {
6609 num = map_parameter_canonical(parm_name, inverse);
6611 /* parametric option */
6612 *canon_parm = parm_name;
6614 *canon_parm = parm_table[num].label;
6621 /**************************************************************************
6622 Determine the canonical name for a parameter.
6623 Turn the value given into the inverse boolean expression when
6624 the synonym is an invers boolean synonym.
6626 Return True if parm_name is a valid parameter name and
6627 in case it is an invers boolean synonym, if the val string could
6628 successfully be converted to the reverse bool.
6629 Return false in all other cases.
6630 **************************************************************************/
6632 bool lp_canonicalize_parameter_with_value(const char *parm_name,
6634 const char **canon_parm,
6635 const char **canon_val)
6640 if (!lp_parameter_is_valid(parm_name)) {
6646 num = map_parameter_canonical(parm_name, &inverse);
6648 /* parametric option */
6649 *canon_parm = parm_name;
6652 *canon_parm = parm_table[num].label;
6654 if (!lp_invert_boolean(val, canon_val)) {
6666 /***************************************************************************
6667 Map a parameter's string representation to something we can use.
6668 Returns False if the parameter string is not recognised, else TRUE.
6669 ***************************************************************************/
6671 static int map_parameter(const char *pszParmName)
6675 if (*pszParmName == '-' && !strequal(pszParmName, "-valid"))
6678 for (iIndex = 0; parm_table[iIndex].label; iIndex++)
6679 if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
6682 /* Warn only if it isn't parametric option */
6683 if (strchr(pszParmName, ':') == NULL)
6684 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
6685 /* We do return 'fail' for parametric options as well because they are
6686 stored in different storage
6691 /***************************************************************************
6692 Map a parameter's string representation to the index of the canonical
6693 form of the parameter (it might be a synonym).
6694 Returns -1 if the parameter string is not recognised.
6695 ***************************************************************************/
6697 static int map_parameter_canonical(const char *pszParmName, bool *inverse)
6699 int parm_num, canon_num;
6700 bool loc_inverse = False;
6702 parm_num = map_parameter(pszParmName);
6703 if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_HIDE)) {
6704 /* invalid, parametric or no canidate for synonyms ... */
6708 for (canon_num = 0; parm_table[canon_num].label; canon_num++) {
6709 if (is_synonym_of(parm_num, canon_num, &loc_inverse)) {
6710 parm_num = canon_num;
6716 if (inverse != NULL) {
6717 *inverse = loc_inverse;
6722 /***************************************************************************
6723 return true if parameter number parm1 is a synonym of parameter
6724 number parm2 (parm2 being the principal name).
6725 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6727 ***************************************************************************/
6729 static bool is_synonym_of(int parm1, int parm2, bool *inverse)
6731 if ((parm_table[parm1].ptr == parm_table[parm2].ptr) &&
6732 (parm_table[parm1].flags & FLAG_HIDE) &&
6733 !(parm_table[parm2].flags & FLAG_HIDE))
6735 if (inverse != NULL) {
6736 if ((parm_table[parm1].type == P_BOOLREV) &&
6737 (parm_table[parm2].type == P_BOOL))
6749 /***************************************************************************
6750 Show one parameter's name, type, [values,] and flags.
6751 (helper functions for show_parameter_list)
6752 ***************************************************************************/
6754 static void show_parameter(int parmIndex)
6756 int enumIndex, flagIndex;
6761 const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6762 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6764 unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
6765 FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
6766 FLAG_HIDE, FLAG_DOS_STRING};
6767 const char *flag_names[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6768 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6769 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL};
6771 printf("%s=%s", parm_table[parmIndex].label,
6772 type[parm_table[parmIndex].type]);
6773 if (parm_table[parmIndex].type == P_ENUM) {
6776 parm_table[parmIndex].enum_list[enumIndex].name;
6780 enumIndex ? "|" : "",
6781 parm_table[parmIndex].enum_list[enumIndex].name);
6786 for (flagIndex=0; flag_names[flagIndex]; flagIndex++) {
6787 if (parm_table[parmIndex].flags & flags[flagIndex]) {
6790 flag_names[flagIndex]);
6795 /* output synonyms */
6797 for (parmIndex2=0; parm_table[parmIndex2].label; parmIndex2++) {
6798 if (is_synonym_of(parmIndex, parmIndex2, &inverse)) {
6799 printf(" (%ssynonym of %s)", inverse ? "inverse " : "",
6800 parm_table[parmIndex2].label);
6801 } else if (is_synonym_of(parmIndex2, parmIndex, &inverse)) {
6803 printf(" (synonyms: ");
6808 printf("%s%s", parm_table[parmIndex2].label,
6809 inverse ? "[i]" : "");
6819 /***************************************************************************
6820 Show all parameter's name, type, [values,] and flags.
6821 ***************************************************************************/
6823 void show_parameter_list(void)
6825 int classIndex, parmIndex;
6826 const char *section_names[] = { "local", "global", NULL};
6828 for (classIndex=0; section_names[classIndex]; classIndex++) {
6829 printf("[%s]\n", section_names[classIndex]);
6830 for (parmIndex = 0; parm_table[parmIndex].label; parmIndex++) {
6831 if (parm_table[parmIndex].p_class == classIndex) {
6832 show_parameter(parmIndex);
6838 /***************************************************************************
6839 Check if a given string correctly represents a boolean value.
6840 ***************************************************************************/
6842 bool lp_string_is_valid_boolean(const char *parm_value)
6844 return set_boolean(parm_value, NULL);
6847 /***************************************************************************
6848 Get the standard string representation of a boolean value ("yes" or "no")
6849 ***************************************************************************/
6851 static const char *get_boolean(bool bool_value)
6853 static const char *yes_str = "yes";
6854 static const char *no_str = "no";
6856 return (bool_value ? yes_str : no_str);
6859 /***************************************************************************
6860 Provide the string of the negated boolean value associated to the boolean
6861 given as a string. Returns False if the passed string does not correctly
6862 represent a boolean.
6863 ***************************************************************************/
6865 bool lp_invert_boolean(const char *str, const char **inverse_str)
6869 if (!set_boolean(str, &val)) {
6873 *inverse_str = get_boolean(!val);
6877 /***************************************************************************
6878 Provide the canonical string representation of a boolean value given
6879 as a string. Return True on success, False if the string given does
6880 not correctly represent a boolean.
6881 ***************************************************************************/
6883 bool lp_canonicalize_boolean(const char *str, const char**canon_str)
6887 if (!set_boolean(str, &val)) {
6891 *canon_str = get_boolean(val);
6895 /***************************************************************************
6896 Find a service by name. Otherwise works like get_service.
6897 ***************************************************************************/
6899 static int getservicebyname(const char *pszServiceName, struct service *pserviceDest)
6905 if (ServiceHash == NULL) {
6909 canon_name = canonicalize_servicename(talloc_tos(), pszServiceName);
6911 data = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name);
6913 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
6914 iService = *(int *)data.dptr;
6917 TALLOC_FREE(canon_name);
6919 if ((iService != -1) && (LP_SNUM_OK(iService))
6920 && (pserviceDest != NULL)) {
6921 copy_service(pserviceDest, ServicePtrs[iService], NULL);
6927 /***************************************************************************
6928 Copy a service structure to another.
6929 If pcopymapDest is NULL then copy all fields
6930 ***************************************************************************/
6933 * Add a parametric option to a param_opt_struct,
6934 * replacing old value, if already present.
6936 static void set_param_opt(struct param_opt_struct **opt_list,
6937 const char *opt_name,
6938 const char *opt_value,
6941 struct param_opt_struct *new_opt, *opt;
6944 if (opt_list == NULL) {
6951 /* Traverse destination */
6953 /* If we already have same option, override it */
6954 if (strwicmp(opt->key, opt_name) == 0) {
6955 if ((opt->flags & FLAG_CMDLINE) &&
6956 !(flags & FLAG_CMDLINE)) {
6957 /* it's been marked as not to be
6961 string_free(&opt->value);
6962 TALLOC_FREE(opt->list);
6963 opt->value = SMB_STRDUP(opt_value);
6971 new_opt = SMB_XMALLOC_P(struct param_opt_struct);
6972 new_opt->key = SMB_STRDUP(opt_name);
6973 new_opt->value = SMB_STRDUP(opt_value);
6974 new_opt->list = NULL;
6975 new_opt->flags = flags;
6976 DLIST_ADD(*opt_list, new_opt);
6980 static void copy_service(struct service *pserviceDest, struct service *pserviceSource,
6981 struct bitmap *pcopymapDest)
6984 bool bcopyall = (pcopymapDest == NULL);
6985 struct param_opt_struct *data;
6987 for (i = 0; parm_table[i].label; i++)
6988 if (parm_table[i].ptr && parm_table[i].p_class == P_LOCAL &&
6989 (bcopyall || bitmap_query(pcopymapDest,i))) {
6990 void *def_ptr = parm_table[i].ptr;
6992 ((char *)pserviceSource) + PTR_DIFF(def_ptr,
6995 ((char *)pserviceDest) + PTR_DIFF(def_ptr,
6998 switch (parm_table[i].type) {
7001 *(bool *)dest_ptr = *(bool *)src_ptr;
7007 *(int *)dest_ptr = *(int *)src_ptr;
7011 *(char *)dest_ptr = *(char *)src_ptr;
7015 string_set((char **)dest_ptr,
7020 string_set((char **)dest_ptr,
7022 strupper_m(*(char **)dest_ptr);
7025 TALLOC_FREE(*((char ***)dest_ptr));
7026 *((char ***)dest_ptr) = str_list_copy(NULL,
7027 *(const char ***)src_ptr);
7035 init_copymap(pserviceDest);
7036 if (pserviceSource->copymap)
7037 bitmap_copy(pserviceDest->copymap,
7038 pserviceSource->copymap);
7041 data = pserviceSource->param_opt;
7043 set_param_opt(&pserviceDest->param_opt, data->key, data->value, data->flags);
7048 /***************************************************************************
7049 Check a service for consistency. Return False if the service is in any way
7050 incomplete or faulty, else True.
7051 ***************************************************************************/
7053 bool service_ok(int iService)
7058 if (ServicePtrs[iService]->szService[0] == '\0') {
7059 DEBUG(0, ("The following message indicates an internal error:\n"));
7060 DEBUG(0, ("No service name in service entry.\n"));
7064 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
7065 /* I can't see why you'd want a non-printable printer service... */
7066 if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
7067 if (!ServicePtrs[iService]->bPrint_ok) {
7068 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
7069 ServicePtrs[iService]->szService));
7070 ServicePtrs[iService]->bPrint_ok = True;
7072 /* [printers] service must also be non-browsable. */
7073 if (ServicePtrs[iService]->bBrowseable)
7074 ServicePtrs[iService]->bBrowseable = False;
7077 if (ServicePtrs[iService]->szPath[0] == '\0' &&
7078 strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0 &&
7079 ServicePtrs[iService]->szMSDfsProxy[0] == '\0'
7081 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
7082 ServicePtrs[iService]->szService));
7083 ServicePtrs[iService]->bAvailable = False;
7086 /* If a service is flagged unavailable, log the fact at level 1. */
7087 if (!ServicePtrs[iService]->bAvailable)
7088 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
7089 ServicePtrs[iService]->szService));
7094 static struct smbconf_ctx *lp_smbconf_ctx(void)
7097 static struct smbconf_ctx *conf_ctx = NULL;
7099 if (conf_ctx == NULL) {
7100 werr = smbconf_init(NULL, &conf_ctx, "registry:");
7101 if (!W_ERROR_IS_OK(werr)) {
7102 DEBUG(1, ("error initializing registry configuration: "
7103 "%s\n", win_errstr(werr)));
7111 static bool process_smbconf_service(struct smbconf_service *service)
7116 if (service == NULL) {
7120 ret = do_section(service->name, NULL);
7124 for (count = 0; count < service->num_params; count++) {
7125 ret = do_parameter(service->param_names[count],
7126 service->param_values[count],
7132 if (iServiceIndex >= 0) {
7133 return service_ok(iServiceIndex);
7139 * load a service from registry and activate it
7141 bool process_registry_service(const char *service_name)
7144 struct smbconf_service *service = NULL;
7145 TALLOC_CTX *mem_ctx = talloc_stackframe();
7146 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7149 if (conf_ctx == NULL) {
7153 DEBUG(5, ("process_registry_service: service name %s\n", service_name));
7155 if (!smbconf_share_exists(conf_ctx, service_name)) {
7157 * Registry does not contain data for this service (yet),
7158 * but make sure lp_load doesn't return false.
7164 werr = smbconf_get_share(conf_ctx, mem_ctx, service_name, &service);
7165 if (!W_ERROR_IS_OK(werr)) {
7169 ret = process_smbconf_service(service);
7175 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7178 TALLOC_FREE(mem_ctx);
7183 * process_registry_globals
7185 static bool process_registry_globals(void)
7189 add_to_file_list(INCLUDE_REGISTRY_NAME, INCLUDE_REGISTRY_NAME);
7191 ret = do_parameter("registry shares", "yes", NULL);
7196 return process_registry_service(GLOBAL_NAME);
7199 bool process_registry_shares(void)
7203 struct smbconf_service **service = NULL;
7204 uint32_t num_shares = 0;
7205 TALLOC_CTX *mem_ctx = talloc_stackframe();
7206 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7209 if (conf_ctx == NULL) {
7213 werr = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &service);
7214 if (!W_ERROR_IS_OK(werr)) {
7220 for (count = 0; count < num_shares; count++) {
7221 if (strequal(service[count]->name, GLOBAL_NAME)) {
7224 ret = process_smbconf_service(service[count]);
7231 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7234 TALLOC_FREE(mem_ctx);
7238 #define MAX_INCLUDE_DEPTH 100
7240 static uint8_t include_depth;
7242 static struct file_lists {
7243 struct file_lists *next;
7247 } *file_lists = NULL;
7249 /*******************************************************************
7250 Keep a linked list of all config files so we know when one has changed
7251 it's date and needs to be reloaded.
7252 ********************************************************************/
7254 static void add_to_file_list(const char *fname, const char *subfname)
7256 struct file_lists *f = file_lists;
7259 if (f->name && !strcmp(f->name, fname))
7265 f = SMB_MALLOC_P(struct file_lists);
7268 f->next = file_lists;
7269 f->name = SMB_STRDUP(fname);
7274 f->subfname = SMB_STRDUP(subfname);
7281 f->modtime = file_modtime(subfname);
7283 time_t t = file_modtime(subfname);
7291 * Free the file lists
7293 static void free_file_list(void)
7295 struct file_lists *f;
7296 struct file_lists *next;
7301 SAFE_FREE( f->name );
7302 SAFE_FREE( f->subfname );
7311 * Utility function for outsiders to check if we're running on registry.
7313 bool lp_config_backend_is_registry(void)
7315 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY);
7319 * Utility function to check if the config backend is FILE.
7321 bool lp_config_backend_is_file(void)
7323 return (lp_config_backend() == CONFIG_BACKEND_FILE);
7326 /*******************************************************************
7327 Check if a config file has changed date.
7328 ********************************************************************/
7330 bool lp_file_list_changed(void)
7332 struct file_lists *f = file_lists;
7334 DEBUG(6, ("lp_file_list_changed()\n"));
7339 if (strequal(f->name, INCLUDE_REGISTRY_NAME)) {
7340 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7342 if (conf_ctx == NULL) {
7345 if (smbconf_changed(conf_ctx, &conf_last_csn, NULL,
7348 DEBUGADD(6, ("registry config changed\n"));
7353 n2 = talloc_sub_basic(talloc_tos(),
7354 get_current_username(),
7355 current_user_info.domain,
7360 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
7361 f->name, n2, ctime(&f->modtime)));
7363 mod_time = file_modtime(n2);
7366 ((f->modtime != mod_time) ||
7367 (f->subfname == NULL) ||
7368 (strcmp(n2, f->subfname) != 0)))
7371 ("file %s modified: %s\n", n2,
7373 f->modtime = mod_time;
7374 SAFE_FREE(f->subfname);
7375 f->subfname = SMB_STRDUP(n2);
7387 /***************************************************************************
7388 Run standard_sub_basic on netbios name... needed because global_myname
7389 is not accessed through any lp_ macro.
7390 Note: We must *NOT* use string_set() here as ptr points to global_myname.
7391 ***************************************************************************/
7393 static bool handle_netbios_name(int snum, const char *pszParmValue, char **ptr)
7396 char *netbios_name = talloc_sub_basic(
7397 talloc_tos(), get_current_username(), current_user_info.domain,
7400 ret = set_global_myname(netbios_name);
7401 TALLOC_FREE(netbios_name);
7402 string_set(&Globals.szNetbiosName,global_myname());
7404 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
7410 static bool handle_charset(int snum, const char *pszParmValue, char **ptr)
7412 if (strcmp(*ptr, pszParmValue) != 0) {
7413 string_set(ptr, pszParmValue);
7421 static bool handle_workgroup(int snum, const char *pszParmValue, char **ptr)
7425 ret = set_global_myworkgroup(pszParmValue);
7426 string_set(&Globals.szWorkgroup,lp_workgroup());
7431 static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
7435 ret = set_global_scope(pszParmValue);
7436 string_set(&Globals.szNetbiosScope,global_scope());
7441 static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
7443 TALLOC_FREE(Globals.szNetbiosAliases);
7444 Globals.szNetbiosAliases = str_list_make_v3(NULL, pszParmValue, NULL);
7445 return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
7448 /***************************************************************************
7449 Handle the include operation.
7450 ***************************************************************************/
7451 static bool bAllowIncludeRegistry = true;
7453 static bool handle_include(int snum, const char *pszParmValue, char **ptr)
7457 if (include_depth >= MAX_INCLUDE_DEPTH) {
7458 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7463 if (strequal(pszParmValue, INCLUDE_REGISTRY_NAME)) {
7464 if (!bAllowIncludeRegistry) {
7467 if (bInGlobalSection) {
7470 ret = process_registry_globals();
7474 DEBUG(1, ("\"include = registry\" only effective "
7475 "in %s section\n", GLOBAL_NAME));
7480 fname = talloc_sub_basic(talloc_tos(), get_current_username(),
7481 current_user_info.domain,
7484 add_to_file_list(pszParmValue, fname);
7486 string_set(ptr, fname);
7488 if (file_exist(fname)) {
7491 ret = pm_process(fname, do_section, do_parameter, NULL);
7497 DEBUG(2, ("Can't find include file %s\n", fname));
7502 /***************************************************************************
7503 Handle the interpretation of the copy parameter.
7504 ***************************************************************************/
7506 static bool handle_copy(int snum, const char *pszParmValue, char **ptr)
7510 struct service serviceTemp;
7512 string_set(ptr, pszParmValue);
7514 init_service(&serviceTemp);
7518 DEBUG(3, ("Copying service from service %s\n", pszParmValue));
7520 if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) {
7521 if (iTemp == iServiceIndex) {
7522 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
7524 copy_service(ServicePtrs[iServiceIndex],
7526 ServicePtrs[iServiceIndex]->copymap);
7530 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
7534 free_service(&serviceTemp);
7538 static bool handle_ldap_debug_level(int snum, const char *pszParmValue, char **ptr)
7540 Globals.ldap_debug_level = lp_int(pszParmValue);
7541 init_ldap_debugging();
7545 /***************************************************************************
7546 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7551 idmap uid = 1000-1999
7554 We only do simple parsing checks here. The strings are parsed into useful
7555 structures in the idmap daemon code.
7557 ***************************************************************************/
7559 /* Some lp_ routines to return idmap [ug]id information */
7561 static uid_t idmap_uid_low, idmap_uid_high;
7562 static gid_t idmap_gid_low, idmap_gid_high;
7564 bool lp_idmap_uid(uid_t *low, uid_t *high)
7566 if (idmap_uid_low == 0 || idmap_uid_high == 0)
7570 *low = idmap_uid_low;
7573 *high = idmap_uid_high;
7578 bool lp_idmap_gid(gid_t *low, gid_t *high)
7580 if (idmap_gid_low == 0 || idmap_gid_high == 0)
7584 *low = idmap_gid_low;
7587 *high = idmap_gid_high;
7592 /* Do some simple checks on "idmap [ug]id" parameter values */
7594 static bool handle_idmap_uid(int snum, const char *pszParmValue, char **ptr)
7598 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
7603 string_set(ptr, pszParmValue);
7605 idmap_uid_low = low;
7606 idmap_uid_high = high;
7611 static bool handle_idmap_gid(int snum, const char *pszParmValue, char **ptr)
7615 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
7620 string_set(ptr, pszParmValue);
7622 idmap_gid_low = low;
7623 idmap_gid_high = high;
7628 /***************************************************************************
7629 Handle the DEBUG level list.
7630 ***************************************************************************/
7632 static bool handle_debug_list( int snum, const char *pszParmValueIn, char **ptr )
7634 string_set(ptr, pszParmValueIn);
7635 return debug_parse_levels(pszParmValueIn);
7638 /***************************************************************************
7639 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7640 ***************************************************************************/
7642 static const char *append_ldap_suffix( const char *str )
7644 const char *suffix_string;
7647 suffix_string = talloc_asprintf(talloc_tos(), "%s,%s", str,
7648 Globals.szLdapSuffix );
7649 if ( !suffix_string ) {
7650 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7654 return suffix_string;
7657 const char *lp_ldap_machine_suffix(void)
7659 if (Globals.szLdapMachineSuffix[0])
7660 return append_ldap_suffix(Globals.szLdapMachineSuffix);
7662 return lp_string(Globals.szLdapSuffix);
7665 const char *lp_ldap_user_suffix(void)
7667 if (Globals.szLdapUserSuffix[0])
7668 return append_ldap_suffix(Globals.szLdapUserSuffix);
7670 return lp_string(Globals.szLdapSuffix);
7673 const char *lp_ldap_group_suffix(void)
7675 if (Globals.szLdapGroupSuffix[0])
7676 return append_ldap_suffix(Globals.szLdapGroupSuffix);
7678 return lp_string(Globals.szLdapSuffix);
7681 const char *lp_ldap_idmap_suffix(void)
7683 if (Globals.szLdapIdmapSuffix[0])
7684 return append_ldap_suffix(Globals.szLdapIdmapSuffix);
7686 return lp_string(Globals.szLdapSuffix);
7689 /****************************************************************************
7690 set the value for a P_ENUM
7691 ***************************************************************************/
7693 static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue,
7698 for (i = 0; parm->enum_list[i].name; i++) {
7699 if ( strequal(pszParmValue, parm->enum_list[i].name)) {
7700 *ptr = parm->enum_list[i].value;
7704 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7705 pszParmValue, parm->label));
7708 /***************************************************************************
7709 ***************************************************************************/
7711 static bool handle_printing(int snum, const char *pszParmValue, char **ptr)
7713 static int parm_num = -1;
7716 if ( parm_num == -1 )
7717 parm_num = map_parameter( "printing" );
7719 lp_set_enum_parm( &parm_table[parm_num], pszParmValue, (int*)ptr );
7724 s = ServicePtrs[snum];
7726 init_printer_values( s );
7732 /***************************************************************************
7733 Initialise a copymap.
7734 ***************************************************************************/
7736 static void init_copymap(struct service *pservice)
7740 TALLOC_FREE(pservice->copymap);
7742 pservice->copymap = bitmap_talloc(NULL, NUMPARAMETERS);
7743 if (!pservice->copymap)
7745 ("Couldn't allocate copymap!! (size %d)\n",
7746 (int)NUMPARAMETERS));
7748 for (i = 0; i < NUMPARAMETERS; i++)
7749 bitmap_set(pservice->copymap, i);
7752 /***************************************************************************
7753 Return the local pointer to a parameter given a service struct and the
7754 pointer into the default structure.
7755 ***************************************************************************/
7757 static void *lp_local_ptr(struct service *service, void *ptr)
7759 return (void *)(((char *)service) + PTR_DIFF(ptr, &sDefault));
7762 /***************************************************************************
7763 Return the local pointer to a parameter given the service number and the
7764 pointer into the default structure.
7765 ***************************************************************************/
7767 void *lp_local_ptr_by_snum(int snum, void *ptr)
7769 return lp_local_ptr(ServicePtrs[snum], ptr);
7772 /***************************************************************************
7773 Process a parameter for a particular service number. If snum < 0
7774 then assume we are in the globals.
7775 ***************************************************************************/
7777 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
7780 void *parm_ptr = NULL; /* where we are going to store the result */
7781 void *def_ptr = NULL;
7782 struct param_opt_struct **opt_list;
7784 parmnum = map_parameter(pszParmName);
7787 if (strchr(pszParmName, ':') == NULL) {
7788 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7794 * We've got a parametric option
7797 opt_list = (snum < 0)
7798 ? &Globals.param_opt : &ServicePtrs[snum]->param_opt;
7799 set_param_opt(opt_list, pszParmName, pszParmValue, 0);
7804 /* if it's already been set by the command line, then we don't
7806 if (parm_table[parmnum].flags & FLAG_CMDLINE) {
7810 if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
7811 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7815 def_ptr = parm_table[parmnum].ptr;
7817 /* we might point at a service, the default service or a global */
7821 if (parm_table[parmnum].p_class == P_GLOBAL) {
7823 ("Global parameter %s found in service section!\n",
7827 parm_ptr = lp_local_ptr_by_snum(snum, def_ptr);
7831 if (!ServicePtrs[snum]->copymap)
7832 init_copymap(ServicePtrs[snum]);
7834 /* this handles the aliases - set the copymap for other entries with
7835 the same data pointer */
7836 for (i = 0; parm_table[i].label; i++)
7837 if (parm_table[i].ptr == parm_table[parmnum].ptr)
7838 bitmap_clear(ServicePtrs[snum]->copymap, i);
7841 /* if it is a special case then go ahead */
7842 if (parm_table[parmnum].special) {
7843 return parm_table[parmnum].special(snum, pszParmValue,
7847 /* now switch on the type of variable it is */
7848 switch (parm_table[parmnum].type)
7851 *(bool *)parm_ptr = lp_bool(pszParmValue);
7855 *(bool *)parm_ptr = !lp_bool(pszParmValue);
7859 *(int *)parm_ptr = lp_int(pszParmValue);
7863 *(char *)parm_ptr = *pszParmValue;
7867 i = sscanf(pszParmValue, "%o", (int *)parm_ptr);
7869 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName ));
7874 TALLOC_FREE(*((char ***)parm_ptr));
7875 *(char ***)parm_ptr = str_list_make_v3(
7876 NULL, pszParmValue, NULL);
7880 string_set((char **)parm_ptr, pszParmValue);
7884 string_set((char **)parm_ptr, pszParmValue);
7885 strupper_m(*(char **)parm_ptr);
7889 lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
7898 /***************************************************************************
7899 set a parameter, marking it with FLAG_CMDLINE. Parameters marked as
7900 FLAG_CMDLINE won't be overridden by loads from smb.conf.
7901 ***************************************************************************/
7903 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values)
7906 parmnum = map_parameter(pszParmName);
7908 parm_table[parmnum].flags &= ~FLAG_CMDLINE;
7909 if (!lp_do_parameter(-1, pszParmName, pszParmValue)) {
7912 parm_table[parmnum].flags |= FLAG_CMDLINE;
7914 /* we have to also set FLAG_CMDLINE on aliases. Aliases must
7915 * be grouped in the table, so we don't have to search the
7917 for (i=parmnum-1;i>=0 && parm_table[i].ptr == parm_table[parmnum].ptr;i--) {
7918 parm_table[i].flags |= FLAG_CMDLINE;
7920 for (i=parmnum+1;i<NUMPARAMETERS && parm_table[i].ptr == parm_table[parmnum].ptr;i++) {
7921 parm_table[i].flags |= FLAG_CMDLINE;
7925 store_lp_set_cmdline(pszParmName, pszParmValue);
7930 /* it might be parametric */
7931 if (strchr(pszParmName, ':') != NULL) {
7932 set_param_opt(&Globals.param_opt, pszParmName, pszParmValue, FLAG_CMDLINE);
7934 store_lp_set_cmdline(pszParmName, pszParmValue);
7939 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName));
7943 bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
7945 return lp_set_cmdline_helper(pszParmName, pszParmValue, true);
7948 /***************************************************************************
7949 Process a parameter.
7950 ***************************************************************************/
7952 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
7955 if (!bInGlobalSection && bGlobalOnly)
7958 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
7960 return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
7961 pszParmName, pszParmValue));
7965 set a option from the commandline in 'a=b' format. Use to support --option
7967 bool lp_set_option(const char *option)
7972 s = talloc_strdup(NULL, option);
7985 ret = lp_set_cmdline(s, p+1);
7990 /**************************************************************************
7991 Print a parameter of the specified type.
7992 ***************************************************************************/
7994 static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
8000 for (i = 0; p->enum_list[i].name; i++) {
8001 if (*(int *)ptr == p->enum_list[i].value) {
8003 p->enum_list[i].name);
8010 fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
8014 fprintf(f, "%s", BOOLSTR(!*(bool *)ptr));
8018 fprintf(f, "%d", *(int *)ptr);
8022 fprintf(f, "%c", *(char *)ptr);
8026 char *o = octal_string(*(int *)ptr);
8027 fprintf(f, "%s", o);
8033 if ((char ***)ptr && *(char ***)ptr) {
8034 char **list = *(char ***)ptr;
8035 for (; *list; list++) {
8036 /* surround strings with whitespace in double quotes */
8037 if ( strchr_m( *list, ' ' ) )
8038 fprintf(f, "\"%s\"%s", *list, ((*(list+1))?", ":""));
8040 fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
8047 if (*(char **)ptr) {
8048 fprintf(f, "%s", *(char **)ptr);
8056 /***************************************************************************
8057 Check if two parameters are equal.
8058 ***************************************************************************/
8060 static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
8065 return (*((bool *)ptr1) == *((bool *)ptr2));
8070 return (*((int *)ptr1) == *((int *)ptr2));
8073 return (*((char *)ptr1) == *((char *)ptr2));
8076 return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2);
8081 char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
8086 return (p1 == p2 || strequal(p1, p2));
8094 /***************************************************************************
8095 Initialize any local varients in the sDefault table.
8096 ***************************************************************************/
8098 void init_locals(void)
8103 /***************************************************************************
8104 Process a new section (service). At this stage all sections are services.
8105 Later we'll have special sections that permit server parameters to be set.
8106 Returns True on success, False on failure.
8107 ***************************************************************************/
8109 static bool do_section(const char *pszSectionName, void *userdata)
8112 bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
8113 (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
8116 /* if we were in a global section then do the local inits */
8117 if (bInGlobalSection && !isglobal)
8120 /* if we've just struck a global section, note the fact. */
8121 bInGlobalSection = isglobal;
8123 /* check for multiple global sections */
8124 if (bInGlobalSection) {
8125 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
8129 if (!bInGlobalSection && bGlobalOnly)
8132 /* if we have a current service, tidy it up before moving on */
8135 if (iServiceIndex >= 0)
8136 bRetval = service_ok(iServiceIndex);
8138 /* if all is still well, move to the next record in the services array */
8140 /* We put this here to avoid an odd message order if messages are */
8141 /* issued by the post-processing of a previous section. */
8142 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName));
8144 if ((iServiceIndex = add_a_service(&sDefault, pszSectionName))
8146 DEBUG(0, ("Failed to add a new service\n"));
8149 /* Clean all parametric options for service */
8150 /* They will be added during parsing again */
8151 free_param_opts(&ServicePtrs[iServiceIndex]->param_opt);
8158 /***************************************************************************
8159 Determine if a partcular base parameter is currentl set to the default value.
8160 ***************************************************************************/
8162 static bool is_default(int i)
8164 if (!defaults_saved)
8166 switch (parm_table[i].type) {
8168 return str_list_equal((const char **)parm_table[i].def.lvalue,
8169 *(const char ***)parm_table[i].ptr);
8172 return strequal(parm_table[i].def.svalue,
8173 *(char **)parm_table[i].ptr);
8176 return parm_table[i].def.bvalue ==
8177 *(bool *)parm_table[i].ptr;
8179 return parm_table[i].def.cvalue ==
8180 *(char *)parm_table[i].ptr;
8184 return parm_table[i].def.ivalue ==
8185 *(int *)parm_table[i].ptr;
8192 /***************************************************************************
8193 Display the contents of the global structure.
8194 ***************************************************************************/
8196 static void dump_globals(FILE *f)
8199 struct param_opt_struct *data;
8201 fprintf(f, "[global]\n");
8203 for (i = 0; parm_table[i].label; i++)
8204 if (parm_table[i].p_class == P_GLOBAL &&
8205 !(parm_table[i].flags & FLAG_META) &&
8206 parm_table[i].ptr &&
8207 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
8208 if (defaults_saved && is_default(i))
8210 fprintf(f, "\t%s = ", parm_table[i].label);
8211 print_parameter(&parm_table[i], parm_table[i].ptr, f);
8214 if (Globals.param_opt != NULL) {
8215 data = Globals.param_opt;
8217 fprintf(f, "\t%s = %s\n", data->key, data->value);
8224 /***************************************************************************
8225 Return True if a local parameter is currently set to the global default.
8226 ***************************************************************************/
8228 bool lp_is_default(int snum, struct parm_struct *parm)
8230 int pdiff = PTR_DIFF(parm->ptr, &sDefault);
8232 return equal_parameter(parm->type,
8233 ((char *)ServicePtrs[snum]) + pdiff,
8234 ((char *)&sDefault) + pdiff);
8237 /***************************************************************************
8238 Display the contents of a single services record.
8239 ***************************************************************************/
8241 static void dump_a_service(struct service *pService, FILE * f)
8244 struct param_opt_struct *data;
8246 if (pService != &sDefault)
8247 fprintf(f, "[%s]\n", pService->szService);
8249 for (i = 0; parm_table[i].label; i++) {
8251 if (parm_table[i].p_class == P_LOCAL &&
8252 !(parm_table[i].flags & FLAG_META) &&
8253 parm_table[i].ptr &&
8254 (*parm_table[i].label != '-') &&
8255 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8257 int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault);
8259 if (pService == &sDefault) {
8260 if (defaults_saved && is_default(i))
8263 if (equal_parameter(parm_table[i].type,
8264 ((char *)pService) +
8266 ((char *)&sDefault) +
8271 fprintf(f, "\t%s = ", parm_table[i].label);
8272 print_parameter(&parm_table[i],
8273 ((char *)pService) + pdiff, f);
8278 if (pService->param_opt != NULL) {
8279 data = pService->param_opt;
8281 fprintf(f, "\t%s = %s\n", data->key, data->value);
8287 /***************************************************************************
8288 Display the contents of a parameter of a single services record.
8289 ***************************************************************************/
8291 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
8294 bool result = False;
8297 fstring local_parm_name;
8299 const char *parm_opt_value;
8301 /* check for parametrical option */
8302 fstrcpy( local_parm_name, parm_name);
8303 parm_opt = strchr( local_parm_name, ':');
8308 if (strlen(parm_opt)) {
8309 parm_opt_value = lp_parm_const_string( snum,
8310 local_parm_name, parm_opt, NULL);
8311 if (parm_opt_value) {
8312 printf( "%s\n", parm_opt_value);
8319 /* check for a key and print the value */
8326 for (i = 0; parm_table[i].label; i++) {
8327 if (strwicmp(parm_table[i].label, parm_name) == 0 &&
8328 !(parm_table[i].flags & FLAG_META) &&
8329 (parm_table[i].p_class == p_class || parm_table[i].flags & flag) &&
8330 parm_table[i].ptr &&
8331 (*parm_table[i].label != '-') &&
8332 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8337 ptr = parm_table[i].ptr;
8339 struct service *pService = ServicePtrs[snum];
8340 ptr = ((char *)pService) +
8341 PTR_DIFF(parm_table[i].ptr, &sDefault);
8344 print_parameter(&parm_table[i],
8355 /***************************************************************************
8356 Return info about the requested parameter (given as a string).
8357 Return NULL when the string is not a valid parameter name.
8358 ***************************************************************************/
8360 struct parm_struct *lp_get_parameter(const char *param_name)
8362 int num = map_parameter(param_name);
8368 return &parm_table[num];
8371 /***************************************************************************
8372 Return info about the next parameter in a service.
8373 snum==GLOBAL_SECTION_SNUM gives the globals.
8374 Return NULL when out of parameters.
8375 ***************************************************************************/
8377 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
8380 /* do the globals */
8381 for (; parm_table[*i].label; (*i)++) {
8382 if (parm_table[*i].p_class == P_SEPARATOR)
8383 return &parm_table[(*i)++];
8385 if (!parm_table[*i].ptr
8386 || (*parm_table[*i].label == '-'))
8390 && (parm_table[*i].ptr ==
8391 parm_table[(*i) - 1].ptr))
8394 if (is_default(*i) && !allparameters)
8397 return &parm_table[(*i)++];
8400 struct service *pService = ServicePtrs[snum];
8402 for (; parm_table[*i].label; (*i)++) {
8403 if (parm_table[*i].p_class == P_SEPARATOR)
8404 return &parm_table[(*i)++];
8406 if (parm_table[*i].p_class == P_LOCAL &&
8407 parm_table[*i].ptr &&
8408 (*parm_table[*i].label != '-') &&
8410 (parm_table[*i].ptr !=
8411 parm_table[(*i) - 1].ptr)))
8414 PTR_DIFF(parm_table[*i].ptr,
8417 if (allparameters ||
8418 !equal_parameter(parm_table[*i].type,
8419 ((char *)pService) +
8421 ((char *)&sDefault) +
8424 return &parm_table[(*i)++];
8435 /***************************************************************************
8436 Display the contents of a single copy structure.
8437 ***************************************************************************/
8438 static void dump_copy_map(bool *pcopymap)
8444 printf("\n\tNon-Copied parameters:\n");
8446 for (i = 0; parm_table[i].label; i++)
8447 if (parm_table[i].p_class == P_LOCAL &&
8448 parm_table[i].ptr && !pcopymap[i] &&
8449 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8451 printf("\t\t%s\n", parm_table[i].label);
8456 /***************************************************************************
8457 Return TRUE if the passed service number is within range.
8458 ***************************************************************************/
8460 bool lp_snum_ok(int iService)
8462 return (LP_SNUM_OK(iService) && ServicePtrs[iService]->bAvailable);
8465 /***************************************************************************
8466 Auto-load some home services.
8467 ***************************************************************************/
8469 static void lp_add_auto_services(char *str)
8479 s = SMB_STRDUP(str);
8483 homes = lp_servicenumber(HOMES_NAME);
8485 for (p = strtok_r(s, LIST_SEP, &saveptr); p;
8486 p = strtok_r(NULL, LIST_SEP, &saveptr)) {
8489 if (lp_servicenumber(p) >= 0)
8492 home = get_user_home_dir(talloc_tos(), p);
8494 if (home && home[0] && homes >= 0)
8495 lp_add_home(p, homes, p, home);
8502 /***************************************************************************
8503 Auto-load one printer.
8504 ***************************************************************************/
8506 void lp_add_one_printer(const char *name, const char *comment, void *pdata)
8508 int printers = lp_servicenumber(PRINTERS_NAME);
8511 if (lp_servicenumber(name) < 0) {
8512 lp_add_printer(name, printers);
8513 if ((i = lp_servicenumber(name)) >= 0) {
8514 string_set(&ServicePtrs[i]->comment, comment);
8515 ServicePtrs[i]->autoloaded = True;
8520 /***************************************************************************
8521 Have we loaded a services file yet?
8522 ***************************************************************************/
8524 bool lp_loaded(void)
8529 /***************************************************************************
8530 Unload unused services.
8531 ***************************************************************************/
8533 void lp_killunused(bool (*snumused) (int))
8536 for (i = 0; i < iNumServices; i++) {
8540 /* don't kill autoloaded or usershare services */
8541 if ( ServicePtrs[i]->autoloaded ||
8542 ServicePtrs[i]->usershare == USERSHARE_VALID) {
8546 if (!snumused || !snumused(i)) {
8547 free_service_byindex(i);
8553 * Kill all except autoloaded and usershare services - convenience wrapper
8555 void lp_kill_all_services(void)
8557 lp_killunused(NULL);
8560 /***************************************************************************
8562 ***************************************************************************/
8564 void lp_killservice(int iServiceIn)
8566 if (VALID(iServiceIn)) {
8567 free_service_byindex(iServiceIn);
8571 /***************************************************************************
8572 Save the curent values of all global and sDefault parameters into the
8573 defaults union. This allows swat and testparm to show only the
8574 changed (ie. non-default) parameters.
8575 ***************************************************************************/
8577 static void lp_save_defaults(void)
8580 for (i = 0; parm_table[i].label; i++) {
8581 if (i > 0 && parm_table[i].ptr == parm_table[i - 1].ptr)
8583 switch (parm_table[i].type) {
8585 parm_table[i].def.lvalue = str_list_copy(
8586 NULL, *(const char ***)parm_table[i].ptr);
8590 if (parm_table[i].ptr) {
8591 parm_table[i].def.svalue = SMB_STRDUP(*(char **)parm_table[i].ptr);
8593 parm_table[i].def.svalue = NULL;
8598 parm_table[i].def.bvalue =
8599 *(bool *)parm_table[i].ptr;
8602 parm_table[i].def.cvalue =
8603 *(char *)parm_table[i].ptr;
8608 parm_table[i].def.ivalue =
8609 *(int *)parm_table[i].ptr;
8615 defaults_saved = True;
8618 /***********************************************************
8619 If we should send plaintext/LANMAN passwords in the clinet
8620 ************************************************************/
8622 static void set_allowed_client_auth(void)
8624 if (Globals.bClientNTLMv2Auth) {
8625 Globals.bClientLanManAuth = False;
8627 if (!Globals.bClientLanManAuth) {
8628 Globals.bClientPlaintextAuth = False;
8632 /***************************************************************************
8634 The following code allows smbd to read a user defined share file.
8635 Yes, this is my intent. Yes, I'm comfortable with that...
8637 THE FOLLOWING IS SECURITY CRITICAL CODE.
8639 It washes your clothes, it cleans your house, it guards you while you sleep...
8640 Do not f%^k with it....
8641 ***************************************************************************/
8643 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8645 /***************************************************************************
8646 Check allowed stat state of a usershare file.
8647 Ensure we print out who is dicking with us so the admin can
8648 get their sorry ass fired.
8649 ***************************************************************************/
8651 static bool check_usershare_stat(const char *fname,
8652 const SMB_STRUCT_STAT *psbuf)
8654 if (!S_ISREG(psbuf->st_ex_mode)) {
8655 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8656 "not a regular file\n",
8657 fname, (unsigned int)psbuf->st_ex_uid ));
8661 /* Ensure this doesn't have the other write bit set. */
8662 if (psbuf->st_ex_mode & S_IWOTH) {
8663 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8664 "public write. Refusing to allow as a usershare file.\n",
8665 fname, (unsigned int)psbuf->st_ex_uid ));
8669 /* Should be 10k or less. */
8670 if (psbuf->st_ex_size > MAX_USERSHARE_FILE_SIZE) {
8671 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8672 "too large (%u) to be a user share file.\n",
8673 fname, (unsigned int)psbuf->st_ex_uid,
8674 (unsigned int)psbuf->st_ex_size ));
8681 /***************************************************************************
8682 Parse the contents of a usershare file.
8683 ***************************************************************************/
8685 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
8686 SMB_STRUCT_STAT *psbuf,
8687 const char *servicename,
8691 char **pp_sharepath,
8693 char **pp_cp_servicename,
8694 struct security_descriptor **ppsd,
8697 const char **prefixallowlist = lp_usershare_prefix_allow_list();
8698 const char **prefixdenylist = lp_usershare_prefix_deny_list();
8701 SMB_STRUCT_STAT sbuf;
8702 char *sharepath = NULL;
8703 char *comment = NULL;
8705 *pp_sharepath = NULL;
8708 *pallow_guest = False;
8711 return USERSHARE_MALFORMED_FILE;
8714 if (strcmp(lines[0], "#VERSION 1") == 0) {
8716 } else if (strcmp(lines[0], "#VERSION 2") == 0) {
8719 return USERSHARE_MALFORMED_FILE;
8722 return USERSHARE_BAD_VERSION;
8725 if (strncmp(lines[1], "path=", 5) != 0) {
8726 return USERSHARE_MALFORMED_PATH;
8729 sharepath = talloc_strdup(ctx, &lines[1][5]);
8731 return USERSHARE_POSIX_ERR;
8733 trim_string(sharepath, " ", " ");
8735 if (strncmp(lines[2], "comment=", 8) != 0) {
8736 return USERSHARE_MALFORMED_COMMENT_DEF;
8739 comment = talloc_strdup(ctx, &lines[2][8]);
8741 return USERSHARE_POSIX_ERR;
8743 trim_string(comment, " ", " ");
8744 trim_char(comment, '"', '"');
8746 if (strncmp(lines[3], "usershare_acl=", 14) != 0) {
8747 return USERSHARE_MALFORMED_ACL_DEF;
8750 if (!parse_usershare_acl(ctx, &lines[3][14], ppsd)) {
8751 return USERSHARE_ACL_ERR;
8755 if (strncmp(lines[4], "guest_ok=", 9) != 0) {
8756 return USERSHARE_MALFORMED_ACL_DEF;
8758 if (lines[4][9] == 'y') {
8759 *pallow_guest = True;
8762 /* Backwards compatible extension to file version #2. */
8764 if (strncmp(lines[5], "sharename=", 10) != 0) {
8765 return USERSHARE_MALFORMED_SHARENAME_DEF;
8767 if (!strequal(&lines[5][10], servicename)) {
8768 return USERSHARE_BAD_SHARENAME;
8770 *pp_cp_servicename = talloc_strdup(ctx, &lines[5][10]);
8771 if (!*pp_cp_servicename) {
8772 return USERSHARE_POSIX_ERR;
8777 if (*pp_cp_servicename == NULL) {
8778 *pp_cp_servicename = talloc_strdup(ctx, servicename);
8779 if (!*pp_cp_servicename) {
8780 return USERSHARE_POSIX_ERR;
8784 if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->szPath) == 0)) {
8785 /* Path didn't change, no checks needed. */
8786 *pp_sharepath = sharepath;
8787 *pp_comment = comment;
8788 return USERSHARE_OK;
8791 /* The path *must* be absolute. */
8792 if (sharepath[0] != '/') {
8793 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8794 servicename, sharepath));
8795 return USERSHARE_PATH_NOT_ABSOLUTE;
8798 /* If there is a usershare prefix deny list ensure one of these paths
8799 doesn't match the start of the user given path. */
8800 if (prefixdenylist) {
8802 for ( i=0; prefixdenylist[i]; i++ ) {
8803 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8804 servicename, i, prefixdenylist[i], sharepath ));
8805 if (memcmp( sharepath, prefixdenylist[i], strlen(prefixdenylist[i])) == 0) {
8806 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8807 "usershare prefix deny list entries.\n",
8808 servicename, sharepath));
8809 return USERSHARE_PATH_IS_DENIED;
8814 /* If there is a usershare prefix allow list ensure one of these paths
8815 does match the start of the user given path. */
8817 if (prefixallowlist) {
8819 for ( i=0; prefixallowlist[i]; i++ ) {
8820 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8821 servicename, i, prefixallowlist[i], sharepath ));
8822 if (memcmp( sharepath, prefixallowlist[i], strlen(prefixallowlist[i])) == 0) {
8826 if (prefixallowlist[i] == NULL) {
8827 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8828 "usershare prefix allow list entries.\n",
8829 servicename, sharepath));
8830 return USERSHARE_PATH_NOT_ALLOWED;
8834 /* Ensure this is pointing to a directory. */
8835 dp = sys_opendir(sharepath);
8838 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8839 servicename, sharepath));
8840 return USERSHARE_PATH_NOT_DIRECTORY;
8843 /* Ensure the owner of the usershare file has permission to share
8846 if (sys_stat(sharepath, &sbuf, false) == -1) {
8847 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8848 servicename, sharepath, strerror(errno) ));
8850 return USERSHARE_POSIX_ERR;
8855 if (!S_ISDIR(sbuf.st_ex_mode)) {
8856 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8857 servicename, sharepath ));
8858 return USERSHARE_PATH_NOT_DIRECTORY;
8861 /* Check if sharing is restricted to owner-only. */
8862 /* psbuf is the stat of the usershare definition file,
8863 sbuf is the stat of the target directory to be shared. */
8865 if (lp_usershare_owner_only()) {
8866 /* root can share anything. */
8867 if ((psbuf->st_ex_uid != 0) && (sbuf.st_ex_uid != psbuf->st_ex_uid)) {
8868 return USERSHARE_PATH_NOT_ALLOWED;
8872 *pp_sharepath = sharepath;
8873 *pp_comment = comment;
8874 return USERSHARE_OK;
8877 /***************************************************************************
8878 Deal with a usershare file.
8881 -1 - Bad name, invalid contents.
8882 - service name already existed and not a usershare, problem
8883 with permissions to share directory etc.
8884 ***************************************************************************/
8886 static int process_usershare_file(const char *dir_name, const char *file_name, int snum_template)
8888 SMB_STRUCT_STAT sbuf;
8889 SMB_STRUCT_STAT lsbuf;
8891 char *sharepath = NULL;
8892 char *comment = NULL;
8893 char *cp_service_name = NULL;
8894 char **lines = NULL;
8898 TALLOC_CTX *ctx = talloc_stackframe();
8899 struct security_descriptor *psd = NULL;
8900 bool guest_ok = False;
8901 char *canon_name = NULL;
8902 bool added_service = false;
8905 /* Ensure share name doesn't contain invalid characters. */
8906 if (!validate_net_name(file_name, INVALID_SHARENAME_CHARS, strlen(file_name))) {
8907 DEBUG(0,("process_usershare_file: share name %s contains "
8908 "invalid characters (any of %s)\n",
8909 file_name, INVALID_SHARENAME_CHARS ));
8913 canon_name = canonicalize_servicename(ctx, file_name);
8918 fname = talloc_asprintf(ctx, "%s/%s", dir_name, file_name);
8923 /* Minimize the race condition by doing an lstat before we
8924 open and fstat. Ensure this isn't a symlink link. */
8926 if (sys_lstat(fname, &lsbuf, false) != 0) {
8927 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8928 fname, strerror(errno) ));
8932 /* This must be a regular file, not a symlink, directory or
8933 other strange filetype. */
8934 if (!check_usershare_stat(fname, &lsbuf)) {
8939 TDB_DATA data = dbwrap_fetch_bystring(
8940 ServiceHash, canon_name, canon_name);
8944 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
8945 iService = *(int *)data.dptr;
8949 if (iService != -1 &&
8950 timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
8951 &lsbuf.st_ex_mtime) == 0) {
8952 /* Nothing changed - Mark valid and return. */
8953 DEBUG(10,("process_usershare_file: service %s not changed.\n",
8955 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8960 /* Try and open the file read only - no symlinks allowed. */
8962 fd = sys_open(fname, O_RDONLY|O_NOFOLLOW, 0);
8964 fd = sys_open(fname, O_RDONLY, 0);
8968 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
8969 fname, strerror(errno) ));
8973 /* Now fstat to be *SURE* it's a regular file. */
8974 if (sys_fstat(fd, &sbuf, false) != 0) {
8976 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
8977 fname, strerror(errno) ));
8981 /* Is it the same dev/inode as was lstated ? */
8982 if (lsbuf.st_ex_dev != sbuf.st_ex_dev || lsbuf.st_ex_ino != sbuf.st_ex_ino) {
8984 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
8985 "Symlink spoofing going on ?\n", fname ));
8989 /* This must be a regular file, not a symlink, directory or
8990 other strange filetype. */
8991 if (!check_usershare_stat(fname, &sbuf)) {
8995 lines = fd_lines_load(fd, &numlines, MAX_USERSHARE_FILE_SIZE, NULL);
8998 if (lines == NULL) {
8999 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
9000 fname, (unsigned int)sbuf.st_ex_uid ));
9004 if (parse_usershare_file(ctx, &sbuf, file_name,
9005 iService, lines, numlines, &sharepath,
9006 &comment, &cp_service_name,
9007 &psd, &guest_ok) != USERSHARE_OK) {
9011 /* Everything ok - add the service possibly using a template. */
9013 const struct service *sp = &sDefault;
9014 if (snum_template != -1) {
9015 sp = ServicePtrs[snum_template];
9018 if ((iService = add_a_service(sp, cp_service_name)) < 0) {
9019 DEBUG(0, ("process_usershare_file: Failed to add "
9020 "new service %s\n", cp_service_name));
9024 added_service = true;
9026 /* Read only is controlled by usershare ACL below. */
9027 ServicePtrs[iService]->bRead_only = False;
9030 /* Write the ACL of the new/modified share. */
9031 if (!set_share_security(canon_name, psd)) {
9032 DEBUG(0, ("process_usershare_file: Failed to set share "
9033 "security for user share %s\n",
9038 /* If from a template it may be marked invalid. */
9039 ServicePtrs[iService]->valid = True;
9041 /* Set the service as a valid usershare. */
9042 ServicePtrs[iService]->usershare = USERSHARE_VALID;
9044 /* Set guest access. */
9045 if (lp_usershare_allow_guests()) {
9046 ServicePtrs[iService]->bGuest_ok = guest_ok;
9049 /* And note when it was loaded. */
9050 ServicePtrs[iService]->usershare_last_mod = sbuf.st_ex_mtime;
9051 string_set(&ServicePtrs[iService]->szPath, sharepath);
9052 string_set(&ServicePtrs[iService]->comment, comment);
9058 if (ret == -1 && iService != -1 && added_service) {
9059 lp_remove_service(iService);
9067 /***************************************************************************
9068 Checks if a usershare entry has been modified since last load.
9069 ***************************************************************************/
9071 static bool usershare_exists(int iService, struct timespec *last_mod)
9073 SMB_STRUCT_STAT lsbuf;
9074 const char *usersharepath = Globals.szUsersharePath;
9077 if (asprintf(&fname, "%s/%s",
9079 ServicePtrs[iService]->szService) < 0) {
9083 if (sys_lstat(fname, &lsbuf, false) != 0) {
9088 if (!S_ISREG(lsbuf.st_ex_mode)) {
9094 *last_mod = lsbuf.st_ex_mtime;
9098 /***************************************************************************
9099 Load a usershare service by name. Returns a valid servicenumber or -1.
9100 ***************************************************************************/
9102 int load_usershare_service(const char *servicename)
9104 SMB_STRUCT_STAT sbuf;
9105 const char *usersharepath = Globals.szUsersharePath;
9106 int max_user_shares = Globals.iUsershareMaxShares;
9107 int snum_template = -1;
9109 if (*usersharepath == 0 || max_user_shares == 0) {
9113 if (sys_stat(usersharepath, &sbuf, false) != 0) {
9114 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
9115 usersharepath, strerror(errno) ));
9119 if (!S_ISDIR(sbuf.st_ex_mode)) {
9120 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
9126 * This directory must be owned by root, and have the 't' bit set.
9127 * It also must not be writable by "other".
9131 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
9133 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
9135 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
9136 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9141 /* Ensure the template share exists if it's set. */
9142 if (Globals.szUsershareTemplateShare[0]) {
9143 /* We can't use lp_servicenumber here as we are recommending that
9144 template shares have -valid=False set. */
9145 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
9146 if (ServicePtrs[snum_template]->szService &&
9147 strequal(ServicePtrs[snum_template]->szService,
9148 Globals.szUsershareTemplateShare)) {
9153 if (snum_template == -1) {
9154 DEBUG(0,("load_usershare_service: usershare template share %s "
9155 "does not exist.\n",
9156 Globals.szUsershareTemplateShare ));
9161 return process_usershare_file(usersharepath, servicename, snum_template);
9164 /***************************************************************************
9165 Load all user defined shares from the user share directory.
9166 We only do this if we're enumerating the share list.
9167 This is the function that can delete usershares that have
9169 ***************************************************************************/
9171 int load_usershare_shares(void)
9174 SMB_STRUCT_STAT sbuf;
9175 SMB_STRUCT_DIRENT *de;
9176 int num_usershares = 0;
9177 int max_user_shares = Globals.iUsershareMaxShares;
9178 unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries;
9179 unsigned int allowed_bad_entries = ((2*max_user_shares)/10);
9180 unsigned int allowed_tmp_entries = ((2*max_user_shares)/10);
9182 int snum_template = -1;
9183 const char *usersharepath = Globals.szUsersharePath;
9184 int ret = lp_numservices();
9186 if (max_user_shares == 0 || *usersharepath == '\0') {
9187 return lp_numservices();
9190 if (sys_stat(usersharepath, &sbuf, false) != 0) {
9191 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
9192 usersharepath, strerror(errno) ));
9197 * This directory must be owned by root, and have the 't' bit set.
9198 * It also must not be writable by "other".
9202 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
9204 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
9206 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
9207 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9212 /* Ensure the template share exists if it's set. */
9213 if (Globals.szUsershareTemplateShare[0]) {
9214 /* We can't use lp_servicenumber here as we are recommending that
9215 template shares have -valid=False set. */
9216 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
9217 if (ServicePtrs[snum_template]->szService &&
9218 strequal(ServicePtrs[snum_template]->szService,
9219 Globals.szUsershareTemplateShare)) {
9224 if (snum_template == -1) {
9225 DEBUG(0,("load_usershare_shares: usershare template share %s "
9226 "does not exist.\n",
9227 Globals.szUsershareTemplateShare ));
9232 /* Mark all existing usershares as pending delete. */
9233 for (iService = iNumServices - 1; iService >= 0; iService--) {
9234 if (VALID(iService) && ServicePtrs[iService]->usershare) {
9235 ServicePtrs[iService]->usershare = USERSHARE_PENDING_DELETE;
9239 dp = sys_opendir(usersharepath);
9241 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
9242 usersharepath, strerror(errno) ));
9246 for (num_dir_entries = 0, num_bad_dir_entries = 0, num_tmp_dir_entries = 0;
9247 (de = sys_readdir(dp));
9248 num_dir_entries++ ) {
9250 const char *n = de->d_name;
9252 /* Ignore . and .. */
9254 if ((n[1] == '\0') || (n[1] == '.' && n[2] == '\0')) {
9260 /* Temporary file used when creating a share. */
9261 num_tmp_dir_entries++;
9264 /* Allow 20% tmp entries. */
9265 if (num_tmp_dir_entries > allowed_tmp_entries) {
9266 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
9267 "in directory %s\n",
9268 num_tmp_dir_entries, usersharepath));
9272 r = process_usershare_file(usersharepath, n, snum_template);
9274 /* Update the services count. */
9276 if (num_usershares >= max_user_shares) {
9277 DEBUG(0,("load_usershare_shares: max user shares reached "
9278 "on file %s in directory %s\n",
9279 n, usersharepath ));
9282 } else if (r == -1) {
9283 num_bad_dir_entries++;
9286 /* Allow 20% bad entries. */
9287 if (num_bad_dir_entries > allowed_bad_entries) {
9288 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
9289 "in directory %s\n",
9290 num_bad_dir_entries, usersharepath));
9294 /* Allow 20% bad entries. */
9295 if (num_dir_entries > max_user_shares + allowed_bad_entries) {
9296 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
9297 "in directory %s\n",
9298 num_dir_entries, usersharepath));
9305 /* Sweep through and delete any non-refreshed usershares that are
9306 not currently in use. */
9307 for (iService = iNumServices - 1; iService >= 0; iService--) {
9308 if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
9309 if (conn_snum_used(iService)) {
9312 /* Remove from the share ACL db. */
9313 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
9314 lp_servicename(iService) ));
9315 delete_share_security(lp_servicename(iService));
9316 free_service_byindex(iService);
9320 return lp_numservices();
9323 /********************************************************
9324 Destroy global resources allocated in this file
9325 ********************************************************/
9327 void gfree_loadparm(void)
9333 /* Free resources allocated to services */
9335 for ( i = 0; i < iNumServices; i++ ) {
9337 free_service_byindex(i);
9341 SAFE_FREE( ServicePtrs );
9344 /* Now release all resources allocated to global
9345 parameters and the default service */
9347 free_global_parameters();
9351 /***************************************************************************
9352 Allow client apps to specify that they are a client
9353 ***************************************************************************/
9354 void lp_set_in_client(bool b)
9360 /***************************************************************************
9361 Determine if we're running in a client app
9362 ***************************************************************************/
9363 bool lp_is_in_client(void)
9368 /***************************************************************************
9369 Load the services array from the services file. Return True on success,
9371 ***************************************************************************/
9373 static bool lp_load_ex(const char *pszFname,
9377 bool initialize_globals,
9378 bool allow_include_registry,
9379 bool allow_registry_shares)
9386 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9388 bInGlobalSection = True;
9389 bGlobalOnly = global_only;
9390 bAllowIncludeRegistry = allow_include_registry;
9392 init_globals(initialize_globals);
9397 if (save_defaults) {
9402 free_param_opts(&Globals.param_opt);
9404 /* We get sections first, so have to start 'behind' to make up */
9407 if (lp_config_backend_is_file()) {
9408 n2 = talloc_sub_basic(talloc_tos(), get_current_username(),
9409 current_user_info.domain,
9412 smb_panic("lp_load_ex: out of memory");
9415 add_to_file_list(pszFname, n2);
9417 bRetval = pm_process(n2, do_section, do_parameter, NULL);
9420 /* finish up the last section */
9421 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
9423 if (iServiceIndex >= 0) {
9424 bRetval = service_ok(iServiceIndex);
9428 if (lp_config_backend_is_registry()) {
9429 /* config backend changed to registry in config file */
9431 * We need to use this extra global variable here to
9432 * survive restart: init_globals uses this as a default
9433 * for ConfigBackend. Otherwise, init_globals would
9434 * send us into an endless loop here.
9436 config_backend = CONFIG_BACKEND_REGISTRY;
9438 DEBUG(1, ("lp_load_ex: changing to config backend "
9441 lp_kill_all_services();
9442 return lp_load_ex(pszFname, global_only, save_defaults,
9443 add_ipc, initialize_globals,
9444 allow_include_registry,
9445 allow_registry_shares);
9447 } else if (lp_config_backend_is_registry()) {
9448 bRetval = process_registry_globals();
9450 DEBUG(0, ("Illegal config backend given: %d\n",
9451 lp_config_backend()));
9455 if (bRetval && lp_registry_shares() && allow_registry_shares) {
9456 bRetval = process_registry_shares();
9459 lp_add_auto_services(lp_auto_services());
9462 /* When 'restrict anonymous = 2' guest connections to ipc$
9464 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9465 if ( lp_enable_asu_support() ) {
9466 lp_add_ipc("ADMIN$", false);
9471 set_default_server_announce_type();
9472 set_allowed_client_auth();
9476 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9477 /* if bWINSsupport is true and we are in the client */
9478 if (lp_is_in_client() && Globals.bWINSsupport) {
9479 lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
9484 bAllowIncludeRegistry = true;
9489 bool lp_load(const char *pszFname,
9493 bool initialize_globals)
9495 return lp_load_ex(pszFname,
9500 true, /* allow_include_registry */
9501 false); /* allow_registry_shares*/
9504 bool lp_load_initial_only(const char *pszFname)
9506 return lp_load_ex(pszFname,
9507 true, /* global only */
9508 false, /* save_defaults */
9509 false, /* add_ipc */
9510 true, /* initialize_globals */
9511 false, /* allow_include_registry */
9512 false); /* allow_registry_shares*/
9515 bool lp_load_with_registry_shares(const char *pszFname,
9519 bool initialize_globals)
9521 return lp_load_ex(pszFname,
9526 true, /* allow_include_registry */
9527 true); /* allow_registry_shares*/
9530 /***************************************************************************
9531 Return the max number of services.
9532 ***************************************************************************/
9534 int lp_numservices(void)
9536 return (iNumServices);
9539 /***************************************************************************
9540 Display the contents of the services array in human-readable form.
9541 ***************************************************************************/
9543 void lp_dump(FILE *f, bool show_defaults, int maxtoprint)
9548 defaults_saved = False;
9552 dump_a_service(&sDefault, f);
9554 for (iService = 0; iService < maxtoprint; iService++) {
9556 lp_dump_one(f, show_defaults, iService);
9560 /***************************************************************************
9561 Display the contents of one service in human-readable form.
9562 ***************************************************************************/
9564 void lp_dump_one(FILE * f, bool show_defaults, int snum)
9567 if (ServicePtrs[snum]->szService[0] == '\0')
9569 dump_a_service(ServicePtrs[snum], f);
9573 /***************************************************************************
9574 Return the number of the service with the given name, or -1 if it doesn't
9575 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9576 getservicebyname()! This works ONLY if all services have been loaded, and
9577 does not copy the found service.
9578 ***************************************************************************/
9580 int lp_servicenumber(const char *pszServiceName)
9583 fstring serviceName;
9585 if (!pszServiceName) {
9586 return GLOBAL_SECTION_SNUM;
9589 for (iService = iNumServices - 1; iService >= 0; iService--) {
9590 if (VALID(iService) && ServicePtrs[iService]->szService) {
9592 * The substitution here is used to support %U is
9595 fstrcpy(serviceName, ServicePtrs[iService]->szService);
9596 standard_sub_basic(get_current_username(),
9597 current_user_info.domain,
9598 serviceName,sizeof(serviceName));
9599 if (strequal(serviceName, pszServiceName)) {
9605 if (iService >= 0 && ServicePtrs[iService]->usershare == USERSHARE_VALID) {
9606 struct timespec last_mod;
9608 if (!usershare_exists(iService, &last_mod)) {
9609 /* Remove the share security tdb entry for it. */
9610 delete_share_security(lp_servicename(iService));
9611 /* Remove it from the array. */
9612 free_service_byindex(iService);
9613 /* Doesn't exist anymore. */
9614 return GLOBAL_SECTION_SNUM;
9617 /* Has it been modified ? If so delete and reload. */
9618 if (timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
9620 /* Remove it from the array. */
9621 free_service_byindex(iService);
9622 /* and now reload it. */
9623 iService = load_usershare_service(pszServiceName);
9628 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
9629 return GLOBAL_SECTION_SNUM;
9635 bool share_defined(const char *service_name)
9637 return (lp_servicenumber(service_name) != -1);
9640 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
9641 const char *sharename)
9643 struct share_params *result;
9647 snum = find_service(mem_ctx, sharename, &sname);
9648 if (snum < 0 || sname == NULL) {
9652 if (!(result = TALLOC_P(mem_ctx, struct share_params))) {
9653 DEBUG(0, ("talloc failed\n"));
9657 result->service = snum;
9661 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx)
9663 struct share_iterator *result;
9665 if (!(result = TALLOC_P(mem_ctx, struct share_iterator))) {
9666 DEBUG(0, ("talloc failed\n"));
9670 result->next_id = 0;
9674 struct share_params *next_share(struct share_iterator *list)
9676 struct share_params *result;
9678 while (!lp_snum_ok(list->next_id) &&
9679 (list->next_id < lp_numservices())) {
9683 if (list->next_id >= lp_numservices()) {
9687 if (!(result = TALLOC_P(list, struct share_params))) {
9688 DEBUG(0, ("talloc failed\n"));
9692 result->service = list->next_id;
9697 struct share_params *next_printer(struct share_iterator *list)
9699 struct share_params *result;
9701 while ((result = next_share(list)) != NULL) {
9702 if (lp_print_ok(result->service)) {
9710 * This is a hack for a transition period until we transformed all code from
9711 * service numbers to struct share_params.
9714 struct share_params *snum2params_static(int snum)
9716 static struct share_params result;
9717 result.service = snum;
9721 /*******************************************************************
9722 A useful volume label function.
9723 ********************************************************************/
9725 const char *volume_label(int snum)
9728 const char *label = lp_volume(snum);
9730 label = lp_servicename(snum);
9733 /* This returns a 33 byte guarenteed null terminated string. */
9734 ret = talloc_strndup(talloc_tos(), label, 32);
9741 /*******************************************************************
9742 Set the server type we will announce as via nmbd.
9743 ********************************************************************/
9745 static void set_default_server_announce_type(void)
9747 default_server_announce = 0;
9748 default_server_announce |= SV_TYPE_WORKSTATION;
9749 default_server_announce |= SV_TYPE_SERVER;
9750 default_server_announce |= SV_TYPE_SERVER_UNIX;
9752 /* note that the flag should be set only if we have a
9753 printer service but nmbd doesn't actually load the
9754 services so we can't tell --jerry */
9756 default_server_announce |= SV_TYPE_PRINTQ_SERVER;
9758 switch (lp_announce_as()) {
9759 case ANNOUNCE_AS_NT_SERVER:
9760 default_server_announce |= SV_TYPE_SERVER_NT;
9761 /* fall through... */
9762 case ANNOUNCE_AS_NT_WORKSTATION:
9763 default_server_announce |= SV_TYPE_NT;
9765 case ANNOUNCE_AS_WIN95:
9766 default_server_announce |= SV_TYPE_WIN95_PLUS;
9768 case ANNOUNCE_AS_WFW:
9769 default_server_announce |= SV_TYPE_WFW;
9775 switch (lp_server_role()) {
9776 case ROLE_DOMAIN_MEMBER:
9777 default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
9779 case ROLE_DOMAIN_PDC:
9780 default_server_announce |= SV_TYPE_DOMAIN_CTRL;
9782 case ROLE_DOMAIN_BDC:
9783 default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL;
9785 case ROLE_STANDALONE:
9789 if (lp_time_server())
9790 default_server_announce |= SV_TYPE_TIME_SOURCE;
9792 if (lp_host_msdfs())
9793 default_server_announce |= SV_TYPE_DFS_SERVER;
9796 /***********************************************************
9797 If we are PDC then prefer us as DMB
9798 ************************************************************/
9800 bool lp_domain_master(void)
9802 if (Globals.iDomainMaster == Auto)
9803 return (lp_server_role() == ROLE_DOMAIN_PDC);
9805 return (bool)Globals.iDomainMaster;
9808 /***********************************************************
9809 If we are PDC then prefer us as DMB
9810 ************************************************************/
9812 bool lp_domain_master_true_or_auto(void)
9814 if (Globals.iDomainMaster) /* auto or yes */
9820 /***********************************************************
9821 If we are DMB then prefer us as LMB
9822 ************************************************************/
9824 bool lp_preferred_master(void)
9826 if (Globals.iPreferredMaster == Auto)
9827 return (lp_local_master() && lp_domain_master());
9829 return (bool)Globals.iPreferredMaster;
9832 /*******************************************************************
9834 ********************************************************************/
9836 void lp_remove_service(int snum)
9838 ServicePtrs[snum]->valid = False;
9839 invalid_services[num_invalid_services++] = snum;
9842 /*******************************************************************
9844 ********************************************************************/
9846 void lp_copy_service(int snum, const char *new_name)
9848 do_section(new_name, NULL);
9850 snum = lp_servicenumber(new_name);
9852 lp_do_parameter(snum, "copy", lp_servicename(snum));
9857 /*******************************************************************
9858 Get the default server type we will announce as via nmbd.
9859 ********************************************************************/
9861 int lp_default_server_announce(void)
9863 return default_server_announce;
9866 /*******************************************************************
9867 Split the announce version into major and minor numbers.
9868 ********************************************************************/
9870 int lp_major_announce_version(void)
9872 static bool got_major = False;
9873 static int major_version = DEFAULT_MAJOR_VERSION;
9878 return major_version;
9881 if ((vers = lp_announce_version()) == NULL)
9882 return major_version;
9884 if ((p = strchr_m(vers, '.')) == 0)
9885 return major_version;
9888 major_version = atoi(vers);
9889 return major_version;
9892 int lp_minor_announce_version(void)
9894 static bool got_minor = False;
9895 static int minor_version = DEFAULT_MINOR_VERSION;
9900 return minor_version;
9903 if ((vers = lp_announce_version()) == NULL)
9904 return minor_version;
9906 if ((p = strchr_m(vers, '.')) == 0)
9907 return minor_version;
9910 minor_version = atoi(p);
9911 return minor_version;
9914 /***********************************************************
9915 Set the global name resolution order (used in smbclient).
9916 ************************************************************/
9918 void lp_set_name_resolve_order(const char *new_order)
9920 string_set(&Globals.szNameResolveOrder, new_order);
9923 const char *lp_printername(int snum)
9925 const char *ret = _lp_printername(snum);
9926 if (ret == NULL || (ret != NULL && *ret == '\0'))
9927 ret = lp_const_servicename(snum);
9933 /***********************************************************
9934 Allow daemons such as winbindd to fix their logfile name.
9935 ************************************************************/
9937 void lp_set_logfile(const char *name)
9939 string_set(&Globals.szLogFile, name);
9940 debug_set_logfile(name);
9943 /*******************************************************************
9944 Return the max print jobs per queue.
9945 ********************************************************************/
9947 int lp_maxprintjobs(int snum)
9949 int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
9950 if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
9951 maxjobs = PRINT_MAX_JOBID - 1;
9956 const char *lp_printcapname(void)
9958 if ((Globals.szPrintcapname != NULL) &&
9959 (Globals.szPrintcapname[0] != '\0'))
9960 return Globals.szPrintcapname;
9962 if (sDefault.iPrinting == PRINT_CUPS) {
9970 if (sDefault.iPrinting == PRINT_BSD)
9971 return "/etc/printcap";
9973 return PRINTCAP_NAME;
9976 static uint32 spoolss_state;
9978 bool lp_disable_spoolss( void )
9980 if ( spoolss_state == SVCCTL_STATE_UNKNOWN )
9981 spoolss_state = _lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9983 return spoolss_state == SVCCTL_STOPPED ? True : False;
9986 void lp_set_spoolss_state( uint32 state )
9988 SMB_ASSERT( (state == SVCCTL_STOPPED) || (state == SVCCTL_RUNNING) );
9990 spoolss_state = state;
9993 uint32 lp_get_spoolss_state( void )
9995 return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9998 /*******************************************************************
9999 Ensure we don't use sendfile if server smb signing is active.
10000 ********************************************************************/
10002 bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state)
10004 bool sign_active = false;
10006 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
10007 if (get_Protocol() < PROTOCOL_NT1) {
10010 if (signing_state) {
10011 sign_active = smb_signing_is_active(signing_state);
10013 return (_lp_use_sendfile(snum) &&
10014 (get_remote_arch() != RA_WIN95) &&
10018 /*******************************************************************
10019 Turn off sendfile if we find the underlying OS doesn't support it.
10020 ********************************************************************/
10022 void set_use_sendfile(int snum, bool val)
10024 if (LP_SNUM_OK(snum))
10025 ServicePtrs[snum]->bUseSendfile = val;
10027 sDefault.bUseSendfile = val;
10030 /*******************************************************************
10031 Turn off storing DOS attributes if this share doesn't support it.
10032 ********************************************************************/
10034 void set_store_dos_attributes(int snum, bool val)
10036 if (!LP_SNUM_OK(snum))
10038 ServicePtrs[(snum)]->bStoreDosAttributes = val;
10041 void lp_set_mangling_method(const char *new_method)
10043 string_set(&Globals.szManglingMethod, new_method);
10046 /*******************************************************************
10047 Global state for POSIX pathname processing.
10048 ********************************************************************/
10050 static bool posix_pathnames;
10052 bool lp_posix_pathnames(void)
10054 return posix_pathnames;
10057 /*******************************************************************
10058 Change everything needed to ensure POSIX pathname processing (currently
10060 ********************************************************************/
10062 void lp_set_posix_pathnames(void)
10064 posix_pathnames = True;
10067 /*******************************************************************
10068 Global state for POSIX lock processing - CIFS unix extensions.
10069 ********************************************************************/
10071 bool posix_default_lock_was_set;
10072 static enum brl_flavour posix_cifsx_locktype; /* By default 0 == WINDOWS_LOCK */
10074 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp)
10076 if (posix_default_lock_was_set) {
10077 return posix_cifsx_locktype;
10079 return fsp->posix_open ? POSIX_LOCK : WINDOWS_LOCK;
10083 /*******************************************************************
10084 ********************************************************************/
10086 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val)
10088 posix_default_lock_was_set = True;
10089 posix_cifsx_locktype = val;
10092 int lp_min_receive_file_size(void)
10094 if (Globals.iminreceivefile < 0) {
10097 return MIN(Globals.iminreceivefile, BUFFER_SIZE);
10100 /*******************************************************************
10101 If socket address is an empty character string, it is necessary to
10102 define it as "0.0.0.0".
10103 ********************************************************************/
10105 const char *lp_socket_address(void)
10107 char *sock_addr = Globals.szSocketAddress;
10109 if (sock_addr[0] == '\0'){
10110 string_set(&Globals.szSocketAddress, "0.0.0.0");
10112 return Globals.szSocketAddress;
10115 void lp_set_passdb_backend(const char *backend)
10117 string_set(&Globals.szPassdbBackend, backend);
10120 /*******************************************************************
10121 Safe wide links checks.
10122 This helper function always verify the validity of wide links,
10123 even after a configuration file reload.
10124 ********************************************************************/
10126 static bool lp_widelinks_internal(int snum)
10128 return (bool)(LP_SNUM_OK(snum)? ServicePtrs[(snum)]->bWidelinks :
10129 sDefault.bWidelinks);
10132 void widelinks_warning(int snum)
10134 if (lp_unix_extensions() && lp_widelinks_internal(snum)) {
10135 DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
10136 "These parameters are incompatible. "
10137 "Wide links will be disabled for this share.\n",
10138 lp_servicename(snum) ));
10142 bool lp_widelinks(int snum)
10144 /* wide links is always incompatible with unix extensions */
10145 if (lp_unix_extensions()) {
10149 return lp_widelinks_internal(snum);
10152 bool lp_writeraw(void)
10154 if (lp_async_smb_echo_handler()) {
10157 return _lp_writeraw();
10160 bool lp_readraw(void)
10162 if (lp_async_smb_echo_handler()) {
10165 return _lp_readraw();