2 Unix SMB/CIFS implementation.
3 Parameter loading functions
4 Copyright (C) Karl Auer 1993-1998
6 Largely re-written by Andrew Tridgell, September 1994
8 Copyright (C) Simo Sorce 2001
9 Copyright (C) Alexander Bokovoy 2002
10 Copyright (C) Stefan (metze) Metzmacher 2002
11 Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
12 Copyright (C) Michael Adam 2008
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 3 of the License, or
17 (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>.
31 * This module provides suitable callback functions for the params
32 * module. It builds the internal table of service details which is
33 * then used by the rest of the server.
37 * 1) add it to the global or service structure definition
38 * 2) add it to the parm_table
39 * 3) add it to the list of available functions (eg: using FN_GLOBAL_STRING())
40 * 4) If it's a global then initialise it in init_globals. If a local
41 * (ie. service) parameter then initialise it in the sDefault structure
45 * The configuration file is processed sequentially for speed. It is NOT
46 * accessed randomly as happens in 'real' Windows. For this reason, there
47 * is a fair bit of sequence-dependent code here - ie., code which assumes
48 * that certain things happen before others. In particular, the code which
49 * happens at the boundary between sections is delicately poised, so be
56 #include "lib/smbconf/smbconf.h"
57 #include "lib/smbconf/smbconf_init.h"
58 #include "lib/smbconf/smbconf_reg.h"
61 #include "../librpc/gen_ndr/svcctl.h"
63 #include "smb_signing.h"
67 #ifdef HAVE_SYS_SYSCTL_H
68 #include <sys/sysctl.h>
71 #ifdef HAVE_HTTPCONNECTENCRYPT
72 #include <cups/http.h>
77 extern userdom_struct current_user_info
;
80 #define GLOBAL_NAME "global"
84 #define PRINTERS_NAME "printers"
88 #define HOMES_NAME "homes"
91 /* the special value for the include parameter
92 * to be interpreted not as a file name but to
93 * trigger loading of the global smb.conf options
95 #ifndef INCLUDE_REGISTRY_NAME
96 #define INCLUDE_REGISTRY_NAME "registry"
99 static bool in_client
= False
; /* Not in the client by default */
100 static struct smbconf_csn conf_last_csn
;
102 #define CONFIG_BACKEND_FILE 0
103 #define CONFIG_BACKEND_REGISTRY 1
105 static int config_backend
= CONFIG_BACKEND_FILE
;
107 /* some helpful bits */
108 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
109 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
111 #define USERSHARE_VALID 1
112 #define USERSHARE_PENDING_DELETE 2
114 static bool defaults_saved
= False
;
116 struct param_opt_struct
{
117 struct param_opt_struct
*prev
, *next
;
125 * This structure describes global (ie., server-wide) parameters.
132 char *display_charset
;
133 char *szPrintcapname
;
134 char *szAddPortCommand
;
135 char *szEnumPortsCommand
;
136 char *szAddPrinterCommand
;
137 char *szDeletePrinterCommand
;
138 char *szOs2DriverMap
;
144 char *szDefaultService
;
148 char *szServerString
;
149 char *szAutoServices
;
150 char *szPasswdProgram
;
154 char *szSMBPasswdFile
;
156 char *szPassdbBackend
;
157 char **szPreloadModules
;
158 char *szPasswordServer
;
159 char *szSocketOptions
;
161 char *szAfsUsernameMap
;
162 int iAfsTokenLifetime
;
163 char *szLogNtTokenCommand
;
169 char **szWINSservers
;
171 char *szRemoteAnnounce
;
172 char *szRemoteBrowseSync
;
173 char *szSocketAddress
;
174 bool bNmbdBindExplicitBroadcast
;
175 char *szNISHomeMapName
;
176 char *szAnnounceVersion
; /* This is initialised in init_globals */
179 char **szNetbiosAliases
;
180 char *szNetbiosScope
;
181 char *szNameResolveOrder
;
183 char *szAddUserScript
;
184 char *szRenameUserScript
;
185 char *szDelUserScript
;
186 char *szAddGroupScript
;
187 char *szDelGroupScript
;
188 char *szAddUserToGroupScript
;
189 char *szDelUserFromGroupScript
;
190 char *szSetPrimaryGroupScript
;
191 char *szAddMachineScript
;
192 char *szShutdownScript
;
193 char *szAbortShutdownScript
;
194 char *szUsernameMapScript
;
195 int iUsernameMapCacheTime
;
196 char *szCheckPasswordScript
;
203 bool bPassdbExpandExplicit
;
204 int AlgorithmicRidBase
;
205 char *szTemplateHomedir
;
206 char *szTemplateShell
;
207 char *szWinbindSeparator
;
208 bool bWinbindEnumUsers
;
209 bool bWinbindEnumGroups
;
210 bool bWinbindUseDefaultDomain
;
211 bool bWinbindTrustedDomainsOnly
;
212 bool bWinbindNestedGroups
;
213 int winbind_expand_groups
;
214 bool bWinbindRefreshTickets
;
215 bool bWinbindOfflineLogon
;
216 bool bWinbindNormalizeNames
;
217 bool bWinbindRpcOnly
;
218 bool bCreateKrb5Conf
;
219 char *szIdmapBackend
;
221 char *szAddShareCommand
;
222 char *szChangeShareCommand
;
223 char *szDeleteShareCommand
;
225 char *szGuestaccount
;
226 char *szManglingMethod
;
227 char **szServicesList
;
228 char *szUsersharePath
;
229 char *szUsershareTemplateShare
;
230 char **szUsersharePrefixAllowList
;
231 char **szUsersharePrefixDenyList
;
238 int open_files_db_hash_size
;
247 bool paranoid_server_security
;
250 int iMaxSmbdProcesses
;
251 bool bDisableSpoolss
;
254 bool enhanced_browsing
;
260 int announce_as
; /* This is initialised in init_globals */
261 int machine_password_timeout
;
263 int oplock_break_wait_time
;
264 int winbind_cache_time
;
265 int winbind_reconnect_delay
;
266 int winbind_max_clients
;
267 char **szWinbindNssInfo
;
269 char *szLdapMachineSuffix
;
270 char *szLdapUserSuffix
;
271 char *szLdapIdmapSuffix
;
272 char *szLdapGroupSuffix
;
276 int ldap_follow_referral
;
279 int ldap_debug_level
;
280 int ldap_debug_threshold
;
284 char *szIPrintServer
;
286 char **szClusterAddresses
;
289 int ctdb_locktime_warn_threshold
;
290 int ldap_passwd_sync
;
291 int ldap_replication_sleep
;
292 int ldap_timeout
; /* This is initialised in init_globals */
293 int ldap_connection_timeout
;
296 bool bMsAddPrinterWizard
;
301 int iPreferredMaster
;
304 char **szInitLogonDelayedHosts
;
306 bool bEncryptPasswords
;
311 bool bObeyPamRestrictions
;
313 int PrintcapCacheTime
;
314 bool bLargeReadwrite
;
321 bool bBindInterfacesOnly
;
322 bool bPamPasswordChange
;
323 bool bUnixPasswdSync
;
324 bool bPasswdChatDebug
;
325 int iPasswdChatTimeout
;
329 bool bNTStatusSupport
;
331 int iMaxStatCacheSize
;
333 bool bAllowTrustedDomains
;
337 bool bClientLanManAuth
;
338 bool bClientNTLMv2Auth
;
339 bool bClientPlaintextAuth
;
340 bool bClientUseSpnego
;
341 bool client_use_spnego_principal
;
342 bool send_spnego_principal
;
343 bool bDebugPrefixTimestamp
;
344 bool bDebugHiresTimestamp
;
348 bool bEnableCoreFiles
;
351 bool bHostnameLookups
;
352 bool bUnixExtensions
;
353 bool bDisableNetbios
;
354 char * szDedicatedKeytabFile
;
356 bool bDeferSharingViolations
;
357 bool bEnablePrivileges
;
359 bool bUsershareOwnerOnly
;
360 bool bUsershareAllowGuests
;
361 bool bRegistryShares
;
362 int restrict_anonymous
;
363 int name_cache_timeout
;
366 int client_ldap_sasl_wrapping
;
367 int iUsershareMaxShares
;
369 int iIdmapNegativeCacheTime
;
371 bool bLogWriteableFilesOnExit
;
374 struct param_opt_struct
*param_opt
;
375 int cups_connection_timeout
;
376 char *szSMBPerfcountModule
;
377 bool bMapUntrustedToDomain
;
378 bool bAsyncSMBEchoHandler
;
379 bool bMulticastDnsRegister
;
383 int ismb2_max_credits
;
387 static struct global Globals
;
390 * This structure describes a single service.
396 struct timespec usershare_last_mod
;
400 char **szInvalidUsers
;
408 char *szRootPostExec
;
410 char *szPrintcommand
;
413 char *szLppausecommand
;
414 char *szLpresumecommand
;
415 char *szQueuepausecommand
;
416 char *szQueueresumecommand
;
418 char *szPrintjobUsername
;
426 char *szVetoOplockFiles
;
432 char **printer_admin
;
437 char *szAioWriteBehind
;
441 int iMaxReportedPrintJobs
;
444 int iCreate_force_mode
;
446 int iSecurity_force_mode
;
449 int iDir_Security_mask
;
450 int iDir_Security_force_mode
;
454 int iOplockContentionLimit
;
459 bool bRootpreexecClose
;
462 bool bShortCasePreserve
;
464 bool bHideSpecialFiles
;
465 bool bHideUnReadable
;
466 bool bHideUnWriteableFiles
;
468 bool bAccessBasedShareEnum
;
473 bool bAdministrative_share
;
479 bool bStoreDosAttributes
;
492 bool bStrictAllocate
;
495 struct bitmap
*copymap
;
496 bool bDeleteReadonly
;
498 bool bDeleteVetoFiles
;
501 bool bDosFiletimeResolution
;
502 bool bFakeDirCreateTimes
;
508 bool bUseClientDriver
;
509 bool bDefaultDevmode
;
510 bool bForcePrintername
;
512 bool bForceUnknownAclUser
;
515 bool bMap_acl_inherit
;
518 bool bAclCheckPermissions
;
519 bool bAclMapFullControl
;
520 bool bAclGroupControl
;
522 bool bKernelChangeNotify
;
523 int iallocation_roundup_size
;
527 int iDirectoryNameCacheSize
;
529 struct param_opt_struct
*param_opt
;
531 char dummy
[3]; /* for alignment */
535 /* This is a default service used to prime a services structure */
536 static struct service sDefault
= {
538 False
, /* not autoloaded */
539 0, /* not a usershare */
540 {0, }, /* No last mod time */
541 NULL
, /* szService */
543 NULL
, /* szUsername */
544 NULL
, /* szInvalidUsers */
545 NULL
, /* szValidUsers */
546 NULL
, /* szAdminUsers */
548 NULL
, /* szInclude */
549 NULL
, /* szPreExec */
550 NULL
, /* szPostExec */
551 NULL
, /* szRootPreExec */
552 NULL
, /* szRootPostExec */
553 NULL
, /* szCupsOptions */
554 NULL
, /* szPrintcommand */
555 NULL
, /* szLpqcommand */
556 NULL
, /* szLprmcommand */
557 NULL
, /* szLppausecommand */
558 NULL
, /* szLpresumecommand */
559 NULL
, /* szQueuepausecommand */
560 NULL
, /* szQueueresumecommand */
561 NULL
, /* szPrintername */
562 NULL
, /* szPrintjobUsername */
563 NULL
, /* szDontdescend */
564 NULL
, /* szHostsallow */
565 NULL
, /* szHostsdeny */
566 NULL
, /* szMagicScript */
567 NULL
, /* szMagicOutput */
568 NULL
, /* szVetoFiles */
569 NULL
, /* szHideFiles */
570 NULL
, /* szVetoOplockFiles */
572 NULL
, /* force user */
573 NULL
, /* force group */
575 NULL
, /* writelist */
576 NULL
, /* printer admin */
579 NULL
, /* vfs objects */
580 NULL
, /* szMSDfsProxy */
581 NULL
, /* szAioWriteBehind */
583 0, /* iMinPrintSpace */
584 1000, /* iMaxPrintJobs */
585 0, /* iMaxReportedPrintJobs */
586 0, /* iWriteCacheSize */
587 0744, /* iCreate_mask */
588 0000, /* iCreate_force_mode */
589 0777, /* iSecurity_mask */
590 0, /* iSecurity_force_mode */
591 0755, /* iDir_mask */
592 0000, /* iDir_force_mode */
593 0777, /* iDir_Security_mask */
594 0, /* iDir_Security_force_mode */
595 0, /* iMaxConnections */
596 CASE_LOWER
, /* iDefaultCase */
597 DEFAULT_PRINTING
, /* iPrinting */
598 2, /* iOplockContentionLimit */
600 1024, /* iBlock_size */
601 0, /* iDfreeCacheTime */
602 False
, /* bPreexecClose */
603 False
, /* bRootpreexecClose */
604 Auto
, /* case sensitive */
605 True
, /* case preserve */
606 True
, /* short case preserve */
607 True
, /* bHideDotFiles */
608 False
, /* bHideSpecialFiles */
609 False
, /* bHideUnReadable */
610 False
, /* bHideUnWriteableFiles */
611 True
, /* bBrowseable */
612 False
, /* bAccessBasedShareEnum */
613 True
, /* bAvailable */
614 True
, /* bRead_only */
615 True
, /* bNo_set_dir */
616 False
, /* bGuest_only */
617 False
, /* bAdministrative_share */
618 False
, /* bGuest_ok */
619 False
, /* bPrint_ok */
620 False
, /* bMap_system */
621 False
, /* bMap_hidden */
622 True
, /* bMap_archive */
623 False
, /* bStoreDosAttributes */
624 False
, /* bDmapiSupport */
626 Auto
, /* iStrictLocking */
627 True
, /* bPosixLocking */
628 True
, /* bShareModes */
630 True
, /* bLevel2OpLocks */
631 False
, /* bOnlyUser */
632 True
, /* bMangledNames */
633 false, /* bWidelinks */
634 True
, /* bSymlinks */
635 False
, /* bSyncAlways */
636 False
, /* bStrictAllocate */
637 False
, /* bStrictSync */
638 '~', /* magic char */
640 False
, /* bDeleteReadonly */
641 False
, /* bFakeOplocks */
642 False
, /* bDeleteVetoFiles */
643 False
, /* bDosFilemode */
644 True
, /* bDosFiletimes */
645 False
, /* bDosFiletimeResolution */
646 False
, /* bFakeDirCreateTimes */
647 True
, /* bBlockingLocks */
648 False
, /* bInheritPerms */
649 False
, /* bInheritACLS */
650 False
, /* bInheritOwner */
651 False
, /* bMSDfsRoot */
652 False
, /* bUseClientDriver */
653 True
, /* bDefaultDevmode */
654 False
, /* bForcePrintername */
655 True
, /* bNTAclSupport */
656 False
, /* bForceUnknownAclUser */
657 False
, /* bUseSendfile */
658 False
, /* bProfileAcls */
659 False
, /* bMap_acl_inherit */
660 False
, /* bAfs_Share */
661 False
, /* bEASupport */
662 True
, /* bAclCheckPermissions */
663 True
, /* bAclMapFullControl */
664 False
, /* bAclGroupControl */
665 True
, /* bChangeNotify */
666 True
, /* bKernelChangeNotify */
667 SMB_ROUNDUP_ALLOCATION_SIZE
, /* iallocation_roundup_size */
668 0, /* iAioReadSize */
669 0, /* iAioWriteSize */
670 MAP_READONLY_YES
, /* iMap_readonly */
671 #ifdef BROKEN_DIRECTORY_HANDLING
672 0, /* iDirectoryNameCacheSize */
674 100, /* iDirectoryNameCacheSize */
676 Auto
, /* ismb_encrypt */
677 NULL
, /* Parametric options */
682 /* local variables */
683 static struct service
**ServicePtrs
= NULL
;
684 static int iNumServices
= 0;
685 static int iServiceIndex
= 0;
686 static struct db_context
*ServiceHash
;
687 static int *invalid_services
= NULL
;
688 static int num_invalid_services
= 0;
689 static bool bInGlobalSection
= True
;
690 static bool bGlobalOnly
= False
;
691 static int default_server_announce
;
693 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
695 /* prototypes for the special type handlers */
696 static bool handle_include( int snum
, const char *pszParmValue
, char **ptr
);
697 static bool handle_copy( int snum
, const char *pszParmValue
, char **ptr
);
698 static bool handle_netbios_name( int snum
, const char *pszParmValue
, char **ptr
);
699 static bool handle_idmap_uid( int snum
, const char *pszParmValue
, char **ptr
);
700 static bool handle_idmap_gid( int snum
, const char *pszParmValue
, char **ptr
);
701 static bool handle_debug_list( int snum
, const char *pszParmValue
, char **ptr
);
702 static bool handle_workgroup( int snum
, const char *pszParmValue
, char **ptr
);
703 static bool handle_netbios_aliases( int snum
, const char *pszParmValue
, char **ptr
);
704 static bool handle_netbios_scope( int snum
, const char *pszParmValue
, char **ptr
);
705 static bool handle_charset( int snum
, const char *pszParmValue
, char **ptr
);
706 static bool handle_printing( int snum
, const char *pszParmValue
, char **ptr
);
707 static bool handle_ldap_debug_level( int snum
, const char *pszParmValue
, char **ptr
);
709 static void set_default_server_announce_type(void);
710 static void set_allowed_client_auth(void);
712 static void *lp_local_ptr(struct service
*service
, void *ptr
);
714 static void add_to_file_list(const char *fname
, const char *subfname
);
715 static bool lp_set_cmdline_helper(const char *pszParmName
, const char *pszParmValue
, bool store_values
);
717 static const struct enum_list enum_protocol
[] = {
718 {PROTOCOL_SMB2
, "SMB2"},
719 {PROTOCOL_NT1
, "NT1"},
720 {PROTOCOL_LANMAN2
, "LANMAN2"},
721 {PROTOCOL_LANMAN1
, "LANMAN1"},
722 {PROTOCOL_CORE
, "CORE"},
723 {PROTOCOL_COREPLUS
, "COREPLUS"},
724 {PROTOCOL_COREPLUS
, "CORE+"},
728 static const struct enum_list enum_security
[] = {
729 {SEC_SHARE
, "SHARE"},
731 {SEC_SERVER
, "SERVER"},
732 {SEC_DOMAIN
, "DOMAIN"},
739 static const struct enum_list enum_printing
[] = {
740 {PRINT_SYSV
, "sysv"},
742 {PRINT_HPUX
, "hpux"},
746 {PRINT_LPRNG
, "lprng"},
747 {PRINT_CUPS
, "cups"},
748 {PRINT_IPRINT
, "iprint"},
750 {PRINT_LPROS2
, "os2"},
752 {PRINT_TEST
, "test"},
754 #endif /* DEVELOPER */
758 static const struct enum_list enum_ldap_sasl_wrapping
[] = {
760 {ADS_AUTH_SASL_SIGN
, "sign"},
761 {ADS_AUTH_SASL_SEAL
, "seal"},
765 static const struct enum_list enum_ldap_ssl
[] = {
766 {LDAP_SSL_OFF
, "no"},
767 {LDAP_SSL_OFF
, "off"},
768 {LDAP_SSL_START_TLS
, "start tls"},
769 {LDAP_SSL_START_TLS
, "start_tls"},
773 /* LDAP Dereferencing Alias types */
774 #define SAMBA_LDAP_DEREF_NEVER 0
775 #define SAMBA_LDAP_DEREF_SEARCHING 1
776 #define SAMBA_LDAP_DEREF_FINDING 2
777 #define SAMBA_LDAP_DEREF_ALWAYS 3
779 static const struct enum_list enum_ldap_deref
[] = {
780 {SAMBA_LDAP_DEREF_NEVER
, "never"},
781 {SAMBA_LDAP_DEREF_SEARCHING
, "searching"},
782 {SAMBA_LDAP_DEREF_FINDING
, "finding"},
783 {SAMBA_LDAP_DEREF_ALWAYS
, "always"},
787 static const struct enum_list enum_ldap_passwd_sync
[] = {
788 {LDAP_PASSWD_SYNC_OFF
, "no"},
789 {LDAP_PASSWD_SYNC_OFF
, "off"},
790 {LDAP_PASSWD_SYNC_ON
, "yes"},
791 {LDAP_PASSWD_SYNC_ON
, "on"},
792 {LDAP_PASSWD_SYNC_ONLY
, "only"},
796 /* Types of machine we can announce as. */
797 #define ANNOUNCE_AS_NT_SERVER 1
798 #define ANNOUNCE_AS_WIN95 2
799 #define ANNOUNCE_AS_WFW 3
800 #define ANNOUNCE_AS_NT_WORKSTATION 4
802 static const struct enum_list enum_announce_as
[] = {
803 {ANNOUNCE_AS_NT_SERVER
, "NT"},
804 {ANNOUNCE_AS_NT_SERVER
, "NT Server"},
805 {ANNOUNCE_AS_NT_WORKSTATION
, "NT Workstation"},
806 {ANNOUNCE_AS_WIN95
, "win95"},
807 {ANNOUNCE_AS_WFW
, "WfW"},
811 static const struct enum_list enum_map_readonly
[] = {
812 {MAP_READONLY_NO
, "no"},
813 {MAP_READONLY_NO
, "false"},
814 {MAP_READONLY_NO
, "0"},
815 {MAP_READONLY_YES
, "yes"},
816 {MAP_READONLY_YES
, "true"},
817 {MAP_READONLY_YES
, "1"},
818 {MAP_READONLY_PERMISSIONS
, "permissions"},
819 {MAP_READONLY_PERMISSIONS
, "perms"},
823 static const struct enum_list enum_case
[] = {
824 {CASE_LOWER
, "lower"},
825 {CASE_UPPER
, "upper"},
831 static const struct enum_list enum_bool_auto
[] = {
842 static const struct enum_list enum_csc_policy
[] = {
843 {CSC_POLICY_MANUAL
, "manual"},
844 {CSC_POLICY_DOCUMENTS
, "documents"},
845 {CSC_POLICY_PROGRAMS
, "programs"},
846 {CSC_POLICY_DISABLE
, "disable"},
850 /* SMB signing types. */
851 static const struct enum_list enum_smb_signing_vals
[] = {
863 {Required
, "required"},
864 {Required
, "mandatory"},
866 {Required
, "forced"},
867 {Required
, "enforced"},
871 /* ACL compatibility options. */
872 static const struct enum_list enum_acl_compat_vals
[] = {
873 { ACL_COMPAT_AUTO
, "auto" },
874 { ACL_COMPAT_WINNT
, "winnt" },
875 { ACL_COMPAT_WIN2K
, "win2k" },
880 Do you want session setups at user level security with a invalid
881 password to be rejected or allowed in as guest? WinNT rejects them
882 but it can be a pain as it means "net view" needs to use a password
884 You have 3 choices in the setting of map_to_guest:
886 "Never" means session setups with an invalid password
887 are rejected. This is the default.
889 "Bad User" means session setups with an invalid password
890 are rejected, unless the username does not exist, in which case it
891 is treated as a guest login
893 "Bad Password" means session setups with an invalid password
894 are treated as a guest login
896 Note that map_to_guest only has an effect in user or server
900 static const struct enum_list enum_map_to_guest
[] = {
901 {NEVER_MAP_TO_GUEST
, "Never"},
902 {MAP_TO_GUEST_ON_BAD_USER
, "Bad User"},
903 {MAP_TO_GUEST_ON_BAD_PASSWORD
, "Bad Password"},
904 {MAP_TO_GUEST_ON_BAD_UID
, "Bad Uid"},
908 /* Config backend options */
910 static const struct enum_list enum_config_backend
[] = {
911 {CONFIG_BACKEND_FILE
, "file"},
912 {CONFIG_BACKEND_REGISTRY
, "registry"},
916 /* ADS kerberos ticket verification options */
918 static const struct enum_list enum_kerberos_method
[] = {
919 {KERBEROS_VERIFY_SECRETS
, "default"},
920 {KERBEROS_VERIFY_SECRETS
, "secrets only"},
921 {KERBEROS_VERIFY_SYSTEM_KEYTAB
, "system keytab"},
922 {KERBEROS_VERIFY_DEDICATED_KEYTAB
, "dedicated keytab"},
923 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB
, "secrets and keytab"},
927 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
929 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
930 * screen in SWAT. This is used to exclude parameters as well as to squash all
931 * parameters that have been duplicated by pseudonyms.
933 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
934 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
935 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
938 * NOTE2: Handling of duplicated (synonym) parameters:
939 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
940 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
941 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
942 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
945 static struct parm_struct parm_table
[] = {
946 {N_("Base Options"), P_SEP
, P_SEPARATOR
},
949 .label
= "dos charset",
952 .ptr
= &Globals
.dos_charset
,
953 .special
= handle_charset
,
955 .flags
= FLAG_ADVANCED
958 .label
= "unix charset",
961 .ptr
= &Globals
.unix_charset
,
962 .special
= handle_charset
,
964 .flags
= FLAG_ADVANCED
967 .label
= "display charset",
970 .ptr
= &Globals
.display_charset
,
971 .special
= handle_charset
,
973 .flags
= FLAG_ADVANCED
979 .ptr
= &sDefault
.comment
,
982 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
988 .ptr
= &sDefault
.szPath
,
991 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
994 .label
= "directory",
997 .ptr
= &sDefault
.szPath
,
1003 .label
= "workgroup",
1005 .p_class
= P_GLOBAL
,
1006 .ptr
= &Globals
.szWorkgroup
,
1007 .special
= handle_workgroup
,
1009 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1015 .p_class
= P_GLOBAL
,
1016 .ptr
= &Globals
.szRealm
,
1019 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1023 .label
= "netbios name",
1025 .p_class
= P_GLOBAL
,
1026 .ptr
= &Globals
.szNetbiosName
,
1027 .special
= handle_netbios_name
,
1029 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1032 .label
= "netbios aliases",
1034 .p_class
= P_GLOBAL
,
1035 .ptr
= &Globals
.szNetbiosAliases
,
1036 .special
= handle_netbios_aliases
,
1038 .flags
= FLAG_ADVANCED
,
1041 .label
= "netbios scope",
1043 .p_class
= P_GLOBAL
,
1044 .ptr
= &Globals
.szNetbiosScope
,
1045 .special
= handle_netbios_scope
,
1047 .flags
= FLAG_ADVANCED
,
1050 .label
= "server string",
1052 .p_class
= P_GLOBAL
,
1053 .ptr
= &Globals
.szServerString
,
1056 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1059 .label
= "interfaces",
1061 .p_class
= P_GLOBAL
,
1062 .ptr
= &Globals
.szInterfaces
,
1065 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1068 .label
= "bind interfaces only",
1070 .p_class
= P_GLOBAL
,
1071 .ptr
= &Globals
.bBindInterfacesOnly
,
1074 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1077 .label
= "config backend",
1079 .p_class
= P_GLOBAL
,
1080 .ptr
= &Globals
.ConfigBackend
,
1082 .enum_list
= enum_config_backend
,
1083 .flags
= FLAG_HIDE
|FLAG_ADVANCED
|FLAG_META
,
1086 {N_("Security Options"), P_SEP
, P_SEPARATOR
},
1089 .label
= "security",
1091 .p_class
= P_GLOBAL
,
1092 .ptr
= &Globals
.security
,
1094 .enum_list
= enum_security
,
1095 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1098 .label
= "auth methods",
1100 .p_class
= P_GLOBAL
,
1101 .ptr
= &Globals
.AuthMethods
,
1104 .flags
= FLAG_ADVANCED
,
1107 .label
= "encrypt passwords",
1109 .p_class
= P_GLOBAL
,
1110 .ptr
= &Globals
.bEncryptPasswords
,
1113 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1116 .label
= "client schannel",
1118 .p_class
= P_GLOBAL
,
1119 .ptr
= &Globals
.clientSchannel
,
1121 .enum_list
= enum_bool_auto
,
1122 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1125 .label
= "server schannel",
1127 .p_class
= P_GLOBAL
,
1128 .ptr
= &Globals
.serverSchannel
,
1130 .enum_list
= enum_bool_auto
,
1131 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1134 .label
= "allow trusted domains",
1136 .p_class
= P_GLOBAL
,
1137 .ptr
= &Globals
.bAllowTrustedDomains
,
1140 .flags
= FLAG_ADVANCED
,
1143 .label
= "map to guest",
1145 .p_class
= P_GLOBAL
,
1146 .ptr
= &Globals
.map_to_guest
,
1148 .enum_list
= enum_map_to_guest
,
1149 .flags
= FLAG_ADVANCED
,
1152 .label
= "null passwords",
1154 .p_class
= P_GLOBAL
,
1155 .ptr
= &Globals
.bNullPasswords
,
1158 .flags
= FLAG_ADVANCED
,
1161 .label
= "obey pam restrictions",
1163 .p_class
= P_GLOBAL
,
1164 .ptr
= &Globals
.bObeyPamRestrictions
,
1167 .flags
= FLAG_ADVANCED
,
1170 .label
= "password server",
1172 .p_class
= P_GLOBAL
,
1173 .ptr
= &Globals
.szPasswordServer
,
1176 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1179 .label
= "smb passwd file",
1181 .p_class
= P_GLOBAL
,
1182 .ptr
= &Globals
.szSMBPasswdFile
,
1185 .flags
= FLAG_ADVANCED
,
1188 .label
= "private dir",
1190 .p_class
= P_GLOBAL
,
1191 .ptr
= &Globals
.szPrivateDir
,
1194 .flags
= FLAG_ADVANCED
,
1197 .label
= "passdb backend",
1199 .p_class
= P_GLOBAL
,
1200 .ptr
= &Globals
.szPassdbBackend
,
1203 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1206 .label
= "algorithmic rid base",
1208 .p_class
= P_GLOBAL
,
1209 .ptr
= &Globals
.AlgorithmicRidBase
,
1212 .flags
= FLAG_ADVANCED
,
1215 .label
= "root directory",
1217 .p_class
= P_GLOBAL
,
1218 .ptr
= &Globals
.szRootdir
,
1221 .flags
= FLAG_ADVANCED
,
1224 .label
= "root dir",
1226 .p_class
= P_GLOBAL
,
1227 .ptr
= &Globals
.szRootdir
,
1235 .p_class
= P_GLOBAL
,
1236 .ptr
= &Globals
.szRootdir
,
1242 .label
= "guest account",
1244 .p_class
= P_GLOBAL
,
1245 .ptr
= &Globals
.szGuestaccount
,
1248 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1251 .label
= "enable privileges",
1253 .p_class
= P_GLOBAL
,
1254 .ptr
= &Globals
.bEnablePrivileges
,
1257 .flags
= FLAG_ADVANCED
,
1261 .label
= "pam password change",
1263 .p_class
= P_GLOBAL
,
1264 .ptr
= &Globals
.bPamPasswordChange
,
1267 .flags
= FLAG_ADVANCED
,
1270 .label
= "passwd program",
1272 .p_class
= P_GLOBAL
,
1273 .ptr
= &Globals
.szPasswdProgram
,
1276 .flags
= FLAG_ADVANCED
,
1279 .label
= "passwd chat",
1281 .p_class
= P_GLOBAL
,
1282 .ptr
= &Globals
.szPasswdChat
,
1285 .flags
= FLAG_ADVANCED
,
1288 .label
= "passwd chat debug",
1290 .p_class
= P_GLOBAL
,
1291 .ptr
= &Globals
.bPasswdChatDebug
,
1294 .flags
= FLAG_ADVANCED
,
1297 .label
= "passwd chat timeout",
1299 .p_class
= P_GLOBAL
,
1300 .ptr
= &Globals
.iPasswdChatTimeout
,
1303 .flags
= FLAG_ADVANCED
,
1306 .label
= "check password script",
1308 .p_class
= P_GLOBAL
,
1309 .ptr
= &Globals
.szCheckPasswordScript
,
1312 .flags
= FLAG_ADVANCED
,
1315 .label
= "username map",
1317 .p_class
= P_GLOBAL
,
1318 .ptr
= &Globals
.szUsernameMap
,
1321 .flags
= FLAG_ADVANCED
,
1324 .label
= "password level",
1326 .p_class
= P_GLOBAL
,
1327 .ptr
= &Globals
.pwordlevel
,
1330 .flags
= FLAG_ADVANCED
,
1333 .label
= "username level",
1335 .p_class
= P_GLOBAL
,
1336 .ptr
= &Globals
.unamelevel
,
1339 .flags
= FLAG_ADVANCED
,
1342 .label
= "unix password sync",
1344 .p_class
= P_GLOBAL
,
1345 .ptr
= &Globals
.bUnixPasswdSync
,
1348 .flags
= FLAG_ADVANCED
,
1351 .label
= "restrict anonymous",
1353 .p_class
= P_GLOBAL
,
1354 .ptr
= &Globals
.restrict_anonymous
,
1357 .flags
= FLAG_ADVANCED
,
1360 .label
= "lanman auth",
1362 .p_class
= P_GLOBAL
,
1363 .ptr
= &Globals
.bLanmanAuth
,
1366 .flags
= FLAG_ADVANCED
,
1369 .label
= "ntlm auth",
1371 .p_class
= P_GLOBAL
,
1372 .ptr
= &Globals
.bNTLMAuth
,
1375 .flags
= FLAG_ADVANCED
,
1378 .label
= "client NTLMv2 auth",
1380 .p_class
= P_GLOBAL
,
1381 .ptr
= &Globals
.bClientNTLMv2Auth
,
1384 .flags
= FLAG_ADVANCED
,
1387 .label
= "client lanman auth",
1389 .p_class
= P_GLOBAL
,
1390 .ptr
= &Globals
.bClientLanManAuth
,
1393 .flags
= FLAG_ADVANCED
,
1396 .label
= "client plaintext auth",
1398 .p_class
= P_GLOBAL
,
1399 .ptr
= &Globals
.bClientPlaintextAuth
,
1402 .flags
= FLAG_ADVANCED
,
1405 .label
= "client use spnego principal",
1407 .p_class
= P_GLOBAL
,
1408 .ptr
= &Globals
.client_use_spnego_principal
,
1411 .flags
= FLAG_ADVANCED
,
1414 .label
= "send spnego principal",
1416 .p_class
= P_GLOBAL
,
1417 .ptr
= &Globals
.send_spnego_principal
,
1420 .flags
= FLAG_ADVANCED
,
1423 .label
= "username",
1426 .ptr
= &sDefault
.szUsername
,
1429 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1435 .ptr
= &sDefault
.szUsername
,
1444 .ptr
= &sDefault
.szUsername
,
1450 .label
= "invalid users",
1453 .ptr
= &sDefault
.szInvalidUsers
,
1456 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1459 .label
= "valid users",
1462 .ptr
= &sDefault
.szValidUsers
,
1465 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1468 .label
= "admin users",
1471 .ptr
= &sDefault
.szAdminUsers
,
1474 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1477 .label
= "read list",
1480 .ptr
= &sDefault
.readlist
,
1483 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1486 .label
= "write list",
1489 .ptr
= &sDefault
.writelist
,
1492 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1495 .label
= "printer admin",
1498 .ptr
= &sDefault
.printer_admin
,
1501 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_PRINT
| FLAG_DEPRECATED
,
1504 .label
= "force user",
1507 .ptr
= &sDefault
.force_user
,
1510 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1513 .label
= "force group",
1516 .ptr
= &sDefault
.force_group
,
1519 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1525 .ptr
= &sDefault
.force_group
,
1528 .flags
= FLAG_ADVANCED
,
1531 .label
= "read only",
1534 .ptr
= &sDefault
.bRead_only
,
1537 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
,
1540 .label
= "write ok",
1543 .ptr
= &sDefault
.bRead_only
,
1549 .label
= "writeable",
1552 .ptr
= &sDefault
.bRead_only
,
1558 .label
= "writable",
1561 .ptr
= &sDefault
.bRead_only
,
1567 .label
= "acl check permissions",
1570 .ptr
= &sDefault
.bAclCheckPermissions
,
1573 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1576 .label
= "acl group control",
1579 .ptr
= &sDefault
.bAclGroupControl
,
1582 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1585 .label
= "acl map full control",
1588 .ptr
= &sDefault
.bAclMapFullControl
,
1591 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1594 .label
= "create mask",
1597 .ptr
= &sDefault
.iCreate_mask
,
1600 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1603 .label
= "create mode",
1606 .ptr
= &sDefault
.iCreate_mask
,
1612 .label
= "force create mode",
1615 .ptr
= &sDefault
.iCreate_force_mode
,
1618 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1621 .label
= "security mask",
1624 .ptr
= &sDefault
.iSecurity_mask
,
1627 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1630 .label
= "force security mode",
1633 .ptr
= &sDefault
.iSecurity_force_mode
,
1636 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1639 .label
= "directory mask",
1642 .ptr
= &sDefault
.iDir_mask
,
1645 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1648 .label
= "directory mode",
1651 .ptr
= &sDefault
.iDir_mask
,
1654 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1657 .label
= "force directory mode",
1660 .ptr
= &sDefault
.iDir_force_mode
,
1663 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1666 .label
= "directory security mask",
1669 .ptr
= &sDefault
.iDir_Security_mask
,
1672 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1675 .label
= "force directory security mode",
1678 .ptr
= &sDefault
.iDir_Security_force_mode
,
1681 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1684 .label
= "force unknown acl user",
1687 .ptr
= &sDefault
.bForceUnknownAclUser
,
1690 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1693 .label
= "inherit permissions",
1696 .ptr
= &sDefault
.bInheritPerms
,
1699 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1702 .label
= "inherit acls",
1705 .ptr
= &sDefault
.bInheritACLS
,
1708 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1711 .label
= "inherit owner",
1714 .ptr
= &sDefault
.bInheritOwner
,
1717 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1720 .label
= "guest only",
1723 .ptr
= &sDefault
.bGuest_only
,
1726 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1729 .label
= "only guest",
1732 .ptr
= &sDefault
.bGuest_only
,
1738 .label
= "administrative share",
1741 .ptr
= &sDefault
.bAdministrative_share
,
1744 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1748 .label
= "guest ok",
1751 .ptr
= &sDefault
.bGuest_ok
,
1754 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1760 .ptr
= &sDefault
.bGuest_ok
,
1766 .label
= "only user",
1769 .ptr
= &sDefault
.bOnlyUser
,
1772 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_DEPRECATED
,
1775 .label
= "hosts allow",
1778 .ptr
= &sDefault
.szHostsallow
,
1781 .flags
= FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1784 .label
= "allow hosts",
1787 .ptr
= &sDefault
.szHostsallow
,
1793 .label
= "hosts deny",
1796 .ptr
= &sDefault
.szHostsdeny
,
1799 .flags
= FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1802 .label
= "deny hosts",
1805 .ptr
= &sDefault
.szHostsdeny
,
1811 .label
= "preload modules",
1813 .p_class
= P_GLOBAL
,
1814 .ptr
= &Globals
.szPreloadModules
,
1817 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1820 .label
= "dedicated keytab file",
1822 .p_class
= P_GLOBAL
,
1823 .ptr
= &Globals
.szDedicatedKeytabFile
,
1826 .flags
= FLAG_ADVANCED
,
1829 .label
= "kerberos method",
1831 .p_class
= P_GLOBAL
,
1832 .ptr
= &Globals
.iKerberosMethod
,
1834 .enum_list
= enum_kerberos_method
,
1835 .flags
= FLAG_ADVANCED
,
1838 .label
= "map untrusted to domain",
1840 .p_class
= P_GLOBAL
,
1841 .ptr
= &Globals
.bMapUntrustedToDomain
,
1844 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1848 {N_("Logging Options"), P_SEP
, P_SEPARATOR
},
1851 .label
= "log level",
1853 .p_class
= P_GLOBAL
,
1854 .ptr
= &Globals
.szLogLevel
,
1855 .special
= handle_debug_list
,
1857 .flags
= FLAG_ADVANCED
,
1860 .label
= "debuglevel",
1862 .p_class
= P_GLOBAL
,
1863 .ptr
= &Globals
.szLogLevel
,
1864 .special
= handle_debug_list
,
1871 .p_class
= P_GLOBAL
,
1872 .ptr
= &Globals
.syslog
,
1875 .flags
= FLAG_ADVANCED
,
1878 .label
= "syslog only",
1880 .p_class
= P_GLOBAL
,
1881 .ptr
= &Globals
.bSyslogOnly
,
1884 .flags
= FLAG_ADVANCED
,
1887 .label
= "log file",
1889 .p_class
= P_GLOBAL
,
1890 .ptr
= &Globals
.szLogFile
,
1893 .flags
= FLAG_ADVANCED
,
1896 .label
= "max log size",
1898 .p_class
= P_GLOBAL
,
1899 .ptr
= &Globals
.max_log_size
,
1902 .flags
= FLAG_ADVANCED
,
1905 .label
= "debug timestamp",
1907 .p_class
= P_GLOBAL
,
1908 .ptr
= &Globals
.bTimestampLogs
,
1911 .flags
= FLAG_ADVANCED
,
1914 .label
= "timestamp logs",
1916 .p_class
= P_GLOBAL
,
1917 .ptr
= &Globals
.bTimestampLogs
,
1920 .flags
= FLAG_ADVANCED
,
1923 .label
= "debug prefix timestamp",
1925 .p_class
= P_GLOBAL
,
1926 .ptr
= &Globals
.bDebugPrefixTimestamp
,
1929 .flags
= FLAG_ADVANCED
,
1932 .label
= "debug hires timestamp",
1934 .p_class
= P_GLOBAL
,
1935 .ptr
= &Globals
.bDebugHiresTimestamp
,
1938 .flags
= FLAG_ADVANCED
,
1941 .label
= "debug pid",
1943 .p_class
= P_GLOBAL
,
1944 .ptr
= &Globals
.bDebugPid
,
1947 .flags
= FLAG_ADVANCED
,
1950 .label
= "debug uid",
1952 .p_class
= P_GLOBAL
,
1953 .ptr
= &Globals
.bDebugUid
,
1956 .flags
= FLAG_ADVANCED
,
1959 .label
= "debug class",
1961 .p_class
= P_GLOBAL
,
1962 .ptr
= &Globals
.bDebugClass
,
1965 .flags
= FLAG_ADVANCED
,
1968 .label
= "enable core files",
1970 .p_class
= P_GLOBAL
,
1971 .ptr
= &Globals
.bEnableCoreFiles
,
1974 .flags
= FLAG_ADVANCED
,
1977 {N_("Protocol Options"), P_SEP
, P_SEPARATOR
},
1980 .label
= "allocation roundup size",
1983 .ptr
= &sDefault
.iallocation_roundup_size
,
1986 .flags
= FLAG_ADVANCED
,
1989 .label
= "aio read size",
1992 .ptr
= &sDefault
.iAioReadSize
,
1995 .flags
= FLAG_ADVANCED
,
1998 .label
= "aio write size",
2001 .ptr
= &sDefault
.iAioWriteSize
,
2004 .flags
= FLAG_ADVANCED
,
2007 .label
= "aio write behind",
2010 .ptr
= &sDefault
.szAioWriteBehind
,
2013 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2016 .label
= "smb ports",
2018 .p_class
= P_GLOBAL
,
2019 .ptr
= &Globals
.smb_ports
,
2022 .flags
= FLAG_ADVANCED
,
2025 .label
= "large readwrite",
2027 .p_class
= P_GLOBAL
,
2028 .ptr
= &Globals
.bLargeReadwrite
,
2031 .flags
= FLAG_ADVANCED
,
2034 .label
= "max protocol",
2036 .p_class
= P_GLOBAL
,
2037 .ptr
= &Globals
.maxprotocol
,
2039 .enum_list
= enum_protocol
,
2040 .flags
= FLAG_ADVANCED
,
2043 .label
= "protocol",
2045 .p_class
= P_GLOBAL
,
2046 .ptr
= &Globals
.maxprotocol
,
2048 .enum_list
= enum_protocol
,
2049 .flags
= FLAG_ADVANCED
,
2052 .label
= "min protocol",
2054 .p_class
= P_GLOBAL
,
2055 .ptr
= &Globals
.minprotocol
,
2057 .enum_list
= enum_protocol
,
2058 .flags
= FLAG_ADVANCED
,
2061 .label
= "min receivefile size",
2063 .p_class
= P_GLOBAL
,
2064 .ptr
= &Globals
.iminreceivefile
,
2067 .flags
= FLAG_ADVANCED
,
2070 .label
= "read raw",
2072 .p_class
= P_GLOBAL
,
2073 .ptr
= &Globals
.bReadRaw
,
2076 .flags
= FLAG_ADVANCED
,
2079 .label
= "write raw",
2081 .p_class
= P_GLOBAL
,
2082 .ptr
= &Globals
.bWriteRaw
,
2085 .flags
= FLAG_ADVANCED
,
2088 .label
= "disable netbios",
2090 .p_class
= P_GLOBAL
,
2091 .ptr
= &Globals
.bDisableNetbios
,
2094 .flags
= FLAG_ADVANCED
,
2097 .label
= "reset on zero vc",
2099 .p_class
= P_GLOBAL
,
2100 .ptr
= &Globals
.bResetOnZeroVC
,
2103 .flags
= FLAG_ADVANCED
,
2106 .label
= "log writeable files on exit",
2108 .p_class
= P_GLOBAL
,
2109 .ptr
= &Globals
.bLogWriteableFilesOnExit
,
2112 .flags
= FLAG_ADVANCED
,
2115 .label
= "acl compatibility",
2117 .p_class
= P_GLOBAL
,
2118 .ptr
= &Globals
.iAclCompat
,
2120 .enum_list
= enum_acl_compat_vals
,
2121 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2124 .label
= "defer sharing violations",
2126 .p_class
= P_GLOBAL
,
2127 .ptr
= &Globals
.bDeferSharingViolations
,
2130 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2133 .label
= "ea support",
2136 .ptr
= &sDefault
.bEASupport
,
2139 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2142 .label
= "nt acl support",
2145 .ptr
= &sDefault
.bNTAclSupport
,
2148 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2151 .label
= "nt pipe support",
2153 .p_class
= P_GLOBAL
,
2154 .ptr
= &Globals
.bNTPipeSupport
,
2157 .flags
= FLAG_ADVANCED
,
2160 .label
= "nt status support",
2162 .p_class
= P_GLOBAL
,
2163 .ptr
= &Globals
.bNTStatusSupport
,
2166 .flags
= FLAG_ADVANCED
,
2169 .label
= "profile acls",
2172 .ptr
= &sDefault
.bProfileAcls
,
2175 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
2178 .label
= "announce version",
2180 .p_class
= P_GLOBAL
,
2181 .ptr
= &Globals
.szAnnounceVersion
,
2184 .flags
= FLAG_ADVANCED
,
2187 .label
= "announce as",
2189 .p_class
= P_GLOBAL
,
2190 .ptr
= &Globals
.announce_as
,
2192 .enum_list
= enum_announce_as
,
2193 .flags
= FLAG_ADVANCED
,
2196 .label
= "map acl inherit",
2199 .ptr
= &sDefault
.bMap_acl_inherit
,
2202 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2205 .label
= "afs share",
2208 .ptr
= &sDefault
.bAfs_Share
,
2211 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2216 .p_class
= P_GLOBAL
,
2217 .ptr
= &Globals
.max_mux
,
2220 .flags
= FLAG_ADVANCED
,
2223 .label
= "max xmit",
2225 .p_class
= P_GLOBAL
,
2226 .ptr
= &Globals
.max_xmit
,
2229 .flags
= FLAG_ADVANCED
,
2232 .label
= "name resolve order",
2234 .p_class
= P_GLOBAL
,
2235 .ptr
= &Globals
.szNameResolveOrder
,
2238 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
2243 .p_class
= P_GLOBAL
,
2244 .ptr
= &Globals
.max_ttl
,
2247 .flags
= FLAG_ADVANCED
,
2250 .label
= "max wins ttl",
2252 .p_class
= P_GLOBAL
,
2253 .ptr
= &Globals
.max_wins_ttl
,
2256 .flags
= FLAG_ADVANCED
,
2259 .label
= "min wins ttl",
2261 .p_class
= P_GLOBAL
,
2262 .ptr
= &Globals
.min_wins_ttl
,
2265 .flags
= FLAG_ADVANCED
,
2268 .label
= "time server",
2270 .p_class
= P_GLOBAL
,
2271 .ptr
= &Globals
.bTimeServer
,
2274 .flags
= FLAG_ADVANCED
,
2277 .label
= "unix extensions",
2279 .p_class
= P_GLOBAL
,
2280 .ptr
= &Globals
.bUnixExtensions
,
2283 .flags
= FLAG_ADVANCED
,
2286 .label
= "use spnego",
2288 .p_class
= P_GLOBAL
,
2289 .ptr
= &Globals
.bUseSpnego
,
2292 .flags
= FLAG_ADVANCED
,
2295 .label
= "client signing",
2297 .p_class
= P_GLOBAL
,
2298 .ptr
= &Globals
.client_signing
,
2300 .enum_list
= enum_smb_signing_vals
,
2301 .flags
= FLAG_ADVANCED
,
2304 .label
= "server signing",
2306 .p_class
= P_GLOBAL
,
2307 .ptr
= &Globals
.server_signing
,
2309 .enum_list
= enum_smb_signing_vals
,
2310 .flags
= FLAG_ADVANCED
,
2313 .label
= "smb encrypt",
2316 .ptr
= &sDefault
.ismb_encrypt
,
2318 .enum_list
= enum_smb_signing_vals
,
2319 .flags
= FLAG_ADVANCED
,
2322 .label
= "client use spnego",
2324 .p_class
= P_GLOBAL
,
2325 .ptr
= &Globals
.bClientUseSpnego
,
2328 .flags
= FLAG_ADVANCED
,
2331 .label
= "client ldap sasl wrapping",
2333 .p_class
= P_GLOBAL
,
2334 .ptr
= &Globals
.client_ldap_sasl_wrapping
,
2336 .enum_list
= enum_ldap_sasl_wrapping
,
2337 .flags
= FLAG_ADVANCED
,
2340 .label
= "enable asu support",
2342 .p_class
= P_GLOBAL
,
2343 .ptr
= &Globals
.bASUSupport
,
2346 .flags
= FLAG_ADVANCED
,
2349 .label
= "svcctl list",
2351 .p_class
= P_GLOBAL
,
2352 .ptr
= &Globals
.szServicesList
,
2355 .flags
= FLAG_ADVANCED
,
2358 {N_("Tuning Options"), P_SEP
, P_SEPARATOR
},
2361 .label
= "block size",
2364 .ptr
= &sDefault
.iBlock_size
,
2367 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2370 .label
= "deadtime",
2372 .p_class
= P_GLOBAL
,
2373 .ptr
= &Globals
.deadtime
,
2376 .flags
= FLAG_ADVANCED
,
2379 .label
= "getwd cache",
2381 .p_class
= P_GLOBAL
,
2382 .ptr
= &Globals
.getwd_cache
,
2385 .flags
= FLAG_ADVANCED
,
2388 .label
= "keepalive",
2390 .p_class
= P_GLOBAL
,
2391 .ptr
= &Globals
.iKeepalive
,
2394 .flags
= FLAG_ADVANCED
,
2397 .label
= "change notify",
2400 .ptr
= &sDefault
.bChangeNotify
,
2403 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2406 .label
= "directory name cache size",
2409 .ptr
= &sDefault
.iDirectoryNameCacheSize
,
2412 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2415 .label
= "kernel change notify",
2418 .ptr
= &sDefault
.bKernelChangeNotify
,
2421 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2424 .label
= "lpq cache time",
2426 .p_class
= P_GLOBAL
,
2427 .ptr
= &Globals
.lpqcachetime
,
2430 .flags
= FLAG_ADVANCED
,
2433 .label
= "max smbd processes",
2435 .p_class
= P_GLOBAL
,
2436 .ptr
= &Globals
.iMaxSmbdProcesses
,
2439 .flags
= FLAG_ADVANCED
,
2442 .label
= "max connections",
2445 .ptr
= &sDefault
.iMaxConnections
,
2448 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2451 .label
= "paranoid server security",
2453 .p_class
= P_GLOBAL
,
2454 .ptr
= &Globals
.paranoid_server_security
,
2457 .flags
= FLAG_ADVANCED
,
2460 .label
= "max disk size",
2462 .p_class
= P_GLOBAL
,
2463 .ptr
= &Globals
.maxdisksize
,
2466 .flags
= FLAG_ADVANCED
,
2469 .label
= "max open files",
2471 .p_class
= P_GLOBAL
,
2472 .ptr
= &Globals
.max_open_files
,
2475 .flags
= FLAG_ADVANCED
,
2478 .label
= "min print space",
2481 .ptr
= &sDefault
.iMinPrintSpace
,
2484 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2487 .label
= "socket options",
2489 .p_class
= P_GLOBAL
,
2490 .ptr
= &Globals
.szSocketOptions
,
2493 .flags
= FLAG_ADVANCED
,
2496 .label
= "strict allocate",
2499 .ptr
= &sDefault
.bStrictAllocate
,
2502 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2505 .label
= "strict sync",
2508 .ptr
= &sDefault
.bStrictSync
,
2511 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2514 .label
= "sync always",
2517 .ptr
= &sDefault
.bSyncAlways
,
2520 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2523 .label
= "use mmap",
2525 .p_class
= P_GLOBAL
,
2526 .ptr
= &Globals
.bUseMmap
,
2529 .flags
= FLAG_ADVANCED
,
2532 .label
= "use sendfile",
2535 .ptr
= &sDefault
.bUseSendfile
,
2538 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2541 .label
= "hostname lookups",
2543 .p_class
= P_GLOBAL
,
2544 .ptr
= &Globals
.bHostnameLookups
,
2547 .flags
= FLAG_ADVANCED
,
2550 .label
= "write cache size",
2553 .ptr
= &sDefault
.iWriteCacheSize
,
2556 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2559 .label
= "name cache timeout",
2561 .p_class
= P_GLOBAL
,
2562 .ptr
= &Globals
.name_cache_timeout
,
2565 .flags
= FLAG_ADVANCED
,
2568 .label
= "ctdbd socket",
2570 .p_class
= P_GLOBAL
,
2571 .ptr
= &Globals
.ctdbdSocket
,
2574 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2577 .label
= "cluster addresses",
2579 .p_class
= P_GLOBAL
,
2580 .ptr
= &Globals
.szClusterAddresses
,
2583 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2586 .label
= "clustering",
2588 .p_class
= P_GLOBAL
,
2589 .ptr
= &Globals
.clustering
,
2592 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2595 .label
= "ctdb timeout",
2597 .p_class
= P_GLOBAL
,
2598 .ptr
= &Globals
.ctdb_timeout
,
2601 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2604 .label
= "ctdb locktime warn threshold",
2606 .p_class
= P_GLOBAL
,
2607 .ptr
= &Globals
.ctdb_locktime_warn_threshold
,
2610 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2613 .label
= "smb2 max read",
2615 .p_class
= P_GLOBAL
,
2616 .ptr
= &Globals
.ismb2_max_read
,
2619 .flags
= FLAG_ADVANCED
,
2622 .label
= "smb2 max write",
2624 .p_class
= P_GLOBAL
,
2625 .ptr
= &Globals
.ismb2_max_write
,
2628 .flags
= FLAG_ADVANCED
,
2631 .label
= "smb2 max trans",
2633 .p_class
= P_GLOBAL
,
2634 .ptr
= &Globals
.ismb2_max_trans
,
2637 .flags
= FLAG_ADVANCED
,
2640 .label
= "smb2 max credits",
2642 .p_class
= P_GLOBAL
,
2643 .ptr
= &Globals
.ismb2_max_credits
,
2646 .flags
= FLAG_ADVANCED
,
2649 {N_("Printing Options"), P_SEP
, P_SEPARATOR
},
2652 .label
= "max reported print jobs",
2655 .ptr
= &sDefault
.iMaxReportedPrintJobs
,
2658 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2661 .label
= "max print jobs",
2664 .ptr
= &sDefault
.iMaxPrintJobs
,
2667 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2670 .label
= "load printers",
2672 .p_class
= P_GLOBAL
,
2673 .ptr
= &Globals
.bLoadPrinters
,
2676 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2679 .label
= "printcap cache time",
2681 .p_class
= P_GLOBAL
,
2682 .ptr
= &Globals
.PrintcapCacheTime
,
2685 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2688 .label
= "printcap name",
2690 .p_class
= P_GLOBAL
,
2691 .ptr
= &Globals
.szPrintcapname
,
2694 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2697 .label
= "printcap",
2699 .p_class
= P_GLOBAL
,
2700 .ptr
= &Globals
.szPrintcapname
,
2706 .label
= "printable",
2709 .ptr
= &sDefault
.bPrint_ok
,
2712 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2715 .label
= "print ok",
2718 .ptr
= &sDefault
.bPrint_ok
,
2724 .label
= "printing",
2727 .ptr
= &sDefault
.iPrinting
,
2728 .special
= handle_printing
,
2729 .enum_list
= enum_printing
,
2730 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2733 .label
= "cups options",
2736 .ptr
= &sDefault
.szCupsOptions
,
2739 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2742 .label
= "cups server",
2744 .p_class
= P_GLOBAL
,
2745 .ptr
= &Globals
.szCupsServer
,
2748 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2751 .label
= "cups encrypt",
2753 .p_class
= P_GLOBAL
,
2754 .ptr
= &Globals
.CupsEncrypt
,
2756 .enum_list
= enum_bool_auto
,
2757 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2761 .label
= "cups connection timeout",
2763 .p_class
= P_GLOBAL
,
2764 .ptr
= &Globals
.cups_connection_timeout
,
2767 .flags
= FLAG_ADVANCED
,
2770 .label
= "iprint server",
2772 .p_class
= P_GLOBAL
,
2773 .ptr
= &Globals
.szIPrintServer
,
2776 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2779 .label
= "print command",
2782 .ptr
= &sDefault
.szPrintcommand
,
2785 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2788 .label
= "disable spoolss",
2790 .p_class
= P_GLOBAL
,
2791 .ptr
= &Globals
.bDisableSpoolss
,
2794 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2797 .label
= "enable spoolss",
2799 .p_class
= P_GLOBAL
,
2800 .ptr
= &Globals
.bDisableSpoolss
,
2806 .label
= "lpq command",
2809 .ptr
= &sDefault
.szLpqcommand
,
2812 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2815 .label
= "lprm command",
2818 .ptr
= &sDefault
.szLprmcommand
,
2821 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2824 .label
= "lppause command",
2827 .ptr
= &sDefault
.szLppausecommand
,
2830 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2833 .label
= "lpresume command",
2836 .ptr
= &sDefault
.szLpresumecommand
,
2839 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2842 .label
= "queuepause command",
2845 .ptr
= &sDefault
.szQueuepausecommand
,
2848 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2851 .label
= "queueresume command",
2854 .ptr
= &sDefault
.szQueueresumecommand
,
2857 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2860 .label
= "addport command",
2862 .p_class
= P_GLOBAL
,
2863 .ptr
= &Globals
.szAddPortCommand
,
2866 .flags
= FLAG_ADVANCED
,
2869 .label
= "enumports command",
2871 .p_class
= P_GLOBAL
,
2872 .ptr
= &Globals
.szEnumPortsCommand
,
2875 .flags
= FLAG_ADVANCED
,
2878 .label
= "addprinter command",
2880 .p_class
= P_GLOBAL
,
2881 .ptr
= &Globals
.szAddPrinterCommand
,
2884 .flags
= FLAG_ADVANCED
,
2887 .label
= "deleteprinter command",
2889 .p_class
= P_GLOBAL
,
2890 .ptr
= &Globals
.szDeletePrinterCommand
,
2893 .flags
= FLAG_ADVANCED
,
2896 .label
= "show add printer wizard",
2898 .p_class
= P_GLOBAL
,
2899 .ptr
= &Globals
.bMsAddPrinterWizard
,
2902 .flags
= FLAG_ADVANCED
,
2905 .label
= "os2 driver map",
2907 .p_class
= P_GLOBAL
,
2908 .ptr
= &Globals
.szOs2DriverMap
,
2911 .flags
= FLAG_ADVANCED
,
2915 .label
= "printer name",
2918 .ptr
= &sDefault
.szPrintername
,
2921 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2927 .ptr
= &sDefault
.szPrintername
,
2933 .label
= "use client driver",
2936 .ptr
= &sDefault
.bUseClientDriver
,
2939 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2942 .label
= "default devmode",
2945 .ptr
= &sDefault
.bDefaultDevmode
,
2948 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2951 .label
= "force printername",
2954 .ptr
= &sDefault
.bForcePrintername
,
2957 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2960 .label
= "printjob username",
2963 .ptr
= &sDefault
.szPrintjobUsername
,
2966 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2969 {N_("Filename Handling"), P_SEP
, P_SEPARATOR
},
2972 .label
= "mangling method",
2974 .p_class
= P_GLOBAL
,
2975 .ptr
= &Globals
.szManglingMethod
,
2978 .flags
= FLAG_ADVANCED
,
2981 .label
= "mangle prefix",
2983 .p_class
= P_GLOBAL
,
2984 .ptr
= &Globals
.mangle_prefix
,
2987 .flags
= FLAG_ADVANCED
,
2991 .label
= "default case",
2994 .ptr
= &sDefault
.iDefaultCase
,
2996 .enum_list
= enum_case
,
2997 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
3000 .label
= "case sensitive",
3003 .ptr
= &sDefault
.iCaseSensitive
,
3005 .enum_list
= enum_bool_auto
,
3006 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3009 .label
= "casesignames",
3012 .ptr
= &sDefault
.iCaseSensitive
,
3014 .enum_list
= enum_bool_auto
,
3015 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
| FLAG_HIDE
,
3018 .label
= "preserve case",
3021 .ptr
= &sDefault
.bCasePreserve
,
3024 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3027 .label
= "short preserve case",
3030 .ptr
= &sDefault
.bShortCasePreserve
,
3033 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3036 .label
= "mangling char",
3039 .ptr
= &sDefault
.magic_char
,
3042 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3045 .label
= "hide dot files",
3048 .ptr
= &sDefault
.bHideDotFiles
,
3051 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3054 .label
= "hide special files",
3057 .ptr
= &sDefault
.bHideSpecialFiles
,
3060 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3063 .label
= "hide unreadable",
3066 .ptr
= &sDefault
.bHideUnReadable
,
3069 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3072 .label
= "hide unwriteable files",
3075 .ptr
= &sDefault
.bHideUnWriteableFiles
,
3078 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3081 .label
= "delete veto files",
3084 .ptr
= &sDefault
.bDeleteVetoFiles
,
3087 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3090 .label
= "veto files",
3093 .ptr
= &sDefault
.szVetoFiles
,
3096 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3099 .label
= "hide files",
3102 .ptr
= &sDefault
.szHideFiles
,
3105 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3108 .label
= "veto oplock files",
3111 .ptr
= &sDefault
.szVetoOplockFiles
,
3114 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3117 .label
= "map archive",
3120 .ptr
= &sDefault
.bMap_archive
,
3123 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3126 .label
= "map hidden",
3129 .ptr
= &sDefault
.bMap_hidden
,
3132 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3135 .label
= "map system",
3138 .ptr
= &sDefault
.bMap_system
,
3141 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3144 .label
= "map readonly",
3147 .ptr
= &sDefault
.iMap_readonly
,
3149 .enum_list
= enum_map_readonly
,
3150 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3153 .label
= "mangled names",
3156 .ptr
= &sDefault
.bMangledNames
,
3159 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3162 .label
= "max stat cache size",
3164 .p_class
= P_GLOBAL
,
3165 .ptr
= &Globals
.iMaxStatCacheSize
,
3168 .flags
= FLAG_ADVANCED
,
3171 .label
= "stat cache",
3173 .p_class
= P_GLOBAL
,
3174 .ptr
= &Globals
.bStatCache
,
3177 .flags
= FLAG_ADVANCED
,
3180 .label
= "store dos attributes",
3183 .ptr
= &sDefault
.bStoreDosAttributes
,
3186 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3189 .label
= "dmapi support",
3192 .ptr
= &sDefault
.bDmapiSupport
,
3195 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3199 {N_("Domain Options"), P_SEP
, P_SEPARATOR
},
3202 .label
= "machine password timeout",
3204 .p_class
= P_GLOBAL
,
3205 .ptr
= &Globals
.machine_password_timeout
,
3208 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
3211 {N_("Logon Options"), P_SEP
, P_SEPARATOR
},
3214 .label
= "add user script",
3216 .p_class
= P_GLOBAL
,
3217 .ptr
= &Globals
.szAddUserScript
,
3220 .flags
= FLAG_ADVANCED
,
3223 .label
= "rename user script",
3225 .p_class
= P_GLOBAL
,
3226 .ptr
= &Globals
.szRenameUserScript
,
3229 .flags
= FLAG_ADVANCED
,
3232 .label
= "delete user script",
3234 .p_class
= P_GLOBAL
,
3235 .ptr
= &Globals
.szDelUserScript
,
3238 .flags
= FLAG_ADVANCED
,
3241 .label
= "add group script",
3243 .p_class
= P_GLOBAL
,
3244 .ptr
= &Globals
.szAddGroupScript
,
3247 .flags
= FLAG_ADVANCED
,
3250 .label
= "delete group script",
3252 .p_class
= P_GLOBAL
,
3253 .ptr
= &Globals
.szDelGroupScript
,
3256 .flags
= FLAG_ADVANCED
,
3259 .label
= "add user to group script",
3261 .p_class
= P_GLOBAL
,
3262 .ptr
= &Globals
.szAddUserToGroupScript
,
3265 .flags
= FLAG_ADVANCED
,
3268 .label
= "delete user from group script",
3270 .p_class
= P_GLOBAL
,
3271 .ptr
= &Globals
.szDelUserFromGroupScript
,
3274 .flags
= FLAG_ADVANCED
,
3277 .label
= "set primary group script",
3279 .p_class
= P_GLOBAL
,
3280 .ptr
= &Globals
.szSetPrimaryGroupScript
,
3283 .flags
= FLAG_ADVANCED
,
3286 .label
= "add machine script",
3288 .p_class
= P_GLOBAL
,
3289 .ptr
= &Globals
.szAddMachineScript
,
3292 .flags
= FLAG_ADVANCED
,
3295 .label
= "shutdown script",
3297 .p_class
= P_GLOBAL
,
3298 .ptr
= &Globals
.szShutdownScript
,
3301 .flags
= FLAG_ADVANCED
,
3304 .label
= "abort shutdown script",
3306 .p_class
= P_GLOBAL
,
3307 .ptr
= &Globals
.szAbortShutdownScript
,
3310 .flags
= FLAG_ADVANCED
,
3313 .label
= "username map script",
3315 .p_class
= P_GLOBAL
,
3316 .ptr
= &Globals
.szUsernameMapScript
,
3319 .flags
= FLAG_ADVANCED
,
3322 .label
= "username map cache time",
3324 .p_class
= P_GLOBAL
,
3325 .ptr
= &Globals
.iUsernameMapCacheTime
,
3328 .flags
= FLAG_ADVANCED
,
3331 .label
= "logon script",
3333 .p_class
= P_GLOBAL
,
3334 .ptr
= &Globals
.szLogonScript
,
3337 .flags
= FLAG_ADVANCED
,
3340 .label
= "logon path",
3342 .p_class
= P_GLOBAL
,
3343 .ptr
= &Globals
.szLogonPath
,
3346 .flags
= FLAG_ADVANCED
,
3349 .label
= "logon drive",
3351 .p_class
= P_GLOBAL
,
3352 .ptr
= &Globals
.szLogonDrive
,
3355 .flags
= FLAG_ADVANCED
,
3358 .label
= "logon home",
3360 .p_class
= P_GLOBAL
,
3361 .ptr
= &Globals
.szLogonHome
,
3364 .flags
= FLAG_ADVANCED
,
3367 .label
= "domain logons",
3369 .p_class
= P_GLOBAL
,
3370 .ptr
= &Globals
.bDomainLogons
,
3373 .flags
= FLAG_ADVANCED
,
3377 .label
= "init logon delayed hosts",
3379 .p_class
= P_GLOBAL
,
3380 .ptr
= &Globals
.szInitLogonDelayedHosts
,
3383 .flags
= FLAG_ADVANCED
,
3387 .label
= "init logon delay",
3389 .p_class
= P_GLOBAL
,
3390 .ptr
= &Globals
.InitLogonDelay
,
3393 .flags
= FLAG_ADVANCED
,
3397 {N_("Browse Options"), P_SEP
, P_SEPARATOR
},
3400 .label
= "os level",
3402 .p_class
= P_GLOBAL
,
3403 .ptr
= &Globals
.os_level
,
3406 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3409 .label
= "lm announce",
3411 .p_class
= P_GLOBAL
,
3412 .ptr
= &Globals
.lm_announce
,
3414 .enum_list
= enum_bool_auto
,
3415 .flags
= FLAG_ADVANCED
,
3418 .label
= "lm interval",
3420 .p_class
= P_GLOBAL
,
3421 .ptr
= &Globals
.lm_interval
,
3424 .flags
= FLAG_ADVANCED
,
3427 .label
= "preferred master",
3429 .p_class
= P_GLOBAL
,
3430 .ptr
= &Globals
.iPreferredMaster
,
3432 .enum_list
= enum_bool_auto
,
3433 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3436 .label
= "prefered master",
3438 .p_class
= P_GLOBAL
,
3439 .ptr
= &Globals
.iPreferredMaster
,
3441 .enum_list
= enum_bool_auto
,
3445 .label
= "local master",
3447 .p_class
= P_GLOBAL
,
3448 .ptr
= &Globals
.bLocalMaster
,
3451 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3454 .label
= "domain master",
3456 .p_class
= P_GLOBAL
,
3457 .ptr
= &Globals
.iDomainMaster
,
3459 .enum_list
= enum_bool_auto
,
3460 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3463 .label
= "browse list",
3465 .p_class
= P_GLOBAL
,
3466 .ptr
= &Globals
.bBrowseList
,
3469 .flags
= FLAG_ADVANCED
,
3472 .label
= "browseable",
3475 .ptr
= &sDefault
.bBrowseable
,
3478 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
3481 .label
= "browsable",
3484 .ptr
= &sDefault
.bBrowseable
,
3490 .label
= "access based share enum",
3493 .ptr
= &sDefault
.bAccessBasedShareEnum
,
3496 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
3499 .label
= "enhanced browsing",
3501 .p_class
= P_GLOBAL
,
3502 .ptr
= &Globals
.enhanced_browsing
,
3505 .flags
= FLAG_ADVANCED
,
3508 {N_("WINS Options"), P_SEP
, P_SEPARATOR
},
3511 .label
= "dns proxy",
3513 .p_class
= P_GLOBAL
,
3514 .ptr
= &Globals
.bDNSproxy
,
3517 .flags
= FLAG_ADVANCED
,
3520 .label
= "wins proxy",
3522 .p_class
= P_GLOBAL
,
3523 .ptr
= &Globals
.bWINSproxy
,
3526 .flags
= FLAG_ADVANCED
,
3529 .label
= "wins server",
3531 .p_class
= P_GLOBAL
,
3532 .ptr
= &Globals
.szWINSservers
,
3535 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
3538 .label
= "wins support",
3540 .p_class
= P_GLOBAL
,
3541 .ptr
= &Globals
.bWINSsupport
,
3544 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
3547 .label
= "wins hook",
3549 .p_class
= P_GLOBAL
,
3550 .ptr
= &Globals
.szWINSHook
,
3553 .flags
= FLAG_ADVANCED
,
3556 {N_("Locking Options"), P_SEP
, P_SEPARATOR
},
3559 .label
= "blocking locks",
3562 .ptr
= &sDefault
.bBlockingLocks
,
3565 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3568 .label
= "csc policy",
3571 .ptr
= &sDefault
.iCSCPolicy
,
3573 .enum_list
= enum_csc_policy
,
3574 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3577 .label
= "fake oplocks",
3580 .ptr
= &sDefault
.bFakeOplocks
,
3583 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
3586 .label
= "kernel oplocks",
3588 .p_class
= P_GLOBAL
,
3589 .ptr
= &Globals
.bKernelOplocks
,
3592 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3598 .ptr
= &sDefault
.bLocking
,
3601 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3604 .label
= "lock spin time",
3606 .p_class
= P_GLOBAL
,
3607 .ptr
= &Globals
.iLockSpinTime
,
3610 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3616 .ptr
= &sDefault
.bOpLocks
,
3619 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3622 .label
= "level2 oplocks",
3625 .ptr
= &sDefault
.bLevel2OpLocks
,
3628 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3631 .label
= "oplock break wait time",
3633 .p_class
= P_GLOBAL
,
3634 .ptr
= &Globals
.oplock_break_wait_time
,
3637 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3640 .label
= "oplock contention limit",
3643 .ptr
= &sDefault
.iOplockContentionLimit
,
3646 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3649 .label
= "posix locking",
3652 .ptr
= &sDefault
.bPosixLocking
,
3655 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3658 .label
= "strict locking",
3661 .ptr
= &sDefault
.iStrictLocking
,
3663 .enum_list
= enum_bool_auto
,
3664 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3667 .label
= "share modes",
3670 .ptr
= &sDefault
.bShareModes
,
3673 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DEPRECATED
,
3676 {N_("Ldap Options"), P_SEP
, P_SEPARATOR
},
3679 .label
= "ldap admin dn",
3681 .p_class
= P_GLOBAL
,
3682 .ptr
= &Globals
.szLdapAdminDn
,
3685 .flags
= FLAG_ADVANCED
,
3688 .label
= "ldap delete dn",
3690 .p_class
= P_GLOBAL
,
3691 .ptr
= &Globals
.ldap_delete_dn
,
3694 .flags
= FLAG_ADVANCED
,
3697 .label
= "ldap group suffix",
3699 .p_class
= P_GLOBAL
,
3700 .ptr
= &Globals
.szLdapGroupSuffix
,
3703 .flags
= FLAG_ADVANCED
,
3706 .label
= "ldap idmap suffix",
3708 .p_class
= P_GLOBAL
,
3709 .ptr
= &Globals
.szLdapIdmapSuffix
,
3712 .flags
= FLAG_ADVANCED
,
3715 .label
= "ldap machine suffix",
3717 .p_class
= P_GLOBAL
,
3718 .ptr
= &Globals
.szLdapMachineSuffix
,
3721 .flags
= FLAG_ADVANCED
,
3724 .label
= "ldap passwd sync",
3726 .p_class
= P_GLOBAL
,
3727 .ptr
= &Globals
.ldap_passwd_sync
,
3729 .enum_list
= enum_ldap_passwd_sync
,
3730 .flags
= FLAG_ADVANCED
,
3733 .label
= "ldap password sync",
3735 .p_class
= P_GLOBAL
,
3736 .ptr
= &Globals
.ldap_passwd_sync
,
3738 .enum_list
= enum_ldap_passwd_sync
,
3742 .label
= "ldap replication sleep",
3744 .p_class
= P_GLOBAL
,
3745 .ptr
= &Globals
.ldap_replication_sleep
,
3748 .flags
= FLAG_ADVANCED
,
3751 .label
= "ldap suffix",
3753 .p_class
= P_GLOBAL
,
3754 .ptr
= &Globals
.szLdapSuffix
,
3757 .flags
= FLAG_ADVANCED
,
3760 .label
= "ldap ssl",
3762 .p_class
= P_GLOBAL
,
3763 .ptr
= &Globals
.ldap_ssl
,
3765 .enum_list
= enum_ldap_ssl
,
3766 .flags
= FLAG_ADVANCED
,
3769 .label
= "ldap ssl ads",
3771 .p_class
= P_GLOBAL
,
3772 .ptr
= &Globals
.ldap_ssl_ads
,
3775 .flags
= FLAG_ADVANCED
,
3778 .label
= "ldap deref",
3780 .p_class
= P_GLOBAL
,
3781 .ptr
= &Globals
.ldap_deref
,
3783 .enum_list
= enum_ldap_deref
,
3784 .flags
= FLAG_ADVANCED
,
3787 .label
= "ldap follow referral",
3789 .p_class
= P_GLOBAL
,
3790 .ptr
= &Globals
.ldap_follow_referral
,
3792 .enum_list
= enum_bool_auto
,
3793 .flags
= FLAG_ADVANCED
,
3796 .label
= "ldap timeout",
3798 .p_class
= P_GLOBAL
,
3799 .ptr
= &Globals
.ldap_timeout
,
3802 .flags
= FLAG_ADVANCED
,
3805 .label
= "ldap connection timeout",
3807 .p_class
= P_GLOBAL
,
3808 .ptr
= &Globals
.ldap_connection_timeout
,
3811 .flags
= FLAG_ADVANCED
,
3814 .label
= "ldap page size",
3816 .p_class
= P_GLOBAL
,
3817 .ptr
= &Globals
.ldap_page_size
,
3820 .flags
= FLAG_ADVANCED
,
3823 .label
= "ldap user suffix",
3825 .p_class
= P_GLOBAL
,
3826 .ptr
= &Globals
.szLdapUserSuffix
,
3829 .flags
= FLAG_ADVANCED
,
3832 .label
= "ldap debug level",
3834 .p_class
= P_GLOBAL
,
3835 .ptr
= &Globals
.ldap_debug_level
,
3836 .special
= handle_ldap_debug_level
,
3838 .flags
= FLAG_ADVANCED
,
3841 .label
= "ldap debug threshold",
3843 .p_class
= P_GLOBAL
,
3844 .ptr
= &Globals
.ldap_debug_threshold
,
3847 .flags
= FLAG_ADVANCED
,
3850 {N_("EventLog Options"), P_SEP
, P_SEPARATOR
},
3853 .label
= "eventlog list",
3855 .p_class
= P_GLOBAL
,
3856 .ptr
= &Globals
.szEventLogs
,
3859 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
3862 {N_("Miscellaneous Options"), P_SEP
, P_SEPARATOR
},
3865 .label
= "add share command",
3867 .p_class
= P_GLOBAL
,
3868 .ptr
= &Globals
.szAddShareCommand
,
3871 .flags
= FLAG_ADVANCED
,
3874 .label
= "change share command",
3876 .p_class
= P_GLOBAL
,
3877 .ptr
= &Globals
.szChangeShareCommand
,
3880 .flags
= FLAG_ADVANCED
,
3883 .label
= "delete share command",
3885 .p_class
= P_GLOBAL
,
3886 .ptr
= &Globals
.szDeleteShareCommand
,
3889 .flags
= FLAG_ADVANCED
,
3892 .label
= "config file",
3894 .p_class
= P_GLOBAL
,
3895 .ptr
= &Globals
.szConfigFile
,
3898 .flags
= FLAG_HIDE
|FLAG_META
,
3903 .p_class
= P_GLOBAL
,
3904 .ptr
= &Globals
.szAutoServices
,
3907 .flags
= FLAG_ADVANCED
,
3910 .label
= "auto services",
3912 .p_class
= P_GLOBAL
,
3913 .ptr
= &Globals
.szAutoServices
,
3916 .flags
= FLAG_ADVANCED
,
3919 .label
= "lock directory",
3921 .p_class
= P_GLOBAL
,
3922 .ptr
= &Globals
.szLockDir
,
3925 .flags
= FLAG_ADVANCED
,
3928 .label
= "lock dir",
3930 .p_class
= P_GLOBAL
,
3931 .ptr
= &Globals
.szLockDir
,
3937 .label
= "state directory",
3939 .p_class
= P_GLOBAL
,
3940 .ptr
= &Globals
.szStateDir
,
3943 .flags
= FLAG_ADVANCED
,
3946 .label
= "cache directory",
3948 .p_class
= P_GLOBAL
,
3949 .ptr
= &Globals
.szCacheDir
,
3952 .flags
= FLAG_ADVANCED
,
3955 .label
= "pid directory",
3957 .p_class
= P_GLOBAL
,
3958 .ptr
= &Globals
.szPidDir
,
3961 .flags
= FLAG_ADVANCED
,
3965 .label
= "utmp directory",
3967 .p_class
= P_GLOBAL
,
3968 .ptr
= &Globals
.szUtmpDir
,
3971 .flags
= FLAG_ADVANCED
,
3974 .label
= "wtmp directory",
3976 .p_class
= P_GLOBAL
,
3977 .ptr
= &Globals
.szWtmpDir
,
3980 .flags
= FLAG_ADVANCED
,
3985 .p_class
= P_GLOBAL
,
3986 .ptr
= &Globals
.bUtmp
,
3989 .flags
= FLAG_ADVANCED
,
3993 .label
= "default service",
3995 .p_class
= P_GLOBAL
,
3996 .ptr
= &Globals
.szDefaultService
,
3999 .flags
= FLAG_ADVANCED
,
4004 .p_class
= P_GLOBAL
,
4005 .ptr
= &Globals
.szDefaultService
,
4008 .flags
= FLAG_ADVANCED
,
4011 .label
= "message command",
4013 .p_class
= P_GLOBAL
,
4014 .ptr
= &Globals
.szMsgCommand
,
4017 .flags
= FLAG_ADVANCED
,
4020 .label
= "dfree cache time",
4023 .ptr
= &sDefault
.iDfreeCacheTime
,
4026 .flags
= FLAG_ADVANCED
,
4029 .label
= "dfree command",
4032 .ptr
= &sDefault
.szDfree
,
4035 .flags
= FLAG_ADVANCED
,
4038 .label
= "get quota command",
4040 .p_class
= P_GLOBAL
,
4041 .ptr
= &Globals
.szGetQuota
,
4044 .flags
= FLAG_ADVANCED
,
4047 .label
= "set quota command",
4049 .p_class
= P_GLOBAL
,
4050 .ptr
= &Globals
.szSetQuota
,
4053 .flags
= FLAG_ADVANCED
,
4056 .label
= "remote announce",
4058 .p_class
= P_GLOBAL
,
4059 .ptr
= &Globals
.szRemoteAnnounce
,
4062 .flags
= FLAG_ADVANCED
,
4065 .label
= "remote browse sync",
4067 .p_class
= P_GLOBAL
,
4068 .ptr
= &Globals
.szRemoteBrowseSync
,
4071 .flags
= FLAG_ADVANCED
,
4074 .label
= "socket address",
4076 .p_class
= P_GLOBAL
,
4077 .ptr
= &Globals
.szSocketAddress
,
4080 .flags
= FLAG_ADVANCED
,
4083 .label
= "nmbd bind explicit broadcast",
4085 .p_class
= P_GLOBAL
,
4086 .ptr
= &Globals
.bNmbdBindExplicitBroadcast
,
4089 .flags
= FLAG_ADVANCED
,
4092 .label
= "homedir map",
4094 .p_class
= P_GLOBAL
,
4095 .ptr
= &Globals
.szNISHomeMapName
,
4098 .flags
= FLAG_ADVANCED
,
4101 .label
= "afs username map",
4103 .p_class
= P_GLOBAL
,
4104 .ptr
= &Globals
.szAfsUsernameMap
,
4107 .flags
= FLAG_ADVANCED
,
4110 .label
= "afs token lifetime",
4112 .p_class
= P_GLOBAL
,
4113 .ptr
= &Globals
.iAfsTokenLifetime
,
4116 .flags
= FLAG_ADVANCED
,
4119 .label
= "log nt token command",
4121 .p_class
= P_GLOBAL
,
4122 .ptr
= &Globals
.szLogNtTokenCommand
,
4125 .flags
= FLAG_ADVANCED
,
4128 .label
= "time offset",
4130 .p_class
= P_GLOBAL
,
4131 .ptr
= &extra_time_offset
,
4134 .flags
= FLAG_ADVANCED
,
4137 .label
= "NIS homedir",
4139 .p_class
= P_GLOBAL
,
4140 .ptr
= &Globals
.bNISHomeMap
,
4143 .flags
= FLAG_ADVANCED
,
4149 .ptr
= &sDefault
.valid
,
4158 .ptr
= &sDefault
.szCopy
,
4159 .special
= handle_copy
,
4167 .ptr
= &sDefault
.szInclude
,
4168 .special
= handle_include
,
4170 .flags
= FLAG_HIDE
|FLAG_META
,
4176 .ptr
= &sDefault
.szPreExec
,
4179 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4185 .ptr
= &sDefault
.szPreExec
,
4188 .flags
= FLAG_ADVANCED
,
4191 .label
= "preexec close",
4194 .ptr
= &sDefault
.bPreexecClose
,
4197 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4200 .label
= "postexec",
4203 .ptr
= &sDefault
.szPostExec
,
4206 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4209 .label
= "root preexec",
4212 .ptr
= &sDefault
.szRootPreExec
,
4215 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4218 .label
= "root preexec close",
4221 .ptr
= &sDefault
.bRootpreexecClose
,
4224 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4227 .label
= "root postexec",
4230 .ptr
= &sDefault
.szRootPostExec
,
4233 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4236 .label
= "available",
4239 .ptr
= &sDefault
.bAvailable
,
4242 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4245 .label
= "registry shares",
4247 .p_class
= P_GLOBAL
,
4248 .ptr
= &Globals
.bRegistryShares
,
4251 .flags
= FLAG_ADVANCED
,
4254 .label
= "usershare allow guests",
4256 .p_class
= P_GLOBAL
,
4257 .ptr
= &Globals
.bUsershareAllowGuests
,
4260 .flags
= FLAG_ADVANCED
,
4263 .label
= "usershare max shares",
4265 .p_class
= P_GLOBAL
,
4266 .ptr
= &Globals
.iUsershareMaxShares
,
4269 .flags
= FLAG_ADVANCED
,
4272 .label
= "usershare owner only",
4274 .p_class
= P_GLOBAL
,
4275 .ptr
= &Globals
.bUsershareOwnerOnly
,
4278 .flags
= FLAG_ADVANCED
,
4281 .label
= "usershare path",
4283 .p_class
= P_GLOBAL
,
4284 .ptr
= &Globals
.szUsersharePath
,
4287 .flags
= FLAG_ADVANCED
,
4290 .label
= "usershare prefix allow list",
4292 .p_class
= P_GLOBAL
,
4293 .ptr
= &Globals
.szUsersharePrefixAllowList
,
4296 .flags
= FLAG_ADVANCED
,
4299 .label
= "usershare prefix deny list",
4301 .p_class
= P_GLOBAL
,
4302 .ptr
= &Globals
.szUsersharePrefixDenyList
,
4305 .flags
= FLAG_ADVANCED
,
4308 .label
= "usershare template share",
4310 .p_class
= P_GLOBAL
,
4311 .ptr
= &Globals
.szUsershareTemplateShare
,
4314 .flags
= FLAG_ADVANCED
,
4320 .ptr
= &sDefault
.volume
,
4323 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4329 .ptr
= &sDefault
.fstype
,
4332 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4335 .label
= "set directory",
4338 .ptr
= &sDefault
.bNo_set_dir
,
4341 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4344 .label
= "wide links",
4347 .ptr
= &sDefault
.bWidelinks
,
4350 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4353 .label
= "follow symlinks",
4356 .ptr
= &sDefault
.bSymlinks
,
4359 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4362 .label
= "dont descend",
4365 .ptr
= &sDefault
.szDontdescend
,
4368 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4371 .label
= "magic script",
4374 .ptr
= &sDefault
.szMagicScript
,
4377 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4380 .label
= "magic output",
4383 .ptr
= &sDefault
.szMagicOutput
,
4386 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4389 .label
= "delete readonly",
4392 .ptr
= &sDefault
.bDeleteReadonly
,
4395 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4398 .label
= "dos filemode",
4401 .ptr
= &sDefault
.bDosFilemode
,
4404 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4407 .label
= "dos filetimes",
4410 .ptr
= &sDefault
.bDosFiletimes
,
4413 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4416 .label
= "dos filetime resolution",
4419 .ptr
= &sDefault
.bDosFiletimeResolution
,
4422 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4425 .label
= "fake directory create times",
4428 .ptr
= &sDefault
.bFakeDirCreateTimes
,
4431 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
4434 .label
= "async smb echo handler",
4436 .p_class
= P_GLOBAL
,
4437 .ptr
= &Globals
.bAsyncSMBEchoHandler
,
4440 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
4443 .label
= "multicast dns register",
4445 .p_class
= P_GLOBAL
,
4446 .ptr
= &Globals
.bMulticastDnsRegister
,
4449 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
4452 .label
= "panic action",
4454 .p_class
= P_GLOBAL
,
4455 .ptr
= &Globals
.szPanicAction
,
4458 .flags
= FLAG_ADVANCED
,
4461 .label
= "perfcount module",
4463 .p_class
= P_GLOBAL
,
4464 .ptr
= &Globals
.szSMBPerfcountModule
,
4467 .flags
= FLAG_ADVANCED
,
4470 {N_("VFS module options"), P_SEP
, P_SEPARATOR
},
4473 .label
= "vfs objects",
4476 .ptr
= &sDefault
.szVfsObjects
,
4479 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4482 .label
= "vfs object",
4485 .ptr
= &sDefault
.szVfsObjects
,
4492 {N_("MSDFS options"), P_SEP
, P_SEPARATOR
},
4495 .label
= "msdfs root",
4498 .ptr
= &sDefault
.bMSDfsRoot
,
4501 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4504 .label
= "msdfs proxy",
4507 .ptr
= &sDefault
.szMSDfsProxy
,
4510 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4513 .label
= "host msdfs",
4515 .p_class
= P_GLOBAL
,
4516 .ptr
= &Globals
.bHostMSDfs
,
4519 .flags
= FLAG_ADVANCED
,
4522 {N_("Winbind options"), P_SEP
, P_SEPARATOR
},
4525 .label
= "passdb expand explicit",
4527 .p_class
= P_GLOBAL
,
4528 .ptr
= &Globals
.bPassdbExpandExplicit
,
4531 .flags
= FLAG_ADVANCED
,
4534 .label
= "idmap backend",
4536 .p_class
= P_GLOBAL
,
4537 .ptr
= &Globals
.szIdmapBackend
,
4540 .flags
= FLAG_ADVANCED
,
4543 .label
= "idmap read only",
4545 .p_class
= P_GLOBAL
,
4546 .ptr
= &Globals
.bIdmapReadOnly
,
4549 .flags
= FLAG_ADVANCED
,
4552 .label
= "idmap cache time",
4554 .p_class
= P_GLOBAL
,
4555 .ptr
= &Globals
.iIdmapCacheTime
,
4558 .flags
= FLAG_ADVANCED
,
4561 .label
= "idmap negative cache time",
4563 .p_class
= P_GLOBAL
,
4564 .ptr
= &Globals
.iIdmapNegativeCacheTime
,
4567 .flags
= FLAG_ADVANCED
,
4570 .label
= "idmap uid",
4572 .p_class
= P_GLOBAL
,
4573 .ptr
= &Globals
.szIdmapUID
,
4574 .special
= handle_idmap_uid
,
4576 .flags
= FLAG_ADVANCED
,
4579 .label
= "winbind uid",
4581 .p_class
= P_GLOBAL
,
4582 .ptr
= &Globals
.szIdmapUID
,
4583 .special
= handle_idmap_uid
,
4588 .label
= "idmap gid",
4590 .p_class
= P_GLOBAL
,
4591 .ptr
= &Globals
.szIdmapGID
,
4592 .special
= handle_idmap_gid
,
4594 .flags
= FLAG_ADVANCED
,
4597 .label
= "winbind gid",
4599 .p_class
= P_GLOBAL
,
4600 .ptr
= &Globals
.szIdmapGID
,
4601 .special
= handle_idmap_gid
,
4606 .label
= "template homedir",
4608 .p_class
= P_GLOBAL
,
4609 .ptr
= &Globals
.szTemplateHomedir
,
4612 .flags
= FLAG_ADVANCED
,
4615 .label
= "template shell",
4617 .p_class
= P_GLOBAL
,
4618 .ptr
= &Globals
.szTemplateShell
,
4621 .flags
= FLAG_ADVANCED
,
4624 .label
= "winbind separator",
4626 .p_class
= P_GLOBAL
,
4627 .ptr
= &Globals
.szWinbindSeparator
,
4630 .flags
= FLAG_ADVANCED
,
4633 .label
= "winbind cache time",
4635 .p_class
= P_GLOBAL
,
4636 .ptr
= &Globals
.winbind_cache_time
,
4639 .flags
= FLAG_ADVANCED
,
4642 .label
= "winbind reconnect delay",
4644 .p_class
= P_GLOBAL
,
4645 .ptr
= &Globals
.winbind_reconnect_delay
,
4648 .flags
= FLAG_ADVANCED
,
4651 .label
= "winbind max clients",
4653 .p_class
= P_GLOBAL
,
4654 .ptr
= &Globals
.winbind_max_clients
,
4657 .flags
= FLAG_ADVANCED
,
4660 .label
= "winbind enum users",
4662 .p_class
= P_GLOBAL
,
4663 .ptr
= &Globals
.bWinbindEnumUsers
,
4666 .flags
= FLAG_ADVANCED
,
4669 .label
= "winbind enum groups",
4671 .p_class
= P_GLOBAL
,
4672 .ptr
= &Globals
.bWinbindEnumGroups
,
4675 .flags
= FLAG_ADVANCED
,
4678 .label
= "winbind use default domain",
4680 .p_class
= P_GLOBAL
,
4681 .ptr
= &Globals
.bWinbindUseDefaultDomain
,
4684 .flags
= FLAG_ADVANCED
,
4687 .label
= "winbind trusted domains only",
4689 .p_class
= P_GLOBAL
,
4690 .ptr
= &Globals
.bWinbindTrustedDomainsOnly
,
4693 .flags
= FLAG_ADVANCED
,
4696 .label
= "winbind nested groups",
4698 .p_class
= P_GLOBAL
,
4699 .ptr
= &Globals
.bWinbindNestedGroups
,
4702 .flags
= FLAG_ADVANCED
,
4705 .label
= "winbind expand groups",
4707 .p_class
= P_GLOBAL
,
4708 .ptr
= &Globals
.winbind_expand_groups
,
4711 .flags
= FLAG_ADVANCED
,
4714 .label
= "winbind nss info",
4716 .p_class
= P_GLOBAL
,
4717 .ptr
= &Globals
.szWinbindNssInfo
,
4720 .flags
= FLAG_ADVANCED
,
4723 .label
= "winbind refresh tickets",
4725 .p_class
= P_GLOBAL
,
4726 .ptr
= &Globals
.bWinbindRefreshTickets
,
4729 .flags
= FLAG_ADVANCED
,
4732 .label
= "winbind offline logon",
4734 .p_class
= P_GLOBAL
,
4735 .ptr
= &Globals
.bWinbindOfflineLogon
,
4738 .flags
= FLAG_ADVANCED
,
4741 .label
= "winbind normalize names",
4743 .p_class
= P_GLOBAL
,
4744 .ptr
= &Globals
.bWinbindNormalizeNames
,
4747 .flags
= FLAG_ADVANCED
,
4750 .label
= "winbind rpc only",
4752 .p_class
= P_GLOBAL
,
4753 .ptr
= &Globals
.bWinbindRpcOnly
,
4756 .flags
= FLAG_ADVANCED
,
4759 .label
= "create krb5 conf",
4761 .p_class
= P_GLOBAL
,
4762 .ptr
= &Globals
.bCreateKrb5Conf
,
4765 .flags
= FLAG_ADVANCED
,
4768 .label
= "ncalrpc dir",
4770 .p_class
= P_GLOBAL
,
4771 .ptr
= &Globals
.ncalrpc_dir
,
4774 .flags
= FLAG_ADVANCED
,
4777 {NULL
, P_BOOL
, P_NONE
, NULL
, NULL
, NULL
, 0}
4780 /***************************************************************************
4781 Initialise the sDefault parameter structure for the printer values.
4782 ***************************************************************************/
4784 static void init_printer_values(struct service
*pService
)
4786 /* choose defaults depending on the type of printing */
4787 switch (pService
->iPrinting
) {
4792 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4793 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4794 string_set(&pService
->szPrintcommand
, "lpr -r -P'%p' %s");
4799 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4800 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4801 string_set(&pService
->szPrintcommand
, "lpr -r -P'%p' %s");
4802 string_set(&pService
->szQueuepausecommand
, "lpc stop '%p'");
4803 string_set(&pService
->szQueueresumecommand
, "lpc start '%p'");
4804 string_set(&pService
->szLppausecommand
, "lpc hold '%p' %j");
4805 string_set(&pService
->szLpresumecommand
, "lpc release '%p' %j");
4811 /* set the lpq command to contain the destination printer
4812 name only. This is used by cups_queue_get() */
4813 string_set(&pService
->szLpqcommand
, "%p");
4814 string_set(&pService
->szLprmcommand
, "");
4815 string_set(&pService
->szPrintcommand
, "");
4816 string_set(&pService
->szLppausecommand
, "");
4817 string_set(&pService
->szLpresumecommand
, "");
4818 string_set(&pService
->szQueuepausecommand
, "");
4819 string_set(&pService
->szQueueresumecommand
, "");
4821 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4822 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4823 string_set(&pService
->szPrintcommand
, "lpr -P'%p' %s; rm %s");
4824 string_set(&pService
->szLppausecommand
, "lp -i '%p-%j' -H hold");
4825 string_set(&pService
->szLpresumecommand
, "lp -i '%p-%j' -H resume");
4826 string_set(&pService
->szQueuepausecommand
, "disable '%p'");
4827 string_set(&pService
->szQueueresumecommand
, "enable '%p'");
4828 #endif /* HAVE_CUPS */
4833 string_set(&pService
->szLpqcommand
, "lpstat -o%p");
4834 string_set(&pService
->szLprmcommand
, "cancel %p-%j");
4835 string_set(&pService
->szPrintcommand
, "lp -c -d%p %s; rm %s");
4836 string_set(&pService
->szQueuepausecommand
, "disable %p");
4837 string_set(&pService
->szQueueresumecommand
, "enable %p");
4839 string_set(&pService
->szLppausecommand
, "lp -i %p-%j -H hold");
4840 string_set(&pService
->szLpresumecommand
, "lp -i %p-%j -H resume");
4845 string_set(&pService
->szLpqcommand
, "lpq -P%p");
4846 string_set(&pService
->szLprmcommand
, "lprm -P%p %j");
4847 string_set(&pService
->szPrintcommand
, "lp -r -P%p %s");
4853 string_set(&pService
->szPrintcommand
, "vlp print %p %s");
4854 string_set(&pService
->szLpqcommand
, "vlp lpq %p");
4855 string_set(&pService
->szLprmcommand
, "vlp lprm %p %j");
4856 string_set(&pService
->szLppausecommand
, "vlp lppause %p %j");
4857 string_set(&pService
->szLpresumecommand
, "vlp lpresume %p %j");
4858 string_set(&pService
->szQueuepausecommand
, "vlp queuepause %p");
4859 string_set(&pService
->szQueueresumecommand
, "vlp queueresume %p");
4861 #endif /* DEVELOPER */
4866 * Function to return the default value for the maximum number of open
4867 * file descriptors permitted. This function tries to consult the
4868 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4869 * the smaller of those.
4871 static int max_open_files(void)
4873 int sysctl_max
= MAX_OPEN_FILES
;
4874 int rlimit_max
= MAX_OPEN_FILES
;
4876 #ifdef HAVE_SYSCTLBYNAME
4878 size_t size
= sizeof(sysctl_max
);
4879 sysctlbyname("kern.maxfilesperproc", &sysctl_max
, &size
, NULL
,
4884 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4890 if (getrlimit(RLIMIT_NOFILE
, &rl
) == 0)
4891 rlimit_max
= rl
.rlim_cur
;
4893 #if defined(RLIM_INFINITY)
4894 if(rl
.rlim_cur
== RLIM_INFINITY
)
4895 rlimit_max
= MAX_OPEN_FILES
;
4900 if (sysctl_max
< MIN_OPEN_FILES_WINDOWS
) {
4901 DEBUG(2,("max_open_files: sysctl_max (%d) below "
4902 "minimum Windows limit (%d)\n",
4904 MIN_OPEN_FILES_WINDOWS
));
4905 sysctl_max
= MIN_OPEN_FILES_WINDOWS
;
4908 if (rlimit_max
< MIN_OPEN_FILES_WINDOWS
) {
4909 DEBUG(2,("rlimit_max: rlimit_max (%d) below "
4910 "minimum Windows limit (%d)\n",
4912 MIN_OPEN_FILES_WINDOWS
));
4913 rlimit_max
= MIN_OPEN_FILES_WINDOWS
;
4916 return MIN(sysctl_max
, rlimit_max
);
4920 * Common part of freeing allocated data for one parameter.
4922 static void free_one_parameter_common(void *parm_ptr
,
4923 struct parm_struct parm
)
4925 if ((parm
.type
== P_STRING
) ||
4926 (parm
.type
== P_USTRING
))
4928 string_free((char**)parm_ptr
);
4929 } else if (parm
.type
== P_LIST
) {
4930 TALLOC_FREE(*((char***)parm_ptr
));
4935 * Free the allocated data for one parameter for a share
4936 * given as a service struct.
4938 static void free_one_parameter(struct service
*service
,
4939 struct parm_struct parm
)
4943 if (parm
.p_class
!= P_LOCAL
) {
4947 parm_ptr
= lp_local_ptr(service
, parm
.ptr
);
4949 free_one_parameter_common(parm_ptr
, parm
);
4953 * Free the allocated parameter data of a share given
4954 * as a service struct.
4956 static void free_parameters(struct service
*service
)
4960 for (i
=0; parm_table
[i
].label
; i
++) {
4961 free_one_parameter(service
, parm_table
[i
]);
4966 * Free the allocated data for one parameter for a given share
4967 * specified by an snum.
4969 static void free_one_parameter_by_snum(int snum
, struct parm_struct parm
)
4973 if (parm
.ptr
== NULL
) {
4978 parm_ptr
= parm
.ptr
;
4979 } else if (parm
.p_class
!= P_LOCAL
) {
4982 parm_ptr
= lp_local_ptr_by_snum(snum
, parm
.ptr
);
4985 free_one_parameter_common(parm_ptr
, parm
);
4989 * Free the allocated parameter data for a share specified
4992 static void free_parameters_by_snum(int snum
)
4996 for (i
=0; parm_table
[i
].label
; i
++) {
4997 free_one_parameter_by_snum(snum
, parm_table
[i
]);
5002 * Free the allocated global parameters.
5004 static void free_global_parameters(void)
5006 free_parameters_by_snum(GLOBAL_SECTION_SNUM
);
5009 static int map_parameter(const char *pszParmName
);
5011 struct lp_stored_option
{
5012 struct lp_stored_option
*prev
, *next
;
5017 static struct lp_stored_option
*stored_options
;
5020 save options set by lp_set_cmdline() into a list. This list is
5021 re-applied when we do a globals reset, so that cmdline set options
5022 are sticky across reloads of smb.conf
5024 static bool store_lp_set_cmdline(const char *pszParmName
, const char *pszParmValue
)
5026 struct lp_stored_option
*entry
, *entry_next
;
5027 for (entry
= stored_options
; entry
!= NULL
; entry
= entry_next
) {
5028 entry_next
= entry
->next
;
5029 if (strcmp(pszParmName
, entry
->label
) == 0) {
5030 DLIST_REMOVE(stored_options
, entry
);
5036 entry
= talloc(NULL
, struct lp_stored_option
);
5041 entry
->label
= talloc_strdup(entry
, pszParmName
);
5042 if (!entry
->label
) {
5047 entry
->value
= talloc_strdup(entry
, pszParmValue
);
5048 if (!entry
->value
) {
5053 DLIST_ADD_END(stored_options
, entry
, struct lp_stored_option
);
5058 static bool apply_lp_set_cmdline(void)
5060 struct lp_stored_option
*entry
= NULL
;
5061 for (entry
= stored_options
; entry
!= NULL
; entry
= entry
->next
) {
5062 if (!lp_set_cmdline_helper(entry
->label
, entry
->value
, false)) {
5063 DEBUG(0, ("Failed to re-apply cmdline parameter %s = %s\n",
5064 entry
->label
, entry
->value
));
5071 /***************************************************************************
5072 Initialise the global parameter structure.
5073 ***************************************************************************/
5075 static void init_globals(bool reinit_globals
)
5077 static bool done_init
= False
;
5081 /* If requested to initialize only once and we've already done it... */
5082 if (!reinit_globals
&& done_init
) {
5083 /* ... then we have nothing more to do */
5088 /* The logfile can be set before this is invoked. Free it if so. */
5089 if (Globals
.szLogFile
!= NULL
) {
5090 string_free(&Globals
.szLogFile
);
5091 Globals
.szLogFile
= NULL
;
5095 free_global_parameters();
5098 /* This memset and the free_global_parameters() above will
5099 * wipe out smb.conf options set with lp_set_cmdline(). The
5100 * apply_lp_set_cmdline() call puts these values back in the
5101 * table once the defaults are set */
5102 memset((void *)&Globals
, '\0', sizeof(Globals
));
5104 for (i
= 0; parm_table
[i
].label
; i
++) {
5105 if ((parm_table
[i
].type
== P_STRING
||
5106 parm_table
[i
].type
== P_USTRING
) &&
5109 string_set((char **)parm_table
[i
].ptr
, "");
5113 string_set(&sDefault
.fstype
, FSTYPE_STRING
);
5114 string_set(&sDefault
.szPrintjobUsername
, "%U");
5116 init_printer_values(&sDefault
);
5119 DEBUG(3, ("Initialising global parameters\n"));
5121 string_set(&Globals
.szSMBPasswdFile
, get_dyn_SMB_PASSWD_FILE());
5122 string_set(&Globals
.szPrivateDir
, get_dyn_PRIVATE_DIR());
5124 /* use the new 'hash2' method by default, with a prefix of 1 */
5125 string_set(&Globals
.szManglingMethod
, "hash2");
5126 Globals
.mangle_prefix
= 1;
5128 string_set(&Globals
.szGuestaccount
, GUEST_ACCOUNT
);
5130 /* using UTF8 by default allows us to support all chars */
5131 string_set(&Globals
.unix_charset
, DEFAULT_UNIX_CHARSET
);
5133 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
5134 /* If the system supports nl_langinfo(), try to grab the value
5135 from the user's locale */
5136 string_set(&Globals
.display_charset
, "LOCALE");
5138 string_set(&Globals
.display_charset
, DEFAULT_DISPLAY_CHARSET
);
5141 /* Use codepage 850 as a default for the dos character set */
5142 string_set(&Globals
.dos_charset
, DEFAULT_DOS_CHARSET
);
5145 * Allow the default PASSWD_CHAT to be overridden in local.h.
5147 string_set(&Globals
.szPasswdChat
, DEFAULT_PASSWD_CHAT
);
5149 set_global_myname(myhostname());
5150 string_set(&Globals
.szNetbiosName
,global_myname());
5152 set_global_myworkgroup(WORKGROUP
);
5153 string_set(&Globals
.szWorkgroup
, lp_workgroup());
5155 string_set(&Globals
.szPasswdProgram
, "");
5156 string_set(&Globals
.szLockDir
, get_dyn_LOCKDIR());
5157 string_set(&Globals
.szStateDir
, get_dyn_STATEDIR());
5158 string_set(&Globals
.szCacheDir
, get_dyn_CACHEDIR());
5159 string_set(&Globals
.szPidDir
, get_dyn_PIDDIR());
5160 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
5162 * By default support explicit binding to broadcast
5165 Globals
.bNmbdBindExplicitBroadcast
= true;
5167 if (asprintf(&s
, "Samba %s", samba_version_string()) < 0) {
5168 smb_panic("init_globals: ENOMEM");
5170 string_set(&Globals
.szServerString
, s
);
5172 if (asprintf(&s
, "%d.%d", DEFAULT_MAJOR_VERSION
,
5173 DEFAULT_MINOR_VERSION
) < 0) {
5174 smb_panic("init_globals: ENOMEM");
5176 string_set(&Globals
.szAnnounceVersion
, s
);
5179 string_set(&Globals
.szPanicAction
, "/bin/sleep 999999999");
5182 string_set(&Globals
.szSocketOptions
, DEFAULT_SOCKET_OPTIONS
);
5184 string_set(&Globals
.szLogonDrive
, "");
5185 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
5186 string_set(&Globals
.szLogonHome
, "\\\\%N\\%U");
5187 string_set(&Globals
.szLogonPath
, "\\\\%N\\%U\\profile");
5189 string_set(&Globals
.szNameResolveOrder
, "lmhosts wins host bcast");
5190 string_set(&Globals
.szPasswordServer
, "*");
5192 Globals
.AlgorithmicRidBase
= BASE_RID
;
5194 Globals
.bLoadPrinters
= True
;
5195 Globals
.PrintcapCacheTime
= 750; /* 12.5 minutes */
5197 Globals
.ConfigBackend
= config_backend
;
5199 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
5200 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
5201 Globals
.max_xmit
= 0x4104;
5202 Globals
.max_mux
= 50; /* This is *needed* for profile support. */
5203 Globals
.lpqcachetime
= 30; /* changed to handle large print servers better -- jerry */
5204 Globals
.bDisableSpoolss
= False
;
5205 Globals
.iMaxSmbdProcesses
= 0;/* no limit specified */
5206 Globals
.pwordlevel
= 0;
5207 Globals
.unamelevel
= 0;
5208 Globals
.deadtime
= 0;
5209 Globals
.getwd_cache
= true;
5210 Globals
.bLargeReadwrite
= True
;
5211 Globals
.max_log_size
= 5000;
5212 Globals
.max_open_files
= max_open_files();
5213 Globals
.open_files_db_hash_size
= SMB_OPEN_DATABASE_TDB_HASH_SIZE
;
5214 Globals
.maxprotocol
= PROTOCOL_NT1
;
5215 Globals
.minprotocol
= PROTOCOL_CORE
;
5216 Globals
.security
= SEC_USER
;
5217 Globals
.paranoid_server_security
= True
;
5218 Globals
.bEncryptPasswords
= True
;
5219 Globals
.bUpdateEncrypt
= False
;
5220 Globals
.clientSchannel
= Auto
;
5221 Globals
.serverSchannel
= Auto
;
5222 Globals
.bReadRaw
= True
;
5223 Globals
.bWriteRaw
= True
;
5224 Globals
.bNullPasswords
= False
;
5225 Globals
.bObeyPamRestrictions
= False
;
5227 Globals
.bSyslogOnly
= False
;
5228 Globals
.bTimestampLogs
= True
;
5229 string_set(&Globals
.szLogLevel
, "0");
5230 Globals
.bDebugPrefixTimestamp
= False
;
5231 Globals
.bDebugHiresTimestamp
= true;
5232 Globals
.bDebugPid
= False
;
5233 Globals
.bDebugUid
= False
;
5234 Globals
.bDebugClass
= False
;
5235 Globals
.bEnableCoreFiles
= True
;
5236 Globals
.max_ttl
= 60 * 60 * 24 * 3; /* 3 days default. */
5237 Globals
.max_wins_ttl
= 60 * 60 * 24 * 6; /* 6 days default. */
5238 Globals
.min_wins_ttl
= 60 * 60 * 6; /* 6 hours default. */
5239 Globals
.machine_password_timeout
= 60 * 60 * 24 * 7; /* 7 days default. */
5240 Globals
.lm_announce
= 2; /* = Auto: send only if LM clients found */
5241 Globals
.lm_interval
= 60;
5242 Globals
.announce_as
= ANNOUNCE_AS_NT_SERVER
;
5243 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
5244 Globals
.bNISHomeMap
= False
;
5245 #ifdef WITH_NISPLUS_HOME
5246 string_set(&Globals
.szNISHomeMapName
, "auto_home.org_dir");
5248 string_set(&Globals
.szNISHomeMapName
, "auto.home");
5251 Globals
.bTimeServer
= False
;
5252 Globals
.bBindInterfacesOnly
= False
;
5253 Globals
.bUnixPasswdSync
= False
;
5254 Globals
.bPamPasswordChange
= False
;
5255 Globals
.bPasswdChatDebug
= False
;
5256 Globals
.iPasswdChatTimeout
= 2; /* 2 second default. */
5257 Globals
.bNTPipeSupport
= True
; /* Do NT pipes by default. */
5258 Globals
.bNTStatusSupport
= True
; /* Use NT status by default. */
5259 Globals
.bStatCache
= True
; /* use stat cache by default */
5260 Globals
.iMaxStatCacheSize
= 256; /* 256k by default */
5261 Globals
.restrict_anonymous
= 0;
5262 Globals
.bClientLanManAuth
= False
; /* Do NOT use the LanMan hash if it is available */
5263 Globals
.bClientPlaintextAuth
= False
; /* Do NOT use a plaintext password even if is requested by the server */
5264 Globals
.bLanmanAuth
= False
; /* Do NOT use the LanMan hash, even if it is supplied */
5265 Globals
.bNTLMAuth
= True
; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
5266 Globals
.bClientNTLMv2Auth
= True
; /* Client should always use use NTLMv2, as we can't tell that the server supports it, but most modern servers do */
5267 /* Note, that we will also use NTLM2 session security (which is different), if it is available */
5269 Globals
.map_to_guest
= 0; /* By Default, "Never" */
5270 Globals
.oplock_break_wait_time
= 0; /* By Default, 0 msecs. */
5271 Globals
.enhanced_browsing
= true;
5272 Globals
.iLockSpinTime
= WINDOWS_MINIMUM_LOCK_TIMEOUT_MS
; /* msec. */
5273 #ifdef MMAP_BLACKLIST
5274 Globals
.bUseMmap
= False
;
5276 Globals
.bUseMmap
= True
;
5278 Globals
.bUnixExtensions
= True
;
5279 Globals
.bResetOnZeroVC
= False
;
5280 Globals
.bLogWriteableFilesOnExit
= False
;
5281 Globals
.bCreateKrb5Conf
= true;
5283 /* hostname lookups can be very expensive and are broken on
5284 a large number of sites (tridge) */
5285 Globals
.bHostnameLookups
= False
;
5287 string_set(&Globals
.szPassdbBackend
, "tdbsam");
5288 string_set(&Globals
.szLdapSuffix
, "");
5289 string_set(&Globals
.szLdapMachineSuffix
, "");
5290 string_set(&Globals
.szLdapUserSuffix
, "");
5291 string_set(&Globals
.szLdapGroupSuffix
, "");
5292 string_set(&Globals
.szLdapIdmapSuffix
, "");
5294 string_set(&Globals
.szLdapAdminDn
, "");
5295 Globals
.ldap_ssl
= LDAP_SSL_START_TLS
;
5296 Globals
.ldap_ssl_ads
= False
;
5297 Globals
.ldap_deref
= -1;
5298 Globals
.ldap_passwd_sync
= LDAP_PASSWD_SYNC_OFF
;
5299 Globals
.ldap_delete_dn
= False
;
5300 Globals
.ldap_replication_sleep
= 1000; /* wait 1 sec for replication */
5301 Globals
.ldap_follow_referral
= Auto
;
5302 Globals
.ldap_timeout
= LDAP_DEFAULT_TIMEOUT
;
5303 Globals
.ldap_connection_timeout
= LDAP_CONNECTION_DEFAULT_TIMEOUT
;
5304 Globals
.ldap_page_size
= LDAP_PAGE_SIZE
;
5306 Globals
.ldap_debug_level
= 0;
5307 Globals
.ldap_debug_threshold
= 10;
5309 /* This is what we tell the afs client. in reality we set the token
5310 * to never expire, though, when this runs out the afs client will
5311 * forget the token. Set to 0 to get NEVERDATE.*/
5312 Globals
.iAfsTokenLifetime
= 604800;
5313 Globals
.cups_connection_timeout
= CUPS_DEFAULT_CONNECTION_TIMEOUT
;
5315 /* these parameters are set to defaults that are more appropriate
5316 for the increasing samba install base:
5318 as a member of the workgroup, that will possibly become a
5319 _local_ master browser (lm = True). this is opposed to a forced
5320 local master browser startup (pm = True).
5322 doesn't provide WINS server service by default (wsupp = False),
5323 and doesn't provide domain master browser services by default, either.
5327 Globals
.bMsAddPrinterWizard
= True
;
5328 Globals
.os_level
= 20;
5329 Globals
.bLocalMaster
= True
;
5330 Globals
.iDomainMaster
= Auto
; /* depending on bDomainLogons */
5331 Globals
.bDomainLogons
= False
;
5332 Globals
.bBrowseList
= True
;
5333 Globals
.bWINSsupport
= False
;
5334 Globals
.bWINSproxy
= False
;
5336 TALLOC_FREE(Globals
.szInitLogonDelayedHosts
);
5337 Globals
.InitLogonDelay
= 100; /* 100 ms default delay */
5339 Globals
.bDNSproxy
= True
;
5341 /* this just means to use them if they exist */
5342 Globals
.bKernelOplocks
= True
;
5344 Globals
.bAllowTrustedDomains
= True
;
5345 string_set(&Globals
.szIdmapBackend
, "tdb");
5346 Globals
.bIdmapReadOnly
= false;
5348 string_set(&Globals
.szTemplateShell
, "/bin/false");
5349 string_set(&Globals
.szTemplateHomedir
, "/home/%D/%U");
5350 string_set(&Globals
.szWinbindSeparator
, "\\");
5352 string_set(&Globals
.szCupsServer
, "");
5353 string_set(&Globals
.szIPrintServer
, "");
5355 string_set(&Globals
.ctdbdSocket
, "");
5356 Globals
.szClusterAddresses
= NULL
;
5357 Globals
.clustering
= False
;
5358 Globals
.ctdb_timeout
= 0;
5359 Globals
.ctdb_locktime_warn_threshold
= 0;
5361 Globals
.winbind_cache_time
= 300; /* 5 minutes */
5362 Globals
.winbind_reconnect_delay
= 30; /* 30 seconds */
5363 Globals
.winbind_max_clients
= 200;
5364 Globals
.bWinbindEnumUsers
= False
;
5365 Globals
.bWinbindEnumGroups
= False
;
5366 Globals
.bWinbindUseDefaultDomain
= False
;
5367 Globals
.bWinbindTrustedDomainsOnly
= False
;
5368 Globals
.bWinbindNestedGroups
= True
;
5369 Globals
.winbind_expand_groups
= 1;
5370 Globals
.szWinbindNssInfo
= str_list_make_v3(NULL
, "template", NULL
);
5371 Globals
.bWinbindRefreshTickets
= False
;
5372 Globals
.bWinbindOfflineLogon
= False
;
5374 Globals
.iIdmapCacheTime
= 86400 * 7; /* a week by default */
5375 Globals
.iIdmapNegativeCacheTime
= 120; /* 2 minutes by default */
5377 Globals
.bPassdbExpandExplicit
= False
;
5379 Globals
.name_cache_timeout
= 660; /* In seconds */
5381 Globals
.bUseSpnego
= True
;
5382 Globals
.bClientUseSpnego
= True
;
5384 Globals
.client_signing
= Auto
;
5385 Globals
.server_signing
= False
;
5387 Globals
.bDeferSharingViolations
= True
;
5388 string_set(&Globals
.smb_ports
, SMB_PORTS
);
5390 Globals
.bEnablePrivileges
= True
;
5391 Globals
.bHostMSDfs
= True
;
5392 Globals
.bASUSupport
= False
;
5394 /* User defined shares. */
5395 if (asprintf(&s
, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5396 smb_panic("init_globals: ENOMEM");
5398 string_set(&Globals
.szUsersharePath
, s
);
5400 string_set(&Globals
.szUsershareTemplateShare
, "");
5401 Globals
.iUsershareMaxShares
= 0;
5402 /* By default disallow sharing of directories not owned by the sharer. */
5403 Globals
.bUsershareOwnerOnly
= True
;
5404 /* By default disallow guest access to usershares. */
5405 Globals
.bUsershareAllowGuests
= False
;
5407 Globals
.iKeepalive
= DEFAULT_KEEPALIVE
;
5409 /* By default no shares out of the registry */
5410 Globals
.bRegistryShares
= False
;
5412 Globals
.iminreceivefile
= 0;
5414 Globals
.bMapUntrustedToDomain
= false;
5415 Globals
.bMulticastDnsRegister
= true;
5417 Globals
.ismb2_max_read
= DEFAULT_SMB2_MAX_READ
;
5418 Globals
.ismb2_max_write
= DEFAULT_SMB2_MAX_WRITE
;
5419 Globals
.ismb2_max_trans
= DEFAULT_SMB2_MAX_TRANSACT
;
5420 Globals
.ismb2_max_credits
= DEFAULT_SMB2_MAX_CREDITS
;
5422 string_set(&Globals
.ncalrpc_dir
, get_dyn_NCALRPCDIR());
5424 /* Now put back the settings that were set with lp_set_cmdline() */
5425 apply_lp_set_cmdline();
5428 /*******************************************************************
5429 Convenience routine to grab string parameters into temporary memory
5430 and run standard_sub_basic on them. The buffers can be written to by
5431 callers without affecting the source string.
5432 ********************************************************************/
5434 static char *lp_string(const char *s
)
5437 TALLOC_CTX
*ctx
= talloc_tos();
5439 /* The follow debug is useful for tracking down memory problems
5440 especially if you have an inner loop that is calling a lp_*()
5441 function that returns a string. Perhaps this debug should be
5442 present all the time? */
5445 DEBUG(10, ("lp_string(%s)\n", s
));
5451 ret
= talloc_sub_basic(ctx
,
5452 get_current_username(),
5453 current_user_info
.domain
,
5455 if (trim_char(ret
, '\"', '\"')) {
5456 if (strchr(ret
,'\"') != NULL
) {
5458 ret
= talloc_sub_basic(ctx
,
5459 get_current_username(),
5460 current_user_info
.domain
,
5468 In this section all the functions that are used to access the
5469 parameters from the rest of the program are defined
5472 #define FN_GLOBAL_STRING(fn_name,ptr) \
5473 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
5474 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5475 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
5476 #define FN_GLOBAL_LIST(fn_name,ptr) \
5477 const char **fn_name(void) {return(*(const char ***)(ptr));}
5478 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5479 bool fn_name(void) {return(*(bool *)(ptr));}
5480 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5481 char fn_name(void) {return(*(char *)(ptr));}
5482 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5483 int fn_name(void) {return(*(int *)(ptr));}
5485 #define FN_LOCAL_STRING(fn_name,val) \
5486 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5487 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5488 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5489 #define FN_LOCAL_LIST(fn_name,val) \
5490 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5491 #define FN_LOCAL_BOOL(fn_name,val) \
5492 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5493 #define FN_LOCAL_INTEGER(fn_name,val) \
5494 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5496 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5497 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5498 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5499 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5500 #define FN_LOCAL_CHAR(fn_name,val) \
5501 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5503 FN_GLOBAL_STRING(lp_smb_ports
, &Globals
.smb_ports
)
5504 FN_GLOBAL_STRING(lp_dos_charset
, &Globals
.dos_charset
)
5505 FN_GLOBAL_STRING(lp_unix_charset
, &Globals
.unix_charset
)
5506 FN_GLOBAL_STRING(lp_display_charset
, &Globals
.display_charset
)
5507 FN_GLOBAL_STRING(lp_logfile
, &Globals
.szLogFile
)
5508 FN_GLOBAL_STRING(lp_configfile
, &Globals
.szConfigFile
)
5509 FN_GLOBAL_STRING(lp_smb_passwd_file
, &Globals
.szSMBPasswdFile
)
5510 FN_GLOBAL_STRING(lp_private_dir
, &Globals
.szPrivateDir
)
5511 FN_GLOBAL_STRING(lp_serverstring
, &Globals
.szServerString
)
5512 FN_GLOBAL_INTEGER(lp_printcap_cache_time
, &Globals
.PrintcapCacheTime
)
5513 FN_GLOBAL_STRING(lp_addport_cmd
, &Globals
.szAddPortCommand
)
5514 FN_GLOBAL_STRING(lp_enumports_cmd
, &Globals
.szEnumPortsCommand
)
5515 FN_GLOBAL_STRING(lp_addprinter_cmd
, &Globals
.szAddPrinterCommand
)
5516 FN_GLOBAL_STRING(lp_deleteprinter_cmd
, &Globals
.szDeletePrinterCommand
)
5517 FN_GLOBAL_STRING(lp_os2_driver_map
, &Globals
.szOs2DriverMap
)
5518 FN_GLOBAL_STRING(lp_lockdir
, &Globals
.szLockDir
)
5519 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5520 * build process or in smb.conf, we use that value. Otherwise they
5521 * default to the value of lp_lockdir(). */
5522 char *lp_statedir(void) {
5523 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5524 (strcmp(get_dyn_STATEDIR(), Globals
.szStateDir
) != 0))
5525 return(lp_string(*(char **)(&Globals
.szStateDir
) ?
5526 *(char **)(&Globals
.szStateDir
) : ""));
5528 return(lp_string(*(char **)(&Globals
.szLockDir
) ?
5529 *(char **)(&Globals
.szLockDir
) : ""));
5531 char *lp_cachedir(void) {
5532 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5533 (strcmp(get_dyn_CACHEDIR(), Globals
.szCacheDir
) != 0))
5534 return(lp_string(*(char **)(&Globals
.szCacheDir
) ?
5535 *(char **)(&Globals
.szCacheDir
) : ""));
5537 return(lp_string(*(char **)(&Globals
.szLockDir
) ?
5538 *(char **)(&Globals
.szLockDir
) : ""));
5540 FN_GLOBAL_STRING(lp_piddir
, &Globals
.szPidDir
)
5541 FN_GLOBAL_STRING(lp_mangling_method
, &Globals
.szManglingMethod
)
5542 FN_GLOBAL_INTEGER(lp_mangle_prefix
, &Globals
.mangle_prefix
)
5543 FN_GLOBAL_STRING(lp_utmpdir
, &Globals
.szUtmpDir
)
5544 FN_GLOBAL_STRING(lp_wtmpdir
, &Globals
.szWtmpDir
)
5545 FN_GLOBAL_BOOL(lp_utmp
, &Globals
.bUtmp
)
5546 FN_GLOBAL_STRING(lp_rootdir
, &Globals
.szRootdir
)
5547 FN_GLOBAL_STRING(lp_perfcount_module
, &Globals
.szSMBPerfcountModule
)
5548 FN_GLOBAL_STRING(lp_defaultservice
, &Globals
.szDefaultService
)
5549 FN_GLOBAL_STRING(lp_msg_command
, &Globals
.szMsgCommand
)
5550 FN_GLOBAL_STRING(lp_get_quota_command
, &Globals
.szGetQuota
)
5551 FN_GLOBAL_STRING(lp_set_quota_command
, &Globals
.szSetQuota
)
5552 FN_GLOBAL_STRING(lp_auto_services
, &Globals
.szAutoServices
)
5553 FN_GLOBAL_STRING(lp_passwd_program
, &Globals
.szPasswdProgram
)
5554 FN_GLOBAL_STRING(lp_passwd_chat
, &Globals
.szPasswdChat
)
5555 FN_GLOBAL_STRING(lp_passwordserver
, &Globals
.szPasswordServer
)
5556 FN_GLOBAL_STRING(lp_name_resolve_order
, &Globals
.szNameResolveOrder
)
5557 FN_GLOBAL_STRING(lp_realm
, &Globals
.szRealm
)
5558 FN_GLOBAL_CONST_STRING(lp_afs_username_map
, &Globals
.szAfsUsernameMap
)
5559 FN_GLOBAL_INTEGER(lp_afs_token_lifetime
, &Globals
.iAfsTokenLifetime
)
5560 FN_GLOBAL_STRING(lp_log_nt_token_command
, &Globals
.szLogNtTokenCommand
)
5561 FN_GLOBAL_STRING(lp_username_map
, &Globals
.szUsernameMap
)
5562 FN_GLOBAL_CONST_STRING(lp_logon_script
, &Globals
.szLogonScript
)
5563 FN_GLOBAL_CONST_STRING(lp_logon_path
, &Globals
.szLogonPath
)
5564 FN_GLOBAL_CONST_STRING(lp_logon_drive
, &Globals
.szLogonDrive
)
5565 FN_GLOBAL_CONST_STRING(lp_logon_home
, &Globals
.szLogonHome
)
5566 FN_GLOBAL_STRING(lp_remote_announce
, &Globals
.szRemoteAnnounce
)
5567 FN_GLOBAL_STRING(lp_remote_browse_sync
, &Globals
.szRemoteBrowseSync
)
5568 FN_GLOBAL_BOOL(lp_nmbd_bind_explicit_broadcast
, &Globals
.bNmbdBindExplicitBroadcast
)
5569 FN_GLOBAL_LIST(lp_wins_server_list
, &Globals
.szWINSservers
)
5570 FN_GLOBAL_LIST(lp_interfaces
, &Globals
.szInterfaces
)
5571 FN_GLOBAL_STRING(lp_nis_home_map_name
, &Globals
.szNISHomeMapName
)
5572 static FN_GLOBAL_STRING(lp_announce_version
, &Globals
.szAnnounceVersion
)
5573 FN_GLOBAL_LIST(lp_netbios_aliases
, &Globals
.szNetbiosAliases
)
5574 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
5575 * lp_passdb_backend() should be replace by the this macro again after
5578 const char *lp_passdb_backend(void)
5580 char *delim
, *quote
;
5582 delim
= strchr( Globals
.szPassdbBackend
, ' ');
5583 /* no space at all */
5584 if (delim
== NULL
) {
5588 quote
= strchr(Globals
.szPassdbBackend
, '"');
5589 /* no quote char or non in the first part */
5590 if (quote
== NULL
|| quote
> delim
) {
5595 quote
= strchr(quote
+1, '"');
5596 if (quote
== NULL
) {
5597 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
5599 } else if (*(quote
+1) == '\0') {
5600 /* space, fitting quote char, and one backend only */
5603 /* terminate string after the fitting quote char */
5608 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5609 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5610 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5611 "backend (%s) is used. The rest is ignored.\n", Globals
.szPassdbBackend
));
5614 return Globals
.szPassdbBackend
;
5616 FN_GLOBAL_LIST(lp_preload_modules
, &Globals
.szPreloadModules
)
5617 FN_GLOBAL_STRING(lp_panic_action
, &Globals
.szPanicAction
)
5618 FN_GLOBAL_STRING(lp_adduser_script
, &Globals
.szAddUserScript
)
5619 FN_GLOBAL_STRING(lp_renameuser_script
, &Globals
.szRenameUserScript
)
5620 FN_GLOBAL_STRING(lp_deluser_script
, &Globals
.szDelUserScript
)
5622 FN_GLOBAL_CONST_STRING(lp_guestaccount
, &Globals
.szGuestaccount
)
5623 FN_GLOBAL_STRING(lp_addgroup_script
, &Globals
.szAddGroupScript
)
5624 FN_GLOBAL_STRING(lp_delgroup_script
, &Globals
.szDelGroupScript
)
5625 FN_GLOBAL_STRING(lp_addusertogroup_script
, &Globals
.szAddUserToGroupScript
)
5626 FN_GLOBAL_STRING(lp_deluserfromgroup_script
, &Globals
.szDelUserFromGroupScript
)
5627 FN_GLOBAL_STRING(lp_setprimarygroup_script
, &Globals
.szSetPrimaryGroupScript
)
5629 FN_GLOBAL_STRING(lp_addmachine_script
, &Globals
.szAddMachineScript
)
5631 FN_GLOBAL_STRING(lp_shutdown_script
, &Globals
.szShutdownScript
)
5632 FN_GLOBAL_STRING(lp_abort_shutdown_script
, &Globals
.szAbortShutdownScript
)
5633 FN_GLOBAL_STRING(lp_username_map_script
, &Globals
.szUsernameMapScript
)
5634 FN_GLOBAL_INTEGER(lp_username_map_cache_time
, &Globals
.iUsernameMapCacheTime
)
5636 FN_GLOBAL_STRING(lp_check_password_script
, &Globals
.szCheckPasswordScript
)
5638 FN_GLOBAL_STRING(lp_wins_hook
, &Globals
.szWINSHook
)
5639 FN_GLOBAL_CONST_STRING(lp_template_homedir
, &Globals
.szTemplateHomedir
)
5640 FN_GLOBAL_CONST_STRING(lp_template_shell
, &Globals
.szTemplateShell
)
5641 FN_GLOBAL_CONST_STRING(lp_winbind_separator
, &Globals
.szWinbindSeparator
)
5642 FN_GLOBAL_INTEGER(lp_acl_compatibility
, &Globals
.iAclCompat
)
5643 FN_GLOBAL_BOOL(lp_winbind_enum_users
, &Globals
.bWinbindEnumUsers
)
5644 FN_GLOBAL_BOOL(lp_winbind_enum_groups
, &Globals
.bWinbindEnumGroups
)
5645 FN_GLOBAL_BOOL(lp_winbind_use_default_domain
, &Globals
.bWinbindUseDefaultDomain
)
5646 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only
, &Globals
.bWinbindTrustedDomainsOnly
)
5647 FN_GLOBAL_BOOL(lp_winbind_nested_groups
, &Globals
.bWinbindNestedGroups
)
5648 FN_GLOBAL_INTEGER(lp_winbind_expand_groups
, &Globals
.winbind_expand_groups
)
5649 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets
, &Globals
.bWinbindRefreshTickets
)
5650 FN_GLOBAL_BOOL(lp_winbind_offline_logon
, &Globals
.bWinbindOfflineLogon
)
5651 FN_GLOBAL_BOOL(lp_winbind_normalize_names
, &Globals
.bWinbindNormalizeNames
)
5652 FN_GLOBAL_BOOL(lp_winbind_rpc_only
, &Globals
.bWinbindRpcOnly
)
5653 FN_GLOBAL_BOOL(lp_create_krb5_conf
, &Globals
.bCreateKrb5Conf
)
5655 FN_GLOBAL_CONST_STRING(lp_idmap_backend
, &Globals
.szIdmapBackend
)
5656 FN_GLOBAL_BOOL(lp_idmap_read_only
, &Globals
.bIdmapReadOnly
)
5657 FN_GLOBAL_INTEGER(lp_idmap_cache_time
, &Globals
.iIdmapCacheTime
)
5658 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time
, &Globals
.iIdmapNegativeCacheTime
)
5659 FN_GLOBAL_INTEGER(lp_keepalive
, &Globals
.iKeepalive
)
5660 FN_GLOBAL_BOOL(lp_passdb_expand_explicit
, &Globals
.bPassdbExpandExplicit
)
5662 FN_GLOBAL_STRING(lp_ldap_suffix
, &Globals
.szLdapSuffix
)
5663 FN_GLOBAL_STRING(lp_ldap_admin_dn
, &Globals
.szLdapAdminDn
)
5664 FN_GLOBAL_INTEGER(lp_ldap_ssl
, &Globals
.ldap_ssl
)
5665 FN_GLOBAL_BOOL(lp_ldap_ssl_ads
, &Globals
.ldap_ssl_ads
)
5666 FN_GLOBAL_INTEGER(lp_ldap_deref
, &Globals
.ldap_deref
)
5667 FN_GLOBAL_INTEGER(lp_ldap_follow_referral
, &Globals
.ldap_follow_referral
)
5668 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync
, &Globals
.ldap_passwd_sync
)
5669 FN_GLOBAL_BOOL(lp_ldap_delete_dn
, &Globals
.ldap_delete_dn
)
5670 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep
, &Globals
.ldap_replication_sleep
)
5671 FN_GLOBAL_INTEGER(lp_ldap_timeout
, &Globals
.ldap_timeout
)
5672 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout
, &Globals
.ldap_connection_timeout
)
5673 FN_GLOBAL_INTEGER(lp_ldap_page_size
, &Globals
.ldap_page_size
)
5674 FN_GLOBAL_INTEGER(lp_ldap_debug_level
, &Globals
.ldap_debug_level
)
5675 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold
, &Globals
.ldap_debug_threshold
)
5676 FN_GLOBAL_STRING(lp_add_share_cmd
, &Globals
.szAddShareCommand
)
5677 FN_GLOBAL_STRING(lp_change_share_cmd
, &Globals
.szChangeShareCommand
)
5678 FN_GLOBAL_STRING(lp_delete_share_cmd
, &Globals
.szDeleteShareCommand
)
5679 FN_GLOBAL_STRING(lp_usershare_path
, &Globals
.szUsersharePath
)
5680 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list
, &Globals
.szUsersharePrefixAllowList
)
5681 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list
, &Globals
.szUsersharePrefixDenyList
)
5683 FN_GLOBAL_LIST(lp_eventlog_list
, &Globals
.szEventLogs
)
5685 FN_GLOBAL_BOOL(lp_registry_shares
, &Globals
.bRegistryShares
)
5686 FN_GLOBAL_BOOL(lp_usershare_allow_guests
, &Globals
.bUsershareAllowGuests
)
5687 FN_GLOBAL_BOOL(lp_usershare_owner_only
, &Globals
.bUsershareOwnerOnly
)
5688 FN_GLOBAL_BOOL(lp_disable_netbios
, &Globals
.bDisableNetbios
)
5689 FN_GLOBAL_BOOL(lp_reset_on_zero_vc
, &Globals
.bResetOnZeroVC
)
5690 FN_GLOBAL_BOOL(lp_log_writeable_files_on_exit
,
5691 &Globals
.bLogWriteableFilesOnExit
)
5692 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard
, &Globals
.bMsAddPrinterWizard
)
5693 FN_GLOBAL_BOOL(lp_dns_proxy
, &Globals
.bDNSproxy
)
5694 FN_GLOBAL_BOOL(lp_wins_support
, &Globals
.bWINSsupport
)
5695 FN_GLOBAL_BOOL(lp_we_are_a_wins_server
, &Globals
.bWINSsupport
)
5696 FN_GLOBAL_BOOL(lp_wins_proxy
, &Globals
.bWINSproxy
)
5697 FN_GLOBAL_BOOL(lp_local_master
, &Globals
.bLocalMaster
)
5698 FN_GLOBAL_BOOL(lp_domain_logons
, &Globals
.bDomainLogons
)
5699 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts
, &Globals
.szInitLogonDelayedHosts
)
5700 FN_GLOBAL_INTEGER(lp_init_logon_delay
, &Globals
.InitLogonDelay
)
5701 FN_GLOBAL_BOOL(lp_load_printers
, &Globals
.bLoadPrinters
)
5702 FN_GLOBAL_BOOL(_lp_readraw
, &Globals
.bReadRaw
)
5703 FN_GLOBAL_BOOL(lp_large_readwrite
, &Globals
.bLargeReadwrite
)
5704 FN_GLOBAL_BOOL(_lp_writeraw
, &Globals
.bWriteRaw
)
5705 FN_GLOBAL_BOOL(lp_null_passwords
, &Globals
.bNullPasswords
)
5706 FN_GLOBAL_BOOL(lp_obey_pam_restrictions
, &Globals
.bObeyPamRestrictions
)
5707 FN_GLOBAL_BOOL(lp_encrypted_passwords
, &Globals
.bEncryptPasswords
)
5708 FN_GLOBAL_INTEGER(lp_client_schannel
, &Globals
.clientSchannel
)
5709 FN_GLOBAL_INTEGER(lp_server_schannel
, &Globals
.serverSchannel
)
5710 FN_GLOBAL_BOOL(lp_syslog_only
, &Globals
.bSyslogOnly
)
5711 FN_GLOBAL_BOOL(lp_timestamp_logs
, &Globals
.bTimestampLogs
)
5712 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp
, &Globals
.bDebugPrefixTimestamp
)
5713 FN_GLOBAL_BOOL(lp_debug_hires_timestamp
, &Globals
.bDebugHiresTimestamp
)
5714 FN_GLOBAL_BOOL(lp_debug_pid
, &Globals
.bDebugPid
)
5715 FN_GLOBAL_BOOL(lp_debug_uid
, &Globals
.bDebugUid
)
5716 FN_GLOBAL_BOOL(lp_debug_class
, &Globals
.bDebugClass
)
5717 FN_GLOBAL_BOOL(lp_enable_core_files
, &Globals
.bEnableCoreFiles
)
5718 FN_GLOBAL_BOOL(lp_browse_list
, &Globals
.bBrowseList
)
5719 FN_GLOBAL_BOOL(lp_nis_home_map
, &Globals
.bNISHomeMap
)
5720 static FN_GLOBAL_BOOL(lp_time_server
, &Globals
.bTimeServer
)
5721 FN_GLOBAL_BOOL(lp_bind_interfaces_only
, &Globals
.bBindInterfacesOnly
)
5722 FN_GLOBAL_BOOL(lp_pam_password_change
, &Globals
.bPamPasswordChange
)
5723 FN_GLOBAL_BOOL(lp_unix_password_sync
, &Globals
.bUnixPasswdSync
)
5724 FN_GLOBAL_BOOL(lp_passwd_chat_debug
, &Globals
.bPasswdChatDebug
)
5725 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout
, &Globals
.iPasswdChatTimeout
)
5726 FN_GLOBAL_BOOL(lp_nt_pipe_support
, &Globals
.bNTPipeSupport
)
5727 FN_GLOBAL_BOOL(lp_nt_status_support
, &Globals
.bNTStatusSupport
)
5728 FN_GLOBAL_BOOL(lp_stat_cache
, &Globals
.bStatCache
)
5729 FN_GLOBAL_INTEGER(lp_max_stat_cache_size
, &Globals
.iMaxStatCacheSize
)
5730 FN_GLOBAL_BOOL(lp_allow_trusted_domains
, &Globals
.bAllowTrustedDomains
)
5731 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain
, &Globals
.bMapUntrustedToDomain
)
5732 FN_GLOBAL_INTEGER(lp_restrict_anonymous
, &Globals
.restrict_anonymous
)
5733 FN_GLOBAL_BOOL(lp_lanman_auth
, &Globals
.bLanmanAuth
)
5734 FN_GLOBAL_BOOL(lp_ntlm_auth
, &Globals
.bNTLMAuth
)
5735 FN_GLOBAL_BOOL(lp_client_plaintext_auth
, &Globals
.bClientPlaintextAuth
)
5736 FN_GLOBAL_BOOL(lp_client_lanman_auth
, &Globals
.bClientLanManAuth
)
5737 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth
, &Globals
.bClientNTLMv2Auth
)
5738 FN_GLOBAL_BOOL(lp_host_msdfs
, &Globals
.bHostMSDfs
)
5739 FN_GLOBAL_BOOL(lp_kernel_oplocks
, &Globals
.bKernelOplocks
)
5740 FN_GLOBAL_BOOL(lp_enhanced_browsing
, &Globals
.enhanced_browsing
)
5741 FN_GLOBAL_BOOL(lp_use_mmap
, &Globals
.bUseMmap
)
5742 FN_GLOBAL_BOOL(lp_unix_extensions
, &Globals
.bUnixExtensions
)
5743 FN_GLOBAL_BOOL(lp_use_spnego
, &Globals
.bUseSpnego
)
5744 FN_GLOBAL_BOOL(lp_client_use_spnego
, &Globals
.bClientUseSpnego
)
5745 FN_GLOBAL_BOOL(lp_client_use_spnego_principal
, &Globals
.client_use_spnego_principal
)
5746 FN_GLOBAL_BOOL(lp_send_spnego_principal
, &Globals
.send_spnego_principal
)
5747 FN_GLOBAL_BOOL(lp_hostname_lookups
, &Globals
.bHostnameLookups
)
5748 FN_LOCAL_PARM_BOOL(lp_change_notify
, bChangeNotify
)
5749 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify
, bKernelChangeNotify
)
5750 FN_GLOBAL_STRING(lp_dedicated_keytab_file
, &Globals
.szDedicatedKeytabFile
)
5751 FN_GLOBAL_INTEGER(lp_kerberos_method
, &Globals
.iKerberosMethod
)
5752 FN_GLOBAL_BOOL(lp_defer_sharing_violations
, &Globals
.bDeferSharingViolations
)
5753 FN_GLOBAL_BOOL(lp_enable_privileges
, &Globals
.bEnablePrivileges
)
5754 FN_GLOBAL_BOOL(lp_enable_asu_support
, &Globals
.bASUSupport
)
5755 FN_GLOBAL_INTEGER(lp_os_level
, &Globals
.os_level
)
5756 FN_GLOBAL_INTEGER(lp_max_ttl
, &Globals
.max_ttl
)
5757 FN_GLOBAL_INTEGER(lp_max_wins_ttl
, &Globals
.max_wins_ttl
)
5758 FN_GLOBAL_INTEGER(lp_min_wins_ttl
, &Globals
.min_wins_ttl
)
5759 FN_GLOBAL_INTEGER(lp_max_log_size
, &Globals
.max_log_size
)
5760 FN_GLOBAL_INTEGER(lp_max_open_files
, &Globals
.max_open_files
)
5761 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size
, &Globals
.open_files_db_hash_size
)
5762 FN_GLOBAL_INTEGER(lp_maxxmit
, &Globals
.max_xmit
)
5763 FN_GLOBAL_INTEGER(lp_maxmux
, &Globals
.max_mux
)
5764 FN_GLOBAL_INTEGER(lp_passwordlevel
, &Globals
.pwordlevel
)
5765 FN_GLOBAL_INTEGER(lp_usernamelevel
, &Globals
.unamelevel
)
5766 FN_GLOBAL_INTEGER(lp_deadtime
, &Globals
.deadtime
)
5767 FN_GLOBAL_BOOL(lp_getwd_cache
, &Globals
.getwd_cache
)
5768 FN_GLOBAL_INTEGER(lp_maxprotocol
, &Globals
.maxprotocol
)
5769 FN_GLOBAL_INTEGER(lp_minprotocol
, &Globals
.minprotocol
)
5770 FN_GLOBAL_INTEGER(lp_security
, &Globals
.security
)
5771 FN_GLOBAL_LIST(lp_auth_methods
, &Globals
.AuthMethods
)
5772 FN_GLOBAL_BOOL(lp_paranoid_server_security
, &Globals
.paranoid_server_security
)
5773 FN_GLOBAL_INTEGER(lp_maxdisksize
, &Globals
.maxdisksize
)
5774 FN_GLOBAL_INTEGER(lp_lpqcachetime
, &Globals
.lpqcachetime
)
5775 FN_GLOBAL_INTEGER(lp_max_smbd_processes
, &Globals
.iMaxSmbdProcesses
)
5776 FN_GLOBAL_BOOL(_lp_disable_spoolss
, &Globals
.bDisableSpoolss
)
5777 FN_GLOBAL_INTEGER(lp_syslog
, &Globals
.syslog
)
5778 static FN_GLOBAL_INTEGER(lp_announce_as
, &Globals
.announce_as
)
5779 FN_GLOBAL_INTEGER(lp_lm_announce
, &Globals
.lm_announce
)
5780 FN_GLOBAL_INTEGER(lp_lm_interval
, &Globals
.lm_interval
)
5781 FN_GLOBAL_INTEGER(lp_machine_password_timeout
, &Globals
.machine_password_timeout
)
5782 FN_GLOBAL_INTEGER(lp_map_to_guest
, &Globals
.map_to_guest
)
5783 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time
, &Globals
.oplock_break_wait_time
)
5784 FN_GLOBAL_INTEGER(lp_lock_spin_time
, &Globals
.iLockSpinTime
)
5785 FN_GLOBAL_INTEGER(lp_usershare_max_shares
, &Globals
.iUsershareMaxShares
)
5786 FN_GLOBAL_CONST_STRING(lp_socket_options
, &Globals
.szSocketOptions
)
5787 FN_GLOBAL_INTEGER(lp_config_backend
, &Globals
.ConfigBackend
)
5788 FN_GLOBAL_INTEGER(lp_smb2_max_read
, &Globals
.ismb2_max_read
)
5789 FN_GLOBAL_INTEGER(lp_smb2_max_write
, &Globals
.ismb2_max_write
)
5790 FN_GLOBAL_INTEGER(lp_smb2_max_trans
, &Globals
.ismb2_max_trans
)
5791 int lp_smb2_max_credits(void)
5793 if (Globals
.ismb2_max_credits
== 0) {
5794 Globals
.ismb2_max_credits
= DEFAULT_SMB2_MAX_CREDITS
;
5796 return Globals
.ismb2_max_credits
;
5798 FN_LOCAL_STRING(lp_preexec
, szPreExec
)
5799 FN_LOCAL_STRING(lp_postexec
, szPostExec
)
5800 FN_LOCAL_STRING(lp_rootpreexec
, szRootPreExec
)
5801 FN_LOCAL_STRING(lp_rootpostexec
, szRootPostExec
)
5802 FN_LOCAL_STRING(lp_servicename
, szService
)
5803 FN_LOCAL_CONST_STRING(lp_const_servicename
, szService
)
5804 FN_LOCAL_STRING(lp_pathname
, szPath
)
5805 FN_LOCAL_STRING(lp_dontdescend
, szDontdescend
)
5806 FN_LOCAL_STRING(lp_username
, szUsername
)
5807 FN_LOCAL_LIST(lp_invalid_users
, szInvalidUsers
)
5808 FN_LOCAL_LIST(lp_valid_users
, szValidUsers
)
5809 FN_LOCAL_LIST(lp_admin_users
, szAdminUsers
)
5810 FN_GLOBAL_LIST(lp_svcctl_list
, &Globals
.szServicesList
)
5811 FN_LOCAL_STRING(lp_cups_options
, szCupsOptions
)
5812 FN_GLOBAL_STRING(lp_cups_server
, &Globals
.szCupsServer
)
5813 int lp_cups_encrypt(void)
5816 #ifdef HAVE_HTTPCONNECTENCRYPT
5817 switch (Globals
.CupsEncrypt
) {
5819 result
= HTTP_ENCRYPT_REQUIRED
;
5822 result
= HTTP_ENCRYPT_ALWAYS
;
5825 result
= HTTP_ENCRYPT_NEVER
;
5831 FN_GLOBAL_STRING(lp_iprint_server
, &Globals
.szIPrintServer
)
5832 FN_GLOBAL_INTEGER(lp_cups_connection_timeout
, &Globals
.cups_connection_timeout
)
5833 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket
, &Globals
.ctdbdSocket
)
5834 FN_GLOBAL_LIST(lp_cluster_addresses
, &Globals
.szClusterAddresses
)
5835 FN_GLOBAL_BOOL(lp_clustering
, &Globals
.clustering
)
5836 FN_GLOBAL_INTEGER(lp_ctdb_timeout
, &Globals
.ctdb_timeout
)
5837 FN_GLOBAL_INTEGER(lp_ctdb_locktime_warn_threshold
, &Globals
.ctdb_locktime_warn_threshold
)
5838 FN_LOCAL_STRING(lp_printcommand
, szPrintcommand
)
5839 FN_LOCAL_STRING(lp_lpqcommand
, szLpqcommand
)
5840 FN_LOCAL_STRING(lp_lprmcommand
, szLprmcommand
)
5841 FN_LOCAL_STRING(lp_lppausecommand
, szLppausecommand
)
5842 FN_LOCAL_STRING(lp_lpresumecommand
, szLpresumecommand
)
5843 FN_LOCAL_STRING(lp_queuepausecommand
, szQueuepausecommand
)
5844 FN_LOCAL_STRING(lp_queueresumecommand
, szQueueresumecommand
)
5845 static FN_LOCAL_STRING(_lp_printername
, szPrintername
)
5846 FN_LOCAL_CONST_STRING(lp_printjob_username
, szPrintjobUsername
)
5847 FN_LOCAL_LIST(lp_hostsallow
, szHostsallow
)
5848 FN_LOCAL_LIST(lp_hostsdeny
, szHostsdeny
)
5849 FN_LOCAL_STRING(lp_magicscript
, szMagicScript
)
5850 FN_LOCAL_STRING(lp_magicoutput
, szMagicOutput
)
5851 FN_LOCAL_STRING(lp_comment
, comment
)
5852 FN_LOCAL_STRING(lp_force_user
, force_user
)
5853 FN_LOCAL_STRING(lp_force_group
, force_group
)
5854 FN_LOCAL_LIST(lp_readlist
, readlist
)
5855 FN_LOCAL_LIST(lp_writelist
, writelist
)
5856 FN_LOCAL_LIST(lp_printer_admin
, printer_admin
)
5857 FN_LOCAL_STRING(lp_fstype
, fstype
)
5858 FN_LOCAL_LIST(lp_vfs_objects
, szVfsObjects
)
5859 FN_LOCAL_STRING(lp_msdfs_proxy
, szMSDfsProxy
)
5860 static FN_LOCAL_STRING(lp_volume
, volume
)
5861 FN_LOCAL_STRING(lp_veto_files
, szVetoFiles
)
5862 FN_LOCAL_STRING(lp_hide_files
, szHideFiles
)
5863 FN_LOCAL_STRING(lp_veto_oplocks
, szVetoOplockFiles
)
5864 FN_LOCAL_BOOL(lp_msdfs_root
, bMSDfsRoot
)
5865 FN_LOCAL_STRING(lp_aio_write_behind
, szAioWriteBehind
)
5866 FN_LOCAL_STRING(lp_dfree_command
, szDfree
)
5867 FN_LOCAL_BOOL(lp_autoloaded
, autoloaded
)
5868 FN_LOCAL_BOOL(lp_preexec_close
, bPreexecClose
)
5869 FN_LOCAL_BOOL(lp_rootpreexec_close
, bRootpreexecClose
)
5870 FN_LOCAL_INTEGER(lp_casesensitive
, iCaseSensitive
)
5871 FN_LOCAL_BOOL(lp_preservecase
, bCasePreserve
)
5872 FN_LOCAL_BOOL(lp_shortpreservecase
, bShortCasePreserve
)
5873 FN_LOCAL_BOOL(lp_hide_dot_files
, bHideDotFiles
)
5874 FN_LOCAL_BOOL(lp_hide_special_files
, bHideSpecialFiles
)
5875 FN_LOCAL_BOOL(lp_hideunreadable
, bHideUnReadable
)
5876 FN_LOCAL_BOOL(lp_hideunwriteable_files
, bHideUnWriteableFiles
)
5877 FN_LOCAL_BOOL(lp_browseable
, bBrowseable
)
5878 FN_LOCAL_BOOL(lp_access_based_share_enum
, bAccessBasedShareEnum
)
5879 FN_LOCAL_BOOL(lp_readonly
, bRead_only
)
5880 FN_LOCAL_BOOL(lp_no_set_dir
, bNo_set_dir
)
5881 FN_LOCAL_BOOL(lp_guest_ok
, bGuest_ok
)
5882 FN_LOCAL_BOOL(lp_guest_only
, bGuest_only
)
5883 FN_LOCAL_BOOL(lp_administrative_share
, bAdministrative_share
)
5884 FN_LOCAL_BOOL(lp_print_ok
, bPrint_ok
)
5885 FN_LOCAL_BOOL(lp_map_hidden
, bMap_hidden
)
5886 FN_LOCAL_BOOL(lp_map_archive
, bMap_archive
)
5887 FN_LOCAL_BOOL(lp_store_dos_attributes
, bStoreDosAttributes
)
5888 FN_LOCAL_BOOL(lp_dmapi_support
, bDmapiSupport
)
5889 FN_LOCAL_PARM_BOOL(lp_locking
, bLocking
)
5890 FN_LOCAL_PARM_INTEGER(lp_strict_locking
, iStrictLocking
)
5891 FN_LOCAL_PARM_BOOL(lp_posix_locking
, bPosixLocking
)
5892 FN_LOCAL_BOOL(lp_share_modes
, bShareModes
)
5893 FN_LOCAL_BOOL(lp_oplocks
, bOpLocks
)
5894 FN_LOCAL_BOOL(lp_level2_oplocks
, bLevel2OpLocks
)
5895 FN_LOCAL_BOOL(lp_onlyuser
, bOnlyUser
)
5896 FN_LOCAL_PARM_BOOL(lp_manglednames
, bMangledNames
)
5897 FN_LOCAL_BOOL(lp_symlinks
, bSymlinks
)
5898 FN_LOCAL_BOOL(lp_syncalways
, bSyncAlways
)
5899 FN_LOCAL_BOOL(lp_strict_allocate
, bStrictAllocate
)
5900 FN_LOCAL_BOOL(lp_strict_sync
, bStrictSync
)
5901 FN_LOCAL_BOOL(lp_map_system
, bMap_system
)
5902 FN_LOCAL_BOOL(lp_delete_readonly
, bDeleteReadonly
)
5903 FN_LOCAL_BOOL(lp_fake_oplocks
, bFakeOplocks
)
5904 FN_LOCAL_BOOL(lp_recursive_veto_delete
, bDeleteVetoFiles
)
5905 FN_LOCAL_BOOL(lp_dos_filemode
, bDosFilemode
)
5906 FN_LOCAL_BOOL(lp_dos_filetimes
, bDosFiletimes
)
5907 FN_LOCAL_BOOL(lp_dos_filetime_resolution
, bDosFiletimeResolution
)
5908 FN_LOCAL_BOOL(lp_fake_dir_create_times
, bFakeDirCreateTimes
)
5909 FN_GLOBAL_BOOL(lp_async_smb_echo_handler
, &Globals
.bAsyncSMBEchoHandler
)
5910 FN_GLOBAL_BOOL(lp_multicast_dns_register
, &Globals
.bMulticastDnsRegister
)
5911 FN_LOCAL_BOOL(lp_blocking_locks
, bBlockingLocks
)
5912 FN_LOCAL_BOOL(lp_inherit_perms
, bInheritPerms
)
5913 FN_LOCAL_BOOL(lp_inherit_acls
, bInheritACLS
)
5914 FN_LOCAL_BOOL(lp_inherit_owner
, bInheritOwner
)
5915 FN_LOCAL_BOOL(lp_use_client_driver
, bUseClientDriver
)
5916 FN_LOCAL_BOOL(lp_default_devmode
, bDefaultDevmode
)
5917 FN_LOCAL_BOOL(lp_force_printername
, bForcePrintername
)
5918 FN_LOCAL_BOOL(lp_nt_acl_support
, bNTAclSupport
)
5919 FN_LOCAL_BOOL(lp_force_unknown_acl_user
, bForceUnknownAclUser
)
5920 FN_LOCAL_BOOL(lp_ea_support
, bEASupport
)
5921 FN_LOCAL_BOOL(_lp_use_sendfile
, bUseSendfile
)
5922 FN_LOCAL_BOOL(lp_profile_acls
, bProfileAcls
)
5923 FN_LOCAL_BOOL(lp_map_acl_inherit
, bMap_acl_inherit
)
5924 FN_LOCAL_BOOL(lp_afs_share
, bAfs_Share
)
5925 FN_LOCAL_BOOL(lp_acl_check_permissions
, bAclCheckPermissions
)
5926 FN_LOCAL_BOOL(lp_acl_group_control
, bAclGroupControl
)
5927 FN_LOCAL_BOOL(lp_acl_map_full_control
, bAclMapFullControl
)
5928 FN_LOCAL_INTEGER(lp_create_mask
, iCreate_mask
)
5929 FN_LOCAL_INTEGER(lp_force_create_mode
, iCreate_force_mode
)
5930 FN_LOCAL_INTEGER(lp_security_mask
, iSecurity_mask
)
5931 FN_LOCAL_INTEGER(lp_force_security_mode
, iSecurity_force_mode
)
5932 FN_LOCAL_INTEGER(lp_dir_mask
, iDir_mask
)
5933 FN_LOCAL_INTEGER(lp_force_dir_mode
, iDir_force_mode
)
5934 FN_LOCAL_INTEGER(lp_dir_security_mask
, iDir_Security_mask
)
5935 FN_LOCAL_INTEGER(lp_force_dir_security_mode
, iDir_Security_force_mode
)
5936 FN_LOCAL_INTEGER(lp_max_connections
, iMaxConnections
)
5937 FN_LOCAL_INTEGER(lp_defaultcase
, iDefaultCase
)
5938 FN_LOCAL_INTEGER(lp_minprintspace
, iMinPrintSpace
)
5939 FN_LOCAL_INTEGER(lp_printing
, iPrinting
)
5940 FN_LOCAL_INTEGER(lp_max_reported_jobs
, iMaxReportedPrintJobs
)
5941 FN_LOCAL_INTEGER(lp_oplock_contention_limit
, iOplockContentionLimit
)
5942 FN_LOCAL_INTEGER(lp_csc_policy
, iCSCPolicy
)
5943 FN_LOCAL_INTEGER(lp_write_cache_size
, iWriteCacheSize
)
5944 FN_LOCAL_INTEGER(lp_block_size
, iBlock_size
)
5945 FN_LOCAL_INTEGER(lp_dfree_cache_time
, iDfreeCacheTime
)
5946 FN_LOCAL_INTEGER(lp_allocation_roundup_size
, iallocation_roundup_size
)
5947 FN_LOCAL_INTEGER(lp_aio_read_size
, iAioReadSize
)
5948 FN_LOCAL_INTEGER(lp_aio_write_size
, iAioWriteSize
)
5949 FN_LOCAL_INTEGER(lp_map_readonly
, iMap_readonly
)
5950 FN_LOCAL_INTEGER(lp_directory_name_cache_size
, iDirectoryNameCacheSize
)
5951 FN_LOCAL_INTEGER(lp_smb_encrypt
, ismb_encrypt
)
5952 FN_LOCAL_CHAR(lp_magicchar
, magic_char
)
5953 FN_GLOBAL_INTEGER(lp_winbind_cache_time
, &Globals
.winbind_cache_time
)
5954 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay
, &Globals
.winbind_reconnect_delay
)
5955 FN_GLOBAL_INTEGER(lp_winbind_max_clients
, &Globals
.winbind_max_clients
)
5956 FN_GLOBAL_LIST(lp_winbind_nss_info
, &Globals
.szWinbindNssInfo
)
5957 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base
, &Globals
.AlgorithmicRidBase
)
5958 FN_GLOBAL_INTEGER(lp_name_cache_timeout
, &Globals
.name_cache_timeout
)
5959 FN_GLOBAL_INTEGER(lp_client_signing
, &Globals
.client_signing
)
5960 FN_GLOBAL_INTEGER(lp_server_signing
, &Globals
.server_signing
)
5961 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping
, &Globals
.client_ldap_sasl_wrapping
)
5963 FN_GLOBAL_STRING(lp_ncalrpc_dir
, &Globals
.ncalrpc_dir
)
5965 /* local prototypes */
5967 static int map_parameter_canonical(const char *pszParmName
, bool *inverse
);
5968 static const char *get_boolean(bool bool_value
);
5969 static int getservicebyname(const char *pszServiceName
,
5970 struct service
*pserviceDest
);
5971 static void copy_service(struct service
*pserviceDest
,
5972 struct service
*pserviceSource
,
5973 struct bitmap
*pcopymapDest
);
5974 static bool do_parameter(const char *pszParmName
, const char *pszParmValue
,
5976 static bool do_section(const char *pszSectionName
, void *userdata
);
5977 static void init_copymap(struct service
*pservice
);
5978 static bool hash_a_service(const char *name
, int number
);
5979 static void free_service_byindex(int iService
);
5980 static void free_param_opts(struct param_opt_struct
**popts
);
5981 static void show_parameter(int parmIndex
);
5982 static bool is_synonym_of(int parm1
, int parm2
, bool *inverse
);
5985 * This is a helper function for parametrical options support. It returns a
5986 * pointer to parametrical option value if it exists or NULL otherwise. Actual
5987 * parametrical functions are quite simple
5989 static struct param_opt_struct
*get_parametrics(int snum
, const char *type
,
5992 bool global_section
= False
;
5994 struct param_opt_struct
*data
;
5996 if (snum
>= iNumServices
) return NULL
;
5999 data
= Globals
.param_opt
;
6000 global_section
= True
;
6002 data
= ServicePtrs
[snum
]->param_opt
;
6005 if (asprintf(¶m_key
, "%s:%s", type
, option
) == -1) {
6006 DEBUG(0,("asprintf failed!\n"));
6011 if (strwicmp(data
->key
, param_key
) == 0) {
6012 string_free(¶m_key
);
6018 if (!global_section
) {
6019 /* Try to fetch the same option but from globals */
6020 /* but only if we are not already working with Globals */
6021 data
= Globals
.param_opt
;
6023 if (strwicmp(data
->key
, param_key
) == 0) {
6024 string_free(¶m_key
);
6031 string_free(¶m_key
);
6037 #define MISSING_PARAMETER(name) \
6038 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
6040 /*******************************************************************
6041 convenience routine to return int parameters.
6042 ********************************************************************/
6043 static int lp_int(const char *s
)
6047 MISSING_PARAMETER(lp_int
);
6051 return (int)strtol(s
, NULL
, 0);
6054 /*******************************************************************
6055 convenience routine to return unsigned long parameters.
6056 ********************************************************************/
6057 static unsigned long lp_ulong(const char *s
)
6061 MISSING_PARAMETER(lp_ulong
);
6065 return strtoul(s
, NULL
, 0);
6068 /*******************************************************************
6069 convenience routine to return boolean parameters.
6070 ********************************************************************/
6071 static bool lp_bool(const char *s
)
6076 MISSING_PARAMETER(lp_bool
);
6080 if (!set_boolean(s
, &ret
)) {
6081 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s
));
6088 /*******************************************************************
6089 convenience routine to return enum parameters.
6090 ********************************************************************/
6091 static int lp_enum(const char *s
,const struct enum_list
*_enum
)
6095 if (!s
|| !*s
|| !_enum
) {
6096 MISSING_PARAMETER(lp_enum
);
6100 for (i
=0; _enum
[i
].name
; i
++) {
6101 if (strequal(_enum
[i
].name
,s
))
6102 return _enum
[i
].value
;
6105 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s
));
6109 #undef MISSING_PARAMETER
6111 /* DO NOT USE lp_parm_string ANYMORE!!!!
6112 * use lp_parm_const_string or lp_parm_talloc_string
6114 * lp_parm_string is only used to let old modules find this symbol
6116 #undef lp_parm_string
6117 char *lp_parm_string(const char *servicename
, const char *type
, const char *option
);
6118 char *lp_parm_string(const char *servicename
, const char *type
, const char *option
)
6120 return lp_parm_talloc_string(lp_servicenumber(servicename
), type
, option
, NULL
);
6123 /* Return parametric option from a given service. Type is a part of option before ':' */
6124 /* Parametric option has following syntax: 'Type: option = value' */
6125 /* the returned value is talloced on the talloc_tos() */
6126 char *lp_parm_talloc_string(int snum
, const char *type
, const char *option
, const char *def
)
6128 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6130 if (data
== NULL
||data
->value
==NULL
) {
6132 return lp_string(def
);
6138 return lp_string(data
->value
);
6141 /* Return parametric option from a given service. Type is a part of option before ':' */
6142 /* Parametric option has following syntax: 'Type: option = value' */
6143 const char *lp_parm_const_string(int snum
, const char *type
, const char *option
, const char *def
)
6145 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6147 if (data
== NULL
||data
->value
==NULL
)
6153 /* Return parametric option from a given service. Type is a part of option before ':' */
6154 /* Parametric option has following syntax: 'Type: option = value' */
6156 const char **lp_parm_string_list(int snum
, const char *type
, const char *option
, const char **def
)
6158 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6160 if (data
== NULL
||data
->value
==NULL
)
6161 return (const char **)def
;
6163 if (data
->list
==NULL
) {
6164 data
->list
= str_list_make_v3(NULL
, data
->value
, NULL
);
6167 return (const char **)data
->list
;
6170 /* Return parametric option from a given service. Type is a part of option before ':' */
6171 /* Parametric option has following syntax: 'Type: option = value' */
6173 int lp_parm_int(int snum
, const char *type
, const char *option
, int def
)
6175 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6177 if (data
&& data
->value
&& *data
->value
)
6178 return lp_int(data
->value
);
6183 /* Return parametric option from a given service. Type is a part of option before ':' */
6184 /* Parametric option has following syntax: 'Type: option = value' */
6186 unsigned long lp_parm_ulong(int snum
, const char *type
, const char *option
, unsigned long def
)
6188 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6190 if (data
&& data
->value
&& *data
->value
)
6191 return lp_ulong(data
->value
);
6196 /* Return parametric option from a given service. Type is a part of option before ':' */
6197 /* Parametric option has following syntax: 'Type: option = value' */
6199 bool lp_parm_bool(int snum
, const char *type
, const char *option
, bool def
)
6201 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6203 if (data
&& data
->value
&& *data
->value
)
6204 return lp_bool(data
->value
);
6209 /* Return parametric option from a given service. Type is a part of option before ':' */
6210 /* Parametric option has following syntax: 'Type: option = value' */
6212 int lp_parm_enum(int snum
, const char *type
, const char *option
,
6213 const struct enum_list
*_enum
, int def
)
6215 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6217 if (data
&& data
->value
&& *data
->value
&& _enum
)
6218 return lp_enum(data
->value
, _enum
);
6224 /***************************************************************************
6225 Initialise a service to the defaults.
6226 ***************************************************************************/
6228 static void init_service(struct service
*pservice
)
6230 memset((char *)pservice
, '\0', sizeof(struct service
));
6231 copy_service(pservice
, &sDefault
, NULL
);
6236 * free a param_opts structure.
6237 * param_opts handling should be moved to talloc;
6238 * then this whole functions reduces to a TALLOC_FREE().
6241 static void free_param_opts(struct param_opt_struct
**popts
)
6243 struct param_opt_struct
*opt
, *next_opt
;
6245 if (popts
== NULL
) {
6249 if (*popts
!= NULL
) {
6250 DEBUG(5, ("Freeing parametrics:\n"));
6253 while (opt
!= NULL
) {
6254 string_free(&opt
->key
);
6255 string_free(&opt
->value
);
6256 TALLOC_FREE(opt
->list
);
6257 next_opt
= opt
->next
;
6264 /***************************************************************************
6265 Free the dynamically allocated parts of a service struct.
6266 ***************************************************************************/
6268 static void free_service(struct service
*pservice
)
6273 if (pservice
->szService
)
6274 DEBUG(5, ("free_service: Freeing service %s\n",
6275 pservice
->szService
));
6277 free_parameters(pservice
);
6279 string_free(&pservice
->szService
);
6280 TALLOC_FREE(pservice
->copymap
);
6282 free_param_opts(&pservice
->param_opt
);
6284 ZERO_STRUCTP(pservice
);
6288 /***************************************************************************
6289 remove a service indexed in the ServicePtrs array from the ServiceHash
6290 and free the dynamically allocated parts
6291 ***************************************************************************/
6293 static void free_service_byindex(int idx
)
6295 if ( !LP_SNUM_OK(idx
) )
6298 ServicePtrs
[idx
]->valid
= False
;
6299 invalid_services
[num_invalid_services
++] = idx
;
6301 /* we have to cleanup the hash record */
6303 if (ServicePtrs
[idx
]->szService
) {
6304 char *canon_name
= canonicalize_servicename(
6306 ServicePtrs
[idx
]->szService
);
6308 dbwrap_delete_bystring(ServiceHash
, canon_name
);
6309 TALLOC_FREE(canon_name
);
6312 free_service(ServicePtrs
[idx
]);
6315 /***************************************************************************
6316 Add a new service to the services array initialising it with the given
6318 ***************************************************************************/
6320 static int add_a_service(const struct service
*pservice
, const char *name
)
6323 struct service tservice
;
6324 int num_to_alloc
= iNumServices
+ 1;
6326 tservice
= *pservice
;
6328 /* it might already exist */
6330 i
= getservicebyname(name
, NULL
);
6336 /* find an invalid one */
6338 if (num_invalid_services
> 0) {
6339 i
= invalid_services
[--num_invalid_services
];
6342 /* if not, then create one */
6343 if (i
== iNumServices
) {
6344 struct service
**tsp
;
6347 tsp
= SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs
, struct service
*, num_to_alloc
);
6349 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
6353 ServicePtrs
[iNumServices
] = SMB_MALLOC_P(struct service
);
6354 if (!ServicePtrs
[iNumServices
]) {
6355 DEBUG(0,("add_a_service: out of memory!\n"));
6360 /* enlarge invalid_services here for now... */
6361 tinvalid
= SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services
, int,
6363 if (tinvalid
== NULL
) {
6364 DEBUG(0,("add_a_service: failed to enlarge "
6365 "invalid_services!\n"));
6368 invalid_services
= tinvalid
;
6370 free_service_byindex(i
);
6373 ServicePtrs
[i
]->valid
= True
;
6375 init_service(ServicePtrs
[i
]);
6376 copy_service(ServicePtrs
[i
], &tservice
, NULL
);
6378 string_set(&ServicePtrs
[i
]->szService
, name
);
6380 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
6381 i
, ServicePtrs
[i
]->szService
));
6383 if (!hash_a_service(ServicePtrs
[i
]->szService
, i
)) {
6390 /***************************************************************************
6391 Convert a string to uppercase and remove whitespaces.
6392 ***************************************************************************/
6394 char *canonicalize_servicename(TALLOC_CTX
*ctx
, const char *src
)
6399 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
6403 result
= talloc_strdup(ctx
, src
);
6404 SMB_ASSERT(result
!= NULL
);
6410 /***************************************************************************
6411 Add a name/index pair for the services array to the hash table.
6412 ***************************************************************************/
6414 static bool hash_a_service(const char *name
, int idx
)
6418 if ( !ServiceHash
) {
6419 DEBUG(10,("hash_a_service: creating servicehash\n"));
6420 ServiceHash
= db_open_rbt(NULL
);
6421 if ( !ServiceHash
) {
6422 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
6427 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
6430 canon_name
= canonicalize_servicename(talloc_tos(), name
);
6432 dbwrap_store_bystring(ServiceHash
, canon_name
,
6433 make_tdb_data((uint8
*)&idx
, sizeof(idx
)),
6436 TALLOC_FREE(canon_name
);
6441 /***************************************************************************
6442 Add a new home service, with the specified home directory, defaults coming
6444 ***************************************************************************/
6446 bool lp_add_home(const char *pszHomename
, int iDefaultService
,
6447 const char *user
, const char *pszHomedir
)
6451 if (pszHomename
== NULL
|| user
== NULL
|| pszHomedir
== NULL
||
6452 pszHomedir
[0] == '\0') {
6456 i
= add_a_service(ServicePtrs
[iDefaultService
], pszHomename
);
6461 if (!(*(ServicePtrs
[iDefaultService
]->szPath
))
6462 || strequal(ServicePtrs
[iDefaultService
]->szPath
, lp_pathname(GLOBAL_SECTION_SNUM
))) {
6463 string_set(&ServicePtrs
[i
]->szPath
, pszHomedir
);
6466 if (!(*(ServicePtrs
[i
]->comment
))) {
6467 char *comment
= NULL
;
6468 if (asprintf(&comment
, "Home directory of %s", user
) < 0) {
6471 string_set(&ServicePtrs
[i
]->comment
, comment
);
6475 /* set the browseable flag from the global default */
6477 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6478 ServicePtrs
[i
]->bAccessBasedShareEnum
= sDefault
.bAccessBasedShareEnum
;
6480 ServicePtrs
[i
]->autoloaded
= True
;
6482 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename
,
6483 user
, ServicePtrs
[i
]->szPath
));
6488 /***************************************************************************
6489 Add a new service, based on an old one.
6490 ***************************************************************************/
6492 int lp_add_service(const char *pszService
, int iDefaultService
)
6494 if (iDefaultService
< 0) {
6495 return add_a_service(&sDefault
, pszService
);
6498 return (add_a_service(ServicePtrs
[iDefaultService
], pszService
));
6501 /***************************************************************************
6502 Add the IPC service.
6503 ***************************************************************************/
6505 static bool lp_add_ipc(const char *ipc_name
, bool guest_ok
)
6507 char *comment
= NULL
;
6508 int i
= add_a_service(&sDefault
, ipc_name
);
6513 if (asprintf(&comment
, "IPC Service (%s)",
6514 Globals
.szServerString
) < 0) {
6518 string_set(&ServicePtrs
[i
]->szPath
, tmpdir());
6519 string_set(&ServicePtrs
[i
]->szUsername
, "");
6520 string_set(&ServicePtrs
[i
]->comment
, comment
);
6521 string_set(&ServicePtrs
[i
]->fstype
, "IPC");
6522 ServicePtrs
[i
]->iMaxConnections
= 0;
6523 ServicePtrs
[i
]->bAvailable
= True
;
6524 ServicePtrs
[i
]->bRead_only
= True
;
6525 ServicePtrs
[i
]->bGuest_only
= False
;
6526 ServicePtrs
[i
]->bAdministrative_share
= True
;
6527 ServicePtrs
[i
]->bGuest_ok
= guest_ok
;
6528 ServicePtrs
[i
]->bPrint_ok
= False
;
6529 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6531 DEBUG(3, ("adding IPC service\n"));
6537 /***************************************************************************
6538 Add a new printer service, with defaults coming from service iFrom.
6539 ***************************************************************************/
6541 bool lp_add_printer(const char *pszPrintername
, int iDefaultService
)
6543 const char *comment
= "From Printcap";
6544 int i
= add_a_service(ServicePtrs
[iDefaultService
], pszPrintername
);
6549 /* note that we do NOT default the availability flag to True - */
6550 /* we take it from the default service passed. This allows all */
6551 /* dynamic printers to be disabled by disabling the [printers] */
6552 /* entry (if/when the 'available' keyword is implemented!). */
6554 /* the printer name is set to the service name. */
6555 string_set(&ServicePtrs
[i
]->szPrintername
, pszPrintername
);
6556 string_set(&ServicePtrs
[i
]->comment
, comment
);
6558 /* set the browseable flag from the gloabl default */
6559 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6561 /* Printers cannot be read_only. */
6562 ServicePtrs
[i
]->bRead_only
= False
;
6563 /* No share modes on printer services. */
6564 ServicePtrs
[i
]->bShareModes
= False
;
6565 /* No oplocks on printer services. */
6566 ServicePtrs
[i
]->bOpLocks
= False
;
6567 /* Printer services must be printable. */
6568 ServicePtrs
[i
]->bPrint_ok
= True
;
6570 DEBUG(3, ("adding printer service %s\n", pszPrintername
));
6576 /***************************************************************************
6577 Check whether the given parameter name is valid.
6578 Parametric options (names containing a colon) are considered valid.
6579 ***************************************************************************/
6581 bool lp_parameter_is_valid(const char *pszParmName
)
6583 return ((map_parameter(pszParmName
) != -1) ||
6584 (strchr(pszParmName
, ':') != NULL
));
6587 /***************************************************************************
6588 Check whether the given name is the name of a global parameter.
6589 Returns True for strings belonging to parameters of class
6590 P_GLOBAL, False for all other strings, also for parametric options
6591 and strings not belonging to any option.
6592 ***************************************************************************/
6594 bool lp_parameter_is_global(const char *pszParmName
)
6596 int num
= map_parameter(pszParmName
);
6599 return (parm_table
[num
].p_class
== P_GLOBAL
);
6605 /**************************************************************************
6606 Check whether the given name is the canonical name of a parameter.
6607 Returns False if it is not a valid parameter Name.
6608 For parametric options, True is returned.
6609 **************************************************************************/
6611 bool lp_parameter_is_canonical(const char *parm_name
)
6613 if (!lp_parameter_is_valid(parm_name
)) {
6617 return (map_parameter(parm_name
) ==
6618 map_parameter_canonical(parm_name
, NULL
));
6621 /**************************************************************************
6622 Determine the canonical name for a parameter.
6623 Indicate when it is an inverse (boolean) synonym instead of a
6625 **************************************************************************/
6627 bool lp_canonicalize_parameter(const char *parm_name
, const char **canon_parm
,
6632 if (!lp_parameter_is_valid(parm_name
)) {
6637 num
= map_parameter_canonical(parm_name
, inverse
);
6639 /* parametric option */
6640 *canon_parm
= parm_name
;
6642 *canon_parm
= parm_table
[num
].label
;
6649 /**************************************************************************
6650 Determine the canonical name for a parameter.
6651 Turn the value given into the inverse boolean expression when
6652 the synonym is an invers boolean synonym.
6654 Return True if parm_name is a valid parameter name and
6655 in case it is an invers boolean synonym, if the val string could
6656 successfully be converted to the reverse bool.
6657 Return false in all other cases.
6658 **************************************************************************/
6660 bool lp_canonicalize_parameter_with_value(const char *parm_name
,
6662 const char **canon_parm
,
6663 const char **canon_val
)
6668 if (!lp_parameter_is_valid(parm_name
)) {
6674 num
= map_parameter_canonical(parm_name
, &inverse
);
6676 /* parametric option */
6677 *canon_parm
= parm_name
;
6680 *canon_parm
= parm_table
[num
].label
;
6682 if (!lp_invert_boolean(val
, canon_val
)) {
6694 /***************************************************************************
6695 Map a parameter's string representation to something we can use.
6696 Returns False if the parameter string is not recognised, else TRUE.
6697 ***************************************************************************/
6699 static int map_parameter(const char *pszParmName
)
6703 if (*pszParmName
== '-' && !strequal(pszParmName
, "-valid"))
6706 for (iIndex
= 0; parm_table
[iIndex
].label
; iIndex
++)
6707 if (strwicmp(parm_table
[iIndex
].label
, pszParmName
) == 0)
6710 /* Warn only if it isn't parametric option */
6711 if (strchr(pszParmName
, ':') == NULL
)
6712 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName
));
6713 /* We do return 'fail' for parametric options as well because they are
6714 stored in different storage
6719 /***************************************************************************
6720 Map a parameter's string representation to the index of the canonical
6721 form of the parameter (it might be a synonym).
6722 Returns -1 if the parameter string is not recognised.
6723 ***************************************************************************/
6725 static int map_parameter_canonical(const char *pszParmName
, bool *inverse
)
6727 int parm_num
, canon_num
;
6728 bool loc_inverse
= False
;
6730 parm_num
= map_parameter(pszParmName
);
6731 if ((parm_num
< 0) || !(parm_table
[parm_num
].flags
& FLAG_HIDE
)) {
6732 /* invalid, parametric or no canidate for synonyms ... */
6736 for (canon_num
= 0; parm_table
[canon_num
].label
; canon_num
++) {
6737 if (is_synonym_of(parm_num
, canon_num
, &loc_inverse
)) {
6738 parm_num
= canon_num
;
6744 if (inverse
!= NULL
) {
6745 *inverse
= loc_inverse
;
6750 /***************************************************************************
6751 return true if parameter number parm1 is a synonym of parameter
6752 number parm2 (parm2 being the principal name).
6753 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6755 ***************************************************************************/
6757 static bool is_synonym_of(int parm1
, int parm2
, bool *inverse
)
6759 if ((parm_table
[parm1
].ptr
== parm_table
[parm2
].ptr
) &&
6760 (parm_table
[parm1
].flags
& FLAG_HIDE
) &&
6761 !(parm_table
[parm2
].flags
& FLAG_HIDE
))
6763 if (inverse
!= NULL
) {
6764 if ((parm_table
[parm1
].type
== P_BOOLREV
) &&
6765 (parm_table
[parm2
].type
== P_BOOL
))
6777 /***************************************************************************
6778 Show one parameter's name, type, [values,] and flags.
6779 (helper functions for show_parameter_list)
6780 ***************************************************************************/
6782 static void show_parameter(int parmIndex
)
6784 int enumIndex
, flagIndex
;
6789 const char *type
[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6790 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6792 unsigned flags
[] = { FLAG_BASIC
, FLAG_SHARE
, FLAG_PRINT
, FLAG_GLOBAL
,
6793 FLAG_WIZARD
, FLAG_ADVANCED
, FLAG_DEVELOPER
, FLAG_DEPRECATED
,
6794 FLAG_HIDE
, FLAG_DOS_STRING
};
6795 const char *flag_names
[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6796 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6797 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL
};
6799 printf("%s=%s", parm_table
[parmIndex
].label
,
6800 type
[parm_table
[parmIndex
].type
]);
6801 if (parm_table
[parmIndex
].type
== P_ENUM
) {
6804 parm_table
[parmIndex
].enum_list
[enumIndex
].name
;
6808 enumIndex
? "|" : "",
6809 parm_table
[parmIndex
].enum_list
[enumIndex
].name
);
6814 for (flagIndex
=0; flag_names
[flagIndex
]; flagIndex
++) {
6815 if (parm_table
[parmIndex
].flags
& flags
[flagIndex
]) {
6818 flag_names
[flagIndex
]);
6823 /* output synonyms */
6825 for (parmIndex2
=0; parm_table
[parmIndex2
].label
; parmIndex2
++) {
6826 if (is_synonym_of(parmIndex
, parmIndex2
, &inverse
)) {
6827 printf(" (%ssynonym of %s)", inverse
? "inverse " : "",
6828 parm_table
[parmIndex2
].label
);
6829 } else if (is_synonym_of(parmIndex2
, parmIndex
, &inverse
)) {
6831 printf(" (synonyms: ");
6836 printf("%s%s", parm_table
[parmIndex2
].label
,
6837 inverse
? "[i]" : "");
6847 /***************************************************************************
6848 Show all parameter's name, type, [values,] and flags.
6849 ***************************************************************************/
6851 void show_parameter_list(void)
6853 int classIndex
, parmIndex
;
6854 const char *section_names
[] = { "local", "global", NULL
};
6856 for (classIndex
=0; section_names
[classIndex
]; classIndex
++) {
6857 printf("[%s]\n", section_names
[classIndex
]);
6858 for (parmIndex
= 0; parm_table
[parmIndex
].label
; parmIndex
++) {
6859 if (parm_table
[parmIndex
].p_class
== classIndex
) {
6860 show_parameter(parmIndex
);
6866 /***************************************************************************
6867 Check if a given string correctly represents a boolean value.
6868 ***************************************************************************/
6870 bool lp_string_is_valid_boolean(const char *parm_value
)
6872 return set_boolean(parm_value
, NULL
);
6875 /***************************************************************************
6876 Get the standard string representation of a boolean value ("yes" or "no")
6877 ***************************************************************************/
6879 static const char *get_boolean(bool bool_value
)
6881 static const char *yes_str
= "yes";
6882 static const char *no_str
= "no";
6884 return (bool_value
? yes_str
: no_str
);
6887 /***************************************************************************
6888 Provide the string of the negated boolean value associated to the boolean
6889 given as a string. Returns False if the passed string does not correctly
6890 represent a boolean.
6891 ***************************************************************************/
6893 bool lp_invert_boolean(const char *str
, const char **inverse_str
)
6897 if (!set_boolean(str
, &val
)) {
6901 *inverse_str
= get_boolean(!val
);
6905 /***************************************************************************
6906 Provide the canonical string representation of a boolean value given
6907 as a string. Return True on success, False if the string given does
6908 not correctly represent a boolean.
6909 ***************************************************************************/
6911 bool lp_canonicalize_boolean(const char *str
, const char**canon_str
)
6915 if (!set_boolean(str
, &val
)) {
6919 *canon_str
= get_boolean(val
);
6923 /***************************************************************************
6924 Find a service by name. Otherwise works like get_service.
6925 ***************************************************************************/
6927 static int getservicebyname(const char *pszServiceName
, struct service
*pserviceDest
)
6933 if (ServiceHash
== NULL
) {
6937 canon_name
= canonicalize_servicename(talloc_tos(), pszServiceName
);
6939 data
= dbwrap_fetch_bystring(ServiceHash
, canon_name
, canon_name
);
6941 if ((data
.dptr
!= NULL
) && (data
.dsize
== sizeof(iService
))) {
6942 iService
= *(int *)data
.dptr
;
6945 TALLOC_FREE(canon_name
);
6947 if ((iService
!= -1) && (LP_SNUM_OK(iService
))
6948 && (pserviceDest
!= NULL
)) {
6949 copy_service(pserviceDest
, ServicePtrs
[iService
], NULL
);
6955 /***************************************************************************
6956 Copy a service structure to another.
6957 If pcopymapDest is NULL then copy all fields
6958 ***************************************************************************/
6961 * Add a parametric option to a param_opt_struct,
6962 * replacing old value, if already present.
6964 static void set_param_opt(struct param_opt_struct
**opt_list
,
6965 const char *opt_name
,
6966 const char *opt_value
,
6969 struct param_opt_struct
*new_opt
, *opt
;
6972 if (opt_list
== NULL
) {
6979 /* Traverse destination */
6981 /* If we already have same option, override it */
6982 if (strwicmp(opt
->key
, opt_name
) == 0) {
6983 if ((opt
->flags
& FLAG_CMDLINE
) &&
6984 !(flags
& FLAG_CMDLINE
)) {
6985 /* it's been marked as not to be
6989 string_free(&opt
->value
);
6990 TALLOC_FREE(opt
->list
);
6991 opt
->value
= SMB_STRDUP(opt_value
);
6999 new_opt
= SMB_XMALLOC_P(struct param_opt_struct
);
7000 new_opt
->key
= SMB_STRDUP(opt_name
);
7001 new_opt
->value
= SMB_STRDUP(opt_value
);
7002 new_opt
->list
= NULL
;
7003 new_opt
->flags
= flags
;
7004 DLIST_ADD(*opt_list
, new_opt
);
7008 static void copy_service(struct service
*pserviceDest
, struct service
*pserviceSource
,
7009 struct bitmap
*pcopymapDest
)
7012 bool bcopyall
= (pcopymapDest
== NULL
);
7013 struct param_opt_struct
*data
;
7015 for (i
= 0; parm_table
[i
].label
; i
++)
7016 if (parm_table
[i
].ptr
&& parm_table
[i
].p_class
== P_LOCAL
&&
7017 (bcopyall
|| bitmap_query(pcopymapDest
,i
))) {
7018 void *def_ptr
= parm_table
[i
].ptr
;
7020 ((char *)pserviceSource
) + PTR_DIFF(def_ptr
,
7023 ((char *)pserviceDest
) + PTR_DIFF(def_ptr
,
7026 switch (parm_table
[i
].type
) {
7029 *(bool *)dest_ptr
= *(bool *)src_ptr
;
7035 *(int *)dest_ptr
= *(int *)src_ptr
;
7039 *(char *)dest_ptr
= *(char *)src_ptr
;
7043 string_set((char **)dest_ptr
,
7048 string_set((char **)dest_ptr
,
7050 strupper_m(*(char **)dest_ptr
);
7053 TALLOC_FREE(*((char ***)dest_ptr
));
7054 *((char ***)dest_ptr
) = str_list_copy(NULL
,
7055 *(const char ***)src_ptr
);
7063 init_copymap(pserviceDest
);
7064 if (pserviceSource
->copymap
)
7065 bitmap_copy(pserviceDest
->copymap
,
7066 pserviceSource
->copymap
);
7069 data
= pserviceSource
->param_opt
;
7071 set_param_opt(&pserviceDest
->param_opt
, data
->key
, data
->value
, data
->flags
);
7076 /***************************************************************************
7077 Check a service for consistency. Return False if the service is in any way
7078 incomplete or faulty, else True.
7079 ***************************************************************************/
7081 bool service_ok(int iService
)
7086 if (ServicePtrs
[iService
]->szService
[0] == '\0') {
7087 DEBUG(0, ("The following message indicates an internal error:\n"));
7088 DEBUG(0, ("No service name in service entry.\n"));
7092 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
7093 /* I can't see why you'd want a non-printable printer service... */
7094 if (strwicmp(ServicePtrs
[iService
]->szService
, PRINTERS_NAME
) == 0) {
7095 if (!ServicePtrs
[iService
]->bPrint_ok
) {
7096 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
7097 ServicePtrs
[iService
]->szService
));
7098 ServicePtrs
[iService
]->bPrint_ok
= True
;
7100 /* [printers] service must also be non-browsable. */
7101 if (ServicePtrs
[iService
]->bBrowseable
)
7102 ServicePtrs
[iService
]->bBrowseable
= False
;
7105 if (ServicePtrs
[iService
]->szPath
[0] == '\0' &&
7106 strwicmp(ServicePtrs
[iService
]->szService
, HOMES_NAME
) != 0 &&
7107 ServicePtrs
[iService
]->szMSDfsProxy
[0] == '\0'
7109 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
7110 ServicePtrs
[iService
]->szService
));
7111 ServicePtrs
[iService
]->bAvailable
= False
;
7114 /* If a service is flagged unavailable, log the fact at level 1. */
7115 if (!ServicePtrs
[iService
]->bAvailable
)
7116 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
7117 ServicePtrs
[iService
]->szService
));
7122 static struct smbconf_ctx
*lp_smbconf_ctx(void)
7125 static struct smbconf_ctx
*conf_ctx
= NULL
;
7127 if (conf_ctx
== NULL
) {
7128 werr
= smbconf_init(NULL
, &conf_ctx
, "registry:");
7129 if (!W_ERROR_IS_OK(werr
)) {
7130 DEBUG(1, ("error initializing registry configuration: "
7131 "%s\n", win_errstr(werr
)));
7139 static bool process_smbconf_service(struct smbconf_service
*service
)
7144 if (service
== NULL
) {
7148 ret
= do_section(service
->name
, NULL
);
7152 for (count
= 0; count
< service
->num_params
; count
++) {
7153 ret
= do_parameter(service
->param_names
[count
],
7154 service
->param_values
[count
],
7160 if (iServiceIndex
>= 0) {
7161 return service_ok(iServiceIndex
);
7167 * load a service from registry and activate it
7169 bool process_registry_service(const char *service_name
)
7172 struct smbconf_service
*service
= NULL
;
7173 TALLOC_CTX
*mem_ctx
= talloc_stackframe();
7174 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
7177 if (conf_ctx
== NULL
) {
7181 DEBUG(5, ("process_registry_service: service name %s\n", service_name
));
7183 if (!smbconf_share_exists(conf_ctx
, service_name
)) {
7185 * Registry does not contain data for this service (yet),
7186 * but make sure lp_load doesn't return false.
7192 werr
= smbconf_get_share(conf_ctx
, mem_ctx
, service_name
, &service
);
7193 if (!W_ERROR_IS_OK(werr
)) {
7197 ret
= process_smbconf_service(service
);
7203 smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
, NULL
);
7206 TALLOC_FREE(mem_ctx
);
7211 * process_registry_globals
7213 static bool process_registry_globals(void)
7217 add_to_file_list(INCLUDE_REGISTRY_NAME
, INCLUDE_REGISTRY_NAME
);
7219 ret
= do_parameter("registry shares", "yes", NULL
);
7224 return process_registry_service(GLOBAL_NAME
);
7227 bool process_registry_shares(void)
7231 struct smbconf_service
**service
= NULL
;
7232 uint32_t num_shares
= 0;
7233 TALLOC_CTX
*mem_ctx
= talloc_stackframe();
7234 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
7237 if (conf_ctx
== NULL
) {
7241 werr
= smbconf_get_config(conf_ctx
, mem_ctx
, &num_shares
, &service
);
7242 if (!W_ERROR_IS_OK(werr
)) {
7248 for (count
= 0; count
< num_shares
; count
++) {
7249 if (strequal(service
[count
]->name
, GLOBAL_NAME
)) {
7252 ret
= process_smbconf_service(service
[count
]);
7259 smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
, NULL
);
7262 TALLOC_FREE(mem_ctx
);
7266 #define MAX_INCLUDE_DEPTH 100
7268 static uint8_t include_depth
;
7270 static struct file_lists
{
7271 struct file_lists
*next
;
7275 } *file_lists
= NULL
;
7277 /*******************************************************************
7278 Keep a linked list of all config files so we know when one has changed
7279 it's date and needs to be reloaded.
7280 ********************************************************************/
7282 static void add_to_file_list(const char *fname
, const char *subfname
)
7284 struct file_lists
*f
= file_lists
;
7287 if (f
->name
&& !strcmp(f
->name
, fname
))
7293 f
= SMB_MALLOC_P(struct file_lists
);
7296 f
->next
= file_lists
;
7297 f
->name
= SMB_STRDUP(fname
);
7302 f
->subfname
= SMB_STRDUP(subfname
);
7309 f
->modtime
= file_modtime(subfname
);
7311 time_t t
= file_modtime(subfname
);
7319 * Free the file lists
7321 static void free_file_list(void)
7323 struct file_lists
*f
;
7324 struct file_lists
*next
;
7329 SAFE_FREE( f
->name
);
7330 SAFE_FREE( f
->subfname
);
7339 * Utility function for outsiders to check if we're running on registry.
7341 bool lp_config_backend_is_registry(void)
7343 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY
);
7347 * Utility function to check if the config backend is FILE.
7349 bool lp_config_backend_is_file(void)
7351 return (lp_config_backend() == CONFIG_BACKEND_FILE
);
7354 /*******************************************************************
7355 Check if a config file has changed date.
7356 ********************************************************************/
7358 bool lp_file_list_changed(void)
7360 struct file_lists
*f
= file_lists
;
7362 DEBUG(6, ("lp_file_list_changed()\n"));
7367 if (strequal(f
->name
, INCLUDE_REGISTRY_NAME
)) {
7368 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
7370 if (conf_ctx
== NULL
) {
7373 if (smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
,
7376 DEBUGADD(6, ("registry config changed\n"));
7381 n2
= talloc_sub_basic(talloc_tos(),
7382 get_current_username(),
7383 current_user_info
.domain
,
7388 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
7389 f
->name
, n2
, ctime(&f
->modtime
)));
7391 mod_time
= file_modtime(n2
);
7394 ((f
->modtime
!= mod_time
) ||
7395 (f
->subfname
== NULL
) ||
7396 (strcmp(n2
, f
->subfname
) != 0)))
7399 ("file %s modified: %s\n", n2
,
7401 f
->modtime
= mod_time
;
7402 SAFE_FREE(f
->subfname
);
7403 f
->subfname
= SMB_STRDUP(n2
);
7415 /***************************************************************************
7416 Run standard_sub_basic on netbios name... needed because global_myname
7417 is not accessed through any lp_ macro.
7418 Note: We must *NOT* use string_set() here as ptr points to global_myname.
7419 ***************************************************************************/
7421 static bool handle_netbios_name(int snum
, const char *pszParmValue
, char **ptr
)
7424 char *netbios_name
= talloc_sub_basic(
7425 talloc_tos(), get_current_username(), current_user_info
.domain
,
7428 ret
= set_global_myname(netbios_name
);
7429 TALLOC_FREE(netbios_name
);
7430 string_set(&Globals
.szNetbiosName
,global_myname());
7432 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
7438 static bool handle_charset(int snum
, const char *pszParmValue
, char **ptr
)
7440 if (strcmp(*ptr
, pszParmValue
) != 0) {
7441 string_set(ptr
, pszParmValue
);
7449 static bool handle_workgroup(int snum
, const char *pszParmValue
, char **ptr
)
7453 ret
= set_global_myworkgroup(pszParmValue
);
7454 string_set(&Globals
.szWorkgroup
,lp_workgroup());
7459 static bool handle_netbios_scope(int snum
, const char *pszParmValue
, char **ptr
)
7463 ret
= set_global_scope(pszParmValue
);
7464 string_set(&Globals
.szNetbiosScope
,global_scope());
7469 static bool handle_netbios_aliases(int snum
, const char *pszParmValue
, char **ptr
)
7471 TALLOC_FREE(Globals
.szNetbiosAliases
);
7472 Globals
.szNetbiosAliases
= str_list_make_v3(NULL
, pszParmValue
, NULL
);
7473 return set_netbios_aliases((const char **)Globals
.szNetbiosAliases
);
7476 /***************************************************************************
7477 Handle the include operation.
7478 ***************************************************************************/
7479 static bool bAllowIncludeRegistry
= true;
7481 static bool handle_include(int snum
, const char *pszParmValue
, char **ptr
)
7485 if (include_depth
>= MAX_INCLUDE_DEPTH
) {
7486 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7491 if (strequal(pszParmValue
, INCLUDE_REGISTRY_NAME
)) {
7492 if (!bAllowIncludeRegistry
) {
7495 if (bInGlobalSection
) {
7498 ret
= process_registry_globals();
7502 DEBUG(1, ("\"include = registry\" only effective "
7503 "in %s section\n", GLOBAL_NAME
));
7508 fname
= talloc_sub_basic(talloc_tos(), get_current_username(),
7509 current_user_info
.domain
,
7512 add_to_file_list(pszParmValue
, fname
);
7514 string_set(ptr
, fname
);
7516 if (file_exist(fname
)) {
7519 ret
= pm_process(fname
, do_section
, do_parameter
, NULL
);
7525 DEBUG(2, ("Can't find include file %s\n", fname
));
7530 /***************************************************************************
7531 Handle the interpretation of the copy parameter.
7532 ***************************************************************************/
7534 static bool handle_copy(int snum
, const char *pszParmValue
, char **ptr
)
7538 struct service serviceTemp
;
7540 string_set(ptr
, pszParmValue
);
7542 init_service(&serviceTemp
);
7546 DEBUG(3, ("Copying service from service %s\n", pszParmValue
));
7548 if ((iTemp
= getservicebyname(pszParmValue
, &serviceTemp
)) >= 0) {
7549 if (iTemp
== iServiceIndex
) {
7550 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue
));
7552 copy_service(ServicePtrs
[iServiceIndex
],
7554 ServicePtrs
[iServiceIndex
]->copymap
);
7558 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue
));
7562 free_service(&serviceTemp
);
7566 static bool handle_ldap_debug_level(int snum
, const char *pszParmValue
, char **ptr
)
7568 Globals
.ldap_debug_level
= lp_int(pszParmValue
);
7569 init_ldap_debugging();
7573 /***************************************************************************
7574 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7579 idmap uid = 1000-1999
7582 We only do simple parsing checks here. The strings are parsed into useful
7583 structures in the idmap daemon code.
7585 ***************************************************************************/
7587 /* Some lp_ routines to return idmap [ug]id information */
7589 static uid_t idmap_uid_low
, idmap_uid_high
;
7590 static gid_t idmap_gid_low
, idmap_gid_high
;
7592 bool lp_idmap_uid(uid_t
*low
, uid_t
*high
)
7594 if (idmap_uid_low
== 0 || idmap_uid_high
== 0)
7598 *low
= idmap_uid_low
;
7601 *high
= idmap_uid_high
;
7606 bool lp_idmap_gid(gid_t
*low
, gid_t
*high
)
7608 if (idmap_gid_low
== 0 || idmap_gid_high
== 0)
7612 *low
= idmap_gid_low
;
7615 *high
= idmap_gid_high
;
7620 /* Do some simple checks on "idmap [ug]id" parameter values */
7622 static bool handle_idmap_uid(int snum
, const char *pszParmValue
, char **ptr
)
7626 if (sscanf(pszParmValue
, "%u - %u", &low
, &high
) != 2 || high
< low
)
7631 string_set(ptr
, pszParmValue
);
7633 idmap_uid_low
= low
;
7634 idmap_uid_high
= high
;
7639 static bool handle_idmap_gid(int snum
, const char *pszParmValue
, char **ptr
)
7643 if (sscanf(pszParmValue
, "%u - %u", &low
, &high
) != 2 || high
< low
)
7648 string_set(ptr
, pszParmValue
);
7650 idmap_gid_low
= low
;
7651 idmap_gid_high
= high
;
7656 /***************************************************************************
7657 Handle the DEBUG level list.
7658 ***************************************************************************/
7660 static bool handle_debug_list( int snum
, const char *pszParmValueIn
, char **ptr
)
7662 string_set(ptr
, pszParmValueIn
);
7663 return debug_parse_levels(pszParmValueIn
);
7666 /***************************************************************************
7667 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7668 ***************************************************************************/
7670 static const char *append_ldap_suffix( const char *str
)
7672 const char *suffix_string
;
7675 suffix_string
= talloc_asprintf(talloc_tos(), "%s,%s", str
,
7676 Globals
.szLdapSuffix
);
7677 if ( !suffix_string
) {
7678 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7682 return suffix_string
;
7685 const char *lp_ldap_machine_suffix(void)
7687 if (Globals
.szLdapMachineSuffix
[0])
7688 return append_ldap_suffix(Globals
.szLdapMachineSuffix
);
7690 return lp_string(Globals
.szLdapSuffix
);
7693 const char *lp_ldap_user_suffix(void)
7695 if (Globals
.szLdapUserSuffix
[0])
7696 return append_ldap_suffix(Globals
.szLdapUserSuffix
);
7698 return lp_string(Globals
.szLdapSuffix
);
7701 const char *lp_ldap_group_suffix(void)
7703 if (Globals
.szLdapGroupSuffix
[0])
7704 return append_ldap_suffix(Globals
.szLdapGroupSuffix
);
7706 return lp_string(Globals
.szLdapSuffix
);
7709 const char *lp_ldap_idmap_suffix(void)
7711 if (Globals
.szLdapIdmapSuffix
[0])
7712 return append_ldap_suffix(Globals
.szLdapIdmapSuffix
);
7714 return lp_string(Globals
.szLdapSuffix
);
7717 /****************************************************************************
7718 set the value for a P_ENUM
7719 ***************************************************************************/
7721 static void lp_set_enum_parm( struct parm_struct
*parm
, const char *pszParmValue
,
7726 for (i
= 0; parm
->enum_list
[i
].name
; i
++) {
7727 if ( strequal(pszParmValue
, parm
->enum_list
[i
].name
)) {
7728 *ptr
= parm
->enum_list
[i
].value
;
7732 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7733 pszParmValue
, parm
->label
));
7736 /***************************************************************************
7737 ***************************************************************************/
7739 static bool handle_printing(int snum
, const char *pszParmValue
, char **ptr
)
7741 static int parm_num
= -1;
7744 if ( parm_num
== -1 )
7745 parm_num
= map_parameter( "printing" );
7747 lp_set_enum_parm( &parm_table
[parm_num
], pszParmValue
, (int*)ptr
);
7752 s
= ServicePtrs
[snum
];
7754 init_printer_values( s
);
7760 /***************************************************************************
7761 Initialise a copymap.
7762 ***************************************************************************/
7764 static void init_copymap(struct service
*pservice
)
7768 TALLOC_FREE(pservice
->copymap
);
7770 pservice
->copymap
= bitmap_talloc(NULL
, NUMPARAMETERS
);
7771 if (!pservice
->copymap
)
7773 ("Couldn't allocate copymap!! (size %d)\n",
7774 (int)NUMPARAMETERS
));
7776 for (i
= 0; i
< NUMPARAMETERS
; i
++)
7777 bitmap_set(pservice
->copymap
, i
);
7780 /***************************************************************************
7781 Return the local pointer to a parameter given a service struct and the
7782 pointer into the default structure.
7783 ***************************************************************************/
7785 static void *lp_local_ptr(struct service
*service
, void *ptr
)
7787 return (void *)(((char *)service
) + PTR_DIFF(ptr
, &sDefault
));
7790 /***************************************************************************
7791 Return the local pointer to a parameter given the service number and the
7792 pointer into the default structure.
7793 ***************************************************************************/
7795 void *lp_local_ptr_by_snum(int snum
, void *ptr
)
7797 return lp_local_ptr(ServicePtrs
[snum
], ptr
);
7800 /***************************************************************************
7801 Process a parameter for a particular service number. If snum < 0
7802 then assume we are in the globals.
7803 ***************************************************************************/
7805 bool lp_do_parameter(int snum
, const char *pszParmName
, const char *pszParmValue
)
7808 void *parm_ptr
= NULL
; /* where we are going to store the result */
7809 void *def_ptr
= NULL
;
7810 struct param_opt_struct
**opt_list
;
7812 parmnum
= map_parameter(pszParmName
);
7815 if (strchr(pszParmName
, ':') == NULL
) {
7816 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7822 * We've got a parametric option
7825 opt_list
= (snum
< 0)
7826 ? &Globals
.param_opt
: &ServicePtrs
[snum
]->param_opt
;
7827 set_param_opt(opt_list
, pszParmName
, pszParmValue
, 0);
7832 /* if it's already been set by the command line, then we don't
7834 if (parm_table
[parmnum
].flags
& FLAG_CMDLINE
) {
7838 if (parm_table
[parmnum
].flags
& FLAG_DEPRECATED
) {
7839 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7843 def_ptr
= parm_table
[parmnum
].ptr
;
7845 /* we might point at a service, the default service or a global */
7849 if (parm_table
[parmnum
].p_class
== P_GLOBAL
) {
7851 ("Global parameter %s found in service section!\n",
7855 parm_ptr
= lp_local_ptr_by_snum(snum
, def_ptr
);
7859 if (!ServicePtrs
[snum
]->copymap
)
7860 init_copymap(ServicePtrs
[snum
]);
7862 /* this handles the aliases - set the copymap for other entries with
7863 the same data pointer */
7864 for (i
= 0; parm_table
[i
].label
; i
++)
7865 if (parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
)
7866 bitmap_clear(ServicePtrs
[snum
]->copymap
, i
);
7869 /* if it is a special case then go ahead */
7870 if (parm_table
[parmnum
].special
) {
7871 return parm_table
[parmnum
].special(snum
, pszParmValue
,
7875 /* now switch on the type of variable it is */
7876 switch (parm_table
[parmnum
].type
)
7879 *(bool *)parm_ptr
= lp_bool(pszParmValue
);
7883 *(bool *)parm_ptr
= !lp_bool(pszParmValue
);
7887 *(int *)parm_ptr
= lp_int(pszParmValue
);
7891 *(char *)parm_ptr
= *pszParmValue
;
7895 i
= sscanf(pszParmValue
, "%o", (int *)parm_ptr
);
7897 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName
));
7902 TALLOC_FREE(*((char ***)parm_ptr
));
7903 *(char ***)parm_ptr
= str_list_make_v3(
7904 NULL
, pszParmValue
, NULL
);
7908 string_set((char **)parm_ptr
, pszParmValue
);
7912 string_set((char **)parm_ptr
, pszParmValue
);
7913 strupper_m(*(char **)parm_ptr
);
7917 lp_set_enum_parm( &parm_table
[parmnum
], pszParmValue
, (int*)parm_ptr
);
7926 /***************************************************************************
7927 set a parameter, marking it with FLAG_CMDLINE. Parameters marked as
7928 FLAG_CMDLINE won't be overridden by loads from smb.conf.
7929 ***************************************************************************/
7931 static bool lp_set_cmdline_helper(const char *pszParmName
, const char *pszParmValue
, bool store_values
)
7934 parmnum
= map_parameter(pszParmName
);
7936 parm_table
[parmnum
].flags
&= ~FLAG_CMDLINE
;
7937 if (!lp_do_parameter(-1, pszParmName
, pszParmValue
)) {
7940 parm_table
[parmnum
].flags
|= FLAG_CMDLINE
;
7942 /* we have to also set FLAG_CMDLINE on aliases. Aliases must
7943 * be grouped in the table, so we don't have to search the
7945 for (i
=parmnum
-1;i
>=0 && parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
;i
--) {
7946 parm_table
[i
].flags
|= FLAG_CMDLINE
;
7948 for (i
=parmnum
+1;i
<NUMPARAMETERS
&& parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
;i
++) {
7949 parm_table
[i
].flags
|= FLAG_CMDLINE
;
7953 store_lp_set_cmdline(pszParmName
, pszParmValue
);
7958 /* it might be parametric */
7959 if (strchr(pszParmName
, ':') != NULL
) {
7960 set_param_opt(&Globals
.param_opt
, pszParmName
, pszParmValue
, FLAG_CMDLINE
);
7962 store_lp_set_cmdline(pszParmName
, pszParmValue
);
7967 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName
));
7971 bool lp_set_cmdline(const char *pszParmName
, const char *pszParmValue
)
7973 return lp_set_cmdline_helper(pszParmName
, pszParmValue
, true);
7976 /***************************************************************************
7977 Process a parameter.
7978 ***************************************************************************/
7980 static bool do_parameter(const char *pszParmName
, const char *pszParmValue
,
7983 if (!bInGlobalSection
&& bGlobalOnly
)
7986 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName
, pszParmValue
));
7988 return (lp_do_parameter(bInGlobalSection
? -2 : iServiceIndex
,
7989 pszParmName
, pszParmValue
));
7993 set a option from the commandline in 'a=b' format. Use to support --option
7995 bool lp_set_option(const char *option
)
8000 s
= talloc_strdup(NULL
, option
);
8013 ret
= lp_set_cmdline(s
, p
+1);
8018 /**************************************************************************
8019 Print a parameter of the specified type.
8020 ***************************************************************************/
8022 static void print_parameter(struct parm_struct
*p
, void *ptr
, FILE * f
)
8028 for (i
= 0; p
->enum_list
[i
].name
; i
++) {
8029 if (*(int *)ptr
== p
->enum_list
[i
].value
) {
8031 p
->enum_list
[i
].name
);
8038 fprintf(f
, "%s", BOOLSTR(*(bool *)ptr
));
8042 fprintf(f
, "%s", BOOLSTR(!*(bool *)ptr
));
8046 fprintf(f
, "%d", *(int *)ptr
);
8050 fprintf(f
, "%c", *(char *)ptr
);
8054 char *o
= octal_string(*(int *)ptr
);
8055 fprintf(f
, "%s", o
);
8061 if ((char ***)ptr
&& *(char ***)ptr
) {
8062 char **list
= *(char ***)ptr
;
8063 for (; *list
; list
++) {
8064 /* surround strings with whitespace in double quotes */
8065 if ( strchr_m( *list
, ' ' ) )
8066 fprintf(f
, "\"%s\"%s", *list
, ((*(list
+1))?", ":""));
8068 fprintf(f
, "%s%s", *list
, ((*(list
+1))?", ":""));
8075 if (*(char **)ptr
) {
8076 fprintf(f
, "%s", *(char **)ptr
);
8084 /***************************************************************************
8085 Check if two parameters are equal.
8086 ***************************************************************************/
8088 static bool equal_parameter(parm_type type
, void *ptr1
, void *ptr2
)
8093 return (*((bool *)ptr1
) == *((bool *)ptr2
));
8098 return (*((int *)ptr1
) == *((int *)ptr2
));
8101 return (*((char *)ptr1
) == *((char *)ptr2
));
8104 return str_list_equal(*(const char ***)ptr1
, *(const char ***)ptr2
);
8109 char *p1
= *(char **)ptr1
, *p2
= *(char **)ptr2
;
8114 return (p1
== p2
|| strequal(p1
, p2
));
8122 /***************************************************************************
8123 Initialize any local varients in the sDefault table.
8124 ***************************************************************************/
8126 void init_locals(void)
8131 /***************************************************************************
8132 Process a new section (service). At this stage all sections are services.
8133 Later we'll have special sections that permit server parameters to be set.
8134 Returns True on success, False on failure.
8135 ***************************************************************************/
8137 static bool do_section(const char *pszSectionName
, void *userdata
)
8140 bool isglobal
= ((strwicmp(pszSectionName
, GLOBAL_NAME
) == 0) ||
8141 (strwicmp(pszSectionName
, GLOBAL_NAME2
) == 0));
8144 /* if we were in a global section then do the local inits */
8145 if (bInGlobalSection
&& !isglobal
)
8148 /* if we've just struck a global section, note the fact. */
8149 bInGlobalSection
= isglobal
;
8151 /* check for multiple global sections */
8152 if (bInGlobalSection
) {
8153 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName
));
8157 if (!bInGlobalSection
&& bGlobalOnly
)
8160 /* if we have a current service, tidy it up before moving on */
8163 if (iServiceIndex
>= 0)
8164 bRetval
= service_ok(iServiceIndex
);
8166 /* if all is still well, move to the next record in the services array */
8168 /* We put this here to avoid an odd message order if messages are */
8169 /* issued by the post-processing of a previous section. */
8170 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName
));
8172 if ((iServiceIndex
= add_a_service(&sDefault
, pszSectionName
))
8174 DEBUG(0, ("Failed to add a new service\n"));
8177 /* Clean all parametric options for service */
8178 /* They will be added during parsing again */
8179 free_param_opts(&ServicePtrs
[iServiceIndex
]->param_opt
);
8186 /***************************************************************************
8187 Determine if a partcular base parameter is currentl set to the default value.
8188 ***************************************************************************/
8190 static bool is_default(int i
)
8192 if (!defaults_saved
)
8194 switch (parm_table
[i
].type
) {
8196 return str_list_equal((const char **)parm_table
[i
].def
.lvalue
,
8197 *(const char ***)parm_table
[i
].ptr
);
8200 return strequal(parm_table
[i
].def
.svalue
,
8201 *(char **)parm_table
[i
].ptr
);
8204 return parm_table
[i
].def
.bvalue
==
8205 *(bool *)parm_table
[i
].ptr
;
8207 return parm_table
[i
].def
.cvalue
==
8208 *(char *)parm_table
[i
].ptr
;
8212 return parm_table
[i
].def
.ivalue
==
8213 *(int *)parm_table
[i
].ptr
;
8220 /***************************************************************************
8221 Display the contents of the global structure.
8222 ***************************************************************************/
8224 static void dump_globals(FILE *f
)
8227 struct param_opt_struct
*data
;
8229 fprintf(f
, "[global]\n");
8231 for (i
= 0; parm_table
[i
].label
; i
++)
8232 if (parm_table
[i
].p_class
== P_GLOBAL
&&
8233 !(parm_table
[i
].flags
& FLAG_META
) &&
8234 parm_table
[i
].ptr
&&
8235 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
))) {
8236 if (defaults_saved
&& is_default(i
))
8238 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
8239 print_parameter(&parm_table
[i
], parm_table
[i
].ptr
, f
);
8242 if (Globals
.param_opt
!= NULL
) {
8243 data
= Globals
.param_opt
;
8245 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
8252 /***************************************************************************
8253 Return True if a local parameter is currently set to the global default.
8254 ***************************************************************************/
8256 bool lp_is_default(int snum
, struct parm_struct
*parm
)
8258 int pdiff
= PTR_DIFF(parm
->ptr
, &sDefault
);
8260 return equal_parameter(parm
->type
,
8261 ((char *)ServicePtrs
[snum
]) + pdiff
,
8262 ((char *)&sDefault
) + pdiff
);
8265 /***************************************************************************
8266 Display the contents of a single services record.
8267 ***************************************************************************/
8269 static void dump_a_service(struct service
*pService
, FILE * f
)
8272 struct param_opt_struct
*data
;
8274 if (pService
!= &sDefault
)
8275 fprintf(f
, "[%s]\n", pService
->szService
);
8277 for (i
= 0; parm_table
[i
].label
; i
++) {
8279 if (parm_table
[i
].p_class
== P_LOCAL
&&
8280 !(parm_table
[i
].flags
& FLAG_META
) &&
8281 parm_table
[i
].ptr
&&
8282 (*parm_table
[i
].label
!= '-') &&
8283 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
8285 int pdiff
= PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
8287 if (pService
== &sDefault
) {
8288 if (defaults_saved
&& is_default(i
))
8291 if (equal_parameter(parm_table
[i
].type
,
8292 ((char *)pService
) +
8294 ((char *)&sDefault
) +
8299 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
8300 print_parameter(&parm_table
[i
],
8301 ((char *)pService
) + pdiff
, f
);
8306 if (pService
->param_opt
!= NULL
) {
8307 data
= pService
->param_opt
;
8309 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
8315 /***************************************************************************
8316 Display the contents of a parameter of a single services record.
8317 ***************************************************************************/
8319 bool dump_a_parameter(int snum
, char *parm_name
, FILE * f
, bool isGlobal
)
8322 bool result
= False
;
8325 fstring local_parm_name
;
8327 const char *parm_opt_value
;
8329 /* check for parametrical option */
8330 fstrcpy( local_parm_name
, parm_name
);
8331 parm_opt
= strchr( local_parm_name
, ':');
8336 if (strlen(parm_opt
)) {
8337 parm_opt_value
= lp_parm_const_string( snum
,
8338 local_parm_name
, parm_opt
, NULL
);
8339 if (parm_opt_value
) {
8340 printf( "%s\n", parm_opt_value
);
8347 /* check for a key and print the value */
8354 for (i
= 0; parm_table
[i
].label
; i
++) {
8355 if (strwicmp(parm_table
[i
].label
, parm_name
) == 0 &&
8356 !(parm_table
[i
].flags
& FLAG_META
) &&
8357 (parm_table
[i
].p_class
== p_class
|| parm_table
[i
].flags
& flag
) &&
8358 parm_table
[i
].ptr
&&
8359 (*parm_table
[i
].label
!= '-') &&
8360 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
8365 ptr
= parm_table
[i
].ptr
;
8367 struct service
*pService
= ServicePtrs
[snum
];
8368 ptr
= ((char *)pService
) +
8369 PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
8372 print_parameter(&parm_table
[i
],
8383 /***************************************************************************
8384 Return info about the requested parameter (given as a string).
8385 Return NULL when the string is not a valid parameter name.
8386 ***************************************************************************/
8388 struct parm_struct
*lp_get_parameter(const char *param_name
)
8390 int num
= map_parameter(param_name
);
8396 return &parm_table
[num
];
8399 /***************************************************************************
8400 Return info about the next parameter in a service.
8401 snum==GLOBAL_SECTION_SNUM gives the globals.
8402 Return NULL when out of parameters.
8403 ***************************************************************************/
8405 struct parm_struct
*lp_next_parameter(int snum
, int *i
, int allparameters
)
8408 /* do the globals */
8409 for (; parm_table
[*i
].label
; (*i
)++) {
8410 if (parm_table
[*i
].p_class
== P_SEPARATOR
)
8411 return &parm_table
[(*i
)++];
8413 if (!parm_table
[*i
].ptr
8414 || (*parm_table
[*i
].label
== '-'))
8418 && (parm_table
[*i
].ptr
==
8419 parm_table
[(*i
) - 1].ptr
))
8422 if (is_default(*i
) && !allparameters
)
8425 return &parm_table
[(*i
)++];
8428 struct service
*pService
= ServicePtrs
[snum
];
8430 for (; parm_table
[*i
].label
; (*i
)++) {
8431 if (parm_table
[*i
].p_class
== P_SEPARATOR
)
8432 return &parm_table
[(*i
)++];
8434 if (parm_table
[*i
].p_class
== P_LOCAL
&&
8435 parm_table
[*i
].ptr
&&
8436 (*parm_table
[*i
].label
!= '-') &&
8438 (parm_table
[*i
].ptr
!=
8439 parm_table
[(*i
) - 1].ptr
)))
8442 PTR_DIFF(parm_table
[*i
].ptr
,
8445 if (allparameters
||
8446 !equal_parameter(parm_table
[*i
].type
,
8447 ((char *)pService
) +
8449 ((char *)&sDefault
) +
8452 return &parm_table
[(*i
)++];
8463 /***************************************************************************
8464 Display the contents of a single copy structure.
8465 ***************************************************************************/
8466 static void dump_copy_map(bool *pcopymap
)
8472 printf("\n\tNon-Copied parameters:\n");
8474 for (i
= 0; parm_table
[i
].label
; i
++)
8475 if (parm_table
[i
].p_class
== P_LOCAL
&&
8476 parm_table
[i
].ptr
&& !pcopymap
[i
] &&
8477 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
8479 printf("\t\t%s\n", parm_table
[i
].label
);
8484 /***************************************************************************
8485 Return TRUE if the passed service number is within range.
8486 ***************************************************************************/
8488 bool lp_snum_ok(int iService
)
8490 return (LP_SNUM_OK(iService
) && ServicePtrs
[iService
]->bAvailable
);
8493 /***************************************************************************
8494 Auto-load some home services.
8495 ***************************************************************************/
8497 static void lp_add_auto_services(char *str
)
8507 s
= SMB_STRDUP(str
);
8511 homes
= lp_servicenumber(HOMES_NAME
);
8513 for (p
= strtok_r(s
, LIST_SEP
, &saveptr
); p
;
8514 p
= strtok_r(NULL
, LIST_SEP
, &saveptr
)) {
8517 if (lp_servicenumber(p
) >= 0)
8520 home
= get_user_home_dir(talloc_tos(), p
);
8522 if (home
&& home
[0] && homes
>= 0)
8523 lp_add_home(p
, homes
, p
, home
);
8530 /***************************************************************************
8531 Auto-load one printer.
8532 ***************************************************************************/
8534 void lp_add_one_printer(const char *name
, const char *comment
, void *pdata
)
8536 int printers
= lp_servicenumber(PRINTERS_NAME
);
8539 if (lp_servicenumber(name
) < 0) {
8540 lp_add_printer(name
, printers
);
8541 if ((i
= lp_servicenumber(name
)) >= 0) {
8542 string_set(&ServicePtrs
[i
]->comment
, comment
);
8543 ServicePtrs
[i
]->autoloaded
= True
;
8548 /***************************************************************************
8549 Have we loaded a services file yet?
8550 ***************************************************************************/
8552 bool lp_loaded(void)
8557 /***************************************************************************
8558 Unload unused services.
8559 ***************************************************************************/
8561 void lp_killunused(bool (*snumused
) (int))
8564 for (i
= 0; i
< iNumServices
; i
++) {
8568 /* don't kill autoloaded or usershare services */
8569 if ( ServicePtrs
[i
]->autoloaded
||
8570 ServicePtrs
[i
]->usershare
== USERSHARE_VALID
) {
8574 if (!snumused
|| !snumused(i
)) {
8575 free_service_byindex(i
);
8581 * Kill all except autoloaded and usershare services - convenience wrapper
8583 void lp_kill_all_services(void)
8585 lp_killunused(NULL
);
8588 /***************************************************************************
8590 ***************************************************************************/
8592 void lp_killservice(int iServiceIn
)
8594 if (VALID(iServiceIn
)) {
8595 free_service_byindex(iServiceIn
);
8599 /***************************************************************************
8600 Save the curent values of all global and sDefault parameters into the
8601 defaults union. This allows swat and testparm to show only the
8602 changed (ie. non-default) parameters.
8603 ***************************************************************************/
8605 static void lp_save_defaults(void)
8608 for (i
= 0; parm_table
[i
].label
; i
++) {
8609 if (i
> 0 && parm_table
[i
].ptr
== parm_table
[i
- 1].ptr
)
8611 switch (parm_table
[i
].type
) {
8613 parm_table
[i
].def
.lvalue
= str_list_copy(
8614 NULL
, *(const char ***)parm_table
[i
].ptr
);
8618 if (parm_table
[i
].ptr
) {
8619 parm_table
[i
].def
.svalue
= SMB_STRDUP(*(char **)parm_table
[i
].ptr
);
8621 parm_table
[i
].def
.svalue
= NULL
;
8626 parm_table
[i
].def
.bvalue
=
8627 *(bool *)parm_table
[i
].ptr
;
8630 parm_table
[i
].def
.cvalue
=
8631 *(char *)parm_table
[i
].ptr
;
8636 parm_table
[i
].def
.ivalue
=
8637 *(int *)parm_table
[i
].ptr
;
8643 defaults_saved
= True
;
8646 /***********************************************************
8647 If we should send plaintext/LANMAN passwords in the clinet
8648 ************************************************************/
8650 static void set_allowed_client_auth(void)
8652 if (Globals
.bClientNTLMv2Auth
) {
8653 Globals
.bClientLanManAuth
= False
;
8655 if (!Globals
.bClientLanManAuth
) {
8656 Globals
.bClientPlaintextAuth
= False
;
8660 /***************************************************************************
8662 The following code allows smbd to read a user defined share file.
8663 Yes, this is my intent. Yes, I'm comfortable with that...
8665 THE FOLLOWING IS SECURITY CRITICAL CODE.
8667 It washes your clothes, it cleans your house, it guards you while you sleep...
8668 Do not f%^k with it....
8669 ***************************************************************************/
8671 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8673 /***************************************************************************
8674 Check allowed stat state of a usershare file.
8675 Ensure we print out who is dicking with us so the admin can
8676 get their sorry ass fired.
8677 ***************************************************************************/
8679 static bool check_usershare_stat(const char *fname
,
8680 const SMB_STRUCT_STAT
*psbuf
)
8682 if (!S_ISREG(psbuf
->st_ex_mode
)) {
8683 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8684 "not a regular file\n",
8685 fname
, (unsigned int)psbuf
->st_ex_uid
));
8689 /* Ensure this doesn't have the other write bit set. */
8690 if (psbuf
->st_ex_mode
& S_IWOTH
) {
8691 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8692 "public write. Refusing to allow as a usershare file.\n",
8693 fname
, (unsigned int)psbuf
->st_ex_uid
));
8697 /* Should be 10k or less. */
8698 if (psbuf
->st_ex_size
> MAX_USERSHARE_FILE_SIZE
) {
8699 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8700 "too large (%u) to be a user share file.\n",
8701 fname
, (unsigned int)psbuf
->st_ex_uid
,
8702 (unsigned int)psbuf
->st_ex_size
));
8709 /***************************************************************************
8710 Parse the contents of a usershare file.
8711 ***************************************************************************/
8713 enum usershare_err
parse_usershare_file(TALLOC_CTX
*ctx
,
8714 SMB_STRUCT_STAT
*psbuf
,
8715 const char *servicename
,
8719 char **pp_sharepath
,
8721 char **pp_cp_servicename
,
8722 struct security_descriptor
**ppsd
,
8725 const char **prefixallowlist
= lp_usershare_prefix_allow_list();
8726 const char **prefixdenylist
= lp_usershare_prefix_deny_list();
8729 SMB_STRUCT_STAT sbuf
;
8730 char *sharepath
= NULL
;
8731 char *comment
= NULL
;
8733 *pp_sharepath
= NULL
;
8736 *pallow_guest
= False
;
8739 return USERSHARE_MALFORMED_FILE
;
8742 if (strcmp(lines
[0], "#VERSION 1") == 0) {
8744 } else if (strcmp(lines
[0], "#VERSION 2") == 0) {
8747 return USERSHARE_MALFORMED_FILE
;
8750 return USERSHARE_BAD_VERSION
;
8753 if (strncmp(lines
[1], "path=", 5) != 0) {
8754 return USERSHARE_MALFORMED_PATH
;
8757 sharepath
= talloc_strdup(ctx
, &lines
[1][5]);
8759 return USERSHARE_POSIX_ERR
;
8761 trim_string(sharepath
, " ", " ");
8763 if (strncmp(lines
[2], "comment=", 8) != 0) {
8764 return USERSHARE_MALFORMED_COMMENT_DEF
;
8767 comment
= talloc_strdup(ctx
, &lines
[2][8]);
8769 return USERSHARE_POSIX_ERR
;
8771 trim_string(comment
, " ", " ");
8772 trim_char(comment
, '"', '"');
8774 if (strncmp(lines
[3], "usershare_acl=", 14) != 0) {
8775 return USERSHARE_MALFORMED_ACL_DEF
;
8778 if (!parse_usershare_acl(ctx
, &lines
[3][14], ppsd
)) {
8779 return USERSHARE_ACL_ERR
;
8783 if (strncmp(lines
[4], "guest_ok=", 9) != 0) {
8784 return USERSHARE_MALFORMED_ACL_DEF
;
8786 if (lines
[4][9] == 'y') {
8787 *pallow_guest
= True
;
8790 /* Backwards compatible extension to file version #2. */
8792 if (strncmp(lines
[5], "sharename=", 10) != 0) {
8793 return USERSHARE_MALFORMED_SHARENAME_DEF
;
8795 if (!strequal(&lines
[5][10], servicename
)) {
8796 return USERSHARE_BAD_SHARENAME
;
8798 *pp_cp_servicename
= talloc_strdup(ctx
, &lines
[5][10]);
8799 if (!*pp_cp_servicename
) {
8800 return USERSHARE_POSIX_ERR
;
8805 if (*pp_cp_servicename
== NULL
) {
8806 *pp_cp_servicename
= talloc_strdup(ctx
, servicename
);
8807 if (!*pp_cp_servicename
) {
8808 return USERSHARE_POSIX_ERR
;
8812 if (snum
!= -1 && (strcmp(sharepath
, ServicePtrs
[snum
]->szPath
) == 0)) {
8813 /* Path didn't change, no checks needed. */
8814 *pp_sharepath
= sharepath
;
8815 *pp_comment
= comment
;
8816 return USERSHARE_OK
;
8819 /* The path *must* be absolute. */
8820 if (sharepath
[0] != '/') {
8821 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8822 servicename
, sharepath
));
8823 return USERSHARE_PATH_NOT_ABSOLUTE
;
8826 /* If there is a usershare prefix deny list ensure one of these paths
8827 doesn't match the start of the user given path. */
8828 if (prefixdenylist
) {
8830 for ( i
=0; prefixdenylist
[i
]; i
++ ) {
8831 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8832 servicename
, i
, prefixdenylist
[i
], sharepath
));
8833 if (memcmp( sharepath
, prefixdenylist
[i
], strlen(prefixdenylist
[i
])) == 0) {
8834 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8835 "usershare prefix deny list entries.\n",
8836 servicename
, sharepath
));
8837 return USERSHARE_PATH_IS_DENIED
;
8842 /* If there is a usershare prefix allow list ensure one of these paths
8843 does match the start of the user given path. */
8845 if (prefixallowlist
) {
8847 for ( i
=0; prefixallowlist
[i
]; i
++ ) {
8848 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8849 servicename
, i
, prefixallowlist
[i
], sharepath
));
8850 if (memcmp( sharepath
, prefixallowlist
[i
], strlen(prefixallowlist
[i
])) == 0) {
8854 if (prefixallowlist
[i
] == NULL
) {
8855 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8856 "usershare prefix allow list entries.\n",
8857 servicename
, sharepath
));
8858 return USERSHARE_PATH_NOT_ALLOWED
;
8862 /* Ensure this is pointing to a directory. */
8863 dp
= sys_opendir(sharepath
);
8866 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8867 servicename
, sharepath
));
8868 return USERSHARE_PATH_NOT_DIRECTORY
;
8871 /* Ensure the owner of the usershare file has permission to share
8874 if (sys_stat(sharepath
, &sbuf
, false) == -1) {
8875 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8876 servicename
, sharepath
, strerror(errno
) ));
8878 return USERSHARE_POSIX_ERR
;
8883 if (!S_ISDIR(sbuf
.st_ex_mode
)) {
8884 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8885 servicename
, sharepath
));
8886 return USERSHARE_PATH_NOT_DIRECTORY
;
8889 /* Check if sharing is restricted to owner-only. */
8890 /* psbuf is the stat of the usershare definition file,
8891 sbuf is the stat of the target directory to be shared. */
8893 if (lp_usershare_owner_only()) {
8894 /* root can share anything. */
8895 if ((psbuf
->st_ex_uid
!= 0) && (sbuf
.st_ex_uid
!= psbuf
->st_ex_uid
)) {
8896 return USERSHARE_PATH_NOT_ALLOWED
;
8900 *pp_sharepath
= sharepath
;
8901 *pp_comment
= comment
;
8902 return USERSHARE_OK
;
8905 /***************************************************************************
8906 Deal with a usershare file.
8909 -1 - Bad name, invalid contents.
8910 - service name already existed and not a usershare, problem
8911 with permissions to share directory etc.
8912 ***************************************************************************/
8914 static int process_usershare_file(const char *dir_name
, const char *file_name
, int snum_template
)
8916 SMB_STRUCT_STAT sbuf
;
8917 SMB_STRUCT_STAT lsbuf
;
8919 char *sharepath
= NULL
;
8920 char *comment
= NULL
;
8921 char *cp_service_name
= NULL
;
8922 char **lines
= NULL
;
8926 TALLOC_CTX
*ctx
= talloc_stackframe();
8927 struct security_descriptor
*psd
= NULL
;
8928 bool guest_ok
= False
;
8929 char *canon_name
= NULL
;
8930 bool added_service
= false;
8933 /* Ensure share name doesn't contain invalid characters. */
8934 if (!validate_net_name(file_name
, INVALID_SHARENAME_CHARS
, strlen(file_name
))) {
8935 DEBUG(0,("process_usershare_file: share name %s contains "
8936 "invalid characters (any of %s)\n",
8937 file_name
, INVALID_SHARENAME_CHARS
));
8941 canon_name
= canonicalize_servicename(ctx
, file_name
);
8946 fname
= talloc_asprintf(ctx
, "%s/%s", dir_name
, file_name
);
8951 /* Minimize the race condition by doing an lstat before we
8952 open and fstat. Ensure this isn't a symlink link. */
8954 if (sys_lstat(fname
, &lsbuf
, false) != 0) {
8955 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8956 fname
, strerror(errno
) ));
8960 /* This must be a regular file, not a symlink, directory or
8961 other strange filetype. */
8962 if (!check_usershare_stat(fname
, &lsbuf
)) {
8967 TDB_DATA data
= dbwrap_fetch_bystring(
8968 ServiceHash
, canon_name
, canon_name
);
8972 if ((data
.dptr
!= NULL
) && (data
.dsize
== sizeof(iService
))) {
8973 iService
= *(int *)data
.dptr
;
8977 if (iService
!= -1 &&
8978 timespec_compare(&ServicePtrs
[iService
]->usershare_last_mod
,
8979 &lsbuf
.st_ex_mtime
) == 0) {
8980 /* Nothing changed - Mark valid and return. */
8981 DEBUG(10,("process_usershare_file: service %s not changed.\n",
8983 ServicePtrs
[iService
]->usershare
= USERSHARE_VALID
;
8988 /* Try and open the file read only - no symlinks allowed. */
8990 fd
= sys_open(fname
, O_RDONLY
|O_NOFOLLOW
, 0);
8992 fd
= sys_open(fname
, O_RDONLY
, 0);
8996 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
8997 fname
, strerror(errno
) ));
9001 /* Now fstat to be *SURE* it's a regular file. */
9002 if (sys_fstat(fd
, &sbuf
, false) != 0) {
9004 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
9005 fname
, strerror(errno
) ));
9009 /* Is it the same dev/inode as was lstated ? */
9010 if (lsbuf
.st_ex_dev
!= sbuf
.st_ex_dev
|| lsbuf
.st_ex_ino
!= sbuf
.st_ex_ino
) {
9012 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
9013 "Symlink spoofing going on ?\n", fname
));
9017 /* This must be a regular file, not a symlink, directory or
9018 other strange filetype. */
9019 if (!check_usershare_stat(fname
, &sbuf
)) {
9023 lines
= fd_lines_load(fd
, &numlines
, MAX_USERSHARE_FILE_SIZE
, NULL
);
9026 if (lines
== NULL
) {
9027 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
9028 fname
, (unsigned int)sbuf
.st_ex_uid
));
9032 if (parse_usershare_file(ctx
, &sbuf
, file_name
,
9033 iService
, lines
, numlines
, &sharepath
,
9034 &comment
, &cp_service_name
,
9035 &psd
, &guest_ok
) != USERSHARE_OK
) {
9039 /* Everything ok - add the service possibly using a template. */
9041 const struct service
*sp
= &sDefault
;
9042 if (snum_template
!= -1) {
9043 sp
= ServicePtrs
[snum_template
];
9046 if ((iService
= add_a_service(sp
, cp_service_name
)) < 0) {
9047 DEBUG(0, ("process_usershare_file: Failed to add "
9048 "new service %s\n", cp_service_name
));
9052 added_service
= true;
9054 /* Read only is controlled by usershare ACL below. */
9055 ServicePtrs
[iService
]->bRead_only
= False
;
9058 /* Write the ACL of the new/modified share. */
9059 if (!set_share_security(canon_name
, psd
)) {
9060 DEBUG(0, ("process_usershare_file: Failed to set share "
9061 "security for user share %s\n",
9066 /* If from a template it may be marked invalid. */
9067 ServicePtrs
[iService
]->valid
= True
;
9069 /* Set the service as a valid usershare. */
9070 ServicePtrs
[iService
]->usershare
= USERSHARE_VALID
;
9072 /* Set guest access. */
9073 if (lp_usershare_allow_guests()) {
9074 ServicePtrs
[iService
]->bGuest_ok
= guest_ok
;
9077 /* And note when it was loaded. */
9078 ServicePtrs
[iService
]->usershare_last_mod
= sbuf
.st_ex_mtime
;
9079 string_set(&ServicePtrs
[iService
]->szPath
, sharepath
);
9080 string_set(&ServicePtrs
[iService
]->comment
, comment
);
9086 if (ret
== -1 && iService
!= -1 && added_service
) {
9087 lp_remove_service(iService
);
9095 /***************************************************************************
9096 Checks if a usershare entry has been modified since last load.
9097 ***************************************************************************/
9099 static bool usershare_exists(int iService
, struct timespec
*last_mod
)
9101 SMB_STRUCT_STAT lsbuf
;
9102 const char *usersharepath
= Globals
.szUsersharePath
;
9105 if (asprintf(&fname
, "%s/%s",
9107 ServicePtrs
[iService
]->szService
) < 0) {
9111 if (sys_lstat(fname
, &lsbuf
, false) != 0) {
9116 if (!S_ISREG(lsbuf
.st_ex_mode
)) {
9122 *last_mod
= lsbuf
.st_ex_mtime
;
9126 /***************************************************************************
9127 Load a usershare service by name. Returns a valid servicenumber or -1.
9128 ***************************************************************************/
9130 int load_usershare_service(const char *servicename
)
9132 SMB_STRUCT_STAT sbuf
;
9133 const char *usersharepath
= Globals
.szUsersharePath
;
9134 int max_user_shares
= Globals
.iUsershareMaxShares
;
9135 int snum_template
= -1;
9137 if (*usersharepath
== 0 || max_user_shares
== 0) {
9141 if (sys_stat(usersharepath
, &sbuf
, false) != 0) {
9142 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
9143 usersharepath
, strerror(errno
) ));
9147 if (!S_ISDIR(sbuf
.st_ex_mode
)) {
9148 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
9154 * This directory must be owned by root, and have the 't' bit set.
9155 * It also must not be writable by "other".
9159 if (sbuf
.st_ex_uid
!= 0 || !(sbuf
.st_ex_mode
& S_ISVTX
) || (sbuf
.st_ex_mode
& S_IWOTH
)) {
9161 if (sbuf
.st_ex_uid
!= 0 || (sbuf
.st_ex_mode
& S_IWOTH
)) {
9163 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
9164 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9169 /* Ensure the template share exists if it's set. */
9170 if (Globals
.szUsershareTemplateShare
[0]) {
9171 /* We can't use lp_servicenumber here as we are recommending that
9172 template shares have -valid=False set. */
9173 for (snum_template
= iNumServices
- 1; snum_template
>= 0; snum_template
--) {
9174 if (ServicePtrs
[snum_template
]->szService
&&
9175 strequal(ServicePtrs
[snum_template
]->szService
,
9176 Globals
.szUsershareTemplateShare
)) {
9181 if (snum_template
== -1) {
9182 DEBUG(0,("load_usershare_service: usershare template share %s "
9183 "does not exist.\n",
9184 Globals
.szUsershareTemplateShare
));
9189 return process_usershare_file(usersharepath
, servicename
, snum_template
);
9192 /***************************************************************************
9193 Load all user defined shares from the user share directory.
9194 We only do this if we're enumerating the share list.
9195 This is the function that can delete usershares that have
9197 ***************************************************************************/
9199 int load_usershare_shares(void)
9202 SMB_STRUCT_STAT sbuf
;
9203 SMB_STRUCT_DIRENT
*de
;
9204 int num_usershares
= 0;
9205 int max_user_shares
= Globals
.iUsershareMaxShares
;
9206 unsigned int num_dir_entries
, num_bad_dir_entries
, num_tmp_dir_entries
;
9207 unsigned int allowed_bad_entries
= ((2*max_user_shares
)/10);
9208 unsigned int allowed_tmp_entries
= ((2*max_user_shares
)/10);
9210 int snum_template
= -1;
9211 const char *usersharepath
= Globals
.szUsersharePath
;
9212 int ret
= lp_numservices();
9214 if (max_user_shares
== 0 || *usersharepath
== '\0') {
9215 return lp_numservices();
9218 if (sys_stat(usersharepath
, &sbuf
, false) != 0) {
9219 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
9220 usersharepath
, strerror(errno
) ));
9225 * This directory must be owned by root, and have the 't' bit set.
9226 * It also must not be writable by "other".
9230 if (sbuf
.st_ex_uid
!= 0 || !(sbuf
.st_ex_mode
& S_ISVTX
) || (sbuf
.st_ex_mode
& S_IWOTH
)) {
9232 if (sbuf
.st_ex_uid
!= 0 || (sbuf
.st_ex_mode
& S_IWOTH
)) {
9234 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
9235 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9240 /* Ensure the template share exists if it's set. */
9241 if (Globals
.szUsershareTemplateShare
[0]) {
9242 /* We can't use lp_servicenumber here as we are recommending that
9243 template shares have -valid=False set. */
9244 for (snum_template
= iNumServices
- 1; snum_template
>= 0; snum_template
--) {
9245 if (ServicePtrs
[snum_template
]->szService
&&
9246 strequal(ServicePtrs
[snum_template
]->szService
,
9247 Globals
.szUsershareTemplateShare
)) {
9252 if (snum_template
== -1) {
9253 DEBUG(0,("load_usershare_shares: usershare template share %s "
9254 "does not exist.\n",
9255 Globals
.szUsershareTemplateShare
));
9260 /* Mark all existing usershares as pending delete. */
9261 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
9262 if (VALID(iService
) && ServicePtrs
[iService
]->usershare
) {
9263 ServicePtrs
[iService
]->usershare
= USERSHARE_PENDING_DELETE
;
9267 dp
= sys_opendir(usersharepath
);
9269 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
9270 usersharepath
, strerror(errno
) ));
9274 for (num_dir_entries
= 0, num_bad_dir_entries
= 0, num_tmp_dir_entries
= 0;
9275 (de
= sys_readdir(dp
));
9276 num_dir_entries
++ ) {
9278 const char *n
= de
->d_name
;
9280 /* Ignore . and .. */
9282 if ((n
[1] == '\0') || (n
[1] == '.' && n
[2] == '\0')) {
9288 /* Temporary file used when creating a share. */
9289 num_tmp_dir_entries
++;
9292 /* Allow 20% tmp entries. */
9293 if (num_tmp_dir_entries
> allowed_tmp_entries
) {
9294 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
9295 "in directory %s\n",
9296 num_tmp_dir_entries
, usersharepath
));
9300 r
= process_usershare_file(usersharepath
, n
, snum_template
);
9302 /* Update the services count. */
9304 if (num_usershares
>= max_user_shares
) {
9305 DEBUG(0,("load_usershare_shares: max user shares reached "
9306 "on file %s in directory %s\n",
9307 n
, usersharepath
));
9310 } else if (r
== -1) {
9311 num_bad_dir_entries
++;
9314 /* Allow 20% bad entries. */
9315 if (num_bad_dir_entries
> allowed_bad_entries
) {
9316 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
9317 "in directory %s\n",
9318 num_bad_dir_entries
, usersharepath
));
9322 /* Allow 20% bad entries. */
9323 if (num_dir_entries
> max_user_shares
+ allowed_bad_entries
) {
9324 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
9325 "in directory %s\n",
9326 num_dir_entries
, usersharepath
));
9333 /* Sweep through and delete any non-refreshed usershares that are
9334 not currently in use. */
9335 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
9336 if (VALID(iService
) && (ServicePtrs
[iService
]->usershare
== USERSHARE_PENDING_DELETE
)) {
9337 if (conn_snum_used(iService
)) {
9340 /* Remove from the share ACL db. */
9341 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
9342 lp_servicename(iService
) ));
9343 delete_share_security(lp_servicename(iService
));
9344 free_service_byindex(iService
);
9348 return lp_numservices();
9351 /********************************************************
9352 Destroy global resources allocated in this file
9353 ********************************************************/
9355 void gfree_loadparm(void)
9361 /* Free resources allocated to services */
9363 for ( i
= 0; i
< iNumServices
; i
++ ) {
9365 free_service_byindex(i
);
9369 SAFE_FREE( ServicePtrs
);
9372 /* Now release all resources allocated to global
9373 parameters and the default service */
9375 free_global_parameters();
9379 /***************************************************************************
9380 Allow client apps to specify that they are a client
9381 ***************************************************************************/
9382 void lp_set_in_client(bool b
)
9388 /***************************************************************************
9389 Determine if we're running in a client app
9390 ***************************************************************************/
9391 bool lp_is_in_client(void)
9396 /***************************************************************************
9397 Load the services array from the services file. Return True on success,
9399 ***************************************************************************/
9401 static bool lp_load_ex(const char *pszFname
,
9405 bool initialize_globals
,
9406 bool allow_include_registry
,
9407 bool allow_registry_shares
)
9414 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9416 bInGlobalSection
= True
;
9417 bGlobalOnly
= global_only
;
9418 bAllowIncludeRegistry
= allow_include_registry
;
9420 init_globals(initialize_globals
);
9425 if (save_defaults
) {
9430 free_param_opts(&Globals
.param_opt
);
9432 /* We get sections first, so have to start 'behind' to make up */
9435 if (lp_config_backend_is_file()) {
9436 n2
= talloc_sub_basic(talloc_tos(), get_current_username(),
9437 current_user_info
.domain
,
9440 smb_panic("lp_load_ex: out of memory");
9443 add_to_file_list(pszFname
, n2
);
9445 bRetval
= pm_process(n2
, do_section
, do_parameter
, NULL
);
9448 /* finish up the last section */
9449 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval
)));
9451 if (iServiceIndex
>= 0) {
9452 bRetval
= service_ok(iServiceIndex
);
9456 if (lp_config_backend_is_registry()) {
9457 /* config backend changed to registry in config file */
9459 * We need to use this extra global variable here to
9460 * survive restart: init_globals uses this as a default
9461 * for ConfigBackend. Otherwise, init_globals would
9462 * send us into an endless loop here.
9464 config_backend
= CONFIG_BACKEND_REGISTRY
;
9466 DEBUG(1, ("lp_load_ex: changing to config backend "
9469 lp_kill_all_services();
9470 return lp_load_ex(pszFname
, global_only
, save_defaults
,
9471 add_ipc
, initialize_globals
,
9472 allow_include_registry
,
9473 allow_registry_shares
);
9475 } else if (lp_config_backend_is_registry()) {
9476 bRetval
= process_registry_globals();
9478 DEBUG(0, ("Illegal config backend given: %d\n",
9479 lp_config_backend()));
9483 if (bRetval
&& lp_registry_shares() && allow_registry_shares
) {
9484 bRetval
= process_registry_shares();
9487 lp_add_auto_services(lp_auto_services());
9490 /* When 'restrict anonymous = 2' guest connections to ipc$
9492 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9493 if ( lp_enable_asu_support() ) {
9494 lp_add_ipc("ADMIN$", false);
9499 set_default_server_announce_type();
9500 set_allowed_client_auth();
9504 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9505 /* if bWINSsupport is true and we are in the client */
9506 if (lp_is_in_client() && Globals
.bWINSsupport
) {
9507 lp_do_parameter(GLOBAL_SECTION_SNUM
, "wins server", "127.0.0.1");
9512 bAllowIncludeRegistry
= true;
9517 bool lp_load(const char *pszFname
,
9521 bool initialize_globals
)
9523 return lp_load_ex(pszFname
,
9528 true, /* allow_include_registry */
9529 false); /* allow_registry_shares*/
9532 bool lp_load_initial_only(const char *pszFname
)
9534 return lp_load_ex(pszFname
,
9535 true, /* global only */
9536 false, /* save_defaults */
9537 false, /* add_ipc */
9538 true, /* initialize_globals */
9539 false, /* allow_include_registry */
9540 false); /* allow_registry_shares*/
9543 bool lp_load_with_registry_shares(const char *pszFname
,
9547 bool initialize_globals
)
9549 return lp_load_ex(pszFname
,
9554 true, /* allow_include_registry */
9555 true); /* allow_registry_shares*/
9558 /***************************************************************************
9559 Return the max number of services.
9560 ***************************************************************************/
9562 int lp_numservices(void)
9564 return (iNumServices
);
9567 /***************************************************************************
9568 Display the contents of the services array in human-readable form.
9569 ***************************************************************************/
9571 void lp_dump(FILE *f
, bool show_defaults
, int maxtoprint
)
9576 defaults_saved
= False
;
9580 dump_a_service(&sDefault
, f
);
9582 for (iService
= 0; iService
< maxtoprint
; iService
++) {
9584 lp_dump_one(f
, show_defaults
, iService
);
9588 /***************************************************************************
9589 Display the contents of one service in human-readable form.
9590 ***************************************************************************/
9592 void lp_dump_one(FILE * f
, bool show_defaults
, int snum
)
9595 if (ServicePtrs
[snum
]->szService
[0] == '\0')
9597 dump_a_service(ServicePtrs
[snum
], f
);
9601 /***************************************************************************
9602 Return the number of the service with the given name, or -1 if it doesn't
9603 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9604 getservicebyname()! This works ONLY if all services have been loaded, and
9605 does not copy the found service.
9606 ***************************************************************************/
9608 int lp_servicenumber(const char *pszServiceName
)
9611 fstring serviceName
;
9613 if (!pszServiceName
) {
9614 return GLOBAL_SECTION_SNUM
;
9617 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
9618 if (VALID(iService
) && ServicePtrs
[iService
]->szService
) {
9620 * The substitution here is used to support %U is
9623 fstrcpy(serviceName
, ServicePtrs
[iService
]->szService
);
9624 standard_sub_basic(get_current_username(),
9625 current_user_info
.domain
,
9626 serviceName
,sizeof(serviceName
));
9627 if (strequal(serviceName
, pszServiceName
)) {
9633 if (iService
>= 0 && ServicePtrs
[iService
]->usershare
== USERSHARE_VALID
) {
9634 struct timespec last_mod
;
9636 if (!usershare_exists(iService
, &last_mod
)) {
9637 /* Remove the share security tdb entry for it. */
9638 delete_share_security(lp_servicename(iService
));
9639 /* Remove it from the array. */
9640 free_service_byindex(iService
);
9641 /* Doesn't exist anymore. */
9642 return GLOBAL_SECTION_SNUM
;
9645 /* Has it been modified ? If so delete and reload. */
9646 if (timespec_compare(&ServicePtrs
[iService
]->usershare_last_mod
,
9648 /* Remove it from the array. */
9649 free_service_byindex(iService
);
9650 /* and now reload it. */
9651 iService
= load_usershare_service(pszServiceName
);
9656 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName
));
9657 return GLOBAL_SECTION_SNUM
;
9663 bool share_defined(const char *service_name
)
9665 return (lp_servicenumber(service_name
) != -1);
9668 struct share_params
*get_share_params(TALLOC_CTX
*mem_ctx
,
9669 const char *sharename
)
9671 struct share_params
*result
;
9675 snum
= find_service(mem_ctx
, sharename
, &sname
);
9676 if (snum
< 0 || sname
== NULL
) {
9680 if (!(result
= TALLOC_P(mem_ctx
, struct share_params
))) {
9681 DEBUG(0, ("talloc failed\n"));
9685 result
->service
= snum
;
9689 struct share_iterator
*share_list_all(TALLOC_CTX
*mem_ctx
)
9691 struct share_iterator
*result
;
9693 if (!(result
= TALLOC_P(mem_ctx
, struct share_iterator
))) {
9694 DEBUG(0, ("talloc failed\n"));
9698 result
->next_id
= 0;
9702 struct share_params
*next_share(struct share_iterator
*list
)
9704 struct share_params
*result
;
9706 while (!lp_snum_ok(list
->next_id
) &&
9707 (list
->next_id
< lp_numservices())) {
9711 if (list
->next_id
>= lp_numservices()) {
9715 if (!(result
= TALLOC_P(list
, struct share_params
))) {
9716 DEBUG(0, ("talloc failed\n"));
9720 result
->service
= list
->next_id
;
9725 struct share_params
*next_printer(struct share_iterator
*list
)
9727 struct share_params
*result
;
9729 while ((result
= next_share(list
)) != NULL
) {
9730 if (lp_print_ok(result
->service
)) {
9738 * This is a hack for a transition period until we transformed all code from
9739 * service numbers to struct share_params.
9742 struct share_params
*snum2params_static(int snum
)
9744 static struct share_params result
;
9745 result
.service
= snum
;
9749 /*******************************************************************
9750 A useful volume label function.
9751 ********************************************************************/
9753 const char *volume_label(int snum
)
9756 const char *label
= lp_volume(snum
);
9758 label
= lp_servicename(snum
);
9761 /* This returns a 33 byte guarenteed null terminated string. */
9762 ret
= talloc_strndup(talloc_tos(), label
, 32);
9769 /*******************************************************************
9770 Set the server type we will announce as via nmbd.
9771 ********************************************************************/
9773 static void set_default_server_announce_type(void)
9775 default_server_announce
= 0;
9776 default_server_announce
|= SV_TYPE_WORKSTATION
;
9777 default_server_announce
|= SV_TYPE_SERVER
;
9778 default_server_announce
|= SV_TYPE_SERVER_UNIX
;
9780 /* note that the flag should be set only if we have a
9781 printer service but nmbd doesn't actually load the
9782 services so we can't tell --jerry */
9784 default_server_announce
|= SV_TYPE_PRINTQ_SERVER
;
9786 switch (lp_announce_as()) {
9787 case ANNOUNCE_AS_NT_SERVER
:
9788 default_server_announce
|= SV_TYPE_SERVER_NT
;
9789 /* fall through... */
9790 case ANNOUNCE_AS_NT_WORKSTATION
:
9791 default_server_announce
|= SV_TYPE_NT
;
9793 case ANNOUNCE_AS_WIN95
:
9794 default_server_announce
|= SV_TYPE_WIN95_PLUS
;
9796 case ANNOUNCE_AS_WFW
:
9797 default_server_announce
|= SV_TYPE_WFW
;
9803 switch (lp_server_role()) {
9804 case ROLE_DOMAIN_MEMBER
:
9805 default_server_announce
|= SV_TYPE_DOMAIN_MEMBER
;
9807 case ROLE_DOMAIN_PDC
:
9808 default_server_announce
|= SV_TYPE_DOMAIN_CTRL
;
9810 case ROLE_DOMAIN_BDC
:
9811 default_server_announce
|= SV_TYPE_DOMAIN_BAKCTRL
;
9813 case ROLE_STANDALONE
:
9817 if (lp_time_server())
9818 default_server_announce
|= SV_TYPE_TIME_SOURCE
;
9820 if (lp_host_msdfs())
9821 default_server_announce
|= SV_TYPE_DFS_SERVER
;
9824 /***********************************************************
9825 If we are PDC then prefer us as DMB
9826 ************************************************************/
9828 bool lp_domain_master(void)
9830 if (Globals
.iDomainMaster
== Auto
)
9831 return (lp_server_role() == ROLE_DOMAIN_PDC
);
9833 return (bool)Globals
.iDomainMaster
;
9836 /***********************************************************
9837 If we are PDC then prefer us as DMB
9838 ************************************************************/
9840 bool lp_domain_master_true_or_auto(void)
9842 if (Globals
.iDomainMaster
) /* auto or yes */
9848 /***********************************************************
9849 If we are DMB then prefer us as LMB
9850 ************************************************************/
9852 bool lp_preferred_master(void)
9854 if (Globals
.iPreferredMaster
== Auto
)
9855 return (lp_local_master() && lp_domain_master());
9857 return (bool)Globals
.iPreferredMaster
;
9860 /*******************************************************************
9862 ********************************************************************/
9864 void lp_remove_service(int snum
)
9866 ServicePtrs
[snum
]->valid
= False
;
9867 invalid_services
[num_invalid_services
++] = snum
;
9870 /*******************************************************************
9872 ********************************************************************/
9874 void lp_copy_service(int snum
, const char *new_name
)
9876 do_section(new_name
, NULL
);
9878 snum
= lp_servicenumber(new_name
);
9880 lp_do_parameter(snum
, "copy", lp_servicename(snum
));
9885 /*******************************************************************
9886 Get the default server type we will announce as via nmbd.
9887 ********************************************************************/
9889 int lp_default_server_announce(void)
9891 return default_server_announce
;
9894 /*******************************************************************
9895 Split the announce version into major and minor numbers.
9896 ********************************************************************/
9898 int lp_major_announce_version(void)
9900 static bool got_major
= False
;
9901 static int major_version
= DEFAULT_MAJOR_VERSION
;
9906 return major_version
;
9909 if ((vers
= lp_announce_version()) == NULL
)
9910 return major_version
;
9912 if ((p
= strchr_m(vers
, '.')) == 0)
9913 return major_version
;
9916 major_version
= atoi(vers
);
9917 return major_version
;
9920 int lp_minor_announce_version(void)
9922 static bool got_minor
= False
;
9923 static int minor_version
= DEFAULT_MINOR_VERSION
;
9928 return minor_version
;
9931 if ((vers
= lp_announce_version()) == NULL
)
9932 return minor_version
;
9934 if ((p
= strchr_m(vers
, '.')) == 0)
9935 return minor_version
;
9938 minor_version
= atoi(p
);
9939 return minor_version
;
9942 /***********************************************************
9943 Set the global name resolution order (used in smbclient).
9944 ************************************************************/
9946 void lp_set_name_resolve_order(const char *new_order
)
9948 string_set(&Globals
.szNameResolveOrder
, new_order
);
9951 const char *lp_printername(int snum
)
9953 const char *ret
= _lp_printername(snum
);
9954 if (ret
== NULL
|| (ret
!= NULL
&& *ret
== '\0'))
9955 ret
= lp_const_servicename(snum
);
9961 /***********************************************************
9962 Allow daemons such as winbindd to fix their logfile name.
9963 ************************************************************/
9965 void lp_set_logfile(const char *name
)
9967 string_set(&Globals
.szLogFile
, name
);
9968 debug_set_logfile(name
);
9971 /*******************************************************************
9972 Return the max print jobs per queue.
9973 ********************************************************************/
9975 int lp_maxprintjobs(int snum
)
9977 int maxjobs
= LP_SNUM_OK(snum
) ? ServicePtrs
[snum
]->iMaxPrintJobs
: sDefault
.iMaxPrintJobs
;
9978 if (maxjobs
<= 0 || maxjobs
>= PRINT_MAX_JOBID
)
9979 maxjobs
= PRINT_MAX_JOBID
- 1;
9984 const char *lp_printcapname(void)
9986 if ((Globals
.szPrintcapname
!= NULL
) &&
9987 (Globals
.szPrintcapname
[0] != '\0'))
9988 return Globals
.szPrintcapname
;
9990 if (sDefault
.iPrinting
== PRINT_CUPS
) {
9998 if (sDefault
.iPrinting
== PRINT_BSD
)
9999 return "/etc/printcap";
10001 return PRINTCAP_NAME
;
10004 static uint32 spoolss_state
;
10006 bool lp_disable_spoolss( void )
10008 if ( spoolss_state
== SVCCTL_STATE_UNKNOWN
)
10009 spoolss_state
= _lp_disable_spoolss() ? SVCCTL_STOPPED
: SVCCTL_RUNNING
;
10011 return spoolss_state
== SVCCTL_STOPPED
? True
: False
;
10014 void lp_set_spoolss_state( uint32 state
)
10016 SMB_ASSERT( (state
== SVCCTL_STOPPED
) || (state
== SVCCTL_RUNNING
) );
10018 spoolss_state
= state
;
10021 uint32
lp_get_spoolss_state( void )
10023 return lp_disable_spoolss() ? SVCCTL_STOPPED
: SVCCTL_RUNNING
;
10026 /*******************************************************************
10027 Ensure we don't use sendfile if server smb signing is active.
10028 ********************************************************************/
10030 bool lp_use_sendfile(int snum
, struct smb_signing_state
*signing_state
)
10032 bool sign_active
= false;
10034 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
10035 if (get_Protocol() < PROTOCOL_NT1
) {
10038 if (signing_state
) {
10039 sign_active
= smb_signing_is_active(signing_state
);
10041 return (_lp_use_sendfile(snum
) &&
10042 (get_remote_arch() != RA_WIN95
) &&
10046 /*******************************************************************
10047 Turn off sendfile if we find the underlying OS doesn't support it.
10048 ********************************************************************/
10050 void set_use_sendfile(int snum
, bool val
)
10052 if (LP_SNUM_OK(snum
))
10053 ServicePtrs
[snum
]->bUseSendfile
= val
;
10055 sDefault
.bUseSendfile
= val
;
10058 /*******************************************************************
10059 Turn off storing DOS attributes if this share doesn't support it.
10060 ********************************************************************/
10062 void set_store_dos_attributes(int snum
, bool val
)
10064 if (!LP_SNUM_OK(snum
))
10066 ServicePtrs
[(snum
)]->bStoreDosAttributes
= val
;
10069 void lp_set_mangling_method(const char *new_method
)
10071 string_set(&Globals
.szManglingMethod
, new_method
);
10074 /*******************************************************************
10075 Global state for POSIX pathname processing.
10076 ********************************************************************/
10078 static bool posix_pathnames
;
10080 bool lp_posix_pathnames(void)
10082 return posix_pathnames
;
10085 /*******************************************************************
10086 Change everything needed to ensure POSIX pathname processing (currently
10088 ********************************************************************/
10090 void lp_set_posix_pathnames(void)
10092 posix_pathnames
= True
;
10095 /*******************************************************************
10096 Global state for POSIX lock processing - CIFS unix extensions.
10097 ********************************************************************/
10099 bool posix_default_lock_was_set
;
10100 static enum brl_flavour posix_cifsx_locktype
; /* By default 0 == WINDOWS_LOCK */
10102 enum brl_flavour
lp_posix_cifsu_locktype(files_struct
*fsp
)
10104 if (posix_default_lock_was_set
) {
10105 return posix_cifsx_locktype
;
10107 return fsp
->posix_open
? POSIX_LOCK
: WINDOWS_LOCK
;
10111 /*******************************************************************
10112 ********************************************************************/
10114 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val
)
10116 posix_default_lock_was_set
= True
;
10117 posix_cifsx_locktype
= val
;
10120 int lp_min_receive_file_size(void)
10122 if (Globals
.iminreceivefile
< 0) {
10125 return MIN(Globals
.iminreceivefile
, BUFFER_SIZE
);
10128 /*******************************************************************
10129 If socket address is an empty character string, it is necessary to
10130 define it as "0.0.0.0".
10131 ********************************************************************/
10133 const char *lp_socket_address(void)
10135 char *sock_addr
= Globals
.szSocketAddress
;
10137 if (sock_addr
[0] == '\0'){
10138 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
10140 return Globals
.szSocketAddress
;
10143 void lp_set_passdb_backend(const char *backend
)
10145 string_set(&Globals
.szPassdbBackend
, backend
);
10148 /*******************************************************************
10149 Safe wide links checks.
10150 This helper function always verify the validity of wide links,
10151 even after a configuration file reload.
10152 ********************************************************************/
10154 static bool lp_widelinks_internal(int snum
)
10156 return (bool)(LP_SNUM_OK(snum
)? ServicePtrs
[(snum
)]->bWidelinks
:
10157 sDefault
.bWidelinks
);
10160 void widelinks_warning(int snum
)
10162 if (lp_unix_extensions() && lp_widelinks_internal(snum
)) {
10163 DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
10164 "These parameters are incompatible. "
10165 "Wide links will be disabled for this share.\n",
10166 lp_servicename(snum
) ));
10170 bool lp_widelinks(int snum
)
10172 /* wide links is always incompatible with unix extensions */
10173 if (lp_unix_extensions()) {
10177 return lp_widelinks_internal(snum
);
10180 bool lp_writeraw(void)
10182 if (lp_async_smb_echo_handler()) {
10185 return _lp_writeraw();
10188 bool lp_readraw(void)
10190 if (lp_async_smb_echo_handler()) {
10193 return _lp_readraw();