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
57 #ifdef HAVE_SYS_SYSCTL_H
58 #include <sys/sysctl.h>
61 #ifdef HAVE_HTTPCONNECTENCRYPT
62 #include <cups/http.h>
67 extern userdom_struct current_user_info
;
70 #define GLOBAL_NAME "global"
74 #define PRINTERS_NAME "printers"
78 #define HOMES_NAME "homes"
81 /* the special value for the include parameter
82 * to be interpreted not as a file name but to
83 * trigger loading of the global smb.conf options
85 #ifndef INCLUDE_REGISTRY_NAME
86 #define INCLUDE_REGISTRY_NAME "registry"
89 static bool in_client
= False
; /* Not in the client by default */
90 static struct smbconf_csn conf_last_csn
;
92 #define CONFIG_BACKEND_FILE 0
93 #define CONFIG_BACKEND_REGISTRY 1
95 static int config_backend
= CONFIG_BACKEND_FILE
;
97 /* some helpful bits */
98 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
99 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
101 #define USERSHARE_VALID 1
102 #define USERSHARE_PENDING_DELETE 2
104 static bool defaults_saved
= False
;
106 struct param_opt_struct
{
107 struct param_opt_struct
*prev
, *next
;
114 * This structure describes global (ie., server-wide) parameters.
121 char *display_charset
;
122 char *szPrintcapname
;
123 char *szAddPortCommand
;
124 char *szEnumPortsCommand
;
125 char *szAddPrinterCommand
;
126 char *szDeletePrinterCommand
;
127 char *szOs2DriverMap
;
133 char *szDefaultService
;
137 char *szServerString
;
138 char *szAutoServices
;
139 char *szPasswdProgram
;
143 char *szSMBPasswdFile
;
145 char *szPassdbBackend
;
146 char **szPreloadModules
;
147 char *szPasswordServer
;
148 char *szSocketOptions
;
150 char *szAfsUsernameMap
;
151 int iAfsTokenLifetime
;
152 char *szLogNtTokenCommand
;
158 char **szWINSservers
;
160 char *szRemoteAnnounce
;
161 char *szRemoteBrowseSync
;
162 char *szSocketAddress
;
163 bool bNmbdBindExplicitBroadcast
;
164 char *szNISHomeMapName
;
165 char *szAnnounceVersion
; /* This is initialised in init_globals */
168 char **szNetbiosAliases
;
169 char *szNetbiosScope
;
170 char *szNameResolveOrder
;
172 char *szAddUserScript
;
173 char *szRenameUserScript
;
174 char *szDelUserScript
;
175 char *szAddGroupScript
;
176 char *szDelGroupScript
;
177 char *szAddUserToGroupScript
;
178 char *szDelUserFromGroupScript
;
179 char *szSetPrimaryGroupScript
;
180 char *szAddMachineScript
;
181 char *szShutdownScript
;
182 char *szAbortShutdownScript
;
183 char *szUsernameMapScript
;
184 char *szCheckPasswordScript
;
191 bool bPassdbExpandExplicit
;
192 int AlgorithmicRidBase
;
193 char *szTemplateHomedir
;
194 char *szTemplateShell
;
195 char *szWinbindSeparator
;
196 bool bWinbindEnumUsers
;
197 bool bWinbindEnumGroups
;
198 bool bWinbindUseDefaultDomain
;
199 bool bWinbindTrustedDomainsOnly
;
200 bool bWinbindNestedGroups
;
201 int winbind_expand_groups
;
202 bool bWinbindRefreshTickets
;
203 bool bWinbindOfflineLogon
;
204 bool bWinbindNormalizeNames
;
205 bool bWinbindRpcOnly
;
206 bool bCreateKrb5Conf
;
207 char *szIdmapBackend
;
208 char *szIdmapAllocBackend
;
209 char *szAddShareCommand
;
210 char *szChangeShareCommand
;
211 char *szDeleteShareCommand
;
213 char *szGuestaccount
;
214 char *szManglingMethod
;
215 char **szServicesList
;
216 char *szUsersharePath
;
217 char *szUsershareTemplateShare
;
218 char **szUsersharePrefixAllowList
;
219 char **szUsersharePrefixDenyList
;
226 int open_files_db_hash_size
;
235 bool paranoid_server_security
;
238 int iMaxSmbdProcesses
;
239 bool bDisableSpoolss
;
242 bool enhanced_browsing
;
248 int announce_as
; /* This is initialised in init_globals */
249 int machine_password_timeout
;
251 int oplock_break_wait_time
;
252 int winbind_cache_time
;
253 int winbind_reconnect_delay
;
254 int winbind_max_clients
;
255 char **szWinbindNssInfo
;
257 char *szLdapMachineSuffix
;
258 char *szLdapUserSuffix
;
259 char *szLdapIdmapSuffix
;
260 char *szLdapGroupSuffix
;
264 int ldap_follow_referral
;
267 int ldap_debug_level
;
268 int ldap_debug_threshold
;
272 char *szIPrintServer
;
274 char **szClusterAddresses
;
277 int ldap_passwd_sync
;
278 int ldap_replication_sleep
;
279 int ldap_timeout
; /* This is initialised in init_globals */
280 int ldap_connection_timeout
;
283 bool bMsAddPrinterWizard
;
288 int iPreferredMaster
;
291 char **szInitLogonDelayedHosts
;
293 bool bEncryptPasswords
;
298 bool bObeyPamRestrictions
;
300 int PrintcapCacheTime
;
301 bool bLargeReadwrite
;
308 bool bBindInterfacesOnly
;
309 bool bPamPasswordChange
;
310 bool bUnixPasswdSync
;
311 bool bPasswdChatDebug
;
312 int iPasswdChatTimeout
;
316 bool bNTStatusSupport
;
318 int iMaxStatCacheSize
;
320 bool bAllowTrustedDomains
;
324 bool bClientLanManAuth
;
325 bool bClientNTLMv2Auth
;
326 bool bClientPlaintextAuth
;
327 bool bClientUseSpnego
;
328 bool client_use_spnego_principal
;
329 bool bDebugPrefixTimestamp
;
330 bool bDebugHiresTimestamp
;
334 bool bEnableCoreFiles
;
337 bool bHostnameLookups
;
338 bool bUnixExtensions
;
339 bool bDisableNetbios
;
340 char * szDedicatedKeytabFile
;
342 bool bDeferSharingViolations
;
343 bool bEnablePrivileges
;
345 bool bUsershareOwnerOnly
;
346 bool bUsershareAllowGuests
;
347 bool bRegistryShares
;
348 int restrict_anonymous
;
349 int name_cache_timeout
;
352 int client_ldap_sasl_wrapping
;
353 int iUsershareMaxShares
;
355 int iIdmapNegativeCacheTime
;
359 struct param_opt_struct
*param_opt
;
360 int cups_connection_timeout
;
361 char *szSMBPerfcountModule
;
362 bool bMapUntrustedToDomain
;
365 static struct global Globals
;
368 * This structure describes a single service.
374 struct timespec usershare_last_mod
;
378 char **szInvalidUsers
;
386 char *szRootPostExec
;
388 char *szPrintcommand
;
391 char *szLppausecommand
;
392 char *szLpresumecommand
;
393 char *szQueuepausecommand
;
394 char *szQueueresumecommand
;
396 char *szPrintjobUsername
;
404 char *szVetoOplockFiles
;
410 char **printer_admin
;
415 char *szAioWriteBehind
;
419 int iMaxReportedPrintJobs
;
422 int iCreate_force_mode
;
424 int iSecurity_force_mode
;
427 int iDir_Security_mask
;
428 int iDir_Security_force_mode
;
432 int iOplockContentionLimit
;
437 bool bRootpreexecClose
;
440 bool bShortCasePreserve
;
442 bool bHideSpecialFiles
;
443 bool bHideUnReadable
;
444 bool bHideUnWriteableFiles
;
446 bool bAccessBasedShareEnum
;
451 bool bAdministrative_share
;
457 bool bStoreDosAttributes
;
470 bool bStrictAllocate
;
473 struct bitmap
*copymap
;
474 bool bDeleteReadonly
;
476 bool bDeleteVetoFiles
;
479 bool bDosFiletimeResolution
;
480 bool bFakeDirCreateTimes
;
486 bool bUseClientDriver
;
487 bool bDefaultDevmode
;
488 bool bForcePrintername
;
490 bool bForceUnknownAclUser
;
493 bool bMap_acl_inherit
;
496 bool bAclCheckPermissions
;
497 bool bAclMapFullControl
;
498 bool bAclGroupControl
;
500 bool bKernelChangeNotify
;
501 int iallocation_roundup_size
;
505 int iDirectoryNameCacheSize
;
507 struct param_opt_struct
*param_opt
;
509 char dummy
[3]; /* for alignment */
513 /* This is a default service used to prime a services structure */
514 static struct service sDefault
= {
516 False
, /* not autoloaded */
517 0, /* not a usershare */
518 {0, }, /* No last mod time */
519 NULL
, /* szService */
521 NULL
, /* szUsername */
522 NULL
, /* szInvalidUsers */
523 NULL
, /* szValidUsers */
524 NULL
, /* szAdminUsers */
526 NULL
, /* szInclude */
527 NULL
, /* szPreExec */
528 NULL
, /* szPostExec */
529 NULL
, /* szRootPreExec */
530 NULL
, /* szRootPostExec */
531 NULL
, /* szCupsOptions */
532 NULL
, /* szPrintcommand */
533 NULL
, /* szLpqcommand */
534 NULL
, /* szLprmcommand */
535 NULL
, /* szLppausecommand */
536 NULL
, /* szLpresumecommand */
537 NULL
, /* szQueuepausecommand */
538 NULL
, /* szQueueresumecommand */
539 NULL
, /* szPrintername */
540 NULL
, /* szPrintjobUsername */
541 NULL
, /* szDontdescend */
542 NULL
, /* szHostsallow */
543 NULL
, /* szHostsdeny */
544 NULL
, /* szMagicScript */
545 NULL
, /* szMagicOutput */
546 NULL
, /* szVetoFiles */
547 NULL
, /* szHideFiles */
548 NULL
, /* szVetoOplockFiles */
550 NULL
, /* force user */
551 NULL
, /* force group */
553 NULL
, /* writelist */
554 NULL
, /* printer admin */
557 NULL
, /* vfs objects */
558 NULL
, /* szMSDfsProxy */
559 NULL
, /* szAioWriteBehind */
561 0, /* iMinPrintSpace */
562 1000, /* iMaxPrintJobs */
563 0, /* iMaxReportedPrintJobs */
564 0, /* iWriteCacheSize */
565 0744, /* iCreate_mask */
566 0000, /* iCreate_force_mode */
567 0777, /* iSecurity_mask */
568 0, /* iSecurity_force_mode */
569 0755, /* iDir_mask */
570 0000, /* iDir_force_mode */
571 0777, /* iDir_Security_mask */
572 0, /* iDir_Security_force_mode */
573 0, /* iMaxConnections */
574 CASE_LOWER
, /* iDefaultCase */
575 DEFAULT_PRINTING
, /* iPrinting */
576 2, /* iOplockContentionLimit */
578 1024, /* iBlock_size */
579 0, /* iDfreeCacheTime */
580 False
, /* bPreexecClose */
581 False
, /* bRootpreexecClose */
582 Auto
, /* case sensitive */
583 True
, /* case preserve */
584 True
, /* short case preserve */
585 True
, /* bHideDotFiles */
586 False
, /* bHideSpecialFiles */
587 False
, /* bHideUnReadable */
588 False
, /* bHideUnWriteableFiles */
589 True
, /* bBrowseable */
590 False
, /* bAccessBasedShareEnum */
591 True
, /* bAvailable */
592 True
, /* bRead_only */
593 True
, /* bNo_set_dir */
594 False
, /* bGuest_only */
595 False
, /* bAdministrative_share */
596 False
, /* bGuest_ok */
597 False
, /* bPrint_ok */
598 False
, /* bMap_system */
599 False
, /* bMap_hidden */
600 True
, /* bMap_archive */
601 False
, /* bStoreDosAttributes */
602 False
, /* bDmapiSupport */
604 Auto
, /* iStrictLocking */
605 True
, /* bPosixLocking */
606 True
, /* bShareModes */
608 True
, /* bLevel2OpLocks */
609 False
, /* bOnlyUser */
610 True
, /* bMangledNames */
611 false, /* bWidelinks */
612 True
, /* bSymlinks */
613 False
, /* bSyncAlways */
614 False
, /* bStrictAllocate */
615 False
, /* bStrictSync */
616 '~', /* magic char */
618 False
, /* bDeleteReadonly */
619 False
, /* bFakeOplocks */
620 False
, /* bDeleteVetoFiles */
621 False
, /* bDosFilemode */
622 True
, /* bDosFiletimes */
623 False
, /* bDosFiletimeResolution */
624 False
, /* bFakeDirCreateTimes */
625 True
, /* bBlockingLocks */
626 False
, /* bInheritPerms */
627 False
, /* bInheritACLS */
628 False
, /* bInheritOwner */
629 False
, /* bMSDfsRoot */
630 False
, /* bUseClientDriver */
631 True
, /* bDefaultDevmode */
632 False
, /* bForcePrintername */
633 True
, /* bNTAclSupport */
634 False
, /* bForceUnknownAclUser */
635 False
, /* bUseSendfile */
636 False
, /* bProfileAcls */
637 False
, /* bMap_acl_inherit */
638 False
, /* bAfs_Share */
639 False
, /* bEASupport */
640 True
, /* bAclCheckPermissions */
641 True
, /* bAclMapFullControl */
642 False
, /* bAclGroupControl */
643 True
, /* bChangeNotify */
644 True
, /* bKernelChangeNotify */
645 SMB_ROUNDUP_ALLOCATION_SIZE
, /* iallocation_roundup_size */
646 0, /* iAioReadSize */
647 0, /* iAioWriteSize */
648 MAP_READONLY_YES
, /* iMap_readonly */
649 #ifdef BROKEN_DIRECTORY_HANDLING
650 0, /* iDirectoryNameCacheSize */
652 100, /* iDirectoryNameCacheSize */
654 Auto
, /* ismb_encrypt */
655 NULL
, /* Parametric options */
660 /* local variables */
661 static struct service
**ServicePtrs
= NULL
;
662 static int iNumServices
= 0;
663 static int iServiceIndex
= 0;
664 static struct db_context
*ServiceHash
;
665 static int *invalid_services
= NULL
;
666 static int num_invalid_services
= 0;
667 static bool bInGlobalSection
= True
;
668 static bool bGlobalOnly
= False
;
669 static int server_role
;
670 static int default_server_announce
;
672 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
674 /* prototypes for the special type handlers */
675 static bool handle_include( int snum
, const char *pszParmValue
, char **ptr
);
676 static bool handle_copy( int snum
, const char *pszParmValue
, char **ptr
);
677 static bool handle_netbios_name( int snum
, const char *pszParmValue
, char **ptr
);
678 static bool handle_idmap_uid( int snum
, const char *pszParmValue
, char **ptr
);
679 static bool handle_idmap_gid( int snum
, const char *pszParmValue
, char **ptr
);
680 static bool handle_debug_list( int snum
, const char *pszParmValue
, char **ptr
);
681 static bool handle_workgroup( int snum
, const char *pszParmValue
, char **ptr
);
682 static bool handle_netbios_aliases( int snum
, const char *pszParmValue
, char **ptr
);
683 static bool handle_netbios_scope( int snum
, const char *pszParmValue
, char **ptr
);
684 static bool handle_charset( int snum
, const char *pszParmValue
, char **ptr
);
685 static bool handle_printing( int snum
, const char *pszParmValue
, char **ptr
);
686 static bool handle_ldap_debug_level( int snum
, const char *pszParmValue
, char **ptr
);
688 static void set_server_role(void);
689 static void set_default_server_announce_type(void);
690 static void set_allowed_client_auth(void);
692 static void *lp_local_ptr(struct service
*service
, void *ptr
);
694 static void add_to_file_list(const char *fname
, const char *subfname
);
696 static const struct enum_list enum_protocol
[] = {
697 {PROTOCOL_SMB2
, "SMB2"},
698 {PROTOCOL_NT1
, "NT1"},
699 {PROTOCOL_LANMAN2
, "LANMAN2"},
700 {PROTOCOL_LANMAN1
, "LANMAN1"},
701 {PROTOCOL_CORE
, "CORE"},
702 {PROTOCOL_COREPLUS
, "COREPLUS"},
703 {PROTOCOL_COREPLUS
, "CORE+"},
707 static const struct enum_list enum_security
[] = {
708 {SEC_SHARE
, "SHARE"},
710 {SEC_SERVER
, "SERVER"},
711 {SEC_DOMAIN
, "DOMAIN"},
718 static const struct enum_list enum_printing
[] = {
719 {PRINT_SYSV
, "sysv"},
721 {PRINT_HPUX
, "hpux"},
725 {PRINT_LPRNG
, "lprng"},
726 {PRINT_CUPS
, "cups"},
727 {PRINT_IPRINT
, "iprint"},
729 {PRINT_LPROS2
, "os2"},
731 {PRINT_TEST
, "test"},
733 #endif /* DEVELOPER */
737 static const struct enum_list enum_ldap_sasl_wrapping
[] = {
739 {ADS_AUTH_SASL_SIGN
, "sign"},
740 {ADS_AUTH_SASL_SEAL
, "seal"},
744 static const struct enum_list enum_ldap_ssl
[] = {
745 {LDAP_SSL_OFF
, "no"},
746 {LDAP_SSL_OFF
, "off"},
747 {LDAP_SSL_START_TLS
, "start tls"},
748 {LDAP_SSL_START_TLS
, "start_tls"},
752 /* LDAP Dereferencing Alias types */
753 #define SAMBA_LDAP_DEREF_NEVER 0
754 #define SAMBA_LDAP_DEREF_SEARCHING 1
755 #define SAMBA_LDAP_DEREF_FINDING 2
756 #define SAMBA_LDAP_DEREF_ALWAYS 3
758 static const struct enum_list enum_ldap_deref
[] = {
759 {SAMBA_LDAP_DEREF_NEVER
, "never"},
760 {SAMBA_LDAP_DEREF_SEARCHING
, "searching"},
761 {SAMBA_LDAP_DEREF_FINDING
, "finding"},
762 {SAMBA_LDAP_DEREF_ALWAYS
, "always"},
766 static const struct enum_list enum_ldap_passwd_sync
[] = {
767 {LDAP_PASSWD_SYNC_OFF
, "no"},
768 {LDAP_PASSWD_SYNC_OFF
, "off"},
769 {LDAP_PASSWD_SYNC_ON
, "yes"},
770 {LDAP_PASSWD_SYNC_ON
, "on"},
771 {LDAP_PASSWD_SYNC_ONLY
, "only"},
775 /* Types of machine we can announce as. */
776 #define ANNOUNCE_AS_NT_SERVER 1
777 #define ANNOUNCE_AS_WIN95 2
778 #define ANNOUNCE_AS_WFW 3
779 #define ANNOUNCE_AS_NT_WORKSTATION 4
781 static const struct enum_list enum_announce_as
[] = {
782 {ANNOUNCE_AS_NT_SERVER
, "NT"},
783 {ANNOUNCE_AS_NT_SERVER
, "NT Server"},
784 {ANNOUNCE_AS_NT_WORKSTATION
, "NT Workstation"},
785 {ANNOUNCE_AS_WIN95
, "win95"},
786 {ANNOUNCE_AS_WFW
, "WfW"},
790 static const struct enum_list enum_map_readonly
[] = {
791 {MAP_READONLY_NO
, "no"},
792 {MAP_READONLY_NO
, "false"},
793 {MAP_READONLY_NO
, "0"},
794 {MAP_READONLY_YES
, "yes"},
795 {MAP_READONLY_YES
, "true"},
796 {MAP_READONLY_YES
, "1"},
797 {MAP_READONLY_PERMISSIONS
, "permissions"},
798 {MAP_READONLY_PERMISSIONS
, "perms"},
802 static const struct enum_list enum_case
[] = {
803 {CASE_LOWER
, "lower"},
804 {CASE_UPPER
, "upper"},
810 static const struct enum_list enum_bool_auto
[] = {
821 /* Client-side offline caching policy types */
822 #define CSC_POLICY_MANUAL 0
823 #define CSC_POLICY_DOCUMENTS 1
824 #define CSC_POLICY_PROGRAMS 2
825 #define CSC_POLICY_DISABLE 3
827 static const struct enum_list enum_csc_policy
[] = {
828 {CSC_POLICY_MANUAL
, "manual"},
829 {CSC_POLICY_DOCUMENTS
, "documents"},
830 {CSC_POLICY_PROGRAMS
, "programs"},
831 {CSC_POLICY_DISABLE
, "disable"},
835 /* SMB signing types. */
836 static const struct enum_list enum_smb_signing_vals
[] = {
848 {Required
, "required"},
849 {Required
, "mandatory"},
851 {Required
, "forced"},
852 {Required
, "enforced"},
856 /* ACL compatibility options. */
857 static const struct enum_list enum_acl_compat_vals
[] = {
858 { ACL_COMPAT_AUTO
, "auto" },
859 { ACL_COMPAT_WINNT
, "winnt" },
860 { ACL_COMPAT_WIN2K
, "win2k" },
865 Do you want session setups at user level security with a invalid
866 password to be rejected or allowed in as guest? WinNT rejects them
867 but it can be a pain as it means "net view" needs to use a password
869 You have 3 choices in the setting of map_to_guest:
871 "Never" means session setups with an invalid password
872 are rejected. This is the default.
874 "Bad User" means session setups with an invalid password
875 are rejected, unless the username does not exist, in which case it
876 is treated as a guest login
878 "Bad Password" means session setups with an invalid password
879 are treated as a guest login
881 Note that map_to_guest only has an effect in user or server
885 static const struct enum_list enum_map_to_guest
[] = {
886 {NEVER_MAP_TO_GUEST
, "Never"},
887 {MAP_TO_GUEST_ON_BAD_USER
, "Bad User"},
888 {MAP_TO_GUEST_ON_BAD_PASSWORD
, "Bad Password"},
889 {MAP_TO_GUEST_ON_BAD_UID
, "Bad Uid"},
893 /* Config backend options */
895 static const struct enum_list enum_config_backend
[] = {
896 {CONFIG_BACKEND_FILE
, "file"},
897 {CONFIG_BACKEND_REGISTRY
, "registry"},
901 /* ADS kerberos ticket verification options */
903 static const struct enum_list enum_kerberos_method
[] = {
904 {KERBEROS_VERIFY_SECRETS
, "default"},
905 {KERBEROS_VERIFY_SECRETS
, "secrets only"},
906 {KERBEROS_VERIFY_SYSTEM_KEYTAB
, "system keytab"},
907 {KERBEROS_VERIFY_DEDICATED_KEYTAB
, "dedicated keytab"},
908 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB
, "secrets and keytab"},
912 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
914 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
915 * screen in SWAT. This is used to exclude parameters as well as to squash all
916 * parameters that have been duplicated by pseudonyms.
918 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
919 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
920 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
923 * NOTE2: Handling of duplicated (synonym) parameters:
924 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
925 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
926 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
927 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
930 static struct parm_struct parm_table
[] = {
931 {N_("Base Options"), P_SEP
, P_SEPARATOR
},
934 .label
= "dos charset",
937 .ptr
= &Globals
.dos_charset
,
938 .special
= handle_charset
,
940 .flags
= FLAG_ADVANCED
943 .label
= "unix charset",
946 .ptr
= &Globals
.unix_charset
,
947 .special
= handle_charset
,
949 .flags
= FLAG_ADVANCED
952 .label
= "display charset",
955 .ptr
= &Globals
.display_charset
,
956 .special
= handle_charset
,
958 .flags
= FLAG_ADVANCED
964 .ptr
= &sDefault
.comment
,
967 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
973 .ptr
= &sDefault
.szPath
,
976 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
979 .label
= "directory",
982 .ptr
= &sDefault
.szPath
,
988 .label
= "workgroup",
991 .ptr
= &Globals
.szWorkgroup
,
992 .special
= handle_workgroup
,
994 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1000 .p_class
= P_GLOBAL
,
1001 .ptr
= &Globals
.szRealm
,
1004 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1008 .label
= "netbios name",
1010 .p_class
= P_GLOBAL
,
1011 .ptr
= &Globals
.szNetbiosName
,
1012 .special
= handle_netbios_name
,
1014 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1017 .label
= "netbios aliases",
1019 .p_class
= P_GLOBAL
,
1020 .ptr
= &Globals
.szNetbiosAliases
,
1021 .special
= handle_netbios_aliases
,
1023 .flags
= FLAG_ADVANCED
,
1026 .label
= "netbios scope",
1028 .p_class
= P_GLOBAL
,
1029 .ptr
= &Globals
.szNetbiosScope
,
1030 .special
= handle_netbios_scope
,
1032 .flags
= FLAG_ADVANCED
,
1035 .label
= "server string",
1037 .p_class
= P_GLOBAL
,
1038 .ptr
= &Globals
.szServerString
,
1041 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1044 .label
= "interfaces",
1046 .p_class
= P_GLOBAL
,
1047 .ptr
= &Globals
.szInterfaces
,
1050 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1053 .label
= "bind interfaces only",
1055 .p_class
= P_GLOBAL
,
1056 .ptr
= &Globals
.bBindInterfacesOnly
,
1059 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1062 .label
= "config backend",
1064 .p_class
= P_GLOBAL
,
1065 .ptr
= &Globals
.ConfigBackend
,
1067 .enum_list
= enum_config_backend
,
1068 .flags
= FLAG_HIDE
|FLAG_ADVANCED
|FLAG_META
,
1071 {N_("Security Options"), P_SEP
, P_SEPARATOR
},
1074 .label
= "security",
1076 .p_class
= P_GLOBAL
,
1077 .ptr
= &Globals
.security
,
1079 .enum_list
= enum_security
,
1080 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1083 .label
= "auth methods",
1085 .p_class
= P_GLOBAL
,
1086 .ptr
= &Globals
.AuthMethods
,
1089 .flags
= FLAG_ADVANCED
,
1092 .label
= "encrypt passwords",
1094 .p_class
= P_GLOBAL
,
1095 .ptr
= &Globals
.bEncryptPasswords
,
1098 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1101 .label
= "update encrypted",
1103 .p_class
= P_GLOBAL
,
1104 .ptr
= &Globals
.bUpdateEncrypt
,
1107 .flags
= FLAG_ADVANCED
,
1110 .label
= "client schannel",
1112 .p_class
= P_GLOBAL
,
1113 .ptr
= &Globals
.clientSchannel
,
1115 .enum_list
= enum_bool_auto
,
1116 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1119 .label
= "server schannel",
1121 .p_class
= P_GLOBAL
,
1122 .ptr
= &Globals
.serverSchannel
,
1124 .enum_list
= enum_bool_auto
,
1125 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1128 .label
= "allow trusted domains",
1130 .p_class
= P_GLOBAL
,
1131 .ptr
= &Globals
.bAllowTrustedDomains
,
1134 .flags
= FLAG_ADVANCED
,
1137 .label
= "map to guest",
1139 .p_class
= P_GLOBAL
,
1140 .ptr
= &Globals
.map_to_guest
,
1142 .enum_list
= enum_map_to_guest
,
1143 .flags
= FLAG_ADVANCED
,
1146 .label
= "null passwords",
1148 .p_class
= P_GLOBAL
,
1149 .ptr
= &Globals
.bNullPasswords
,
1152 .flags
= FLAG_ADVANCED
,
1155 .label
= "obey pam restrictions",
1157 .p_class
= P_GLOBAL
,
1158 .ptr
= &Globals
.bObeyPamRestrictions
,
1161 .flags
= FLAG_ADVANCED
,
1164 .label
= "password server",
1166 .p_class
= P_GLOBAL
,
1167 .ptr
= &Globals
.szPasswordServer
,
1170 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1173 .label
= "smb passwd file",
1175 .p_class
= P_GLOBAL
,
1176 .ptr
= &Globals
.szSMBPasswdFile
,
1179 .flags
= FLAG_ADVANCED
,
1182 .label
= "private dir",
1184 .p_class
= P_GLOBAL
,
1185 .ptr
= &Globals
.szPrivateDir
,
1188 .flags
= FLAG_ADVANCED
,
1191 .label
= "passdb backend",
1193 .p_class
= P_GLOBAL
,
1194 .ptr
= &Globals
.szPassdbBackend
,
1197 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1200 .label
= "algorithmic rid base",
1202 .p_class
= P_GLOBAL
,
1203 .ptr
= &Globals
.AlgorithmicRidBase
,
1206 .flags
= FLAG_ADVANCED
,
1209 .label
= "root directory",
1211 .p_class
= P_GLOBAL
,
1212 .ptr
= &Globals
.szRootdir
,
1215 .flags
= FLAG_ADVANCED
,
1218 .label
= "root dir",
1220 .p_class
= P_GLOBAL
,
1221 .ptr
= &Globals
.szRootdir
,
1229 .p_class
= P_GLOBAL
,
1230 .ptr
= &Globals
.szRootdir
,
1236 .label
= "guest account",
1238 .p_class
= P_GLOBAL
,
1239 .ptr
= &Globals
.szGuestaccount
,
1242 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1245 .label
= "enable privileges",
1247 .p_class
= P_GLOBAL
,
1248 .ptr
= &Globals
.bEnablePrivileges
,
1251 .flags
= FLAG_ADVANCED
,
1255 .label
= "pam password change",
1257 .p_class
= P_GLOBAL
,
1258 .ptr
= &Globals
.bPamPasswordChange
,
1261 .flags
= FLAG_ADVANCED
,
1264 .label
= "passwd program",
1266 .p_class
= P_GLOBAL
,
1267 .ptr
= &Globals
.szPasswdProgram
,
1270 .flags
= FLAG_ADVANCED
,
1273 .label
= "passwd chat",
1275 .p_class
= P_GLOBAL
,
1276 .ptr
= &Globals
.szPasswdChat
,
1279 .flags
= FLAG_ADVANCED
,
1282 .label
= "passwd chat debug",
1284 .p_class
= P_GLOBAL
,
1285 .ptr
= &Globals
.bPasswdChatDebug
,
1288 .flags
= FLAG_ADVANCED
,
1291 .label
= "passwd chat timeout",
1293 .p_class
= P_GLOBAL
,
1294 .ptr
= &Globals
.iPasswdChatTimeout
,
1297 .flags
= FLAG_ADVANCED
,
1300 .label
= "check password script",
1302 .p_class
= P_GLOBAL
,
1303 .ptr
= &Globals
.szCheckPasswordScript
,
1306 .flags
= FLAG_ADVANCED
,
1309 .label
= "username map",
1311 .p_class
= P_GLOBAL
,
1312 .ptr
= &Globals
.szUsernameMap
,
1315 .flags
= FLAG_ADVANCED
,
1318 .label
= "password level",
1320 .p_class
= P_GLOBAL
,
1321 .ptr
= &Globals
.pwordlevel
,
1324 .flags
= FLAG_ADVANCED
,
1327 .label
= "username level",
1329 .p_class
= P_GLOBAL
,
1330 .ptr
= &Globals
.unamelevel
,
1333 .flags
= FLAG_ADVANCED
,
1336 .label
= "unix password sync",
1338 .p_class
= P_GLOBAL
,
1339 .ptr
= &Globals
.bUnixPasswdSync
,
1342 .flags
= FLAG_ADVANCED
,
1345 .label
= "restrict anonymous",
1347 .p_class
= P_GLOBAL
,
1348 .ptr
= &Globals
.restrict_anonymous
,
1351 .flags
= FLAG_ADVANCED
,
1354 .label
= "lanman auth",
1356 .p_class
= P_GLOBAL
,
1357 .ptr
= &Globals
.bLanmanAuth
,
1360 .flags
= FLAG_ADVANCED
,
1363 .label
= "ntlm auth",
1365 .p_class
= P_GLOBAL
,
1366 .ptr
= &Globals
.bNTLMAuth
,
1369 .flags
= FLAG_ADVANCED
,
1372 .label
= "client NTLMv2 auth",
1374 .p_class
= P_GLOBAL
,
1375 .ptr
= &Globals
.bClientNTLMv2Auth
,
1378 .flags
= FLAG_ADVANCED
,
1381 .label
= "client lanman auth",
1383 .p_class
= P_GLOBAL
,
1384 .ptr
= &Globals
.bClientLanManAuth
,
1387 .flags
= FLAG_ADVANCED
,
1390 .label
= "client plaintext auth",
1392 .p_class
= P_GLOBAL
,
1393 .ptr
= &Globals
.bClientPlaintextAuth
,
1396 .flags
= FLAG_ADVANCED
,
1399 .label
= "client use spnego principal",
1401 .p_class
= P_GLOBAL
,
1402 .ptr
= &Globals
.client_use_spnego_principal
,
1405 .flags
= FLAG_ADVANCED
,
1408 .label
= "username",
1411 .ptr
= &sDefault
.szUsername
,
1414 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1420 .ptr
= &sDefault
.szUsername
,
1429 .ptr
= &sDefault
.szUsername
,
1435 .label
= "invalid users",
1438 .ptr
= &sDefault
.szInvalidUsers
,
1441 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1444 .label
= "valid users",
1447 .ptr
= &sDefault
.szValidUsers
,
1450 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1453 .label
= "admin users",
1456 .ptr
= &sDefault
.szAdminUsers
,
1459 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1462 .label
= "read list",
1465 .ptr
= &sDefault
.readlist
,
1468 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1471 .label
= "write list",
1474 .ptr
= &sDefault
.writelist
,
1477 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1480 .label
= "printer admin",
1483 .ptr
= &sDefault
.printer_admin
,
1486 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_PRINT
| FLAG_DEPRECATED
,
1489 .label
= "force user",
1492 .ptr
= &sDefault
.force_user
,
1495 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1498 .label
= "force group",
1501 .ptr
= &sDefault
.force_group
,
1504 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1510 .ptr
= &sDefault
.force_group
,
1513 .flags
= FLAG_ADVANCED
,
1516 .label
= "read only",
1519 .ptr
= &sDefault
.bRead_only
,
1522 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
,
1525 .label
= "write ok",
1528 .ptr
= &sDefault
.bRead_only
,
1534 .label
= "writeable",
1537 .ptr
= &sDefault
.bRead_only
,
1543 .label
= "writable",
1546 .ptr
= &sDefault
.bRead_only
,
1552 .label
= "acl check permissions",
1555 .ptr
= &sDefault
.bAclCheckPermissions
,
1558 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1561 .label
= "acl group control",
1564 .ptr
= &sDefault
.bAclGroupControl
,
1567 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1570 .label
= "acl map full control",
1573 .ptr
= &sDefault
.bAclMapFullControl
,
1576 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1579 .label
= "create mask",
1582 .ptr
= &sDefault
.iCreate_mask
,
1585 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1588 .label
= "create mode",
1591 .ptr
= &sDefault
.iCreate_mask
,
1597 .label
= "force create mode",
1600 .ptr
= &sDefault
.iCreate_force_mode
,
1603 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1606 .label
= "security mask",
1609 .ptr
= &sDefault
.iSecurity_mask
,
1612 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1615 .label
= "force security mode",
1618 .ptr
= &sDefault
.iSecurity_force_mode
,
1621 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1624 .label
= "directory mask",
1627 .ptr
= &sDefault
.iDir_mask
,
1630 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1633 .label
= "directory mode",
1636 .ptr
= &sDefault
.iDir_mask
,
1639 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1642 .label
= "force directory mode",
1645 .ptr
= &sDefault
.iDir_force_mode
,
1648 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1651 .label
= "directory security mask",
1654 .ptr
= &sDefault
.iDir_Security_mask
,
1657 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1660 .label
= "force directory security mode",
1663 .ptr
= &sDefault
.iDir_Security_force_mode
,
1666 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1669 .label
= "force unknown acl user",
1672 .ptr
= &sDefault
.bForceUnknownAclUser
,
1675 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1678 .label
= "inherit permissions",
1681 .ptr
= &sDefault
.bInheritPerms
,
1684 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1687 .label
= "inherit acls",
1690 .ptr
= &sDefault
.bInheritACLS
,
1693 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1696 .label
= "inherit owner",
1699 .ptr
= &sDefault
.bInheritOwner
,
1702 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1705 .label
= "guest only",
1708 .ptr
= &sDefault
.bGuest_only
,
1711 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1714 .label
= "only guest",
1717 .ptr
= &sDefault
.bGuest_only
,
1723 .label
= "administrative share",
1726 .ptr
= &sDefault
.bAdministrative_share
,
1729 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1733 .label
= "guest ok",
1736 .ptr
= &sDefault
.bGuest_ok
,
1739 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1745 .ptr
= &sDefault
.bGuest_ok
,
1751 .label
= "only user",
1754 .ptr
= &sDefault
.bOnlyUser
,
1757 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_DEPRECATED
,
1760 .label
= "hosts allow",
1763 .ptr
= &sDefault
.szHostsallow
,
1766 .flags
= FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1769 .label
= "allow hosts",
1772 .ptr
= &sDefault
.szHostsallow
,
1778 .label
= "hosts deny",
1781 .ptr
= &sDefault
.szHostsdeny
,
1784 .flags
= FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1787 .label
= "deny hosts",
1790 .ptr
= &sDefault
.szHostsdeny
,
1796 .label
= "preload modules",
1798 .p_class
= P_GLOBAL
,
1799 .ptr
= &Globals
.szPreloadModules
,
1802 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1805 .label
= "dedicated keytab file",
1807 .p_class
= P_GLOBAL
,
1808 .ptr
= &Globals
.szDedicatedKeytabFile
,
1811 .flags
= FLAG_ADVANCED
,
1814 .label
= "kerberos method",
1816 .p_class
= P_GLOBAL
,
1817 .ptr
= &Globals
.iKerberosMethod
,
1819 .enum_list
= enum_kerberos_method
,
1820 .flags
= FLAG_ADVANCED
,
1823 .label
= "map untrusted to domain",
1825 .p_class
= P_GLOBAL
,
1826 .ptr
= &Globals
.bMapUntrustedToDomain
,
1829 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1833 {N_("Logging Options"), P_SEP
, P_SEPARATOR
},
1836 .label
= "log level",
1838 .p_class
= P_GLOBAL
,
1839 .ptr
= &Globals
.szLogLevel
,
1840 .special
= handle_debug_list
,
1842 .flags
= FLAG_ADVANCED
,
1845 .label
= "debuglevel",
1847 .p_class
= P_GLOBAL
,
1848 .ptr
= &Globals
.szLogLevel
,
1849 .special
= handle_debug_list
,
1856 .p_class
= P_GLOBAL
,
1857 .ptr
= &Globals
.syslog
,
1860 .flags
= FLAG_ADVANCED
,
1863 .label
= "syslog only",
1865 .p_class
= P_GLOBAL
,
1866 .ptr
= &Globals
.bSyslogOnly
,
1869 .flags
= FLAG_ADVANCED
,
1872 .label
= "log file",
1874 .p_class
= P_GLOBAL
,
1875 .ptr
= &Globals
.szLogFile
,
1878 .flags
= FLAG_ADVANCED
,
1881 .label
= "max log size",
1883 .p_class
= P_GLOBAL
,
1884 .ptr
= &Globals
.max_log_size
,
1887 .flags
= FLAG_ADVANCED
,
1890 .label
= "debug timestamp",
1892 .p_class
= P_GLOBAL
,
1893 .ptr
= &Globals
.bTimestampLogs
,
1896 .flags
= FLAG_ADVANCED
,
1899 .label
= "timestamp logs",
1901 .p_class
= P_GLOBAL
,
1902 .ptr
= &Globals
.bTimestampLogs
,
1905 .flags
= FLAG_ADVANCED
,
1908 .label
= "debug prefix timestamp",
1910 .p_class
= P_GLOBAL
,
1911 .ptr
= &Globals
.bDebugPrefixTimestamp
,
1914 .flags
= FLAG_ADVANCED
,
1917 .label
= "debug hires timestamp",
1919 .p_class
= P_GLOBAL
,
1920 .ptr
= &Globals
.bDebugHiresTimestamp
,
1923 .flags
= FLAG_ADVANCED
,
1926 .label
= "debug pid",
1928 .p_class
= P_GLOBAL
,
1929 .ptr
= &Globals
.bDebugPid
,
1932 .flags
= FLAG_ADVANCED
,
1935 .label
= "debug uid",
1937 .p_class
= P_GLOBAL
,
1938 .ptr
= &Globals
.bDebugUid
,
1941 .flags
= FLAG_ADVANCED
,
1944 .label
= "debug class",
1946 .p_class
= P_GLOBAL
,
1947 .ptr
= &Globals
.bDebugClass
,
1950 .flags
= FLAG_ADVANCED
,
1953 .label
= "enable core files",
1955 .p_class
= P_GLOBAL
,
1956 .ptr
= &Globals
.bEnableCoreFiles
,
1959 .flags
= FLAG_ADVANCED
,
1962 {N_("Protocol Options"), P_SEP
, P_SEPARATOR
},
1965 .label
= "allocation roundup size",
1968 .ptr
= &sDefault
.iallocation_roundup_size
,
1971 .flags
= FLAG_ADVANCED
,
1974 .label
= "aio read size",
1977 .ptr
= &sDefault
.iAioReadSize
,
1980 .flags
= FLAG_ADVANCED
,
1983 .label
= "aio write size",
1986 .ptr
= &sDefault
.iAioWriteSize
,
1989 .flags
= FLAG_ADVANCED
,
1992 .label
= "aio write behind",
1995 .ptr
= &sDefault
.szAioWriteBehind
,
1998 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2001 .label
= "smb ports",
2003 .p_class
= P_GLOBAL
,
2004 .ptr
= &Globals
.smb_ports
,
2007 .flags
= FLAG_ADVANCED
,
2010 .label
= "large readwrite",
2012 .p_class
= P_GLOBAL
,
2013 .ptr
= &Globals
.bLargeReadwrite
,
2016 .flags
= FLAG_ADVANCED
,
2019 .label
= "max protocol",
2021 .p_class
= P_GLOBAL
,
2022 .ptr
= &Globals
.maxprotocol
,
2024 .enum_list
= enum_protocol
,
2025 .flags
= FLAG_ADVANCED
,
2028 .label
= "protocol",
2030 .p_class
= P_GLOBAL
,
2031 .ptr
= &Globals
.maxprotocol
,
2033 .enum_list
= enum_protocol
,
2034 .flags
= FLAG_ADVANCED
,
2037 .label
= "min protocol",
2039 .p_class
= P_GLOBAL
,
2040 .ptr
= &Globals
.minprotocol
,
2042 .enum_list
= enum_protocol
,
2043 .flags
= FLAG_ADVANCED
,
2046 .label
= "min receivefile size",
2048 .p_class
= P_GLOBAL
,
2049 .ptr
= &Globals
.iminreceivefile
,
2052 .flags
= FLAG_ADVANCED
,
2055 .label
= "read raw",
2057 .p_class
= P_GLOBAL
,
2058 .ptr
= &Globals
.bReadRaw
,
2061 .flags
= FLAG_ADVANCED
,
2064 .label
= "write raw",
2066 .p_class
= P_GLOBAL
,
2067 .ptr
= &Globals
.bWriteRaw
,
2070 .flags
= FLAG_ADVANCED
,
2073 .label
= "disable netbios",
2075 .p_class
= P_GLOBAL
,
2076 .ptr
= &Globals
.bDisableNetbios
,
2079 .flags
= FLAG_ADVANCED
,
2082 .label
= "reset on zero vc",
2084 .p_class
= P_GLOBAL
,
2085 .ptr
= &Globals
.bResetOnZeroVC
,
2088 .flags
= FLAG_ADVANCED
,
2091 .label
= "acl compatibility",
2093 .p_class
= P_GLOBAL
,
2094 .ptr
= &Globals
.iAclCompat
,
2096 .enum_list
= enum_acl_compat_vals
,
2097 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2100 .label
= "defer sharing violations",
2102 .p_class
= P_GLOBAL
,
2103 .ptr
= &Globals
.bDeferSharingViolations
,
2106 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2109 .label
= "ea support",
2112 .ptr
= &sDefault
.bEASupport
,
2115 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2118 .label
= "nt acl support",
2121 .ptr
= &sDefault
.bNTAclSupport
,
2124 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2127 .label
= "nt pipe support",
2129 .p_class
= P_GLOBAL
,
2130 .ptr
= &Globals
.bNTPipeSupport
,
2133 .flags
= FLAG_ADVANCED
,
2136 .label
= "nt status support",
2138 .p_class
= P_GLOBAL
,
2139 .ptr
= &Globals
.bNTStatusSupport
,
2142 .flags
= FLAG_ADVANCED
,
2145 .label
= "profile acls",
2148 .ptr
= &sDefault
.bProfileAcls
,
2151 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
2154 .label
= "announce version",
2156 .p_class
= P_GLOBAL
,
2157 .ptr
= &Globals
.szAnnounceVersion
,
2160 .flags
= FLAG_ADVANCED
,
2163 .label
= "announce as",
2165 .p_class
= P_GLOBAL
,
2166 .ptr
= &Globals
.announce_as
,
2168 .enum_list
= enum_announce_as
,
2169 .flags
= FLAG_ADVANCED
,
2172 .label
= "map acl inherit",
2175 .ptr
= &sDefault
.bMap_acl_inherit
,
2178 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2181 .label
= "afs share",
2184 .ptr
= &sDefault
.bAfs_Share
,
2187 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2192 .p_class
= P_GLOBAL
,
2193 .ptr
= &Globals
.max_mux
,
2196 .flags
= FLAG_ADVANCED
,
2199 .label
= "max xmit",
2201 .p_class
= P_GLOBAL
,
2202 .ptr
= &Globals
.max_xmit
,
2205 .flags
= FLAG_ADVANCED
,
2208 .label
= "name resolve order",
2210 .p_class
= P_GLOBAL
,
2211 .ptr
= &Globals
.szNameResolveOrder
,
2214 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
2219 .p_class
= P_GLOBAL
,
2220 .ptr
= &Globals
.max_ttl
,
2223 .flags
= FLAG_ADVANCED
,
2226 .label
= "max wins ttl",
2228 .p_class
= P_GLOBAL
,
2229 .ptr
= &Globals
.max_wins_ttl
,
2232 .flags
= FLAG_ADVANCED
,
2235 .label
= "min wins ttl",
2237 .p_class
= P_GLOBAL
,
2238 .ptr
= &Globals
.min_wins_ttl
,
2241 .flags
= FLAG_ADVANCED
,
2244 .label
= "time server",
2246 .p_class
= P_GLOBAL
,
2247 .ptr
= &Globals
.bTimeServer
,
2250 .flags
= FLAG_ADVANCED
,
2253 .label
= "unix extensions",
2255 .p_class
= P_GLOBAL
,
2256 .ptr
= &Globals
.bUnixExtensions
,
2259 .flags
= FLAG_ADVANCED
,
2262 .label
= "use spnego",
2264 .p_class
= P_GLOBAL
,
2265 .ptr
= &Globals
.bUseSpnego
,
2268 .flags
= FLAG_ADVANCED
,
2271 .label
= "client signing",
2273 .p_class
= P_GLOBAL
,
2274 .ptr
= &Globals
.client_signing
,
2276 .enum_list
= enum_smb_signing_vals
,
2277 .flags
= FLAG_ADVANCED
,
2280 .label
= "server signing",
2282 .p_class
= P_GLOBAL
,
2283 .ptr
= &Globals
.server_signing
,
2285 .enum_list
= enum_smb_signing_vals
,
2286 .flags
= FLAG_ADVANCED
,
2289 .label
= "smb encrypt",
2292 .ptr
= &sDefault
.ismb_encrypt
,
2294 .enum_list
= enum_smb_signing_vals
,
2295 .flags
= FLAG_ADVANCED
,
2298 .label
= "client use spnego",
2300 .p_class
= P_GLOBAL
,
2301 .ptr
= &Globals
.bClientUseSpnego
,
2304 .flags
= FLAG_ADVANCED
,
2307 .label
= "client ldap sasl wrapping",
2309 .p_class
= P_GLOBAL
,
2310 .ptr
= &Globals
.client_ldap_sasl_wrapping
,
2312 .enum_list
= enum_ldap_sasl_wrapping
,
2313 .flags
= FLAG_ADVANCED
,
2316 .label
= "enable asu support",
2318 .p_class
= P_GLOBAL
,
2319 .ptr
= &Globals
.bASUSupport
,
2322 .flags
= FLAG_ADVANCED
,
2325 .label
= "svcctl list",
2327 .p_class
= P_GLOBAL
,
2328 .ptr
= &Globals
.szServicesList
,
2331 .flags
= FLAG_ADVANCED
,
2334 {N_("Tuning Options"), P_SEP
, P_SEPARATOR
},
2337 .label
= "block size",
2340 .ptr
= &sDefault
.iBlock_size
,
2343 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2346 .label
= "deadtime",
2348 .p_class
= P_GLOBAL
,
2349 .ptr
= &Globals
.deadtime
,
2352 .flags
= FLAG_ADVANCED
,
2355 .label
= "getwd cache",
2357 .p_class
= P_GLOBAL
,
2358 .ptr
= &Globals
.getwd_cache
,
2361 .flags
= FLAG_ADVANCED
,
2364 .label
= "keepalive",
2366 .p_class
= P_GLOBAL
,
2367 .ptr
= &Globals
.iKeepalive
,
2370 .flags
= FLAG_ADVANCED
,
2373 .label
= "change notify",
2376 .ptr
= &sDefault
.bChangeNotify
,
2379 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2382 .label
= "directory name cache size",
2385 .ptr
= &sDefault
.iDirectoryNameCacheSize
,
2388 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2391 .label
= "kernel change notify",
2394 .ptr
= &sDefault
.bKernelChangeNotify
,
2397 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2400 .label
= "lpq cache time",
2402 .p_class
= P_GLOBAL
,
2403 .ptr
= &Globals
.lpqcachetime
,
2406 .flags
= FLAG_ADVANCED
,
2409 .label
= "max smbd processes",
2411 .p_class
= P_GLOBAL
,
2412 .ptr
= &Globals
.iMaxSmbdProcesses
,
2415 .flags
= FLAG_ADVANCED
,
2418 .label
= "max connections",
2421 .ptr
= &sDefault
.iMaxConnections
,
2424 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2427 .label
= "paranoid server security",
2429 .p_class
= P_GLOBAL
,
2430 .ptr
= &Globals
.paranoid_server_security
,
2433 .flags
= FLAG_ADVANCED
,
2436 .label
= "max disk size",
2438 .p_class
= P_GLOBAL
,
2439 .ptr
= &Globals
.maxdisksize
,
2442 .flags
= FLAG_ADVANCED
,
2445 .label
= "max open files",
2447 .p_class
= P_GLOBAL
,
2448 .ptr
= &Globals
.max_open_files
,
2451 .flags
= FLAG_ADVANCED
,
2454 .label
= "min print space",
2457 .ptr
= &sDefault
.iMinPrintSpace
,
2460 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2463 .label
= "socket options",
2465 .p_class
= P_GLOBAL
,
2466 .ptr
= &Globals
.szSocketOptions
,
2469 .flags
= FLAG_ADVANCED
,
2472 .label
= "strict allocate",
2475 .ptr
= &sDefault
.bStrictAllocate
,
2478 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2481 .label
= "strict sync",
2484 .ptr
= &sDefault
.bStrictSync
,
2487 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2490 .label
= "sync always",
2493 .ptr
= &sDefault
.bSyncAlways
,
2496 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2499 .label
= "use mmap",
2501 .p_class
= P_GLOBAL
,
2502 .ptr
= &Globals
.bUseMmap
,
2505 .flags
= FLAG_ADVANCED
,
2508 .label
= "use sendfile",
2511 .ptr
= &sDefault
.bUseSendfile
,
2514 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2517 .label
= "hostname lookups",
2519 .p_class
= P_GLOBAL
,
2520 .ptr
= &Globals
.bHostnameLookups
,
2523 .flags
= FLAG_ADVANCED
,
2526 .label
= "write cache size",
2529 .ptr
= &sDefault
.iWriteCacheSize
,
2532 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2535 .label
= "name cache timeout",
2537 .p_class
= P_GLOBAL
,
2538 .ptr
= &Globals
.name_cache_timeout
,
2541 .flags
= FLAG_ADVANCED
,
2544 .label
= "ctdbd socket",
2546 .p_class
= P_GLOBAL
,
2547 .ptr
= &Globals
.ctdbdSocket
,
2550 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2553 .label
= "cluster addresses",
2555 .p_class
= P_GLOBAL
,
2556 .ptr
= &Globals
.szClusterAddresses
,
2559 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2562 .label
= "clustering",
2564 .p_class
= P_GLOBAL
,
2565 .ptr
= &Globals
.clustering
,
2568 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2571 .label
= "ctdb timeout",
2573 .p_class
= P_GLOBAL
,
2574 .ptr
= &Globals
.ctdb_timeout
,
2577 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2580 {N_("Printing Options"), P_SEP
, P_SEPARATOR
},
2583 .label
= "max reported print jobs",
2586 .ptr
= &sDefault
.iMaxReportedPrintJobs
,
2589 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2592 .label
= "max print jobs",
2595 .ptr
= &sDefault
.iMaxPrintJobs
,
2598 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2601 .label
= "load printers",
2603 .p_class
= P_GLOBAL
,
2604 .ptr
= &Globals
.bLoadPrinters
,
2607 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2610 .label
= "printcap cache time",
2612 .p_class
= P_GLOBAL
,
2613 .ptr
= &Globals
.PrintcapCacheTime
,
2616 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2619 .label
= "printcap name",
2621 .p_class
= P_GLOBAL
,
2622 .ptr
= &Globals
.szPrintcapname
,
2625 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2628 .label
= "printcap",
2630 .p_class
= P_GLOBAL
,
2631 .ptr
= &Globals
.szPrintcapname
,
2637 .label
= "printable",
2640 .ptr
= &sDefault
.bPrint_ok
,
2643 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2646 .label
= "print ok",
2649 .ptr
= &sDefault
.bPrint_ok
,
2655 .label
= "printing",
2658 .ptr
= &sDefault
.iPrinting
,
2659 .special
= handle_printing
,
2660 .enum_list
= enum_printing
,
2661 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2664 .label
= "cups options",
2667 .ptr
= &sDefault
.szCupsOptions
,
2670 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2673 .label
= "cups server",
2675 .p_class
= P_GLOBAL
,
2676 .ptr
= &Globals
.szCupsServer
,
2679 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2682 .label
= "cups encrypt",
2684 .p_class
= P_GLOBAL
,
2685 .ptr
= &Globals
.CupsEncrypt
,
2687 .enum_list
= enum_bool_auto
,
2688 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2692 .label
= "cups connection timeout",
2694 .p_class
= P_GLOBAL
,
2695 .ptr
= &Globals
.cups_connection_timeout
,
2698 .flags
= FLAG_ADVANCED
,
2701 .label
= "iprint server",
2703 .p_class
= P_GLOBAL
,
2704 .ptr
= &Globals
.szIPrintServer
,
2707 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2710 .label
= "print command",
2713 .ptr
= &sDefault
.szPrintcommand
,
2716 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2719 .label
= "disable spoolss",
2721 .p_class
= P_GLOBAL
,
2722 .ptr
= &Globals
.bDisableSpoolss
,
2725 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2728 .label
= "enable spoolss",
2730 .p_class
= P_GLOBAL
,
2731 .ptr
= &Globals
.bDisableSpoolss
,
2737 .label
= "lpq command",
2740 .ptr
= &sDefault
.szLpqcommand
,
2743 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2746 .label
= "lprm command",
2749 .ptr
= &sDefault
.szLprmcommand
,
2752 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2755 .label
= "lppause command",
2758 .ptr
= &sDefault
.szLppausecommand
,
2761 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2764 .label
= "lpresume command",
2767 .ptr
= &sDefault
.szLpresumecommand
,
2770 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2773 .label
= "queuepause command",
2776 .ptr
= &sDefault
.szQueuepausecommand
,
2779 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2782 .label
= "queueresume command",
2785 .ptr
= &sDefault
.szQueueresumecommand
,
2788 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2791 .label
= "addport command",
2793 .p_class
= P_GLOBAL
,
2794 .ptr
= &Globals
.szAddPortCommand
,
2797 .flags
= FLAG_ADVANCED
,
2800 .label
= "enumports command",
2802 .p_class
= P_GLOBAL
,
2803 .ptr
= &Globals
.szEnumPortsCommand
,
2806 .flags
= FLAG_ADVANCED
,
2809 .label
= "addprinter command",
2811 .p_class
= P_GLOBAL
,
2812 .ptr
= &Globals
.szAddPrinterCommand
,
2815 .flags
= FLAG_ADVANCED
,
2818 .label
= "deleteprinter command",
2820 .p_class
= P_GLOBAL
,
2821 .ptr
= &Globals
.szDeletePrinterCommand
,
2824 .flags
= FLAG_ADVANCED
,
2827 .label
= "show add printer wizard",
2829 .p_class
= P_GLOBAL
,
2830 .ptr
= &Globals
.bMsAddPrinterWizard
,
2833 .flags
= FLAG_ADVANCED
,
2836 .label
= "os2 driver map",
2838 .p_class
= P_GLOBAL
,
2839 .ptr
= &Globals
.szOs2DriverMap
,
2842 .flags
= FLAG_ADVANCED
,
2846 .label
= "printer name",
2849 .ptr
= &sDefault
.szPrintername
,
2852 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2858 .ptr
= &sDefault
.szPrintername
,
2864 .label
= "use client driver",
2867 .ptr
= &sDefault
.bUseClientDriver
,
2870 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2873 .label
= "default devmode",
2876 .ptr
= &sDefault
.bDefaultDevmode
,
2879 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2882 .label
= "force printername",
2885 .ptr
= &sDefault
.bForcePrintername
,
2888 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2891 .label
= "printjob username",
2894 .ptr
= &sDefault
.szPrintjobUsername
,
2897 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2900 {N_("Filename Handling"), P_SEP
, P_SEPARATOR
},
2903 .label
= "mangling method",
2905 .p_class
= P_GLOBAL
,
2906 .ptr
= &Globals
.szManglingMethod
,
2909 .flags
= FLAG_ADVANCED
,
2912 .label
= "mangle prefix",
2914 .p_class
= P_GLOBAL
,
2915 .ptr
= &Globals
.mangle_prefix
,
2918 .flags
= FLAG_ADVANCED
,
2922 .label
= "default case",
2925 .ptr
= &sDefault
.iDefaultCase
,
2927 .enum_list
= enum_case
,
2928 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2931 .label
= "case sensitive",
2934 .ptr
= &sDefault
.iCaseSensitive
,
2936 .enum_list
= enum_bool_auto
,
2937 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2940 .label
= "casesignames",
2943 .ptr
= &sDefault
.iCaseSensitive
,
2945 .enum_list
= enum_bool_auto
,
2946 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
| FLAG_HIDE
,
2949 .label
= "preserve case",
2952 .ptr
= &sDefault
.bCasePreserve
,
2955 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2958 .label
= "short preserve case",
2961 .ptr
= &sDefault
.bShortCasePreserve
,
2964 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2967 .label
= "mangling char",
2970 .ptr
= &sDefault
.magic_char
,
2973 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2976 .label
= "hide dot files",
2979 .ptr
= &sDefault
.bHideDotFiles
,
2982 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2985 .label
= "hide special files",
2988 .ptr
= &sDefault
.bHideSpecialFiles
,
2991 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2994 .label
= "hide unreadable",
2997 .ptr
= &sDefault
.bHideUnReadable
,
3000 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3003 .label
= "hide unwriteable files",
3006 .ptr
= &sDefault
.bHideUnWriteableFiles
,
3009 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3012 .label
= "delete veto files",
3015 .ptr
= &sDefault
.bDeleteVetoFiles
,
3018 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3021 .label
= "veto files",
3024 .ptr
= &sDefault
.szVetoFiles
,
3027 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3030 .label
= "hide files",
3033 .ptr
= &sDefault
.szHideFiles
,
3036 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3039 .label
= "veto oplock files",
3042 .ptr
= &sDefault
.szVetoOplockFiles
,
3045 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3048 .label
= "map archive",
3051 .ptr
= &sDefault
.bMap_archive
,
3054 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3057 .label
= "map hidden",
3060 .ptr
= &sDefault
.bMap_hidden
,
3063 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3066 .label
= "map system",
3069 .ptr
= &sDefault
.bMap_system
,
3072 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3075 .label
= "map readonly",
3078 .ptr
= &sDefault
.iMap_readonly
,
3080 .enum_list
= enum_map_readonly
,
3081 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3084 .label
= "mangled names",
3087 .ptr
= &sDefault
.bMangledNames
,
3090 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3093 .label
= "max stat cache size",
3095 .p_class
= P_GLOBAL
,
3096 .ptr
= &Globals
.iMaxStatCacheSize
,
3099 .flags
= FLAG_ADVANCED
,
3102 .label
= "stat cache",
3104 .p_class
= P_GLOBAL
,
3105 .ptr
= &Globals
.bStatCache
,
3108 .flags
= FLAG_ADVANCED
,
3111 .label
= "store dos attributes",
3114 .ptr
= &sDefault
.bStoreDosAttributes
,
3117 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3120 .label
= "dmapi support",
3123 .ptr
= &sDefault
.bDmapiSupport
,
3126 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3130 {N_("Domain Options"), P_SEP
, P_SEPARATOR
},
3133 .label
= "machine password timeout",
3135 .p_class
= P_GLOBAL
,
3136 .ptr
= &Globals
.machine_password_timeout
,
3139 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
3142 {N_("Logon Options"), P_SEP
, P_SEPARATOR
},
3145 .label
= "add user script",
3147 .p_class
= P_GLOBAL
,
3148 .ptr
= &Globals
.szAddUserScript
,
3151 .flags
= FLAG_ADVANCED
,
3154 .label
= "rename user script",
3156 .p_class
= P_GLOBAL
,
3157 .ptr
= &Globals
.szRenameUserScript
,
3160 .flags
= FLAG_ADVANCED
,
3163 .label
= "delete user script",
3165 .p_class
= P_GLOBAL
,
3166 .ptr
= &Globals
.szDelUserScript
,
3169 .flags
= FLAG_ADVANCED
,
3172 .label
= "add group script",
3174 .p_class
= P_GLOBAL
,
3175 .ptr
= &Globals
.szAddGroupScript
,
3178 .flags
= FLAG_ADVANCED
,
3181 .label
= "delete group script",
3183 .p_class
= P_GLOBAL
,
3184 .ptr
= &Globals
.szDelGroupScript
,
3187 .flags
= FLAG_ADVANCED
,
3190 .label
= "add user to group script",
3192 .p_class
= P_GLOBAL
,
3193 .ptr
= &Globals
.szAddUserToGroupScript
,
3196 .flags
= FLAG_ADVANCED
,
3199 .label
= "delete user from group script",
3201 .p_class
= P_GLOBAL
,
3202 .ptr
= &Globals
.szDelUserFromGroupScript
,
3205 .flags
= FLAG_ADVANCED
,
3208 .label
= "set primary group script",
3210 .p_class
= P_GLOBAL
,
3211 .ptr
= &Globals
.szSetPrimaryGroupScript
,
3214 .flags
= FLAG_ADVANCED
,
3217 .label
= "add machine script",
3219 .p_class
= P_GLOBAL
,
3220 .ptr
= &Globals
.szAddMachineScript
,
3223 .flags
= FLAG_ADVANCED
,
3226 .label
= "shutdown script",
3228 .p_class
= P_GLOBAL
,
3229 .ptr
= &Globals
.szShutdownScript
,
3232 .flags
= FLAG_ADVANCED
,
3235 .label
= "abort shutdown script",
3237 .p_class
= P_GLOBAL
,
3238 .ptr
= &Globals
.szAbortShutdownScript
,
3241 .flags
= FLAG_ADVANCED
,
3244 .label
= "username map script",
3246 .p_class
= P_GLOBAL
,
3247 .ptr
= &Globals
.szUsernameMapScript
,
3250 .flags
= FLAG_ADVANCED
,
3253 .label
= "logon script",
3255 .p_class
= P_GLOBAL
,
3256 .ptr
= &Globals
.szLogonScript
,
3259 .flags
= FLAG_ADVANCED
,
3262 .label
= "logon path",
3264 .p_class
= P_GLOBAL
,
3265 .ptr
= &Globals
.szLogonPath
,
3268 .flags
= FLAG_ADVANCED
,
3271 .label
= "logon drive",
3273 .p_class
= P_GLOBAL
,
3274 .ptr
= &Globals
.szLogonDrive
,
3277 .flags
= FLAG_ADVANCED
,
3280 .label
= "logon home",
3282 .p_class
= P_GLOBAL
,
3283 .ptr
= &Globals
.szLogonHome
,
3286 .flags
= FLAG_ADVANCED
,
3289 .label
= "domain logons",
3291 .p_class
= P_GLOBAL
,
3292 .ptr
= &Globals
.bDomainLogons
,
3295 .flags
= FLAG_ADVANCED
,
3299 .label
= "init logon delayed hosts",
3301 .p_class
= P_GLOBAL
,
3302 .ptr
= &Globals
.szInitLogonDelayedHosts
,
3305 .flags
= FLAG_ADVANCED
,
3309 .label
= "init logon delay",
3311 .p_class
= P_GLOBAL
,
3312 .ptr
= &Globals
.InitLogonDelay
,
3315 .flags
= FLAG_ADVANCED
,
3319 {N_("Browse Options"), P_SEP
, P_SEPARATOR
},
3322 .label
= "os level",
3324 .p_class
= P_GLOBAL
,
3325 .ptr
= &Globals
.os_level
,
3328 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3331 .label
= "lm announce",
3333 .p_class
= P_GLOBAL
,
3334 .ptr
= &Globals
.lm_announce
,
3336 .enum_list
= enum_bool_auto
,
3337 .flags
= FLAG_ADVANCED
,
3340 .label
= "lm interval",
3342 .p_class
= P_GLOBAL
,
3343 .ptr
= &Globals
.lm_interval
,
3346 .flags
= FLAG_ADVANCED
,
3349 .label
= "preferred master",
3351 .p_class
= P_GLOBAL
,
3352 .ptr
= &Globals
.iPreferredMaster
,
3354 .enum_list
= enum_bool_auto
,
3355 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3358 .label
= "prefered master",
3360 .p_class
= P_GLOBAL
,
3361 .ptr
= &Globals
.iPreferredMaster
,
3363 .enum_list
= enum_bool_auto
,
3367 .label
= "local master",
3369 .p_class
= P_GLOBAL
,
3370 .ptr
= &Globals
.bLocalMaster
,
3373 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3376 .label
= "domain master",
3378 .p_class
= P_GLOBAL
,
3379 .ptr
= &Globals
.iDomainMaster
,
3381 .enum_list
= enum_bool_auto
,
3382 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3385 .label
= "browse list",
3387 .p_class
= P_GLOBAL
,
3388 .ptr
= &Globals
.bBrowseList
,
3391 .flags
= FLAG_ADVANCED
,
3394 .label
= "browseable",
3397 .ptr
= &sDefault
.bBrowseable
,
3400 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
3403 .label
= "browsable",
3406 .ptr
= &sDefault
.bBrowseable
,
3412 .label
= "access based share enum",
3415 .ptr
= &sDefault
.bAccessBasedShareEnum
,
3418 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
3421 .label
= "enhanced browsing",
3423 .p_class
= P_GLOBAL
,
3424 .ptr
= &Globals
.enhanced_browsing
,
3427 .flags
= FLAG_ADVANCED
,
3430 {N_("WINS Options"), P_SEP
, P_SEPARATOR
},
3433 .label
= "dns proxy",
3435 .p_class
= P_GLOBAL
,
3436 .ptr
= &Globals
.bDNSproxy
,
3439 .flags
= FLAG_ADVANCED
,
3442 .label
= "wins proxy",
3444 .p_class
= P_GLOBAL
,
3445 .ptr
= &Globals
.bWINSproxy
,
3448 .flags
= FLAG_ADVANCED
,
3451 .label
= "wins server",
3453 .p_class
= P_GLOBAL
,
3454 .ptr
= &Globals
.szWINSservers
,
3457 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
3460 .label
= "wins support",
3462 .p_class
= P_GLOBAL
,
3463 .ptr
= &Globals
.bWINSsupport
,
3466 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
3469 .label
= "wins hook",
3471 .p_class
= P_GLOBAL
,
3472 .ptr
= &Globals
.szWINSHook
,
3475 .flags
= FLAG_ADVANCED
,
3478 {N_("Locking Options"), P_SEP
, P_SEPARATOR
},
3481 .label
= "blocking locks",
3484 .ptr
= &sDefault
.bBlockingLocks
,
3487 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3490 .label
= "csc policy",
3493 .ptr
= &sDefault
.iCSCPolicy
,
3495 .enum_list
= enum_csc_policy
,
3496 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3499 .label
= "fake oplocks",
3502 .ptr
= &sDefault
.bFakeOplocks
,
3505 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
3508 .label
= "kernel oplocks",
3510 .p_class
= P_GLOBAL
,
3511 .ptr
= &Globals
.bKernelOplocks
,
3514 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3520 .ptr
= &sDefault
.bLocking
,
3523 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3526 .label
= "lock spin time",
3528 .p_class
= P_GLOBAL
,
3529 .ptr
= &Globals
.iLockSpinTime
,
3532 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3538 .ptr
= &sDefault
.bOpLocks
,
3541 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3544 .label
= "level2 oplocks",
3547 .ptr
= &sDefault
.bLevel2OpLocks
,
3550 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3553 .label
= "oplock break wait time",
3555 .p_class
= P_GLOBAL
,
3556 .ptr
= &Globals
.oplock_break_wait_time
,
3559 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3562 .label
= "oplock contention limit",
3565 .ptr
= &sDefault
.iOplockContentionLimit
,
3568 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3571 .label
= "posix locking",
3574 .ptr
= &sDefault
.bPosixLocking
,
3577 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3580 .label
= "strict locking",
3583 .ptr
= &sDefault
.iStrictLocking
,
3585 .enum_list
= enum_bool_auto
,
3586 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3589 .label
= "share modes",
3592 .ptr
= &sDefault
.bShareModes
,
3595 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DEPRECATED
,
3598 {N_("Ldap Options"), P_SEP
, P_SEPARATOR
},
3601 .label
= "ldap admin dn",
3603 .p_class
= P_GLOBAL
,
3604 .ptr
= &Globals
.szLdapAdminDn
,
3607 .flags
= FLAG_ADVANCED
,
3610 .label
= "ldap delete dn",
3612 .p_class
= P_GLOBAL
,
3613 .ptr
= &Globals
.ldap_delete_dn
,
3616 .flags
= FLAG_ADVANCED
,
3619 .label
= "ldap group suffix",
3621 .p_class
= P_GLOBAL
,
3622 .ptr
= &Globals
.szLdapGroupSuffix
,
3625 .flags
= FLAG_ADVANCED
,
3628 .label
= "ldap idmap suffix",
3630 .p_class
= P_GLOBAL
,
3631 .ptr
= &Globals
.szLdapIdmapSuffix
,
3634 .flags
= FLAG_ADVANCED
,
3637 .label
= "ldap machine suffix",
3639 .p_class
= P_GLOBAL
,
3640 .ptr
= &Globals
.szLdapMachineSuffix
,
3643 .flags
= FLAG_ADVANCED
,
3646 .label
= "ldap passwd sync",
3648 .p_class
= P_GLOBAL
,
3649 .ptr
= &Globals
.ldap_passwd_sync
,
3651 .enum_list
= enum_ldap_passwd_sync
,
3652 .flags
= FLAG_ADVANCED
,
3655 .label
= "ldap password sync",
3657 .p_class
= P_GLOBAL
,
3658 .ptr
= &Globals
.ldap_passwd_sync
,
3660 .enum_list
= enum_ldap_passwd_sync
,
3664 .label
= "ldap replication sleep",
3666 .p_class
= P_GLOBAL
,
3667 .ptr
= &Globals
.ldap_replication_sleep
,
3670 .flags
= FLAG_ADVANCED
,
3673 .label
= "ldap suffix",
3675 .p_class
= P_GLOBAL
,
3676 .ptr
= &Globals
.szLdapSuffix
,
3679 .flags
= FLAG_ADVANCED
,
3682 .label
= "ldap ssl",
3684 .p_class
= P_GLOBAL
,
3685 .ptr
= &Globals
.ldap_ssl
,
3687 .enum_list
= enum_ldap_ssl
,
3688 .flags
= FLAG_ADVANCED
,
3691 .label
= "ldap ssl ads",
3693 .p_class
= P_GLOBAL
,
3694 .ptr
= &Globals
.ldap_ssl_ads
,
3697 .flags
= FLAG_ADVANCED
,
3700 .label
= "ldap deref",
3702 .p_class
= P_GLOBAL
,
3703 .ptr
= &Globals
.ldap_deref
,
3705 .enum_list
= enum_ldap_deref
,
3706 .flags
= FLAG_ADVANCED
,
3709 .label
= "ldap follow referral",
3711 .p_class
= P_GLOBAL
,
3712 .ptr
= &Globals
.ldap_follow_referral
,
3714 .enum_list
= enum_bool_auto
,
3715 .flags
= FLAG_ADVANCED
,
3718 .label
= "ldap timeout",
3720 .p_class
= P_GLOBAL
,
3721 .ptr
= &Globals
.ldap_timeout
,
3724 .flags
= FLAG_ADVANCED
,
3727 .label
= "ldap connection timeout",
3729 .p_class
= P_GLOBAL
,
3730 .ptr
= &Globals
.ldap_connection_timeout
,
3733 .flags
= FLAG_ADVANCED
,
3736 .label
= "ldap page size",
3738 .p_class
= P_GLOBAL
,
3739 .ptr
= &Globals
.ldap_page_size
,
3742 .flags
= FLAG_ADVANCED
,
3745 .label
= "ldap user suffix",
3747 .p_class
= P_GLOBAL
,
3748 .ptr
= &Globals
.szLdapUserSuffix
,
3751 .flags
= FLAG_ADVANCED
,
3754 .label
= "ldap debug level",
3756 .p_class
= P_GLOBAL
,
3757 .ptr
= &Globals
.ldap_debug_level
,
3758 .special
= handle_ldap_debug_level
,
3760 .flags
= FLAG_ADVANCED
,
3763 .label
= "ldap debug threshold",
3765 .p_class
= P_GLOBAL
,
3766 .ptr
= &Globals
.ldap_debug_threshold
,
3769 .flags
= FLAG_ADVANCED
,
3772 {N_("EventLog Options"), P_SEP
, P_SEPARATOR
},
3775 .label
= "eventlog list",
3777 .p_class
= P_GLOBAL
,
3778 .ptr
= &Globals
.szEventLogs
,
3781 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
3784 {N_("Miscellaneous Options"), P_SEP
, P_SEPARATOR
},
3787 .label
= "add share command",
3789 .p_class
= P_GLOBAL
,
3790 .ptr
= &Globals
.szAddShareCommand
,
3793 .flags
= FLAG_ADVANCED
,
3796 .label
= "change share command",
3798 .p_class
= P_GLOBAL
,
3799 .ptr
= &Globals
.szChangeShareCommand
,
3802 .flags
= FLAG_ADVANCED
,
3805 .label
= "delete share command",
3807 .p_class
= P_GLOBAL
,
3808 .ptr
= &Globals
.szDeleteShareCommand
,
3811 .flags
= FLAG_ADVANCED
,
3814 .label
= "config file",
3816 .p_class
= P_GLOBAL
,
3817 .ptr
= &Globals
.szConfigFile
,
3820 .flags
= FLAG_HIDE
|FLAG_META
,
3825 .p_class
= P_GLOBAL
,
3826 .ptr
= &Globals
.szAutoServices
,
3829 .flags
= FLAG_ADVANCED
,
3832 .label
= "auto services",
3834 .p_class
= P_GLOBAL
,
3835 .ptr
= &Globals
.szAutoServices
,
3838 .flags
= FLAG_ADVANCED
,
3841 .label
= "lock directory",
3843 .p_class
= P_GLOBAL
,
3844 .ptr
= &Globals
.szLockDir
,
3847 .flags
= FLAG_ADVANCED
,
3850 .label
= "lock dir",
3852 .p_class
= P_GLOBAL
,
3853 .ptr
= &Globals
.szLockDir
,
3859 .label
= "state directory",
3861 .p_class
= P_GLOBAL
,
3862 .ptr
= &Globals
.szStateDir
,
3865 .flags
= FLAG_ADVANCED
,
3868 .label
= "cache directory",
3870 .p_class
= P_GLOBAL
,
3871 .ptr
= &Globals
.szCacheDir
,
3874 .flags
= FLAG_ADVANCED
,
3877 .label
= "pid directory",
3879 .p_class
= P_GLOBAL
,
3880 .ptr
= &Globals
.szPidDir
,
3883 .flags
= FLAG_ADVANCED
,
3887 .label
= "utmp directory",
3889 .p_class
= P_GLOBAL
,
3890 .ptr
= &Globals
.szUtmpDir
,
3893 .flags
= FLAG_ADVANCED
,
3896 .label
= "wtmp directory",
3898 .p_class
= P_GLOBAL
,
3899 .ptr
= &Globals
.szWtmpDir
,
3902 .flags
= FLAG_ADVANCED
,
3907 .p_class
= P_GLOBAL
,
3908 .ptr
= &Globals
.bUtmp
,
3911 .flags
= FLAG_ADVANCED
,
3915 .label
= "default service",
3917 .p_class
= P_GLOBAL
,
3918 .ptr
= &Globals
.szDefaultService
,
3921 .flags
= FLAG_ADVANCED
,
3926 .p_class
= P_GLOBAL
,
3927 .ptr
= &Globals
.szDefaultService
,
3930 .flags
= FLAG_ADVANCED
,
3933 .label
= "message command",
3935 .p_class
= P_GLOBAL
,
3936 .ptr
= &Globals
.szMsgCommand
,
3939 .flags
= FLAG_ADVANCED
,
3942 .label
= "dfree cache time",
3945 .ptr
= &sDefault
.iDfreeCacheTime
,
3948 .flags
= FLAG_ADVANCED
,
3951 .label
= "dfree command",
3954 .ptr
= &sDefault
.szDfree
,
3957 .flags
= FLAG_ADVANCED
,
3960 .label
= "get quota command",
3962 .p_class
= P_GLOBAL
,
3963 .ptr
= &Globals
.szGetQuota
,
3966 .flags
= FLAG_ADVANCED
,
3969 .label
= "set quota command",
3971 .p_class
= P_GLOBAL
,
3972 .ptr
= &Globals
.szSetQuota
,
3975 .flags
= FLAG_ADVANCED
,
3978 .label
= "remote announce",
3980 .p_class
= P_GLOBAL
,
3981 .ptr
= &Globals
.szRemoteAnnounce
,
3984 .flags
= FLAG_ADVANCED
,
3987 .label
= "remote browse sync",
3989 .p_class
= P_GLOBAL
,
3990 .ptr
= &Globals
.szRemoteBrowseSync
,
3993 .flags
= FLAG_ADVANCED
,
3996 .label
= "socket address",
3998 .p_class
= P_GLOBAL
,
3999 .ptr
= &Globals
.szSocketAddress
,
4002 .flags
= FLAG_ADVANCED
,
4005 .label
= "nmbd bind explicit broadcast",
4007 .p_class
= P_GLOBAL
,
4008 .ptr
= &Globals
.bNmbdBindExplicitBroadcast
,
4011 .flags
= FLAG_ADVANCED
,
4014 .label
= "homedir map",
4016 .p_class
= P_GLOBAL
,
4017 .ptr
= &Globals
.szNISHomeMapName
,
4020 .flags
= FLAG_ADVANCED
,
4023 .label
= "afs username map",
4025 .p_class
= P_GLOBAL
,
4026 .ptr
= &Globals
.szAfsUsernameMap
,
4029 .flags
= FLAG_ADVANCED
,
4032 .label
= "afs token lifetime",
4034 .p_class
= P_GLOBAL
,
4035 .ptr
= &Globals
.iAfsTokenLifetime
,
4038 .flags
= FLAG_ADVANCED
,
4041 .label
= "log nt token command",
4043 .p_class
= P_GLOBAL
,
4044 .ptr
= &Globals
.szLogNtTokenCommand
,
4047 .flags
= FLAG_ADVANCED
,
4050 .label
= "time offset",
4052 .p_class
= P_GLOBAL
,
4053 .ptr
= &extra_time_offset
,
4056 .flags
= FLAG_ADVANCED
,
4059 .label
= "NIS homedir",
4061 .p_class
= P_GLOBAL
,
4062 .ptr
= &Globals
.bNISHomeMap
,
4065 .flags
= FLAG_ADVANCED
,
4071 .ptr
= &sDefault
.valid
,
4080 .ptr
= &sDefault
.szCopy
,
4081 .special
= handle_copy
,
4089 .ptr
= &sDefault
.szInclude
,
4090 .special
= handle_include
,
4092 .flags
= FLAG_HIDE
|FLAG_META
,
4098 .ptr
= &sDefault
.szPreExec
,
4101 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4107 .ptr
= &sDefault
.szPreExec
,
4110 .flags
= FLAG_ADVANCED
,
4113 .label
= "preexec close",
4116 .ptr
= &sDefault
.bPreexecClose
,
4119 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4122 .label
= "postexec",
4125 .ptr
= &sDefault
.szPostExec
,
4128 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4131 .label
= "root preexec",
4134 .ptr
= &sDefault
.szRootPreExec
,
4137 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4140 .label
= "root preexec close",
4143 .ptr
= &sDefault
.bRootpreexecClose
,
4146 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4149 .label
= "root postexec",
4152 .ptr
= &sDefault
.szRootPostExec
,
4155 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4158 .label
= "available",
4161 .ptr
= &sDefault
.bAvailable
,
4164 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4167 .label
= "registry shares",
4169 .p_class
= P_GLOBAL
,
4170 .ptr
= &Globals
.bRegistryShares
,
4173 .flags
= FLAG_ADVANCED
,
4176 .label
= "usershare allow guests",
4178 .p_class
= P_GLOBAL
,
4179 .ptr
= &Globals
.bUsershareAllowGuests
,
4182 .flags
= FLAG_ADVANCED
,
4185 .label
= "usershare max shares",
4187 .p_class
= P_GLOBAL
,
4188 .ptr
= &Globals
.iUsershareMaxShares
,
4191 .flags
= FLAG_ADVANCED
,
4194 .label
= "usershare owner only",
4196 .p_class
= P_GLOBAL
,
4197 .ptr
= &Globals
.bUsershareOwnerOnly
,
4200 .flags
= FLAG_ADVANCED
,
4203 .label
= "usershare path",
4205 .p_class
= P_GLOBAL
,
4206 .ptr
= &Globals
.szUsersharePath
,
4209 .flags
= FLAG_ADVANCED
,
4212 .label
= "usershare prefix allow list",
4214 .p_class
= P_GLOBAL
,
4215 .ptr
= &Globals
.szUsersharePrefixAllowList
,
4218 .flags
= FLAG_ADVANCED
,
4221 .label
= "usershare prefix deny list",
4223 .p_class
= P_GLOBAL
,
4224 .ptr
= &Globals
.szUsersharePrefixDenyList
,
4227 .flags
= FLAG_ADVANCED
,
4230 .label
= "usershare template share",
4232 .p_class
= P_GLOBAL
,
4233 .ptr
= &Globals
.szUsershareTemplateShare
,
4236 .flags
= FLAG_ADVANCED
,
4242 .ptr
= &sDefault
.volume
,
4245 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4251 .ptr
= &sDefault
.fstype
,
4254 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4257 .label
= "set directory",
4260 .ptr
= &sDefault
.bNo_set_dir
,
4263 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4266 .label
= "wide links",
4269 .ptr
= &sDefault
.bWidelinks
,
4272 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4275 .label
= "follow symlinks",
4278 .ptr
= &sDefault
.bSymlinks
,
4281 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4284 .label
= "dont descend",
4287 .ptr
= &sDefault
.szDontdescend
,
4290 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4293 .label
= "magic script",
4296 .ptr
= &sDefault
.szMagicScript
,
4299 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4302 .label
= "magic output",
4305 .ptr
= &sDefault
.szMagicOutput
,
4308 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4311 .label
= "delete readonly",
4314 .ptr
= &sDefault
.bDeleteReadonly
,
4317 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4320 .label
= "dos filemode",
4323 .ptr
= &sDefault
.bDosFilemode
,
4326 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4329 .label
= "dos filetimes",
4332 .ptr
= &sDefault
.bDosFiletimes
,
4335 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4338 .label
= "dos filetime resolution",
4341 .ptr
= &sDefault
.bDosFiletimeResolution
,
4344 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4347 .label
= "fake directory create times",
4350 .ptr
= &sDefault
.bFakeDirCreateTimes
,
4353 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
4356 .label
= "panic action",
4358 .p_class
= P_GLOBAL
,
4359 .ptr
= &Globals
.szPanicAction
,
4362 .flags
= FLAG_ADVANCED
,
4365 .label
= "perfcount module",
4367 .p_class
= P_GLOBAL
,
4368 .ptr
= &Globals
.szSMBPerfcountModule
,
4371 .flags
= FLAG_ADVANCED
,
4374 {N_("VFS module options"), P_SEP
, P_SEPARATOR
},
4377 .label
= "vfs objects",
4380 .ptr
= &sDefault
.szVfsObjects
,
4383 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4386 .label
= "vfs object",
4389 .ptr
= &sDefault
.szVfsObjects
,
4396 {N_("MSDFS options"), P_SEP
, P_SEPARATOR
},
4399 .label
= "msdfs root",
4402 .ptr
= &sDefault
.bMSDfsRoot
,
4405 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4408 .label
= "msdfs proxy",
4411 .ptr
= &sDefault
.szMSDfsProxy
,
4414 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4417 .label
= "host msdfs",
4419 .p_class
= P_GLOBAL
,
4420 .ptr
= &Globals
.bHostMSDfs
,
4423 .flags
= FLAG_ADVANCED
,
4426 {N_("Winbind options"), P_SEP
, P_SEPARATOR
},
4429 .label
= "passdb expand explicit",
4431 .p_class
= P_GLOBAL
,
4432 .ptr
= &Globals
.bPassdbExpandExplicit
,
4435 .flags
= FLAG_ADVANCED
,
4438 .label
= "idmap backend",
4440 .p_class
= P_GLOBAL
,
4441 .ptr
= &Globals
.szIdmapBackend
,
4444 .flags
= FLAG_ADVANCED
,
4447 .label
= "idmap alloc backend",
4449 .p_class
= P_GLOBAL
,
4450 .ptr
= &Globals
.szIdmapAllocBackend
,
4453 .flags
= FLAG_ADVANCED
,
4456 .label
= "idmap cache time",
4458 .p_class
= P_GLOBAL
,
4459 .ptr
= &Globals
.iIdmapCacheTime
,
4462 .flags
= FLAG_ADVANCED
,
4465 .label
= "idmap negative cache time",
4467 .p_class
= P_GLOBAL
,
4468 .ptr
= &Globals
.iIdmapNegativeCacheTime
,
4471 .flags
= FLAG_ADVANCED
,
4474 .label
= "idmap uid",
4476 .p_class
= P_GLOBAL
,
4477 .ptr
= &Globals
.szIdmapUID
,
4478 .special
= handle_idmap_uid
,
4480 .flags
= FLAG_ADVANCED
,
4483 .label
= "winbind uid",
4485 .p_class
= P_GLOBAL
,
4486 .ptr
= &Globals
.szIdmapUID
,
4487 .special
= handle_idmap_uid
,
4492 .label
= "idmap gid",
4494 .p_class
= P_GLOBAL
,
4495 .ptr
= &Globals
.szIdmapGID
,
4496 .special
= handle_idmap_gid
,
4498 .flags
= FLAG_ADVANCED
,
4501 .label
= "winbind gid",
4503 .p_class
= P_GLOBAL
,
4504 .ptr
= &Globals
.szIdmapGID
,
4505 .special
= handle_idmap_gid
,
4510 .label
= "template homedir",
4512 .p_class
= P_GLOBAL
,
4513 .ptr
= &Globals
.szTemplateHomedir
,
4516 .flags
= FLAG_ADVANCED
,
4519 .label
= "template shell",
4521 .p_class
= P_GLOBAL
,
4522 .ptr
= &Globals
.szTemplateShell
,
4525 .flags
= FLAG_ADVANCED
,
4528 .label
= "winbind separator",
4530 .p_class
= P_GLOBAL
,
4531 .ptr
= &Globals
.szWinbindSeparator
,
4534 .flags
= FLAG_ADVANCED
,
4537 .label
= "winbind cache time",
4539 .p_class
= P_GLOBAL
,
4540 .ptr
= &Globals
.winbind_cache_time
,
4543 .flags
= FLAG_ADVANCED
,
4546 .label
= "winbind reconnect delay",
4548 .p_class
= P_GLOBAL
,
4549 .ptr
= &Globals
.winbind_reconnect_delay
,
4552 .flags
= FLAG_ADVANCED
,
4555 .label
= "winbind max clients",
4557 .p_class
= P_GLOBAL
,
4558 .ptr
= &Globals
.winbind_max_clients
,
4561 .flags
= FLAG_ADVANCED
,
4564 .label
= "winbind enum users",
4566 .p_class
= P_GLOBAL
,
4567 .ptr
= &Globals
.bWinbindEnumUsers
,
4570 .flags
= FLAG_ADVANCED
,
4573 .label
= "winbind enum groups",
4575 .p_class
= P_GLOBAL
,
4576 .ptr
= &Globals
.bWinbindEnumGroups
,
4579 .flags
= FLAG_ADVANCED
,
4582 .label
= "winbind use default domain",
4584 .p_class
= P_GLOBAL
,
4585 .ptr
= &Globals
.bWinbindUseDefaultDomain
,
4588 .flags
= FLAG_ADVANCED
,
4591 .label
= "winbind trusted domains only",
4593 .p_class
= P_GLOBAL
,
4594 .ptr
= &Globals
.bWinbindTrustedDomainsOnly
,
4597 .flags
= FLAG_ADVANCED
,
4600 .label
= "winbind nested groups",
4602 .p_class
= P_GLOBAL
,
4603 .ptr
= &Globals
.bWinbindNestedGroups
,
4606 .flags
= FLAG_ADVANCED
,
4609 .label
= "winbind expand groups",
4611 .p_class
= P_GLOBAL
,
4612 .ptr
= &Globals
.winbind_expand_groups
,
4615 .flags
= FLAG_ADVANCED
,
4618 .label
= "winbind nss info",
4620 .p_class
= P_GLOBAL
,
4621 .ptr
= &Globals
.szWinbindNssInfo
,
4624 .flags
= FLAG_ADVANCED
,
4627 .label
= "winbind refresh tickets",
4629 .p_class
= P_GLOBAL
,
4630 .ptr
= &Globals
.bWinbindRefreshTickets
,
4633 .flags
= FLAG_ADVANCED
,
4636 .label
= "winbind offline logon",
4638 .p_class
= P_GLOBAL
,
4639 .ptr
= &Globals
.bWinbindOfflineLogon
,
4642 .flags
= FLAG_ADVANCED
,
4645 .label
= "winbind normalize names",
4647 .p_class
= P_GLOBAL
,
4648 .ptr
= &Globals
.bWinbindNormalizeNames
,
4651 .flags
= FLAG_ADVANCED
,
4654 .label
= "winbind rpc only",
4656 .p_class
= P_GLOBAL
,
4657 .ptr
= &Globals
.bWinbindRpcOnly
,
4660 .flags
= FLAG_ADVANCED
,
4663 .label
= "create krb5 conf",
4665 .p_class
= P_GLOBAL
,
4666 .ptr
= &Globals
.bCreateKrb5Conf
,
4669 .flags
= FLAG_ADVANCED
,
4672 {NULL
, P_BOOL
, P_NONE
, NULL
, NULL
, NULL
, 0}
4675 /***************************************************************************
4676 Initialise the sDefault parameter structure for the printer values.
4677 ***************************************************************************/
4679 static void init_printer_values(struct service
*pService
)
4681 /* choose defaults depending on the type of printing */
4682 switch (pService
->iPrinting
) {
4687 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4688 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4689 string_set(&pService
->szPrintcommand
, "lpr -r -P'%p' %s");
4694 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4695 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4696 string_set(&pService
->szPrintcommand
, "lpr -r -P'%p' %s");
4697 string_set(&pService
->szQueuepausecommand
, "lpc stop '%p'");
4698 string_set(&pService
->szQueueresumecommand
, "lpc start '%p'");
4699 string_set(&pService
->szLppausecommand
, "lpc hold '%p' %j");
4700 string_set(&pService
->szLpresumecommand
, "lpc release '%p' %j");
4706 /* set the lpq command to contain the destination printer
4707 name only. This is used by cups_queue_get() */
4708 string_set(&pService
->szLpqcommand
, "%p");
4709 string_set(&pService
->szLprmcommand
, "");
4710 string_set(&pService
->szPrintcommand
, "");
4711 string_set(&pService
->szLppausecommand
, "");
4712 string_set(&pService
->szLpresumecommand
, "");
4713 string_set(&pService
->szQueuepausecommand
, "");
4714 string_set(&pService
->szQueueresumecommand
, "");
4716 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4717 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4718 string_set(&pService
->szPrintcommand
, "lpr -P'%p' %s; rm %s");
4719 string_set(&pService
->szLppausecommand
, "lp -i '%p-%j' -H hold");
4720 string_set(&pService
->szLpresumecommand
, "lp -i '%p-%j' -H resume");
4721 string_set(&pService
->szQueuepausecommand
, "disable '%p'");
4722 string_set(&pService
->szQueueresumecommand
, "enable '%p'");
4723 #endif /* HAVE_CUPS */
4728 string_set(&pService
->szLpqcommand
, "lpstat -o%p");
4729 string_set(&pService
->szLprmcommand
, "cancel %p-%j");
4730 string_set(&pService
->szPrintcommand
, "lp -c -d%p %s; rm %s");
4731 string_set(&pService
->szQueuepausecommand
, "disable %p");
4732 string_set(&pService
->szQueueresumecommand
, "enable %p");
4734 string_set(&pService
->szLppausecommand
, "lp -i %p-%j -H hold");
4735 string_set(&pService
->szLpresumecommand
, "lp -i %p-%j -H resume");
4740 string_set(&pService
->szLpqcommand
, "lpq -P%p");
4741 string_set(&pService
->szLprmcommand
, "lprm -P%p %j");
4742 string_set(&pService
->szPrintcommand
, "lp -r -P%p %s");
4748 string_set(&pService
->szPrintcommand
, "vlp print %p %s");
4749 string_set(&pService
->szLpqcommand
, "vlp lpq %p");
4750 string_set(&pService
->szLprmcommand
, "vlp lprm %p %j");
4751 string_set(&pService
->szLppausecommand
, "vlp lppause %p %j");
4752 string_set(&pService
->szLpresumecommand
, "vlp lpresume %p %j");
4753 string_set(&pService
->szQueuepausecommand
, "vlp queuepause %p");
4754 string_set(&pService
->szQueueresumecommand
, "vlp queueresume %p");
4756 #endif /* DEVELOPER */
4761 * Function to return the default value for the maximum number of open
4762 * file descriptors permitted. This function tries to consult the
4763 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4764 * the smaller of those.
4766 static int max_open_files(void)
4768 int sysctl_max
= MAX_OPEN_FILES
;
4769 int rlimit_max
= MAX_OPEN_FILES
;
4771 #ifdef HAVE_SYSCTLBYNAME
4773 size_t size
= sizeof(sysctl_max
);
4774 sysctlbyname("kern.maxfilesperproc", &sysctl_max
, &size
, NULL
,
4779 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4785 if (getrlimit(RLIMIT_NOFILE
, &rl
) == 0)
4786 rlimit_max
= rl
.rlim_cur
;
4788 #if defined(RLIM_INFINITY)
4789 if(rl
.rlim_cur
== RLIM_INFINITY
)
4790 rlimit_max
= MAX_OPEN_FILES
;
4795 if (sysctl_max
< MIN_OPEN_FILES_WINDOWS
) {
4796 DEBUG(2,("max_open_files: increasing sysctl_max (%d) to "
4797 "minimum Windows limit (%d)\n",
4799 MIN_OPEN_FILES_WINDOWS
));
4800 sysctl_max
= MIN_OPEN_FILES_WINDOWS
;
4803 if (rlimit_max
< MIN_OPEN_FILES_WINDOWS
) {
4804 DEBUG(2,("rlimit_max: increasing rlimit_max (%d) to "
4805 "minimum Windows limit (%d)\n",
4807 MIN_OPEN_FILES_WINDOWS
));
4808 rlimit_max
= MIN_OPEN_FILES_WINDOWS
;
4811 return MIN(sysctl_max
, rlimit_max
);
4815 * Common part of freeing allocated data for one parameter.
4817 static void free_one_parameter_common(void *parm_ptr
,
4818 struct parm_struct parm
)
4820 if ((parm
.type
== P_STRING
) ||
4821 (parm
.type
== P_USTRING
))
4823 string_free((char**)parm_ptr
);
4824 } else if (parm
.type
== P_LIST
) {
4825 TALLOC_FREE(*((char***)parm_ptr
));
4830 * Free the allocated data for one parameter for a share
4831 * given as a service struct.
4833 static void free_one_parameter(struct service
*service
,
4834 struct parm_struct parm
)
4838 if (parm
.p_class
!= P_LOCAL
) {
4842 parm_ptr
= lp_local_ptr(service
, parm
.ptr
);
4844 free_one_parameter_common(parm_ptr
, parm
);
4848 * Free the allocated parameter data of a share given
4849 * as a service struct.
4851 static void free_parameters(struct service
*service
)
4855 for (i
=0; parm_table
[i
].label
; i
++) {
4856 free_one_parameter(service
, parm_table
[i
]);
4861 * Free the allocated data for one parameter for a given share
4862 * specified by an snum.
4864 static void free_one_parameter_by_snum(int snum
, struct parm_struct parm
)
4868 if (parm
.ptr
== NULL
) {
4873 parm_ptr
= parm
.ptr
;
4874 } else if (parm
.p_class
!= P_LOCAL
) {
4877 parm_ptr
= lp_local_ptr_by_snum(snum
, parm
.ptr
);
4880 free_one_parameter_common(parm_ptr
, parm
);
4884 * Free the allocated parameter data for a share specified
4887 static void free_parameters_by_snum(int snum
)
4891 for (i
=0; parm_table
[i
].label
; i
++) {
4892 free_one_parameter_by_snum(snum
, parm_table
[i
]);
4897 * Free the allocated global parameters.
4899 static void free_global_parameters(void)
4901 free_parameters_by_snum(GLOBAL_SECTION_SNUM
);
4904 /***************************************************************************
4905 Initialise the global parameter structure.
4906 ***************************************************************************/
4908 static void init_globals(bool first_time_only
)
4910 static bool done_init
= False
;
4914 /* If requested to initialize only once and we've already done it... */
4915 if (first_time_only
&& done_init
) {
4916 /* ... then we have nothing more to do */
4921 /* The logfile can be set before this is invoked. Free it if so. */
4922 if (Globals
.szLogFile
!= NULL
) {
4923 string_free(&Globals
.szLogFile
);
4924 Globals
.szLogFile
= NULL
;
4928 free_global_parameters();
4931 memset((void *)&Globals
, '\0', sizeof(Globals
));
4933 for (i
= 0; parm_table
[i
].label
; i
++) {
4934 if ((parm_table
[i
].type
== P_STRING
||
4935 parm_table
[i
].type
== P_USTRING
) &&
4938 string_set((char **)parm_table
[i
].ptr
, "");
4942 string_set(&sDefault
.fstype
, FSTYPE_STRING
);
4943 string_set(&sDefault
.szPrintjobUsername
, "%U");
4945 init_printer_values(&sDefault
);
4948 DEBUG(3, ("Initialising global parameters\n"));
4950 string_set(&Globals
.szSMBPasswdFile
, get_dyn_SMB_PASSWD_FILE());
4951 string_set(&Globals
.szPrivateDir
, get_dyn_PRIVATE_DIR());
4953 /* use the new 'hash2' method by default, with a prefix of 1 */
4954 string_set(&Globals
.szManglingMethod
, "hash2");
4955 Globals
.mangle_prefix
= 1;
4957 string_set(&Globals
.szGuestaccount
, GUEST_ACCOUNT
);
4959 /* using UTF8 by default allows us to support all chars */
4960 string_set(&Globals
.unix_charset
, DEFAULT_UNIX_CHARSET
);
4962 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
4963 /* If the system supports nl_langinfo(), try to grab the value
4964 from the user's locale */
4965 string_set(&Globals
.display_charset
, "LOCALE");
4967 string_set(&Globals
.display_charset
, DEFAULT_DISPLAY_CHARSET
);
4970 /* Use codepage 850 as a default for the dos character set */
4971 string_set(&Globals
.dos_charset
, DEFAULT_DOS_CHARSET
);
4974 * Allow the default PASSWD_CHAT to be overridden in local.h.
4976 string_set(&Globals
.szPasswdChat
, DEFAULT_PASSWD_CHAT
);
4978 set_global_myname(myhostname());
4979 string_set(&Globals
.szNetbiosName
,global_myname());
4981 set_global_myworkgroup(WORKGROUP
);
4982 string_set(&Globals
.szWorkgroup
, lp_workgroup());
4984 string_set(&Globals
.szPasswdProgram
, "");
4985 string_set(&Globals
.szLockDir
, get_dyn_LOCKDIR());
4986 string_set(&Globals
.szStateDir
, get_dyn_STATEDIR());
4987 string_set(&Globals
.szCacheDir
, get_dyn_CACHEDIR());
4988 string_set(&Globals
.szPidDir
, get_dyn_PIDDIR());
4989 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
4991 * By default support explicit binding to broadcast
4994 Globals
.bNmbdBindExplicitBroadcast
= true;
4996 if (asprintf(&s
, "Samba %s", samba_version_string()) < 0) {
4997 smb_panic("init_globals: ENOMEM");
4999 string_set(&Globals
.szServerString
, s
);
5001 if (asprintf(&s
, "%d.%d", DEFAULT_MAJOR_VERSION
,
5002 DEFAULT_MINOR_VERSION
) < 0) {
5003 smb_panic("init_globals: ENOMEM");
5005 string_set(&Globals
.szAnnounceVersion
, s
);
5008 string_set(&Globals
.szPanicAction
, "/bin/sleep 999999999");
5011 string_set(&Globals
.szSocketOptions
, DEFAULT_SOCKET_OPTIONS
);
5013 string_set(&Globals
.szLogonDrive
, "");
5014 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
5015 string_set(&Globals
.szLogonHome
, "\\\\%N\\%U");
5016 string_set(&Globals
.szLogonPath
, "\\\\%N\\%U\\profile");
5018 string_set(&Globals
.szNameResolveOrder
, "lmhosts wins host bcast");
5019 string_set(&Globals
.szPasswordServer
, "*");
5021 Globals
.AlgorithmicRidBase
= BASE_RID
;
5023 Globals
.bLoadPrinters
= True
;
5024 Globals
.PrintcapCacheTime
= 750; /* 12.5 minutes */
5026 Globals
.ConfigBackend
= config_backend
;
5028 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
5029 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
5030 Globals
.max_xmit
= 0x4104;
5031 Globals
.max_mux
= 50; /* This is *needed* for profile support. */
5032 Globals
.lpqcachetime
= 30; /* changed to handle large print servers better -- jerry */
5033 Globals
.bDisableSpoolss
= False
;
5034 Globals
.iMaxSmbdProcesses
= 0;/* no limit specified */
5035 Globals
.pwordlevel
= 0;
5036 Globals
.unamelevel
= 0;
5037 Globals
.deadtime
= 0;
5038 Globals
.getwd_cache
= true;
5039 Globals
.bLargeReadwrite
= True
;
5040 Globals
.max_log_size
= 5000;
5041 Globals
.max_open_files
= max_open_files();
5042 Globals
.open_files_db_hash_size
= SMB_OPEN_DATABASE_TDB_HASH_SIZE
;
5043 Globals
.maxprotocol
= PROTOCOL_NT1
;
5044 Globals
.minprotocol
= PROTOCOL_CORE
;
5045 Globals
.security
= SEC_USER
;
5046 Globals
.paranoid_server_security
= True
;
5047 Globals
.bEncryptPasswords
= True
;
5048 Globals
.bUpdateEncrypt
= False
;
5049 Globals
.clientSchannel
= Auto
;
5050 Globals
.serverSchannel
= Auto
;
5051 Globals
.bReadRaw
= True
;
5052 Globals
.bWriteRaw
= True
;
5053 Globals
.bNullPasswords
= False
;
5054 Globals
.bObeyPamRestrictions
= False
;
5056 Globals
.bSyslogOnly
= False
;
5057 Globals
.bTimestampLogs
= True
;
5058 string_set(&Globals
.szLogLevel
, "0");
5059 Globals
.bDebugPrefixTimestamp
= False
;
5060 Globals
.bDebugHiresTimestamp
= true;
5061 Globals
.bDebugPid
= False
;
5062 Globals
.bDebugUid
= False
;
5063 Globals
.bDebugClass
= False
;
5064 Globals
.bEnableCoreFiles
= True
;
5065 Globals
.max_ttl
= 60 * 60 * 24 * 3; /* 3 days default. */
5066 Globals
.max_wins_ttl
= 60 * 60 * 24 * 6; /* 6 days default. */
5067 Globals
.min_wins_ttl
= 60 * 60 * 6; /* 6 hours default. */
5068 Globals
.machine_password_timeout
= 60 * 60 * 24 * 7; /* 7 days default. */
5069 Globals
.lm_announce
= 2; /* = Auto: send only if LM clients found */
5070 Globals
.lm_interval
= 60;
5071 Globals
.announce_as
= ANNOUNCE_AS_NT_SERVER
;
5072 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
5073 Globals
.bNISHomeMap
= False
;
5074 #ifdef WITH_NISPLUS_HOME
5075 string_set(&Globals
.szNISHomeMapName
, "auto_home.org_dir");
5077 string_set(&Globals
.szNISHomeMapName
, "auto.home");
5080 Globals
.bTimeServer
= False
;
5081 Globals
.bBindInterfacesOnly
= False
;
5082 Globals
.bUnixPasswdSync
= False
;
5083 Globals
.bPamPasswordChange
= False
;
5084 Globals
.bPasswdChatDebug
= False
;
5085 Globals
.iPasswdChatTimeout
= 2; /* 2 second default. */
5086 Globals
.bNTPipeSupport
= True
; /* Do NT pipes by default. */
5087 Globals
.bNTStatusSupport
= True
; /* Use NT status by default. */
5088 Globals
.bStatCache
= True
; /* use stat cache by default */
5089 Globals
.iMaxStatCacheSize
= 256; /* 256k by default */
5090 Globals
.restrict_anonymous
= 0;
5091 Globals
.bClientLanManAuth
= False
; /* Do NOT use the LanMan hash if it is available */
5092 Globals
.bClientPlaintextAuth
= False
; /* Do NOT use a plaintext password even if is requested by the server */
5093 Globals
.bLanmanAuth
= False
; /* Do NOT use the LanMan hash, even if it is supplied */
5094 Globals
.bNTLMAuth
= True
; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
5095 Globals
.bClientNTLMv2Auth
= False
; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
5096 /* Note, that we will use NTLM2 session security (which is different), if it is available */
5098 Globals
.map_to_guest
= 0; /* By Default, "Never" */
5099 Globals
.oplock_break_wait_time
= 0; /* By Default, 0 msecs. */
5100 Globals
.enhanced_browsing
= true;
5101 Globals
.iLockSpinTime
= WINDOWS_MINIMUM_LOCK_TIMEOUT_MS
; /* msec. */
5102 #ifdef MMAP_BLACKLIST
5103 Globals
.bUseMmap
= False
;
5105 Globals
.bUseMmap
= True
;
5107 Globals
.bUnixExtensions
= True
;
5108 Globals
.bResetOnZeroVC
= False
;
5109 Globals
.bCreateKrb5Conf
= true;
5111 /* hostname lookups can be very expensive and are broken on
5112 a large number of sites (tridge) */
5113 Globals
.bHostnameLookups
= False
;
5115 string_set(&Globals
.szPassdbBackend
, "tdbsam");
5116 string_set(&Globals
.szLdapSuffix
, "");
5117 string_set(&Globals
.szLdapMachineSuffix
, "");
5118 string_set(&Globals
.szLdapUserSuffix
, "");
5119 string_set(&Globals
.szLdapGroupSuffix
, "");
5120 string_set(&Globals
.szLdapIdmapSuffix
, "");
5122 string_set(&Globals
.szLdapAdminDn
, "");
5123 Globals
.ldap_ssl
= LDAP_SSL_START_TLS
;
5124 Globals
.ldap_ssl_ads
= False
;
5125 Globals
.ldap_deref
= -1;
5126 Globals
.ldap_passwd_sync
= LDAP_PASSWD_SYNC_OFF
;
5127 Globals
.ldap_delete_dn
= False
;
5128 Globals
.ldap_replication_sleep
= 1000; /* wait 1 sec for replication */
5129 Globals
.ldap_follow_referral
= Auto
;
5130 Globals
.ldap_timeout
= LDAP_DEFAULT_TIMEOUT
;
5131 Globals
.ldap_connection_timeout
= LDAP_CONNECTION_DEFAULT_TIMEOUT
;
5132 Globals
.ldap_page_size
= LDAP_PAGE_SIZE
;
5134 Globals
.ldap_debug_level
= 0;
5135 Globals
.ldap_debug_threshold
= 10;
5137 /* This is what we tell the afs client. in reality we set the token
5138 * to never expire, though, when this runs out the afs client will
5139 * forget the token. Set to 0 to get NEVERDATE.*/
5140 Globals
.iAfsTokenLifetime
= 604800;
5141 Globals
.cups_connection_timeout
= CUPS_DEFAULT_CONNECTION_TIMEOUT
;
5143 /* these parameters are set to defaults that are more appropriate
5144 for the increasing samba install base:
5146 as a member of the workgroup, that will possibly become a
5147 _local_ master browser (lm = True). this is opposed to a forced
5148 local master browser startup (pm = True).
5150 doesn't provide WINS server service by default (wsupp = False),
5151 and doesn't provide domain master browser services by default, either.
5155 Globals
.bMsAddPrinterWizard
= True
;
5156 Globals
.os_level
= 20;
5157 Globals
.bLocalMaster
= True
;
5158 Globals
.iDomainMaster
= Auto
; /* depending on bDomainLogons */
5159 Globals
.bDomainLogons
= False
;
5160 Globals
.bBrowseList
= True
;
5161 Globals
.bWINSsupport
= False
;
5162 Globals
.bWINSproxy
= False
;
5164 TALLOC_FREE(Globals
.szInitLogonDelayedHosts
);
5165 Globals
.InitLogonDelay
= 100; /* 100 ms default delay */
5167 Globals
.bDNSproxy
= True
;
5169 /* this just means to use them if they exist */
5170 Globals
.bKernelOplocks
= True
;
5172 Globals
.bAllowTrustedDomains
= True
;
5173 string_set(&Globals
.szIdmapBackend
, "tdb");
5175 string_set(&Globals
.szTemplateShell
, "/bin/false");
5176 string_set(&Globals
.szTemplateHomedir
, "/home/%D/%U");
5177 string_set(&Globals
.szWinbindSeparator
, "\\");
5179 string_set(&Globals
.szCupsServer
, "");
5180 string_set(&Globals
.szIPrintServer
, "");
5182 string_set(&Globals
.ctdbdSocket
, "");
5183 Globals
.szClusterAddresses
= NULL
;
5184 Globals
.clustering
= False
;
5185 Globals
.ctdb_timeout
= 0;
5187 Globals
.winbind_cache_time
= 300; /* 5 minutes */
5188 Globals
.winbind_reconnect_delay
= 30; /* 30 seconds */
5189 Globals
.winbind_max_clients
= 200;
5190 Globals
.bWinbindEnumUsers
= False
;
5191 Globals
.bWinbindEnumGroups
= False
;
5192 Globals
.bWinbindUseDefaultDomain
= False
;
5193 Globals
.bWinbindTrustedDomainsOnly
= False
;
5194 Globals
.bWinbindNestedGroups
= True
;
5195 Globals
.winbind_expand_groups
= 1;
5196 Globals
.szWinbindNssInfo
= str_list_make_v3(talloc_autofree_context(), "template", NULL
);
5197 Globals
.bWinbindRefreshTickets
= False
;
5198 Globals
.bWinbindOfflineLogon
= False
;
5200 Globals
.iIdmapCacheTime
= 86400 * 7; /* a week by default */
5201 Globals
.iIdmapNegativeCacheTime
= 120; /* 2 minutes by default */
5203 Globals
.bPassdbExpandExplicit
= False
;
5205 Globals
.name_cache_timeout
= 660; /* In seconds */
5207 Globals
.bUseSpnego
= True
;
5208 Globals
.bClientUseSpnego
= True
;
5210 Globals
.client_signing
= Auto
;
5211 Globals
.server_signing
= False
;
5213 Globals
.bDeferSharingViolations
= True
;
5214 string_set(&Globals
.smb_ports
, SMB_PORTS
);
5216 Globals
.bEnablePrivileges
= True
;
5217 Globals
.bHostMSDfs
= True
;
5218 Globals
.bASUSupport
= False
;
5220 /* User defined shares. */
5221 if (asprintf(&s
, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5222 smb_panic("init_globals: ENOMEM");
5224 string_set(&Globals
.szUsersharePath
, s
);
5226 string_set(&Globals
.szUsershareTemplateShare
, "");
5227 Globals
.iUsershareMaxShares
= 0;
5228 /* By default disallow sharing of directories not owned by the sharer. */
5229 Globals
.bUsershareOwnerOnly
= True
;
5230 /* By default disallow guest access to usershares. */
5231 Globals
.bUsershareAllowGuests
= False
;
5233 Globals
.iKeepalive
= DEFAULT_KEEPALIVE
;
5235 /* By default no shares out of the registry */
5236 Globals
.bRegistryShares
= False
;
5238 Globals
.iminreceivefile
= 0;
5240 Globals
.bMapUntrustedToDomain
= false;
5243 /*******************************************************************
5244 Convenience routine to grab string parameters into temporary memory
5245 and run standard_sub_basic on them. The buffers can be written to by
5246 callers without affecting the source string.
5247 ********************************************************************/
5249 static char *lp_string(const char *s
)
5252 TALLOC_CTX
*ctx
= talloc_tos();
5254 /* The follow debug is useful for tracking down memory problems
5255 especially if you have an inner loop that is calling a lp_*()
5256 function that returns a string. Perhaps this debug should be
5257 present all the time? */
5260 DEBUG(10, ("lp_string(%s)\n", s
));
5266 ret
= talloc_sub_basic(ctx
,
5267 get_current_username(),
5268 current_user_info
.domain
,
5270 if (trim_char(ret
, '\"', '\"')) {
5271 if (strchr(ret
,'\"') != NULL
) {
5273 ret
= talloc_sub_basic(ctx
,
5274 get_current_username(),
5275 current_user_info
.domain
,
5283 In this section all the functions that are used to access the
5284 parameters from the rest of the program are defined
5287 #define FN_GLOBAL_STRING(fn_name,ptr) \
5288 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
5289 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5290 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
5291 #define FN_GLOBAL_LIST(fn_name,ptr) \
5292 const char **fn_name(void) {return(*(const char ***)(ptr));}
5293 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5294 bool fn_name(void) {return(*(bool *)(ptr));}
5295 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5296 char fn_name(void) {return(*(char *)(ptr));}
5297 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5298 int fn_name(void) {return(*(int *)(ptr));}
5300 #define FN_LOCAL_STRING(fn_name,val) \
5301 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5302 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5303 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5304 #define FN_LOCAL_LIST(fn_name,val) \
5305 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5306 #define FN_LOCAL_BOOL(fn_name,val) \
5307 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5308 #define FN_LOCAL_INTEGER(fn_name,val) \
5309 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5311 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5312 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5313 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5314 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5315 #define FN_LOCAL_PARM_STRING(fn_name,val) \
5316 char *fn_name(const struct share_params *p) {return(lp_string((LP_SNUM_OK(p->service) && ServicePtrs[(p->service)]->val) ? ServicePtrs[(p->service)]->val : sDefault.val));}
5317 #define FN_LOCAL_CHAR(fn_name,val) \
5318 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5320 FN_GLOBAL_STRING(lp_smb_ports
, &Globals
.smb_ports
)
5321 FN_GLOBAL_STRING(lp_dos_charset
, &Globals
.dos_charset
)
5322 FN_GLOBAL_STRING(lp_unix_charset
, &Globals
.unix_charset
)
5323 FN_GLOBAL_STRING(lp_display_charset
, &Globals
.display_charset
)
5324 FN_GLOBAL_STRING(lp_logfile
, &Globals
.szLogFile
)
5325 FN_GLOBAL_STRING(lp_configfile
, &Globals
.szConfigFile
)
5326 FN_GLOBAL_STRING(lp_smb_passwd_file
, &Globals
.szSMBPasswdFile
)
5327 FN_GLOBAL_STRING(lp_private_dir
, &Globals
.szPrivateDir
)
5328 FN_GLOBAL_STRING(lp_serverstring
, &Globals
.szServerString
)
5329 FN_GLOBAL_INTEGER(lp_printcap_cache_time
, &Globals
.PrintcapCacheTime
)
5330 FN_GLOBAL_STRING(lp_addport_cmd
, &Globals
.szAddPortCommand
)
5331 FN_GLOBAL_STRING(lp_enumports_cmd
, &Globals
.szEnumPortsCommand
)
5332 FN_GLOBAL_STRING(lp_addprinter_cmd
, &Globals
.szAddPrinterCommand
)
5333 FN_GLOBAL_STRING(lp_deleteprinter_cmd
, &Globals
.szDeletePrinterCommand
)
5334 FN_GLOBAL_STRING(lp_os2_driver_map
, &Globals
.szOs2DriverMap
)
5335 FN_GLOBAL_STRING(lp_lockdir
, &Globals
.szLockDir
)
5336 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5337 * build process or in smb.conf, we use that value. Otherwise they
5338 * default to the value of lp_lockdir(). */
5339 char *lp_statedir(void) {
5340 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5341 (strcmp(get_dyn_STATEDIR(), Globals
.szStateDir
) != 0))
5342 return(lp_string(*(char **)(&Globals
.szStateDir
) ?
5343 *(char **)(&Globals
.szStateDir
) : ""));
5345 return(lp_string(*(char **)(&Globals
.szLockDir
) ?
5346 *(char **)(&Globals
.szLockDir
) : ""));
5348 char *lp_cachedir(void) {
5349 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5350 (strcmp(get_dyn_CACHEDIR(), Globals
.szCacheDir
) != 0))
5351 return(lp_string(*(char **)(&Globals
.szCacheDir
) ?
5352 *(char **)(&Globals
.szCacheDir
) : ""));
5354 return(lp_string(*(char **)(&Globals
.szLockDir
) ?
5355 *(char **)(&Globals
.szLockDir
) : ""));
5357 FN_GLOBAL_STRING(lp_piddir
, &Globals
.szPidDir
)
5358 FN_GLOBAL_STRING(lp_mangling_method
, &Globals
.szManglingMethod
)
5359 FN_GLOBAL_INTEGER(lp_mangle_prefix
, &Globals
.mangle_prefix
)
5360 FN_GLOBAL_STRING(lp_utmpdir
, &Globals
.szUtmpDir
)
5361 FN_GLOBAL_STRING(lp_wtmpdir
, &Globals
.szWtmpDir
)
5362 FN_GLOBAL_BOOL(lp_utmp
, &Globals
.bUtmp
)
5363 FN_GLOBAL_STRING(lp_rootdir
, &Globals
.szRootdir
)
5364 FN_GLOBAL_STRING(lp_perfcount_module
, &Globals
.szSMBPerfcountModule
)
5365 FN_GLOBAL_STRING(lp_defaultservice
, &Globals
.szDefaultService
)
5366 FN_GLOBAL_STRING(lp_msg_command
, &Globals
.szMsgCommand
)
5367 FN_GLOBAL_STRING(lp_get_quota_command
, &Globals
.szGetQuota
)
5368 FN_GLOBAL_STRING(lp_set_quota_command
, &Globals
.szSetQuota
)
5369 FN_GLOBAL_STRING(lp_auto_services
, &Globals
.szAutoServices
)
5370 FN_GLOBAL_STRING(lp_passwd_program
, &Globals
.szPasswdProgram
)
5371 FN_GLOBAL_STRING(lp_passwd_chat
, &Globals
.szPasswdChat
)
5372 FN_GLOBAL_STRING(lp_passwordserver
, &Globals
.szPasswordServer
)
5373 FN_GLOBAL_STRING(lp_name_resolve_order
, &Globals
.szNameResolveOrder
)
5374 FN_GLOBAL_STRING(lp_realm
, &Globals
.szRealm
)
5375 FN_GLOBAL_CONST_STRING(lp_afs_username_map
, &Globals
.szAfsUsernameMap
)
5376 FN_GLOBAL_INTEGER(lp_afs_token_lifetime
, &Globals
.iAfsTokenLifetime
)
5377 FN_GLOBAL_STRING(lp_log_nt_token_command
, &Globals
.szLogNtTokenCommand
)
5378 FN_GLOBAL_STRING(lp_username_map
, &Globals
.szUsernameMap
)
5379 FN_GLOBAL_CONST_STRING(lp_logon_script
, &Globals
.szLogonScript
)
5380 FN_GLOBAL_CONST_STRING(lp_logon_path
, &Globals
.szLogonPath
)
5381 FN_GLOBAL_CONST_STRING(lp_logon_drive
, &Globals
.szLogonDrive
)
5382 FN_GLOBAL_CONST_STRING(lp_logon_home
, &Globals
.szLogonHome
)
5383 FN_GLOBAL_STRING(lp_remote_announce
, &Globals
.szRemoteAnnounce
)
5384 FN_GLOBAL_STRING(lp_remote_browse_sync
, &Globals
.szRemoteBrowseSync
)
5385 FN_GLOBAL_BOOL(lp_nmbd_bind_explicit_broadcast
, &Globals
.bNmbdBindExplicitBroadcast
)
5386 FN_GLOBAL_LIST(lp_wins_server_list
, &Globals
.szWINSservers
)
5387 FN_GLOBAL_LIST(lp_interfaces
, &Globals
.szInterfaces
)
5388 FN_GLOBAL_STRING(lp_nis_home_map_name
, &Globals
.szNISHomeMapName
)
5389 static FN_GLOBAL_STRING(lp_announce_version
, &Globals
.szAnnounceVersion
)
5390 FN_GLOBAL_LIST(lp_netbios_aliases
, &Globals
.szNetbiosAliases
)
5391 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
5392 * lp_passdb_backend() should be replace by the this macro again after
5395 const char *lp_passdb_backend(void)
5397 char *delim
, *quote
;
5399 delim
= strchr( Globals
.szPassdbBackend
, ' ');
5400 /* no space at all */
5401 if (delim
== NULL
) {
5405 quote
= strchr(Globals
.szPassdbBackend
, '"');
5406 /* no quote char or non in the first part */
5407 if (quote
== NULL
|| quote
> delim
) {
5412 quote
= strchr(quote
+1, '"');
5413 if (quote
== NULL
) {
5414 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
5416 } else if (*(quote
+1) == '\0') {
5417 /* space, fitting quote char, and one backend only */
5420 /* terminate string after the fitting quote char */
5425 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5426 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5427 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5428 "backend (%s) is used. The rest is ignored.\n", Globals
.szPassdbBackend
));
5431 return Globals
.szPassdbBackend
;
5433 FN_GLOBAL_LIST(lp_preload_modules
, &Globals
.szPreloadModules
)
5434 FN_GLOBAL_STRING(lp_panic_action
, &Globals
.szPanicAction
)
5435 FN_GLOBAL_STRING(lp_adduser_script
, &Globals
.szAddUserScript
)
5436 FN_GLOBAL_STRING(lp_renameuser_script
, &Globals
.szRenameUserScript
)
5437 FN_GLOBAL_STRING(lp_deluser_script
, &Globals
.szDelUserScript
)
5439 FN_GLOBAL_CONST_STRING(lp_guestaccount
, &Globals
.szGuestaccount
)
5440 FN_GLOBAL_STRING(lp_addgroup_script
, &Globals
.szAddGroupScript
)
5441 FN_GLOBAL_STRING(lp_delgroup_script
, &Globals
.szDelGroupScript
)
5442 FN_GLOBAL_STRING(lp_addusertogroup_script
, &Globals
.szAddUserToGroupScript
)
5443 FN_GLOBAL_STRING(lp_deluserfromgroup_script
, &Globals
.szDelUserFromGroupScript
)
5444 FN_GLOBAL_STRING(lp_setprimarygroup_script
, &Globals
.szSetPrimaryGroupScript
)
5446 FN_GLOBAL_STRING(lp_addmachine_script
, &Globals
.szAddMachineScript
)
5448 FN_GLOBAL_STRING(lp_shutdown_script
, &Globals
.szShutdownScript
)
5449 FN_GLOBAL_STRING(lp_abort_shutdown_script
, &Globals
.szAbortShutdownScript
)
5450 FN_GLOBAL_STRING(lp_username_map_script
, &Globals
.szUsernameMapScript
)
5452 FN_GLOBAL_STRING(lp_check_password_script
, &Globals
.szCheckPasswordScript
)
5454 FN_GLOBAL_STRING(lp_wins_hook
, &Globals
.szWINSHook
)
5455 FN_GLOBAL_CONST_STRING(lp_template_homedir
, &Globals
.szTemplateHomedir
)
5456 FN_GLOBAL_CONST_STRING(lp_template_shell
, &Globals
.szTemplateShell
)
5457 FN_GLOBAL_CONST_STRING(lp_winbind_separator
, &Globals
.szWinbindSeparator
)
5458 FN_GLOBAL_INTEGER(lp_acl_compatibility
, &Globals
.iAclCompat
)
5459 FN_GLOBAL_BOOL(lp_winbind_enum_users
, &Globals
.bWinbindEnumUsers
)
5460 FN_GLOBAL_BOOL(lp_winbind_enum_groups
, &Globals
.bWinbindEnumGroups
)
5461 FN_GLOBAL_BOOL(lp_winbind_use_default_domain
, &Globals
.bWinbindUseDefaultDomain
)
5462 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only
, &Globals
.bWinbindTrustedDomainsOnly
)
5463 FN_GLOBAL_BOOL(lp_winbind_nested_groups
, &Globals
.bWinbindNestedGroups
)
5464 FN_GLOBAL_INTEGER(lp_winbind_expand_groups
, &Globals
.winbind_expand_groups
)
5465 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets
, &Globals
.bWinbindRefreshTickets
)
5466 FN_GLOBAL_BOOL(lp_winbind_offline_logon
, &Globals
.bWinbindOfflineLogon
)
5467 FN_GLOBAL_BOOL(lp_winbind_normalize_names
, &Globals
.bWinbindNormalizeNames
)
5468 FN_GLOBAL_BOOL(lp_winbind_rpc_only
, &Globals
.bWinbindRpcOnly
)
5469 FN_GLOBAL_BOOL(lp_create_krb5_conf
, &Globals
.bCreateKrb5Conf
)
5471 FN_GLOBAL_CONST_STRING(lp_idmap_backend
, &Globals
.szIdmapBackend
)
5472 FN_GLOBAL_STRING(lp_idmap_alloc_backend
, &Globals
.szIdmapAllocBackend
)
5473 FN_GLOBAL_INTEGER(lp_idmap_cache_time
, &Globals
.iIdmapCacheTime
)
5474 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time
, &Globals
.iIdmapNegativeCacheTime
)
5475 FN_GLOBAL_INTEGER(lp_keepalive
, &Globals
.iKeepalive
)
5476 FN_GLOBAL_BOOL(lp_passdb_expand_explicit
, &Globals
.bPassdbExpandExplicit
)
5478 FN_GLOBAL_STRING(lp_ldap_suffix
, &Globals
.szLdapSuffix
)
5479 FN_GLOBAL_STRING(lp_ldap_admin_dn
, &Globals
.szLdapAdminDn
)
5480 FN_GLOBAL_INTEGER(lp_ldap_ssl
, &Globals
.ldap_ssl
)
5481 FN_GLOBAL_BOOL(lp_ldap_ssl_ads
, &Globals
.ldap_ssl_ads
)
5482 FN_GLOBAL_INTEGER(lp_ldap_deref
, &Globals
.ldap_deref
)
5483 FN_GLOBAL_INTEGER(lp_ldap_follow_referral
, &Globals
.ldap_follow_referral
)
5484 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync
, &Globals
.ldap_passwd_sync
)
5485 FN_GLOBAL_BOOL(lp_ldap_delete_dn
, &Globals
.ldap_delete_dn
)
5486 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep
, &Globals
.ldap_replication_sleep
)
5487 FN_GLOBAL_INTEGER(lp_ldap_timeout
, &Globals
.ldap_timeout
)
5488 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout
, &Globals
.ldap_connection_timeout
)
5489 FN_GLOBAL_INTEGER(lp_ldap_page_size
, &Globals
.ldap_page_size
)
5490 FN_GLOBAL_INTEGER(lp_ldap_debug_level
, &Globals
.ldap_debug_level
)
5491 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold
, &Globals
.ldap_debug_threshold
)
5492 FN_GLOBAL_STRING(lp_add_share_cmd
, &Globals
.szAddShareCommand
)
5493 FN_GLOBAL_STRING(lp_change_share_cmd
, &Globals
.szChangeShareCommand
)
5494 FN_GLOBAL_STRING(lp_delete_share_cmd
, &Globals
.szDeleteShareCommand
)
5495 FN_GLOBAL_STRING(lp_usershare_path
, &Globals
.szUsersharePath
)
5496 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list
, &Globals
.szUsersharePrefixAllowList
)
5497 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list
, &Globals
.szUsersharePrefixDenyList
)
5499 FN_GLOBAL_LIST(lp_eventlog_list
, &Globals
.szEventLogs
)
5501 FN_GLOBAL_BOOL(lp_registry_shares
, &Globals
.bRegistryShares
)
5502 FN_GLOBAL_BOOL(lp_usershare_allow_guests
, &Globals
.bUsershareAllowGuests
)
5503 FN_GLOBAL_BOOL(lp_usershare_owner_only
, &Globals
.bUsershareOwnerOnly
)
5504 FN_GLOBAL_BOOL(lp_disable_netbios
, &Globals
.bDisableNetbios
)
5505 FN_GLOBAL_BOOL(lp_reset_on_zero_vc
, &Globals
.bResetOnZeroVC
)
5506 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard
, &Globals
.bMsAddPrinterWizard
)
5507 FN_GLOBAL_BOOL(lp_dns_proxy
, &Globals
.bDNSproxy
)
5508 FN_GLOBAL_BOOL(lp_wins_support
, &Globals
.bWINSsupport
)
5509 FN_GLOBAL_BOOL(lp_we_are_a_wins_server
, &Globals
.bWINSsupport
)
5510 FN_GLOBAL_BOOL(lp_wins_proxy
, &Globals
.bWINSproxy
)
5511 FN_GLOBAL_BOOL(lp_local_master
, &Globals
.bLocalMaster
)
5512 FN_GLOBAL_BOOL(lp_domain_logons
, &Globals
.bDomainLogons
)
5513 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts
, &Globals
.szInitLogonDelayedHosts
)
5514 FN_GLOBAL_INTEGER(lp_init_logon_delay
, &Globals
.InitLogonDelay
)
5515 FN_GLOBAL_BOOL(lp_load_printers
, &Globals
.bLoadPrinters
)
5516 FN_GLOBAL_BOOL(lp_readraw
, &Globals
.bReadRaw
)
5517 FN_GLOBAL_BOOL(lp_large_readwrite
, &Globals
.bLargeReadwrite
)
5518 FN_GLOBAL_BOOL(lp_writeraw
, &Globals
.bWriteRaw
)
5519 FN_GLOBAL_BOOL(lp_null_passwords
, &Globals
.bNullPasswords
)
5520 FN_GLOBAL_BOOL(lp_obey_pam_restrictions
, &Globals
.bObeyPamRestrictions
)
5521 FN_GLOBAL_BOOL(lp_encrypted_passwords
, &Globals
.bEncryptPasswords
)
5522 FN_GLOBAL_BOOL(lp_update_encrypted
, &Globals
.bUpdateEncrypt
)
5523 FN_GLOBAL_INTEGER(lp_client_schannel
, &Globals
.clientSchannel
)
5524 FN_GLOBAL_INTEGER(lp_server_schannel
, &Globals
.serverSchannel
)
5525 FN_GLOBAL_BOOL(lp_syslog_only
, &Globals
.bSyslogOnly
)
5526 FN_GLOBAL_BOOL(lp_timestamp_logs
, &Globals
.bTimestampLogs
)
5527 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp
, &Globals
.bDebugPrefixTimestamp
)
5528 FN_GLOBAL_BOOL(lp_debug_hires_timestamp
, &Globals
.bDebugHiresTimestamp
)
5529 FN_GLOBAL_BOOL(lp_debug_pid
, &Globals
.bDebugPid
)
5530 FN_GLOBAL_BOOL(lp_debug_uid
, &Globals
.bDebugUid
)
5531 FN_GLOBAL_BOOL(lp_debug_class
, &Globals
.bDebugClass
)
5532 FN_GLOBAL_BOOL(lp_enable_core_files
, &Globals
.bEnableCoreFiles
)
5533 FN_GLOBAL_BOOL(lp_browse_list
, &Globals
.bBrowseList
)
5534 FN_GLOBAL_BOOL(lp_nis_home_map
, &Globals
.bNISHomeMap
)
5535 static FN_GLOBAL_BOOL(lp_time_server
, &Globals
.bTimeServer
)
5536 FN_GLOBAL_BOOL(lp_bind_interfaces_only
, &Globals
.bBindInterfacesOnly
)
5537 FN_GLOBAL_BOOL(lp_pam_password_change
, &Globals
.bPamPasswordChange
)
5538 FN_GLOBAL_BOOL(lp_unix_password_sync
, &Globals
.bUnixPasswdSync
)
5539 FN_GLOBAL_BOOL(lp_passwd_chat_debug
, &Globals
.bPasswdChatDebug
)
5540 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout
, &Globals
.iPasswdChatTimeout
)
5541 FN_GLOBAL_BOOL(lp_nt_pipe_support
, &Globals
.bNTPipeSupport
)
5542 FN_GLOBAL_BOOL(lp_nt_status_support
, &Globals
.bNTStatusSupport
)
5543 FN_GLOBAL_BOOL(lp_stat_cache
, &Globals
.bStatCache
)
5544 FN_GLOBAL_INTEGER(lp_max_stat_cache_size
, &Globals
.iMaxStatCacheSize
)
5545 FN_GLOBAL_BOOL(lp_allow_trusted_domains
, &Globals
.bAllowTrustedDomains
)
5546 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain
, &Globals
.bMapUntrustedToDomain
)
5547 FN_GLOBAL_INTEGER(lp_restrict_anonymous
, &Globals
.restrict_anonymous
)
5548 FN_GLOBAL_BOOL(lp_lanman_auth
, &Globals
.bLanmanAuth
)
5549 FN_GLOBAL_BOOL(lp_ntlm_auth
, &Globals
.bNTLMAuth
)
5550 FN_GLOBAL_BOOL(lp_client_plaintext_auth
, &Globals
.bClientPlaintextAuth
)
5551 FN_GLOBAL_BOOL(lp_client_lanman_auth
, &Globals
.bClientLanManAuth
)
5552 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth
, &Globals
.bClientNTLMv2Auth
)
5553 FN_GLOBAL_BOOL(lp_host_msdfs
, &Globals
.bHostMSDfs
)
5554 FN_GLOBAL_BOOL(lp_kernel_oplocks
, &Globals
.bKernelOplocks
)
5555 FN_GLOBAL_BOOL(lp_enhanced_browsing
, &Globals
.enhanced_browsing
)
5556 FN_GLOBAL_BOOL(lp_use_mmap
, &Globals
.bUseMmap
)
5557 FN_GLOBAL_BOOL(lp_unix_extensions
, &Globals
.bUnixExtensions
)
5558 FN_GLOBAL_BOOL(lp_use_spnego
, &Globals
.bUseSpnego
)
5559 FN_GLOBAL_BOOL(lp_client_use_spnego
, &Globals
.bClientUseSpnego
)
5560 FN_GLOBAL_BOOL(lp_client_use_spnego_principal
, &Globals
.client_use_spnego_principal
)
5561 FN_GLOBAL_BOOL(lp_hostname_lookups
, &Globals
.bHostnameLookups
)
5562 FN_LOCAL_PARM_BOOL(lp_change_notify
, bChangeNotify
)
5563 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify
, bKernelChangeNotify
)
5564 FN_GLOBAL_STRING(lp_dedicated_keytab_file
, &Globals
.szDedicatedKeytabFile
)
5565 FN_GLOBAL_INTEGER(lp_kerberos_method
, &Globals
.iKerberosMethod
)
5566 FN_GLOBAL_BOOL(lp_defer_sharing_violations
, &Globals
.bDeferSharingViolations
)
5567 FN_GLOBAL_BOOL(lp_enable_privileges
, &Globals
.bEnablePrivileges
)
5568 FN_GLOBAL_BOOL(lp_enable_asu_support
, &Globals
.bASUSupport
)
5569 FN_GLOBAL_INTEGER(lp_os_level
, &Globals
.os_level
)
5570 FN_GLOBAL_INTEGER(lp_max_ttl
, &Globals
.max_ttl
)
5571 FN_GLOBAL_INTEGER(lp_max_wins_ttl
, &Globals
.max_wins_ttl
)
5572 FN_GLOBAL_INTEGER(lp_min_wins_ttl
, &Globals
.min_wins_ttl
)
5573 FN_GLOBAL_INTEGER(lp_max_log_size
, &Globals
.max_log_size
)
5574 FN_GLOBAL_INTEGER(lp_max_open_files
, &Globals
.max_open_files
)
5575 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size
, &Globals
.open_files_db_hash_size
)
5576 FN_GLOBAL_INTEGER(lp_maxxmit
, &Globals
.max_xmit
)
5577 FN_GLOBAL_INTEGER(lp_maxmux
, &Globals
.max_mux
)
5578 FN_GLOBAL_INTEGER(lp_passwordlevel
, &Globals
.pwordlevel
)
5579 FN_GLOBAL_INTEGER(lp_usernamelevel
, &Globals
.unamelevel
)
5580 FN_GLOBAL_INTEGER(lp_deadtime
, &Globals
.deadtime
)
5581 FN_GLOBAL_BOOL(lp_getwd_cache
, &Globals
.getwd_cache
)
5582 FN_GLOBAL_INTEGER(lp_maxprotocol
, &Globals
.maxprotocol
)
5583 FN_GLOBAL_INTEGER(lp_minprotocol
, &Globals
.minprotocol
)
5584 FN_GLOBAL_INTEGER(lp_security
, &Globals
.security
)
5585 FN_GLOBAL_LIST(lp_auth_methods
, &Globals
.AuthMethods
)
5586 FN_GLOBAL_BOOL(lp_paranoid_server_security
, &Globals
.paranoid_server_security
)
5587 FN_GLOBAL_INTEGER(lp_maxdisksize
, &Globals
.maxdisksize
)
5588 FN_GLOBAL_INTEGER(lp_lpqcachetime
, &Globals
.lpqcachetime
)
5589 FN_GLOBAL_INTEGER(lp_max_smbd_processes
, &Globals
.iMaxSmbdProcesses
)
5590 FN_GLOBAL_BOOL(_lp_disable_spoolss
, &Globals
.bDisableSpoolss
)
5591 FN_GLOBAL_INTEGER(lp_syslog
, &Globals
.syslog
)
5592 static FN_GLOBAL_INTEGER(lp_announce_as
, &Globals
.announce_as
)
5593 FN_GLOBAL_INTEGER(lp_lm_announce
, &Globals
.lm_announce
)
5594 FN_GLOBAL_INTEGER(lp_lm_interval
, &Globals
.lm_interval
)
5595 FN_GLOBAL_INTEGER(lp_machine_password_timeout
, &Globals
.machine_password_timeout
)
5596 FN_GLOBAL_INTEGER(lp_map_to_guest
, &Globals
.map_to_guest
)
5597 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time
, &Globals
.oplock_break_wait_time
)
5598 FN_GLOBAL_INTEGER(lp_lock_spin_time
, &Globals
.iLockSpinTime
)
5599 FN_GLOBAL_INTEGER(lp_usershare_max_shares
, &Globals
.iUsershareMaxShares
)
5600 FN_GLOBAL_CONST_STRING(lp_socket_options
, &Globals
.szSocketOptions
)
5601 FN_GLOBAL_INTEGER(lp_config_backend
, &Globals
.ConfigBackend
)
5603 FN_LOCAL_STRING(lp_preexec
, szPreExec
)
5604 FN_LOCAL_STRING(lp_postexec
, szPostExec
)
5605 FN_LOCAL_STRING(lp_rootpreexec
, szRootPreExec
)
5606 FN_LOCAL_STRING(lp_rootpostexec
, szRootPostExec
)
5607 FN_LOCAL_STRING(lp_servicename
, szService
)
5608 FN_LOCAL_CONST_STRING(lp_const_servicename
, szService
)
5609 FN_LOCAL_STRING(lp_pathname
, szPath
)
5610 FN_LOCAL_STRING(lp_dontdescend
, szDontdescend
)
5611 FN_LOCAL_STRING(lp_username
, szUsername
)
5612 FN_LOCAL_LIST(lp_invalid_users
, szInvalidUsers
)
5613 FN_LOCAL_LIST(lp_valid_users
, szValidUsers
)
5614 FN_LOCAL_LIST(lp_admin_users
, szAdminUsers
)
5615 FN_GLOBAL_LIST(lp_svcctl_list
, &Globals
.szServicesList
)
5616 FN_LOCAL_STRING(lp_cups_options
, szCupsOptions
)
5617 FN_GLOBAL_STRING(lp_cups_server
, &Globals
.szCupsServer
)
5618 int lp_cups_encrypt(void)
5621 #ifdef HAVE_HTTPCONNECTENCRYPT
5622 switch (Globals
.CupsEncrypt
) {
5624 result
= HTTP_ENCRYPT_REQUIRED
;
5627 result
= HTTP_ENCRYPT_ALWAYS
;
5630 result
= HTTP_ENCRYPT_NEVER
;
5636 FN_GLOBAL_STRING(lp_iprint_server
, &Globals
.szIPrintServer
)
5637 FN_GLOBAL_INTEGER(lp_cups_connection_timeout
, &Globals
.cups_connection_timeout
)
5638 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket
, &Globals
.ctdbdSocket
)
5639 FN_GLOBAL_LIST(lp_cluster_addresses
, &Globals
.szClusterAddresses
)
5640 FN_GLOBAL_BOOL(lp_clustering
, &Globals
.clustering
)
5641 FN_GLOBAL_INTEGER(lp_ctdb_timeout
, &Globals
.ctdb_timeout
)
5642 FN_LOCAL_STRING(lp_printcommand
, szPrintcommand
)
5643 FN_LOCAL_STRING(lp_lpqcommand
, szLpqcommand
)
5644 FN_LOCAL_STRING(lp_lprmcommand
, szLprmcommand
)
5645 FN_LOCAL_STRING(lp_lppausecommand
, szLppausecommand
)
5646 FN_LOCAL_STRING(lp_lpresumecommand
, szLpresumecommand
)
5647 FN_LOCAL_STRING(lp_queuepausecommand
, szQueuepausecommand
)
5648 FN_LOCAL_STRING(lp_queueresumecommand
, szQueueresumecommand
)
5649 static FN_LOCAL_STRING(_lp_printername
, szPrintername
)
5650 FN_LOCAL_CONST_STRING(lp_printjob_username
, szPrintjobUsername
)
5651 FN_LOCAL_LIST(lp_hostsallow
, szHostsallow
)
5652 FN_LOCAL_LIST(lp_hostsdeny
, szHostsdeny
)
5653 FN_LOCAL_STRING(lp_magicscript
, szMagicScript
)
5654 FN_LOCAL_STRING(lp_magicoutput
, szMagicOutput
)
5655 FN_LOCAL_STRING(lp_comment
, comment
)
5656 FN_LOCAL_STRING(lp_force_user
, force_user
)
5657 FN_LOCAL_STRING(lp_force_group
, force_group
)
5658 FN_LOCAL_LIST(lp_readlist
, readlist
)
5659 FN_LOCAL_LIST(lp_writelist
, writelist
)
5660 FN_LOCAL_LIST(lp_printer_admin
, printer_admin
)
5661 FN_LOCAL_STRING(lp_fstype
, fstype
)
5662 FN_LOCAL_LIST(lp_vfs_objects
, szVfsObjects
)
5663 FN_LOCAL_STRING(lp_msdfs_proxy
, szMSDfsProxy
)
5664 static FN_LOCAL_STRING(lp_volume
, volume
)
5665 FN_LOCAL_STRING(lp_veto_files
, szVetoFiles
)
5666 FN_LOCAL_STRING(lp_hide_files
, szHideFiles
)
5667 FN_LOCAL_STRING(lp_veto_oplocks
, szVetoOplockFiles
)
5668 FN_LOCAL_BOOL(lp_msdfs_root
, bMSDfsRoot
)
5669 FN_LOCAL_STRING(lp_aio_write_behind
, szAioWriteBehind
)
5670 FN_LOCAL_STRING(lp_dfree_command
, szDfree
)
5671 FN_LOCAL_BOOL(lp_autoloaded
, autoloaded
)
5672 FN_LOCAL_BOOL(lp_preexec_close
, bPreexecClose
)
5673 FN_LOCAL_BOOL(lp_rootpreexec_close
, bRootpreexecClose
)
5674 FN_LOCAL_INTEGER(lp_casesensitive
, iCaseSensitive
)
5675 FN_LOCAL_BOOL(lp_preservecase
, bCasePreserve
)
5676 FN_LOCAL_BOOL(lp_shortpreservecase
, bShortCasePreserve
)
5677 FN_LOCAL_BOOL(lp_hide_dot_files
, bHideDotFiles
)
5678 FN_LOCAL_BOOL(lp_hide_special_files
, bHideSpecialFiles
)
5679 FN_LOCAL_BOOL(lp_hideunreadable
, bHideUnReadable
)
5680 FN_LOCAL_BOOL(lp_hideunwriteable_files
, bHideUnWriteableFiles
)
5681 FN_LOCAL_BOOL(lp_browseable
, bBrowseable
)
5682 FN_LOCAL_BOOL(lp_access_based_share_enum
, bAccessBasedShareEnum
)
5683 FN_LOCAL_BOOL(lp_readonly
, bRead_only
)
5684 FN_LOCAL_BOOL(lp_no_set_dir
, bNo_set_dir
)
5685 FN_LOCAL_BOOL(lp_guest_ok
, bGuest_ok
)
5686 FN_LOCAL_BOOL(lp_guest_only
, bGuest_only
)
5687 FN_LOCAL_BOOL(lp_administrative_share
, bAdministrative_share
)
5688 FN_LOCAL_BOOL(lp_print_ok
, bPrint_ok
)
5689 FN_LOCAL_BOOL(lp_map_hidden
, bMap_hidden
)
5690 FN_LOCAL_BOOL(lp_map_archive
, bMap_archive
)
5691 FN_LOCAL_BOOL(lp_store_dos_attributes
, bStoreDosAttributes
)
5692 FN_LOCAL_BOOL(lp_dmapi_support
, bDmapiSupport
)
5693 FN_LOCAL_PARM_BOOL(lp_locking
, bLocking
)
5694 FN_LOCAL_PARM_INTEGER(lp_strict_locking
, iStrictLocking
)
5695 FN_LOCAL_PARM_BOOL(lp_posix_locking
, bPosixLocking
)
5696 FN_LOCAL_BOOL(lp_share_modes
, bShareModes
)
5697 FN_LOCAL_BOOL(lp_oplocks
, bOpLocks
)
5698 FN_LOCAL_BOOL(lp_level2_oplocks
, bLevel2OpLocks
)
5699 FN_LOCAL_BOOL(lp_onlyuser
, bOnlyUser
)
5700 FN_LOCAL_PARM_BOOL(lp_manglednames
, bMangledNames
)
5701 FN_LOCAL_BOOL(lp_symlinks
, bSymlinks
)
5702 FN_LOCAL_BOOL(lp_syncalways
, bSyncAlways
)
5703 FN_LOCAL_BOOL(lp_strict_allocate
, bStrictAllocate
)
5704 FN_LOCAL_BOOL(lp_strict_sync
, bStrictSync
)
5705 FN_LOCAL_BOOL(lp_map_system
, bMap_system
)
5706 FN_LOCAL_BOOL(lp_delete_readonly
, bDeleteReadonly
)
5707 FN_LOCAL_BOOL(lp_fake_oplocks
, bFakeOplocks
)
5708 FN_LOCAL_BOOL(lp_recursive_veto_delete
, bDeleteVetoFiles
)
5709 FN_LOCAL_BOOL(lp_dos_filemode
, bDosFilemode
)
5710 FN_LOCAL_BOOL(lp_dos_filetimes
, bDosFiletimes
)
5711 FN_LOCAL_BOOL(lp_dos_filetime_resolution
, bDosFiletimeResolution
)
5712 FN_LOCAL_BOOL(lp_fake_dir_create_times
, bFakeDirCreateTimes
)
5713 FN_LOCAL_BOOL(lp_blocking_locks
, bBlockingLocks
)
5714 FN_LOCAL_BOOL(lp_inherit_perms
, bInheritPerms
)
5715 FN_LOCAL_BOOL(lp_inherit_acls
, bInheritACLS
)
5716 FN_LOCAL_BOOL(lp_inherit_owner
, bInheritOwner
)
5717 FN_LOCAL_BOOL(lp_use_client_driver
, bUseClientDriver
)
5718 FN_LOCAL_BOOL(lp_default_devmode
, bDefaultDevmode
)
5719 FN_LOCAL_BOOL(lp_force_printername
, bForcePrintername
)
5720 FN_LOCAL_BOOL(lp_nt_acl_support
, bNTAclSupport
)
5721 FN_LOCAL_BOOL(lp_force_unknown_acl_user
, bForceUnknownAclUser
)
5722 FN_LOCAL_BOOL(lp_ea_support
, bEASupport
)
5723 FN_LOCAL_BOOL(_lp_use_sendfile
, bUseSendfile
)
5724 FN_LOCAL_BOOL(lp_profile_acls
, bProfileAcls
)
5725 FN_LOCAL_BOOL(lp_map_acl_inherit
, bMap_acl_inherit
)
5726 FN_LOCAL_BOOL(lp_afs_share
, bAfs_Share
)
5727 FN_LOCAL_BOOL(lp_acl_check_permissions
, bAclCheckPermissions
)
5728 FN_LOCAL_BOOL(lp_acl_group_control
, bAclGroupControl
)
5729 FN_LOCAL_BOOL(lp_acl_map_full_control
, bAclMapFullControl
)
5730 FN_LOCAL_INTEGER(lp_create_mask
, iCreate_mask
)
5731 FN_LOCAL_INTEGER(lp_force_create_mode
, iCreate_force_mode
)
5732 FN_LOCAL_INTEGER(lp_security_mask
, iSecurity_mask
)
5733 FN_LOCAL_INTEGER(lp_force_security_mode
, iSecurity_force_mode
)
5734 FN_LOCAL_INTEGER(lp_dir_mask
, iDir_mask
)
5735 FN_LOCAL_INTEGER(lp_force_dir_mode
, iDir_force_mode
)
5736 FN_LOCAL_INTEGER(lp_dir_security_mask
, iDir_Security_mask
)
5737 FN_LOCAL_INTEGER(lp_force_dir_security_mode
, iDir_Security_force_mode
)
5738 FN_LOCAL_INTEGER(lp_max_connections
, iMaxConnections
)
5739 FN_LOCAL_INTEGER(lp_defaultcase
, iDefaultCase
)
5740 FN_LOCAL_INTEGER(lp_minprintspace
, iMinPrintSpace
)
5741 FN_LOCAL_INTEGER(lp_printing
, iPrinting
)
5742 FN_LOCAL_INTEGER(lp_max_reported_jobs
, iMaxReportedPrintJobs
)
5743 FN_LOCAL_INTEGER(lp_oplock_contention_limit
, iOplockContentionLimit
)
5744 FN_LOCAL_INTEGER(lp_csc_policy
, iCSCPolicy
)
5745 FN_LOCAL_INTEGER(lp_write_cache_size
, iWriteCacheSize
)
5746 FN_LOCAL_INTEGER(lp_block_size
, iBlock_size
)
5747 FN_LOCAL_INTEGER(lp_dfree_cache_time
, iDfreeCacheTime
)
5748 FN_LOCAL_INTEGER(lp_allocation_roundup_size
, iallocation_roundup_size
)
5749 FN_LOCAL_INTEGER(lp_aio_read_size
, iAioReadSize
)
5750 FN_LOCAL_INTEGER(lp_aio_write_size
, iAioWriteSize
)
5751 FN_LOCAL_INTEGER(lp_map_readonly
, iMap_readonly
)
5752 FN_LOCAL_INTEGER(lp_directory_name_cache_size
, iDirectoryNameCacheSize
)
5753 FN_LOCAL_INTEGER(lp_smb_encrypt
, ismb_encrypt
)
5754 FN_LOCAL_CHAR(lp_magicchar
, magic_char
)
5755 FN_GLOBAL_INTEGER(lp_winbind_cache_time
, &Globals
.winbind_cache_time
)
5756 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay
, &Globals
.winbind_reconnect_delay
)
5757 FN_GLOBAL_INTEGER(lp_winbind_max_clients
, &Globals
.winbind_max_clients
)
5758 FN_GLOBAL_LIST(lp_winbind_nss_info
, &Globals
.szWinbindNssInfo
)
5759 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base
, &Globals
.AlgorithmicRidBase
)
5760 FN_GLOBAL_INTEGER(lp_name_cache_timeout
, &Globals
.name_cache_timeout
)
5761 FN_GLOBAL_INTEGER(lp_client_signing
, &Globals
.client_signing
)
5762 FN_GLOBAL_INTEGER(lp_server_signing
, &Globals
.server_signing
)
5763 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping
, &Globals
.client_ldap_sasl_wrapping
)
5765 /* local prototypes */
5767 static int map_parameter(const char *pszParmName
);
5768 static int map_parameter_canonical(const char *pszParmName
, bool *inverse
);
5769 static const char *get_boolean(bool bool_value
);
5770 static int getservicebyname(const char *pszServiceName
,
5771 struct service
*pserviceDest
);
5772 static void copy_service(struct service
*pserviceDest
,
5773 struct service
*pserviceSource
,
5774 struct bitmap
*pcopymapDest
);
5775 static bool do_parameter(const char *pszParmName
, const char *pszParmValue
,
5777 static bool do_section(const char *pszSectionName
, void *userdata
);
5778 static void init_copymap(struct service
*pservice
);
5779 static bool hash_a_service(const char *name
, int number
);
5780 static void free_service_byindex(int iService
);
5781 static void free_param_opts(struct param_opt_struct
**popts
);
5782 static char * canonicalize_servicename(const char *name
);
5783 static void show_parameter(int parmIndex
);
5784 static bool is_synonym_of(int parm1
, int parm2
, bool *inverse
);
5787 * This is a helper function for parametrical options support. It returns a
5788 * pointer to parametrical option value if it exists or NULL otherwise. Actual
5789 * parametrical functions are quite simple
5791 static struct param_opt_struct
*get_parametrics(int snum
, const char *type
,
5794 bool global_section
= False
;
5796 struct param_opt_struct
*data
;
5798 if (snum
>= iNumServices
) return NULL
;
5801 data
= Globals
.param_opt
;
5802 global_section
= True
;
5804 data
= ServicePtrs
[snum
]->param_opt
;
5807 if (asprintf(¶m_key
, "%s:%s", type
, option
) == -1) {
5808 DEBUG(0,("asprintf failed!\n"));
5813 if (strwicmp(data
->key
, param_key
) == 0) {
5814 string_free(¶m_key
);
5820 if (!global_section
) {
5821 /* Try to fetch the same option but from globals */
5822 /* but only if we are not already working with Globals */
5823 data
= Globals
.param_opt
;
5825 if (strwicmp(data
->key
, param_key
) == 0) {
5826 string_free(¶m_key
);
5833 string_free(¶m_key
);
5839 #define MISSING_PARAMETER(name) \
5840 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
5842 /*******************************************************************
5843 convenience routine to return int parameters.
5844 ********************************************************************/
5845 static int lp_int(const char *s
)
5849 MISSING_PARAMETER(lp_int
);
5853 return (int)strtol(s
, NULL
, 0);
5856 /*******************************************************************
5857 convenience routine to return unsigned long parameters.
5858 ********************************************************************/
5859 static unsigned long lp_ulong(const char *s
)
5863 MISSING_PARAMETER(lp_ulong
);
5867 return strtoul(s
, NULL
, 0);
5870 /*******************************************************************
5871 convenience routine to return boolean parameters.
5872 ********************************************************************/
5873 static bool lp_bool(const char *s
)
5878 MISSING_PARAMETER(lp_bool
);
5882 if (!set_boolean(s
, &ret
)) {
5883 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s
));
5890 /*******************************************************************
5891 convenience routine to return enum parameters.
5892 ********************************************************************/
5893 static int lp_enum(const char *s
,const struct enum_list
*_enum
)
5897 if (!s
|| !*s
|| !_enum
) {
5898 MISSING_PARAMETER(lp_enum
);
5902 for (i
=0; _enum
[i
].name
; i
++) {
5903 if (strequal(_enum
[i
].name
,s
))
5904 return _enum
[i
].value
;
5907 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s
));
5911 #undef MISSING_PARAMETER
5913 /* DO NOT USE lp_parm_string ANYMORE!!!!
5914 * use lp_parm_const_string or lp_parm_talloc_string
5916 * lp_parm_string is only used to let old modules find this symbol
5918 #undef lp_parm_string
5919 char *lp_parm_string(const char *servicename
, const char *type
, const char *option
);
5920 char *lp_parm_string(const char *servicename
, const char *type
, const char *option
)
5922 return lp_parm_talloc_string(lp_servicenumber(servicename
), type
, option
, NULL
);
5925 /* Return parametric option from a given service. Type is a part of option before ':' */
5926 /* Parametric option has following syntax: 'Type: option = value' */
5927 /* the returned value is talloced on the talloc_tos() */
5928 char *lp_parm_talloc_string(int snum
, const char *type
, const char *option
, const char *def
)
5930 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5932 if (data
== NULL
||data
->value
==NULL
) {
5934 return lp_string(def
);
5940 return lp_string(data
->value
);
5943 /* Return parametric option from a given service. Type is a part of option before ':' */
5944 /* Parametric option has following syntax: 'Type: option = value' */
5945 const char *lp_parm_const_string(int snum
, const char *type
, const char *option
, const char *def
)
5947 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5949 if (data
== NULL
||data
->value
==NULL
)
5955 /* Return parametric option from a given service. Type is a part of option before ':' */
5956 /* Parametric option has following syntax: 'Type: option = value' */
5958 const char **lp_parm_string_list(int snum
, const char *type
, const char *option
, const char **def
)
5960 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5962 if (data
== NULL
||data
->value
==NULL
)
5963 return (const char **)def
;
5965 if (data
->list
==NULL
) {
5966 data
->list
= str_list_make_v3(talloc_autofree_context(), data
->value
, NULL
);
5969 return (const char **)data
->list
;
5972 /* Return parametric option from a given service. Type is a part of option before ':' */
5973 /* Parametric option has following syntax: 'Type: option = value' */
5975 int lp_parm_int(int snum
, const char *type
, const char *option
, int def
)
5977 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5979 if (data
&& data
->value
&& *data
->value
)
5980 return lp_int(data
->value
);
5985 /* Return parametric option from a given service. Type is a part of option before ':' */
5986 /* Parametric option has following syntax: 'Type: option = value' */
5988 unsigned long lp_parm_ulong(int snum
, const char *type
, const char *option
, unsigned long def
)
5990 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5992 if (data
&& data
->value
&& *data
->value
)
5993 return lp_ulong(data
->value
);
5998 /* Return parametric option from a given service. Type is a part of option before ':' */
5999 /* Parametric option has following syntax: 'Type: option = value' */
6001 bool lp_parm_bool(int snum
, const char *type
, const char *option
, bool def
)
6003 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6005 if (data
&& data
->value
&& *data
->value
)
6006 return lp_bool(data
->value
);
6011 /* Return parametric option from a given service. Type is a part of option before ':' */
6012 /* Parametric option has following syntax: 'Type: option = value' */
6014 int lp_parm_enum(int snum
, const char *type
, const char *option
,
6015 const struct enum_list
*_enum
, int def
)
6017 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6019 if (data
&& data
->value
&& *data
->value
&& _enum
)
6020 return lp_enum(data
->value
, _enum
);
6026 /***************************************************************************
6027 Initialise a service to the defaults.
6028 ***************************************************************************/
6030 static void init_service(struct service
*pservice
)
6032 memset((char *)pservice
, '\0', sizeof(struct service
));
6033 copy_service(pservice
, &sDefault
, NULL
);
6038 * free a param_opts structure.
6039 * param_opts handling should be moved to talloc;
6040 * then this whole functions reduces to a TALLOC_FREE().
6043 static void free_param_opts(struct param_opt_struct
**popts
)
6045 struct param_opt_struct
*opt
, *next_opt
;
6047 if (popts
== NULL
) {
6051 if (*popts
!= NULL
) {
6052 DEBUG(5, ("Freeing parametrics:\n"));
6055 while (opt
!= NULL
) {
6056 string_free(&opt
->key
);
6057 string_free(&opt
->value
);
6058 TALLOC_FREE(opt
->list
);
6059 next_opt
= opt
->next
;
6066 /***************************************************************************
6067 Free the dynamically allocated parts of a service struct.
6068 ***************************************************************************/
6070 static void free_service(struct service
*pservice
)
6075 if (pservice
->szService
)
6076 DEBUG(5, ("free_service: Freeing service %s\n",
6077 pservice
->szService
));
6079 free_parameters(pservice
);
6081 string_free(&pservice
->szService
);
6082 bitmap_free(pservice
->copymap
);
6084 free_param_opts(&pservice
->param_opt
);
6086 ZERO_STRUCTP(pservice
);
6090 /***************************************************************************
6091 remove a service indexed in the ServicePtrs array from the ServiceHash
6092 and free the dynamically allocated parts
6093 ***************************************************************************/
6095 static void free_service_byindex(int idx
)
6097 if ( !LP_SNUM_OK(idx
) )
6100 ServicePtrs
[idx
]->valid
= False
;
6101 invalid_services
[num_invalid_services
++] = idx
;
6103 /* we have to cleanup the hash record */
6105 if (ServicePtrs
[idx
]->szService
) {
6106 char *canon_name
= canonicalize_servicename(
6107 ServicePtrs
[idx
]->szService
);
6109 dbwrap_delete_bystring(ServiceHash
, canon_name
);
6110 TALLOC_FREE(canon_name
);
6113 free_service(ServicePtrs
[idx
]);
6116 /***************************************************************************
6117 Add a new service to the services array initialising it with the given
6119 ***************************************************************************/
6121 static int add_a_service(const struct service
*pservice
, const char *name
)
6124 struct service tservice
;
6125 int num_to_alloc
= iNumServices
+ 1;
6127 tservice
= *pservice
;
6129 /* it might already exist */
6131 i
= getservicebyname(name
, NULL
);
6133 /* Clean all parametric options for service */
6134 /* They will be added during parsing again */
6135 free_param_opts(&ServicePtrs
[i
]->param_opt
);
6140 /* find an invalid one */
6142 if (num_invalid_services
> 0) {
6143 i
= invalid_services
[--num_invalid_services
];
6146 /* if not, then create one */
6147 if (i
== iNumServices
) {
6148 struct service
**tsp
;
6151 tsp
= SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs
, struct service
*, num_to_alloc
);
6153 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
6157 ServicePtrs
[iNumServices
] = SMB_MALLOC_P(struct service
);
6158 if (!ServicePtrs
[iNumServices
]) {
6159 DEBUG(0,("add_a_service: out of memory!\n"));
6164 /* enlarge invalid_services here for now... */
6165 tinvalid
= SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services
, int,
6167 if (tinvalid
== NULL
) {
6168 DEBUG(0,("add_a_service: failed to enlarge "
6169 "invalid_services!\n"));
6172 invalid_services
= tinvalid
;
6174 free_service_byindex(i
);
6177 ServicePtrs
[i
]->valid
= True
;
6179 init_service(ServicePtrs
[i
]);
6180 copy_service(ServicePtrs
[i
], &tservice
, NULL
);
6182 string_set(&ServicePtrs
[i
]->szService
, name
);
6184 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
6185 i
, ServicePtrs
[i
]->szService
));
6187 if (!hash_a_service(ServicePtrs
[i
]->szService
, i
)) {
6194 /***************************************************************************
6195 Convert a string to uppercase and remove whitespaces.
6196 ***************************************************************************/
6198 static char *canonicalize_servicename(const char *src
)
6203 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
6207 result
= talloc_strdup(talloc_tos(), src
);
6208 SMB_ASSERT(result
!= NULL
);
6214 /***************************************************************************
6215 Add a name/index pair for the services array to the hash table.
6216 ***************************************************************************/
6218 static bool hash_a_service(const char *name
, int idx
)
6222 if ( !ServiceHash
) {
6223 DEBUG(10,("hash_a_service: creating servicehash\n"));
6224 ServiceHash
= db_open_rbt(NULL
);
6225 if ( !ServiceHash
) {
6226 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
6231 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
6234 canon_name
= canonicalize_servicename( name
);
6236 dbwrap_store_bystring(ServiceHash
, canon_name
,
6237 make_tdb_data((uint8
*)&idx
, sizeof(idx
)),
6240 TALLOC_FREE(canon_name
);
6245 /***************************************************************************
6246 Add a new home service, with the specified home directory, defaults coming
6248 ***************************************************************************/
6250 bool lp_add_home(const char *pszHomename
, int iDefaultService
,
6251 const char *user
, const char *pszHomedir
)
6255 if (pszHomename
== NULL
|| user
== NULL
|| pszHomedir
== NULL
||
6256 pszHomedir
[0] == '\0') {
6260 i
= add_a_service(ServicePtrs
[iDefaultService
], pszHomename
);
6265 if (!(*(ServicePtrs
[iDefaultService
]->szPath
))
6266 || strequal(ServicePtrs
[iDefaultService
]->szPath
, lp_pathname(GLOBAL_SECTION_SNUM
))) {
6267 string_set(&ServicePtrs
[i
]->szPath
, pszHomedir
);
6270 if (!(*(ServicePtrs
[i
]->comment
))) {
6271 char *comment
= NULL
;
6272 if (asprintf(&comment
, "Home directory of %s", user
) < 0) {
6275 string_set(&ServicePtrs
[i
]->comment
, comment
);
6279 /* set the browseable flag from the global default */
6281 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6282 ServicePtrs
[i
]->bAccessBasedShareEnum
= sDefault
.bAccessBasedShareEnum
;
6284 ServicePtrs
[i
]->autoloaded
= True
;
6286 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename
,
6287 user
, ServicePtrs
[i
]->szPath
));
6292 /***************************************************************************
6293 Add a new service, based on an old one.
6294 ***************************************************************************/
6296 int lp_add_service(const char *pszService
, int iDefaultService
)
6298 if (iDefaultService
< 0) {
6299 return add_a_service(&sDefault
, pszService
);
6302 return (add_a_service(ServicePtrs
[iDefaultService
], pszService
));
6305 /***************************************************************************
6306 Add the IPC service.
6307 ***************************************************************************/
6309 static bool lp_add_ipc(const char *ipc_name
, bool guest_ok
)
6311 char *comment
= NULL
;
6312 int i
= add_a_service(&sDefault
, ipc_name
);
6317 if (asprintf(&comment
, "IPC Service (%s)",
6318 Globals
.szServerString
) < 0) {
6322 string_set(&ServicePtrs
[i
]->szPath
, tmpdir());
6323 string_set(&ServicePtrs
[i
]->szUsername
, "");
6324 string_set(&ServicePtrs
[i
]->comment
, comment
);
6325 string_set(&ServicePtrs
[i
]->fstype
, "IPC");
6326 ServicePtrs
[i
]->iMaxConnections
= 0;
6327 ServicePtrs
[i
]->bAvailable
= True
;
6328 ServicePtrs
[i
]->bRead_only
= True
;
6329 ServicePtrs
[i
]->bGuest_only
= False
;
6330 ServicePtrs
[i
]->bAdministrative_share
= True
;
6331 ServicePtrs
[i
]->bGuest_ok
= guest_ok
;
6332 ServicePtrs
[i
]->bPrint_ok
= False
;
6333 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6335 DEBUG(3, ("adding IPC service\n"));
6341 /***************************************************************************
6342 Add a new printer service, with defaults coming from service iFrom.
6343 ***************************************************************************/
6345 bool lp_add_printer(const char *pszPrintername
, int iDefaultService
)
6347 const char *comment
= "From Printcap";
6348 int i
= add_a_service(ServicePtrs
[iDefaultService
], pszPrintername
);
6353 /* note that we do NOT default the availability flag to True - */
6354 /* we take it from the default service passed. This allows all */
6355 /* dynamic printers to be disabled by disabling the [printers] */
6356 /* entry (if/when the 'available' keyword is implemented!). */
6358 /* the printer name is set to the service name. */
6359 string_set(&ServicePtrs
[i
]->szPrintername
, pszPrintername
);
6360 string_set(&ServicePtrs
[i
]->comment
, comment
);
6362 /* set the browseable flag from the gloabl default */
6363 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6365 /* Printers cannot be read_only. */
6366 ServicePtrs
[i
]->bRead_only
= False
;
6367 /* No share modes on printer services. */
6368 ServicePtrs
[i
]->bShareModes
= False
;
6369 /* No oplocks on printer services. */
6370 ServicePtrs
[i
]->bOpLocks
= False
;
6371 /* Printer services must be printable. */
6372 ServicePtrs
[i
]->bPrint_ok
= True
;
6374 DEBUG(3, ("adding printer service %s\n", pszPrintername
));
6380 /***************************************************************************
6381 Check whether the given parameter name is valid.
6382 Parametric options (names containing a colon) are considered valid.
6383 ***************************************************************************/
6385 bool lp_parameter_is_valid(const char *pszParmName
)
6387 return ((map_parameter(pszParmName
) != -1) ||
6388 (strchr(pszParmName
, ':') != NULL
));
6391 /***************************************************************************
6392 Check whether the given name is the name of a global parameter.
6393 Returns True for strings belonging to parameters of class
6394 P_GLOBAL, False for all other strings, also for parametric options
6395 and strings not belonging to any option.
6396 ***************************************************************************/
6398 bool lp_parameter_is_global(const char *pszParmName
)
6400 int num
= map_parameter(pszParmName
);
6403 return (parm_table
[num
].p_class
== P_GLOBAL
);
6409 /**************************************************************************
6410 Check whether the given name is the canonical name of a parameter.
6411 Returns False if it is not a valid parameter Name.
6412 For parametric options, True is returned.
6413 **************************************************************************/
6415 bool lp_parameter_is_canonical(const char *parm_name
)
6417 if (!lp_parameter_is_valid(parm_name
)) {
6421 return (map_parameter(parm_name
) ==
6422 map_parameter_canonical(parm_name
, NULL
));
6425 /**************************************************************************
6426 Determine the canonical name for a parameter.
6427 Indicate when it is an inverse (boolean) synonym instead of a
6429 **************************************************************************/
6431 bool lp_canonicalize_parameter(const char *parm_name
, const char **canon_parm
,
6436 if (!lp_parameter_is_valid(parm_name
)) {
6441 num
= map_parameter_canonical(parm_name
, inverse
);
6443 /* parametric option */
6444 *canon_parm
= parm_name
;
6446 *canon_parm
= parm_table
[num
].label
;
6453 /**************************************************************************
6454 Determine the canonical name for a parameter.
6455 Turn the value given into the inverse boolean expression when
6456 the synonym is an invers boolean synonym.
6458 Return True if parm_name is a valid parameter name and
6459 in case it is an invers boolean synonym, if the val string could
6460 successfully be converted to the reverse bool.
6461 Return false in all other cases.
6462 **************************************************************************/
6464 bool lp_canonicalize_parameter_with_value(const char *parm_name
,
6466 const char **canon_parm
,
6467 const char **canon_val
)
6472 if (!lp_parameter_is_valid(parm_name
)) {
6478 num
= map_parameter_canonical(parm_name
, &inverse
);
6480 /* parametric option */
6481 *canon_parm
= parm_name
;
6484 *canon_parm
= parm_table
[num
].label
;
6486 if (!lp_invert_boolean(val
, canon_val
)) {
6498 /***************************************************************************
6499 Map a parameter's string representation to something we can use.
6500 Returns False if the parameter string is not recognised, else TRUE.
6501 ***************************************************************************/
6503 static int map_parameter(const char *pszParmName
)
6507 if (*pszParmName
== '-' && !strequal(pszParmName
, "-valid"))
6510 for (iIndex
= 0; parm_table
[iIndex
].label
; iIndex
++)
6511 if (strwicmp(parm_table
[iIndex
].label
, pszParmName
) == 0)
6514 /* Warn only if it isn't parametric option */
6515 if (strchr(pszParmName
, ':') == NULL
)
6516 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName
));
6517 /* We do return 'fail' for parametric options as well because they are
6518 stored in different storage
6523 /***************************************************************************
6524 Map a parameter's string representation to the index of the canonical
6525 form of the parameter (it might be a synonym).
6526 Returns -1 if the parameter string is not recognised.
6527 ***************************************************************************/
6529 static int map_parameter_canonical(const char *pszParmName
, bool *inverse
)
6531 int parm_num
, canon_num
;
6532 bool loc_inverse
= False
;
6534 parm_num
= map_parameter(pszParmName
);
6535 if ((parm_num
< 0) || !(parm_table
[parm_num
].flags
& FLAG_HIDE
)) {
6536 /* invalid, parametric or no canidate for synonyms ... */
6540 for (canon_num
= 0; parm_table
[canon_num
].label
; canon_num
++) {
6541 if (is_synonym_of(parm_num
, canon_num
, &loc_inverse
)) {
6542 parm_num
= canon_num
;
6548 if (inverse
!= NULL
) {
6549 *inverse
= loc_inverse
;
6554 /***************************************************************************
6555 return true if parameter number parm1 is a synonym of parameter
6556 number parm2 (parm2 being the principal name).
6557 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6559 ***************************************************************************/
6561 static bool is_synonym_of(int parm1
, int parm2
, bool *inverse
)
6563 if ((parm_table
[parm1
].ptr
== parm_table
[parm2
].ptr
) &&
6564 (parm_table
[parm1
].flags
& FLAG_HIDE
) &&
6565 !(parm_table
[parm2
].flags
& FLAG_HIDE
))
6567 if (inverse
!= NULL
) {
6568 if ((parm_table
[parm1
].type
== P_BOOLREV
) &&
6569 (parm_table
[parm2
].type
== P_BOOL
))
6581 /***************************************************************************
6582 Show one parameter's name, type, [values,] and flags.
6583 (helper functions for show_parameter_list)
6584 ***************************************************************************/
6586 static void show_parameter(int parmIndex
)
6588 int enumIndex
, flagIndex
;
6593 const char *type
[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6594 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6596 unsigned flags
[] = { FLAG_BASIC
, FLAG_SHARE
, FLAG_PRINT
, FLAG_GLOBAL
,
6597 FLAG_WIZARD
, FLAG_ADVANCED
, FLAG_DEVELOPER
, FLAG_DEPRECATED
,
6598 FLAG_HIDE
, FLAG_DOS_STRING
};
6599 const char *flag_names
[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6600 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6601 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL
};
6603 printf("%s=%s", parm_table
[parmIndex
].label
,
6604 type
[parm_table
[parmIndex
].type
]);
6605 if (parm_table
[parmIndex
].type
== P_ENUM
) {
6608 parm_table
[parmIndex
].enum_list
[enumIndex
].name
;
6612 enumIndex
? "|" : "",
6613 parm_table
[parmIndex
].enum_list
[enumIndex
].name
);
6618 for (flagIndex
=0; flag_names
[flagIndex
]; flagIndex
++) {
6619 if (parm_table
[parmIndex
].flags
& flags
[flagIndex
]) {
6622 flag_names
[flagIndex
]);
6627 /* output synonyms */
6629 for (parmIndex2
=0; parm_table
[parmIndex2
].label
; parmIndex2
++) {
6630 if (is_synonym_of(parmIndex
, parmIndex2
, &inverse
)) {
6631 printf(" (%ssynonym of %s)", inverse
? "inverse " : "",
6632 parm_table
[parmIndex2
].label
);
6633 } else if (is_synonym_of(parmIndex2
, parmIndex
, &inverse
)) {
6635 printf(" (synonyms: ");
6640 printf("%s%s", parm_table
[parmIndex2
].label
,
6641 inverse
? "[i]" : "");
6651 /***************************************************************************
6652 Show all parameter's name, type, [values,] and flags.
6653 ***************************************************************************/
6655 void show_parameter_list(void)
6657 int classIndex
, parmIndex
;
6658 const char *section_names
[] = { "local", "global", NULL
};
6660 for (classIndex
=0; section_names
[classIndex
]; classIndex
++) {
6661 printf("[%s]\n", section_names
[classIndex
]);
6662 for (parmIndex
= 0; parm_table
[parmIndex
].label
; parmIndex
++) {
6663 if (parm_table
[parmIndex
].p_class
== classIndex
) {
6664 show_parameter(parmIndex
);
6670 /***************************************************************************
6671 Check if a given string correctly represents a boolean value.
6672 ***************************************************************************/
6674 bool lp_string_is_valid_boolean(const char *parm_value
)
6676 return set_boolean(parm_value
, NULL
);
6679 /***************************************************************************
6680 Get the standard string representation of a boolean value ("yes" or "no")
6681 ***************************************************************************/
6683 static const char *get_boolean(bool bool_value
)
6685 static const char *yes_str
= "yes";
6686 static const char *no_str
= "no";
6688 return (bool_value
? yes_str
: no_str
);
6691 /***************************************************************************
6692 Provide the string of the negated boolean value associated to the boolean
6693 given as a string. Returns False if the passed string does not correctly
6694 represent a boolean.
6695 ***************************************************************************/
6697 bool lp_invert_boolean(const char *str
, const char **inverse_str
)
6701 if (!set_boolean(str
, &val
)) {
6705 *inverse_str
= get_boolean(!val
);
6709 /***************************************************************************
6710 Provide the canonical string representation of a boolean value given
6711 as a string. Return True on success, False if the string given does
6712 not correctly represent a boolean.
6713 ***************************************************************************/
6715 bool lp_canonicalize_boolean(const char *str
, const char**canon_str
)
6719 if (!set_boolean(str
, &val
)) {
6723 *canon_str
= get_boolean(val
);
6727 /***************************************************************************
6728 Find a service by name. Otherwise works like get_service.
6729 ***************************************************************************/
6731 static int getservicebyname(const char *pszServiceName
, struct service
*pserviceDest
)
6737 if (ServiceHash
== NULL
) {
6741 canon_name
= canonicalize_servicename(pszServiceName
);
6743 data
= dbwrap_fetch_bystring(ServiceHash
, canon_name
, canon_name
);
6745 if ((data
.dptr
!= NULL
) && (data
.dsize
== sizeof(iService
))) {
6746 iService
= *(int *)data
.dptr
;
6749 TALLOC_FREE(canon_name
);
6751 if ((iService
!= -1) && (LP_SNUM_OK(iService
))
6752 && (pserviceDest
!= NULL
)) {
6753 copy_service(pserviceDest
, ServicePtrs
[iService
], NULL
);
6759 /***************************************************************************
6760 Copy a service structure to another.
6761 If pcopymapDest is NULL then copy all fields
6762 ***************************************************************************/
6765 * Add a parametric option to a param_opt_struct,
6766 * replacing old value, if already present.
6768 static void set_param_opt(struct param_opt_struct
**opt_list
,
6769 const char *opt_name
,
6770 const char *opt_value
)
6772 struct param_opt_struct
*new_opt
, *opt
;
6775 if (opt_list
== NULL
) {
6782 /* Traverse destination */
6784 /* If we already have same option, override it */
6785 if (strwicmp(opt
->key
, opt_name
) == 0) {
6786 string_free(&opt
->value
);
6787 TALLOC_FREE(opt
->list
);
6788 opt
->value
= SMB_STRDUP(opt_value
);
6795 new_opt
= SMB_XMALLOC_P(struct param_opt_struct
);
6796 new_opt
->key
= SMB_STRDUP(opt_name
);
6797 new_opt
->value
= SMB_STRDUP(opt_value
);
6798 new_opt
->list
= NULL
;
6799 DLIST_ADD(*opt_list
, new_opt
);
6803 static void copy_service(struct service
*pserviceDest
, struct service
*pserviceSource
,
6804 struct bitmap
*pcopymapDest
)
6807 bool bcopyall
= (pcopymapDest
== NULL
);
6808 struct param_opt_struct
*data
;
6810 for (i
= 0; parm_table
[i
].label
; i
++)
6811 if (parm_table
[i
].ptr
&& parm_table
[i
].p_class
== P_LOCAL
&&
6812 (bcopyall
|| bitmap_query(pcopymapDest
,i
))) {
6813 void *def_ptr
= parm_table
[i
].ptr
;
6815 ((char *)pserviceSource
) + PTR_DIFF(def_ptr
,
6818 ((char *)pserviceDest
) + PTR_DIFF(def_ptr
,
6821 switch (parm_table
[i
].type
) {
6824 *(bool *)dest_ptr
= *(bool *)src_ptr
;
6830 *(int *)dest_ptr
= *(int *)src_ptr
;
6834 *(char *)dest_ptr
= *(char *)src_ptr
;
6838 string_set((char **)dest_ptr
,
6843 string_set((char **)dest_ptr
,
6845 strupper_m(*(char **)dest_ptr
);
6848 TALLOC_FREE(*((char ***)dest_ptr
));
6849 *((char ***)dest_ptr
) = str_list_copy(NULL
,
6850 *(const char ***)src_ptr
);
6858 init_copymap(pserviceDest
);
6859 if (pserviceSource
->copymap
)
6860 bitmap_copy(pserviceDest
->copymap
,
6861 pserviceSource
->copymap
);
6864 data
= pserviceSource
->param_opt
;
6866 set_param_opt(&pserviceDest
->param_opt
, data
->key
, data
->value
);
6871 /***************************************************************************
6872 Check a service for consistency. Return False if the service is in any way
6873 incomplete or faulty, else True.
6874 ***************************************************************************/
6876 bool service_ok(int iService
)
6881 if (ServicePtrs
[iService
]->szService
[0] == '\0') {
6882 DEBUG(0, ("The following message indicates an internal error:\n"));
6883 DEBUG(0, ("No service name in service entry.\n"));
6887 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
6888 /* I can't see why you'd want a non-printable printer service... */
6889 if (strwicmp(ServicePtrs
[iService
]->szService
, PRINTERS_NAME
) == 0) {
6890 if (!ServicePtrs
[iService
]->bPrint_ok
) {
6891 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
6892 ServicePtrs
[iService
]->szService
));
6893 ServicePtrs
[iService
]->bPrint_ok
= True
;
6895 /* [printers] service must also be non-browsable. */
6896 if (ServicePtrs
[iService
]->bBrowseable
)
6897 ServicePtrs
[iService
]->bBrowseable
= False
;
6900 if (ServicePtrs
[iService
]->szPath
[0] == '\0' &&
6901 strwicmp(ServicePtrs
[iService
]->szService
, HOMES_NAME
) != 0 &&
6902 ServicePtrs
[iService
]->szMSDfsProxy
[0] == '\0'
6904 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
6905 ServicePtrs
[iService
]->szService
));
6906 ServicePtrs
[iService
]->bAvailable
= False
;
6909 /* If a service is flagged unavailable, log the fact at level 1. */
6910 if (!ServicePtrs
[iService
]->bAvailable
)
6911 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
6912 ServicePtrs
[iService
]->szService
));
6917 static struct smbconf_ctx
*lp_smbconf_ctx(void)
6920 static struct smbconf_ctx
*conf_ctx
= NULL
;
6922 if (conf_ctx
== NULL
) {
6923 werr
= smbconf_init(NULL
, &conf_ctx
, "registry:");
6924 if (!W_ERROR_IS_OK(werr
)) {
6925 DEBUG(1, ("error initializing registry configuration: "
6926 "%s\n", win_errstr(werr
)));
6934 static bool process_smbconf_service(struct smbconf_service
*service
)
6939 if (service
== NULL
) {
6943 ret
= do_section(service
->name
, NULL
);
6947 for (count
= 0; count
< service
->num_params
; count
++) {
6948 ret
= do_parameter(service
->param_names
[count
],
6949 service
->param_values
[count
],
6955 if (iServiceIndex
>= 0) {
6956 return service_ok(iServiceIndex
);
6962 * load a service from registry and activate it
6964 bool process_registry_service(const char *service_name
)
6967 struct smbconf_service
*service
= NULL
;
6968 TALLOC_CTX
*mem_ctx
= talloc_stackframe();
6969 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
6972 if (conf_ctx
== NULL
) {
6976 DEBUG(5, ("process_registry_service: service name %s\n", service_name
));
6978 if (!smbconf_share_exists(conf_ctx
, service_name
)) {
6980 * Registry does not contain data for this service (yet),
6981 * but make sure lp_load doesn't return false.
6987 werr
= smbconf_get_share(conf_ctx
, mem_ctx
, service_name
, &service
);
6988 if (!W_ERROR_IS_OK(werr
)) {
6992 ret
= process_smbconf_service(service
);
6998 smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
, NULL
);
7001 TALLOC_FREE(mem_ctx
);
7006 * process_registry_globals
7008 static bool process_registry_globals(void)
7012 add_to_file_list(INCLUDE_REGISTRY_NAME
, INCLUDE_REGISTRY_NAME
);
7014 ret
= do_parameter("registry shares", "yes", NULL
);
7019 return process_registry_service(GLOBAL_NAME
);
7022 bool process_registry_shares(void)
7026 struct smbconf_service
**service
= NULL
;
7027 uint32_t num_shares
= 0;
7028 TALLOC_CTX
*mem_ctx
= talloc_stackframe();
7029 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
7032 if (conf_ctx
== NULL
) {
7036 werr
= smbconf_get_config(conf_ctx
, mem_ctx
, &num_shares
, &service
);
7037 if (!W_ERROR_IS_OK(werr
)) {
7043 for (count
= 0; count
< num_shares
; count
++) {
7044 if (strequal(service
[count
]->name
, GLOBAL_NAME
)) {
7047 ret
= process_smbconf_service(service
[count
]);
7054 smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
, NULL
);
7057 TALLOC_FREE(mem_ctx
);
7061 #define MAX_INCLUDE_DEPTH 100
7063 static uint8_t include_depth
;
7065 static struct file_lists
{
7066 struct file_lists
*next
;
7070 } *file_lists
= NULL
;
7072 /*******************************************************************
7073 Keep a linked list of all config files so we know when one has changed
7074 it's date and needs to be reloaded.
7075 ********************************************************************/
7077 static void add_to_file_list(const char *fname
, const char *subfname
)
7079 struct file_lists
*f
= file_lists
;
7082 if (f
->name
&& !strcmp(f
->name
, fname
))
7088 f
= SMB_MALLOC_P(struct file_lists
);
7091 f
->next
= file_lists
;
7092 f
->name
= SMB_STRDUP(fname
);
7097 f
->subfname
= SMB_STRDUP(subfname
);
7103 f
->modtime
= file_modtime(subfname
);
7105 time_t t
= file_modtime(subfname
);
7112 * Free the file lists
7114 static void free_file_list(void)
7116 struct file_lists
*f
;
7117 struct file_lists
*next
;
7122 SAFE_FREE( f
->name
);
7123 SAFE_FREE( f
->subfname
);
7132 * Utility function for outsiders to check if we're running on registry.
7134 bool lp_config_backend_is_registry(void)
7136 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY
);
7140 * Utility function to check if the config backend is FILE.
7142 bool lp_config_backend_is_file(void)
7144 return (lp_config_backend() == CONFIG_BACKEND_FILE
);
7147 /*******************************************************************
7148 Check if a config file has changed date.
7149 ********************************************************************/
7151 bool lp_file_list_changed(void)
7153 struct file_lists
*f
= file_lists
;
7155 DEBUG(6, ("lp_file_list_changed()\n"));
7161 if (strequal(f
->name
, INCLUDE_REGISTRY_NAME
)) {
7162 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
7164 if (conf_ctx
== NULL
) {
7167 if (smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
,
7170 DEBUGADD(6, ("registry config changed\n"));
7174 n2
= alloc_sub_basic(get_current_username(),
7175 current_user_info
.domain
,
7180 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
7181 f
->name
, n2
, ctime(&f
->modtime
)));
7183 mod_time
= file_modtime(n2
);
7186 ((f
->modtime
!= mod_time
) ||
7187 (f
->subfname
== NULL
) ||
7188 (strcmp(n2
, f
->subfname
) != 0)))
7191 ("file %s modified: %s\n", n2
,
7193 f
->modtime
= mod_time
;
7194 SAFE_FREE(f
->subfname
);
7195 f
->subfname
= n2
; /* Passing ownership of
7196 return from alloc_sub_basic
7208 /***************************************************************************
7209 Run standard_sub_basic on netbios name... needed because global_myname
7210 is not accessed through any lp_ macro.
7211 Note: We must *NOT* use string_set() here as ptr points to global_myname.
7212 ***************************************************************************/
7214 static bool handle_netbios_name(int snum
, const char *pszParmValue
, char **ptr
)
7217 char *netbios_name
= alloc_sub_basic(get_current_username(),
7218 current_user_info
.domain
,
7221 ret
= set_global_myname(netbios_name
);
7222 SAFE_FREE(netbios_name
);
7223 string_set(&Globals
.szNetbiosName
,global_myname());
7225 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
7231 static bool handle_charset(int snum
, const char *pszParmValue
, char **ptr
)
7233 if (strcmp(*ptr
, pszParmValue
) != 0) {
7234 string_set(ptr
, pszParmValue
);
7242 static bool handle_workgroup(int snum
, const char *pszParmValue
, char **ptr
)
7246 ret
= set_global_myworkgroup(pszParmValue
);
7247 string_set(&Globals
.szWorkgroup
,lp_workgroup());
7252 static bool handle_netbios_scope(int snum
, const char *pszParmValue
, char **ptr
)
7256 ret
= set_global_scope(pszParmValue
);
7257 string_set(&Globals
.szNetbiosScope
,global_scope());
7262 static bool handle_netbios_aliases(int snum
, const char *pszParmValue
, char **ptr
)
7264 TALLOC_FREE(Globals
.szNetbiosAliases
);
7265 Globals
.szNetbiosAliases
= str_list_make_v3(talloc_autofree_context(), pszParmValue
, NULL
);
7266 return set_netbios_aliases((const char **)Globals
.szNetbiosAliases
);
7269 /***************************************************************************
7270 Handle the include operation.
7271 ***************************************************************************/
7272 static bool bAllowIncludeRegistry
= true;
7274 static bool handle_include(int snum
, const char *pszParmValue
, char **ptr
)
7278 if (include_depth
>= MAX_INCLUDE_DEPTH
) {
7279 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7284 if (strequal(pszParmValue
, INCLUDE_REGISTRY_NAME
)) {
7285 if (!bAllowIncludeRegistry
) {
7288 if (bInGlobalSection
) {
7291 ret
= process_registry_globals();
7295 DEBUG(1, ("\"include = registry\" only effective "
7296 "in %s section\n", GLOBAL_NAME
));
7301 fname
= alloc_sub_basic(get_current_username(),
7302 current_user_info
.domain
,
7305 add_to_file_list(pszParmValue
, fname
);
7307 string_set(ptr
, fname
);
7309 if (file_exist(fname
)) {
7312 ret
= pm_process(fname
, do_section
, do_parameter
, NULL
);
7318 DEBUG(2, ("Can't find include file %s\n", fname
));
7323 /***************************************************************************
7324 Handle the interpretation of the copy parameter.
7325 ***************************************************************************/
7327 static bool handle_copy(int snum
, const char *pszParmValue
, char **ptr
)
7331 struct service serviceTemp
;
7333 string_set(ptr
, pszParmValue
);
7335 init_service(&serviceTemp
);
7339 DEBUG(3, ("Copying service from service %s\n", pszParmValue
));
7341 if ((iTemp
= getservicebyname(pszParmValue
, &serviceTemp
)) >= 0) {
7342 if (iTemp
== iServiceIndex
) {
7343 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue
));
7345 copy_service(ServicePtrs
[iServiceIndex
],
7347 ServicePtrs
[iServiceIndex
]->copymap
);
7351 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue
));
7355 free_service(&serviceTemp
);
7359 static bool handle_ldap_debug_level(int snum
, const char *pszParmValue
, char **ptr
)
7361 Globals
.ldap_debug_level
= lp_int(pszParmValue
);
7362 init_ldap_debugging();
7366 /***************************************************************************
7367 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7372 idmap uid = 1000-1999
7375 We only do simple parsing checks here. The strings are parsed into useful
7376 structures in the idmap daemon code.
7378 ***************************************************************************/
7380 /* Some lp_ routines to return idmap [ug]id information */
7382 static uid_t idmap_uid_low
, idmap_uid_high
;
7383 static gid_t idmap_gid_low
, idmap_gid_high
;
7385 bool lp_idmap_uid(uid_t
*low
, uid_t
*high
)
7387 if (idmap_uid_low
== 0 || idmap_uid_high
== 0)
7391 *low
= idmap_uid_low
;
7394 *high
= idmap_uid_high
;
7399 bool lp_idmap_gid(gid_t
*low
, gid_t
*high
)
7401 if (idmap_gid_low
== 0 || idmap_gid_high
== 0)
7405 *low
= idmap_gid_low
;
7408 *high
= idmap_gid_high
;
7413 /* Do some simple checks on "idmap [ug]id" parameter values */
7415 static bool handle_idmap_uid(int snum
, const char *pszParmValue
, char **ptr
)
7419 if (sscanf(pszParmValue
, "%u - %u", &low
, &high
) != 2 || high
< low
)
7424 string_set(ptr
, pszParmValue
);
7426 idmap_uid_low
= low
;
7427 idmap_uid_high
= high
;
7432 static bool handle_idmap_gid(int snum
, const char *pszParmValue
, char **ptr
)
7436 if (sscanf(pszParmValue
, "%u - %u", &low
, &high
) != 2 || high
< low
)
7441 string_set(ptr
, pszParmValue
);
7443 idmap_gid_low
= low
;
7444 idmap_gid_high
= high
;
7449 /***************************************************************************
7450 Handle the DEBUG level list.
7451 ***************************************************************************/
7453 static bool handle_debug_list( int snum
, const char *pszParmValueIn
, char **ptr
)
7455 string_set(ptr
, pszParmValueIn
);
7456 return debug_parse_levels(pszParmValueIn
);
7459 /***************************************************************************
7460 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7461 ***************************************************************************/
7463 static const char *append_ldap_suffix( const char *str
)
7465 const char *suffix_string
;
7468 suffix_string
= talloc_asprintf(talloc_tos(), "%s,%s", str
,
7469 Globals
.szLdapSuffix
);
7470 if ( !suffix_string
) {
7471 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7475 return suffix_string
;
7478 const char *lp_ldap_machine_suffix(void)
7480 if (Globals
.szLdapMachineSuffix
[0])
7481 return append_ldap_suffix(Globals
.szLdapMachineSuffix
);
7483 return lp_string(Globals
.szLdapSuffix
);
7486 const char *lp_ldap_user_suffix(void)
7488 if (Globals
.szLdapUserSuffix
[0])
7489 return append_ldap_suffix(Globals
.szLdapUserSuffix
);
7491 return lp_string(Globals
.szLdapSuffix
);
7494 const char *lp_ldap_group_suffix(void)
7496 if (Globals
.szLdapGroupSuffix
[0])
7497 return append_ldap_suffix(Globals
.szLdapGroupSuffix
);
7499 return lp_string(Globals
.szLdapSuffix
);
7502 const char *lp_ldap_idmap_suffix(void)
7504 if (Globals
.szLdapIdmapSuffix
[0])
7505 return append_ldap_suffix(Globals
.szLdapIdmapSuffix
);
7507 return lp_string(Globals
.szLdapSuffix
);
7510 /****************************************************************************
7511 set the value for a P_ENUM
7512 ***************************************************************************/
7514 static void lp_set_enum_parm( struct parm_struct
*parm
, const char *pszParmValue
,
7519 for (i
= 0; parm
->enum_list
[i
].name
; i
++) {
7520 if ( strequal(pszParmValue
, parm
->enum_list
[i
].name
)) {
7521 *ptr
= parm
->enum_list
[i
].value
;
7525 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7526 pszParmValue
, parm
->label
));
7529 /***************************************************************************
7530 ***************************************************************************/
7532 static bool handle_printing(int snum
, const char *pszParmValue
, char **ptr
)
7534 static int parm_num
= -1;
7537 if ( parm_num
== -1 )
7538 parm_num
= map_parameter( "printing" );
7540 lp_set_enum_parm( &parm_table
[parm_num
], pszParmValue
, (int*)ptr
);
7545 s
= ServicePtrs
[snum
];
7547 init_printer_values( s
);
7553 /***************************************************************************
7554 Initialise a copymap.
7555 ***************************************************************************/
7557 static void init_copymap(struct service
*pservice
)
7560 if (pservice
->copymap
) {
7561 bitmap_free(pservice
->copymap
);
7563 pservice
->copymap
= bitmap_allocate(NUMPARAMETERS
);
7564 if (!pservice
->copymap
)
7566 ("Couldn't allocate copymap!! (size %d)\n",
7567 (int)NUMPARAMETERS
));
7569 for (i
= 0; i
< NUMPARAMETERS
; i
++)
7570 bitmap_set(pservice
->copymap
, i
);
7573 /***************************************************************************
7574 Return the local pointer to a parameter given a service struct and the
7575 pointer into the default structure.
7576 ***************************************************************************/
7578 static void *lp_local_ptr(struct service
*service
, void *ptr
)
7580 return (void *)(((char *)service
) + PTR_DIFF(ptr
, &sDefault
));
7583 /***************************************************************************
7584 Return the local pointer to a parameter given the service number and the
7585 pointer into the default structure.
7586 ***************************************************************************/
7588 void *lp_local_ptr_by_snum(int snum
, void *ptr
)
7590 return lp_local_ptr(ServicePtrs
[snum
], ptr
);
7593 /***************************************************************************
7594 Process a parameter for a particular service number. If snum < 0
7595 then assume we are in the globals.
7596 ***************************************************************************/
7598 bool lp_do_parameter(int snum
, const char *pszParmName
, const char *pszParmValue
)
7601 void *parm_ptr
= NULL
; /* where we are going to store the result */
7602 void *def_ptr
= NULL
;
7603 struct param_opt_struct
**opt_list
;
7605 parmnum
= map_parameter(pszParmName
);
7608 if (strchr(pszParmName
, ':') == NULL
) {
7609 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7615 * We've got a parametric option
7618 opt_list
= (snum
< 0)
7619 ? &Globals
.param_opt
: &ServicePtrs
[snum
]->param_opt
;
7620 set_param_opt(opt_list
, pszParmName
, pszParmValue
);
7625 if (parm_table
[parmnum
].flags
& FLAG_DEPRECATED
) {
7626 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7630 def_ptr
= parm_table
[parmnum
].ptr
;
7632 /* we might point at a service, the default service or a global */
7636 if (parm_table
[parmnum
].p_class
== P_GLOBAL
) {
7638 ("Global parameter %s found in service section!\n",
7642 parm_ptr
= lp_local_ptr_by_snum(snum
, def_ptr
);
7646 if (!ServicePtrs
[snum
]->copymap
)
7647 init_copymap(ServicePtrs
[snum
]);
7649 /* this handles the aliases - set the copymap for other entries with
7650 the same data pointer */
7651 for (i
= 0; parm_table
[i
].label
; i
++)
7652 if (parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
)
7653 bitmap_clear(ServicePtrs
[snum
]->copymap
, i
);
7656 /* if it is a special case then go ahead */
7657 if (parm_table
[parmnum
].special
) {
7658 return parm_table
[parmnum
].special(snum
, pszParmValue
,
7662 /* now switch on the type of variable it is */
7663 switch (parm_table
[parmnum
].type
)
7666 *(bool *)parm_ptr
= lp_bool(pszParmValue
);
7670 *(bool *)parm_ptr
= !lp_bool(pszParmValue
);
7674 *(int *)parm_ptr
= lp_int(pszParmValue
);
7678 *(char *)parm_ptr
= *pszParmValue
;
7682 i
= sscanf(pszParmValue
, "%o", (int *)parm_ptr
);
7684 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName
));
7689 TALLOC_FREE(*((char ***)parm_ptr
));
7690 *(char ***)parm_ptr
= str_list_make_v3(
7691 talloc_autofree_context(), pszParmValue
, NULL
);
7695 string_set((char **)parm_ptr
, pszParmValue
);
7699 string_set((char **)parm_ptr
, pszParmValue
);
7700 strupper_m(*(char **)parm_ptr
);
7704 lp_set_enum_parm( &parm_table
[parmnum
], pszParmValue
, (int*)parm_ptr
);
7713 /***************************************************************************
7714 Process a parameter.
7715 ***************************************************************************/
7717 static bool do_parameter(const char *pszParmName
, const char *pszParmValue
,
7720 if (!bInGlobalSection
&& bGlobalOnly
)
7723 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName
, pszParmValue
));
7725 return (lp_do_parameter(bInGlobalSection
? -2 : iServiceIndex
,
7726 pszParmName
, pszParmValue
));
7729 /***************************************************************************
7730 Print a parameter of the specified type.
7731 ***************************************************************************/
7733 static void print_parameter(struct parm_struct
*p
, void *ptr
, FILE * f
)
7739 for (i
= 0; p
->enum_list
[i
].name
; i
++) {
7740 if (*(int *)ptr
== p
->enum_list
[i
].value
) {
7742 p
->enum_list
[i
].name
);
7749 fprintf(f
, "%s", BOOLSTR(*(bool *)ptr
));
7753 fprintf(f
, "%s", BOOLSTR(!*(bool *)ptr
));
7757 fprintf(f
, "%d", *(int *)ptr
);
7761 fprintf(f
, "%c", *(char *)ptr
);
7765 char *o
= octal_string(*(int *)ptr
);
7766 fprintf(f
, "%s", o
);
7772 if ((char ***)ptr
&& *(char ***)ptr
) {
7773 char **list
= *(char ***)ptr
;
7774 for (; *list
; list
++) {
7775 /* surround strings with whitespace in double quotes */
7776 if ( strchr_m( *list
, ' ' ) )
7777 fprintf(f
, "\"%s\"%s", *list
, ((*(list
+1))?", ":""));
7779 fprintf(f
, "%s%s", *list
, ((*(list
+1))?", ":""));
7786 if (*(char **)ptr
) {
7787 fprintf(f
, "%s", *(char **)ptr
);
7795 /***************************************************************************
7796 Check if two parameters are equal.
7797 ***************************************************************************/
7799 static bool equal_parameter(parm_type type
, void *ptr1
, void *ptr2
)
7804 return (*((bool *)ptr1
) == *((bool *)ptr2
));
7809 return (*((int *)ptr1
) == *((int *)ptr2
));
7812 return (*((char *)ptr1
) == *((char *)ptr2
));
7815 return str_list_equal(*(const char ***)ptr1
, *(const char ***)ptr2
);
7820 char *p1
= *(char **)ptr1
, *p2
= *(char **)ptr2
;
7825 return (p1
== p2
|| strequal(p1
, p2
));
7833 /***************************************************************************
7834 Initialize any local varients in the sDefault table.
7835 ***************************************************************************/
7837 void init_locals(void)
7842 /***************************************************************************
7843 Process a new section (service). At this stage all sections are services.
7844 Later we'll have special sections that permit server parameters to be set.
7845 Returns True on success, False on failure.
7846 ***************************************************************************/
7848 static bool do_section(const char *pszSectionName
, void *userdata
)
7851 bool isglobal
= ((strwicmp(pszSectionName
, GLOBAL_NAME
) == 0) ||
7852 (strwicmp(pszSectionName
, GLOBAL_NAME2
) == 0));
7855 /* if we were in a global section then do the local inits */
7856 if (bInGlobalSection
&& !isglobal
)
7859 /* if we've just struck a global section, note the fact. */
7860 bInGlobalSection
= isglobal
;
7862 /* check for multiple global sections */
7863 if (bInGlobalSection
) {
7864 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName
));
7868 if (!bInGlobalSection
&& bGlobalOnly
)
7871 /* if we have a current service, tidy it up before moving on */
7874 if (iServiceIndex
>= 0)
7875 bRetval
= service_ok(iServiceIndex
);
7877 /* if all is still well, move to the next record in the services array */
7879 /* We put this here to avoid an odd message order if messages are */
7880 /* issued by the post-processing of a previous section. */
7881 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName
));
7883 if ((iServiceIndex
= add_a_service(&sDefault
, pszSectionName
))
7885 DEBUG(0, ("Failed to add a new service\n"));
7894 /***************************************************************************
7895 Determine if a partcular base parameter is currentl set to the default value.
7896 ***************************************************************************/
7898 static bool is_default(int i
)
7900 if (!defaults_saved
)
7902 switch (parm_table
[i
].type
) {
7904 return str_list_equal((const char **)parm_table
[i
].def
.lvalue
,
7905 *(const char ***)parm_table
[i
].ptr
);
7908 return strequal(parm_table
[i
].def
.svalue
,
7909 *(char **)parm_table
[i
].ptr
);
7912 return parm_table
[i
].def
.bvalue
==
7913 *(bool *)parm_table
[i
].ptr
;
7915 return parm_table
[i
].def
.cvalue
==
7916 *(char *)parm_table
[i
].ptr
;
7920 return parm_table
[i
].def
.ivalue
==
7921 *(int *)parm_table
[i
].ptr
;
7928 /***************************************************************************
7929 Display the contents of the global structure.
7930 ***************************************************************************/
7932 static void dump_globals(FILE *f
)
7935 struct param_opt_struct
*data
;
7937 fprintf(f
, "[global]\n");
7939 for (i
= 0; parm_table
[i
].label
; i
++)
7940 if (parm_table
[i
].p_class
== P_GLOBAL
&&
7941 !(parm_table
[i
].flags
& FLAG_META
) &&
7942 parm_table
[i
].ptr
&&
7943 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
))) {
7944 if (defaults_saved
&& is_default(i
))
7946 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
7947 print_parameter(&parm_table
[i
], parm_table
[i
].ptr
, f
);
7950 if (Globals
.param_opt
!= NULL
) {
7951 data
= Globals
.param_opt
;
7953 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
7960 /***************************************************************************
7961 Return True if a local parameter is currently set to the global default.
7962 ***************************************************************************/
7964 bool lp_is_default(int snum
, struct parm_struct
*parm
)
7966 int pdiff
= PTR_DIFF(parm
->ptr
, &sDefault
);
7968 return equal_parameter(parm
->type
,
7969 ((char *)ServicePtrs
[snum
]) + pdiff
,
7970 ((char *)&sDefault
) + pdiff
);
7973 /***************************************************************************
7974 Display the contents of a single services record.
7975 ***************************************************************************/
7977 static void dump_a_service(struct service
*pService
, FILE * f
)
7980 struct param_opt_struct
*data
;
7982 if (pService
!= &sDefault
)
7983 fprintf(f
, "[%s]\n", pService
->szService
);
7985 for (i
= 0; parm_table
[i
].label
; i
++) {
7987 if (parm_table
[i
].p_class
== P_LOCAL
&&
7988 !(parm_table
[i
].flags
& FLAG_META
) &&
7989 parm_table
[i
].ptr
&&
7990 (*parm_table
[i
].label
!= '-') &&
7991 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
7994 int pdiff
= PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
7996 if (pService
== &sDefault
) {
7997 if (defaults_saved
&& is_default(i
))
8000 if (equal_parameter(parm_table
[i
].type
,
8001 ((char *)pService
) +
8003 ((char *)&sDefault
) +
8008 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
8009 print_parameter(&parm_table
[i
],
8010 ((char *)pService
) + pdiff
, f
);
8015 if (pService
->param_opt
!= NULL
) {
8016 data
= pService
->param_opt
;
8018 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
8024 /***************************************************************************
8025 Display the contents of a parameter of a single services record.
8026 ***************************************************************************/
8028 bool dump_a_parameter(int snum
, char *parm_name
, FILE * f
, bool isGlobal
)
8031 bool result
= False
;
8034 fstring local_parm_name
;
8036 const char *parm_opt_value
;
8038 /* check for parametrical option */
8039 fstrcpy( local_parm_name
, parm_name
);
8040 parm_opt
= strchr( local_parm_name
, ':');
8045 if (strlen(parm_opt
)) {
8046 parm_opt_value
= lp_parm_const_string( snum
,
8047 local_parm_name
, parm_opt
, NULL
);
8048 if (parm_opt_value
) {
8049 printf( "%s\n", parm_opt_value
);
8056 /* check for a key and print the value */
8063 for (i
= 0; parm_table
[i
].label
; i
++) {
8064 if (strwicmp(parm_table
[i
].label
, parm_name
) == 0 &&
8065 !(parm_table
[i
].flags
& FLAG_META
) &&
8066 (parm_table
[i
].p_class
== p_class
|| parm_table
[i
].flags
& flag
) &&
8067 parm_table
[i
].ptr
&&
8068 (*parm_table
[i
].label
!= '-') &&
8069 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
8074 ptr
= parm_table
[i
].ptr
;
8076 struct service
*pService
= ServicePtrs
[snum
];
8077 ptr
= ((char *)pService
) +
8078 PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
8081 print_parameter(&parm_table
[i
],
8092 /***************************************************************************
8093 Return info about the requested parameter (given as a string).
8094 Return NULL when the string is not a valid parameter name.
8095 ***************************************************************************/
8097 struct parm_struct
*lp_get_parameter(const char *param_name
)
8099 int num
= map_parameter(param_name
);
8105 return &parm_table
[num
];
8108 /***************************************************************************
8109 Return info about the next parameter in a service.
8110 snum==GLOBAL_SECTION_SNUM gives the globals.
8111 Return NULL when out of parameters.
8112 ***************************************************************************/
8114 struct parm_struct
*lp_next_parameter(int snum
, int *i
, int allparameters
)
8117 /* do the globals */
8118 for (; parm_table
[*i
].label
; (*i
)++) {
8119 if (parm_table
[*i
].p_class
== P_SEPARATOR
)
8120 return &parm_table
[(*i
)++];
8122 if (!parm_table
[*i
].ptr
8123 || (*parm_table
[*i
].label
== '-'))
8127 && (parm_table
[*i
].ptr
==
8128 parm_table
[(*i
) - 1].ptr
))
8131 if (is_default(*i
) && !allparameters
)
8134 return &parm_table
[(*i
)++];
8137 struct service
*pService
= ServicePtrs
[snum
];
8139 for (; parm_table
[*i
].label
; (*i
)++) {
8140 if (parm_table
[*i
].p_class
== P_SEPARATOR
)
8141 return &parm_table
[(*i
)++];
8143 if (parm_table
[*i
].p_class
== P_LOCAL
&&
8144 parm_table
[*i
].ptr
&&
8145 (*parm_table
[*i
].label
!= '-') &&
8147 (parm_table
[*i
].ptr
!=
8148 parm_table
[(*i
) - 1].ptr
)))
8151 PTR_DIFF(parm_table
[*i
].ptr
,
8154 if (allparameters
||
8155 !equal_parameter(parm_table
[*i
].type
,
8156 ((char *)pService
) +
8158 ((char *)&sDefault
) +
8161 return &parm_table
[(*i
)++];
8172 /***************************************************************************
8173 Display the contents of a single copy structure.
8174 ***************************************************************************/
8175 static void dump_copy_map(bool *pcopymap
)
8181 printf("\n\tNon-Copied parameters:\n");
8183 for (i
= 0; parm_table
[i
].label
; i
++)
8184 if (parm_table
[i
].p_class
== P_LOCAL
&&
8185 parm_table
[i
].ptr
&& !pcopymap
[i
] &&
8186 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
8188 printf("\t\t%s\n", parm_table
[i
].label
);
8193 /***************************************************************************
8194 Return TRUE if the passed service number is within range.
8195 ***************************************************************************/
8197 bool lp_snum_ok(int iService
)
8199 return (LP_SNUM_OK(iService
) && ServicePtrs
[iService
]->bAvailable
);
8202 /***************************************************************************
8203 Auto-load some home services.
8204 ***************************************************************************/
8206 static void lp_add_auto_services(char *str
)
8216 s
= SMB_STRDUP(str
);
8220 homes
= lp_servicenumber(HOMES_NAME
);
8222 for (p
= strtok_r(s
, LIST_SEP
, &saveptr
); p
;
8223 p
= strtok_r(NULL
, LIST_SEP
, &saveptr
)) {
8226 if (lp_servicenumber(p
) >= 0)
8229 home
= get_user_home_dir(talloc_tos(), p
);
8231 if (home
&& home
[0] && homes
>= 0)
8232 lp_add_home(p
, homes
, p
, home
);
8239 /***************************************************************************
8240 Auto-load one printer.
8241 ***************************************************************************/
8243 void lp_add_one_printer(const char *name
, const char *comment
, void *pdata
)
8245 int printers
= lp_servicenumber(PRINTERS_NAME
);
8248 if (lp_servicenumber(name
) < 0) {
8249 lp_add_printer(name
, printers
);
8250 if ((i
= lp_servicenumber(name
)) >= 0) {
8251 string_set(&ServicePtrs
[i
]->comment
, comment
);
8252 ServicePtrs
[i
]->autoloaded
= True
;
8257 /***************************************************************************
8258 Have we loaded a services file yet?
8259 ***************************************************************************/
8261 bool lp_loaded(void)
8266 /***************************************************************************
8267 Unload unused services.
8268 ***************************************************************************/
8270 void lp_killunused(bool (*snumused
) (int))
8273 for (i
= 0; i
< iNumServices
; i
++) {
8277 /* don't kill autoloaded or usershare services */
8278 if ( ServicePtrs
[i
]->autoloaded
||
8279 ServicePtrs
[i
]->usershare
== USERSHARE_VALID
) {
8283 if (!snumused
|| !snumused(i
)) {
8284 free_service_byindex(i
);
8290 * Kill all except autoloaded and usershare services - convenience wrapper
8292 void lp_kill_all_services(void)
8294 lp_killunused(NULL
);
8297 /***************************************************************************
8299 ***************************************************************************/
8301 void lp_killservice(int iServiceIn
)
8303 if (VALID(iServiceIn
)) {
8304 free_service_byindex(iServiceIn
);
8308 /***************************************************************************
8309 Save the curent values of all global and sDefault parameters into the
8310 defaults union. This allows swat and testparm to show only the
8311 changed (ie. non-default) parameters.
8312 ***************************************************************************/
8314 static void lp_save_defaults(void)
8317 for (i
= 0; parm_table
[i
].label
; i
++) {
8318 if (i
> 0 && parm_table
[i
].ptr
== parm_table
[i
- 1].ptr
)
8320 switch (parm_table
[i
].type
) {
8322 parm_table
[i
].def
.lvalue
= str_list_copy(
8323 NULL
, *(const char ***)parm_table
[i
].ptr
);
8327 if (parm_table
[i
].ptr
) {
8328 parm_table
[i
].def
.svalue
= SMB_STRDUP(*(char **)parm_table
[i
].ptr
);
8330 parm_table
[i
].def
.svalue
= NULL
;
8335 parm_table
[i
].def
.bvalue
=
8336 *(bool *)parm_table
[i
].ptr
;
8339 parm_table
[i
].def
.cvalue
=
8340 *(char *)parm_table
[i
].ptr
;
8345 parm_table
[i
].def
.ivalue
=
8346 *(int *)parm_table
[i
].ptr
;
8352 defaults_saved
= True
;
8355 /*******************************************************************
8356 Set the server type we will announce as via nmbd.
8357 ********************************************************************/
8359 static const struct srv_role_tab
{
8361 const char *role_str
;
8362 } srv_role_tab
[] = {
8363 { ROLE_STANDALONE
, "ROLE_STANDALONE" },
8364 { ROLE_DOMAIN_MEMBER
, "ROLE_DOMAIN_MEMBER" },
8365 { ROLE_DOMAIN_BDC
, "ROLE_DOMAIN_BDC" },
8366 { ROLE_DOMAIN_PDC
, "ROLE_DOMAIN_PDC" },
8370 const char* server_role_str(uint32 role
)
8373 for (i
=0; srv_role_tab
[i
].role_str
; i
++) {
8374 if (role
== srv_role_tab
[i
].role
) {
8375 return srv_role_tab
[i
].role_str
;
8381 static void set_server_role(void)
8383 server_role
= ROLE_STANDALONE
;
8385 switch (lp_security()) {
8387 if (lp_domain_logons())
8388 DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
8391 if (lp_domain_logons())
8392 DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
8393 /* this used to be considered ROLE_DOMAIN_MEMBER but that's just wrong */
8394 server_role
= ROLE_STANDALONE
;
8397 if (lp_domain_logons()) {
8398 DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
8399 server_role
= ROLE_DOMAIN_BDC
;
8402 server_role
= ROLE_DOMAIN_MEMBER
;
8405 if (lp_domain_logons()) {
8406 server_role
= ROLE_DOMAIN_PDC
;
8409 server_role
= ROLE_DOMAIN_MEMBER
;
8412 if (lp_domain_logons()) {
8414 if (Globals
.iDomainMaster
) /* auto or yes */
8415 server_role
= ROLE_DOMAIN_PDC
;
8417 server_role
= ROLE_DOMAIN_BDC
;
8421 DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
8425 DEBUG(10, ("set_server_role: role = %s\n", server_role_str(server_role
)));
8428 /***********************************************************
8429 If we should send plaintext/LANMAN passwords in the clinet
8430 ************************************************************/
8432 static void set_allowed_client_auth(void)
8434 if (Globals
.bClientNTLMv2Auth
) {
8435 Globals
.bClientLanManAuth
= False
;
8437 if (!Globals
.bClientLanManAuth
) {
8438 Globals
.bClientPlaintextAuth
= False
;
8442 /***************************************************************************
8444 The following code allows smbd to read a user defined share file.
8445 Yes, this is my intent. Yes, I'm comfortable with that...
8447 THE FOLLOWING IS SECURITY CRITICAL CODE.
8449 It washes your clothes, it cleans your house, it guards you while you sleep...
8450 Do not f%^k with it....
8451 ***************************************************************************/
8453 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8455 /***************************************************************************
8456 Check allowed stat state of a usershare file.
8457 Ensure we print out who is dicking with us so the admin can
8458 get their sorry ass fired.
8459 ***************************************************************************/
8461 static bool check_usershare_stat(const char *fname
,
8462 const SMB_STRUCT_STAT
*psbuf
)
8464 if (!S_ISREG(psbuf
->st_ex_mode
)) {
8465 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8466 "not a regular file\n",
8467 fname
, (unsigned int)psbuf
->st_ex_uid
));
8471 /* Ensure this doesn't have the other write bit set. */
8472 if (psbuf
->st_ex_mode
& S_IWOTH
) {
8473 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8474 "public write. Refusing to allow as a usershare file.\n",
8475 fname
, (unsigned int)psbuf
->st_ex_uid
));
8479 /* Should be 10k or less. */
8480 if (psbuf
->st_ex_size
> MAX_USERSHARE_FILE_SIZE
) {
8481 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8482 "too large (%u) to be a user share file.\n",
8483 fname
, (unsigned int)psbuf
->st_ex_uid
,
8484 (unsigned int)psbuf
->st_ex_size
));
8491 /***************************************************************************
8492 Parse the contents of a usershare file.
8493 ***************************************************************************/
8495 enum usershare_err
parse_usershare_file(TALLOC_CTX
*ctx
,
8496 SMB_STRUCT_STAT
*psbuf
,
8497 const char *servicename
,
8501 char **pp_sharepath
,
8506 const char **prefixallowlist
= lp_usershare_prefix_allow_list();
8507 const char **prefixdenylist
= lp_usershare_prefix_deny_list();
8510 SMB_STRUCT_STAT sbuf
;
8511 char *sharepath
= NULL
;
8512 char *comment
= NULL
;
8514 *pp_sharepath
= NULL
;
8517 *pallow_guest
= False
;
8520 return USERSHARE_MALFORMED_FILE
;
8523 if (strcmp(lines
[0], "#VERSION 1") == 0) {
8525 } else if (strcmp(lines
[0], "#VERSION 2") == 0) {
8528 return USERSHARE_MALFORMED_FILE
;
8531 return USERSHARE_BAD_VERSION
;
8534 if (strncmp(lines
[1], "path=", 5) != 0) {
8535 return USERSHARE_MALFORMED_PATH
;
8538 sharepath
= talloc_strdup(ctx
, &lines
[1][5]);
8540 return USERSHARE_POSIX_ERR
;
8542 trim_string(sharepath
, " ", " ");
8544 if (strncmp(lines
[2], "comment=", 8) != 0) {
8545 return USERSHARE_MALFORMED_COMMENT_DEF
;
8548 comment
= talloc_strdup(ctx
, &lines
[2][8]);
8550 return USERSHARE_POSIX_ERR
;
8552 trim_string(comment
, " ", " ");
8553 trim_char(comment
, '"', '"');
8555 if (strncmp(lines
[3], "usershare_acl=", 14) != 0) {
8556 return USERSHARE_MALFORMED_ACL_DEF
;
8559 if (!parse_usershare_acl(ctx
, &lines
[3][14], ppsd
)) {
8560 return USERSHARE_ACL_ERR
;
8564 if (strncmp(lines
[4], "guest_ok=", 9) != 0) {
8565 return USERSHARE_MALFORMED_ACL_DEF
;
8567 if (lines
[4][9] == 'y') {
8568 *pallow_guest
= True
;
8572 if (snum
!= -1 && (strcmp(sharepath
, ServicePtrs
[snum
]->szPath
) == 0)) {
8573 /* Path didn't change, no checks needed. */
8574 *pp_sharepath
= sharepath
;
8575 *pp_comment
= comment
;
8576 return USERSHARE_OK
;
8579 /* The path *must* be absolute. */
8580 if (sharepath
[0] != '/') {
8581 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8582 servicename
, sharepath
));
8583 return USERSHARE_PATH_NOT_ABSOLUTE
;
8586 /* If there is a usershare prefix deny list ensure one of these paths
8587 doesn't match the start of the user given path. */
8588 if (prefixdenylist
) {
8590 for ( i
=0; prefixdenylist
[i
]; i
++ ) {
8591 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8592 servicename
, i
, prefixdenylist
[i
], sharepath
));
8593 if (memcmp( sharepath
, prefixdenylist
[i
], strlen(prefixdenylist
[i
])) == 0) {
8594 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8595 "usershare prefix deny list entries.\n",
8596 servicename
, sharepath
));
8597 return USERSHARE_PATH_IS_DENIED
;
8602 /* If there is a usershare prefix allow list ensure one of these paths
8603 does match the start of the user given path. */
8605 if (prefixallowlist
) {
8607 for ( i
=0; prefixallowlist
[i
]; i
++ ) {
8608 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8609 servicename
, i
, prefixallowlist
[i
], sharepath
));
8610 if (memcmp( sharepath
, prefixallowlist
[i
], strlen(prefixallowlist
[i
])) == 0) {
8614 if (prefixallowlist
[i
] == NULL
) {
8615 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8616 "usershare prefix allow list entries.\n",
8617 servicename
, sharepath
));
8618 return USERSHARE_PATH_NOT_ALLOWED
;
8622 /* Ensure this is pointing to a directory. */
8623 dp
= sys_opendir(sharepath
);
8626 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8627 servicename
, sharepath
));
8628 return USERSHARE_PATH_NOT_DIRECTORY
;
8631 /* Ensure the owner of the usershare file has permission to share
8634 if (sys_stat(sharepath
, &sbuf
, false) == -1) {
8635 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8636 servicename
, sharepath
, strerror(errno
) ));
8638 return USERSHARE_POSIX_ERR
;
8643 if (!S_ISDIR(sbuf
.st_ex_mode
)) {
8644 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8645 servicename
, sharepath
));
8646 return USERSHARE_PATH_NOT_DIRECTORY
;
8649 /* Check if sharing is restricted to owner-only. */
8650 /* psbuf is the stat of the usershare definition file,
8651 sbuf is the stat of the target directory to be shared. */
8653 if (lp_usershare_owner_only()) {
8654 /* root can share anything. */
8655 if ((psbuf
->st_ex_uid
!= 0) && (sbuf
.st_ex_uid
!= psbuf
->st_ex_uid
)) {
8656 return USERSHARE_PATH_NOT_ALLOWED
;
8660 *pp_sharepath
= sharepath
;
8661 *pp_comment
= comment
;
8662 return USERSHARE_OK
;
8665 /***************************************************************************
8666 Deal with a usershare file.
8669 -1 - Bad name, invalid contents.
8670 - service name already existed and not a usershare, problem
8671 with permissions to share directory etc.
8672 ***************************************************************************/
8674 static int process_usershare_file(const char *dir_name
, const char *file_name
, int snum_template
)
8676 SMB_STRUCT_STAT sbuf
;
8677 SMB_STRUCT_STAT lsbuf
;
8679 char *sharepath
= NULL
;
8680 char *comment
= NULL
;
8681 fstring service_name
;
8682 char **lines
= NULL
;
8686 TALLOC_CTX
*ctx
= NULL
;
8687 SEC_DESC
*psd
= NULL
;
8688 bool guest_ok
= False
;
8690 /* Ensure share name doesn't contain invalid characters. */
8691 if (!validate_net_name(file_name
, INVALID_SHARENAME_CHARS
, strlen(file_name
))) {
8692 DEBUG(0,("process_usershare_file: share name %s contains "
8693 "invalid characters (any of %s)\n",
8694 file_name
, INVALID_SHARENAME_CHARS
));
8698 fstrcpy(service_name
, file_name
);
8700 if (asprintf(&fname
, "%s/%s", dir_name
, file_name
) < 0) {
8703 /* Minimize the race condition by doing an lstat before we
8704 open and fstat. Ensure this isn't a symlink link. */
8706 if (sys_lstat(fname
, &lsbuf
, false) != 0) {
8707 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8708 fname
, strerror(errno
) ));
8713 /* This must be a regular file, not a symlink, directory or
8714 other strange filetype. */
8715 if (!check_usershare_stat(fname
, &lsbuf
)) {
8721 char *canon_name
= canonicalize_servicename(service_name
);
8722 TDB_DATA data
= dbwrap_fetch_bystring(
8723 ServiceHash
, canon_name
, canon_name
);
8727 if ((data
.dptr
!= NULL
) && (data
.dsize
== sizeof(iService
))) {
8728 iService
= *(int *)data
.dptr
;
8730 TALLOC_FREE(canon_name
);
8733 if (iService
!= -1 &&
8734 timespec_compare(&ServicePtrs
[iService
]->usershare_last_mod
,
8735 &lsbuf
.st_ex_mtime
) == 0) {
8736 /* Nothing changed - Mark valid and return. */
8737 DEBUG(10,("process_usershare_file: service %s not changed.\n",
8739 ServicePtrs
[iService
]->usershare
= USERSHARE_VALID
;
8744 /* Try and open the file read only - no symlinks allowed. */
8746 fd
= sys_open(fname
, O_RDONLY
|O_NOFOLLOW
, 0);
8748 fd
= sys_open(fname
, O_RDONLY
, 0);
8752 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
8753 fname
, strerror(errno
) ));
8758 /* Now fstat to be *SURE* it's a regular file. */
8759 if (sys_fstat(fd
, &sbuf
, false) != 0) {
8761 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
8762 fname
, strerror(errno
) ));
8767 /* Is it the same dev/inode as was lstated ? */
8768 if (lsbuf
.st_ex_dev
!= sbuf
.st_ex_dev
|| lsbuf
.st_ex_ino
!= sbuf
.st_ex_ino
) {
8770 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
8771 "Symlink spoofing going on ?\n", fname
));
8776 /* This must be a regular file, not a symlink, directory or
8777 other strange filetype. */
8778 if (!check_usershare_stat(fname
, &sbuf
)) {
8783 lines
= fd_lines_load(fd
, &numlines
, MAX_USERSHARE_FILE_SIZE
, NULL
);
8786 if (lines
== NULL
) {
8787 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
8788 fname
, (unsigned int)sbuf
.st_ex_uid
));
8795 /* Should we allow printers to be shared... ? */
8796 ctx
= talloc_init("usershare_sd_xctx");
8802 if (parse_usershare_file(ctx
, &sbuf
, service_name
,
8803 iService
, lines
, numlines
, &sharepath
,
8804 &comment
, &psd
, &guest_ok
) != USERSHARE_OK
) {
8805 talloc_destroy(ctx
);
8812 /* Everything ok - add the service possibly using a template. */
8814 const struct service
*sp
= &sDefault
;
8815 if (snum_template
!= -1) {
8816 sp
= ServicePtrs
[snum_template
];
8819 if ((iService
= add_a_service(sp
, service_name
)) < 0) {
8820 DEBUG(0, ("process_usershare_file: Failed to add "
8821 "new service %s\n", service_name
));
8822 talloc_destroy(ctx
);
8826 /* Read only is controlled by usershare ACL below. */
8827 ServicePtrs
[iService
]->bRead_only
= False
;
8830 /* Write the ACL of the new/modified share. */
8831 if (!set_share_security(service_name
, psd
)) {
8832 DEBUG(0, ("process_usershare_file: Failed to set share "
8833 "security for user share %s\n",
8835 lp_remove_service(iService
);
8836 talloc_destroy(ctx
);
8840 /* If from a template it may be marked invalid. */
8841 ServicePtrs
[iService
]->valid
= True
;
8843 /* Set the service as a valid usershare. */
8844 ServicePtrs
[iService
]->usershare
= USERSHARE_VALID
;
8846 /* Set guest access. */
8847 if (lp_usershare_allow_guests()) {
8848 ServicePtrs
[iService
]->bGuest_ok
= guest_ok
;
8851 /* And note when it was loaded. */
8852 ServicePtrs
[iService
]->usershare_last_mod
= sbuf
.st_ex_mtime
;
8853 string_set(&ServicePtrs
[iService
]->szPath
, sharepath
);
8854 string_set(&ServicePtrs
[iService
]->comment
, comment
);
8856 talloc_destroy(ctx
);
8861 /***************************************************************************
8862 Checks if a usershare entry has been modified since last load.
8863 ***************************************************************************/
8865 static bool usershare_exists(int iService
, struct timespec
*last_mod
)
8867 SMB_STRUCT_STAT lsbuf
;
8868 const char *usersharepath
= Globals
.szUsersharePath
;
8871 if (asprintf(&fname
, "%s/%s",
8873 ServicePtrs
[iService
]->szService
) < 0) {
8877 if (sys_lstat(fname
, &lsbuf
, false) != 0) {
8882 if (!S_ISREG(lsbuf
.st_ex_mode
)) {
8888 *last_mod
= lsbuf
.st_ex_mtime
;
8892 /***************************************************************************
8893 Load a usershare service by name. Returns a valid servicenumber or -1.
8894 ***************************************************************************/
8896 int load_usershare_service(const char *servicename
)
8898 SMB_STRUCT_STAT sbuf
;
8899 const char *usersharepath
= Globals
.szUsersharePath
;
8900 int max_user_shares
= Globals
.iUsershareMaxShares
;
8901 int snum_template
= -1;
8903 if (*usersharepath
== 0 || max_user_shares
== 0) {
8907 if (sys_stat(usersharepath
, &sbuf
, false) != 0) {
8908 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
8909 usersharepath
, strerror(errno
) ));
8913 if (!S_ISDIR(sbuf
.st_ex_mode
)) {
8914 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
8920 * This directory must be owned by root, and have the 't' bit set.
8921 * It also must not be writable by "other".
8925 if (sbuf
.st_ex_uid
!= 0 || !(sbuf
.st_ex_mode
& S_ISVTX
) || (sbuf
.st_ex_mode
& S_IWOTH
)) {
8927 if (sbuf
.st_ex_uid
!= 0 || (sbuf
.st_ex_mode
& S_IWOTH
)) {
8929 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
8930 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8935 /* Ensure the template share exists if it's set. */
8936 if (Globals
.szUsershareTemplateShare
[0]) {
8937 /* We can't use lp_servicenumber here as we are recommending that
8938 template shares have -valid=False set. */
8939 for (snum_template
= iNumServices
- 1; snum_template
>= 0; snum_template
--) {
8940 if (ServicePtrs
[snum_template
]->szService
&&
8941 strequal(ServicePtrs
[snum_template
]->szService
,
8942 Globals
.szUsershareTemplateShare
)) {
8947 if (snum_template
== -1) {
8948 DEBUG(0,("load_usershare_service: usershare template share %s "
8949 "does not exist.\n",
8950 Globals
.szUsershareTemplateShare
));
8955 return process_usershare_file(usersharepath
, servicename
, snum_template
);
8958 /***************************************************************************
8959 Load all user defined shares from the user share directory.
8960 We only do this if we're enumerating the share list.
8961 This is the function that can delete usershares that have
8963 ***************************************************************************/
8965 int load_usershare_shares(void)
8968 SMB_STRUCT_STAT sbuf
;
8969 SMB_STRUCT_DIRENT
*de
;
8970 int num_usershares
= 0;
8971 int max_user_shares
= Globals
.iUsershareMaxShares
;
8972 unsigned int num_dir_entries
, num_bad_dir_entries
, num_tmp_dir_entries
;
8973 unsigned int allowed_bad_entries
= ((2*max_user_shares
)/10);
8974 unsigned int allowed_tmp_entries
= ((2*max_user_shares
)/10);
8976 int snum_template
= -1;
8977 const char *usersharepath
= Globals
.szUsersharePath
;
8978 int ret
= lp_numservices();
8980 if (max_user_shares
== 0 || *usersharepath
== '\0') {
8981 return lp_numservices();
8984 if (sys_stat(usersharepath
, &sbuf
, false) != 0) {
8985 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
8986 usersharepath
, strerror(errno
) ));
8991 * This directory must be owned by root, and have the 't' bit set.
8992 * It also must not be writable by "other".
8996 if (sbuf
.st_ex_uid
!= 0 || !(sbuf
.st_ex_mode
& S_ISVTX
) || (sbuf
.st_ex_mode
& S_IWOTH
)) {
8998 if (sbuf
.st_ex_uid
!= 0 || (sbuf
.st_ex_mode
& S_IWOTH
)) {
9000 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
9001 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9006 /* Ensure the template share exists if it's set. */
9007 if (Globals
.szUsershareTemplateShare
[0]) {
9008 /* We can't use lp_servicenumber here as we are recommending that
9009 template shares have -valid=False set. */
9010 for (snum_template
= iNumServices
- 1; snum_template
>= 0; snum_template
--) {
9011 if (ServicePtrs
[snum_template
]->szService
&&
9012 strequal(ServicePtrs
[snum_template
]->szService
,
9013 Globals
.szUsershareTemplateShare
)) {
9018 if (snum_template
== -1) {
9019 DEBUG(0,("load_usershare_shares: usershare template share %s "
9020 "does not exist.\n",
9021 Globals
.szUsershareTemplateShare
));
9026 /* Mark all existing usershares as pending delete. */
9027 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
9028 if (VALID(iService
) && ServicePtrs
[iService
]->usershare
) {
9029 ServicePtrs
[iService
]->usershare
= USERSHARE_PENDING_DELETE
;
9033 dp
= sys_opendir(usersharepath
);
9035 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
9036 usersharepath
, strerror(errno
) ));
9040 for (num_dir_entries
= 0, num_bad_dir_entries
= 0, num_tmp_dir_entries
= 0;
9041 (de
= sys_readdir(dp
));
9042 num_dir_entries
++ ) {
9044 const char *n
= de
->d_name
;
9046 /* Ignore . and .. */
9048 if ((n
[1] == '\0') || (n
[1] == '.' && n
[2] == '\0')) {
9054 /* Temporary file used when creating a share. */
9055 num_tmp_dir_entries
++;
9058 /* Allow 20% tmp entries. */
9059 if (num_tmp_dir_entries
> allowed_tmp_entries
) {
9060 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
9061 "in directory %s\n",
9062 num_tmp_dir_entries
, usersharepath
));
9066 r
= process_usershare_file(usersharepath
, n
, snum_template
);
9068 /* Update the services count. */
9070 if (num_usershares
>= max_user_shares
) {
9071 DEBUG(0,("load_usershare_shares: max user shares reached "
9072 "on file %s in directory %s\n",
9073 n
, usersharepath
));
9076 } else if (r
== -1) {
9077 num_bad_dir_entries
++;
9080 /* Allow 20% bad entries. */
9081 if (num_bad_dir_entries
> allowed_bad_entries
) {
9082 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
9083 "in directory %s\n",
9084 num_bad_dir_entries
, usersharepath
));
9088 /* Allow 20% bad entries. */
9089 if (num_dir_entries
> max_user_shares
+ allowed_bad_entries
) {
9090 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
9091 "in directory %s\n",
9092 num_dir_entries
, usersharepath
));
9099 /* Sweep through and delete any non-refreshed usershares that are
9100 not currently in use. */
9101 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
9102 if (VALID(iService
) && (ServicePtrs
[iService
]->usershare
== USERSHARE_PENDING_DELETE
)) {
9103 if (conn_snum_used(iService
)) {
9106 /* Remove from the share ACL db. */
9107 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
9108 lp_servicename(iService
) ));
9109 delete_share_security(lp_servicename(iService
));
9110 free_service_byindex(iService
);
9114 return lp_numservices();
9117 /********************************************************
9118 Destroy global resources allocated in this file
9119 ********************************************************/
9121 void gfree_loadparm(void)
9127 /* Free resources allocated to services */
9129 for ( i
= 0; i
< iNumServices
; i
++ ) {
9131 free_service_byindex(i
);
9135 SAFE_FREE( ServicePtrs
);
9138 /* Now release all resources allocated to global
9139 parameters and the default service */
9141 free_global_parameters();
9145 /***************************************************************************
9146 Allow client apps to specify that they are a client
9147 ***************************************************************************/
9148 void lp_set_in_client(bool b
)
9154 /***************************************************************************
9155 Determine if we're running in a client app
9156 ***************************************************************************/
9157 bool lp_is_in_client(void)
9162 /***************************************************************************
9163 Load the services array from the services file. Return True on success,
9165 ***************************************************************************/
9167 bool lp_load_ex(const char *pszFname
,
9171 bool initialize_globals
,
9172 bool allow_include_registry
,
9173 bool allow_registry_shares
)
9180 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9182 bInGlobalSection
= True
;
9183 bGlobalOnly
= global_only
;
9184 bAllowIncludeRegistry
= allow_include_registry
;
9186 init_globals(! initialize_globals
);
9191 if (save_defaults
) {
9196 free_param_opts(&Globals
.param_opt
);
9198 /* We get sections first, so have to start 'behind' to make up */
9201 if (lp_config_backend_is_file()) {
9202 n2
= alloc_sub_basic(get_current_username(),
9203 current_user_info
.domain
,
9206 smb_panic("lp_load_ex: out of memory");
9209 add_to_file_list(pszFname
, n2
);
9211 bRetval
= pm_process(n2
, do_section
, do_parameter
, NULL
);
9214 /* finish up the last section */
9215 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval
)));
9217 if (iServiceIndex
>= 0) {
9218 bRetval
= service_ok(iServiceIndex
);
9222 if (lp_config_backend_is_registry()) {
9223 /* config backend changed to registry in config file */
9225 * We need to use this extra global variable here to
9226 * survive restart: init_globals uses this as a default
9227 * for ConfigBackend. Otherwise, init_globals would
9228 * send us into an endless loop here.
9230 config_backend
= CONFIG_BACKEND_REGISTRY
;
9232 DEBUG(1, ("lp_load_ex: changing to config backend "
9234 init_globals(false);
9235 lp_kill_all_services();
9236 return lp_load_ex(pszFname
, global_only
, save_defaults
,
9237 add_ipc
, initialize_globals
,
9238 allow_include_registry
,
9239 allow_registry_shares
);
9241 } else if (lp_config_backend_is_registry()) {
9242 bRetval
= process_registry_globals();
9244 DEBUG(0, ("Illegal config backend given: %d\n",
9245 lp_config_backend()));
9249 if (bRetval
&& lp_registry_shares() && allow_registry_shares
) {
9250 bRetval
= process_registry_shares();
9253 lp_add_auto_services(lp_auto_services());
9256 /* When 'restrict anonymous = 2' guest connections to ipc$
9258 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9259 if ( lp_enable_asu_support() ) {
9260 lp_add_ipc("ADMIN$", false);
9265 set_default_server_announce_type();
9266 set_allowed_client_auth();
9270 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9271 /* if bWINSsupport is true and we are in the client */
9272 if (lp_is_in_client() && Globals
.bWINSsupport
) {
9273 lp_do_parameter(GLOBAL_SECTION_SNUM
, "wins server", "127.0.0.1");
9278 bAllowIncludeRegistry
= true;
9283 bool lp_load(const char *pszFname
,
9287 bool initialize_globals
)
9289 return lp_load_ex(pszFname
,
9297 bool lp_load_initial_only(const char *pszFname
)
9299 return lp_load_ex(pszFname
,
9308 bool lp_load_with_registry_shares(const char *pszFname
,
9312 bool initialize_globals
)
9314 return lp_load_ex(pszFname
,
9323 /***************************************************************************
9324 Return the max number of services.
9325 ***************************************************************************/
9327 int lp_numservices(void)
9329 return (iNumServices
);
9332 /***************************************************************************
9333 Display the contents of the services array in human-readable form.
9334 ***************************************************************************/
9336 void lp_dump(FILE *f
, bool show_defaults
, int maxtoprint
)
9341 defaults_saved
= False
;
9345 dump_a_service(&sDefault
, f
);
9347 for (iService
= 0; iService
< maxtoprint
; iService
++) {
9349 lp_dump_one(f
, show_defaults
, iService
);
9353 /***************************************************************************
9354 Display the contents of one service in human-readable form.
9355 ***************************************************************************/
9357 void lp_dump_one(FILE * f
, bool show_defaults
, int snum
)
9360 if (ServicePtrs
[snum
]->szService
[0] == '\0')
9362 dump_a_service(ServicePtrs
[snum
], f
);
9366 /***************************************************************************
9367 Return the number of the service with the given name, or -1 if it doesn't
9368 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9369 getservicebyname()! This works ONLY if all services have been loaded, and
9370 does not copy the found service.
9371 ***************************************************************************/
9373 int lp_servicenumber(const char *pszServiceName
)
9376 fstring serviceName
;
9378 if (!pszServiceName
) {
9379 return GLOBAL_SECTION_SNUM
;
9382 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
9383 if (VALID(iService
) && ServicePtrs
[iService
]->szService
) {
9385 * The substitution here is used to support %U is
9388 fstrcpy(serviceName
, ServicePtrs
[iService
]->szService
);
9389 standard_sub_basic(get_current_username(),
9390 current_user_info
.domain
,
9391 serviceName
,sizeof(serviceName
));
9392 if (strequal(serviceName
, pszServiceName
)) {
9398 if (iService
>= 0 && ServicePtrs
[iService
]->usershare
== USERSHARE_VALID
) {
9399 struct timespec last_mod
;
9401 if (!usershare_exists(iService
, &last_mod
)) {
9402 /* Remove the share security tdb entry for it. */
9403 delete_share_security(lp_servicename(iService
));
9404 /* Remove it from the array. */
9405 free_service_byindex(iService
);
9406 /* Doesn't exist anymore. */
9407 return GLOBAL_SECTION_SNUM
;
9410 /* Has it been modified ? If so delete and reload. */
9411 if (timespec_compare(&ServicePtrs
[iService
]->usershare_last_mod
,
9413 /* Remove it from the array. */
9414 free_service_byindex(iService
);
9415 /* and now reload it. */
9416 iService
= load_usershare_service(pszServiceName
);
9421 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName
));
9422 return GLOBAL_SECTION_SNUM
;
9428 bool share_defined(const char *service_name
)
9430 return (lp_servicenumber(service_name
) != -1);
9433 struct share_params
*get_share_params(TALLOC_CTX
*mem_ctx
,
9434 const char *sharename
)
9436 struct share_params
*result
;
9440 if (!(sname
= SMB_STRDUP(sharename
))) {
9444 snum
= find_service(sname
);
9451 if (!(result
= TALLOC_P(mem_ctx
, struct share_params
))) {
9452 DEBUG(0, ("talloc failed\n"));
9456 result
->service
= snum
;
9460 struct share_iterator
*share_list_all(TALLOC_CTX
*mem_ctx
)
9462 struct share_iterator
*result
;
9464 if (!(result
= TALLOC_P(mem_ctx
, struct share_iterator
))) {
9465 DEBUG(0, ("talloc failed\n"));
9469 result
->next_id
= 0;
9473 struct share_params
*next_share(struct share_iterator
*list
)
9475 struct share_params
*result
;
9477 while (!lp_snum_ok(list
->next_id
) &&
9478 (list
->next_id
< lp_numservices())) {
9482 if (list
->next_id
>= lp_numservices()) {
9486 if (!(result
= TALLOC_P(list
, struct share_params
))) {
9487 DEBUG(0, ("talloc failed\n"));
9491 result
->service
= list
->next_id
;
9496 struct share_params
*next_printer(struct share_iterator
*list
)
9498 struct share_params
*result
;
9500 while ((result
= next_share(list
)) != NULL
) {
9501 if (lp_print_ok(result
->service
)) {
9509 * This is a hack for a transition period until we transformed all code from
9510 * service numbers to struct share_params.
9513 struct share_params
*snum2params_static(int snum
)
9515 static struct share_params result
;
9516 result
.service
= snum
;
9520 /*******************************************************************
9521 A useful volume label function.
9522 ********************************************************************/
9524 const char *volume_label(int snum
)
9527 const char *label
= lp_volume(snum
);
9529 label
= lp_servicename(snum
);
9532 /* This returns a 33 byte guarenteed null terminated string. */
9533 ret
= talloc_strndup(talloc_tos(), label
, 32);
9540 /*******************************************************************
9541 Set the server type we will announce as via nmbd.
9542 ********************************************************************/
9544 static void set_default_server_announce_type(void)
9546 default_server_announce
= 0;
9547 default_server_announce
|= SV_TYPE_WORKSTATION
;
9548 default_server_announce
|= SV_TYPE_SERVER
;
9549 default_server_announce
|= SV_TYPE_SERVER_UNIX
;
9551 /* note that the flag should be set only if we have a
9552 printer service but nmbd doesn't actually load the
9553 services so we can't tell --jerry */
9555 default_server_announce
|= SV_TYPE_PRINTQ_SERVER
;
9557 switch (lp_announce_as()) {
9558 case ANNOUNCE_AS_NT_SERVER
:
9559 default_server_announce
|= SV_TYPE_SERVER_NT
;
9560 /* fall through... */
9561 case ANNOUNCE_AS_NT_WORKSTATION
:
9562 default_server_announce
|= SV_TYPE_NT
;
9564 case ANNOUNCE_AS_WIN95
:
9565 default_server_announce
|= SV_TYPE_WIN95_PLUS
;
9567 case ANNOUNCE_AS_WFW
:
9568 default_server_announce
|= SV_TYPE_WFW
;
9574 switch (lp_server_role()) {
9575 case ROLE_DOMAIN_MEMBER
:
9576 default_server_announce
|= SV_TYPE_DOMAIN_MEMBER
;
9578 case ROLE_DOMAIN_PDC
:
9579 default_server_announce
|= SV_TYPE_DOMAIN_CTRL
;
9581 case ROLE_DOMAIN_BDC
:
9582 default_server_announce
|= SV_TYPE_DOMAIN_BAKCTRL
;
9584 case ROLE_STANDALONE
:
9588 if (lp_time_server())
9589 default_server_announce
|= SV_TYPE_TIME_SOURCE
;
9591 if (lp_host_msdfs())
9592 default_server_announce
|= SV_TYPE_DFS_SERVER
;
9595 /***********************************************************
9596 returns role of Samba server
9597 ************************************************************/
9599 int lp_server_role(void)
9604 /***********************************************************
9605 If we are PDC then prefer us as DMB
9606 ************************************************************/
9608 bool lp_domain_master(void)
9610 if (Globals
.iDomainMaster
== Auto
)
9611 return (lp_server_role() == ROLE_DOMAIN_PDC
);
9613 return (bool)Globals
.iDomainMaster
;
9616 /***********************************************************
9617 If we are DMB then prefer us as LMB
9618 ************************************************************/
9620 bool lp_preferred_master(void)
9622 if (Globals
.iPreferredMaster
== Auto
)
9623 return (lp_local_master() && lp_domain_master());
9625 return (bool)Globals
.iPreferredMaster
;
9628 /*******************************************************************
9630 ********************************************************************/
9632 void lp_remove_service(int snum
)
9634 ServicePtrs
[snum
]->valid
= False
;
9635 invalid_services
[num_invalid_services
++] = snum
;
9638 /*******************************************************************
9640 ********************************************************************/
9642 void lp_copy_service(int snum
, const char *new_name
)
9644 do_section(new_name
, NULL
);
9646 snum
= lp_servicenumber(new_name
);
9648 lp_do_parameter(snum
, "copy", lp_servicename(snum
));
9653 /*******************************************************************
9654 Get the default server type we will announce as via nmbd.
9655 ********************************************************************/
9657 int lp_default_server_announce(void)
9659 return default_server_announce
;
9662 /*******************************************************************
9663 Split the announce version into major and minor numbers.
9664 ********************************************************************/
9666 int lp_major_announce_version(void)
9668 static bool got_major
= False
;
9669 static int major_version
= DEFAULT_MAJOR_VERSION
;
9674 return major_version
;
9677 if ((vers
= lp_announce_version()) == NULL
)
9678 return major_version
;
9680 if ((p
= strchr_m(vers
, '.')) == 0)
9681 return major_version
;
9684 major_version
= atoi(vers
);
9685 return major_version
;
9688 int lp_minor_announce_version(void)
9690 static bool got_minor
= False
;
9691 static int minor_version
= DEFAULT_MINOR_VERSION
;
9696 return minor_version
;
9699 if ((vers
= lp_announce_version()) == NULL
)
9700 return minor_version
;
9702 if ((p
= strchr_m(vers
, '.')) == 0)
9703 return minor_version
;
9706 minor_version
= atoi(p
);
9707 return minor_version
;
9710 /***********************************************************
9711 Set the global name resolution order (used in smbclient).
9712 ************************************************************/
9714 void lp_set_name_resolve_order(const char *new_order
)
9716 string_set(&Globals
.szNameResolveOrder
, new_order
);
9719 const char *lp_printername(int snum
)
9721 const char *ret
= _lp_printername(snum
);
9722 if (ret
== NULL
|| (ret
!= NULL
&& *ret
== '\0'))
9723 ret
= lp_const_servicename(snum
);
9729 /***********************************************************
9730 Allow daemons such as winbindd to fix their logfile name.
9731 ************************************************************/
9733 void lp_set_logfile(const char *name
)
9735 string_set(&Globals
.szLogFile
, name
);
9736 debug_set_logfile(name
);
9739 /*******************************************************************
9740 Return the max print jobs per queue.
9741 ********************************************************************/
9743 int lp_maxprintjobs(int snum
)
9745 int maxjobs
= LP_SNUM_OK(snum
) ? ServicePtrs
[snum
]->iMaxPrintJobs
: sDefault
.iMaxPrintJobs
;
9746 if (maxjobs
<= 0 || maxjobs
>= PRINT_MAX_JOBID
)
9747 maxjobs
= PRINT_MAX_JOBID
- 1;
9752 const char *lp_printcapname(void)
9754 if ((Globals
.szPrintcapname
!= NULL
) &&
9755 (Globals
.szPrintcapname
[0] != '\0'))
9756 return Globals
.szPrintcapname
;
9758 if (sDefault
.iPrinting
== PRINT_CUPS
) {
9766 if (sDefault
.iPrinting
== PRINT_BSD
)
9767 return "/etc/printcap";
9769 return PRINTCAP_NAME
;
9772 static uint32 spoolss_state
;
9774 bool lp_disable_spoolss( void )
9776 if ( spoolss_state
== SVCCTL_STATE_UNKNOWN
)
9777 spoolss_state
= _lp_disable_spoolss() ? SVCCTL_STOPPED
: SVCCTL_RUNNING
;
9779 return spoolss_state
== SVCCTL_STOPPED
? True
: False
;
9782 void lp_set_spoolss_state( uint32 state
)
9784 SMB_ASSERT( (state
== SVCCTL_STOPPED
) || (state
== SVCCTL_RUNNING
) );
9786 spoolss_state
= state
;
9789 uint32
lp_get_spoolss_state( void )
9791 return lp_disable_spoolss() ? SVCCTL_STOPPED
: SVCCTL_RUNNING
;
9794 /*******************************************************************
9795 Ensure we don't use sendfile if server smb signing is active.
9796 ********************************************************************/
9798 bool lp_use_sendfile(int snum
, struct smb_signing_state
*signing_state
)
9800 bool sign_active
= false;
9802 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
9803 if (get_Protocol() < PROTOCOL_NT1
) {
9806 if (signing_state
) {
9807 sign_active
= smb_signing_is_active(signing_state
);
9809 return (_lp_use_sendfile(snum
) &&
9810 (get_remote_arch() != RA_WIN95
) &&
9814 /*******************************************************************
9815 Turn off sendfile if we find the underlying OS doesn't support it.
9816 ********************************************************************/
9818 void set_use_sendfile(int snum
, bool val
)
9820 if (LP_SNUM_OK(snum
))
9821 ServicePtrs
[snum
]->bUseSendfile
= val
;
9823 sDefault
.bUseSendfile
= val
;
9826 /*******************************************************************
9827 Turn off storing DOS attributes if this share doesn't support it.
9828 ********************************************************************/
9830 void set_store_dos_attributes(int snum
, bool val
)
9832 if (!LP_SNUM_OK(snum
))
9834 ServicePtrs
[(snum
)]->bStoreDosAttributes
= val
;
9837 void lp_set_mangling_method(const char *new_method
)
9839 string_set(&Globals
.szManglingMethod
, new_method
);
9842 /*******************************************************************
9843 Global state for POSIX pathname processing.
9844 ********************************************************************/
9846 static bool posix_pathnames
;
9848 bool lp_posix_pathnames(void)
9850 return posix_pathnames
;
9853 /*******************************************************************
9854 Change everything needed to ensure POSIX pathname processing (currently
9856 ********************************************************************/
9858 void lp_set_posix_pathnames(void)
9860 posix_pathnames
= True
;
9863 /*******************************************************************
9864 Global state for POSIX lock processing - CIFS unix extensions.
9865 ********************************************************************/
9867 bool posix_default_lock_was_set
;
9868 static enum brl_flavour posix_cifsx_locktype
; /* By default 0 == WINDOWS_LOCK */
9870 enum brl_flavour
lp_posix_cifsu_locktype(files_struct
*fsp
)
9872 if (posix_default_lock_was_set
) {
9873 return posix_cifsx_locktype
;
9875 return fsp
->posix_open
? POSIX_LOCK
: WINDOWS_LOCK
;
9879 /*******************************************************************
9880 ********************************************************************/
9882 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val
)
9884 posix_default_lock_was_set
= True
;
9885 posix_cifsx_locktype
= val
;
9888 int lp_min_receive_file_size(void)
9890 if (Globals
.iminreceivefile
< 0) {
9893 return MIN(Globals
.iminreceivefile
, BUFFER_SIZE
);
9896 /*******************************************************************
9897 If socket address is an empty character string, it is necessary to
9898 define it as "0.0.0.0".
9899 ********************************************************************/
9901 const char *lp_socket_address(void)
9903 char *sock_addr
= Globals
.szSocketAddress
;
9905 if (sock_addr
[0] == '\0'){
9906 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
9908 return Globals
.szSocketAddress
;
9911 void lp_set_passdb_backend(const char *backend
)
9913 string_set(&Globals
.szPassdbBackend
, backend
);
9916 /*******************************************************************
9917 Safe wide links checks.
9918 This helper function always verify the validity of wide links,
9919 even after a configuration file reload.
9920 ********************************************************************/
9922 static bool lp_widelinks_internal(int snum
)
9924 return (bool)(LP_SNUM_OK(snum
)? ServicePtrs
[(snum
)]->bWidelinks
:
9925 sDefault
.bWidelinks
);
9928 void widelinks_warning(int snum
)
9930 if (lp_unix_extensions() && lp_widelinks_internal(snum
)) {
9931 DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
9932 "These parameters are incompatible. "
9933 "Wide links will be disabled for this share.\n",
9934 lp_servicename(snum
) ));
9938 bool lp_widelinks(int snum
)
9940 /* wide links is always incompatible with unix extensions */
9941 if (lp_unix_extensions()) {
9945 return lp_widelinks_internal(snum
);