2 Unix SMB/CIFS implementation.
3 Parameter loading functions
4 Copyright (C) Karl Auer 1993-1998
6 Largely re-written by Andrew Tridgell, September 1994
8 Copyright (C) Simo Sorce 2001
9 Copyright (C) Alexander Bokovoy 2002
10 Copyright (C) Stefan (metze) Metzmacher 2002
11 Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
12 Copyright (C) Michael Adam 2008
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 3 of the License, or
17 (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>.
31 * This module provides suitable callback functions for the params
32 * module. It builds the internal table of service details which is
33 * then used by the rest of the server.
37 * 1) add it to the global or service structure definition
38 * 2) add it to the parm_table
39 * 3) add it to the list of available functions (eg: using FN_GLOBAL_STRING())
40 * 4) If it's a global then initialise it in init_globals. If a local
41 * (ie. service) parameter then initialise it in the sDefault structure
45 * The configuration file is processed sequentially for speed. It is NOT
46 * accessed randomly as happens in 'real' Windows. For this reason, there
47 * is a fair bit of sequence-dependent code here - ie., code which assumes
48 * that certain things happen before others. In particular, the code which
49 * happens at the boundary between sections is delicately poised, so be
55 #include "system/filesys.h"
58 #include "lib/smbconf/smbconf.h"
59 #include "lib/smbconf/smbconf_init.h"
62 #include "../librpc/gen_ndr/svcctl.h"
64 #include "smb_signing.h"
68 #ifdef HAVE_SYS_SYSCTL_H
69 #include <sys/sysctl.h>
72 #ifdef HAVE_HTTPCONNECTENCRYPT
73 #include <cups/http.h>
78 extern userdom_struct current_user_info;
81 #define GLOBAL_NAME "global"
85 #define PRINTERS_NAME "printers"
89 #define HOMES_NAME "homes"
92 /* the special value for the include parameter
93 * to be interpreted not as a file name but to
94 * trigger loading of the global smb.conf options
96 #ifndef INCLUDE_REGISTRY_NAME
97 #define INCLUDE_REGISTRY_NAME "registry"
100 static bool in_client = False; /* Not in the client by default */
101 static struct smbconf_csn conf_last_csn;
103 #define CONFIG_BACKEND_FILE 0
104 #define CONFIG_BACKEND_REGISTRY 1
106 static int config_backend = CONFIG_BACKEND_FILE;
108 /* some helpful bits */
109 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
110 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
112 #define USERSHARE_VALID 1
113 #define USERSHARE_PENDING_DELETE 2
115 static bool defaults_saved = False;
117 struct param_opt_struct {
118 struct param_opt_struct *prev, *next;
126 * This structure describes global (ie., server-wide) parameters.
133 char *display_charset;
134 char *szPrintcapname;
135 char *szAddPortCommand;
136 char *szEnumPortsCommand;
137 char *szAddPrinterCommand;
138 char *szDeletePrinterCommand;
139 char *szOs2DriverMap;
145 char *szDefaultService;
149 char *szServerString;
150 char *szAutoServices;
151 char *szPasswdProgram;
155 char *szSMBPasswdFile;
157 char *szPassdbBackend;
158 char **szPreloadModules;
159 char *szPasswordServer;
160 char *szSocketOptions;
162 char *szAfsUsernameMap;
163 int iAfsTokenLifetime;
164 char *szLogNtTokenCommand;
170 char **szWINSservers;
172 char *szRemoteAnnounce;
173 char *szRemoteBrowseSync;
174 char *szSocketAddress;
175 bool bNmbdBindExplicitBroadcast;
176 char *szNISHomeMapName;
177 char *szAnnounceVersion; /* This is initialised in init_globals */
180 char **szNetbiosAliases;
181 char *szNetbiosScope;
182 char *szNameResolveOrder;
184 char *szAddUserScript;
185 char *szRenameUserScript;
186 char *szDelUserScript;
187 char *szAddGroupScript;
188 char *szDelGroupScript;
189 char *szAddUserToGroupScript;
190 char *szDelUserFromGroupScript;
191 char *szSetPrimaryGroupScript;
192 char *szAddMachineScript;
193 char *szShutdownScript;
194 char *szAbortShutdownScript;
195 char *szUsernameMapScript;
196 int iUsernameMapCacheTime;
197 char *szCheckPasswordScript;
204 bool bPassdbExpandExplicit;
205 int AlgorithmicRidBase;
206 char *szTemplateHomedir;
207 char *szTemplateShell;
208 char *szWinbindSeparator;
209 bool bWinbindEnumUsers;
210 bool bWinbindEnumGroups;
211 bool bWinbindUseDefaultDomain;
212 bool bWinbindTrustedDomainsOnly;
213 bool bWinbindNestedGroups;
214 int winbind_expand_groups;
215 bool bWinbindRefreshTickets;
216 bool bWinbindOfflineLogon;
217 bool bWinbindNormalizeNames;
218 bool bWinbindRpcOnly;
219 bool bCreateKrb5Conf;
220 int winbindMaxDomainConnections;
221 char *szIdmapBackend;
223 char *szAddShareCommand;
224 char *szChangeShareCommand;
225 char *szDeleteShareCommand;
227 char *szGuestaccount;
228 char *szManglingMethod;
229 char **szServicesList;
230 char *szUsersharePath;
231 char *szUsershareTemplateShare;
232 char **szUsersharePrefixAllowList;
233 char **szUsersharePrefixDenyList;
240 int open_files_db_hash_size;
249 bool paranoid_server_security;
252 int iMaxSmbdProcesses;
253 bool bDisableSpoolss;
256 bool enhanced_browsing;
262 int announce_as; /* This is initialised in init_globals */
263 int machine_password_timeout;
265 int oplock_break_wait_time;
266 int winbind_cache_time;
267 int winbind_reconnect_delay;
268 int winbind_max_clients;
269 char **szWinbindNssInfo;
271 char *szLdapMachineSuffix;
272 char *szLdapUserSuffix;
273 char *szLdapIdmapSuffix;
274 char *szLdapGroupSuffix;
278 int ldap_follow_referral;
281 int ldap_debug_level;
282 int ldap_debug_threshold;
286 char *szIPrintServer;
288 char **szClusterAddresses;
291 int ctdb_locktime_warn_threshold;
292 int ldap_passwd_sync;
293 int ldap_replication_sleep;
294 int ldap_timeout; /* This is initialised in init_globals */
295 int ldap_connection_timeout;
298 bool bMsAddPrinterWizard;
303 int iPreferredMaster;
306 char **szInitLogonDelayedHosts;
308 bool bEncryptPasswords;
313 bool bObeyPamRestrictions;
315 int PrintcapCacheTime;
316 bool bLargeReadwrite;
323 bool bBindInterfacesOnly;
324 bool bPamPasswordChange;
325 bool bUnixPasswdSync;
326 bool bPasswdChatDebug;
327 int iPasswdChatTimeout;
331 bool bNTStatusSupport;
333 int iMaxStatCacheSize;
335 bool bAllowTrustedDomains;
339 bool bClientLanManAuth;
340 bool bClientNTLMv2Auth;
341 bool bClientPlaintextAuth;
342 bool bClientUseSpnego;
343 bool client_use_spnego_principal;
344 bool send_spnego_principal;
345 bool bDebugPrefixTimestamp;
346 bool bDebugHiresTimestamp;
350 bool bEnableCoreFiles;
353 bool bHostnameLookups;
354 bool bUnixExtensions;
355 bool bDisableNetbios;
356 char * szDedicatedKeytabFile;
358 bool bDeferSharingViolations;
359 bool bEnablePrivileges;
361 bool bUsershareOwnerOnly;
362 bool bUsershareAllowGuests;
363 bool bRegistryShares;
364 int restrict_anonymous;
365 int name_cache_timeout;
368 int client_ldap_sasl_wrapping;
369 int iUsershareMaxShares;
371 int iIdmapNegativeCacheTime;
373 bool bLogWriteableFilesOnExit;
376 struct param_opt_struct *param_opt;
377 int cups_connection_timeout;
378 char *szSMBPerfcountModule;
379 bool bMapUntrustedToDomain;
380 bool bAsyncSMBEchoHandler;
381 bool bMulticastDnsRegister;
385 int ismb2_max_credits;
389 static struct global Globals;
392 * This structure describes a single service.
398 struct timespec usershare_last_mod;
402 char **szInvalidUsers;
410 char *szRootPostExec;
412 char *szPrintcommand;
415 char *szLppausecommand;
416 char *szLpresumecommand;
417 char *szQueuepausecommand;
418 char *szQueueresumecommand;
420 char *szPrintjobUsername;
428 char *szVetoOplockFiles;
434 char **printer_admin;
439 char *szAioWriteBehind;
443 int iMaxReportedPrintJobs;
446 int iCreate_force_mode;
448 int iSecurity_force_mode;
451 int iDir_Security_mask;
452 int iDir_Security_force_mode;
456 int iOplockContentionLimit;
461 bool bRootpreexecClose;
464 bool bShortCasePreserve;
466 bool bHideSpecialFiles;
467 bool bHideUnReadable;
468 bool bHideUnWriteableFiles;
470 bool bAccessBasedShareEnum;
475 bool bAdministrative_share;
478 bool bPrintNotifyBackchannel;
482 bool bStoreDosAttributes;
495 bool bStrictAllocate;
498 struct bitmap *copymap;
499 bool bDeleteReadonly;
501 bool bDeleteVetoFiles;
504 bool bDosFiletimeResolution;
505 bool bFakeDirCreateTimes;
511 bool bUseClientDriver;
512 bool bDefaultDevmode;
513 bool bForcePrintername;
515 bool bForceUnknownAclUser;
518 bool bMap_acl_inherit;
521 bool bAclCheckPermissions;
522 bool bAclMapFullControl;
523 bool bAclGroupControl;
525 bool bKernelChangeNotify;
526 int iallocation_roundup_size;
530 int iDirectoryNameCacheSize;
532 struct param_opt_struct *param_opt;
534 char dummy[3]; /* for alignment */
538 /* This is a default service used to prime a services structure */
539 static struct service sDefault = {
541 False, /* not autoloaded */
542 0, /* not a usershare */
543 {0, }, /* No last mod time */
544 NULL, /* szService */
546 NULL, /* szUsername */
547 NULL, /* szInvalidUsers */
548 NULL, /* szValidUsers */
549 NULL, /* szAdminUsers */
551 NULL, /* szInclude */
552 NULL, /* szPreExec */
553 NULL, /* szPostExec */
554 NULL, /* szRootPreExec */
555 NULL, /* szRootPostExec */
556 NULL, /* szCupsOptions */
557 NULL, /* szPrintcommand */
558 NULL, /* szLpqcommand */
559 NULL, /* szLprmcommand */
560 NULL, /* szLppausecommand */
561 NULL, /* szLpresumecommand */
562 NULL, /* szQueuepausecommand */
563 NULL, /* szQueueresumecommand */
564 NULL, /* szPrintername */
565 NULL, /* szPrintjobUsername */
566 NULL, /* szDontdescend */
567 NULL, /* szHostsallow */
568 NULL, /* szHostsdeny */
569 NULL, /* szMagicScript */
570 NULL, /* szMagicOutput */
571 NULL, /* szVetoFiles */
572 NULL, /* szHideFiles */
573 NULL, /* szVetoOplockFiles */
575 NULL, /* force user */
576 NULL, /* force group */
578 NULL, /* writelist */
579 NULL, /* printer admin */
582 NULL, /* vfs objects */
583 NULL, /* szMSDfsProxy */
584 NULL, /* szAioWriteBehind */
586 0, /* iMinPrintSpace */
587 1000, /* iMaxPrintJobs */
588 0, /* iMaxReportedPrintJobs */
589 0, /* iWriteCacheSize */
590 0744, /* iCreate_mask */
591 0000, /* iCreate_force_mode */
592 0777, /* iSecurity_mask */
593 0, /* iSecurity_force_mode */
594 0755, /* iDir_mask */
595 0000, /* iDir_force_mode */
596 0777, /* iDir_Security_mask */
597 0, /* iDir_Security_force_mode */
598 0, /* iMaxConnections */
599 CASE_LOWER, /* iDefaultCase */
600 DEFAULT_PRINTING, /* iPrinting */
601 2, /* iOplockContentionLimit */
603 1024, /* iBlock_size */
604 0, /* iDfreeCacheTime */
605 False, /* bPreexecClose */
606 False, /* bRootpreexecClose */
607 Auto, /* case sensitive */
608 True, /* case preserve */
609 True, /* short case preserve */
610 True, /* bHideDotFiles */
611 False, /* bHideSpecialFiles */
612 False, /* bHideUnReadable */
613 False, /* bHideUnWriteableFiles */
614 True, /* bBrowseable */
615 False, /* bAccessBasedShareEnum */
616 True, /* bAvailable */
617 True, /* bRead_only */
618 True, /* bNo_set_dir */
619 False, /* bGuest_only */
620 False, /* bAdministrative_share */
621 False, /* bGuest_ok */
622 False, /* bPrint_ok */
623 True, /* bPrintNotifyBackchannel */
624 False, /* bMap_system */
625 False, /* bMap_hidden */
626 True, /* bMap_archive */
627 False, /* bStoreDosAttributes */
628 False, /* bDmapiSupport */
630 Auto, /* iStrictLocking */
631 True, /* bPosixLocking */
632 True, /* bShareModes */
634 True, /* bLevel2OpLocks */
635 False, /* bOnlyUser */
636 True, /* bMangledNames */
637 false, /* bWidelinks */
638 True, /* bSymlinks */
639 False, /* bSyncAlways */
640 False, /* bStrictAllocate */
641 False, /* bStrictSync */
642 '~', /* magic char */
644 False, /* bDeleteReadonly */
645 False, /* bFakeOplocks */
646 False, /* bDeleteVetoFiles */
647 False, /* bDosFilemode */
648 True, /* bDosFiletimes */
649 False, /* bDosFiletimeResolution */
650 False, /* bFakeDirCreateTimes */
651 True, /* bBlockingLocks */
652 False, /* bInheritPerms */
653 False, /* bInheritACLS */
654 False, /* bInheritOwner */
655 False, /* bMSDfsRoot */
656 False, /* bUseClientDriver */
657 True, /* bDefaultDevmode */
658 False, /* bForcePrintername */
659 True, /* bNTAclSupport */
660 False, /* bForceUnknownAclUser */
661 False, /* bUseSendfile */
662 False, /* bProfileAcls */
663 False, /* bMap_acl_inherit */
664 False, /* bAfs_Share */
665 False, /* bEASupport */
666 True, /* bAclCheckPermissions */
667 True, /* bAclMapFullControl */
668 False, /* bAclGroupControl */
669 True, /* bChangeNotify */
670 True, /* bKernelChangeNotify */
671 SMB_ROUNDUP_ALLOCATION_SIZE, /* iallocation_roundup_size */
672 0, /* iAioReadSize */
673 0, /* iAioWriteSize */
674 MAP_READONLY_YES, /* iMap_readonly */
675 #ifdef BROKEN_DIRECTORY_HANDLING
676 0, /* iDirectoryNameCacheSize */
678 100, /* iDirectoryNameCacheSize */
680 Auto, /* ismb_encrypt */
681 NULL, /* Parametric options */
686 /* local variables */
687 static struct service **ServicePtrs = NULL;
688 static int iNumServices = 0;
689 static int iServiceIndex = 0;
690 static struct db_context *ServiceHash;
691 static int *invalid_services = NULL;
692 static int num_invalid_services = 0;
693 static bool bInGlobalSection = True;
694 static bool bGlobalOnly = False;
695 static int default_server_announce;
697 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
699 /* prototypes for the special type handlers */
700 static bool handle_include( int snum, const char *pszParmValue, char **ptr);
701 static bool handle_copy( int snum, const char *pszParmValue, char **ptr);
702 static bool handle_netbios_name( int snum, const char *pszParmValue, char **ptr);
703 static bool handle_idmap_backend(int snum, const char *pszParmValue, char **ptr);
704 static bool handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);
705 static bool handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);
706 static bool handle_debug_list( int snum, const char *pszParmValue, char **ptr );
707 static bool handle_workgroup( int snum, const char *pszParmValue, char **ptr );
708 static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
709 static bool handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );
710 static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
711 static bool handle_printing( int snum, const char *pszParmValue, char **ptr);
712 static bool handle_ldap_debug_level( int snum, const char *pszParmValue, char **ptr);
714 static void set_default_server_announce_type(void);
715 static void set_allowed_client_auth(void);
717 static void *lp_local_ptr(struct service *service, void *ptr);
719 static void add_to_file_list(const char *fname, const char *subfname);
720 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values);
722 static const struct enum_list enum_protocol[] = {
723 {PROTOCOL_SMB2, "SMB2"},
724 {PROTOCOL_NT1, "NT1"},
725 {PROTOCOL_LANMAN2, "LANMAN2"},
726 {PROTOCOL_LANMAN1, "LANMAN1"},
727 {PROTOCOL_CORE, "CORE"},
728 {PROTOCOL_COREPLUS, "COREPLUS"},
729 {PROTOCOL_COREPLUS, "CORE+"},
733 static const struct enum_list enum_security[] = {
734 {SEC_SHARE, "SHARE"},
736 {SEC_SERVER, "SERVER"},
737 {SEC_DOMAIN, "DOMAIN"},
744 static const struct enum_list enum_printing[] = {
745 {PRINT_SYSV, "sysv"},
747 {PRINT_HPUX, "hpux"},
751 {PRINT_LPRNG, "lprng"},
752 {PRINT_CUPS, "cups"},
753 {PRINT_IPRINT, "iprint"},
755 {PRINT_LPROS2, "os2"},
756 #if defined(DEVELOPER) || defined(ENABLE_BUILD_FARM_HACKS)
757 {PRINT_TEST, "test"},
759 #endif /* DEVELOPER */
763 static const struct enum_list enum_ldap_sasl_wrapping[] = {
765 {ADS_AUTH_SASL_SIGN, "sign"},
766 {ADS_AUTH_SASL_SEAL, "seal"},
770 static const struct enum_list enum_ldap_ssl[] = {
771 {LDAP_SSL_OFF, "no"},
772 {LDAP_SSL_OFF, "off"},
773 {LDAP_SSL_START_TLS, "start tls"},
774 {LDAP_SSL_START_TLS, "start_tls"},
778 /* LDAP Dereferencing Alias types */
779 #define SAMBA_LDAP_DEREF_NEVER 0
780 #define SAMBA_LDAP_DEREF_SEARCHING 1
781 #define SAMBA_LDAP_DEREF_FINDING 2
782 #define SAMBA_LDAP_DEREF_ALWAYS 3
784 static const struct enum_list enum_ldap_deref[] = {
785 {SAMBA_LDAP_DEREF_NEVER, "never"},
786 {SAMBA_LDAP_DEREF_SEARCHING, "searching"},
787 {SAMBA_LDAP_DEREF_FINDING, "finding"},
788 {SAMBA_LDAP_DEREF_ALWAYS, "always"},
792 static const struct enum_list enum_ldap_passwd_sync[] = {
793 {LDAP_PASSWD_SYNC_OFF, "no"},
794 {LDAP_PASSWD_SYNC_OFF, "off"},
795 {LDAP_PASSWD_SYNC_ON, "yes"},
796 {LDAP_PASSWD_SYNC_ON, "on"},
797 {LDAP_PASSWD_SYNC_ONLY, "only"},
801 /* Types of machine we can announce as. */
802 #define ANNOUNCE_AS_NT_SERVER 1
803 #define ANNOUNCE_AS_WIN95 2
804 #define ANNOUNCE_AS_WFW 3
805 #define ANNOUNCE_AS_NT_WORKSTATION 4
807 static const struct enum_list enum_announce_as[] = {
808 {ANNOUNCE_AS_NT_SERVER, "NT"},
809 {ANNOUNCE_AS_NT_SERVER, "NT Server"},
810 {ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},
811 {ANNOUNCE_AS_WIN95, "win95"},
812 {ANNOUNCE_AS_WFW, "WfW"},
816 static const struct enum_list enum_map_readonly[] = {
817 {MAP_READONLY_NO, "no"},
818 {MAP_READONLY_NO, "false"},
819 {MAP_READONLY_NO, "0"},
820 {MAP_READONLY_YES, "yes"},
821 {MAP_READONLY_YES, "true"},
822 {MAP_READONLY_YES, "1"},
823 {MAP_READONLY_PERMISSIONS, "permissions"},
824 {MAP_READONLY_PERMISSIONS, "perms"},
828 static const struct enum_list enum_case[] = {
829 {CASE_LOWER, "lower"},
830 {CASE_UPPER, "upper"},
836 static const struct enum_list enum_bool_auto[] = {
847 static const struct enum_list enum_csc_policy[] = {
848 {CSC_POLICY_MANUAL, "manual"},
849 {CSC_POLICY_DOCUMENTS, "documents"},
850 {CSC_POLICY_PROGRAMS, "programs"},
851 {CSC_POLICY_DISABLE, "disable"},
855 /* SMB signing types. */
856 static const struct enum_list enum_smb_signing_vals[] = {
868 {Required, "required"},
869 {Required, "mandatory"},
871 {Required, "forced"},
872 {Required, "enforced"},
876 /* ACL compatibility options. */
877 static const struct enum_list enum_acl_compat_vals[] = {
878 { ACL_COMPAT_AUTO, "auto" },
879 { ACL_COMPAT_WINNT, "winnt" },
880 { ACL_COMPAT_WIN2K, "win2k" },
885 Do you want session setups at user level security with a invalid
886 password to be rejected or allowed in as guest? WinNT rejects them
887 but it can be a pain as it means "net view" needs to use a password
889 You have 3 choices in the setting of map_to_guest:
891 "Never" means session setups with an invalid password
892 are rejected. This is the default.
894 "Bad User" means session setups with an invalid password
895 are rejected, unless the username does not exist, in which case it
896 is treated as a guest login
898 "Bad Password" means session setups with an invalid password
899 are treated as a guest login
901 Note that map_to_guest only has an effect in user or server
905 static const struct enum_list enum_map_to_guest[] = {
906 {NEVER_MAP_TO_GUEST, "Never"},
907 {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
908 {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
909 {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},
913 /* Config backend options */
915 static const struct enum_list enum_config_backend[] = {
916 {CONFIG_BACKEND_FILE, "file"},
917 {CONFIG_BACKEND_REGISTRY, "registry"},
921 /* ADS kerberos ticket verification options */
923 static const struct enum_list enum_kerberos_method[] = {
924 {KERBEROS_VERIFY_SECRETS, "default"},
925 {KERBEROS_VERIFY_SECRETS, "secrets only"},
926 {KERBEROS_VERIFY_SYSTEM_KEYTAB, "system keytab"},
927 {KERBEROS_VERIFY_DEDICATED_KEYTAB, "dedicated keytab"},
928 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB, "secrets and keytab"},
932 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
934 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
935 * screen in SWAT. This is used to exclude parameters as well as to squash all
936 * parameters that have been duplicated by pseudonyms.
938 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
939 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
940 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
943 * NOTE2: Handling of duplicated (synonym) parameters:
944 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
945 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
946 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
947 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
950 static struct parm_struct parm_table[] = {
951 {N_("Base Options"), P_SEP, P_SEPARATOR},
954 .label = "dos charset",
957 .ptr = &Globals.dos_charset,
958 .special = handle_charset,
960 .flags = FLAG_ADVANCED
963 .label = "unix charset",
966 .ptr = &Globals.unix_charset,
967 .special = handle_charset,
969 .flags = FLAG_ADVANCED
972 .label = "display charset",
975 .ptr = &Globals.display_charset,
976 .special = handle_charset,
978 .flags = FLAG_ADVANCED
984 .ptr = &sDefault.comment,
987 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT
993 .ptr = &sDefault.szPath,
996 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
999 .label = "directory",
1002 .ptr = &sDefault.szPath,
1008 .label = "workgroup",
1010 .p_class = P_GLOBAL,
1011 .ptr = &Globals.szWorkgroup,
1012 .special = handle_workgroup,
1014 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1020 .p_class = P_GLOBAL,
1021 .ptr = &Globals.szRealm,
1024 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1028 .label = "netbios name",
1030 .p_class = P_GLOBAL,
1031 .ptr = &Globals.szNetbiosName,
1032 .special = handle_netbios_name,
1034 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1037 .label = "netbios aliases",
1039 .p_class = P_GLOBAL,
1040 .ptr = &Globals.szNetbiosAliases,
1041 .special = handle_netbios_aliases,
1043 .flags = FLAG_ADVANCED,
1046 .label = "netbios scope",
1048 .p_class = P_GLOBAL,
1049 .ptr = &Globals.szNetbiosScope,
1050 .special = handle_netbios_scope,
1052 .flags = FLAG_ADVANCED,
1055 .label = "server string",
1057 .p_class = P_GLOBAL,
1058 .ptr = &Globals.szServerString,
1061 .flags = FLAG_BASIC | FLAG_ADVANCED,
1064 .label = "interfaces",
1066 .p_class = P_GLOBAL,
1067 .ptr = &Globals.szInterfaces,
1070 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1073 .label = "bind interfaces only",
1075 .p_class = P_GLOBAL,
1076 .ptr = &Globals.bBindInterfacesOnly,
1079 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1082 .label = "config backend",
1084 .p_class = P_GLOBAL,
1085 .ptr = &Globals.ConfigBackend,
1087 .enum_list = enum_config_backend,
1088 .flags = FLAG_HIDE|FLAG_ADVANCED|FLAG_META,
1091 {N_("Security Options"), P_SEP, P_SEPARATOR},
1094 .label = "security",
1096 .p_class = P_GLOBAL,
1097 .ptr = &Globals.security,
1099 .enum_list = enum_security,
1100 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1103 .label = "auth methods",
1105 .p_class = P_GLOBAL,
1106 .ptr = &Globals.AuthMethods,
1109 .flags = FLAG_ADVANCED,
1112 .label = "encrypt passwords",
1114 .p_class = P_GLOBAL,
1115 .ptr = &Globals.bEncryptPasswords,
1118 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1121 .label = "client schannel",
1123 .p_class = P_GLOBAL,
1124 .ptr = &Globals.clientSchannel,
1126 .enum_list = enum_bool_auto,
1127 .flags = FLAG_BASIC | FLAG_ADVANCED,
1130 .label = "server schannel",
1132 .p_class = P_GLOBAL,
1133 .ptr = &Globals.serverSchannel,
1135 .enum_list = enum_bool_auto,
1136 .flags = FLAG_BASIC | FLAG_ADVANCED,
1139 .label = "allow trusted domains",
1141 .p_class = P_GLOBAL,
1142 .ptr = &Globals.bAllowTrustedDomains,
1145 .flags = FLAG_ADVANCED,
1148 .label = "map to guest",
1150 .p_class = P_GLOBAL,
1151 .ptr = &Globals.map_to_guest,
1153 .enum_list = enum_map_to_guest,
1154 .flags = FLAG_ADVANCED,
1157 .label = "null passwords",
1159 .p_class = P_GLOBAL,
1160 .ptr = &Globals.bNullPasswords,
1163 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
1166 .label = "obey pam restrictions",
1168 .p_class = P_GLOBAL,
1169 .ptr = &Globals.bObeyPamRestrictions,
1172 .flags = FLAG_ADVANCED,
1175 .label = "password server",
1177 .p_class = P_GLOBAL,
1178 .ptr = &Globals.szPasswordServer,
1181 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1184 .label = "smb passwd file",
1186 .p_class = P_GLOBAL,
1187 .ptr = &Globals.szSMBPasswdFile,
1190 .flags = FLAG_ADVANCED,
1193 .label = "private dir",
1195 .p_class = P_GLOBAL,
1196 .ptr = &Globals.szPrivateDir,
1199 .flags = FLAG_ADVANCED,
1202 .label = "passdb backend",
1204 .p_class = P_GLOBAL,
1205 .ptr = &Globals.szPassdbBackend,
1208 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1211 .label = "algorithmic rid base",
1213 .p_class = P_GLOBAL,
1214 .ptr = &Globals.AlgorithmicRidBase,
1217 .flags = FLAG_ADVANCED,
1220 .label = "root directory",
1222 .p_class = P_GLOBAL,
1223 .ptr = &Globals.szRootdir,
1226 .flags = FLAG_ADVANCED,
1229 .label = "root dir",
1231 .p_class = P_GLOBAL,
1232 .ptr = &Globals.szRootdir,
1240 .p_class = P_GLOBAL,
1241 .ptr = &Globals.szRootdir,
1247 .label = "guest account",
1249 .p_class = P_GLOBAL,
1250 .ptr = &Globals.szGuestaccount,
1253 .flags = FLAG_BASIC | FLAG_ADVANCED,
1256 .label = "enable privileges",
1258 .p_class = P_GLOBAL,
1259 .ptr = &Globals.bEnablePrivileges,
1262 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
1266 .label = "pam password change",
1268 .p_class = P_GLOBAL,
1269 .ptr = &Globals.bPamPasswordChange,
1272 .flags = FLAG_ADVANCED,
1275 .label = "passwd program",
1277 .p_class = P_GLOBAL,
1278 .ptr = &Globals.szPasswdProgram,
1281 .flags = FLAG_ADVANCED,
1284 .label = "passwd chat",
1286 .p_class = P_GLOBAL,
1287 .ptr = &Globals.szPasswdChat,
1290 .flags = FLAG_ADVANCED,
1293 .label = "passwd chat debug",
1295 .p_class = P_GLOBAL,
1296 .ptr = &Globals.bPasswdChatDebug,
1299 .flags = FLAG_ADVANCED,
1302 .label = "passwd chat timeout",
1304 .p_class = P_GLOBAL,
1305 .ptr = &Globals.iPasswdChatTimeout,
1308 .flags = FLAG_ADVANCED,
1311 .label = "check password script",
1313 .p_class = P_GLOBAL,
1314 .ptr = &Globals.szCheckPasswordScript,
1317 .flags = FLAG_ADVANCED,
1320 .label = "username map",
1322 .p_class = P_GLOBAL,
1323 .ptr = &Globals.szUsernameMap,
1326 .flags = FLAG_ADVANCED,
1329 .label = "password level",
1331 .p_class = P_GLOBAL,
1332 .ptr = &Globals.pwordlevel,
1335 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
1338 .label = "username level",
1340 .p_class = P_GLOBAL,
1341 .ptr = &Globals.unamelevel,
1344 .flags = FLAG_ADVANCED,
1347 .label = "unix password sync",
1349 .p_class = P_GLOBAL,
1350 .ptr = &Globals.bUnixPasswdSync,
1353 .flags = FLAG_ADVANCED,
1356 .label = "restrict anonymous",
1358 .p_class = P_GLOBAL,
1359 .ptr = &Globals.restrict_anonymous,
1362 .flags = FLAG_ADVANCED,
1365 .label = "lanman auth",
1367 .p_class = P_GLOBAL,
1368 .ptr = &Globals.bLanmanAuth,
1371 .flags = FLAG_ADVANCED,
1374 .label = "ntlm auth",
1376 .p_class = P_GLOBAL,
1377 .ptr = &Globals.bNTLMAuth,
1380 .flags = FLAG_ADVANCED,
1383 .label = "client NTLMv2 auth",
1385 .p_class = P_GLOBAL,
1386 .ptr = &Globals.bClientNTLMv2Auth,
1389 .flags = FLAG_ADVANCED,
1392 .label = "client lanman auth",
1394 .p_class = P_GLOBAL,
1395 .ptr = &Globals.bClientLanManAuth,
1398 .flags = FLAG_ADVANCED,
1401 .label = "client plaintext auth",
1403 .p_class = P_GLOBAL,
1404 .ptr = &Globals.bClientPlaintextAuth,
1407 .flags = FLAG_ADVANCED,
1410 .label = "client use spnego principal",
1412 .p_class = P_GLOBAL,
1413 .ptr = &Globals.client_use_spnego_principal,
1416 .flags = FLAG_ADVANCED,
1419 .label = "send spnego principal",
1421 .p_class = P_GLOBAL,
1422 .ptr = &Globals.send_spnego_principal,
1425 .flags = FLAG_ADVANCED,
1428 .label = "username",
1431 .ptr = &sDefault.szUsername,
1434 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE | FLAG_DEPRECATED,
1440 .ptr = &sDefault.szUsername,
1449 .ptr = &sDefault.szUsername,
1455 .label = "invalid users",
1458 .ptr = &sDefault.szInvalidUsers,
1461 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1464 .label = "valid users",
1467 .ptr = &sDefault.szValidUsers,
1470 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1473 .label = "admin users",
1476 .ptr = &sDefault.szAdminUsers,
1479 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1482 .label = "read list",
1485 .ptr = &sDefault.readlist,
1488 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1491 .label = "write list",
1494 .ptr = &sDefault.writelist,
1497 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1500 .label = "printer admin",
1503 .ptr = &sDefault.printer_admin,
1506 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_PRINT | FLAG_DEPRECATED,
1509 .label = "force user",
1512 .ptr = &sDefault.force_user,
1515 .flags = FLAG_ADVANCED | FLAG_SHARE,
1518 .label = "force group",
1521 .ptr = &sDefault.force_group,
1524 .flags = FLAG_ADVANCED | FLAG_SHARE,
1530 .ptr = &sDefault.force_group,
1533 .flags = FLAG_ADVANCED,
1536 .label = "read only",
1539 .ptr = &sDefault.bRead_only,
1542 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE,
1545 .label = "write ok",
1548 .ptr = &sDefault.bRead_only,
1554 .label = "writeable",
1557 .ptr = &sDefault.bRead_only,
1563 .label = "writable",
1566 .ptr = &sDefault.bRead_only,
1572 .label = "acl check permissions",
1575 .ptr = &sDefault.bAclCheckPermissions,
1578 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1581 .label = "acl group control",
1584 .ptr = &sDefault.bAclGroupControl,
1587 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1590 .label = "acl map full control",
1593 .ptr = &sDefault.bAclMapFullControl,
1596 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1599 .label = "create mask",
1602 .ptr = &sDefault.iCreate_mask,
1605 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1608 .label = "create mode",
1611 .ptr = &sDefault.iCreate_mask,
1617 .label = "force create mode",
1620 .ptr = &sDefault.iCreate_force_mode,
1623 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1626 .label = "security mask",
1629 .ptr = &sDefault.iSecurity_mask,
1632 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1635 .label = "force security mode",
1638 .ptr = &sDefault.iSecurity_force_mode,
1641 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1644 .label = "directory mask",
1647 .ptr = &sDefault.iDir_mask,
1650 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1653 .label = "directory mode",
1656 .ptr = &sDefault.iDir_mask,
1659 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1662 .label = "force directory mode",
1665 .ptr = &sDefault.iDir_force_mode,
1668 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1671 .label = "directory security mask",
1674 .ptr = &sDefault.iDir_Security_mask,
1677 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1680 .label = "force directory security mode",
1683 .ptr = &sDefault.iDir_Security_force_mode,
1686 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1689 .label = "force unknown acl user",
1692 .ptr = &sDefault.bForceUnknownAclUser,
1695 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1698 .label = "inherit permissions",
1701 .ptr = &sDefault.bInheritPerms,
1704 .flags = FLAG_ADVANCED | FLAG_SHARE,
1707 .label = "inherit acls",
1710 .ptr = &sDefault.bInheritACLS,
1713 .flags = FLAG_ADVANCED | FLAG_SHARE,
1716 .label = "inherit owner",
1719 .ptr = &sDefault.bInheritOwner,
1722 .flags = FLAG_ADVANCED | FLAG_SHARE,
1725 .label = "guest only",
1728 .ptr = &sDefault.bGuest_only,
1731 .flags = FLAG_ADVANCED | FLAG_SHARE,
1734 .label = "only guest",
1737 .ptr = &sDefault.bGuest_only,
1743 .label = "administrative share",
1746 .ptr = &sDefault.bAdministrative_share,
1749 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1753 .label = "guest ok",
1756 .ptr = &sDefault.bGuest_ok,
1759 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1765 .ptr = &sDefault.bGuest_ok,
1771 .label = "only user",
1774 .ptr = &sDefault.bOnlyUser,
1777 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED,
1780 .label = "hosts allow",
1783 .ptr = &sDefault.szHostsallow,
1786 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1789 .label = "allow hosts",
1792 .ptr = &sDefault.szHostsallow,
1798 .label = "hosts deny",
1801 .ptr = &sDefault.szHostsdeny,
1804 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1807 .label = "deny hosts",
1810 .ptr = &sDefault.szHostsdeny,
1816 .label = "preload modules",
1818 .p_class = P_GLOBAL,
1819 .ptr = &Globals.szPreloadModules,
1822 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1825 .label = "dedicated keytab file",
1827 .p_class = P_GLOBAL,
1828 .ptr = &Globals.szDedicatedKeytabFile,
1831 .flags = FLAG_ADVANCED,
1834 .label = "kerberos method",
1836 .p_class = P_GLOBAL,
1837 .ptr = &Globals.iKerberosMethod,
1839 .enum_list = enum_kerberos_method,
1840 .flags = FLAG_ADVANCED,
1843 .label = "map untrusted to domain",
1845 .p_class = P_GLOBAL,
1846 .ptr = &Globals.bMapUntrustedToDomain,
1849 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1853 {N_("Logging Options"), P_SEP, P_SEPARATOR},
1856 .label = "log level",
1858 .p_class = P_GLOBAL,
1859 .ptr = &Globals.szLogLevel,
1860 .special = handle_debug_list,
1862 .flags = FLAG_ADVANCED,
1865 .label = "debuglevel",
1867 .p_class = P_GLOBAL,
1868 .ptr = &Globals.szLogLevel,
1869 .special = handle_debug_list,
1876 .p_class = P_GLOBAL,
1877 .ptr = &Globals.syslog,
1880 .flags = FLAG_ADVANCED,
1883 .label = "syslog only",
1885 .p_class = P_GLOBAL,
1886 .ptr = &Globals.bSyslogOnly,
1889 .flags = FLAG_ADVANCED,
1892 .label = "log file",
1894 .p_class = P_GLOBAL,
1895 .ptr = &Globals.szLogFile,
1898 .flags = FLAG_ADVANCED,
1901 .label = "max log size",
1903 .p_class = P_GLOBAL,
1904 .ptr = &Globals.max_log_size,
1907 .flags = FLAG_ADVANCED,
1910 .label = "debug timestamp",
1912 .p_class = P_GLOBAL,
1913 .ptr = &Globals.bTimestampLogs,
1916 .flags = FLAG_ADVANCED,
1919 .label = "timestamp logs",
1921 .p_class = P_GLOBAL,
1922 .ptr = &Globals.bTimestampLogs,
1925 .flags = FLAG_ADVANCED,
1928 .label = "debug prefix timestamp",
1930 .p_class = P_GLOBAL,
1931 .ptr = &Globals.bDebugPrefixTimestamp,
1934 .flags = FLAG_ADVANCED,
1937 .label = "debug hires timestamp",
1939 .p_class = P_GLOBAL,
1940 .ptr = &Globals.bDebugHiresTimestamp,
1943 .flags = FLAG_ADVANCED,
1946 .label = "debug pid",
1948 .p_class = P_GLOBAL,
1949 .ptr = &Globals.bDebugPid,
1952 .flags = FLAG_ADVANCED,
1955 .label = "debug uid",
1957 .p_class = P_GLOBAL,
1958 .ptr = &Globals.bDebugUid,
1961 .flags = FLAG_ADVANCED,
1964 .label = "debug class",
1966 .p_class = P_GLOBAL,
1967 .ptr = &Globals.bDebugClass,
1970 .flags = FLAG_ADVANCED,
1973 .label = "enable core files",
1975 .p_class = P_GLOBAL,
1976 .ptr = &Globals.bEnableCoreFiles,
1979 .flags = FLAG_ADVANCED,
1982 {N_("Protocol Options"), P_SEP, P_SEPARATOR},
1985 .label = "allocation roundup size",
1988 .ptr = &sDefault.iallocation_roundup_size,
1991 .flags = FLAG_ADVANCED,
1994 .label = "aio read size",
1997 .ptr = &sDefault.iAioReadSize,
2000 .flags = FLAG_ADVANCED,
2003 .label = "aio write size",
2006 .ptr = &sDefault.iAioWriteSize,
2009 .flags = FLAG_ADVANCED,
2012 .label = "aio write behind",
2015 .ptr = &sDefault.szAioWriteBehind,
2018 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2021 .label = "smb ports",
2023 .p_class = P_GLOBAL,
2024 .ptr = &Globals.smb_ports,
2027 .flags = FLAG_ADVANCED,
2030 .label = "large readwrite",
2032 .p_class = P_GLOBAL,
2033 .ptr = &Globals.bLargeReadwrite,
2036 .flags = FLAG_ADVANCED,
2039 .label = "max protocol",
2041 .p_class = P_GLOBAL,
2042 .ptr = &Globals.maxprotocol,
2044 .enum_list = enum_protocol,
2045 .flags = FLAG_ADVANCED,
2048 .label = "protocol",
2050 .p_class = P_GLOBAL,
2051 .ptr = &Globals.maxprotocol,
2053 .enum_list = enum_protocol,
2054 .flags = FLAG_ADVANCED,
2057 .label = "min protocol",
2059 .p_class = P_GLOBAL,
2060 .ptr = &Globals.minprotocol,
2062 .enum_list = enum_protocol,
2063 .flags = FLAG_ADVANCED,
2066 .label = "min receivefile size",
2068 .p_class = P_GLOBAL,
2069 .ptr = &Globals.iminreceivefile,
2072 .flags = FLAG_ADVANCED,
2075 .label = "read raw",
2077 .p_class = P_GLOBAL,
2078 .ptr = &Globals.bReadRaw,
2081 .flags = FLAG_ADVANCED,
2084 .label = "write raw",
2086 .p_class = P_GLOBAL,
2087 .ptr = &Globals.bWriteRaw,
2090 .flags = FLAG_ADVANCED,
2093 .label = "disable netbios",
2095 .p_class = P_GLOBAL,
2096 .ptr = &Globals.bDisableNetbios,
2099 .flags = FLAG_ADVANCED,
2102 .label = "reset on zero vc",
2104 .p_class = P_GLOBAL,
2105 .ptr = &Globals.bResetOnZeroVC,
2108 .flags = FLAG_ADVANCED,
2111 .label = "log writeable files on exit",
2113 .p_class = P_GLOBAL,
2114 .ptr = &Globals.bLogWriteableFilesOnExit,
2117 .flags = FLAG_ADVANCED,
2120 .label = "acl compatibility",
2122 .p_class = P_GLOBAL,
2123 .ptr = &Globals.iAclCompat,
2125 .enum_list = enum_acl_compat_vals,
2126 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2129 .label = "defer sharing violations",
2131 .p_class = P_GLOBAL,
2132 .ptr = &Globals.bDeferSharingViolations,
2135 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2138 .label = "ea support",
2141 .ptr = &sDefault.bEASupport,
2144 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2147 .label = "nt acl support",
2150 .ptr = &sDefault.bNTAclSupport,
2153 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2156 .label = "nt pipe support",
2158 .p_class = P_GLOBAL,
2159 .ptr = &Globals.bNTPipeSupport,
2162 .flags = FLAG_ADVANCED,
2165 .label = "nt status support",
2167 .p_class = P_GLOBAL,
2168 .ptr = &Globals.bNTStatusSupport,
2171 .flags = FLAG_ADVANCED,
2174 .label = "profile acls",
2177 .ptr = &sDefault.bProfileAcls,
2180 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
2183 .label = "announce version",
2185 .p_class = P_GLOBAL,
2186 .ptr = &Globals.szAnnounceVersion,
2189 .flags = FLAG_ADVANCED,
2192 .label = "announce as",
2194 .p_class = P_GLOBAL,
2195 .ptr = &Globals.announce_as,
2197 .enum_list = enum_announce_as,
2198 .flags = FLAG_ADVANCED,
2201 .label = "map acl inherit",
2204 .ptr = &sDefault.bMap_acl_inherit,
2207 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2210 .label = "afs share",
2213 .ptr = &sDefault.bAfs_Share,
2216 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2221 .p_class = P_GLOBAL,
2222 .ptr = &Globals.max_mux,
2225 .flags = FLAG_ADVANCED,
2228 .label = "max xmit",
2230 .p_class = P_GLOBAL,
2231 .ptr = &Globals.max_xmit,
2234 .flags = FLAG_ADVANCED,
2237 .label = "name resolve order",
2239 .p_class = P_GLOBAL,
2240 .ptr = &Globals.szNameResolveOrder,
2243 .flags = FLAG_ADVANCED | FLAG_WIZARD,
2248 .p_class = P_GLOBAL,
2249 .ptr = &Globals.max_ttl,
2252 .flags = FLAG_ADVANCED,
2255 .label = "max wins ttl",
2257 .p_class = P_GLOBAL,
2258 .ptr = &Globals.max_wins_ttl,
2261 .flags = FLAG_ADVANCED,
2264 .label = "min wins ttl",
2266 .p_class = P_GLOBAL,
2267 .ptr = &Globals.min_wins_ttl,
2270 .flags = FLAG_ADVANCED,
2273 .label = "time server",
2275 .p_class = P_GLOBAL,
2276 .ptr = &Globals.bTimeServer,
2279 .flags = FLAG_ADVANCED,
2282 .label = "unix extensions",
2284 .p_class = P_GLOBAL,
2285 .ptr = &Globals.bUnixExtensions,
2288 .flags = FLAG_ADVANCED,
2291 .label = "use spnego",
2293 .p_class = P_GLOBAL,
2294 .ptr = &Globals.bUseSpnego,
2297 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
2300 .label = "client signing",
2302 .p_class = P_GLOBAL,
2303 .ptr = &Globals.client_signing,
2305 .enum_list = enum_smb_signing_vals,
2306 .flags = FLAG_ADVANCED,
2309 .label = "server signing",
2311 .p_class = P_GLOBAL,
2312 .ptr = &Globals.server_signing,
2314 .enum_list = enum_smb_signing_vals,
2315 .flags = FLAG_ADVANCED,
2318 .label = "smb encrypt",
2321 .ptr = &sDefault.ismb_encrypt,
2323 .enum_list = enum_smb_signing_vals,
2324 .flags = FLAG_ADVANCED,
2327 .label = "client use spnego",
2329 .p_class = P_GLOBAL,
2330 .ptr = &Globals.bClientUseSpnego,
2333 .flags = FLAG_ADVANCED,
2336 .label = "client ldap sasl wrapping",
2338 .p_class = P_GLOBAL,
2339 .ptr = &Globals.client_ldap_sasl_wrapping,
2341 .enum_list = enum_ldap_sasl_wrapping,
2342 .flags = FLAG_ADVANCED,
2345 .label = "enable asu support",
2347 .p_class = P_GLOBAL,
2348 .ptr = &Globals.bASUSupport,
2351 .flags = FLAG_ADVANCED,
2354 .label = "svcctl list",
2356 .p_class = P_GLOBAL,
2357 .ptr = &Globals.szServicesList,
2360 .flags = FLAG_ADVANCED,
2363 {N_("Tuning Options"), P_SEP, P_SEPARATOR},
2366 .label = "block size",
2369 .ptr = &sDefault.iBlock_size,
2372 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2375 .label = "deadtime",
2377 .p_class = P_GLOBAL,
2378 .ptr = &Globals.deadtime,
2381 .flags = FLAG_ADVANCED,
2384 .label = "getwd cache",
2386 .p_class = P_GLOBAL,
2387 .ptr = &Globals.getwd_cache,
2390 .flags = FLAG_ADVANCED,
2393 .label = "keepalive",
2395 .p_class = P_GLOBAL,
2396 .ptr = &Globals.iKeepalive,
2399 .flags = FLAG_ADVANCED,
2402 .label = "change notify",
2405 .ptr = &sDefault.bChangeNotify,
2408 .flags = FLAG_ADVANCED | FLAG_SHARE,
2411 .label = "directory name cache size",
2414 .ptr = &sDefault.iDirectoryNameCacheSize,
2417 .flags = FLAG_ADVANCED | FLAG_SHARE,
2420 .label = "kernel change notify",
2423 .ptr = &sDefault.bKernelChangeNotify,
2426 .flags = FLAG_ADVANCED | FLAG_SHARE,
2429 .label = "lpq cache time",
2431 .p_class = P_GLOBAL,
2432 .ptr = &Globals.lpqcachetime,
2435 .flags = FLAG_ADVANCED,
2438 .label = "max smbd processes",
2440 .p_class = P_GLOBAL,
2441 .ptr = &Globals.iMaxSmbdProcesses,
2444 .flags = FLAG_ADVANCED,
2447 .label = "max connections",
2450 .ptr = &sDefault.iMaxConnections,
2453 .flags = FLAG_ADVANCED | FLAG_SHARE,
2456 .label = "paranoid server security",
2458 .p_class = P_GLOBAL,
2459 .ptr = &Globals.paranoid_server_security,
2462 .flags = FLAG_ADVANCED,
2465 .label = "max disk size",
2467 .p_class = P_GLOBAL,
2468 .ptr = &Globals.maxdisksize,
2471 .flags = FLAG_ADVANCED,
2474 .label = "max open files",
2476 .p_class = P_GLOBAL,
2477 .ptr = &Globals.max_open_files,
2480 .flags = FLAG_ADVANCED,
2483 .label = "min print space",
2486 .ptr = &sDefault.iMinPrintSpace,
2489 .flags = FLAG_ADVANCED | FLAG_PRINT,
2492 .label = "socket options",
2494 .p_class = P_GLOBAL,
2495 .ptr = &Globals.szSocketOptions,
2498 .flags = FLAG_ADVANCED,
2501 .label = "strict allocate",
2504 .ptr = &sDefault.bStrictAllocate,
2507 .flags = FLAG_ADVANCED | FLAG_SHARE,
2510 .label = "strict sync",
2513 .ptr = &sDefault.bStrictSync,
2516 .flags = FLAG_ADVANCED | FLAG_SHARE,
2519 .label = "sync always",
2522 .ptr = &sDefault.bSyncAlways,
2525 .flags = FLAG_ADVANCED | FLAG_SHARE,
2528 .label = "use mmap",
2530 .p_class = P_GLOBAL,
2531 .ptr = &Globals.bUseMmap,
2534 .flags = FLAG_ADVANCED,
2537 .label = "use sendfile",
2540 .ptr = &sDefault.bUseSendfile,
2543 .flags = FLAG_ADVANCED | FLAG_SHARE,
2546 .label = "hostname lookups",
2548 .p_class = P_GLOBAL,
2549 .ptr = &Globals.bHostnameLookups,
2552 .flags = FLAG_ADVANCED,
2555 .label = "write cache size",
2558 .ptr = &sDefault.iWriteCacheSize,
2561 .flags = FLAG_ADVANCED | FLAG_SHARE,
2564 .label = "name cache timeout",
2566 .p_class = P_GLOBAL,
2567 .ptr = &Globals.name_cache_timeout,
2570 .flags = FLAG_ADVANCED,
2573 .label = "ctdbd socket",
2575 .p_class = P_GLOBAL,
2576 .ptr = &Globals.ctdbdSocket,
2579 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2582 .label = "cluster addresses",
2584 .p_class = P_GLOBAL,
2585 .ptr = &Globals.szClusterAddresses,
2588 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2591 .label = "clustering",
2593 .p_class = P_GLOBAL,
2594 .ptr = &Globals.clustering,
2597 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2600 .label = "ctdb timeout",
2602 .p_class = P_GLOBAL,
2603 .ptr = &Globals.ctdb_timeout,
2606 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2609 .label = "ctdb locktime warn threshold",
2611 .p_class = P_GLOBAL,
2612 .ptr = &Globals.ctdb_locktime_warn_threshold,
2615 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2618 .label = "smb2 max read",
2620 .p_class = P_GLOBAL,
2621 .ptr = &Globals.ismb2_max_read,
2624 .flags = FLAG_ADVANCED,
2627 .label = "smb2 max write",
2629 .p_class = P_GLOBAL,
2630 .ptr = &Globals.ismb2_max_write,
2633 .flags = FLAG_ADVANCED,
2636 .label = "smb2 max trans",
2638 .p_class = P_GLOBAL,
2639 .ptr = &Globals.ismb2_max_trans,
2642 .flags = FLAG_ADVANCED,
2645 .label = "smb2 max credits",
2647 .p_class = P_GLOBAL,
2648 .ptr = &Globals.ismb2_max_credits,
2651 .flags = FLAG_ADVANCED,
2654 {N_("Printing Options"), P_SEP, P_SEPARATOR},
2657 .label = "max reported print jobs",
2660 .ptr = &sDefault.iMaxReportedPrintJobs,
2663 .flags = FLAG_ADVANCED | FLAG_PRINT,
2666 .label = "max print jobs",
2669 .ptr = &sDefault.iMaxPrintJobs,
2672 .flags = FLAG_ADVANCED | FLAG_PRINT,
2675 .label = "load printers",
2677 .p_class = P_GLOBAL,
2678 .ptr = &Globals.bLoadPrinters,
2681 .flags = FLAG_ADVANCED | FLAG_PRINT,
2684 .label = "printcap cache time",
2686 .p_class = P_GLOBAL,
2687 .ptr = &Globals.PrintcapCacheTime,
2690 .flags = FLAG_ADVANCED | FLAG_PRINT,
2693 .label = "printcap name",
2695 .p_class = P_GLOBAL,
2696 .ptr = &Globals.szPrintcapname,
2699 .flags = FLAG_ADVANCED | FLAG_PRINT,
2702 .label = "printcap",
2704 .p_class = P_GLOBAL,
2705 .ptr = &Globals.szPrintcapname,
2711 .label = "printable",
2714 .ptr = &sDefault.bPrint_ok,
2717 .flags = FLAG_ADVANCED | FLAG_PRINT,
2720 .label = "print notify backchannel",
2723 .ptr = &sDefault.bPrintNotifyBackchannel,
2726 .flags = FLAG_ADVANCED,
2729 .label = "print ok",
2732 .ptr = &sDefault.bPrint_ok,
2738 .label = "printing",
2741 .ptr = &sDefault.iPrinting,
2742 .special = handle_printing,
2743 .enum_list = enum_printing,
2744 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2747 .label = "cups options",
2750 .ptr = &sDefault.szCupsOptions,
2753 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2756 .label = "cups server",
2758 .p_class = P_GLOBAL,
2759 .ptr = &Globals.szCupsServer,
2762 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2765 .label = "cups encrypt",
2767 .p_class = P_GLOBAL,
2768 .ptr = &Globals.CupsEncrypt,
2770 .enum_list = enum_bool_auto,
2771 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2775 .label = "cups connection timeout",
2777 .p_class = P_GLOBAL,
2778 .ptr = &Globals.cups_connection_timeout,
2781 .flags = FLAG_ADVANCED,
2784 .label = "iprint server",
2786 .p_class = P_GLOBAL,
2787 .ptr = &Globals.szIPrintServer,
2790 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2793 .label = "print command",
2796 .ptr = &sDefault.szPrintcommand,
2799 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2802 .label = "disable spoolss",
2804 .p_class = P_GLOBAL,
2805 .ptr = &Globals.bDisableSpoolss,
2808 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2811 .label = "enable spoolss",
2813 .p_class = P_GLOBAL,
2814 .ptr = &Globals.bDisableSpoolss,
2820 .label = "lpq command",
2823 .ptr = &sDefault.szLpqcommand,
2826 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2829 .label = "lprm command",
2832 .ptr = &sDefault.szLprmcommand,
2835 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2838 .label = "lppause command",
2841 .ptr = &sDefault.szLppausecommand,
2844 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2847 .label = "lpresume command",
2850 .ptr = &sDefault.szLpresumecommand,
2853 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2856 .label = "queuepause command",
2859 .ptr = &sDefault.szQueuepausecommand,
2862 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2865 .label = "queueresume command",
2868 .ptr = &sDefault.szQueueresumecommand,
2871 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2874 .label = "addport command",
2876 .p_class = P_GLOBAL,
2877 .ptr = &Globals.szAddPortCommand,
2880 .flags = FLAG_ADVANCED,
2883 .label = "enumports command",
2885 .p_class = P_GLOBAL,
2886 .ptr = &Globals.szEnumPortsCommand,
2889 .flags = FLAG_ADVANCED,
2892 .label = "addprinter command",
2894 .p_class = P_GLOBAL,
2895 .ptr = &Globals.szAddPrinterCommand,
2898 .flags = FLAG_ADVANCED,
2901 .label = "deleteprinter command",
2903 .p_class = P_GLOBAL,
2904 .ptr = &Globals.szDeletePrinterCommand,
2907 .flags = FLAG_ADVANCED,
2910 .label = "show add printer wizard",
2912 .p_class = P_GLOBAL,
2913 .ptr = &Globals.bMsAddPrinterWizard,
2916 .flags = FLAG_ADVANCED,
2919 .label = "os2 driver map",
2921 .p_class = P_GLOBAL,
2922 .ptr = &Globals.szOs2DriverMap,
2925 .flags = FLAG_ADVANCED,
2929 .label = "printer name",
2932 .ptr = &sDefault.szPrintername,
2935 .flags = FLAG_ADVANCED | FLAG_PRINT,
2941 .ptr = &sDefault.szPrintername,
2947 .label = "use client driver",
2950 .ptr = &sDefault.bUseClientDriver,
2953 .flags = FLAG_ADVANCED | FLAG_PRINT,
2956 .label = "default devmode",
2959 .ptr = &sDefault.bDefaultDevmode,
2962 .flags = FLAG_ADVANCED | FLAG_PRINT,
2965 .label = "force printername",
2968 .ptr = &sDefault.bForcePrintername,
2971 .flags = FLAG_ADVANCED | FLAG_PRINT,
2974 .label = "printjob username",
2977 .ptr = &sDefault.szPrintjobUsername,
2980 .flags = FLAG_ADVANCED | FLAG_PRINT,
2983 {N_("Filename Handling"), P_SEP, P_SEPARATOR},
2986 .label = "mangling method",
2988 .p_class = P_GLOBAL,
2989 .ptr = &Globals.szManglingMethod,
2992 .flags = FLAG_ADVANCED,
2995 .label = "mangle prefix",
2997 .p_class = P_GLOBAL,
2998 .ptr = &Globals.mangle_prefix,
3001 .flags = FLAG_ADVANCED,
3005 .label = "default case",
3008 .ptr = &sDefault.iDefaultCase,
3010 .enum_list = enum_case,
3011 .flags = FLAG_ADVANCED | FLAG_SHARE,
3014 .label = "case sensitive",
3017 .ptr = &sDefault.iCaseSensitive,
3019 .enum_list = enum_bool_auto,
3020 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3023 .label = "casesignames",
3026 .ptr = &sDefault.iCaseSensitive,
3028 .enum_list = enum_bool_auto,
3029 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_HIDE,
3032 .label = "preserve case",
3035 .ptr = &sDefault.bCasePreserve,
3038 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3041 .label = "short preserve case",
3044 .ptr = &sDefault.bShortCasePreserve,
3047 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3050 .label = "mangling char",
3053 .ptr = &sDefault.magic_char,
3056 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3059 .label = "hide dot files",
3062 .ptr = &sDefault.bHideDotFiles,
3065 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3068 .label = "hide special files",
3071 .ptr = &sDefault.bHideSpecialFiles,
3074 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3077 .label = "hide unreadable",
3080 .ptr = &sDefault.bHideUnReadable,
3083 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3086 .label = "hide unwriteable files",
3089 .ptr = &sDefault.bHideUnWriteableFiles,
3092 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3095 .label = "delete veto files",
3098 .ptr = &sDefault.bDeleteVetoFiles,
3101 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3104 .label = "veto files",
3107 .ptr = &sDefault.szVetoFiles,
3110 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3113 .label = "hide files",
3116 .ptr = &sDefault.szHideFiles,
3119 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3122 .label = "veto oplock files",
3125 .ptr = &sDefault.szVetoOplockFiles,
3128 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3131 .label = "map archive",
3134 .ptr = &sDefault.bMap_archive,
3137 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3140 .label = "map hidden",
3143 .ptr = &sDefault.bMap_hidden,
3146 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3149 .label = "map system",
3152 .ptr = &sDefault.bMap_system,
3155 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3158 .label = "map readonly",
3161 .ptr = &sDefault.iMap_readonly,
3163 .enum_list = enum_map_readonly,
3164 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3167 .label = "mangled names",
3170 .ptr = &sDefault.bMangledNames,
3173 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3176 .label = "max stat cache size",
3178 .p_class = P_GLOBAL,
3179 .ptr = &Globals.iMaxStatCacheSize,
3182 .flags = FLAG_ADVANCED,
3185 .label = "stat cache",
3187 .p_class = P_GLOBAL,
3188 .ptr = &Globals.bStatCache,
3191 .flags = FLAG_ADVANCED,
3194 .label = "store dos attributes",
3197 .ptr = &sDefault.bStoreDosAttributes,
3200 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3203 .label = "dmapi support",
3206 .ptr = &sDefault.bDmapiSupport,
3209 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3213 {N_("Domain Options"), P_SEP, P_SEPARATOR},
3216 .label = "machine password timeout",
3218 .p_class = P_GLOBAL,
3219 .ptr = &Globals.machine_password_timeout,
3222 .flags = FLAG_ADVANCED | FLAG_WIZARD,
3225 {N_("Logon Options"), P_SEP, P_SEPARATOR},
3228 .label = "add user script",
3230 .p_class = P_GLOBAL,
3231 .ptr = &Globals.szAddUserScript,
3234 .flags = FLAG_ADVANCED,
3237 .label = "rename user script",
3239 .p_class = P_GLOBAL,
3240 .ptr = &Globals.szRenameUserScript,
3243 .flags = FLAG_ADVANCED,
3246 .label = "delete user script",
3248 .p_class = P_GLOBAL,
3249 .ptr = &Globals.szDelUserScript,
3252 .flags = FLAG_ADVANCED,
3255 .label = "add group script",
3257 .p_class = P_GLOBAL,
3258 .ptr = &Globals.szAddGroupScript,
3261 .flags = FLAG_ADVANCED,
3264 .label = "delete group script",
3266 .p_class = P_GLOBAL,
3267 .ptr = &Globals.szDelGroupScript,
3270 .flags = FLAG_ADVANCED,
3273 .label = "add user to group script",
3275 .p_class = P_GLOBAL,
3276 .ptr = &Globals.szAddUserToGroupScript,
3279 .flags = FLAG_ADVANCED,
3282 .label = "delete user from group script",
3284 .p_class = P_GLOBAL,
3285 .ptr = &Globals.szDelUserFromGroupScript,
3288 .flags = FLAG_ADVANCED,
3291 .label = "set primary group script",
3293 .p_class = P_GLOBAL,
3294 .ptr = &Globals.szSetPrimaryGroupScript,
3297 .flags = FLAG_ADVANCED,
3300 .label = "add machine script",
3302 .p_class = P_GLOBAL,
3303 .ptr = &Globals.szAddMachineScript,
3306 .flags = FLAG_ADVANCED,
3309 .label = "shutdown script",
3311 .p_class = P_GLOBAL,
3312 .ptr = &Globals.szShutdownScript,
3315 .flags = FLAG_ADVANCED,
3318 .label = "abort shutdown script",
3320 .p_class = P_GLOBAL,
3321 .ptr = &Globals.szAbortShutdownScript,
3324 .flags = FLAG_ADVANCED,
3327 .label = "username map script",
3329 .p_class = P_GLOBAL,
3330 .ptr = &Globals.szUsernameMapScript,
3333 .flags = FLAG_ADVANCED,
3336 .label = "username map cache time",
3338 .p_class = P_GLOBAL,
3339 .ptr = &Globals.iUsernameMapCacheTime,
3342 .flags = FLAG_ADVANCED,
3345 .label = "logon script",
3347 .p_class = P_GLOBAL,
3348 .ptr = &Globals.szLogonScript,
3351 .flags = FLAG_ADVANCED,
3354 .label = "logon path",
3356 .p_class = P_GLOBAL,
3357 .ptr = &Globals.szLogonPath,
3360 .flags = FLAG_ADVANCED,
3363 .label = "logon drive",
3365 .p_class = P_GLOBAL,
3366 .ptr = &Globals.szLogonDrive,
3369 .flags = FLAG_ADVANCED,
3372 .label = "logon home",
3374 .p_class = P_GLOBAL,
3375 .ptr = &Globals.szLogonHome,
3378 .flags = FLAG_ADVANCED,
3381 .label = "domain logons",
3383 .p_class = P_GLOBAL,
3384 .ptr = &Globals.bDomainLogons,
3387 .flags = FLAG_ADVANCED,
3391 .label = "init logon delayed hosts",
3393 .p_class = P_GLOBAL,
3394 .ptr = &Globals.szInitLogonDelayedHosts,
3397 .flags = FLAG_ADVANCED,
3401 .label = "init logon delay",
3403 .p_class = P_GLOBAL,
3404 .ptr = &Globals.InitLogonDelay,
3407 .flags = FLAG_ADVANCED,
3411 {N_("Browse Options"), P_SEP, P_SEPARATOR},
3414 .label = "os level",
3416 .p_class = P_GLOBAL,
3417 .ptr = &Globals.os_level,
3420 .flags = FLAG_BASIC | FLAG_ADVANCED,
3423 .label = "lm announce",
3425 .p_class = P_GLOBAL,
3426 .ptr = &Globals.lm_announce,
3428 .enum_list = enum_bool_auto,
3429 .flags = FLAG_ADVANCED,
3432 .label = "lm interval",
3434 .p_class = P_GLOBAL,
3435 .ptr = &Globals.lm_interval,
3438 .flags = FLAG_ADVANCED,
3441 .label = "preferred master",
3443 .p_class = P_GLOBAL,
3444 .ptr = &Globals.iPreferredMaster,
3446 .enum_list = enum_bool_auto,
3447 .flags = FLAG_BASIC | FLAG_ADVANCED,
3450 .label = "prefered master",
3452 .p_class = P_GLOBAL,
3453 .ptr = &Globals.iPreferredMaster,
3455 .enum_list = enum_bool_auto,
3459 .label = "local master",
3461 .p_class = P_GLOBAL,
3462 .ptr = &Globals.bLocalMaster,
3465 .flags = FLAG_BASIC | FLAG_ADVANCED,
3468 .label = "domain master",
3470 .p_class = P_GLOBAL,
3471 .ptr = &Globals.iDomainMaster,
3473 .enum_list = enum_bool_auto,
3474 .flags = FLAG_BASIC | FLAG_ADVANCED,
3477 .label = "browse list",
3479 .p_class = P_GLOBAL,
3480 .ptr = &Globals.bBrowseList,
3483 .flags = FLAG_ADVANCED,
3486 .label = "browseable",
3489 .ptr = &sDefault.bBrowseable,
3492 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3495 .label = "browsable",
3498 .ptr = &sDefault.bBrowseable,
3504 .label = "access based share enum",
3507 .ptr = &sDefault.bAccessBasedShareEnum,
3510 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE
3513 .label = "enhanced browsing",
3515 .p_class = P_GLOBAL,
3516 .ptr = &Globals.enhanced_browsing,
3519 .flags = FLAG_ADVANCED,
3522 {N_("WINS Options"), P_SEP, P_SEPARATOR},
3525 .label = "dns proxy",
3527 .p_class = P_GLOBAL,
3528 .ptr = &Globals.bDNSproxy,
3531 .flags = FLAG_ADVANCED,
3534 .label = "wins proxy",
3536 .p_class = P_GLOBAL,
3537 .ptr = &Globals.bWINSproxy,
3540 .flags = FLAG_ADVANCED,
3543 .label = "wins server",
3545 .p_class = P_GLOBAL,
3546 .ptr = &Globals.szWINSservers,
3549 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3552 .label = "wins support",
3554 .p_class = P_GLOBAL,
3555 .ptr = &Globals.bWINSsupport,
3558 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3561 .label = "wins hook",
3563 .p_class = P_GLOBAL,
3564 .ptr = &Globals.szWINSHook,
3567 .flags = FLAG_ADVANCED,
3570 {N_("Locking Options"), P_SEP, P_SEPARATOR},
3573 .label = "blocking locks",
3576 .ptr = &sDefault.bBlockingLocks,
3579 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3582 .label = "csc policy",
3585 .ptr = &sDefault.iCSCPolicy,
3587 .enum_list = enum_csc_policy,
3588 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3591 .label = "fake oplocks",
3594 .ptr = &sDefault.bFakeOplocks,
3597 .flags = FLAG_ADVANCED | FLAG_SHARE,
3600 .label = "kernel oplocks",
3602 .p_class = P_GLOBAL,
3603 .ptr = &Globals.bKernelOplocks,
3606 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3612 .ptr = &sDefault.bLocking,
3615 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3618 .label = "lock spin time",
3620 .p_class = P_GLOBAL,
3621 .ptr = &Globals.iLockSpinTime,
3624 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3630 .ptr = &sDefault.bOpLocks,
3633 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3636 .label = "level2 oplocks",
3639 .ptr = &sDefault.bLevel2OpLocks,
3642 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3645 .label = "oplock break wait time",
3647 .p_class = P_GLOBAL,
3648 .ptr = &Globals.oplock_break_wait_time,
3651 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3654 .label = "oplock contention limit",
3657 .ptr = &sDefault.iOplockContentionLimit,
3660 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3663 .label = "posix locking",
3666 .ptr = &sDefault.bPosixLocking,
3669 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3672 .label = "strict locking",
3675 .ptr = &sDefault.iStrictLocking,
3677 .enum_list = enum_bool_auto,
3678 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3681 .label = "share modes",
3684 .ptr = &sDefault.bShareModes,
3687 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_DEPRECATED,
3690 {N_("Ldap Options"), P_SEP, P_SEPARATOR},
3693 .label = "ldap admin dn",
3695 .p_class = P_GLOBAL,
3696 .ptr = &Globals.szLdapAdminDn,
3699 .flags = FLAG_ADVANCED,
3702 .label = "ldap delete dn",
3704 .p_class = P_GLOBAL,
3705 .ptr = &Globals.ldap_delete_dn,
3708 .flags = FLAG_ADVANCED,
3711 .label = "ldap group suffix",
3713 .p_class = P_GLOBAL,
3714 .ptr = &Globals.szLdapGroupSuffix,
3717 .flags = FLAG_ADVANCED,
3720 .label = "ldap idmap suffix",
3722 .p_class = P_GLOBAL,
3723 .ptr = &Globals.szLdapIdmapSuffix,
3726 .flags = FLAG_ADVANCED,
3729 .label = "ldap machine suffix",
3731 .p_class = P_GLOBAL,
3732 .ptr = &Globals.szLdapMachineSuffix,
3735 .flags = FLAG_ADVANCED,
3738 .label = "ldap passwd sync",
3740 .p_class = P_GLOBAL,
3741 .ptr = &Globals.ldap_passwd_sync,
3743 .enum_list = enum_ldap_passwd_sync,
3744 .flags = FLAG_ADVANCED,
3747 .label = "ldap password sync",
3749 .p_class = P_GLOBAL,
3750 .ptr = &Globals.ldap_passwd_sync,
3752 .enum_list = enum_ldap_passwd_sync,
3756 .label = "ldap replication sleep",
3758 .p_class = P_GLOBAL,
3759 .ptr = &Globals.ldap_replication_sleep,
3762 .flags = FLAG_ADVANCED,
3765 .label = "ldap suffix",
3767 .p_class = P_GLOBAL,
3768 .ptr = &Globals.szLdapSuffix,
3771 .flags = FLAG_ADVANCED,
3774 .label = "ldap ssl",
3776 .p_class = P_GLOBAL,
3777 .ptr = &Globals.ldap_ssl,
3779 .enum_list = enum_ldap_ssl,
3780 .flags = FLAG_ADVANCED,
3783 .label = "ldap ssl ads",
3785 .p_class = P_GLOBAL,
3786 .ptr = &Globals.ldap_ssl_ads,
3789 .flags = FLAG_ADVANCED,
3792 .label = "ldap deref",
3794 .p_class = P_GLOBAL,
3795 .ptr = &Globals.ldap_deref,
3797 .enum_list = enum_ldap_deref,
3798 .flags = FLAG_ADVANCED,
3801 .label = "ldap follow referral",
3803 .p_class = P_GLOBAL,
3804 .ptr = &Globals.ldap_follow_referral,
3806 .enum_list = enum_bool_auto,
3807 .flags = FLAG_ADVANCED,
3810 .label = "ldap timeout",
3812 .p_class = P_GLOBAL,
3813 .ptr = &Globals.ldap_timeout,
3816 .flags = FLAG_ADVANCED,
3819 .label = "ldap connection timeout",
3821 .p_class = P_GLOBAL,
3822 .ptr = &Globals.ldap_connection_timeout,
3825 .flags = FLAG_ADVANCED,
3828 .label = "ldap page size",
3830 .p_class = P_GLOBAL,
3831 .ptr = &Globals.ldap_page_size,
3834 .flags = FLAG_ADVANCED,
3837 .label = "ldap user suffix",
3839 .p_class = P_GLOBAL,
3840 .ptr = &Globals.szLdapUserSuffix,
3843 .flags = FLAG_ADVANCED,
3846 .label = "ldap debug level",
3848 .p_class = P_GLOBAL,
3849 .ptr = &Globals.ldap_debug_level,
3850 .special = handle_ldap_debug_level,
3852 .flags = FLAG_ADVANCED,
3855 .label = "ldap debug threshold",
3857 .p_class = P_GLOBAL,
3858 .ptr = &Globals.ldap_debug_threshold,
3861 .flags = FLAG_ADVANCED,
3864 {N_("EventLog Options"), P_SEP, P_SEPARATOR},
3867 .label = "eventlog list",
3869 .p_class = P_GLOBAL,
3870 .ptr = &Globals.szEventLogs,
3873 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
3876 {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
3879 .label = "add share command",
3881 .p_class = P_GLOBAL,
3882 .ptr = &Globals.szAddShareCommand,
3885 .flags = FLAG_ADVANCED,
3888 .label = "change share command",
3890 .p_class = P_GLOBAL,
3891 .ptr = &Globals.szChangeShareCommand,
3894 .flags = FLAG_ADVANCED,
3897 .label = "delete share command",
3899 .p_class = P_GLOBAL,
3900 .ptr = &Globals.szDeleteShareCommand,
3903 .flags = FLAG_ADVANCED,
3906 .label = "config file",
3908 .p_class = P_GLOBAL,
3909 .ptr = &Globals.szConfigFile,
3912 .flags = FLAG_HIDE|FLAG_META,
3917 .p_class = P_GLOBAL,
3918 .ptr = &Globals.szAutoServices,
3921 .flags = FLAG_ADVANCED,
3924 .label = "auto services",
3926 .p_class = P_GLOBAL,
3927 .ptr = &Globals.szAutoServices,
3930 .flags = FLAG_ADVANCED,
3933 .label = "lock directory",
3935 .p_class = P_GLOBAL,
3936 .ptr = &Globals.szLockDir,
3939 .flags = FLAG_ADVANCED,
3942 .label = "lock dir",
3944 .p_class = P_GLOBAL,
3945 .ptr = &Globals.szLockDir,
3951 .label = "state directory",
3953 .p_class = P_GLOBAL,
3954 .ptr = &Globals.szStateDir,
3957 .flags = FLAG_ADVANCED,
3960 .label = "cache directory",
3962 .p_class = P_GLOBAL,
3963 .ptr = &Globals.szCacheDir,
3966 .flags = FLAG_ADVANCED,
3969 .label = "pid directory",
3971 .p_class = P_GLOBAL,
3972 .ptr = &Globals.szPidDir,
3975 .flags = FLAG_ADVANCED,
3979 .label = "utmp directory",
3981 .p_class = P_GLOBAL,
3982 .ptr = &Globals.szUtmpDir,
3985 .flags = FLAG_ADVANCED,
3988 .label = "wtmp directory",
3990 .p_class = P_GLOBAL,
3991 .ptr = &Globals.szWtmpDir,
3994 .flags = FLAG_ADVANCED,
3999 .p_class = P_GLOBAL,
4000 .ptr = &Globals.bUtmp,
4003 .flags = FLAG_ADVANCED,
4007 .label = "default service",
4009 .p_class = P_GLOBAL,
4010 .ptr = &Globals.szDefaultService,
4013 .flags = FLAG_ADVANCED,
4018 .p_class = P_GLOBAL,
4019 .ptr = &Globals.szDefaultService,
4022 .flags = FLAG_ADVANCED,
4025 .label = "message command",
4027 .p_class = P_GLOBAL,
4028 .ptr = &Globals.szMsgCommand,
4031 .flags = FLAG_ADVANCED,
4034 .label = "dfree cache time",
4037 .ptr = &sDefault.iDfreeCacheTime,
4040 .flags = FLAG_ADVANCED,
4043 .label = "dfree command",
4046 .ptr = &sDefault.szDfree,
4049 .flags = FLAG_ADVANCED,
4052 .label = "get quota command",
4054 .p_class = P_GLOBAL,
4055 .ptr = &Globals.szGetQuota,
4058 .flags = FLAG_ADVANCED,
4061 .label = "set quota command",
4063 .p_class = P_GLOBAL,
4064 .ptr = &Globals.szSetQuota,
4067 .flags = FLAG_ADVANCED,
4070 .label = "remote announce",
4072 .p_class = P_GLOBAL,
4073 .ptr = &Globals.szRemoteAnnounce,
4076 .flags = FLAG_ADVANCED,
4079 .label = "remote browse sync",
4081 .p_class = P_GLOBAL,
4082 .ptr = &Globals.szRemoteBrowseSync,
4085 .flags = FLAG_ADVANCED,
4088 .label = "socket address",
4090 .p_class = P_GLOBAL,
4091 .ptr = &Globals.szSocketAddress,
4094 .flags = FLAG_ADVANCED,
4097 .label = "nmbd bind explicit broadcast",
4099 .p_class = P_GLOBAL,
4100 .ptr = &Globals.bNmbdBindExplicitBroadcast,
4103 .flags = FLAG_ADVANCED,
4106 .label = "homedir map",
4108 .p_class = P_GLOBAL,
4109 .ptr = &Globals.szNISHomeMapName,
4112 .flags = FLAG_ADVANCED,
4115 .label = "afs username map",
4117 .p_class = P_GLOBAL,
4118 .ptr = &Globals.szAfsUsernameMap,
4121 .flags = FLAG_ADVANCED,
4124 .label = "afs token lifetime",
4126 .p_class = P_GLOBAL,
4127 .ptr = &Globals.iAfsTokenLifetime,
4130 .flags = FLAG_ADVANCED,
4133 .label = "log nt token command",
4135 .p_class = P_GLOBAL,
4136 .ptr = &Globals.szLogNtTokenCommand,
4139 .flags = FLAG_ADVANCED,
4142 .label = "time offset",
4144 .p_class = P_GLOBAL,
4145 .ptr = &extra_time_offset,
4148 .flags = FLAG_ADVANCED,
4151 .label = "NIS homedir",
4153 .p_class = P_GLOBAL,
4154 .ptr = &Globals.bNISHomeMap,
4157 .flags = FLAG_ADVANCED,
4163 .ptr = &sDefault.valid,
4172 .ptr = &sDefault.szCopy,
4173 .special = handle_copy,
4181 .ptr = &sDefault.szInclude,
4182 .special = handle_include,
4184 .flags = FLAG_HIDE|FLAG_META,
4190 .ptr = &sDefault.szPreExec,
4193 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4199 .ptr = &sDefault.szPreExec,
4202 .flags = FLAG_ADVANCED,
4205 .label = "preexec close",
4208 .ptr = &sDefault.bPreexecClose,
4211 .flags = FLAG_ADVANCED | FLAG_SHARE,
4214 .label = "postexec",
4217 .ptr = &sDefault.szPostExec,
4220 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4223 .label = "root preexec",
4226 .ptr = &sDefault.szRootPreExec,
4229 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4232 .label = "root preexec close",
4235 .ptr = &sDefault.bRootpreexecClose,
4238 .flags = FLAG_ADVANCED | FLAG_SHARE,
4241 .label = "root postexec",
4244 .ptr = &sDefault.szRootPostExec,
4247 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4250 .label = "available",
4253 .ptr = &sDefault.bAvailable,
4256 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4259 .label = "registry shares",
4261 .p_class = P_GLOBAL,
4262 .ptr = &Globals.bRegistryShares,
4265 .flags = FLAG_ADVANCED,
4268 .label = "usershare allow guests",
4270 .p_class = P_GLOBAL,
4271 .ptr = &Globals.bUsershareAllowGuests,
4274 .flags = FLAG_ADVANCED,
4277 .label = "usershare max shares",
4279 .p_class = P_GLOBAL,
4280 .ptr = &Globals.iUsershareMaxShares,
4283 .flags = FLAG_ADVANCED,
4286 .label = "usershare owner only",
4288 .p_class = P_GLOBAL,
4289 .ptr = &Globals.bUsershareOwnerOnly,
4292 .flags = FLAG_ADVANCED,
4295 .label = "usershare path",
4297 .p_class = P_GLOBAL,
4298 .ptr = &Globals.szUsersharePath,
4301 .flags = FLAG_ADVANCED,
4304 .label = "usershare prefix allow list",
4306 .p_class = P_GLOBAL,
4307 .ptr = &Globals.szUsersharePrefixAllowList,
4310 .flags = FLAG_ADVANCED,
4313 .label = "usershare prefix deny list",
4315 .p_class = P_GLOBAL,
4316 .ptr = &Globals.szUsersharePrefixDenyList,
4319 .flags = FLAG_ADVANCED,
4322 .label = "usershare template share",
4324 .p_class = P_GLOBAL,
4325 .ptr = &Globals.szUsershareTemplateShare,
4328 .flags = FLAG_ADVANCED,
4334 .ptr = &sDefault.volume,
4337 .flags = FLAG_ADVANCED | FLAG_SHARE,
4343 .ptr = &sDefault.fstype,
4346 .flags = FLAG_ADVANCED | FLAG_SHARE,
4349 .label = "set directory",
4352 .ptr = &sDefault.bNo_set_dir,
4355 .flags = FLAG_ADVANCED | FLAG_SHARE,
4358 .label = "wide links",
4361 .ptr = &sDefault.bWidelinks,
4364 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4367 .label = "follow symlinks",
4370 .ptr = &sDefault.bSymlinks,
4373 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4376 .label = "dont descend",
4379 .ptr = &sDefault.szDontdescend,
4382 .flags = FLAG_ADVANCED | FLAG_SHARE,
4385 .label = "magic script",
4388 .ptr = &sDefault.szMagicScript,
4391 .flags = FLAG_ADVANCED | FLAG_SHARE,
4394 .label = "magic output",
4397 .ptr = &sDefault.szMagicOutput,
4400 .flags = FLAG_ADVANCED | FLAG_SHARE,
4403 .label = "delete readonly",
4406 .ptr = &sDefault.bDeleteReadonly,
4409 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4412 .label = "dos filemode",
4415 .ptr = &sDefault.bDosFilemode,
4418 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4421 .label = "dos filetimes",
4424 .ptr = &sDefault.bDosFiletimes,
4427 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4430 .label = "dos filetime resolution",
4433 .ptr = &sDefault.bDosFiletimeResolution,
4436 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4439 .label = "fake directory create times",
4442 .ptr = &sDefault.bFakeDirCreateTimes,
4445 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4448 .label = "async smb echo handler",
4450 .p_class = P_GLOBAL,
4451 .ptr = &Globals.bAsyncSMBEchoHandler,
4454 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4457 .label = "multicast dns register",
4459 .p_class = P_GLOBAL,
4460 .ptr = &Globals.bMulticastDnsRegister,
4463 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4466 .label = "panic action",
4468 .p_class = P_GLOBAL,
4469 .ptr = &Globals.szPanicAction,
4472 .flags = FLAG_ADVANCED,
4475 .label = "perfcount module",
4477 .p_class = P_GLOBAL,
4478 .ptr = &Globals.szSMBPerfcountModule,
4481 .flags = FLAG_ADVANCED,
4484 {N_("VFS module options"), P_SEP, P_SEPARATOR},
4487 .label = "vfs objects",
4490 .ptr = &sDefault.szVfsObjects,
4493 .flags = FLAG_ADVANCED | FLAG_SHARE,
4496 .label = "vfs object",
4499 .ptr = &sDefault.szVfsObjects,
4506 {N_("MSDFS options"), P_SEP, P_SEPARATOR},
4509 .label = "msdfs root",
4512 .ptr = &sDefault.bMSDfsRoot,
4515 .flags = FLAG_ADVANCED | FLAG_SHARE,
4518 .label = "msdfs proxy",
4521 .ptr = &sDefault.szMSDfsProxy,
4524 .flags = FLAG_ADVANCED | FLAG_SHARE,
4527 .label = "host msdfs",
4529 .p_class = P_GLOBAL,
4530 .ptr = &Globals.bHostMSDfs,
4533 .flags = FLAG_ADVANCED,
4536 {N_("Winbind options"), P_SEP, P_SEPARATOR},
4539 .label = "passdb expand explicit",
4541 .p_class = P_GLOBAL,
4542 .ptr = &Globals.bPassdbExpandExplicit,
4545 .flags = FLAG_ADVANCED,
4548 .label = "idmap backend",
4550 .p_class = P_GLOBAL,
4551 .ptr = &Globals.szIdmapBackend,
4552 .special = handle_idmap_backend,
4554 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
4557 .label = "idmap cache time",
4559 .p_class = P_GLOBAL,
4560 .ptr = &Globals.iIdmapCacheTime,
4563 .flags = FLAG_ADVANCED,
4566 .label = "idmap negative cache time",
4568 .p_class = P_GLOBAL,
4569 .ptr = &Globals.iIdmapNegativeCacheTime,
4572 .flags = FLAG_ADVANCED,
4575 .label = "idmap uid",
4577 .p_class = P_GLOBAL,
4578 .ptr = &Globals.szIdmapUID,
4579 .special = handle_idmap_uid,
4581 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
4584 .label = "winbind uid",
4586 .p_class = P_GLOBAL,
4587 .ptr = &Globals.szIdmapUID,
4588 .special = handle_idmap_uid,
4593 .label = "idmap gid",
4595 .p_class = P_GLOBAL,
4596 .ptr = &Globals.szIdmapGID,
4597 .special = handle_idmap_gid,
4599 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
4602 .label = "winbind gid",
4604 .p_class = P_GLOBAL,
4605 .ptr = &Globals.szIdmapGID,
4606 .special = handle_idmap_gid,
4611 .label = "template homedir",
4613 .p_class = P_GLOBAL,
4614 .ptr = &Globals.szTemplateHomedir,
4617 .flags = FLAG_ADVANCED,
4620 .label = "template shell",
4622 .p_class = P_GLOBAL,
4623 .ptr = &Globals.szTemplateShell,
4626 .flags = FLAG_ADVANCED,
4629 .label = "winbind separator",
4631 .p_class = P_GLOBAL,
4632 .ptr = &Globals.szWinbindSeparator,
4635 .flags = FLAG_ADVANCED,
4638 .label = "winbind cache time",
4640 .p_class = P_GLOBAL,
4641 .ptr = &Globals.winbind_cache_time,
4644 .flags = FLAG_ADVANCED,
4647 .label = "winbind reconnect delay",
4649 .p_class = P_GLOBAL,
4650 .ptr = &Globals.winbind_reconnect_delay,
4653 .flags = FLAG_ADVANCED,
4656 .label = "winbind max clients",
4658 .p_class = P_GLOBAL,
4659 .ptr = &Globals.winbind_max_clients,
4662 .flags = FLAG_ADVANCED,
4665 .label = "winbind enum users",
4667 .p_class = P_GLOBAL,
4668 .ptr = &Globals.bWinbindEnumUsers,
4671 .flags = FLAG_ADVANCED,
4674 .label = "winbind enum groups",
4676 .p_class = P_GLOBAL,
4677 .ptr = &Globals.bWinbindEnumGroups,
4680 .flags = FLAG_ADVANCED,
4683 .label = "winbind use default domain",
4685 .p_class = P_GLOBAL,
4686 .ptr = &Globals.bWinbindUseDefaultDomain,
4689 .flags = FLAG_ADVANCED,
4692 .label = "winbind trusted domains only",
4694 .p_class = P_GLOBAL,
4695 .ptr = &Globals.bWinbindTrustedDomainsOnly,
4698 .flags = FLAG_ADVANCED,
4701 .label = "winbind nested groups",
4703 .p_class = P_GLOBAL,
4704 .ptr = &Globals.bWinbindNestedGroups,
4707 .flags = FLAG_ADVANCED,
4710 .label = "winbind expand groups",
4712 .p_class = P_GLOBAL,
4713 .ptr = &Globals.winbind_expand_groups,
4716 .flags = FLAG_ADVANCED,
4719 .label = "winbind nss info",
4721 .p_class = P_GLOBAL,
4722 .ptr = &Globals.szWinbindNssInfo,
4725 .flags = FLAG_ADVANCED,
4728 .label = "winbind refresh tickets",
4730 .p_class = P_GLOBAL,
4731 .ptr = &Globals.bWinbindRefreshTickets,
4734 .flags = FLAG_ADVANCED,
4737 .label = "winbind offline logon",
4739 .p_class = P_GLOBAL,
4740 .ptr = &Globals.bWinbindOfflineLogon,
4743 .flags = FLAG_ADVANCED,
4746 .label = "winbind normalize names",
4748 .p_class = P_GLOBAL,
4749 .ptr = &Globals.bWinbindNormalizeNames,
4752 .flags = FLAG_ADVANCED,
4755 .label = "winbind rpc only",
4757 .p_class = P_GLOBAL,
4758 .ptr = &Globals.bWinbindRpcOnly,
4761 .flags = FLAG_ADVANCED,
4764 .label = "create krb5 conf",
4766 .p_class = P_GLOBAL,
4767 .ptr = &Globals.bCreateKrb5Conf,
4770 .flags = FLAG_ADVANCED,
4773 .label = "ncalrpc dir",
4775 .p_class = P_GLOBAL,
4776 .ptr = &Globals.ncalrpc_dir,
4779 .flags = FLAG_ADVANCED,
4782 .label = "winbind max domain connections",
4784 .p_class = P_GLOBAL,
4785 .ptr = &Globals.winbindMaxDomainConnections,
4788 .flags = FLAG_ADVANCED,
4791 {NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
4794 /***************************************************************************
4795 Initialise the sDefault parameter structure for the printer values.
4796 ***************************************************************************/
4798 static void init_printer_values(struct service *pService)
4800 /* choose defaults depending on the type of printing */
4801 switch (pService->iPrinting) {
4806 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4807 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4808 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4813 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4814 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4815 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4816 string_set(&pService->szQueuepausecommand, "lpc stop '%p'");
4817 string_set(&pService->szQueueresumecommand, "lpc start '%p'");
4818 string_set(&pService->szLppausecommand, "lpc hold '%p' %j");
4819 string_set(&pService->szLpresumecommand, "lpc release '%p' %j");
4825 /* set the lpq command to contain the destination printer
4826 name only. This is used by cups_queue_get() */
4827 string_set(&pService->szLpqcommand, "%p");
4828 string_set(&pService->szLprmcommand, "");
4829 string_set(&pService->szPrintcommand, "");
4830 string_set(&pService->szLppausecommand, "");
4831 string_set(&pService->szLpresumecommand, "");
4832 string_set(&pService->szQueuepausecommand, "");
4833 string_set(&pService->szQueueresumecommand, "");
4835 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4836 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4837 string_set(&pService->szPrintcommand, "lpr -P'%p' %s; rm %s");
4838 string_set(&pService->szLppausecommand, "lp -i '%p-%j' -H hold");
4839 string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
4840 string_set(&pService->szQueuepausecommand, "disable '%p'");
4841 string_set(&pService->szQueueresumecommand, "enable '%p'");
4842 #endif /* HAVE_CUPS */
4847 string_set(&pService->szLpqcommand, "lpstat -o%p");
4848 string_set(&pService->szLprmcommand, "cancel %p-%j");
4849 string_set(&pService->szPrintcommand, "lp -c -d%p %s; rm %s");
4850 string_set(&pService->szQueuepausecommand, "disable %p");
4851 string_set(&pService->szQueueresumecommand, "enable %p");
4853 string_set(&pService->szLppausecommand, "lp -i %p-%j -H hold");
4854 string_set(&pService->szLpresumecommand, "lp -i %p-%j -H resume");
4859 string_set(&pService->szLpqcommand, "lpq -P%p");
4860 string_set(&pService->szLprmcommand, "lprm -P%p %j");
4861 string_set(&pService->szPrintcommand, "lp -r -P%p %s");
4864 #if defined(DEVELOPER) || defined(ENABLE_BUILD_FARM_HACKS)
4868 const char *tdbfile;
4871 tdbfile = talloc_asprintf(
4872 talloc_tos(), "tdbfile=%s",
4873 lp_parm_const_string(-1, "vlp", "tdbfile",
4875 if (tdbfile == NULL) {
4876 tdbfile="tdbfile=/tmp/vlp.tdb";
4879 tmp = talloc_asprintf(talloc_tos(), "vlp %s print %%p %%s",
4881 string_set(&pService->szPrintcommand,
4882 tmp ? tmp : "vlp print %p %s");
4885 tmp = talloc_asprintf(talloc_tos(), "vlp %s lpq %%p",
4887 string_set(&pService->szLpqcommand,
4888 tmp ? tmp : "vlp lpq %p");
4891 tmp = talloc_asprintf(talloc_tos(), "vlp %s lprm %%p %%j",
4893 string_set(&pService->szLprmcommand,
4894 tmp ? tmp : "vlp lprm %p %j");
4897 tmp = talloc_asprintf(talloc_tos(), "vlp %s lppause %%p %%j",
4899 string_set(&pService->szLppausecommand,
4900 tmp ? tmp : "vlp lppause %p %j");
4903 tmp = talloc_asprintf(talloc_tos(), "vlp %s lpresume %%p %%j",
4905 string_set(&pService->szLpresumecommand,
4906 tmp ? tmp : "vlp lpresume %p %j");
4909 tmp = talloc_asprintf(talloc_tos(), "vlp %s queuepause %%p",
4911 string_set(&pService->szQueuepausecommand,
4912 tmp ? tmp : "vlp queuepause %p");
4915 tmp = talloc_asprintf(talloc_tos(), "vlp %s queueresume %%p",
4917 string_set(&pService->szQueueresumecommand,
4918 tmp ? tmp : "vlp queueresume %p");
4923 #endif /* DEVELOPER */
4928 * Function to return the default value for the maximum number of open
4929 * file descriptors permitted. This function tries to consult the
4930 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4931 * the smaller of those.
4933 static int max_open_files(void)
4935 int sysctl_max = MAX_OPEN_FILES;
4936 int rlimit_max = MAX_OPEN_FILES;
4938 #ifdef HAVE_SYSCTLBYNAME
4940 size_t size = sizeof(sysctl_max);
4941 sysctlbyname("kern.maxfilesperproc", &sysctl_max, &size, NULL,
4946 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4952 if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
4953 rlimit_max = rl.rlim_cur;
4955 #if defined(RLIM_INFINITY)
4956 if(rl.rlim_cur == RLIM_INFINITY)
4957 rlimit_max = MAX_OPEN_FILES;
4962 if (sysctl_max < MIN_OPEN_FILES_WINDOWS) {
4963 DEBUG(2,("max_open_files: increasing sysctl_max (%d) to "
4964 "minimum Windows limit (%d)\n",
4966 MIN_OPEN_FILES_WINDOWS));
4967 sysctl_max = MIN_OPEN_FILES_WINDOWS;
4970 if (rlimit_max < MIN_OPEN_FILES_WINDOWS) {
4971 DEBUG(2,("rlimit_max: increasing rlimit_max (%d) to "
4972 "minimum Windows limit (%d)\n",
4974 MIN_OPEN_FILES_WINDOWS));
4975 rlimit_max = MIN_OPEN_FILES_WINDOWS;
4978 return MIN(sysctl_max, rlimit_max);
4982 * Common part of freeing allocated data for one parameter.
4984 static void free_one_parameter_common(void *parm_ptr,
4985 struct parm_struct parm)
4987 if ((parm.type == P_STRING) ||
4988 (parm.type == P_USTRING))
4990 string_free((char**)parm_ptr);
4991 } else if (parm.type == P_LIST) {
4992 TALLOC_FREE(*((char***)parm_ptr));
4997 * Free the allocated data for one parameter for a share
4998 * given as a service struct.
5000 static void free_one_parameter(struct service *service,
5001 struct parm_struct parm)
5005 if (parm.p_class != P_LOCAL) {
5009 parm_ptr = lp_local_ptr(service, parm.ptr);
5011 free_one_parameter_common(parm_ptr, parm);
5015 * Free the allocated parameter data of a share given
5016 * as a service struct.
5018 static void free_parameters(struct service *service)
5022 for (i=0; parm_table[i].label; i++) {
5023 free_one_parameter(service, parm_table[i]);
5028 * Free the allocated data for one parameter for a given share
5029 * specified by an snum.
5031 static void free_one_parameter_by_snum(int snum, struct parm_struct parm)
5035 if (parm.ptr == NULL) {
5040 parm_ptr = parm.ptr;
5041 } else if (parm.p_class != P_LOCAL) {
5044 parm_ptr = lp_local_ptr_by_snum(snum, parm.ptr);
5047 free_one_parameter_common(parm_ptr, parm);
5051 * Free the allocated parameter data for a share specified
5054 static void free_parameters_by_snum(int snum)
5058 for (i=0; parm_table[i].label; i++) {
5059 free_one_parameter_by_snum(snum, parm_table[i]);
5064 * Free the allocated global parameters.
5066 static void free_global_parameters(void)
5068 free_parameters_by_snum(GLOBAL_SECTION_SNUM);
5071 static int map_parameter(const char *pszParmName);
5073 struct lp_stored_option {
5074 struct lp_stored_option *prev, *next;
5079 static struct lp_stored_option *stored_options;
5082 save options set by lp_set_cmdline() into a list. This list is
5083 re-applied when we do a globals reset, so that cmdline set options
5084 are sticky across reloads of smb.conf
5086 static bool store_lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
5088 struct lp_stored_option *entry, *entry_next;
5089 for (entry = stored_options; entry != NULL; entry = entry_next) {
5090 entry_next = entry->next;
5091 if (strcmp(pszParmName, entry->label) == 0) {
5092 DLIST_REMOVE(stored_options, entry);
5098 entry = talloc(NULL, struct lp_stored_option);
5103 entry->label = talloc_strdup(entry, pszParmName);
5104 if (!entry->label) {
5109 entry->value = talloc_strdup(entry, pszParmValue);
5110 if (!entry->value) {
5115 DLIST_ADD_END(stored_options, entry, struct lp_stored_option);
5120 static bool apply_lp_set_cmdline(void)
5122 struct lp_stored_option *entry = NULL;
5123 for (entry = stored_options; entry != NULL; entry = entry->next) {
5124 if (!lp_set_cmdline_helper(entry->label, entry->value, false)) {
5125 DEBUG(0, ("Failed to re-apply cmdline parameter %s = %s\n",
5126 entry->label, entry->value));
5133 /***************************************************************************
5134 Initialise the global parameter structure.
5135 ***************************************************************************/
5137 static void init_globals(bool reinit_globals)
5139 static bool done_init = False;
5143 /* If requested to initialize only once and we've already done it... */
5144 if (!reinit_globals && done_init) {
5145 /* ... then we have nothing more to do */
5150 /* The logfile can be set before this is invoked. Free it if so. */
5151 if (Globals.szLogFile != NULL) {
5152 string_free(&Globals.szLogFile);
5153 Globals.szLogFile = NULL;
5157 free_global_parameters();
5160 /* This memset and the free_global_parameters() above will
5161 * wipe out smb.conf options set with lp_set_cmdline(). The
5162 * apply_lp_set_cmdline() call puts these values back in the
5163 * table once the defaults are set */
5164 memset((void *)&Globals, '\0', sizeof(Globals));
5166 for (i = 0; parm_table[i].label; i++) {
5167 if ((parm_table[i].type == P_STRING ||
5168 parm_table[i].type == P_USTRING) &&
5171 string_set((char **)parm_table[i].ptr, "");
5175 string_set(&sDefault.fstype, FSTYPE_STRING);
5176 string_set(&sDefault.szPrintjobUsername, "%U");
5178 init_printer_values(&sDefault);
5181 DEBUG(3, ("Initialising global parameters\n"));
5183 string_set(&Globals.szSMBPasswdFile, get_dyn_SMB_PASSWD_FILE());
5184 string_set(&Globals.szPrivateDir, get_dyn_PRIVATE_DIR());
5186 /* use the new 'hash2' method by default, with a prefix of 1 */
5187 string_set(&Globals.szManglingMethod, "hash2");
5188 Globals.mangle_prefix = 1;
5190 string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
5192 /* using UTF8 by default allows us to support all chars */
5193 string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
5195 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
5196 /* If the system supports nl_langinfo(), try to grab the value
5197 from the user's locale */
5198 string_set(&Globals.display_charset, "LOCALE");
5200 string_set(&Globals.display_charset, DEFAULT_DISPLAY_CHARSET);
5203 /* Use codepage 850 as a default for the dos character set */
5204 string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
5207 * Allow the default PASSWD_CHAT to be overridden in local.h.
5209 string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
5211 set_global_myname(myhostname());
5212 string_set(&Globals.szNetbiosName,global_myname());
5214 set_global_myworkgroup(WORKGROUP);
5215 string_set(&Globals.szWorkgroup, lp_workgroup());
5217 string_set(&Globals.szPasswdProgram, "");
5218 string_set(&Globals.szLockDir, get_dyn_LOCKDIR());
5219 string_set(&Globals.szStateDir, get_dyn_STATEDIR());
5220 string_set(&Globals.szCacheDir, get_dyn_CACHEDIR());
5221 string_set(&Globals.szPidDir, get_dyn_PIDDIR());
5222 string_set(&Globals.szSocketAddress, "0.0.0.0");
5224 * By default support explicit binding to broadcast
5227 Globals.bNmbdBindExplicitBroadcast = true;
5229 if (asprintf(&s, "Samba %s", samba_version_string()) < 0) {
5230 smb_panic("init_globals: ENOMEM");
5232 string_set(&Globals.szServerString, s);
5234 if (asprintf(&s, "%d.%d", DEFAULT_MAJOR_VERSION,
5235 DEFAULT_MINOR_VERSION) < 0) {
5236 smb_panic("init_globals: ENOMEM");
5238 string_set(&Globals.szAnnounceVersion, s);
5241 string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
5244 string_set(&Globals.szSocketOptions, DEFAULT_SOCKET_OPTIONS);
5246 string_set(&Globals.szLogonDrive, "");
5247 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
5248 string_set(&Globals.szLogonHome, "\\\\%N\\%U");
5249 string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
5251 string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
5252 string_set(&Globals.szPasswordServer, "*");
5254 Globals.AlgorithmicRidBase = BASE_RID;
5256 Globals.bLoadPrinters = True;
5257 Globals.PrintcapCacheTime = 750; /* 12.5 minutes */
5259 Globals.ConfigBackend = config_backend;
5261 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
5262 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
5263 Globals.max_xmit = 0x4104;
5264 Globals.max_mux = 50; /* This is *needed* for profile support. */
5265 Globals.lpqcachetime = 30; /* changed to handle large print servers better -- jerry */
5266 Globals.bDisableSpoolss = False;
5267 Globals.iMaxSmbdProcesses = 0;/* no limit specified */
5268 Globals.pwordlevel = 0;
5269 Globals.unamelevel = 0;
5270 Globals.deadtime = 0;
5271 Globals.getwd_cache = true;
5272 Globals.bLargeReadwrite = True;
5273 Globals.max_log_size = 5000;
5274 Globals.max_open_files = max_open_files();
5275 Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
5276 Globals.maxprotocol = PROTOCOL_NT1;
5277 Globals.minprotocol = PROTOCOL_CORE;
5278 Globals.security = SEC_USER;
5279 Globals.paranoid_server_security = True;
5280 Globals.bEncryptPasswords = True;
5281 Globals.bUpdateEncrypt = False;
5282 Globals.clientSchannel = Auto;
5283 Globals.serverSchannel = Auto;
5284 Globals.bReadRaw = True;
5285 Globals.bWriteRaw = True;
5286 Globals.bNullPasswords = False;
5287 Globals.bObeyPamRestrictions = False;
5289 Globals.bSyslogOnly = False;
5290 Globals.bTimestampLogs = True;
5291 string_set(&Globals.szLogLevel, "0");
5292 Globals.bDebugPrefixTimestamp = False;
5293 Globals.bDebugHiresTimestamp = true;
5294 Globals.bDebugPid = False;
5295 Globals.bDebugUid = False;
5296 Globals.bDebugClass = False;
5297 Globals.bEnableCoreFiles = True;
5298 Globals.max_ttl = 60 * 60 * 24 * 3; /* 3 days default. */
5299 Globals.max_wins_ttl = 60 * 60 * 24 * 6; /* 6 days default. */
5300 Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
5301 Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
5302 Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
5303 Globals.lm_interval = 60;
5304 Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
5305 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
5306 Globals.bNISHomeMap = False;
5307 #ifdef WITH_NISPLUS_HOME
5308 string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
5310 string_set(&Globals.szNISHomeMapName, "auto.home");
5313 Globals.bTimeServer = False;
5314 Globals.bBindInterfacesOnly = False;
5315 Globals.bUnixPasswdSync = False;
5316 Globals.bPamPasswordChange = False;
5317 Globals.bPasswdChatDebug = False;
5318 Globals.iPasswdChatTimeout = 2; /* 2 second default. */
5319 Globals.bNTPipeSupport = True; /* Do NT pipes by default. */
5320 Globals.bNTStatusSupport = True; /* Use NT status by default. */
5321 Globals.bStatCache = True; /* use stat cache by default */
5322 Globals.iMaxStatCacheSize = 256; /* 256k by default */
5323 Globals.restrict_anonymous = 0;
5324 Globals.bClientLanManAuth = False; /* Do NOT use the LanMan hash if it is available */
5325 Globals.bClientPlaintextAuth = False; /* Do NOT use a plaintext password even if is requested by the server */
5326 Globals.bLanmanAuth = False; /* Do NOT use the LanMan hash, even if it is supplied */
5327 Globals.bNTLMAuth = True; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
5328 Globals.bClientNTLMv2Auth = True; /* Client should always use use NTLMv2, as we can't tell that the server supports it, but most modern servers do */
5329 /* Note, that we will also use NTLM2 session security (which is different), if it is available */
5331 Globals.map_to_guest = 0; /* By Default, "Never" */
5332 Globals.oplock_break_wait_time = 0; /* By Default, 0 msecs. */
5333 Globals.enhanced_browsing = true;
5334 Globals.iLockSpinTime = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
5335 #ifdef MMAP_BLACKLIST
5336 Globals.bUseMmap = False;
5338 Globals.bUseMmap = True;
5340 Globals.bUnixExtensions = True;
5341 Globals.bResetOnZeroVC = False;
5342 Globals.bLogWriteableFilesOnExit = False;
5343 Globals.bCreateKrb5Conf = true;
5344 Globals.winbindMaxDomainConnections = 1;
5346 /* hostname lookups can be very expensive and are broken on
5347 a large number of sites (tridge) */
5348 Globals.bHostnameLookups = False;
5350 string_set(&Globals.szPassdbBackend, "tdbsam");
5351 string_set(&Globals.szLdapSuffix, "");
5352 string_set(&Globals.szLdapMachineSuffix, "");
5353 string_set(&Globals.szLdapUserSuffix, "");
5354 string_set(&Globals.szLdapGroupSuffix, "");
5355 string_set(&Globals.szLdapIdmapSuffix, "");
5357 string_set(&Globals.szLdapAdminDn, "");
5358 Globals.ldap_ssl = LDAP_SSL_START_TLS;
5359 Globals.ldap_ssl_ads = False;
5360 Globals.ldap_deref = -1;
5361 Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
5362 Globals.ldap_delete_dn = False;
5363 Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
5364 Globals.ldap_follow_referral = Auto;
5365 Globals.ldap_timeout = LDAP_DEFAULT_TIMEOUT;
5366 Globals.ldap_connection_timeout = LDAP_CONNECTION_DEFAULT_TIMEOUT;
5367 Globals.ldap_page_size = LDAP_PAGE_SIZE;
5369 Globals.ldap_debug_level = 0;
5370 Globals.ldap_debug_threshold = 10;
5372 /* This is what we tell the afs client. in reality we set the token
5373 * to never expire, though, when this runs out the afs client will
5374 * forget the token. Set to 0 to get NEVERDATE.*/
5375 Globals.iAfsTokenLifetime = 604800;
5376 Globals.cups_connection_timeout = CUPS_DEFAULT_CONNECTION_TIMEOUT;
5378 /* these parameters are set to defaults that are more appropriate
5379 for the increasing samba install base:
5381 as a member of the workgroup, that will possibly become a
5382 _local_ master browser (lm = True). this is opposed to a forced
5383 local master browser startup (pm = True).
5385 doesn't provide WINS server service by default (wsupp = False),
5386 and doesn't provide domain master browser services by default, either.
5390 Globals.bMsAddPrinterWizard = True;
5391 Globals.os_level = 20;
5392 Globals.bLocalMaster = True;
5393 Globals.iDomainMaster = Auto; /* depending on bDomainLogons */
5394 Globals.bDomainLogons = False;
5395 Globals.bBrowseList = True;
5396 Globals.bWINSsupport = False;
5397 Globals.bWINSproxy = False;
5399 TALLOC_FREE(Globals.szInitLogonDelayedHosts);
5400 Globals.InitLogonDelay = 100; /* 100 ms default delay */
5402 Globals.bDNSproxy = True;
5404 /* this just means to use them if they exist */
5405 Globals.bKernelOplocks = True;
5407 Globals.bAllowTrustedDomains = True;
5408 string_set(&Globals.szIdmapBackend, "tdb");
5409 Globals.bIdmapReadOnly = false;
5411 string_set(&Globals.szTemplateShell, "/bin/false");
5412 string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
5413 string_set(&Globals.szWinbindSeparator, "\\");
5415 string_set(&Globals.szCupsServer, "");
5416 string_set(&Globals.szIPrintServer, "");
5418 string_set(&Globals.ctdbdSocket, "");
5419 Globals.szClusterAddresses = NULL;
5420 Globals.clustering = False;
5421 Globals.ctdb_timeout = 0;
5422 Globals.ctdb_locktime_warn_threshold = 0;
5424 Globals.winbind_cache_time = 300; /* 5 minutes */
5425 Globals.winbind_reconnect_delay = 30; /* 30 seconds */
5426 Globals.winbind_max_clients = 200;
5427 Globals.bWinbindEnumUsers = False;
5428 Globals.bWinbindEnumGroups = False;
5429 Globals.bWinbindUseDefaultDomain = False;
5430 Globals.bWinbindTrustedDomainsOnly = False;
5431 Globals.bWinbindNestedGroups = True;
5432 Globals.winbind_expand_groups = 1;
5433 Globals.szWinbindNssInfo = str_list_make_v3(NULL, "template", NULL);
5434 Globals.bWinbindRefreshTickets = False;
5435 Globals.bWinbindOfflineLogon = False;
5437 Globals.iIdmapCacheTime = 86400 * 7; /* a week by default */
5438 Globals.iIdmapNegativeCacheTime = 120; /* 2 minutes by default */
5440 Globals.bPassdbExpandExplicit = False;
5442 Globals.name_cache_timeout = 660; /* In seconds */
5444 Globals.bUseSpnego = True;
5445 Globals.bClientUseSpnego = True;
5447 Globals.client_signing = Auto;
5448 Globals.server_signing = False;
5450 Globals.bDeferSharingViolations = True;
5451 string_set(&Globals.smb_ports, SMB_PORTS);
5453 Globals.bEnablePrivileges = True;
5454 Globals.bHostMSDfs = True;
5455 Globals.bASUSupport = False;
5457 /* User defined shares. */
5458 if (asprintf(&s, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5459 smb_panic("init_globals: ENOMEM");
5461 string_set(&Globals.szUsersharePath, s);
5463 string_set(&Globals.szUsershareTemplateShare, "");
5464 Globals.iUsershareMaxShares = 0;
5465 /* By default disallow sharing of directories not owned by the sharer. */
5466 Globals.bUsershareOwnerOnly = True;
5467 /* By default disallow guest access to usershares. */
5468 Globals.bUsershareAllowGuests = False;
5470 Globals.iKeepalive = DEFAULT_KEEPALIVE;
5472 /* By default no shares out of the registry */
5473 Globals.bRegistryShares = False;
5475 Globals.iminreceivefile = 0;
5477 Globals.bMapUntrustedToDomain = false;
5478 Globals.bMulticastDnsRegister = true;
5480 Globals.ismb2_max_read = DEFAULT_SMB2_MAX_READ;
5481 Globals.ismb2_max_write = DEFAULT_SMB2_MAX_WRITE;
5482 Globals.ismb2_max_trans = DEFAULT_SMB2_MAX_TRANSACT;
5483 Globals.ismb2_max_credits = DEFAULT_SMB2_MAX_CREDITS;
5485 string_set(&Globals.ncalrpc_dir, get_dyn_NCALRPCDIR());
5487 /* Now put back the settings that were set with lp_set_cmdline() */
5488 apply_lp_set_cmdline();
5491 /*******************************************************************
5492 Convenience routine to grab string parameters into temporary memory
5493 and run standard_sub_basic on them. The buffers can be written to by
5494 callers without affecting the source string.
5495 ********************************************************************/
5497 static char *lp_string(const char *s)
5500 TALLOC_CTX *ctx = talloc_tos();
5502 /* The follow debug is useful for tracking down memory problems
5503 especially if you have an inner loop that is calling a lp_*()
5504 function that returns a string. Perhaps this debug should be
5505 present all the time? */
5508 DEBUG(10, ("lp_string(%s)\n", s));
5514 ret = talloc_sub_basic(ctx,
5515 get_current_username(),
5516 current_user_info.domain,
5518 if (trim_char(ret, '\"', '\"')) {
5519 if (strchr(ret,'\"') != NULL) {
5521 ret = talloc_sub_basic(ctx,
5522 get_current_username(),
5523 current_user_info.domain,
5531 In this section all the functions that are used to access the
5532 parameters from the rest of the program are defined
5535 #define FN_GLOBAL_STRING(fn_name,ptr) \
5536 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
5537 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5538 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
5539 #define FN_GLOBAL_LIST(fn_name,ptr) \
5540 const char **fn_name(void) {return(*(const char ***)(ptr));}
5541 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5542 bool fn_name(void) {return(*(bool *)(ptr));}
5543 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5544 char fn_name(void) {return(*(char *)(ptr));}
5545 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5546 int fn_name(void) {return(*(int *)(ptr));}
5548 #define FN_LOCAL_STRING(fn_name,val) \
5549 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5550 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5551 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5552 #define FN_LOCAL_LIST(fn_name,val) \
5553 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5554 #define FN_LOCAL_BOOL(fn_name,val) \
5555 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5556 #define FN_LOCAL_INTEGER(fn_name,val) \
5557 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5559 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5560 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5561 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5562 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5563 #define FN_LOCAL_CHAR(fn_name,val) \
5564 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5566 FN_GLOBAL_STRING(lp_smb_ports, &Globals.smb_ports)
5567 FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset)
5568 FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset)
5569 FN_GLOBAL_STRING(lp_display_charset, &Globals.display_charset)
5570 FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile)
5571 FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
5572 FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
5573 FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)
5574 FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString)
5575 FN_GLOBAL_INTEGER(lp_printcap_cache_time, &Globals.PrintcapCacheTime)
5576 FN_GLOBAL_STRING(lp_addport_cmd, &Globals.szAddPortCommand)
5577 FN_GLOBAL_STRING(lp_enumports_cmd, &Globals.szEnumPortsCommand)
5578 FN_GLOBAL_STRING(lp_addprinter_cmd, &Globals.szAddPrinterCommand)
5579 FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
5580 FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap)
5581 FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
5582 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5583 * build process or in smb.conf, we use that value. Otherwise they
5584 * default to the value of lp_lockdir(). */
5585 char *lp_statedir(void) {
5586 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5587 (strcmp(get_dyn_STATEDIR(), Globals.szStateDir) != 0))
5588 return(lp_string(*(char **)(&Globals.szStateDir) ?
5589 *(char **)(&Globals.szStateDir) : ""));
5591 return(lp_string(*(char **)(&Globals.szLockDir) ?
5592 *(char **)(&Globals.szLockDir) : ""));
5594 char *lp_cachedir(void) {
5595 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5596 (strcmp(get_dyn_CACHEDIR(), Globals.szCacheDir) != 0))
5597 return(lp_string(*(char **)(&Globals.szCacheDir) ?
5598 *(char **)(&Globals.szCacheDir) : ""));
5600 return(lp_string(*(char **)(&Globals.szLockDir) ?
5601 *(char **)(&Globals.szLockDir) : ""));
5603 FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
5604 FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
5605 FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
5606 FN_GLOBAL_STRING(lp_utmpdir, &Globals.szUtmpDir)
5607 FN_GLOBAL_STRING(lp_wtmpdir, &Globals.szWtmpDir)
5608 FN_GLOBAL_BOOL(lp_utmp, &Globals.bUtmp)
5609 FN_GLOBAL_STRING(lp_rootdir, &Globals.szRootdir)
5610 FN_GLOBAL_STRING(lp_perfcount_module, &Globals.szSMBPerfcountModule)
5611 FN_GLOBAL_STRING(lp_defaultservice, &Globals.szDefaultService)
5612 FN_GLOBAL_STRING(lp_msg_command, &Globals.szMsgCommand)
5613 FN_GLOBAL_STRING(lp_get_quota_command, &Globals.szGetQuota)
5614 FN_GLOBAL_STRING(lp_set_quota_command, &Globals.szSetQuota)
5615 FN_GLOBAL_STRING(lp_auto_services, &Globals.szAutoServices)
5616 FN_GLOBAL_STRING(lp_passwd_program, &Globals.szPasswdProgram)
5617 FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat)
5618 FN_GLOBAL_STRING(lp_passwordserver, &Globals.szPasswordServer)
5619 FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
5620 FN_GLOBAL_STRING(lp_realm, &Globals.szRealm)
5621 FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap)
5622 FN_GLOBAL_INTEGER(lp_afs_token_lifetime, &Globals.iAfsTokenLifetime)
5623 FN_GLOBAL_STRING(lp_log_nt_token_command, &Globals.szLogNtTokenCommand)
5624 FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap)
5625 FN_GLOBAL_CONST_STRING(lp_logon_script, &Globals.szLogonScript)
5626 FN_GLOBAL_CONST_STRING(lp_logon_path, &Globals.szLogonPath)
5627 FN_GLOBAL_CONST_STRING(lp_logon_drive, &Globals.szLogonDrive)
5628 FN_GLOBAL_CONST_STRING(lp_logon_home, &Globals.szLogonHome)
5629 FN_GLOBAL_STRING(lp_remote_announce, &Globals.szRemoteAnnounce)
5630 FN_GLOBAL_STRING(lp_remote_browse_sync, &Globals.szRemoteBrowseSync)
5631 FN_GLOBAL_BOOL(lp_nmbd_bind_explicit_broadcast, &Globals.bNmbdBindExplicitBroadcast)
5632 FN_GLOBAL_LIST(lp_wins_server_list, &Globals.szWINSservers)
5633 FN_GLOBAL_LIST(lp_interfaces, &Globals.szInterfaces)
5634 FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName)
5635 static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
5636 FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
5637 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
5638 * lp_passdb_backend() should be replace by the this macro again after
5641 const char *lp_passdb_backend(void)
5643 char *delim, *quote;
5645 delim = strchr( Globals.szPassdbBackend, ' ');
5646 /* no space at all */
5647 if (delim == NULL) {
5651 quote = strchr(Globals.szPassdbBackend, '"');
5652 /* no quote char or non in the first part */
5653 if (quote == NULL || quote > delim) {
5658 quote = strchr(quote+1, '"');
5659 if (quote == NULL) {
5660 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
5662 } else if (*(quote+1) == '\0') {
5663 /* space, fitting quote char, and one backend only */
5666 /* terminate string after the fitting quote char */
5671 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5672 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5673 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5674 "backend (%s) is used. The rest is ignored.\n", Globals.szPassdbBackend));
5677 return Globals.szPassdbBackend;
5679 FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
5680 FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
5681 FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
5682 FN_GLOBAL_STRING(lp_renameuser_script, &Globals.szRenameUserScript)
5683 FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
5685 FN_GLOBAL_CONST_STRING(lp_guestaccount, &Globals.szGuestaccount)
5686 FN_GLOBAL_STRING(lp_addgroup_script, &Globals.szAddGroupScript)
5687 FN_GLOBAL_STRING(lp_delgroup_script, &Globals.szDelGroupScript)
5688 FN_GLOBAL_STRING(lp_addusertogroup_script, &Globals.szAddUserToGroupScript)
5689 FN_GLOBAL_STRING(lp_deluserfromgroup_script, &Globals.szDelUserFromGroupScript)
5690 FN_GLOBAL_STRING(lp_setprimarygroup_script, &Globals.szSetPrimaryGroupScript)
5692 FN_GLOBAL_STRING(lp_addmachine_script, &Globals.szAddMachineScript)
5694 FN_GLOBAL_STRING(lp_shutdown_script, &Globals.szShutdownScript)
5695 FN_GLOBAL_STRING(lp_abort_shutdown_script, &Globals.szAbortShutdownScript)
5696 FN_GLOBAL_STRING(lp_username_map_script, &Globals.szUsernameMapScript)
5697 FN_GLOBAL_INTEGER(lp_username_map_cache_time, &Globals.iUsernameMapCacheTime)
5699 FN_GLOBAL_STRING(lp_check_password_script, &Globals.szCheckPasswordScript)
5701 FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
5702 FN_GLOBAL_CONST_STRING(lp_template_homedir, &Globals.szTemplateHomedir)
5703 FN_GLOBAL_CONST_STRING(lp_template_shell, &Globals.szTemplateShell)
5704 FN_GLOBAL_CONST_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
5705 FN_GLOBAL_INTEGER(lp_acl_compatibility, &Globals.iAclCompat)
5706 FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
5707 FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
5708 FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
5709 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, &Globals.bWinbindTrustedDomainsOnly)
5710 FN_GLOBAL_BOOL(lp_winbind_nested_groups, &Globals.bWinbindNestedGroups)
5711 FN_GLOBAL_INTEGER(lp_winbind_expand_groups, &Globals.winbind_expand_groups)
5712 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets, &Globals.bWinbindRefreshTickets)
5713 FN_GLOBAL_BOOL(lp_winbind_offline_logon, &Globals.bWinbindOfflineLogon)
5714 FN_GLOBAL_BOOL(lp_winbind_normalize_names, &Globals.bWinbindNormalizeNames)
5715 FN_GLOBAL_BOOL(lp_winbind_rpc_only, &Globals.bWinbindRpcOnly)
5716 FN_GLOBAL_BOOL(lp_create_krb5_conf, &Globals.bCreateKrb5Conf)
5717 static FN_GLOBAL_INTEGER(lp_winbind_max_domain_connections_int,
5718 &Globals.winbindMaxDomainConnections)
5720 int lp_winbind_max_domain_connections(void)
5722 if (lp_winbind_offline_logon() &&
5723 lp_winbind_max_domain_connections_int() > 1) {
5724 DEBUG(1, ("offline logons active, restricting max domain "
5725 "connections to 1\n"));
5728 return MAX(1, lp_winbind_max_domain_connections_int());
5731 FN_GLOBAL_CONST_STRING(lp_idmap_backend, &Globals.szIdmapBackend)
5732 FN_GLOBAL_INTEGER(lp_idmap_cache_time, &Globals.iIdmapCacheTime)
5733 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time, &Globals.iIdmapNegativeCacheTime)
5734 FN_GLOBAL_INTEGER(lp_keepalive, &Globals.iKeepalive)
5735 FN_GLOBAL_BOOL(lp_passdb_expand_explicit, &Globals.bPassdbExpandExplicit)
5737 FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix)
5738 FN_GLOBAL_STRING(lp_ldap_admin_dn, &Globals.szLdapAdminDn)
5739 FN_GLOBAL_INTEGER(lp_ldap_ssl, &Globals.ldap_ssl)
5740 FN_GLOBAL_BOOL(lp_ldap_ssl_ads, &Globals.ldap_ssl_ads)
5741 FN_GLOBAL_INTEGER(lp_ldap_deref, &Globals.ldap_deref)
5742 FN_GLOBAL_INTEGER(lp_ldap_follow_referral, &Globals.ldap_follow_referral)
5743 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, &Globals.ldap_passwd_sync)
5744 FN_GLOBAL_BOOL(lp_ldap_delete_dn, &Globals.ldap_delete_dn)
5745 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep, &Globals.ldap_replication_sleep)
5746 FN_GLOBAL_INTEGER(lp_ldap_timeout, &Globals.ldap_timeout)
5747 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout, &Globals.ldap_connection_timeout)
5748 FN_GLOBAL_INTEGER(lp_ldap_page_size, &Globals.ldap_page_size)
5749 FN_GLOBAL_INTEGER(lp_ldap_debug_level, &Globals.ldap_debug_level)
5750 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold, &Globals.ldap_debug_threshold)
5751 FN_GLOBAL_STRING(lp_add_share_cmd, &Globals.szAddShareCommand)
5752 FN_GLOBAL_STRING(lp_change_share_cmd, &Globals.szChangeShareCommand)
5753 FN_GLOBAL_STRING(lp_delete_share_cmd, &Globals.szDeleteShareCommand)
5754 FN_GLOBAL_STRING(lp_usershare_path, &Globals.szUsersharePath)
5755 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list, &Globals.szUsersharePrefixAllowList)
5756 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list, &Globals.szUsersharePrefixDenyList)
5758 FN_GLOBAL_LIST(lp_eventlog_list, &Globals.szEventLogs)
5760 FN_GLOBAL_BOOL(lp_registry_shares, &Globals.bRegistryShares)
5761 FN_GLOBAL_BOOL(lp_usershare_allow_guests, &Globals.bUsershareAllowGuests)
5762 FN_GLOBAL_BOOL(lp_usershare_owner_only, &Globals.bUsershareOwnerOnly)
5763 FN_GLOBAL_BOOL(lp_disable_netbios, &Globals.bDisableNetbios)
5764 FN_GLOBAL_BOOL(lp_reset_on_zero_vc, &Globals.bResetOnZeroVC)
5765 FN_GLOBAL_BOOL(lp_log_writeable_files_on_exit,
5766 &Globals.bLogWriteableFilesOnExit)
5767 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, &Globals.bMsAddPrinterWizard)
5768 FN_GLOBAL_BOOL(lp_dns_proxy, &Globals.bDNSproxy)
5769 FN_GLOBAL_BOOL(lp_wins_support, &Globals.bWINSsupport)
5770 FN_GLOBAL_BOOL(lp_we_are_a_wins_server, &Globals.bWINSsupport)
5771 FN_GLOBAL_BOOL(lp_wins_proxy, &Globals.bWINSproxy)
5772 FN_GLOBAL_BOOL(lp_local_master, &Globals.bLocalMaster)
5773 FN_GLOBAL_BOOL(lp_domain_logons, &Globals.bDomainLogons)
5774 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts, &Globals.szInitLogonDelayedHosts)
5775 FN_GLOBAL_INTEGER(lp_init_logon_delay, &Globals.InitLogonDelay)
5776 FN_GLOBAL_BOOL(lp_load_printers, &Globals.bLoadPrinters)
5777 FN_GLOBAL_BOOL(_lp_readraw, &Globals.bReadRaw)
5778 FN_GLOBAL_BOOL(lp_large_readwrite, &Globals.bLargeReadwrite)
5779 FN_GLOBAL_BOOL(_lp_writeraw, &Globals.bWriteRaw)
5780 FN_GLOBAL_BOOL(lp_null_passwords, &Globals.bNullPasswords)
5781 FN_GLOBAL_BOOL(lp_obey_pam_restrictions, &Globals.bObeyPamRestrictions)
5782 FN_GLOBAL_BOOL(lp_encrypted_passwords, &Globals.bEncryptPasswords)
5783 FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
5784 FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
5785 FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
5786 FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
5787 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, &Globals.bDebugPrefixTimestamp)
5788 FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
5789 FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
5790 FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
5791 FN_GLOBAL_BOOL(lp_debug_class, &Globals.bDebugClass)
5792 FN_GLOBAL_BOOL(lp_enable_core_files, &Globals.bEnableCoreFiles)
5793 FN_GLOBAL_BOOL(lp_browse_list, &Globals.bBrowseList)
5794 FN_GLOBAL_BOOL(lp_nis_home_map, &Globals.bNISHomeMap)
5795 static FN_GLOBAL_BOOL(lp_time_server, &Globals.bTimeServer)
5796 FN_GLOBAL_BOOL(lp_bind_interfaces_only, &Globals.bBindInterfacesOnly)
5797 FN_GLOBAL_BOOL(lp_pam_password_change, &Globals.bPamPasswordChange)
5798 FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)
5799 FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)
5800 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout)
5801 FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport)
5802 FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)
5803 FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache)
5804 FN_GLOBAL_INTEGER(lp_max_stat_cache_size, &Globals.iMaxStatCacheSize)
5805 FN_GLOBAL_BOOL(lp_allow_trusted_domains, &Globals.bAllowTrustedDomains)
5806 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain, &Globals.bMapUntrustedToDomain)
5807 FN_GLOBAL_INTEGER(lp_restrict_anonymous, &Globals.restrict_anonymous)
5808 FN_GLOBAL_BOOL(lp_lanman_auth, &Globals.bLanmanAuth)
5809 FN_GLOBAL_BOOL(lp_ntlm_auth, &Globals.bNTLMAuth)
5810 FN_GLOBAL_BOOL(lp_client_plaintext_auth, &Globals.bClientPlaintextAuth)
5811 FN_GLOBAL_BOOL(lp_client_lanman_auth, &Globals.bClientLanManAuth)
5812 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, &Globals.bClientNTLMv2Auth)
5813 FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
5814 FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
5815 FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
5816 FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
5817 FN_GLOBAL_BOOL(lp_unix_extensions, &Globals.bUnixExtensions)
5818 FN_GLOBAL_BOOL(lp_use_spnego, &Globals.bUseSpnego)
5819 FN_GLOBAL_BOOL(lp_client_use_spnego, &Globals.bClientUseSpnego)
5820 FN_GLOBAL_BOOL(lp_client_use_spnego_principal, &Globals.client_use_spnego_principal)
5821 FN_GLOBAL_BOOL(lp_send_spnego_principal, &Globals.send_spnego_principal)
5822 FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups)
5823 FN_LOCAL_PARM_BOOL(lp_change_notify, bChangeNotify)
5824 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify, bKernelChangeNotify)
5825 FN_GLOBAL_STRING(lp_dedicated_keytab_file, &Globals.szDedicatedKeytabFile)
5826 FN_GLOBAL_INTEGER(lp_kerberos_method, &Globals.iKerberosMethod)
5827 FN_GLOBAL_BOOL(lp_defer_sharing_violations, &Globals.bDeferSharingViolations)
5828 FN_GLOBAL_BOOL(lp_enable_privileges, &Globals.bEnablePrivileges)
5829 FN_GLOBAL_BOOL(lp_enable_asu_support, &Globals.bASUSupport)
5830 FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
5831 FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
5832 FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
5833 FN_GLOBAL_INTEGER(lp_min_wins_ttl, &Globals.min_wins_ttl)
5834 FN_GLOBAL_INTEGER(lp_max_log_size, &Globals.max_log_size)
5835 FN_GLOBAL_INTEGER(lp_max_open_files, &Globals.max_open_files)
5836 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size, &Globals.open_files_db_hash_size)
5837 FN_GLOBAL_INTEGER(lp_maxxmit, &Globals.max_xmit)
5838 FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux)
5839 FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel)
5840 FN_GLOBAL_INTEGER(lp_usernamelevel, &Globals.unamelevel)
5841 FN_GLOBAL_INTEGER(lp_deadtime, &Globals.deadtime)
5842 FN_GLOBAL_BOOL(lp_getwd_cache, &Globals.getwd_cache)
5843 static FN_GLOBAL_INTEGER(_lp_maxprotocol, &Globals.maxprotocol)
5844 int lp_maxprotocol(void)
5846 int ret = _lp_maxprotocol();
5847 if ((ret == PROTOCOL_SMB2) && (lp_security() == SEC_SHARE)) {
5848 DEBUG(2,("WARNING!!: \"security = share\" is incompatible "
5849 "with the SMB2 protocol. Resetting to SMB1.\n" ));
5850 lp_do_parameter(-1, "max protocol", "NT1");
5851 return PROTOCOL_NT1;
5855 FN_GLOBAL_INTEGER(lp_minprotocol, &Globals.minprotocol)
5856 FN_GLOBAL_INTEGER(lp_security, &Globals.security)
5857 FN_GLOBAL_LIST(lp_auth_methods, &Globals.AuthMethods)
5858 FN_GLOBAL_BOOL(lp_paranoid_server_security, &Globals.paranoid_server_security)
5859 FN_GLOBAL_INTEGER(lp_maxdisksize, &Globals.maxdisksize)
5860 FN_GLOBAL_INTEGER(lp_lpqcachetime, &Globals.lpqcachetime)
5861 FN_GLOBAL_INTEGER(lp_max_smbd_processes, &Globals.iMaxSmbdProcesses)
5862 FN_GLOBAL_BOOL(_lp_disable_spoolss, &Globals.bDisableSpoolss)
5863 FN_GLOBAL_INTEGER(lp_syslog, &Globals.syslog)
5864 static FN_GLOBAL_INTEGER(lp_announce_as, &Globals.announce_as)
5865 FN_GLOBAL_INTEGER(lp_lm_announce, &Globals.lm_announce)
5866 FN_GLOBAL_INTEGER(lp_lm_interval, &Globals.lm_interval)
5867 FN_GLOBAL_INTEGER(lp_machine_password_timeout, &Globals.machine_password_timeout)
5868 FN_GLOBAL_INTEGER(lp_map_to_guest, &Globals.map_to_guest)
5869 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time)
5870 FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime)
5871 FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares)
5872 FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions)
5873 FN_GLOBAL_INTEGER(lp_config_backend, &Globals.ConfigBackend)
5874 FN_GLOBAL_INTEGER(lp_smb2_max_read, &Globals.ismb2_max_read)
5875 FN_GLOBAL_INTEGER(lp_smb2_max_write, &Globals.ismb2_max_write)
5876 FN_GLOBAL_INTEGER(lp_smb2_max_trans, &Globals.ismb2_max_trans)
5877 int lp_smb2_max_credits(void)
5879 if (Globals.ismb2_max_credits == 0) {
5880 Globals.ismb2_max_credits = DEFAULT_SMB2_MAX_CREDITS;
5882 return Globals.ismb2_max_credits;
5884 FN_LOCAL_STRING(lp_preexec, szPreExec)
5885 FN_LOCAL_STRING(lp_postexec, szPostExec)
5886 FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
5887 FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
5888 FN_LOCAL_STRING(lp_servicename, szService)
5889 FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
5890 FN_LOCAL_STRING(lp_pathname, szPath)
5891 FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
5892 FN_LOCAL_STRING(lp_username, szUsername)
5893 FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers)
5894 FN_LOCAL_LIST(lp_valid_users, szValidUsers)
5895 FN_LOCAL_LIST(lp_admin_users, szAdminUsers)
5896 FN_GLOBAL_LIST(lp_svcctl_list, &Globals.szServicesList)
5897 FN_LOCAL_STRING(lp_cups_options, szCupsOptions)
5898 FN_GLOBAL_STRING(lp_cups_server, &Globals.szCupsServer)
5899 int lp_cups_encrypt(void)
5902 #ifdef HAVE_HTTPCONNECTENCRYPT
5903 switch (Globals.CupsEncrypt) {
5905 result = HTTP_ENCRYPT_REQUIRED;
5908 result = HTTP_ENCRYPT_ALWAYS;
5911 result = HTTP_ENCRYPT_NEVER;
5917 FN_GLOBAL_STRING(lp_iprint_server, &Globals.szIPrintServer)
5918 FN_GLOBAL_INTEGER(lp_cups_connection_timeout, &Globals.cups_connection_timeout)
5919 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket, &Globals.ctdbdSocket)
5920 FN_GLOBAL_LIST(lp_cluster_addresses, &Globals.szClusterAddresses)
5921 FN_GLOBAL_BOOL(lp_clustering, &Globals.clustering)
5922 FN_GLOBAL_INTEGER(lp_ctdb_timeout, &Globals.ctdb_timeout)
5923 FN_GLOBAL_INTEGER(lp_ctdb_locktime_warn_threshold, &Globals.ctdb_locktime_warn_threshold)
5924 FN_LOCAL_STRING(lp_printcommand, szPrintcommand)
5925 FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand)
5926 FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand)
5927 FN_LOCAL_STRING(lp_lppausecommand, szLppausecommand)
5928 FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
5929 FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
5930 FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
5931 static FN_LOCAL_STRING(_lp_printername, szPrintername)
5932 FN_LOCAL_CONST_STRING(lp_printjob_username, szPrintjobUsername)
5933 FN_LOCAL_LIST(lp_hostsallow, szHostsallow)
5934 FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny)
5935 FN_LOCAL_STRING(lp_magicscript, szMagicScript)
5936 FN_LOCAL_STRING(lp_magicoutput, szMagicOutput)
5937 FN_LOCAL_STRING(lp_comment, comment)
5938 FN_LOCAL_STRING(lp_force_user, force_user)
5939 FN_LOCAL_STRING(lp_force_group, force_group)
5940 FN_LOCAL_LIST(lp_readlist, readlist)
5941 FN_LOCAL_LIST(lp_writelist, writelist)
5942 FN_LOCAL_LIST(lp_printer_admin, printer_admin)
5943 FN_LOCAL_STRING(lp_fstype, fstype)
5944 FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects)
5945 FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
5946 static FN_LOCAL_STRING(lp_volume, volume)
5947 FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
5948 FN_LOCAL_STRING(lp_hide_files, szHideFiles)
5949 FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
5950 FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
5951 FN_LOCAL_STRING(lp_aio_write_behind, szAioWriteBehind)
5952 FN_LOCAL_STRING(lp_dfree_command, szDfree)
5953 FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
5954 FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
5955 FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
5956 FN_LOCAL_INTEGER(lp_casesensitive, iCaseSensitive)
5957 FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
5958 FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
5959 FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
5960 FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles)
5961 FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable)
5962 FN_LOCAL_BOOL(lp_hideunwriteable_files, bHideUnWriteableFiles)
5963 FN_LOCAL_BOOL(lp_browseable, bBrowseable)
5964 FN_LOCAL_BOOL(lp_access_based_share_enum, bAccessBasedShareEnum)
5965 FN_LOCAL_BOOL(lp_readonly, bRead_only)
5966 FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir)
5967 FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok)
5968 FN_LOCAL_BOOL(lp_guest_only, bGuest_only)
5969 FN_LOCAL_BOOL(lp_administrative_share, bAdministrative_share)
5970 FN_LOCAL_BOOL(lp_print_ok, bPrint_ok)
5971 FN_LOCAL_BOOL(lp_print_notify_backchannel, bPrintNotifyBackchannel)
5972 FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
5973 FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
5974 FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes)
5975 FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport)
5976 FN_LOCAL_PARM_BOOL(lp_locking, bLocking)
5977 FN_LOCAL_PARM_INTEGER(lp_strict_locking, iStrictLocking)
5978 FN_LOCAL_PARM_BOOL(lp_posix_locking, bPosixLocking)
5979 FN_LOCAL_BOOL(lp_share_modes, bShareModes)
5980 FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
5981 FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
5982 FN_LOCAL_BOOL(lp_onlyuser, bOnlyUser)
5983 FN_LOCAL_PARM_BOOL(lp_manglednames, bMangledNames)
5984 FN_LOCAL_BOOL(lp_symlinks, bSymlinks)
5985 FN_LOCAL_BOOL(lp_syncalways, bSyncAlways)
5986 FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate)
5987 FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
5988 FN_LOCAL_BOOL(lp_map_system, bMap_system)
5989 FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly)
5990 FN_LOCAL_BOOL(lp_fake_oplocks, bFakeOplocks)
5991 FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles)
5992 FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode)
5993 FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes)
5994 FN_LOCAL_BOOL(lp_dos_filetime_resolution, bDosFiletimeResolution)
5995 FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes)
5996 FN_GLOBAL_BOOL(lp_async_smb_echo_handler, &Globals.bAsyncSMBEchoHandler)
5997 FN_GLOBAL_BOOL(lp_multicast_dns_register, &Globals.bMulticastDnsRegister)
5998 FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks)
5999 FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms)
6000 FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS)
6001 FN_LOCAL_BOOL(lp_inherit_owner, bInheritOwner)
6002 FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver)
6003 FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode)
6004 FN_LOCAL_BOOL(lp_force_printername, bForcePrintername)
6005 FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport)
6006 FN_LOCAL_BOOL(lp_force_unknown_acl_user, bForceUnknownAclUser)
6007 FN_LOCAL_BOOL(lp_ea_support, bEASupport)
6008 FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile)
6009 FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls)
6010 FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit)
6011 FN_LOCAL_BOOL(lp_afs_share, bAfs_Share)
6012 FN_LOCAL_BOOL(lp_acl_check_permissions, bAclCheckPermissions)
6013 FN_LOCAL_BOOL(lp_acl_group_control, bAclGroupControl)
6014 FN_LOCAL_BOOL(lp_acl_map_full_control, bAclMapFullControl)
6015 FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask)
6016 FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode)
6017 FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask)
6018 FN_LOCAL_INTEGER(lp_force_security_mode, iSecurity_force_mode)
6019 FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask)
6020 FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode)
6021 FN_LOCAL_INTEGER(lp_dir_security_mask, iDir_Security_mask)
6022 FN_LOCAL_INTEGER(lp_force_dir_security_mode, iDir_Security_force_mode)
6023 FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections)
6024 FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
6025 FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
6026 FN_LOCAL_INTEGER(lp_printing, iPrinting)
6027 FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
6028 FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
6029 FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
6030 FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
6031 FN_LOCAL_INTEGER(lp_block_size, iBlock_size)
6032 FN_LOCAL_INTEGER(lp_dfree_cache_time, iDfreeCacheTime)
6033 FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size)
6034 FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize)
6035 FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize)
6036 FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly)
6037 FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize)
6038 FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt)
6039 FN_LOCAL_CHAR(lp_magicchar, magic_char)
6040 FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
6041 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay, &Globals.winbind_reconnect_delay)
6042 FN_GLOBAL_INTEGER(lp_winbind_max_clients, &Globals.winbind_max_clients)
6043 FN_GLOBAL_LIST(lp_winbind_nss_info, &Globals.szWinbindNssInfo)
6044 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
6045 FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
6046 FN_GLOBAL_INTEGER(lp_client_signing, &Globals.client_signing)
6047 FN_GLOBAL_INTEGER(lp_server_signing, &Globals.server_signing)
6048 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping, &Globals.client_ldap_sasl_wrapping)
6050 FN_GLOBAL_STRING(lp_ncalrpc_dir, &Globals.ncalrpc_dir)
6052 /* local prototypes */
6054 static int map_parameter_canonical(const char *pszParmName, bool *inverse);
6055 static const char *get_boolean(bool bool_value);
6056 static int getservicebyname(const char *pszServiceName,
6057 struct service *pserviceDest);
6058 static void copy_service(struct service *pserviceDest,
6059 struct service *pserviceSource,
6060 struct bitmap *pcopymapDest);
6061 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
6063 static bool do_section(const char *pszSectionName, void *userdata);
6064 static void init_copymap(struct service *pservice);
6065 static bool hash_a_service(const char *name, int number);
6066 static void free_service_byindex(int iService);
6067 static void free_param_opts(struct param_opt_struct **popts);
6068 static void show_parameter(int parmIndex);
6069 static bool is_synonym_of(int parm1, int parm2, bool *inverse);
6072 * This is a helper function for parametrical options support. It returns a
6073 * pointer to parametrical option value if it exists or NULL otherwise. Actual
6074 * parametrical functions are quite simple
6076 static struct param_opt_struct *get_parametrics(int snum, const char *type,
6079 bool global_section = False;
6081 struct param_opt_struct *data;
6083 if (snum >= iNumServices) return NULL;
6086 data = Globals.param_opt;
6087 global_section = True;
6089 data = ServicePtrs[snum]->param_opt;
6092 if (asprintf(¶m_key, "%s:%s", type, option) == -1) {
6093 DEBUG(0,("asprintf failed!\n"));
6098 if (strwicmp(data->key, param_key) == 0) {
6099 string_free(¶m_key);
6105 if (!global_section) {
6106 /* Try to fetch the same option but from globals */
6107 /* but only if we are not already working with Globals */
6108 data = Globals.param_opt;
6110 if (strwicmp(data->key, param_key) == 0) {
6111 string_free(¶m_key);
6118 string_free(¶m_key);
6124 #define MISSING_PARAMETER(name) \
6125 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
6127 /*******************************************************************
6128 convenience routine to return int parameters.
6129 ********************************************************************/
6130 static int lp_int(const char *s)
6134 MISSING_PARAMETER(lp_int);
6138 return (int)strtol(s, NULL, 0);
6141 /*******************************************************************
6142 convenience routine to return unsigned long parameters.
6143 ********************************************************************/
6144 static unsigned long lp_ulong(const char *s)
6148 MISSING_PARAMETER(lp_ulong);
6152 return strtoul(s, NULL, 0);
6155 /*******************************************************************
6156 convenience routine to return boolean parameters.
6157 ********************************************************************/
6158 static bool lp_bool(const char *s)
6163 MISSING_PARAMETER(lp_bool);
6167 if (!set_boolean(s, &ret)) {
6168 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
6175 /*******************************************************************
6176 convenience routine to return enum parameters.
6177 ********************************************************************/
6178 static int lp_enum(const char *s,const struct enum_list *_enum)
6182 if (!s || !*s || !_enum) {
6183 MISSING_PARAMETER(lp_enum);
6187 for (i=0; _enum[i].name; i++) {
6188 if (strequal(_enum[i].name,s))
6189 return _enum[i].value;
6192 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
6196 #undef MISSING_PARAMETER
6198 /* DO NOT USE lp_parm_string ANYMORE!!!!
6199 * use lp_parm_const_string or lp_parm_talloc_string
6201 * lp_parm_string is only used to let old modules find this symbol
6203 #undef lp_parm_string
6204 char *lp_parm_string(const char *servicename, const char *type, const char *option);
6205 char *lp_parm_string(const char *servicename, const char *type, const char *option)
6207 return lp_parm_talloc_string(lp_servicenumber(servicename), type, option, NULL);
6210 /* Return parametric option from a given service. Type is a part of option before ':' */
6211 /* Parametric option has following syntax: 'Type: option = value' */
6212 /* the returned value is talloced on the talloc_tos() */
6213 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def)
6215 struct param_opt_struct *data = get_parametrics(snum, type, option);
6217 if (data == NULL||data->value==NULL) {
6219 return lp_string(def);
6225 return lp_string(data->value);
6228 /* Return parametric option from a given service. Type is a part of option before ':' */
6229 /* Parametric option has following syntax: 'Type: option = value' */
6230 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
6232 struct param_opt_struct *data = get_parametrics(snum, type, option);
6234 if (data == NULL||data->value==NULL)
6240 /* Return parametric option from a given service. Type is a part of option before ':' */
6241 /* Parametric option has following syntax: 'Type: option = value' */
6243 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
6245 struct param_opt_struct *data = get_parametrics(snum, type, option);
6247 if (data == NULL||data->value==NULL)
6248 return (const char **)def;
6250 if (data->list==NULL) {
6251 data->list = str_list_make_v3(NULL, data->value, NULL);
6254 return (const char **)data->list;
6257 /* Return parametric option from a given service. Type is a part of option before ':' */
6258 /* Parametric option has following syntax: 'Type: option = value' */
6260 int lp_parm_int(int snum, const char *type, const char *option, int def)
6262 struct param_opt_struct *data = get_parametrics(snum, type, option);
6264 if (data && data->value && *data->value)
6265 return lp_int(data->value);
6270 /* Return parametric option from a given service. Type is a part of option before ':' */
6271 /* Parametric option has following syntax: 'Type: option = value' */
6273 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
6275 struct param_opt_struct *data = get_parametrics(snum, type, option);
6277 if (data && data->value && *data->value)
6278 return lp_ulong(data->value);
6283 /* Return parametric option from a given service. Type is a part of option before ':' */
6284 /* Parametric option has following syntax: 'Type: option = value' */
6286 bool lp_parm_bool(int snum, const char *type, const char *option, bool def)
6288 struct param_opt_struct *data = get_parametrics(snum, type, option);
6290 if (data && data->value && *data->value)
6291 return lp_bool(data->value);
6296 /* Return parametric option from a given service. Type is a part of option before ':' */
6297 /* Parametric option has following syntax: 'Type: option = value' */
6299 int lp_parm_enum(int snum, const char *type, const char *option,
6300 const struct enum_list *_enum, int def)
6302 struct param_opt_struct *data = get_parametrics(snum, type, option);
6304 if (data && data->value && *data->value && _enum)
6305 return lp_enum(data->value, _enum);
6311 /***************************************************************************
6312 Initialise a service to the defaults.
6313 ***************************************************************************/
6315 static void init_service(struct service *pservice)
6317 memset((char *)pservice, '\0', sizeof(struct service));
6318 copy_service(pservice, &sDefault, NULL);
6323 * free a param_opts structure.
6324 * param_opts handling should be moved to talloc;
6325 * then this whole functions reduces to a TALLOC_FREE().
6328 static void free_param_opts(struct param_opt_struct **popts)
6330 struct param_opt_struct *opt, *next_opt;
6332 if (popts == NULL) {
6336 if (*popts != NULL) {
6337 DEBUG(5, ("Freeing parametrics:\n"));
6340 while (opt != NULL) {
6341 string_free(&opt->key);
6342 string_free(&opt->value);
6343 TALLOC_FREE(opt->list);
6344 next_opt = opt->next;
6351 /***************************************************************************
6352 Free the dynamically allocated parts of a service struct.
6353 ***************************************************************************/
6355 static void free_service(struct service *pservice)
6360 if (pservice->szService)
6361 DEBUG(5, ("free_service: Freeing service %s\n",
6362 pservice->szService));
6364 free_parameters(pservice);
6366 string_free(&pservice->szService);
6367 TALLOC_FREE(pservice->copymap);
6369 free_param_opts(&pservice->param_opt);
6371 ZERO_STRUCTP(pservice);
6375 /***************************************************************************
6376 remove a service indexed in the ServicePtrs array from the ServiceHash
6377 and free the dynamically allocated parts
6378 ***************************************************************************/
6380 static void free_service_byindex(int idx)
6382 if ( !LP_SNUM_OK(idx) )
6385 ServicePtrs[idx]->valid = False;
6386 invalid_services[num_invalid_services++] = idx;
6388 /* we have to cleanup the hash record */
6390 if (ServicePtrs[idx]->szService) {
6391 char *canon_name = canonicalize_servicename(
6393 ServicePtrs[idx]->szService );
6395 dbwrap_delete_bystring(ServiceHash, canon_name );
6396 TALLOC_FREE(canon_name);
6399 free_service(ServicePtrs[idx]);
6402 /***************************************************************************
6403 Add a new service to the services array initialising it with the given
6405 ***************************************************************************/
6407 static int add_a_service(const struct service *pservice, const char *name)
6410 struct service tservice;
6411 int num_to_alloc = iNumServices + 1;
6413 tservice = *pservice;
6415 /* it might already exist */
6417 i = getservicebyname(name, NULL);
6423 /* find an invalid one */
6425 if (num_invalid_services > 0) {
6426 i = invalid_services[--num_invalid_services];
6429 /* if not, then create one */
6430 if (i == iNumServices) {
6431 struct service **tsp;
6434 tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct service *, num_to_alloc);
6436 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
6440 ServicePtrs[iNumServices] = SMB_MALLOC_P(struct service);
6441 if (!ServicePtrs[iNumServices]) {
6442 DEBUG(0,("add_a_service: out of memory!\n"));
6447 /* enlarge invalid_services here for now... */
6448 tinvalid = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services, int,
6450 if (tinvalid == NULL) {
6451 DEBUG(0,("add_a_service: failed to enlarge "
6452 "invalid_services!\n"));
6455 invalid_services = tinvalid;
6457 free_service_byindex(i);
6460 ServicePtrs[i]->valid = True;
6462 init_service(ServicePtrs[i]);
6463 copy_service(ServicePtrs[i], &tservice, NULL);
6465 string_set(&ServicePtrs[i]->szService, name);
6467 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
6468 i, ServicePtrs[i]->szService));
6470 if (!hash_a_service(ServicePtrs[i]->szService, i)) {
6477 /***************************************************************************
6478 Convert a string to uppercase and remove whitespaces.
6479 ***************************************************************************/
6481 char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src)
6486 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
6490 result = talloc_strdup(ctx, src);
6491 SMB_ASSERT(result != NULL);
6497 /***************************************************************************
6498 Add a name/index pair for the services array to the hash table.
6499 ***************************************************************************/
6501 static bool hash_a_service(const char *name, int idx)
6505 if ( !ServiceHash ) {
6506 DEBUG(10,("hash_a_service: creating servicehash\n"));
6507 ServiceHash = db_open_rbt(NULL);
6508 if ( !ServiceHash ) {
6509 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
6514 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
6517 canon_name = canonicalize_servicename(talloc_tos(), name );
6519 dbwrap_store_bystring(ServiceHash, canon_name,
6520 make_tdb_data((uint8 *)&idx, sizeof(idx)),
6523 TALLOC_FREE(canon_name);
6528 /***************************************************************************
6529 Add a new home service, with the specified home directory, defaults coming
6531 ***************************************************************************/
6533 bool lp_add_home(const char *pszHomename, int iDefaultService,
6534 const char *user, const char *pszHomedir)
6538 if (pszHomename == NULL || user == NULL || pszHomedir == NULL ||
6539 pszHomedir[0] == '\0') {
6543 i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
6548 if (!(*(ServicePtrs[iDefaultService]->szPath))
6549 || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
6550 string_set(&ServicePtrs[i]->szPath, pszHomedir);
6553 if (!(*(ServicePtrs[i]->comment))) {
6554 char *comment = NULL;
6555 if (asprintf(&comment, "Home directory of %s", user) < 0) {
6558 string_set(&ServicePtrs[i]->comment, comment);
6562 /* set the browseable flag from the global default */
6564 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6565 ServicePtrs[i]->bAccessBasedShareEnum = sDefault.bAccessBasedShareEnum;
6567 ServicePtrs[i]->autoloaded = True;
6569 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
6570 user, ServicePtrs[i]->szPath ));
6575 /***************************************************************************
6576 Add a new service, based on an old one.
6577 ***************************************************************************/
6579 int lp_add_service(const char *pszService, int iDefaultService)
6581 if (iDefaultService < 0) {
6582 return add_a_service(&sDefault, pszService);
6585 return (add_a_service(ServicePtrs[iDefaultService], pszService));
6588 /***************************************************************************
6589 Add the IPC service.
6590 ***************************************************************************/
6592 static bool lp_add_ipc(const char *ipc_name, bool guest_ok)
6594 char *comment = NULL;
6595 int i = add_a_service(&sDefault, ipc_name);
6600 if (asprintf(&comment, "IPC Service (%s)",
6601 Globals.szServerString) < 0) {
6605 string_set(&ServicePtrs[i]->szPath, tmpdir());
6606 string_set(&ServicePtrs[i]->szUsername, "");
6607 string_set(&ServicePtrs[i]->comment, comment);
6608 string_set(&ServicePtrs[i]->fstype, "IPC");
6609 ServicePtrs[i]->iMaxConnections = 0;
6610 ServicePtrs[i]->bAvailable = True;
6611 ServicePtrs[i]->bRead_only = True;
6612 ServicePtrs[i]->bGuest_only = False;
6613 ServicePtrs[i]->bAdministrative_share = True;
6614 ServicePtrs[i]->bGuest_ok = guest_ok;
6615 ServicePtrs[i]->bPrint_ok = False;
6616 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6618 DEBUG(3, ("adding IPC service\n"));
6624 /***************************************************************************
6625 Add a new printer service, with defaults coming from service iFrom.
6626 ***************************************************************************/
6628 bool lp_add_printer(const char *pszPrintername, int iDefaultService)
6630 const char *comment = "From Printcap";
6631 int i = add_a_service(ServicePtrs[iDefaultService], pszPrintername);
6636 /* note that we do NOT default the availability flag to True - */
6637 /* we take it from the default service passed. This allows all */
6638 /* dynamic printers to be disabled by disabling the [printers] */
6639 /* entry (if/when the 'available' keyword is implemented!). */
6641 /* the printer name is set to the service name. */
6642 string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
6643 string_set(&ServicePtrs[i]->comment, comment);
6645 /* set the browseable flag from the gloabl default */
6646 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6648 /* Printers cannot be read_only. */
6649 ServicePtrs[i]->bRead_only = False;
6650 /* No share modes on printer services. */
6651 ServicePtrs[i]->bShareModes = False;
6652 /* No oplocks on printer services. */
6653 ServicePtrs[i]->bOpLocks = False;
6654 /* Printer services must be printable. */
6655 ServicePtrs[i]->bPrint_ok = True;
6657 DEBUG(3, ("adding printer service %s\n", pszPrintername));
6663 /***************************************************************************
6664 Check whether the given parameter name is valid.
6665 Parametric options (names containing a colon) are considered valid.
6666 ***************************************************************************/
6668 bool lp_parameter_is_valid(const char *pszParmName)
6670 return ((map_parameter(pszParmName) != -1) ||
6671 (strchr(pszParmName, ':') != NULL));
6674 /***************************************************************************
6675 Check whether the given name is the name of a global parameter.
6676 Returns True for strings belonging to parameters of class
6677 P_GLOBAL, False for all other strings, also for parametric options
6678 and strings not belonging to any option.
6679 ***************************************************************************/
6681 bool lp_parameter_is_global(const char *pszParmName)
6683 int num = map_parameter(pszParmName);
6686 return (parm_table[num].p_class == P_GLOBAL);
6692 /**************************************************************************
6693 Check whether the given name is the canonical name of a parameter.
6694 Returns False if it is not a valid parameter Name.
6695 For parametric options, True is returned.
6696 **************************************************************************/
6698 bool lp_parameter_is_canonical(const char *parm_name)
6700 if (!lp_parameter_is_valid(parm_name)) {
6704 return (map_parameter(parm_name) ==
6705 map_parameter_canonical(parm_name, NULL));
6708 /**************************************************************************
6709 Determine the canonical name for a parameter.
6710 Indicate when it is an inverse (boolean) synonym instead of a
6712 **************************************************************************/
6714 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
6719 if (!lp_parameter_is_valid(parm_name)) {
6724 num = map_parameter_canonical(parm_name, inverse);
6726 /* parametric option */
6727 *canon_parm = parm_name;
6729 *canon_parm = parm_table[num].label;
6736 /**************************************************************************
6737 Determine the canonical name for a parameter.
6738 Turn the value given into the inverse boolean expression when
6739 the synonym is an invers boolean synonym.
6741 Return True if parm_name is a valid parameter name and
6742 in case it is an invers boolean synonym, if the val string could
6743 successfully be converted to the reverse bool.
6744 Return false in all other cases.
6745 **************************************************************************/
6747 bool lp_canonicalize_parameter_with_value(const char *parm_name,
6749 const char **canon_parm,
6750 const char **canon_val)
6755 if (!lp_parameter_is_valid(parm_name)) {
6761 num = map_parameter_canonical(parm_name, &inverse);
6763 /* parametric option */
6764 *canon_parm = parm_name;
6767 *canon_parm = parm_table[num].label;
6769 if (!lp_invert_boolean(val, canon_val)) {
6781 /***************************************************************************
6782 Map a parameter's string representation to something we can use.
6783 Returns False if the parameter string is not recognised, else TRUE.
6784 ***************************************************************************/
6786 static int map_parameter(const char *pszParmName)
6790 if (*pszParmName == '-' && !strequal(pszParmName, "-valid"))
6793 for (iIndex = 0; parm_table[iIndex].label; iIndex++)
6794 if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
6797 /* Warn only if it isn't parametric option */
6798 if (strchr(pszParmName, ':') == NULL)
6799 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
6800 /* We do return 'fail' for parametric options as well because they are
6801 stored in different storage
6806 /***************************************************************************
6807 Map a parameter's string representation to the index of the canonical
6808 form of the parameter (it might be a synonym).
6809 Returns -1 if the parameter string is not recognised.
6810 ***************************************************************************/
6812 static int map_parameter_canonical(const char *pszParmName, bool *inverse)
6814 int parm_num, canon_num;
6815 bool loc_inverse = False;
6817 parm_num = map_parameter(pszParmName);
6818 if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_HIDE)) {
6819 /* invalid, parametric or no canidate for synonyms ... */
6823 for (canon_num = 0; parm_table[canon_num].label; canon_num++) {
6824 if (is_synonym_of(parm_num, canon_num, &loc_inverse)) {
6825 parm_num = canon_num;
6831 if (inverse != NULL) {
6832 *inverse = loc_inverse;
6837 /***************************************************************************
6838 return true if parameter number parm1 is a synonym of parameter
6839 number parm2 (parm2 being the principal name).
6840 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6842 ***************************************************************************/
6844 static bool is_synonym_of(int parm1, int parm2, bool *inverse)
6846 if ((parm_table[parm1].ptr == parm_table[parm2].ptr) &&
6847 (parm_table[parm1].flags & FLAG_HIDE) &&
6848 !(parm_table[parm2].flags & FLAG_HIDE))
6850 if (inverse != NULL) {
6851 if ((parm_table[parm1].type == P_BOOLREV) &&
6852 (parm_table[parm2].type == P_BOOL))
6864 /***************************************************************************
6865 Show one parameter's name, type, [values,] and flags.
6866 (helper functions for show_parameter_list)
6867 ***************************************************************************/
6869 static void show_parameter(int parmIndex)
6871 int enumIndex, flagIndex;
6876 const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6877 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6879 unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
6880 FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
6881 FLAG_HIDE, FLAG_DOS_STRING};
6882 const char *flag_names[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6883 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6884 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL};
6886 printf("%s=%s", parm_table[parmIndex].label,
6887 type[parm_table[parmIndex].type]);
6888 if (parm_table[parmIndex].type == P_ENUM) {
6891 parm_table[parmIndex].enum_list[enumIndex].name;
6895 enumIndex ? "|" : "",
6896 parm_table[parmIndex].enum_list[enumIndex].name);
6901 for (flagIndex=0; flag_names[flagIndex]; flagIndex++) {
6902 if (parm_table[parmIndex].flags & flags[flagIndex]) {
6905 flag_names[flagIndex]);
6910 /* output synonyms */
6912 for (parmIndex2=0; parm_table[parmIndex2].label; parmIndex2++) {
6913 if (is_synonym_of(parmIndex, parmIndex2, &inverse)) {
6914 printf(" (%ssynonym of %s)", inverse ? "inverse " : "",
6915 parm_table[parmIndex2].label);
6916 } else if (is_synonym_of(parmIndex2, parmIndex, &inverse)) {
6918 printf(" (synonyms: ");
6923 printf("%s%s", parm_table[parmIndex2].label,
6924 inverse ? "[i]" : "");
6934 /***************************************************************************
6935 Show all parameter's name, type, [values,] and flags.
6936 ***************************************************************************/
6938 void show_parameter_list(void)
6940 int classIndex, parmIndex;
6941 const char *section_names[] = { "local", "global", NULL};
6943 for (classIndex=0; section_names[classIndex]; classIndex++) {
6944 printf("[%s]\n", section_names[classIndex]);
6945 for (parmIndex = 0; parm_table[parmIndex].label; parmIndex++) {
6946 if (parm_table[parmIndex].p_class == classIndex) {
6947 show_parameter(parmIndex);
6953 /***************************************************************************
6954 Check if a given string correctly represents a boolean value.
6955 ***************************************************************************/
6957 bool lp_string_is_valid_boolean(const char *parm_value)
6959 return set_boolean(parm_value, NULL);
6962 /***************************************************************************
6963 Get the standard string representation of a boolean value ("yes" or "no")
6964 ***************************************************************************/
6966 static const char *get_boolean(bool bool_value)
6968 static const char *yes_str = "yes";
6969 static const char *no_str = "no";
6971 return (bool_value ? yes_str : no_str);
6974 /***************************************************************************
6975 Provide the string of the negated boolean value associated to the boolean
6976 given as a string. Returns False if the passed string does not correctly
6977 represent a boolean.
6978 ***************************************************************************/
6980 bool lp_invert_boolean(const char *str, const char **inverse_str)
6984 if (!set_boolean(str, &val)) {
6988 *inverse_str = get_boolean(!val);
6992 /***************************************************************************
6993 Provide the canonical string representation of a boolean value given
6994 as a string. Return True on success, False if the string given does
6995 not correctly represent a boolean.
6996 ***************************************************************************/
6998 bool lp_canonicalize_boolean(const char *str, const char**canon_str)
7002 if (!set_boolean(str, &val)) {
7006 *canon_str = get_boolean(val);
7010 /***************************************************************************
7011 Find a service by name. Otherwise works like get_service.
7012 ***************************************************************************/
7014 static int getservicebyname(const char *pszServiceName, struct service *pserviceDest)
7020 if (ServiceHash == NULL) {
7024 canon_name = canonicalize_servicename(talloc_tos(), pszServiceName);
7026 data = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name);
7028 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
7029 iService = *(int *)data.dptr;
7032 TALLOC_FREE(canon_name);
7034 if ((iService != -1) && (LP_SNUM_OK(iService))
7035 && (pserviceDest != NULL)) {
7036 copy_service(pserviceDest, ServicePtrs[iService], NULL);
7042 /***************************************************************************
7043 Copy a service structure to another.
7044 If pcopymapDest is NULL then copy all fields
7045 ***************************************************************************/
7048 * Add a parametric option to a param_opt_struct,
7049 * replacing old value, if already present.
7051 static void set_param_opt(struct param_opt_struct **opt_list,
7052 const char *opt_name,
7053 const char *opt_value,
7056 struct param_opt_struct *new_opt, *opt;
7059 if (opt_list == NULL) {
7066 /* Traverse destination */
7068 /* If we already have same option, override it */
7069 if (strwicmp(opt->key, opt_name) == 0) {
7070 if ((opt->flags & FLAG_CMDLINE) &&
7071 !(flags & FLAG_CMDLINE)) {
7072 /* it's been marked as not to be
7076 string_free(&opt->value);
7077 TALLOC_FREE(opt->list);
7078 opt->value = SMB_STRDUP(opt_value);
7086 new_opt = SMB_XMALLOC_P(struct param_opt_struct);
7087 new_opt->key = SMB_STRDUP(opt_name);
7088 new_opt->value = SMB_STRDUP(opt_value);
7089 new_opt->list = NULL;
7090 new_opt->flags = flags;
7091 DLIST_ADD(*opt_list, new_opt);
7095 static void copy_service(struct service *pserviceDest, struct service *pserviceSource,
7096 struct bitmap *pcopymapDest)
7099 bool bcopyall = (pcopymapDest == NULL);
7100 struct param_opt_struct *data;
7102 for (i = 0; parm_table[i].label; i++)
7103 if (parm_table[i].ptr && parm_table[i].p_class == P_LOCAL &&
7104 (bcopyall || bitmap_query(pcopymapDest,i))) {
7105 void *def_ptr = parm_table[i].ptr;
7107 ((char *)pserviceSource) + PTR_DIFF(def_ptr,
7110 ((char *)pserviceDest) + PTR_DIFF(def_ptr,
7113 switch (parm_table[i].type) {
7116 *(bool *)dest_ptr = *(bool *)src_ptr;
7122 *(int *)dest_ptr = *(int *)src_ptr;
7126 *(char *)dest_ptr = *(char *)src_ptr;
7130 string_set((char **)dest_ptr,
7135 string_set((char **)dest_ptr,
7137 strupper_m(*(char **)dest_ptr);
7140 TALLOC_FREE(*((char ***)dest_ptr));
7141 *((char ***)dest_ptr) = str_list_copy(NULL,
7142 *(const char ***)src_ptr);
7150 init_copymap(pserviceDest);
7151 if (pserviceSource->copymap)
7152 bitmap_copy(pserviceDest->copymap,
7153 pserviceSource->copymap);
7156 data = pserviceSource->param_opt;
7158 set_param_opt(&pserviceDest->param_opt, data->key, data->value, data->flags);
7163 /***************************************************************************
7164 Check a service for consistency. Return False if the service is in any way
7165 incomplete or faulty, else True.
7166 ***************************************************************************/
7168 bool service_ok(int iService)
7173 if (ServicePtrs[iService]->szService[0] == '\0') {
7174 DEBUG(0, ("The following message indicates an internal error:\n"));
7175 DEBUG(0, ("No service name in service entry.\n"));
7179 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
7180 /* I can't see why you'd want a non-printable printer service... */
7181 if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
7182 if (!ServicePtrs[iService]->bPrint_ok) {
7183 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
7184 ServicePtrs[iService]->szService));
7185 ServicePtrs[iService]->bPrint_ok = True;
7187 /* [printers] service must also be non-browsable. */
7188 if (ServicePtrs[iService]->bBrowseable)
7189 ServicePtrs[iService]->bBrowseable = False;
7192 if (ServicePtrs[iService]->szPath[0] == '\0' &&
7193 strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0 &&
7194 ServicePtrs[iService]->szMSDfsProxy[0] == '\0'
7196 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
7197 ServicePtrs[iService]->szService));
7198 ServicePtrs[iService]->bAvailable = False;
7201 /* If a service is flagged unavailable, log the fact at level 1. */
7202 if (!ServicePtrs[iService]->bAvailable)
7203 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
7204 ServicePtrs[iService]->szService));
7209 static struct smbconf_ctx *lp_smbconf_ctx(void)
7212 static struct smbconf_ctx *conf_ctx = NULL;
7214 if (conf_ctx == NULL) {
7215 err = smbconf_init(NULL, &conf_ctx, "registry:");
7216 if (!SBC_ERROR_IS_OK(err)) {
7217 DEBUG(1, ("error initializing registry configuration: "
7218 "%s\n", sbcErrorString(err)));
7226 static bool process_smbconf_service(struct smbconf_service *service)
7231 if (service == NULL) {
7235 ret = do_section(service->name, NULL);
7239 for (count = 0; count < service->num_params; count++) {
7240 ret = do_parameter(service->param_names[count],
7241 service->param_values[count],
7247 if (iServiceIndex >= 0) {
7248 return service_ok(iServiceIndex);
7254 * load a service from registry and activate it
7256 bool process_registry_service(const char *service_name)
7259 struct smbconf_service *service = NULL;
7260 TALLOC_CTX *mem_ctx = talloc_stackframe();
7261 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7264 if (conf_ctx == NULL) {
7268 DEBUG(5, ("process_registry_service: service name %s\n", service_name));
7270 if (!smbconf_share_exists(conf_ctx, service_name)) {
7272 * Registry does not contain data for this service (yet),
7273 * but make sure lp_load doesn't return false.
7279 err = smbconf_get_share(conf_ctx, mem_ctx, service_name, &service);
7280 if (!SBC_ERROR_IS_OK(err)) {
7284 ret = process_smbconf_service(service);
7290 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7293 TALLOC_FREE(mem_ctx);
7298 * process_registry_globals
7300 static bool process_registry_globals(void)
7304 add_to_file_list(INCLUDE_REGISTRY_NAME, INCLUDE_REGISTRY_NAME);
7306 ret = do_parameter("registry shares", "yes", NULL);
7311 return process_registry_service(GLOBAL_NAME);
7314 bool process_registry_shares(void)
7318 struct smbconf_service **service = NULL;
7319 uint32_t num_shares = 0;
7320 TALLOC_CTX *mem_ctx = talloc_stackframe();
7321 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7324 if (conf_ctx == NULL) {
7328 err = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &service);
7329 if (!SBC_ERROR_IS_OK(err)) {
7335 for (count = 0; count < num_shares; count++) {
7336 if (strequal(service[count]->name, GLOBAL_NAME)) {
7339 ret = process_smbconf_service(service[count]);
7346 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7349 TALLOC_FREE(mem_ctx);
7353 #define MAX_INCLUDE_DEPTH 100
7355 static uint8_t include_depth;
7357 static struct file_lists {
7358 struct file_lists *next;
7362 } *file_lists = NULL;
7364 /*******************************************************************
7365 Keep a linked list of all config files so we know when one has changed
7366 it's date and needs to be reloaded.
7367 ********************************************************************/
7369 static void add_to_file_list(const char *fname, const char *subfname)
7371 struct file_lists *f = file_lists;
7374 if (f->name && !strcmp(f->name, fname))
7380 f = SMB_MALLOC_P(struct file_lists);
7383 f->next = file_lists;
7384 f->name = SMB_STRDUP(fname);
7389 f->subfname = SMB_STRDUP(subfname);
7396 f->modtime = file_modtime(subfname);
7398 time_t t = file_modtime(subfname);
7406 * Free the file lists
7408 static void free_file_list(void)
7410 struct file_lists *f;
7411 struct file_lists *next;
7416 SAFE_FREE( f->name );
7417 SAFE_FREE( f->subfname );
7426 * Utility function for outsiders to check if we're running on registry.
7428 bool lp_config_backend_is_registry(void)
7430 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY);
7434 * Utility function to check if the config backend is FILE.
7436 bool lp_config_backend_is_file(void)
7438 return (lp_config_backend() == CONFIG_BACKEND_FILE);
7441 /*******************************************************************
7442 Check if a config file has changed date.
7443 ********************************************************************/
7445 bool lp_file_list_changed(void)
7447 struct file_lists *f = file_lists;
7449 DEBUG(6, ("lp_file_list_changed()\n"));
7454 if (strequal(f->name, INCLUDE_REGISTRY_NAME)) {
7455 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7457 if (conf_ctx == NULL) {
7460 if (smbconf_changed(conf_ctx, &conf_last_csn, NULL,
7463 DEBUGADD(6, ("registry config changed\n"));
7468 n2 = talloc_sub_basic(talloc_tos(),
7469 get_current_username(),
7470 current_user_info.domain,
7475 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
7476 f->name, n2, ctime(&f->modtime)));
7478 mod_time = file_modtime(n2);
7481 ((f->modtime != mod_time) ||
7482 (f->subfname == NULL) ||
7483 (strcmp(n2, f->subfname) != 0)))
7486 ("file %s modified: %s\n", n2,
7488 f->modtime = mod_time;
7489 SAFE_FREE(f->subfname);
7490 f->subfname = SMB_STRDUP(n2);
7502 /***************************************************************************
7503 Run standard_sub_basic on netbios name... needed because global_myname
7504 is not accessed through any lp_ macro.
7505 Note: We must *NOT* use string_set() here as ptr points to global_myname.
7506 ***************************************************************************/
7508 static bool handle_netbios_name(int snum, const char *pszParmValue, char **ptr)
7511 char *netbios_name = talloc_sub_basic(
7512 talloc_tos(), get_current_username(), current_user_info.domain,
7515 ret = set_global_myname(netbios_name);
7516 TALLOC_FREE(netbios_name);
7517 string_set(&Globals.szNetbiosName,global_myname());
7519 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
7525 static bool handle_charset(int snum, const char *pszParmValue, char **ptr)
7527 if (strcmp(*ptr, pszParmValue) != 0) {
7528 string_set(ptr, pszParmValue);
7536 static bool handle_workgroup(int snum, const char *pszParmValue, char **ptr)
7540 ret = set_global_myworkgroup(pszParmValue);
7541 string_set(&Globals.szWorkgroup,lp_workgroup());
7546 static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
7550 ret = set_global_scope(pszParmValue);
7551 string_set(&Globals.szNetbiosScope,global_scope());
7556 static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
7558 TALLOC_FREE(Globals.szNetbiosAliases);
7559 Globals.szNetbiosAliases = str_list_make_v3(NULL, pszParmValue, NULL);
7560 return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
7563 /***************************************************************************
7564 Handle the include operation.
7565 ***************************************************************************/
7566 static bool bAllowIncludeRegistry = true;
7568 static bool handle_include(int snum, const char *pszParmValue, char **ptr)
7572 if (include_depth >= MAX_INCLUDE_DEPTH) {
7573 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7578 if (strequal(pszParmValue, INCLUDE_REGISTRY_NAME)) {
7579 if (!bAllowIncludeRegistry) {
7582 if (bInGlobalSection) {
7585 ret = process_registry_globals();
7589 DEBUG(1, ("\"include = registry\" only effective "
7590 "in %s section\n", GLOBAL_NAME));
7595 fname = talloc_sub_basic(talloc_tos(), get_current_username(),
7596 current_user_info.domain,
7599 add_to_file_list(pszParmValue, fname);
7601 string_set(ptr, fname);
7603 if (file_exist(fname)) {
7606 ret = pm_process(fname, do_section, do_parameter, NULL);
7612 DEBUG(2, ("Can't find include file %s\n", fname));
7617 /***************************************************************************
7618 Handle the interpretation of the copy parameter.
7619 ***************************************************************************/
7621 static bool handle_copy(int snum, const char *pszParmValue, char **ptr)
7625 struct service serviceTemp;
7627 string_set(ptr, pszParmValue);
7629 init_service(&serviceTemp);
7633 DEBUG(3, ("Copying service from service %s\n", pszParmValue));
7635 if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) {
7636 if (iTemp == iServiceIndex) {
7637 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
7639 copy_service(ServicePtrs[iServiceIndex],
7641 ServicePtrs[iServiceIndex]->copymap);
7645 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
7649 free_service(&serviceTemp);
7653 static bool handle_ldap_debug_level(int snum, const char *pszParmValue, char **ptr)
7655 Globals.ldap_debug_level = lp_int(pszParmValue);
7656 init_ldap_debugging();
7660 /***************************************************************************
7661 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7666 idmap uid = 1000-1999
7669 We only do simple parsing checks here. The strings are parsed into useful
7670 structures in the idmap daemon code.
7672 ***************************************************************************/
7674 /* Some lp_ routines to return idmap [ug]id information */
7676 static uid_t idmap_uid_low, idmap_uid_high;
7677 static gid_t idmap_gid_low, idmap_gid_high;
7679 bool lp_idmap_uid(uid_t *low, uid_t *high)
7681 if (idmap_uid_low == 0 || idmap_uid_high == 0)
7685 *low = idmap_uid_low;
7688 *high = idmap_uid_high;
7693 bool lp_idmap_gid(gid_t *low, gid_t *high)
7695 if (idmap_gid_low == 0 || idmap_gid_high == 0)
7699 *low = idmap_gid_low;
7702 *high = idmap_gid_high;
7707 static bool handle_idmap_backend(int snum, const char *pszParmValue, char **ptr)
7709 lp_do_parameter(snum, "idmap config * : backend", pszParmValue);
7714 /* Do some simple checks on "idmap [ug]id" parameter values */
7716 static bool handle_idmap_uid(int snum, const char *pszParmValue, char **ptr)
7718 lp_do_parameter(snum, "idmap config * : range", pszParmValue);
7723 static bool handle_idmap_gid(int snum, const char *pszParmValue, char **ptr)
7725 lp_do_parameter(snum, "idmap config * : range", pszParmValue);
7730 /***************************************************************************
7731 Handle the DEBUG level list.
7732 ***************************************************************************/
7734 static bool handle_debug_list( int snum, const char *pszParmValueIn, char **ptr )
7736 string_set(ptr, pszParmValueIn);
7737 return debug_parse_levels(pszParmValueIn);
7740 /***************************************************************************
7741 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7742 ***************************************************************************/
7744 static const char *append_ldap_suffix( const char *str )
7746 const char *suffix_string;
7749 suffix_string = talloc_asprintf(talloc_tos(), "%s,%s", str,
7750 Globals.szLdapSuffix );
7751 if ( !suffix_string ) {
7752 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7756 return suffix_string;
7759 const char *lp_ldap_machine_suffix(void)
7761 if (Globals.szLdapMachineSuffix[0])
7762 return append_ldap_suffix(Globals.szLdapMachineSuffix);
7764 return lp_string(Globals.szLdapSuffix);
7767 const char *lp_ldap_user_suffix(void)
7769 if (Globals.szLdapUserSuffix[0])
7770 return append_ldap_suffix(Globals.szLdapUserSuffix);
7772 return lp_string(Globals.szLdapSuffix);
7775 const char *lp_ldap_group_suffix(void)
7777 if (Globals.szLdapGroupSuffix[0])
7778 return append_ldap_suffix(Globals.szLdapGroupSuffix);
7780 return lp_string(Globals.szLdapSuffix);
7783 const char *lp_ldap_idmap_suffix(void)
7785 if (Globals.szLdapIdmapSuffix[0])
7786 return append_ldap_suffix(Globals.szLdapIdmapSuffix);
7788 return lp_string(Globals.szLdapSuffix);
7791 /****************************************************************************
7792 set the value for a P_ENUM
7793 ***************************************************************************/
7795 static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue,
7800 for (i = 0; parm->enum_list[i].name; i++) {
7801 if ( strequal(pszParmValue, parm->enum_list[i].name)) {
7802 *ptr = parm->enum_list[i].value;
7806 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7807 pszParmValue, parm->label));
7810 /***************************************************************************
7811 ***************************************************************************/
7813 static bool handle_printing(int snum, const char *pszParmValue, char **ptr)
7815 static int parm_num = -1;
7818 if ( parm_num == -1 )
7819 parm_num = map_parameter( "printing" );
7821 lp_set_enum_parm( &parm_table[parm_num], pszParmValue, (int*)ptr );
7826 s = ServicePtrs[snum];
7828 init_printer_values( s );
7834 /***************************************************************************
7835 Initialise a copymap.
7836 ***************************************************************************/
7838 static void init_copymap(struct service *pservice)
7842 TALLOC_FREE(pservice->copymap);
7844 pservice->copymap = bitmap_talloc(NULL, NUMPARAMETERS);
7845 if (!pservice->copymap)
7847 ("Couldn't allocate copymap!! (size %d)\n",
7848 (int)NUMPARAMETERS));
7850 for (i = 0; i < NUMPARAMETERS; i++)
7851 bitmap_set(pservice->copymap, i);
7854 /***************************************************************************
7855 Return the local pointer to a parameter given a service struct and the
7856 pointer into the default structure.
7857 ***************************************************************************/
7859 static void *lp_local_ptr(struct service *service, void *ptr)
7861 return (void *)(((char *)service) + PTR_DIFF(ptr, &sDefault));
7864 /***************************************************************************
7865 Return the local pointer to a parameter given the service number and the
7866 pointer into the default structure.
7867 ***************************************************************************/
7869 void *lp_local_ptr_by_snum(int snum, void *ptr)
7871 return lp_local_ptr(ServicePtrs[snum], ptr);
7874 /***************************************************************************
7875 Process a parameter for a particular service number. If snum < 0
7876 then assume we are in the globals.
7877 ***************************************************************************/
7879 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
7882 void *parm_ptr = NULL; /* where we are going to store the result */
7883 void *def_ptr = NULL;
7884 struct param_opt_struct **opt_list;
7886 parmnum = map_parameter(pszParmName);
7889 if (strchr(pszParmName, ':') == NULL) {
7890 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7896 * We've got a parametric option
7899 opt_list = (snum < 0)
7900 ? &Globals.param_opt : &ServicePtrs[snum]->param_opt;
7901 set_param_opt(opt_list, pszParmName, pszParmValue, 0);
7906 /* if it's already been set by the command line, then we don't
7908 if (parm_table[parmnum].flags & FLAG_CMDLINE) {
7912 if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
7913 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7917 def_ptr = parm_table[parmnum].ptr;
7919 /* we might point at a service, the default service or a global */
7923 if (parm_table[parmnum].p_class == P_GLOBAL) {
7925 ("Global parameter %s found in service section!\n",
7929 parm_ptr = lp_local_ptr_by_snum(snum, def_ptr);
7933 if (!ServicePtrs[snum]->copymap)
7934 init_copymap(ServicePtrs[snum]);
7936 /* this handles the aliases - set the copymap for other entries with
7937 the same data pointer */
7938 for (i = 0; parm_table[i].label; i++)
7939 if (parm_table[i].ptr == parm_table[parmnum].ptr)
7940 bitmap_clear(ServicePtrs[snum]->copymap, i);
7943 /* if it is a special case then go ahead */
7944 if (parm_table[parmnum].special) {
7945 return parm_table[parmnum].special(snum, pszParmValue,
7949 /* now switch on the type of variable it is */
7950 switch (parm_table[parmnum].type)
7953 *(bool *)parm_ptr = lp_bool(pszParmValue);
7957 *(bool *)parm_ptr = !lp_bool(pszParmValue);
7961 *(int *)parm_ptr = lp_int(pszParmValue);
7965 *(char *)parm_ptr = *pszParmValue;
7969 i = sscanf(pszParmValue, "%o", (int *)parm_ptr);
7971 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName ));
7976 TALLOC_FREE(*((char ***)parm_ptr));
7977 *(char ***)parm_ptr = str_list_make_v3(
7978 NULL, pszParmValue, NULL);
7982 string_set((char **)parm_ptr, pszParmValue);
7986 string_set((char **)parm_ptr, pszParmValue);
7987 strupper_m(*(char **)parm_ptr);
7991 lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
8000 /***************************************************************************
8001 set a parameter, marking it with FLAG_CMDLINE. Parameters marked as
8002 FLAG_CMDLINE won't be overridden by loads from smb.conf.
8003 ***************************************************************************/
8005 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values)
8008 parmnum = map_parameter(pszParmName);
8010 parm_table[parmnum].flags &= ~FLAG_CMDLINE;
8011 if (!lp_do_parameter(-1, pszParmName, pszParmValue)) {
8014 parm_table[parmnum].flags |= FLAG_CMDLINE;
8016 /* we have to also set FLAG_CMDLINE on aliases. Aliases must
8017 * be grouped in the table, so we don't have to search the
8019 for (i=parmnum-1;i>=0 && parm_table[i].ptr == parm_table[parmnum].ptr;i--) {
8020 parm_table[i].flags |= FLAG_CMDLINE;
8022 for (i=parmnum+1;i<NUMPARAMETERS && parm_table[i].ptr == parm_table[parmnum].ptr;i++) {
8023 parm_table[i].flags |= FLAG_CMDLINE;
8027 store_lp_set_cmdline(pszParmName, pszParmValue);
8032 /* it might be parametric */
8033 if (strchr(pszParmName, ':') != NULL) {
8034 set_param_opt(&Globals.param_opt, pszParmName, pszParmValue, FLAG_CMDLINE);
8036 store_lp_set_cmdline(pszParmName, pszParmValue);
8041 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName));
8045 bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
8047 return lp_set_cmdline_helper(pszParmName, pszParmValue, true);
8050 /***************************************************************************
8051 Process a parameter.
8052 ***************************************************************************/
8054 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
8057 if (!bInGlobalSection && bGlobalOnly)
8060 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
8062 return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
8063 pszParmName, pszParmValue));
8067 set a option from the commandline in 'a=b' format. Use to support --option
8069 bool lp_set_option(const char *option)
8074 s = talloc_strdup(NULL, option);
8087 /* skip white spaces after the = sign */
8090 } while (*p == ' ');
8092 ret = lp_set_cmdline(s, p);
8097 /**************************************************************************
8098 Print a parameter of the specified type.
8099 ***************************************************************************/
8101 static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
8107 for (i = 0; p->enum_list[i].name; i++) {
8108 if (*(int *)ptr == p->enum_list[i].value) {
8110 p->enum_list[i].name);
8117 fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
8121 fprintf(f, "%s", BOOLSTR(!*(bool *)ptr));
8125 fprintf(f, "%d", *(int *)ptr);
8129 fprintf(f, "%c", *(char *)ptr);
8133 char *o = octal_string(*(int *)ptr);
8134 fprintf(f, "%s", o);
8140 if ((char ***)ptr && *(char ***)ptr) {
8141 char **list = *(char ***)ptr;
8142 for (; *list; list++) {
8143 /* surround strings with whitespace in double quotes */
8144 if ( strchr_m( *list, ' ' ) )
8145 fprintf(f, "\"%s\"%s", *list, ((*(list+1))?", ":""));
8147 fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
8154 if (*(char **)ptr) {
8155 fprintf(f, "%s", *(char **)ptr);
8163 /***************************************************************************
8164 Check if two parameters are equal.
8165 ***************************************************************************/
8167 static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
8172 return (*((bool *)ptr1) == *((bool *)ptr2));
8177 return (*((int *)ptr1) == *((int *)ptr2));
8180 return (*((char *)ptr1) == *((char *)ptr2));
8183 return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2);
8188 char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
8193 return (p1 == p2 || strequal(p1, p2));
8201 /***************************************************************************
8202 Initialize any local varients in the sDefault table.
8203 ***************************************************************************/
8205 void init_locals(void)
8210 /***************************************************************************
8211 Process a new section (service). At this stage all sections are services.
8212 Later we'll have special sections that permit server parameters to be set.
8213 Returns True on success, False on failure.
8214 ***************************************************************************/
8216 static bool do_section(const char *pszSectionName, void *userdata)
8219 bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
8220 (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
8223 /* if we were in a global section then do the local inits */
8224 if (bInGlobalSection && !isglobal)
8227 /* if we've just struck a global section, note the fact. */
8228 bInGlobalSection = isglobal;
8230 /* check for multiple global sections */
8231 if (bInGlobalSection) {
8232 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
8236 if (!bInGlobalSection && bGlobalOnly)
8239 /* if we have a current service, tidy it up before moving on */
8242 if (iServiceIndex >= 0)
8243 bRetval = service_ok(iServiceIndex);
8245 /* if all is still well, move to the next record in the services array */
8247 /* We put this here to avoid an odd message order if messages are */
8248 /* issued by the post-processing of a previous section. */
8249 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName));
8251 if ((iServiceIndex = add_a_service(&sDefault, pszSectionName))
8253 DEBUG(0, ("Failed to add a new service\n"));
8256 /* Clean all parametric options for service */
8257 /* They will be added during parsing again */
8258 free_param_opts(&ServicePtrs[iServiceIndex]->param_opt);
8265 /***************************************************************************
8266 Determine if a partcular base parameter is currentl set to the default value.
8267 ***************************************************************************/
8269 static bool is_default(int i)
8271 if (!defaults_saved)
8273 switch (parm_table[i].type) {
8275 return str_list_equal((const char **)parm_table[i].def.lvalue,
8276 *(const char ***)parm_table[i].ptr);
8279 return strequal(parm_table[i].def.svalue,
8280 *(char **)parm_table[i].ptr);
8283 return parm_table[i].def.bvalue ==
8284 *(bool *)parm_table[i].ptr;
8286 return parm_table[i].def.cvalue ==
8287 *(char *)parm_table[i].ptr;
8291 return parm_table[i].def.ivalue ==
8292 *(int *)parm_table[i].ptr;
8299 /***************************************************************************
8300 Display the contents of the global structure.
8301 ***************************************************************************/
8303 static void dump_globals(FILE *f)
8306 struct param_opt_struct *data;
8308 fprintf(f, "[global]\n");
8310 for (i = 0; parm_table[i].label; i++)
8311 if (parm_table[i].p_class == P_GLOBAL &&
8312 !(parm_table[i].flags & FLAG_META) &&
8313 parm_table[i].ptr &&
8314 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
8315 if (defaults_saved && is_default(i))
8317 fprintf(f, "\t%s = ", parm_table[i].label);
8318 print_parameter(&parm_table[i], parm_table[i].ptr, f);
8321 if (Globals.param_opt != NULL) {
8322 data = Globals.param_opt;
8324 fprintf(f, "\t%s = %s\n", data->key, data->value);
8331 /***************************************************************************
8332 Return True if a local parameter is currently set to the global default.
8333 ***************************************************************************/
8335 bool lp_is_default(int snum, struct parm_struct *parm)
8337 int pdiff = PTR_DIFF(parm->ptr, &sDefault);
8339 return equal_parameter(parm->type,
8340 ((char *)ServicePtrs[snum]) + pdiff,
8341 ((char *)&sDefault) + pdiff);
8344 /***************************************************************************
8345 Display the contents of a single services record.
8346 ***************************************************************************/
8348 static void dump_a_service(struct service *pService, FILE * f)
8351 struct param_opt_struct *data;
8353 if (pService != &sDefault)
8354 fprintf(f, "[%s]\n", pService->szService);
8356 for (i = 0; parm_table[i].label; i++) {
8358 if (parm_table[i].p_class == P_LOCAL &&
8359 !(parm_table[i].flags & FLAG_META) &&
8360 parm_table[i].ptr &&
8361 (*parm_table[i].label != '-') &&
8362 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8364 int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault);
8366 if (pService == &sDefault) {
8367 if (defaults_saved && is_default(i))
8370 if (equal_parameter(parm_table[i].type,
8371 ((char *)pService) +
8373 ((char *)&sDefault) +
8378 fprintf(f, "\t%s = ", parm_table[i].label);
8379 print_parameter(&parm_table[i],
8380 ((char *)pService) + pdiff, f);
8385 if (pService->param_opt != NULL) {
8386 data = pService->param_opt;
8388 fprintf(f, "\t%s = %s\n", data->key, data->value);
8394 /***************************************************************************
8395 Display the contents of a parameter of a single services record.
8396 ***************************************************************************/
8398 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
8401 bool result = False;
8404 fstring local_parm_name;
8406 const char *parm_opt_value;
8408 /* check for parametrical option */
8409 fstrcpy( local_parm_name, parm_name);
8410 parm_opt = strchr( local_parm_name, ':');
8415 if (strlen(parm_opt)) {
8416 parm_opt_value = lp_parm_const_string( snum,
8417 local_parm_name, parm_opt, NULL);
8418 if (parm_opt_value) {
8419 printf( "%s\n", parm_opt_value);
8426 /* check for a key and print the value */
8433 for (i = 0; parm_table[i].label; i++) {
8434 if (strwicmp(parm_table[i].label, parm_name) == 0 &&
8435 !(parm_table[i].flags & FLAG_META) &&
8436 (parm_table[i].p_class == p_class || parm_table[i].flags & flag) &&
8437 parm_table[i].ptr &&
8438 (*parm_table[i].label != '-') &&
8439 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8444 ptr = parm_table[i].ptr;
8446 struct service *pService = ServicePtrs[snum];
8447 ptr = ((char *)pService) +
8448 PTR_DIFF(parm_table[i].ptr, &sDefault);
8451 print_parameter(&parm_table[i],
8462 /***************************************************************************
8463 Return info about the requested parameter (given as a string).
8464 Return NULL when the string is not a valid parameter name.
8465 ***************************************************************************/
8467 struct parm_struct *lp_get_parameter(const char *param_name)
8469 int num = map_parameter(param_name);
8475 return &parm_table[num];
8478 /***************************************************************************
8479 Return info about the next parameter in a service.
8480 snum==GLOBAL_SECTION_SNUM gives the globals.
8481 Return NULL when out of parameters.
8482 ***************************************************************************/
8484 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
8487 /* do the globals */
8488 for (; parm_table[*i].label; (*i)++) {
8489 if (parm_table[*i].p_class == P_SEPARATOR)
8490 return &parm_table[(*i)++];
8492 if (!parm_table[*i].ptr
8493 || (*parm_table[*i].label == '-'))
8497 && (parm_table[*i].ptr ==
8498 parm_table[(*i) - 1].ptr))
8501 if (is_default(*i) && !allparameters)
8504 return &parm_table[(*i)++];
8507 struct service *pService = ServicePtrs[snum];
8509 for (; parm_table[*i].label; (*i)++) {
8510 if (parm_table[*i].p_class == P_SEPARATOR)
8511 return &parm_table[(*i)++];
8513 if (parm_table[*i].p_class == P_LOCAL &&
8514 parm_table[*i].ptr &&
8515 (*parm_table[*i].label != '-') &&
8517 (parm_table[*i].ptr !=
8518 parm_table[(*i) - 1].ptr)))
8521 PTR_DIFF(parm_table[*i].ptr,
8524 if (allparameters ||
8525 !equal_parameter(parm_table[*i].type,
8526 ((char *)pService) +
8528 ((char *)&sDefault) +
8531 return &parm_table[(*i)++];
8542 /***************************************************************************
8543 Display the contents of a single copy structure.
8544 ***************************************************************************/
8545 static void dump_copy_map(bool *pcopymap)
8551 printf("\n\tNon-Copied parameters:\n");
8553 for (i = 0; parm_table[i].label; i++)
8554 if (parm_table[i].p_class == P_LOCAL &&
8555 parm_table[i].ptr && !pcopymap[i] &&
8556 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8558 printf("\t\t%s\n", parm_table[i].label);
8563 /***************************************************************************
8564 Return TRUE if the passed service number is within range.
8565 ***************************************************************************/
8567 bool lp_snum_ok(int iService)
8569 return (LP_SNUM_OK(iService) && ServicePtrs[iService]->bAvailable);
8572 /***************************************************************************
8573 Auto-load some home services.
8574 ***************************************************************************/
8576 static void lp_add_auto_services(char *str)
8586 s = SMB_STRDUP(str);
8590 homes = lp_servicenumber(HOMES_NAME);
8592 for (p = strtok_r(s, LIST_SEP, &saveptr); p;
8593 p = strtok_r(NULL, LIST_SEP, &saveptr)) {
8596 if (lp_servicenumber(p) >= 0)
8599 home = get_user_home_dir(talloc_tos(), p);
8601 if (home && home[0] && homes >= 0)
8602 lp_add_home(p, homes, p, home);
8609 /***************************************************************************
8610 Auto-load one printer.
8611 ***************************************************************************/
8613 void lp_add_one_printer(const char *name, const char *comment,
8614 const char *location, void *pdata)
8616 int printers = lp_servicenumber(PRINTERS_NAME);
8619 if (lp_servicenumber(name) < 0) {
8620 lp_add_printer(name, printers);
8621 if ((i = lp_servicenumber(name)) >= 0) {
8622 string_set(&ServicePtrs[i]->comment, comment);
8623 ServicePtrs[i]->autoloaded = True;
8628 /***************************************************************************
8629 Have we loaded a services file yet?
8630 ***************************************************************************/
8632 bool lp_loaded(void)
8637 /***************************************************************************
8638 Unload unused services.
8639 ***************************************************************************/
8641 void lp_killunused(bool (*snumused) (int))
8644 for (i = 0; i < iNumServices; i++) {
8648 /* don't kill autoloaded or usershare services */
8649 if ( ServicePtrs[i]->autoloaded ||
8650 ServicePtrs[i]->usershare == USERSHARE_VALID) {
8654 if (!snumused || !snumused(i)) {
8655 free_service_byindex(i);
8661 * Kill all except autoloaded and usershare services - convenience wrapper
8663 void lp_kill_all_services(void)
8665 lp_killunused(NULL);
8668 /***************************************************************************
8670 ***************************************************************************/
8672 void lp_killservice(int iServiceIn)
8674 if (VALID(iServiceIn)) {
8675 free_service_byindex(iServiceIn);
8679 /***************************************************************************
8680 Save the curent values of all global and sDefault parameters into the
8681 defaults union. This allows swat and testparm to show only the
8682 changed (ie. non-default) parameters.
8683 ***************************************************************************/
8685 static void lp_save_defaults(void)
8688 for (i = 0; parm_table[i].label; i++) {
8689 if (i > 0 && parm_table[i].ptr == parm_table[i - 1].ptr)
8691 switch (parm_table[i].type) {
8693 parm_table[i].def.lvalue = str_list_copy(
8694 NULL, *(const char ***)parm_table[i].ptr);
8698 if (parm_table[i].ptr) {
8699 parm_table[i].def.svalue = SMB_STRDUP(*(char **)parm_table[i].ptr);
8701 parm_table[i].def.svalue = NULL;
8706 parm_table[i].def.bvalue =
8707 *(bool *)parm_table[i].ptr;
8710 parm_table[i].def.cvalue =
8711 *(char *)parm_table[i].ptr;
8716 parm_table[i].def.ivalue =
8717 *(int *)parm_table[i].ptr;
8723 defaults_saved = True;
8726 /***********************************************************
8727 If we should send plaintext/LANMAN passwords in the clinet
8728 ************************************************************/
8730 static void set_allowed_client_auth(void)
8732 if (Globals.bClientNTLMv2Auth) {
8733 Globals.bClientLanManAuth = False;
8735 if (!Globals.bClientLanManAuth) {
8736 Globals.bClientPlaintextAuth = False;
8740 /***************************************************************************
8742 The following code allows smbd to read a user defined share file.
8743 Yes, this is my intent. Yes, I'm comfortable with that...
8745 THE FOLLOWING IS SECURITY CRITICAL CODE.
8747 It washes your clothes, it cleans your house, it guards you while you sleep...
8748 Do not f%^k with it....
8749 ***************************************************************************/
8751 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8753 /***************************************************************************
8754 Check allowed stat state of a usershare file.
8755 Ensure we print out who is dicking with us so the admin can
8756 get their sorry ass fired.
8757 ***************************************************************************/
8759 static bool check_usershare_stat(const char *fname,
8760 const SMB_STRUCT_STAT *psbuf)
8762 if (!S_ISREG(psbuf->st_ex_mode)) {
8763 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8764 "not a regular file\n",
8765 fname, (unsigned int)psbuf->st_ex_uid ));
8769 /* Ensure this doesn't have the other write bit set. */
8770 if (psbuf->st_ex_mode & S_IWOTH) {
8771 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8772 "public write. Refusing to allow as a usershare file.\n",
8773 fname, (unsigned int)psbuf->st_ex_uid ));
8777 /* Should be 10k or less. */
8778 if (psbuf->st_ex_size > MAX_USERSHARE_FILE_SIZE) {
8779 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8780 "too large (%u) to be a user share file.\n",
8781 fname, (unsigned int)psbuf->st_ex_uid,
8782 (unsigned int)psbuf->st_ex_size ));
8789 /***************************************************************************
8790 Parse the contents of a usershare file.
8791 ***************************************************************************/
8793 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
8794 SMB_STRUCT_STAT *psbuf,
8795 const char *servicename,
8799 char **pp_sharepath,
8801 char **pp_cp_servicename,
8802 struct security_descriptor **ppsd,
8805 const char **prefixallowlist = lp_usershare_prefix_allow_list();
8806 const char **prefixdenylist = lp_usershare_prefix_deny_list();
8809 SMB_STRUCT_STAT sbuf;
8810 char *sharepath = NULL;
8811 char *comment = NULL;
8813 *pp_sharepath = NULL;
8816 *pallow_guest = False;
8819 return USERSHARE_MALFORMED_FILE;
8822 if (strcmp(lines[0], "#VERSION 1") == 0) {
8824 } else if (strcmp(lines[0], "#VERSION 2") == 0) {
8827 return USERSHARE_MALFORMED_FILE;
8830 return USERSHARE_BAD_VERSION;
8833 if (strncmp(lines[1], "path=", 5) != 0) {
8834 return USERSHARE_MALFORMED_PATH;
8837 sharepath = talloc_strdup(ctx, &lines[1][5]);
8839 return USERSHARE_POSIX_ERR;
8841 trim_string(sharepath, " ", " ");
8843 if (strncmp(lines[2], "comment=", 8) != 0) {
8844 return USERSHARE_MALFORMED_COMMENT_DEF;
8847 comment = talloc_strdup(ctx, &lines[2][8]);
8849 return USERSHARE_POSIX_ERR;
8851 trim_string(comment, " ", " ");
8852 trim_char(comment, '"', '"');
8854 if (strncmp(lines[3], "usershare_acl=", 14) != 0) {
8855 return USERSHARE_MALFORMED_ACL_DEF;
8858 if (!parse_usershare_acl(ctx, &lines[3][14], ppsd)) {
8859 return USERSHARE_ACL_ERR;
8863 if (strncmp(lines[4], "guest_ok=", 9) != 0) {
8864 return USERSHARE_MALFORMED_ACL_DEF;
8866 if (lines[4][9] == 'y') {
8867 *pallow_guest = True;
8870 /* Backwards compatible extension to file version #2. */
8872 if (strncmp(lines[5], "sharename=", 10) != 0) {
8873 return USERSHARE_MALFORMED_SHARENAME_DEF;
8875 if (!strequal(&lines[5][10], servicename)) {
8876 return USERSHARE_BAD_SHARENAME;
8878 *pp_cp_servicename = talloc_strdup(ctx, &lines[5][10]);
8879 if (!*pp_cp_servicename) {
8880 return USERSHARE_POSIX_ERR;
8885 if (*pp_cp_servicename == NULL) {
8886 *pp_cp_servicename = talloc_strdup(ctx, servicename);
8887 if (!*pp_cp_servicename) {
8888 return USERSHARE_POSIX_ERR;
8892 if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->szPath) == 0)) {
8893 /* Path didn't change, no checks needed. */
8894 *pp_sharepath = sharepath;
8895 *pp_comment = comment;
8896 return USERSHARE_OK;
8899 /* The path *must* be absolute. */
8900 if (sharepath[0] != '/') {
8901 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8902 servicename, sharepath));
8903 return USERSHARE_PATH_NOT_ABSOLUTE;
8906 /* If there is a usershare prefix deny list ensure one of these paths
8907 doesn't match the start of the user given path. */
8908 if (prefixdenylist) {
8910 for ( i=0; prefixdenylist[i]; i++ ) {
8911 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8912 servicename, i, prefixdenylist[i], sharepath ));
8913 if (memcmp( sharepath, prefixdenylist[i], strlen(prefixdenylist[i])) == 0) {
8914 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8915 "usershare prefix deny list entries.\n",
8916 servicename, sharepath));
8917 return USERSHARE_PATH_IS_DENIED;
8922 /* If there is a usershare prefix allow list ensure one of these paths
8923 does match the start of the user given path. */
8925 if (prefixallowlist) {
8927 for ( i=0; prefixallowlist[i]; i++ ) {
8928 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8929 servicename, i, prefixallowlist[i], sharepath ));
8930 if (memcmp( sharepath, prefixallowlist[i], strlen(prefixallowlist[i])) == 0) {
8934 if (prefixallowlist[i] == NULL) {
8935 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8936 "usershare prefix allow list entries.\n",
8937 servicename, sharepath));
8938 return USERSHARE_PATH_NOT_ALLOWED;
8942 /* Ensure this is pointing to a directory. */
8943 dp = sys_opendir(sharepath);
8946 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8947 servicename, sharepath));
8948 return USERSHARE_PATH_NOT_DIRECTORY;
8951 /* Ensure the owner of the usershare file has permission to share
8954 if (sys_stat(sharepath, &sbuf, false) == -1) {
8955 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8956 servicename, sharepath, strerror(errno) ));
8958 return USERSHARE_POSIX_ERR;
8963 if (!S_ISDIR(sbuf.st_ex_mode)) {
8964 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8965 servicename, sharepath ));
8966 return USERSHARE_PATH_NOT_DIRECTORY;
8969 /* Check if sharing is restricted to owner-only. */
8970 /* psbuf is the stat of the usershare definition file,
8971 sbuf is the stat of the target directory to be shared. */
8973 if (lp_usershare_owner_only()) {
8974 /* root can share anything. */
8975 if ((psbuf->st_ex_uid != 0) && (sbuf.st_ex_uid != psbuf->st_ex_uid)) {
8976 return USERSHARE_PATH_NOT_ALLOWED;
8980 *pp_sharepath = sharepath;
8981 *pp_comment = comment;
8982 return USERSHARE_OK;
8985 /***************************************************************************
8986 Deal with a usershare file.
8989 -1 - Bad name, invalid contents.
8990 - service name already existed and not a usershare, problem
8991 with permissions to share directory etc.
8992 ***************************************************************************/
8994 static int process_usershare_file(const char *dir_name, const char *file_name, int snum_template)
8996 SMB_STRUCT_STAT sbuf;
8997 SMB_STRUCT_STAT lsbuf;
8999 char *sharepath = NULL;
9000 char *comment = NULL;
9001 char *cp_service_name = NULL;
9002 char **lines = NULL;
9006 TALLOC_CTX *ctx = talloc_stackframe();
9007 struct security_descriptor *psd = NULL;
9008 bool guest_ok = False;
9009 char *canon_name = NULL;
9010 bool added_service = false;
9013 /* Ensure share name doesn't contain invalid characters. */
9014 if (!validate_net_name(file_name, INVALID_SHARENAME_CHARS, strlen(file_name))) {
9015 DEBUG(0,("process_usershare_file: share name %s contains "
9016 "invalid characters (any of %s)\n",
9017 file_name, INVALID_SHARENAME_CHARS ));
9021 canon_name = canonicalize_servicename(ctx, file_name);
9026 fname = talloc_asprintf(ctx, "%s/%s", dir_name, file_name);
9031 /* Minimize the race condition by doing an lstat before we
9032 open and fstat. Ensure this isn't a symlink link. */
9034 if (sys_lstat(fname, &lsbuf, false) != 0) {
9035 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
9036 fname, strerror(errno) ));
9040 /* This must be a regular file, not a symlink, directory or
9041 other strange filetype. */
9042 if (!check_usershare_stat(fname, &lsbuf)) {
9047 TDB_DATA data = dbwrap_fetch_bystring(
9048 ServiceHash, canon_name, canon_name);
9052 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
9053 iService = *(int *)data.dptr;
9057 if (iService != -1 &&
9058 timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
9059 &lsbuf.st_ex_mtime) == 0) {
9060 /* Nothing changed - Mark valid and return. */
9061 DEBUG(10,("process_usershare_file: service %s not changed.\n",
9063 ServicePtrs[iService]->usershare = USERSHARE_VALID;
9068 /* Try and open the file read only - no symlinks allowed. */
9070 fd = sys_open(fname, O_RDONLY|O_NOFOLLOW, 0);
9072 fd = sys_open(fname, O_RDONLY, 0);
9076 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
9077 fname, strerror(errno) ));
9081 /* Now fstat to be *SURE* it's a regular file. */
9082 if (sys_fstat(fd, &sbuf, false) != 0) {
9084 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
9085 fname, strerror(errno) ));
9089 /* Is it the same dev/inode as was lstated ? */
9090 if (lsbuf.st_ex_dev != sbuf.st_ex_dev || lsbuf.st_ex_ino != sbuf.st_ex_ino) {
9092 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
9093 "Symlink spoofing going on ?\n", fname ));
9097 /* This must be a regular file, not a symlink, directory or
9098 other strange filetype. */
9099 if (!check_usershare_stat(fname, &sbuf)) {
9103 lines = fd_lines_load(fd, &numlines, MAX_USERSHARE_FILE_SIZE, NULL);
9106 if (lines == NULL) {
9107 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
9108 fname, (unsigned int)sbuf.st_ex_uid ));
9112 if (parse_usershare_file(ctx, &sbuf, file_name,
9113 iService, lines, numlines, &sharepath,
9114 &comment, &cp_service_name,
9115 &psd, &guest_ok) != USERSHARE_OK) {
9119 /* Everything ok - add the service possibly using a template. */
9121 const struct service *sp = &sDefault;
9122 if (snum_template != -1) {
9123 sp = ServicePtrs[snum_template];
9126 if ((iService = add_a_service(sp, cp_service_name)) < 0) {
9127 DEBUG(0, ("process_usershare_file: Failed to add "
9128 "new service %s\n", cp_service_name));
9132 added_service = true;
9134 /* Read only is controlled by usershare ACL below. */
9135 ServicePtrs[iService]->bRead_only = False;
9138 /* Write the ACL of the new/modified share. */
9139 if (!set_share_security(canon_name, psd)) {
9140 DEBUG(0, ("process_usershare_file: Failed to set share "
9141 "security for user share %s\n",
9146 /* If from a template it may be marked invalid. */
9147 ServicePtrs[iService]->valid = True;
9149 /* Set the service as a valid usershare. */
9150 ServicePtrs[iService]->usershare = USERSHARE_VALID;
9152 /* Set guest access. */
9153 if (lp_usershare_allow_guests()) {
9154 ServicePtrs[iService]->bGuest_ok = guest_ok;
9157 /* And note when it was loaded. */
9158 ServicePtrs[iService]->usershare_last_mod = sbuf.st_ex_mtime;
9159 string_set(&ServicePtrs[iService]->szPath, sharepath);
9160 string_set(&ServicePtrs[iService]->comment, comment);
9166 if (ret == -1 && iService != -1 && added_service) {
9167 lp_remove_service(iService);
9175 /***************************************************************************
9176 Checks if a usershare entry has been modified since last load.
9177 ***************************************************************************/
9179 static bool usershare_exists(int iService, struct timespec *last_mod)
9181 SMB_STRUCT_STAT lsbuf;
9182 const char *usersharepath = Globals.szUsersharePath;
9185 if (asprintf(&fname, "%s/%s",
9187 ServicePtrs[iService]->szService) < 0) {
9191 if (sys_lstat(fname, &lsbuf, false) != 0) {
9196 if (!S_ISREG(lsbuf.st_ex_mode)) {
9202 *last_mod = lsbuf.st_ex_mtime;
9206 /***************************************************************************
9207 Load a usershare service by name. Returns a valid servicenumber or -1.
9208 ***************************************************************************/
9210 int load_usershare_service(const char *servicename)
9212 SMB_STRUCT_STAT sbuf;
9213 const char *usersharepath = Globals.szUsersharePath;
9214 int max_user_shares = Globals.iUsershareMaxShares;
9215 int snum_template = -1;
9217 if (*usersharepath == 0 || max_user_shares == 0) {
9221 if (sys_stat(usersharepath, &sbuf, false) != 0) {
9222 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
9223 usersharepath, strerror(errno) ));
9227 if (!S_ISDIR(sbuf.st_ex_mode)) {
9228 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
9234 * This directory must be owned by root, and have the 't' bit set.
9235 * It also must not be writable by "other".
9239 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
9241 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
9243 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
9244 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9249 /* Ensure the template share exists if it's set. */
9250 if (Globals.szUsershareTemplateShare[0]) {
9251 /* We can't use lp_servicenumber here as we are recommending that
9252 template shares have -valid=False set. */
9253 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
9254 if (ServicePtrs[snum_template]->szService &&
9255 strequal(ServicePtrs[snum_template]->szService,
9256 Globals.szUsershareTemplateShare)) {
9261 if (snum_template == -1) {
9262 DEBUG(0,("load_usershare_service: usershare template share %s "
9263 "does not exist.\n",
9264 Globals.szUsershareTemplateShare ));
9269 return process_usershare_file(usersharepath, servicename, snum_template);
9272 /***************************************************************************
9273 Load all user defined shares from the user share directory.
9274 We only do this if we're enumerating the share list.
9275 This is the function that can delete usershares that have
9277 ***************************************************************************/
9279 int load_usershare_shares(void)
9282 SMB_STRUCT_STAT sbuf;
9283 SMB_STRUCT_DIRENT *de;
9284 int num_usershares = 0;
9285 int max_user_shares = Globals.iUsershareMaxShares;
9286 unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries;
9287 unsigned int allowed_bad_entries = ((2*max_user_shares)/10);
9288 unsigned int allowed_tmp_entries = ((2*max_user_shares)/10);
9290 int snum_template = -1;
9291 const char *usersharepath = Globals.szUsersharePath;
9292 int ret = lp_numservices();
9294 if (max_user_shares == 0 || *usersharepath == '\0') {
9295 return lp_numservices();
9298 if (sys_stat(usersharepath, &sbuf, false) != 0) {
9299 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
9300 usersharepath, strerror(errno) ));
9305 * This directory must be owned by root, and have the 't' bit set.
9306 * It also must not be writable by "other".
9310 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
9312 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
9314 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
9315 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9320 /* Ensure the template share exists if it's set. */
9321 if (Globals.szUsershareTemplateShare[0]) {
9322 /* We can't use lp_servicenumber here as we are recommending that
9323 template shares have -valid=False set. */
9324 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
9325 if (ServicePtrs[snum_template]->szService &&
9326 strequal(ServicePtrs[snum_template]->szService,
9327 Globals.szUsershareTemplateShare)) {
9332 if (snum_template == -1) {
9333 DEBUG(0,("load_usershare_shares: usershare template share %s "
9334 "does not exist.\n",
9335 Globals.szUsershareTemplateShare ));
9340 /* Mark all existing usershares as pending delete. */
9341 for (iService = iNumServices - 1; iService >= 0; iService--) {
9342 if (VALID(iService) && ServicePtrs[iService]->usershare) {
9343 ServicePtrs[iService]->usershare = USERSHARE_PENDING_DELETE;
9347 dp = sys_opendir(usersharepath);
9349 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
9350 usersharepath, strerror(errno) ));
9354 for (num_dir_entries = 0, num_bad_dir_entries = 0, num_tmp_dir_entries = 0;
9355 (de = sys_readdir(dp));
9356 num_dir_entries++ ) {
9358 const char *n = de->d_name;
9360 /* Ignore . and .. */
9362 if ((n[1] == '\0') || (n[1] == '.' && n[2] == '\0')) {
9368 /* Temporary file used when creating a share. */
9369 num_tmp_dir_entries++;
9372 /* Allow 20% tmp entries. */
9373 if (num_tmp_dir_entries > allowed_tmp_entries) {
9374 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
9375 "in directory %s\n",
9376 num_tmp_dir_entries, usersharepath));
9380 r = process_usershare_file(usersharepath, n, snum_template);
9382 /* Update the services count. */
9384 if (num_usershares >= max_user_shares) {
9385 DEBUG(0,("load_usershare_shares: max user shares reached "
9386 "on file %s in directory %s\n",
9387 n, usersharepath ));
9390 } else if (r == -1) {
9391 num_bad_dir_entries++;
9394 /* Allow 20% bad entries. */
9395 if (num_bad_dir_entries > allowed_bad_entries) {
9396 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
9397 "in directory %s\n",
9398 num_bad_dir_entries, usersharepath));
9402 /* Allow 20% bad entries. */
9403 if (num_dir_entries > max_user_shares + allowed_bad_entries) {
9404 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
9405 "in directory %s\n",
9406 num_dir_entries, usersharepath));
9413 /* Sweep through and delete any non-refreshed usershares that are
9414 not currently in use. */
9415 for (iService = iNumServices - 1; iService >= 0; iService--) {
9416 if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
9417 if (conn_snum_used(iService)) {
9420 /* Remove from the share ACL db. */
9421 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
9422 lp_servicename(iService) ));
9423 delete_share_security(lp_servicename(iService));
9424 free_service_byindex(iService);
9428 return lp_numservices();
9431 /********************************************************
9432 Destroy global resources allocated in this file
9433 ********************************************************/
9435 void gfree_loadparm(void)
9441 /* Free resources allocated to services */
9443 for ( i = 0; i < iNumServices; i++ ) {
9445 free_service_byindex(i);
9449 SAFE_FREE( ServicePtrs );
9452 /* Now release all resources allocated to global
9453 parameters and the default service */
9455 free_global_parameters();
9459 /***************************************************************************
9460 Allow client apps to specify that they are a client
9461 ***************************************************************************/
9462 void lp_set_in_client(bool b)
9468 /***************************************************************************
9469 Determine if we're running in a client app
9470 ***************************************************************************/
9471 bool lp_is_in_client(void)
9476 /***************************************************************************
9477 Load the services array from the services file. Return True on success,
9479 ***************************************************************************/
9481 static bool lp_load_ex(const char *pszFname,
9485 bool initialize_globals,
9486 bool allow_include_registry,
9487 bool allow_registry_shares)
9494 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9496 bInGlobalSection = True;
9497 bGlobalOnly = global_only;
9498 bAllowIncludeRegistry = allow_include_registry;
9500 init_globals(initialize_globals);
9504 if (save_defaults) {
9509 free_param_opts(&Globals.param_opt);
9511 lp_do_parameter(-1, "idmap config * : backend", Globals.szIdmapBackend);
9513 /* We get sections first, so have to start 'behind' to make up */
9516 if (lp_config_backend_is_file()) {
9517 n2 = talloc_sub_basic(talloc_tos(), get_current_username(),
9518 current_user_info.domain,
9521 smb_panic("lp_load_ex: out of memory");
9524 add_to_file_list(pszFname, n2);
9526 bRetval = pm_process(n2, do_section, do_parameter, NULL);
9529 /* finish up the last section */
9530 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
9532 if (iServiceIndex >= 0) {
9533 bRetval = service_ok(iServiceIndex);
9537 if (lp_config_backend_is_registry()) {
9538 /* config backend changed to registry in config file */
9540 * We need to use this extra global variable here to
9541 * survive restart: init_globals uses this as a default
9542 * for ConfigBackend. Otherwise, init_globals would
9543 * send us into an endless loop here.
9545 config_backend = CONFIG_BACKEND_REGISTRY;
9547 DEBUG(1, ("lp_load_ex: changing to config backend "
9550 lp_kill_all_services();
9551 return lp_load_ex(pszFname, global_only, save_defaults,
9552 add_ipc, initialize_globals,
9553 allow_include_registry,
9554 allow_registry_shares);
9556 } else if (lp_config_backend_is_registry()) {
9557 bRetval = process_registry_globals();
9559 DEBUG(0, ("Illegal config backend given: %d\n",
9560 lp_config_backend()));
9564 if (bRetval && lp_registry_shares() && allow_registry_shares) {
9565 bRetval = process_registry_shares();
9568 lp_add_auto_services(lp_auto_services());
9571 /* When 'restrict anonymous = 2' guest connections to ipc$
9573 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9574 if ( lp_enable_asu_support() ) {
9575 lp_add_ipc("ADMIN$", false);
9580 set_default_server_announce_type();
9581 set_allowed_client_auth();
9583 if (lp_security() == SEC_SHARE) {
9584 DEBUG(1, ("WARNING: The security=share option is deprecated\n"));
9585 } else if (lp_security() == SEC_SERVER) {
9586 DEBUG(1, ("WARNING: The security=server option is deprecated\n"));
9591 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9592 /* if bWINSsupport is true and we are in the client */
9593 if (lp_is_in_client() && Globals.bWINSsupport) {
9594 lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
9599 fault_configure(smb_panic_s3);
9601 bAllowIncludeRegistry = true;
9606 bool lp_load(const char *pszFname,
9610 bool initialize_globals)
9612 return lp_load_ex(pszFname,
9617 true, /* allow_include_registry */
9618 false); /* allow_registry_shares*/
9621 bool lp_load_initial_only(const char *pszFname)
9623 return lp_load_ex(pszFname,
9624 true, /* global only */
9625 false, /* save_defaults */
9626 false, /* add_ipc */
9627 true, /* initialize_globals */
9628 false, /* allow_include_registry */
9629 false); /* allow_registry_shares*/
9632 bool lp_load_with_registry_shares(const char *pszFname,
9636 bool initialize_globals)
9638 return lp_load_ex(pszFname,
9643 true, /* allow_include_registry */
9644 true); /* allow_registry_shares*/
9647 /***************************************************************************
9648 Return the max number of services.
9649 ***************************************************************************/
9651 int lp_numservices(void)
9653 return (iNumServices);
9656 /***************************************************************************
9657 Display the contents of the services array in human-readable form.
9658 ***************************************************************************/
9660 void lp_dump(FILE *f, bool show_defaults, int maxtoprint)
9665 defaults_saved = False;
9669 dump_a_service(&sDefault, f);
9671 for (iService = 0; iService < maxtoprint; iService++) {
9673 lp_dump_one(f, show_defaults, iService);
9677 /***************************************************************************
9678 Display the contents of one service in human-readable form.
9679 ***************************************************************************/
9681 void lp_dump_one(FILE * f, bool show_defaults, int snum)
9684 if (ServicePtrs[snum]->szService[0] == '\0')
9686 dump_a_service(ServicePtrs[snum], f);
9690 /***************************************************************************
9691 Return the number of the service with the given name, or -1 if it doesn't
9692 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9693 getservicebyname()! This works ONLY if all services have been loaded, and
9694 does not copy the found service.
9695 ***************************************************************************/
9697 int lp_servicenumber(const char *pszServiceName)
9700 fstring serviceName;
9702 if (!pszServiceName) {
9703 return GLOBAL_SECTION_SNUM;
9706 for (iService = iNumServices - 1; iService >= 0; iService--) {
9707 if (VALID(iService) && ServicePtrs[iService]->szService) {
9709 * The substitution here is used to support %U is
9712 fstrcpy(serviceName, ServicePtrs[iService]->szService);
9713 standard_sub_basic(get_current_username(),
9714 current_user_info.domain,
9715 serviceName,sizeof(serviceName));
9716 if (strequal(serviceName, pszServiceName)) {
9722 if (iService >= 0 && ServicePtrs[iService]->usershare == USERSHARE_VALID) {
9723 struct timespec last_mod;
9725 if (!usershare_exists(iService, &last_mod)) {
9726 /* Remove the share security tdb entry for it. */
9727 delete_share_security(lp_servicename(iService));
9728 /* Remove it from the array. */
9729 free_service_byindex(iService);
9730 /* Doesn't exist anymore. */
9731 return GLOBAL_SECTION_SNUM;
9734 /* Has it been modified ? If so delete and reload. */
9735 if (timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
9737 /* Remove it from the array. */
9738 free_service_byindex(iService);
9739 /* and now reload it. */
9740 iService = load_usershare_service(pszServiceName);
9745 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
9746 return GLOBAL_SECTION_SNUM;
9752 bool share_defined(const char *service_name)
9754 return (lp_servicenumber(service_name) != -1);
9757 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
9758 const char *sharename)
9760 struct share_params *result;
9764 snum = find_service(mem_ctx, sharename, &sname);
9765 if (snum < 0 || sname == NULL) {
9769 if (!(result = TALLOC_P(mem_ctx, struct share_params))) {
9770 DEBUG(0, ("talloc failed\n"));
9774 result->service = snum;
9778 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx)
9780 struct share_iterator *result;
9782 if (!(result = TALLOC_P(mem_ctx, struct share_iterator))) {
9783 DEBUG(0, ("talloc failed\n"));
9787 result->next_id = 0;
9791 struct share_params *next_share(struct share_iterator *list)
9793 struct share_params *result;
9795 while (!lp_snum_ok(list->next_id) &&
9796 (list->next_id < lp_numservices())) {
9800 if (list->next_id >= lp_numservices()) {
9804 if (!(result = TALLOC_P(list, struct share_params))) {
9805 DEBUG(0, ("talloc failed\n"));
9809 result->service = list->next_id;
9814 struct share_params *next_printer(struct share_iterator *list)
9816 struct share_params *result;
9818 while ((result = next_share(list)) != NULL) {
9819 if (lp_print_ok(result->service)) {
9827 * This is a hack for a transition period until we transformed all code from
9828 * service numbers to struct share_params.
9831 struct share_params *snum2params_static(int snum)
9833 static struct share_params result;
9834 result.service = snum;
9838 /*******************************************************************
9839 A useful volume label function.
9840 ********************************************************************/
9842 const char *volume_label(int snum)
9845 const char *label = lp_volume(snum);
9847 label = lp_servicename(snum);
9850 /* This returns a 33 byte guarenteed null terminated string. */
9851 ret = talloc_strndup(talloc_tos(), label, 32);
9858 /*******************************************************************
9859 Set the server type we will announce as via nmbd.
9860 ********************************************************************/
9862 static void set_default_server_announce_type(void)
9864 default_server_announce = 0;
9865 default_server_announce |= SV_TYPE_WORKSTATION;
9866 default_server_announce |= SV_TYPE_SERVER;
9867 default_server_announce |= SV_TYPE_SERVER_UNIX;
9869 /* note that the flag should be set only if we have a
9870 printer service but nmbd doesn't actually load the
9871 services so we can't tell --jerry */
9873 default_server_announce |= SV_TYPE_PRINTQ_SERVER;
9875 switch (lp_announce_as()) {
9876 case ANNOUNCE_AS_NT_SERVER:
9877 default_server_announce |= SV_TYPE_SERVER_NT;
9878 /* fall through... */
9879 case ANNOUNCE_AS_NT_WORKSTATION:
9880 default_server_announce |= SV_TYPE_NT;
9882 case ANNOUNCE_AS_WIN95:
9883 default_server_announce |= SV_TYPE_WIN95_PLUS;
9885 case ANNOUNCE_AS_WFW:
9886 default_server_announce |= SV_TYPE_WFW;
9892 switch (lp_server_role()) {
9893 case ROLE_DOMAIN_MEMBER:
9894 default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
9896 case ROLE_DOMAIN_PDC:
9897 default_server_announce |= SV_TYPE_DOMAIN_CTRL;
9899 case ROLE_DOMAIN_BDC:
9900 default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL;
9902 case ROLE_STANDALONE:
9906 if (lp_time_server())
9907 default_server_announce |= SV_TYPE_TIME_SOURCE;
9909 if (lp_host_msdfs())
9910 default_server_announce |= SV_TYPE_DFS_SERVER;
9913 /***********************************************************
9914 If we are PDC then prefer us as DMB
9915 ************************************************************/
9917 bool lp_domain_master(void)
9919 if (Globals.iDomainMaster == Auto)
9920 return (lp_server_role() == ROLE_DOMAIN_PDC);
9922 return (bool)Globals.iDomainMaster;
9925 /***********************************************************
9926 If we are PDC then prefer us as DMB
9927 ************************************************************/
9929 bool lp_domain_master_true_or_auto(void)
9931 if (Globals.iDomainMaster) /* auto or yes */
9937 /***********************************************************
9938 If we are DMB then prefer us as LMB
9939 ************************************************************/
9941 bool lp_preferred_master(void)
9943 if (Globals.iPreferredMaster == Auto)
9944 return (lp_local_master() && lp_domain_master());
9946 return (bool)Globals.iPreferredMaster;
9949 /*******************************************************************
9951 ********************************************************************/
9953 void lp_remove_service(int snum)
9955 ServicePtrs[snum]->valid = False;
9956 invalid_services[num_invalid_services++] = snum;
9959 /*******************************************************************
9961 ********************************************************************/
9963 void lp_copy_service(int snum, const char *new_name)
9965 do_section(new_name, NULL);
9967 snum = lp_servicenumber(new_name);
9969 lp_do_parameter(snum, "copy", lp_servicename(snum));
9974 /*******************************************************************
9975 Get the default server type we will announce as via nmbd.
9976 ********************************************************************/
9978 int lp_default_server_announce(void)
9980 return default_server_announce;
9983 /*******************************************************************
9984 Split the announce version into major and minor numbers.
9985 ********************************************************************/
9987 int lp_major_announce_version(void)
9989 static bool got_major = False;
9990 static int major_version = DEFAULT_MAJOR_VERSION;
9995 return major_version;
9998 if ((vers = lp_announce_version()) == NULL)
9999 return major_version;
10001 if ((p = strchr_m(vers, '.')) == 0)
10002 return major_version;
10005 major_version = atoi(vers);
10006 return major_version;
10009 int lp_minor_announce_version(void)
10011 static bool got_minor = False;
10012 static int minor_version = DEFAULT_MINOR_VERSION;
10017 return minor_version;
10020 if ((vers = lp_announce_version()) == NULL)
10021 return minor_version;
10023 if ((p = strchr_m(vers, '.')) == 0)
10024 return minor_version;
10027 minor_version = atoi(p);
10028 return minor_version;
10031 /***********************************************************
10032 Set the global name resolution order (used in smbclient).
10033 ************************************************************/
10035 void lp_set_name_resolve_order(const char *new_order)
10037 string_set(&Globals.szNameResolveOrder, new_order);
10040 const char *lp_printername(int snum)
10042 const char *ret = _lp_printername(snum);
10043 if (ret == NULL || (ret != NULL && *ret == '\0'))
10044 ret = lp_const_servicename(snum);
10050 /***********************************************************
10051 Allow daemons such as winbindd to fix their logfile name.
10052 ************************************************************/
10054 void lp_set_logfile(const char *name)
10056 string_set(&Globals.szLogFile, name);
10057 debug_set_logfile(name);
10060 /*******************************************************************
10061 Return the max print jobs per queue.
10062 ********************************************************************/
10064 int lp_maxprintjobs(int snum)
10066 int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
10067 if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
10068 maxjobs = PRINT_MAX_JOBID - 1;
10073 const char *lp_printcapname(void)
10075 if ((Globals.szPrintcapname != NULL) &&
10076 (Globals.szPrintcapname[0] != '\0'))
10077 return Globals.szPrintcapname;
10079 if (sDefault.iPrinting == PRINT_CUPS) {
10087 if (sDefault.iPrinting == PRINT_BSD)
10088 return "/etc/printcap";
10090 return PRINTCAP_NAME;
10093 static uint32 spoolss_state;
10095 bool lp_disable_spoolss( void )
10097 if ( spoolss_state == SVCCTL_STATE_UNKNOWN )
10098 spoolss_state = _lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
10100 return spoolss_state == SVCCTL_STOPPED ? True : False;
10103 void lp_set_spoolss_state( uint32 state )
10105 SMB_ASSERT( (state == SVCCTL_STOPPED) || (state == SVCCTL_RUNNING) );
10107 spoolss_state = state;
10110 uint32 lp_get_spoolss_state( void )
10112 return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
10115 /*******************************************************************
10116 Ensure we don't use sendfile if server smb signing is active.
10117 ********************************************************************/
10119 bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state)
10121 bool sign_active = false;
10123 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
10124 if (get_Protocol() < PROTOCOL_NT1) {
10127 if (signing_state) {
10128 sign_active = smb_signing_is_active(signing_state);
10130 return (_lp_use_sendfile(snum) &&
10131 (get_remote_arch() != RA_WIN95) &&
10135 /*******************************************************************
10136 Turn off sendfile if we find the underlying OS doesn't support it.
10137 ********************************************************************/
10139 void set_use_sendfile(int snum, bool val)
10141 if (LP_SNUM_OK(snum))
10142 ServicePtrs[snum]->bUseSendfile = val;
10144 sDefault.bUseSendfile = val;
10147 /*******************************************************************
10148 Turn off storing DOS attributes if this share doesn't support it.
10149 ********************************************************************/
10151 void set_store_dos_attributes(int snum, bool val)
10153 if (!LP_SNUM_OK(snum))
10155 ServicePtrs[(snum)]->bStoreDosAttributes = val;
10158 void lp_set_mangling_method(const char *new_method)
10160 string_set(&Globals.szManglingMethod, new_method);
10163 /*******************************************************************
10164 Global state for POSIX pathname processing.
10165 ********************************************************************/
10167 static bool posix_pathnames;
10169 bool lp_posix_pathnames(void)
10171 return posix_pathnames;
10174 /*******************************************************************
10175 Change everything needed to ensure POSIX pathname processing (currently
10177 ********************************************************************/
10179 void lp_set_posix_pathnames(void)
10181 posix_pathnames = True;
10184 /*******************************************************************
10185 Global state for POSIX lock processing - CIFS unix extensions.
10186 ********************************************************************/
10188 bool posix_default_lock_was_set;
10189 static enum brl_flavour posix_cifsx_locktype; /* By default 0 == WINDOWS_LOCK */
10191 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp)
10193 if (posix_default_lock_was_set) {
10194 return posix_cifsx_locktype;
10196 return fsp->posix_open ? POSIX_LOCK : WINDOWS_LOCK;
10200 /*******************************************************************
10201 ********************************************************************/
10203 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val)
10205 posix_default_lock_was_set = True;
10206 posix_cifsx_locktype = val;
10209 int lp_min_receive_file_size(void)
10211 if (Globals.iminreceivefile < 0) {
10214 return MIN(Globals.iminreceivefile, BUFFER_SIZE);
10217 /*******************************************************************
10218 If socket address is an empty character string, it is necessary to
10219 define it as "0.0.0.0".
10220 ********************************************************************/
10222 const char *lp_socket_address(void)
10224 char *sock_addr = Globals.szSocketAddress;
10226 if (sock_addr[0] == '\0'){
10227 string_set(&Globals.szSocketAddress, "0.0.0.0");
10229 return Globals.szSocketAddress;
10232 void lp_set_passdb_backend(const char *backend)
10234 string_set(&Globals.szPassdbBackend, backend);
10237 /*******************************************************************
10238 Safe wide links checks.
10239 This helper function always verify the validity of wide links,
10240 even after a configuration file reload.
10241 ********************************************************************/
10243 static bool lp_widelinks_internal(int snum)
10245 return (bool)(LP_SNUM_OK(snum)? ServicePtrs[(snum)]->bWidelinks :
10246 sDefault.bWidelinks);
10249 void widelinks_warning(int snum)
10251 if (lp_unix_extensions() && lp_widelinks_internal(snum)) {
10252 DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
10253 "These parameters are incompatible. "
10254 "Wide links will be disabled for this share.\n",
10255 lp_servicename(snum) ));
10259 bool lp_widelinks(int snum)
10261 /* wide links is always incompatible with unix extensions */
10262 if (lp_unix_extensions()) {
10266 return lp_widelinks_internal(snum);
10269 bool lp_writeraw(void)
10271 if (lp_async_smb_echo_handler()) {
10274 return _lp_writeraw();
10277 bool lp_readraw(void)
10279 if (lp_async_smb_echo_handler()) {
10282 return _lp_readraw();