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 int winbindMaxDomainConnections
;
220 char *szIdmapBackend
;
222 char *szAddShareCommand
;
223 char *szChangeShareCommand
;
224 char *szDeleteShareCommand
;
226 char *szGuestaccount
;
227 char *szManglingMethod
;
228 char **szServicesList
;
229 char *szUsersharePath
;
230 char *szUsershareTemplateShare
;
231 char **szUsersharePrefixAllowList
;
232 char **szUsersharePrefixDenyList
;
239 int open_files_db_hash_size
;
248 bool paranoid_server_security
;
251 int iMaxSmbdProcesses
;
252 bool bDisableSpoolss
;
255 bool enhanced_browsing
;
261 int announce_as
; /* This is initialised in init_globals */
262 int machine_password_timeout
;
264 int oplock_break_wait_time
;
265 int winbind_cache_time
;
266 int winbind_reconnect_delay
;
267 int winbind_max_clients
;
268 char **szWinbindNssInfo
;
270 char *szLdapMachineSuffix
;
271 char *szLdapUserSuffix
;
272 char *szLdapIdmapSuffix
;
273 char *szLdapGroupSuffix
;
277 int ldap_follow_referral
;
280 int ldap_debug_level
;
281 int ldap_debug_threshold
;
285 char *szIPrintServer
;
287 char **szClusterAddresses
;
290 int ctdb_locktime_warn_threshold
;
291 int ldap_passwd_sync
;
292 int ldap_replication_sleep
;
293 int ldap_timeout
; /* This is initialised in init_globals */
294 int ldap_connection_timeout
;
297 bool bMsAddPrinterWizard
;
302 int iPreferredMaster
;
305 char **szInitLogonDelayedHosts
;
307 bool bEncryptPasswords
;
312 bool bObeyPamRestrictions
;
314 int PrintcapCacheTime
;
315 bool bLargeReadwrite
;
322 bool bBindInterfacesOnly
;
323 bool bPamPasswordChange
;
324 bool bUnixPasswdSync
;
325 bool bPasswdChatDebug
;
326 int iPasswdChatTimeout
;
330 bool bNTStatusSupport
;
332 int iMaxStatCacheSize
;
334 bool bAllowTrustedDomains
;
338 bool bClientLanManAuth
;
339 bool bClientNTLMv2Auth
;
340 bool bClientPlaintextAuth
;
341 bool bClientUseSpnego
;
342 bool client_use_spnego_principal
;
343 bool send_spnego_principal
;
344 bool bDebugPrefixTimestamp
;
345 bool bDebugHiresTimestamp
;
349 bool bEnableCoreFiles
;
352 bool bHostnameLookups
;
353 bool bUnixExtensions
;
354 bool bDisableNetbios
;
355 char * szDedicatedKeytabFile
;
357 bool bDeferSharingViolations
;
358 bool bEnablePrivileges
;
360 bool bUsershareOwnerOnly
;
361 bool bUsershareAllowGuests
;
362 bool bRegistryShares
;
363 int restrict_anonymous
;
364 int name_cache_timeout
;
367 int client_ldap_sasl_wrapping
;
368 int iUsershareMaxShares
;
370 int iIdmapNegativeCacheTime
;
372 bool bLogWriteableFilesOnExit
;
375 struct param_opt_struct
*param_opt
;
376 int cups_connection_timeout
;
377 char *szSMBPerfcountModule
;
378 bool bMapUntrustedToDomain
;
379 bool bAsyncSMBEchoHandler
;
380 bool bMulticastDnsRegister
;
384 int ismb2_max_credits
;
388 static struct global Globals
;
391 * This structure describes a single service.
397 struct timespec usershare_last_mod
;
401 char **szInvalidUsers
;
409 char *szRootPostExec
;
411 char *szPrintcommand
;
414 char *szLppausecommand
;
415 char *szLpresumecommand
;
416 char *szQueuepausecommand
;
417 char *szQueueresumecommand
;
419 char *szPrintjobUsername
;
427 char *szVetoOplockFiles
;
433 char **printer_admin
;
438 char *szAioWriteBehind
;
442 int iMaxReportedPrintJobs
;
445 int iCreate_force_mode
;
447 int iSecurity_force_mode
;
450 int iDir_Security_mask
;
451 int iDir_Security_force_mode
;
455 int iOplockContentionLimit
;
460 bool bRootpreexecClose
;
463 bool bShortCasePreserve
;
465 bool bHideSpecialFiles
;
466 bool bHideUnReadable
;
467 bool bHideUnWriteableFiles
;
469 bool bAccessBasedShareEnum
;
474 bool bAdministrative_share
;
480 bool bStoreDosAttributes
;
493 bool bStrictAllocate
;
496 struct bitmap
*copymap
;
497 bool bDeleteReadonly
;
499 bool bDeleteVetoFiles
;
502 bool bDosFiletimeResolution
;
503 bool bFakeDirCreateTimes
;
509 bool bUseClientDriver
;
510 bool bDefaultDevmode
;
511 bool bForcePrintername
;
513 bool bForceUnknownAclUser
;
516 bool bMap_acl_inherit
;
519 bool bAclCheckPermissions
;
520 bool bAclMapFullControl
;
521 bool bAclGroupControl
;
523 bool bKernelChangeNotify
;
524 int iallocation_roundup_size
;
528 int iDirectoryNameCacheSize
;
530 struct param_opt_struct
*param_opt
;
532 char dummy
[3]; /* for alignment */
536 /* This is a default service used to prime a services structure */
537 static struct service sDefault
= {
539 False
, /* not autoloaded */
540 0, /* not a usershare */
541 {0, }, /* No last mod time */
542 NULL
, /* szService */
544 NULL
, /* szUsername */
545 NULL
, /* szInvalidUsers */
546 NULL
, /* szValidUsers */
547 NULL
, /* szAdminUsers */
549 NULL
, /* szInclude */
550 NULL
, /* szPreExec */
551 NULL
, /* szPostExec */
552 NULL
, /* szRootPreExec */
553 NULL
, /* szRootPostExec */
554 NULL
, /* szCupsOptions */
555 NULL
, /* szPrintcommand */
556 NULL
, /* szLpqcommand */
557 NULL
, /* szLprmcommand */
558 NULL
, /* szLppausecommand */
559 NULL
, /* szLpresumecommand */
560 NULL
, /* szQueuepausecommand */
561 NULL
, /* szQueueresumecommand */
562 NULL
, /* szPrintername */
563 NULL
, /* szPrintjobUsername */
564 NULL
, /* szDontdescend */
565 NULL
, /* szHostsallow */
566 NULL
, /* szHostsdeny */
567 NULL
, /* szMagicScript */
568 NULL
, /* szMagicOutput */
569 NULL
, /* szVetoFiles */
570 NULL
, /* szHideFiles */
571 NULL
, /* szVetoOplockFiles */
573 NULL
, /* force user */
574 NULL
, /* force group */
576 NULL
, /* writelist */
577 NULL
, /* printer admin */
580 NULL
, /* vfs objects */
581 NULL
, /* szMSDfsProxy */
582 NULL
, /* szAioWriteBehind */
584 0, /* iMinPrintSpace */
585 1000, /* iMaxPrintJobs */
586 0, /* iMaxReportedPrintJobs */
587 0, /* iWriteCacheSize */
588 0744, /* iCreate_mask */
589 0000, /* iCreate_force_mode */
590 0777, /* iSecurity_mask */
591 0, /* iSecurity_force_mode */
592 0755, /* iDir_mask */
593 0000, /* iDir_force_mode */
594 0777, /* iDir_Security_mask */
595 0, /* iDir_Security_force_mode */
596 0, /* iMaxConnections */
597 CASE_LOWER
, /* iDefaultCase */
598 DEFAULT_PRINTING
, /* iPrinting */
599 2, /* iOplockContentionLimit */
601 1024, /* iBlock_size */
602 0, /* iDfreeCacheTime */
603 False
, /* bPreexecClose */
604 False
, /* bRootpreexecClose */
605 Auto
, /* case sensitive */
606 True
, /* case preserve */
607 True
, /* short case preserve */
608 True
, /* bHideDotFiles */
609 False
, /* bHideSpecialFiles */
610 False
, /* bHideUnReadable */
611 False
, /* bHideUnWriteableFiles */
612 True
, /* bBrowseable */
613 False
, /* bAccessBasedShareEnum */
614 True
, /* bAvailable */
615 True
, /* bRead_only */
616 True
, /* bNo_set_dir */
617 False
, /* bGuest_only */
618 False
, /* bAdministrative_share */
619 False
, /* bGuest_ok */
620 False
, /* bPrint_ok */
621 False
, /* bMap_system */
622 False
, /* bMap_hidden */
623 True
, /* bMap_archive */
624 False
, /* bStoreDosAttributes */
625 False
, /* bDmapiSupport */
627 Auto
, /* iStrictLocking */
628 True
, /* bPosixLocking */
629 True
, /* bShareModes */
631 True
, /* bLevel2OpLocks */
632 False
, /* bOnlyUser */
633 True
, /* bMangledNames */
634 false, /* bWidelinks */
635 True
, /* bSymlinks */
636 False
, /* bSyncAlways */
637 True
, /* bStrictAllocate */
638 False
, /* bStrictSync */
639 '~', /* magic char */
641 False
, /* bDeleteReadonly */
642 False
, /* bFakeOplocks */
643 False
, /* bDeleteVetoFiles */
644 False
, /* bDosFilemode */
645 True
, /* bDosFiletimes */
646 False
, /* bDosFiletimeResolution */
647 False
, /* bFakeDirCreateTimes */
648 True
, /* bBlockingLocks */
649 False
, /* bInheritPerms */
650 False
, /* bInheritACLS */
651 False
, /* bInheritOwner */
652 False
, /* bMSDfsRoot */
653 False
, /* bUseClientDriver */
654 True
, /* bDefaultDevmode */
655 False
, /* bForcePrintername */
656 True
, /* bNTAclSupport */
657 False
, /* bForceUnknownAclUser */
658 False
, /* bUseSendfile */
659 False
, /* bProfileAcls */
660 False
, /* bMap_acl_inherit */
661 False
, /* bAfs_Share */
662 False
, /* bEASupport */
663 True
, /* bAclCheckPermissions */
664 True
, /* bAclMapFullControl */
665 False
, /* bAclGroupControl */
666 True
, /* bChangeNotify */
667 True
, /* bKernelChangeNotify */
668 SMB_ROUNDUP_ALLOCATION_SIZE
, /* iallocation_roundup_size */
669 0, /* iAioReadSize */
670 0, /* iAioWriteSize */
671 MAP_READONLY_YES
, /* iMap_readonly */
672 #ifdef BROKEN_DIRECTORY_HANDLING
673 0, /* iDirectoryNameCacheSize */
675 100, /* iDirectoryNameCacheSize */
677 Auto
, /* ismb_encrypt */
678 NULL
, /* Parametric options */
683 /* local variables */
684 static struct service
**ServicePtrs
= NULL
;
685 static int iNumServices
= 0;
686 static int iServiceIndex
= 0;
687 static struct db_context
*ServiceHash
;
688 static int *invalid_services
= NULL
;
689 static int num_invalid_services
= 0;
690 static bool bInGlobalSection
= True
;
691 static bool bGlobalOnly
= False
;
692 static int default_server_announce
;
694 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
696 /* prototypes for the special type handlers */
697 static bool handle_include( int snum
, const char *pszParmValue
, char **ptr
);
698 static bool handle_copy( int snum
, const char *pszParmValue
, char **ptr
);
699 static bool handle_netbios_name( int snum
, const char *pszParmValue
, char **ptr
);
700 static bool handle_idmap_uid( int snum
, const char *pszParmValue
, char **ptr
);
701 static bool handle_idmap_gid( int snum
, const char *pszParmValue
, char **ptr
);
702 static bool handle_debug_list( int snum
, const char *pszParmValue
, char **ptr
);
703 static bool handle_workgroup( int snum
, const char *pszParmValue
, char **ptr
);
704 static bool handle_netbios_aliases( int snum
, const char *pszParmValue
, char **ptr
);
705 static bool handle_netbios_scope( int snum
, const char *pszParmValue
, char **ptr
);
706 static bool handle_charset( int snum
, const char *pszParmValue
, char **ptr
);
707 static bool handle_printing( int snum
, const char *pszParmValue
, char **ptr
);
708 static bool handle_ldap_debug_level( int snum
, const char *pszParmValue
, char **ptr
);
710 static void set_default_server_announce_type(void);
711 static void set_allowed_client_auth(void);
713 static void *lp_local_ptr(struct service
*service
, void *ptr
);
715 static void add_to_file_list(const char *fname
, const char *subfname
);
716 static bool lp_set_cmdline_helper(const char *pszParmName
, const char *pszParmValue
, bool store_values
);
718 static const struct enum_list enum_protocol
[] = {
719 {PROTOCOL_SMB2
, "SMB2"},
720 {PROTOCOL_NT1
, "NT1"},
721 {PROTOCOL_LANMAN2
, "LANMAN2"},
722 {PROTOCOL_LANMAN1
, "LANMAN1"},
723 {PROTOCOL_CORE
, "CORE"},
724 {PROTOCOL_COREPLUS
, "COREPLUS"},
725 {PROTOCOL_COREPLUS
, "CORE+"},
729 static const struct enum_list enum_security
[] = {
730 {SEC_SHARE
, "SHARE"},
732 {SEC_SERVER
, "SERVER"},
733 {SEC_DOMAIN
, "DOMAIN"},
740 static const struct enum_list enum_printing
[] = {
741 {PRINT_SYSV
, "sysv"},
743 {PRINT_HPUX
, "hpux"},
747 {PRINT_LPRNG
, "lprng"},
748 {PRINT_CUPS
, "cups"},
749 {PRINT_IPRINT
, "iprint"},
751 {PRINT_LPROS2
, "os2"},
753 {PRINT_TEST
, "test"},
755 #endif /* DEVELOPER */
759 static const struct enum_list enum_ldap_sasl_wrapping
[] = {
761 {ADS_AUTH_SASL_SIGN
, "sign"},
762 {ADS_AUTH_SASL_SEAL
, "seal"},
766 static const struct enum_list enum_ldap_ssl
[] = {
767 {LDAP_SSL_OFF
, "no"},
768 {LDAP_SSL_OFF
, "off"},
769 {LDAP_SSL_START_TLS
, "start tls"},
770 {LDAP_SSL_START_TLS
, "start_tls"},
774 /* LDAP Dereferencing Alias types */
775 #define SAMBA_LDAP_DEREF_NEVER 0
776 #define SAMBA_LDAP_DEREF_SEARCHING 1
777 #define SAMBA_LDAP_DEREF_FINDING 2
778 #define SAMBA_LDAP_DEREF_ALWAYS 3
780 static const struct enum_list enum_ldap_deref
[] = {
781 {SAMBA_LDAP_DEREF_NEVER
, "never"},
782 {SAMBA_LDAP_DEREF_SEARCHING
, "searching"},
783 {SAMBA_LDAP_DEREF_FINDING
, "finding"},
784 {SAMBA_LDAP_DEREF_ALWAYS
, "always"},
788 static const struct enum_list enum_ldap_passwd_sync
[] = {
789 {LDAP_PASSWD_SYNC_OFF
, "no"},
790 {LDAP_PASSWD_SYNC_OFF
, "off"},
791 {LDAP_PASSWD_SYNC_ON
, "yes"},
792 {LDAP_PASSWD_SYNC_ON
, "on"},
793 {LDAP_PASSWD_SYNC_ONLY
, "only"},
797 /* Types of machine we can announce as. */
798 #define ANNOUNCE_AS_NT_SERVER 1
799 #define ANNOUNCE_AS_WIN95 2
800 #define ANNOUNCE_AS_WFW 3
801 #define ANNOUNCE_AS_NT_WORKSTATION 4
803 static const struct enum_list enum_announce_as
[] = {
804 {ANNOUNCE_AS_NT_SERVER
, "NT"},
805 {ANNOUNCE_AS_NT_SERVER
, "NT Server"},
806 {ANNOUNCE_AS_NT_WORKSTATION
, "NT Workstation"},
807 {ANNOUNCE_AS_WIN95
, "win95"},
808 {ANNOUNCE_AS_WFW
, "WfW"},
812 static const struct enum_list enum_map_readonly
[] = {
813 {MAP_READONLY_NO
, "no"},
814 {MAP_READONLY_NO
, "false"},
815 {MAP_READONLY_NO
, "0"},
816 {MAP_READONLY_YES
, "yes"},
817 {MAP_READONLY_YES
, "true"},
818 {MAP_READONLY_YES
, "1"},
819 {MAP_READONLY_PERMISSIONS
, "permissions"},
820 {MAP_READONLY_PERMISSIONS
, "perms"},
824 static const struct enum_list enum_case
[] = {
825 {CASE_LOWER
, "lower"},
826 {CASE_UPPER
, "upper"},
832 static const struct enum_list enum_bool_auto
[] = {
843 static const struct enum_list enum_csc_policy
[] = {
844 {CSC_POLICY_MANUAL
, "manual"},
845 {CSC_POLICY_DOCUMENTS
, "documents"},
846 {CSC_POLICY_PROGRAMS
, "programs"},
847 {CSC_POLICY_DISABLE
, "disable"},
851 /* SMB signing types. */
852 static const struct enum_list enum_smb_signing_vals
[] = {
864 {Required
, "required"},
865 {Required
, "mandatory"},
867 {Required
, "forced"},
868 {Required
, "enforced"},
872 /* ACL compatibility options. */
873 static const struct enum_list enum_acl_compat_vals
[] = {
874 { ACL_COMPAT_AUTO
, "auto" },
875 { ACL_COMPAT_WINNT
, "winnt" },
876 { ACL_COMPAT_WIN2K
, "win2k" },
881 Do you want session setups at user level security with a invalid
882 password to be rejected or allowed in as guest? WinNT rejects them
883 but it can be a pain as it means "net view" needs to use a password
885 You have 3 choices in the setting of map_to_guest:
887 "Never" means session setups with an invalid password
888 are rejected. This is the default.
890 "Bad User" means session setups with an invalid password
891 are rejected, unless the username does not exist, in which case it
892 is treated as a guest login
894 "Bad Password" means session setups with an invalid password
895 are treated as a guest login
897 Note that map_to_guest only has an effect in user or server
901 static const struct enum_list enum_map_to_guest
[] = {
902 {NEVER_MAP_TO_GUEST
, "Never"},
903 {MAP_TO_GUEST_ON_BAD_USER
, "Bad User"},
904 {MAP_TO_GUEST_ON_BAD_PASSWORD
, "Bad Password"},
905 {MAP_TO_GUEST_ON_BAD_UID
, "Bad Uid"},
909 /* Config backend options */
911 static const struct enum_list enum_config_backend
[] = {
912 {CONFIG_BACKEND_FILE
, "file"},
913 {CONFIG_BACKEND_REGISTRY
, "registry"},
917 /* ADS kerberos ticket verification options */
919 static const struct enum_list enum_kerberos_method
[] = {
920 {KERBEROS_VERIFY_SECRETS
, "default"},
921 {KERBEROS_VERIFY_SECRETS
, "secrets only"},
922 {KERBEROS_VERIFY_SYSTEM_KEYTAB
, "system keytab"},
923 {KERBEROS_VERIFY_DEDICATED_KEYTAB
, "dedicated keytab"},
924 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB
, "secrets and keytab"},
928 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
930 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
931 * screen in SWAT. This is used to exclude parameters as well as to squash all
932 * parameters that have been duplicated by pseudonyms.
934 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
935 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
936 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
939 * NOTE2: Handling of duplicated (synonym) parameters:
940 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
941 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
942 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
943 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
946 static struct parm_struct parm_table
[] = {
947 {N_("Base Options"), P_SEP
, P_SEPARATOR
},
950 .label
= "dos charset",
953 .ptr
= &Globals
.dos_charset
,
954 .special
= handle_charset
,
956 .flags
= FLAG_ADVANCED
959 .label
= "unix charset",
962 .ptr
= &Globals
.unix_charset
,
963 .special
= handle_charset
,
965 .flags
= FLAG_ADVANCED
968 .label
= "display charset",
971 .ptr
= &Globals
.display_charset
,
972 .special
= handle_charset
,
974 .flags
= FLAG_ADVANCED
980 .ptr
= &sDefault
.comment
,
983 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
989 .ptr
= &sDefault
.szPath
,
992 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
995 .label
= "directory",
998 .ptr
= &sDefault
.szPath
,
1004 .label
= "workgroup",
1006 .p_class
= P_GLOBAL
,
1007 .ptr
= &Globals
.szWorkgroup
,
1008 .special
= handle_workgroup
,
1010 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1016 .p_class
= P_GLOBAL
,
1017 .ptr
= &Globals
.szRealm
,
1020 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1024 .label
= "netbios name",
1026 .p_class
= P_GLOBAL
,
1027 .ptr
= &Globals
.szNetbiosName
,
1028 .special
= handle_netbios_name
,
1030 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1033 .label
= "netbios aliases",
1035 .p_class
= P_GLOBAL
,
1036 .ptr
= &Globals
.szNetbiosAliases
,
1037 .special
= handle_netbios_aliases
,
1039 .flags
= FLAG_ADVANCED
,
1042 .label
= "netbios scope",
1044 .p_class
= P_GLOBAL
,
1045 .ptr
= &Globals
.szNetbiosScope
,
1046 .special
= handle_netbios_scope
,
1048 .flags
= FLAG_ADVANCED
,
1051 .label
= "server string",
1053 .p_class
= P_GLOBAL
,
1054 .ptr
= &Globals
.szServerString
,
1057 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1060 .label
= "interfaces",
1062 .p_class
= P_GLOBAL
,
1063 .ptr
= &Globals
.szInterfaces
,
1066 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1069 .label
= "bind interfaces only",
1071 .p_class
= P_GLOBAL
,
1072 .ptr
= &Globals
.bBindInterfacesOnly
,
1075 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1078 .label
= "config backend",
1080 .p_class
= P_GLOBAL
,
1081 .ptr
= &Globals
.ConfigBackend
,
1083 .enum_list
= enum_config_backend
,
1084 .flags
= FLAG_HIDE
|FLAG_ADVANCED
|FLAG_META
,
1087 {N_("Security Options"), P_SEP
, P_SEPARATOR
},
1090 .label
= "security",
1092 .p_class
= P_GLOBAL
,
1093 .ptr
= &Globals
.security
,
1095 .enum_list
= enum_security
,
1096 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1099 .label
= "auth methods",
1101 .p_class
= P_GLOBAL
,
1102 .ptr
= &Globals
.AuthMethods
,
1105 .flags
= FLAG_ADVANCED
,
1108 .label
= "encrypt passwords",
1110 .p_class
= P_GLOBAL
,
1111 .ptr
= &Globals
.bEncryptPasswords
,
1114 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1117 .label
= "client schannel",
1119 .p_class
= P_GLOBAL
,
1120 .ptr
= &Globals
.clientSchannel
,
1122 .enum_list
= enum_bool_auto
,
1123 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1126 .label
= "server schannel",
1128 .p_class
= P_GLOBAL
,
1129 .ptr
= &Globals
.serverSchannel
,
1131 .enum_list
= enum_bool_auto
,
1132 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1135 .label
= "allow trusted domains",
1137 .p_class
= P_GLOBAL
,
1138 .ptr
= &Globals
.bAllowTrustedDomains
,
1141 .flags
= FLAG_ADVANCED
,
1144 .label
= "map to guest",
1146 .p_class
= P_GLOBAL
,
1147 .ptr
= &Globals
.map_to_guest
,
1149 .enum_list
= enum_map_to_guest
,
1150 .flags
= FLAG_ADVANCED
,
1153 .label
= "null passwords",
1155 .p_class
= P_GLOBAL
,
1156 .ptr
= &Globals
.bNullPasswords
,
1159 .flags
= FLAG_ADVANCED
,
1162 .label
= "obey pam restrictions",
1164 .p_class
= P_GLOBAL
,
1165 .ptr
= &Globals
.bObeyPamRestrictions
,
1168 .flags
= FLAG_ADVANCED
,
1171 .label
= "password server",
1173 .p_class
= P_GLOBAL
,
1174 .ptr
= &Globals
.szPasswordServer
,
1177 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1180 .label
= "smb passwd file",
1182 .p_class
= P_GLOBAL
,
1183 .ptr
= &Globals
.szSMBPasswdFile
,
1186 .flags
= FLAG_ADVANCED
,
1189 .label
= "private dir",
1191 .p_class
= P_GLOBAL
,
1192 .ptr
= &Globals
.szPrivateDir
,
1195 .flags
= FLAG_ADVANCED
,
1198 .label
= "passdb backend",
1200 .p_class
= P_GLOBAL
,
1201 .ptr
= &Globals
.szPassdbBackend
,
1204 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1207 .label
= "algorithmic rid base",
1209 .p_class
= P_GLOBAL
,
1210 .ptr
= &Globals
.AlgorithmicRidBase
,
1213 .flags
= FLAG_ADVANCED
,
1216 .label
= "root directory",
1218 .p_class
= P_GLOBAL
,
1219 .ptr
= &Globals
.szRootdir
,
1222 .flags
= FLAG_ADVANCED
,
1225 .label
= "root dir",
1227 .p_class
= P_GLOBAL
,
1228 .ptr
= &Globals
.szRootdir
,
1236 .p_class
= P_GLOBAL
,
1237 .ptr
= &Globals
.szRootdir
,
1243 .label
= "guest account",
1245 .p_class
= P_GLOBAL
,
1246 .ptr
= &Globals
.szGuestaccount
,
1249 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1252 .label
= "enable privileges",
1254 .p_class
= P_GLOBAL
,
1255 .ptr
= &Globals
.bEnablePrivileges
,
1258 .flags
= FLAG_ADVANCED
,
1262 .label
= "pam password change",
1264 .p_class
= P_GLOBAL
,
1265 .ptr
= &Globals
.bPamPasswordChange
,
1268 .flags
= FLAG_ADVANCED
,
1271 .label
= "passwd program",
1273 .p_class
= P_GLOBAL
,
1274 .ptr
= &Globals
.szPasswdProgram
,
1277 .flags
= FLAG_ADVANCED
,
1280 .label
= "passwd chat",
1282 .p_class
= P_GLOBAL
,
1283 .ptr
= &Globals
.szPasswdChat
,
1286 .flags
= FLAG_ADVANCED
,
1289 .label
= "passwd chat debug",
1291 .p_class
= P_GLOBAL
,
1292 .ptr
= &Globals
.bPasswdChatDebug
,
1295 .flags
= FLAG_ADVANCED
,
1298 .label
= "passwd chat timeout",
1300 .p_class
= P_GLOBAL
,
1301 .ptr
= &Globals
.iPasswdChatTimeout
,
1304 .flags
= FLAG_ADVANCED
,
1307 .label
= "check password script",
1309 .p_class
= P_GLOBAL
,
1310 .ptr
= &Globals
.szCheckPasswordScript
,
1313 .flags
= FLAG_ADVANCED
,
1316 .label
= "username map",
1318 .p_class
= P_GLOBAL
,
1319 .ptr
= &Globals
.szUsernameMap
,
1322 .flags
= FLAG_ADVANCED
,
1325 .label
= "password level",
1327 .p_class
= P_GLOBAL
,
1328 .ptr
= &Globals
.pwordlevel
,
1331 .flags
= FLAG_ADVANCED
,
1334 .label
= "username level",
1336 .p_class
= P_GLOBAL
,
1337 .ptr
= &Globals
.unamelevel
,
1340 .flags
= FLAG_ADVANCED
,
1343 .label
= "unix password sync",
1345 .p_class
= P_GLOBAL
,
1346 .ptr
= &Globals
.bUnixPasswdSync
,
1349 .flags
= FLAG_ADVANCED
,
1352 .label
= "restrict anonymous",
1354 .p_class
= P_GLOBAL
,
1355 .ptr
= &Globals
.restrict_anonymous
,
1358 .flags
= FLAG_ADVANCED
,
1361 .label
= "lanman auth",
1363 .p_class
= P_GLOBAL
,
1364 .ptr
= &Globals
.bLanmanAuth
,
1367 .flags
= FLAG_ADVANCED
,
1370 .label
= "ntlm auth",
1372 .p_class
= P_GLOBAL
,
1373 .ptr
= &Globals
.bNTLMAuth
,
1376 .flags
= FLAG_ADVANCED
,
1379 .label
= "client NTLMv2 auth",
1381 .p_class
= P_GLOBAL
,
1382 .ptr
= &Globals
.bClientNTLMv2Auth
,
1385 .flags
= FLAG_ADVANCED
,
1388 .label
= "client lanman auth",
1390 .p_class
= P_GLOBAL
,
1391 .ptr
= &Globals
.bClientLanManAuth
,
1394 .flags
= FLAG_ADVANCED
,
1397 .label
= "client plaintext auth",
1399 .p_class
= P_GLOBAL
,
1400 .ptr
= &Globals
.bClientPlaintextAuth
,
1403 .flags
= FLAG_ADVANCED
,
1406 .label
= "client use spnego principal",
1408 .p_class
= P_GLOBAL
,
1409 .ptr
= &Globals
.client_use_spnego_principal
,
1412 .flags
= FLAG_ADVANCED
,
1415 .label
= "send spnego principal",
1417 .p_class
= P_GLOBAL
,
1418 .ptr
= &Globals
.send_spnego_principal
,
1421 .flags
= FLAG_ADVANCED
,
1424 .label
= "username",
1427 .ptr
= &sDefault
.szUsername
,
1430 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1436 .ptr
= &sDefault
.szUsername
,
1445 .ptr
= &sDefault
.szUsername
,
1451 .label
= "invalid users",
1454 .ptr
= &sDefault
.szInvalidUsers
,
1457 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1460 .label
= "valid users",
1463 .ptr
= &sDefault
.szValidUsers
,
1466 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1469 .label
= "admin users",
1472 .ptr
= &sDefault
.szAdminUsers
,
1475 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1478 .label
= "read list",
1481 .ptr
= &sDefault
.readlist
,
1484 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1487 .label
= "write list",
1490 .ptr
= &sDefault
.writelist
,
1493 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1496 .label
= "printer admin",
1499 .ptr
= &sDefault
.printer_admin
,
1502 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_PRINT
| FLAG_DEPRECATED
,
1505 .label
= "force user",
1508 .ptr
= &sDefault
.force_user
,
1511 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1514 .label
= "force group",
1517 .ptr
= &sDefault
.force_group
,
1520 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1526 .ptr
= &sDefault
.force_group
,
1529 .flags
= FLAG_ADVANCED
,
1532 .label
= "read only",
1535 .ptr
= &sDefault
.bRead_only
,
1538 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
,
1541 .label
= "write ok",
1544 .ptr
= &sDefault
.bRead_only
,
1550 .label
= "writeable",
1553 .ptr
= &sDefault
.bRead_only
,
1559 .label
= "writable",
1562 .ptr
= &sDefault
.bRead_only
,
1568 .label
= "acl check permissions",
1571 .ptr
= &sDefault
.bAclCheckPermissions
,
1574 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1577 .label
= "acl group control",
1580 .ptr
= &sDefault
.bAclGroupControl
,
1583 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1586 .label
= "acl map full control",
1589 .ptr
= &sDefault
.bAclMapFullControl
,
1592 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1595 .label
= "create mask",
1598 .ptr
= &sDefault
.iCreate_mask
,
1601 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1604 .label
= "create mode",
1607 .ptr
= &sDefault
.iCreate_mask
,
1613 .label
= "force create mode",
1616 .ptr
= &sDefault
.iCreate_force_mode
,
1619 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1622 .label
= "security mask",
1625 .ptr
= &sDefault
.iSecurity_mask
,
1628 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1631 .label
= "force security mode",
1634 .ptr
= &sDefault
.iSecurity_force_mode
,
1637 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1640 .label
= "directory mask",
1643 .ptr
= &sDefault
.iDir_mask
,
1646 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1649 .label
= "directory mode",
1652 .ptr
= &sDefault
.iDir_mask
,
1655 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1658 .label
= "force directory mode",
1661 .ptr
= &sDefault
.iDir_force_mode
,
1664 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1667 .label
= "directory security mask",
1670 .ptr
= &sDefault
.iDir_Security_mask
,
1673 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1676 .label
= "force directory security mode",
1679 .ptr
= &sDefault
.iDir_Security_force_mode
,
1682 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1685 .label
= "force unknown acl user",
1688 .ptr
= &sDefault
.bForceUnknownAclUser
,
1691 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1694 .label
= "inherit permissions",
1697 .ptr
= &sDefault
.bInheritPerms
,
1700 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1703 .label
= "inherit acls",
1706 .ptr
= &sDefault
.bInheritACLS
,
1709 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1712 .label
= "inherit owner",
1715 .ptr
= &sDefault
.bInheritOwner
,
1718 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1721 .label
= "guest only",
1724 .ptr
= &sDefault
.bGuest_only
,
1727 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1730 .label
= "only guest",
1733 .ptr
= &sDefault
.bGuest_only
,
1739 .label
= "administrative share",
1742 .ptr
= &sDefault
.bAdministrative_share
,
1745 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1749 .label
= "guest ok",
1752 .ptr
= &sDefault
.bGuest_ok
,
1755 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1761 .ptr
= &sDefault
.bGuest_ok
,
1767 .label
= "only user",
1770 .ptr
= &sDefault
.bOnlyUser
,
1773 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_DEPRECATED
,
1776 .label
= "hosts allow",
1779 .ptr
= &sDefault
.szHostsallow
,
1782 .flags
= FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1785 .label
= "allow hosts",
1788 .ptr
= &sDefault
.szHostsallow
,
1794 .label
= "hosts deny",
1797 .ptr
= &sDefault
.szHostsdeny
,
1800 .flags
= FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1803 .label
= "deny hosts",
1806 .ptr
= &sDefault
.szHostsdeny
,
1812 .label
= "preload modules",
1814 .p_class
= P_GLOBAL
,
1815 .ptr
= &Globals
.szPreloadModules
,
1818 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1821 .label
= "dedicated keytab file",
1823 .p_class
= P_GLOBAL
,
1824 .ptr
= &Globals
.szDedicatedKeytabFile
,
1827 .flags
= FLAG_ADVANCED
,
1830 .label
= "kerberos method",
1832 .p_class
= P_GLOBAL
,
1833 .ptr
= &Globals
.iKerberosMethod
,
1835 .enum_list
= enum_kerberos_method
,
1836 .flags
= FLAG_ADVANCED
,
1839 .label
= "map untrusted to domain",
1841 .p_class
= P_GLOBAL
,
1842 .ptr
= &Globals
.bMapUntrustedToDomain
,
1845 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1849 {N_("Logging Options"), P_SEP
, P_SEPARATOR
},
1852 .label
= "log level",
1854 .p_class
= P_GLOBAL
,
1855 .ptr
= &Globals
.szLogLevel
,
1856 .special
= handle_debug_list
,
1858 .flags
= FLAG_ADVANCED
,
1861 .label
= "debuglevel",
1863 .p_class
= P_GLOBAL
,
1864 .ptr
= &Globals
.szLogLevel
,
1865 .special
= handle_debug_list
,
1872 .p_class
= P_GLOBAL
,
1873 .ptr
= &Globals
.syslog
,
1876 .flags
= FLAG_ADVANCED
,
1879 .label
= "syslog only",
1881 .p_class
= P_GLOBAL
,
1882 .ptr
= &Globals
.bSyslogOnly
,
1885 .flags
= FLAG_ADVANCED
,
1888 .label
= "log file",
1890 .p_class
= P_GLOBAL
,
1891 .ptr
= &Globals
.szLogFile
,
1894 .flags
= FLAG_ADVANCED
,
1897 .label
= "max log size",
1899 .p_class
= P_GLOBAL
,
1900 .ptr
= &Globals
.max_log_size
,
1903 .flags
= FLAG_ADVANCED
,
1906 .label
= "debug timestamp",
1908 .p_class
= P_GLOBAL
,
1909 .ptr
= &Globals
.bTimestampLogs
,
1912 .flags
= FLAG_ADVANCED
,
1915 .label
= "timestamp logs",
1917 .p_class
= P_GLOBAL
,
1918 .ptr
= &Globals
.bTimestampLogs
,
1921 .flags
= FLAG_ADVANCED
,
1924 .label
= "debug prefix timestamp",
1926 .p_class
= P_GLOBAL
,
1927 .ptr
= &Globals
.bDebugPrefixTimestamp
,
1930 .flags
= FLAG_ADVANCED
,
1933 .label
= "debug hires timestamp",
1935 .p_class
= P_GLOBAL
,
1936 .ptr
= &Globals
.bDebugHiresTimestamp
,
1939 .flags
= FLAG_ADVANCED
,
1942 .label
= "debug pid",
1944 .p_class
= P_GLOBAL
,
1945 .ptr
= &Globals
.bDebugPid
,
1948 .flags
= FLAG_ADVANCED
,
1951 .label
= "debug uid",
1953 .p_class
= P_GLOBAL
,
1954 .ptr
= &Globals
.bDebugUid
,
1957 .flags
= FLAG_ADVANCED
,
1960 .label
= "debug class",
1962 .p_class
= P_GLOBAL
,
1963 .ptr
= &Globals
.bDebugClass
,
1966 .flags
= FLAG_ADVANCED
,
1969 .label
= "enable core files",
1971 .p_class
= P_GLOBAL
,
1972 .ptr
= &Globals
.bEnableCoreFiles
,
1975 .flags
= FLAG_ADVANCED
,
1978 {N_("Protocol Options"), P_SEP
, P_SEPARATOR
},
1981 .label
= "allocation roundup size",
1984 .ptr
= &sDefault
.iallocation_roundup_size
,
1987 .flags
= FLAG_ADVANCED
,
1990 .label
= "aio read size",
1993 .ptr
= &sDefault
.iAioReadSize
,
1996 .flags
= FLAG_ADVANCED
,
1999 .label
= "aio write size",
2002 .ptr
= &sDefault
.iAioWriteSize
,
2005 .flags
= FLAG_ADVANCED
,
2008 .label
= "aio write behind",
2011 .ptr
= &sDefault
.szAioWriteBehind
,
2014 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2017 .label
= "smb ports",
2019 .p_class
= P_GLOBAL
,
2020 .ptr
= &Globals
.smb_ports
,
2023 .flags
= FLAG_ADVANCED
,
2026 .label
= "large readwrite",
2028 .p_class
= P_GLOBAL
,
2029 .ptr
= &Globals
.bLargeReadwrite
,
2032 .flags
= FLAG_ADVANCED
,
2035 .label
= "max protocol",
2037 .p_class
= P_GLOBAL
,
2038 .ptr
= &Globals
.maxprotocol
,
2040 .enum_list
= enum_protocol
,
2041 .flags
= FLAG_ADVANCED
,
2044 .label
= "protocol",
2046 .p_class
= P_GLOBAL
,
2047 .ptr
= &Globals
.maxprotocol
,
2049 .enum_list
= enum_protocol
,
2050 .flags
= FLAG_ADVANCED
,
2053 .label
= "min protocol",
2055 .p_class
= P_GLOBAL
,
2056 .ptr
= &Globals
.minprotocol
,
2058 .enum_list
= enum_protocol
,
2059 .flags
= FLAG_ADVANCED
,
2062 .label
= "min receivefile size",
2064 .p_class
= P_GLOBAL
,
2065 .ptr
= &Globals
.iminreceivefile
,
2068 .flags
= FLAG_ADVANCED
,
2071 .label
= "read raw",
2073 .p_class
= P_GLOBAL
,
2074 .ptr
= &Globals
.bReadRaw
,
2077 .flags
= FLAG_ADVANCED
,
2080 .label
= "write raw",
2082 .p_class
= P_GLOBAL
,
2083 .ptr
= &Globals
.bWriteRaw
,
2086 .flags
= FLAG_ADVANCED
,
2089 .label
= "disable netbios",
2091 .p_class
= P_GLOBAL
,
2092 .ptr
= &Globals
.bDisableNetbios
,
2095 .flags
= FLAG_ADVANCED
,
2098 .label
= "reset on zero vc",
2100 .p_class
= P_GLOBAL
,
2101 .ptr
= &Globals
.bResetOnZeroVC
,
2104 .flags
= FLAG_ADVANCED
,
2107 .label
= "log writeable files on exit",
2109 .p_class
= P_GLOBAL
,
2110 .ptr
= &Globals
.bLogWriteableFilesOnExit
,
2113 .flags
= FLAG_ADVANCED
,
2116 .label
= "acl compatibility",
2118 .p_class
= P_GLOBAL
,
2119 .ptr
= &Globals
.iAclCompat
,
2121 .enum_list
= enum_acl_compat_vals
,
2122 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2125 .label
= "defer sharing violations",
2127 .p_class
= P_GLOBAL
,
2128 .ptr
= &Globals
.bDeferSharingViolations
,
2131 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2134 .label
= "ea support",
2137 .ptr
= &sDefault
.bEASupport
,
2140 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2143 .label
= "nt acl support",
2146 .ptr
= &sDefault
.bNTAclSupport
,
2149 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2152 .label
= "nt pipe support",
2154 .p_class
= P_GLOBAL
,
2155 .ptr
= &Globals
.bNTPipeSupport
,
2158 .flags
= FLAG_ADVANCED
,
2161 .label
= "nt status support",
2163 .p_class
= P_GLOBAL
,
2164 .ptr
= &Globals
.bNTStatusSupport
,
2167 .flags
= FLAG_ADVANCED
,
2170 .label
= "profile acls",
2173 .ptr
= &sDefault
.bProfileAcls
,
2176 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
2179 .label
= "announce version",
2181 .p_class
= P_GLOBAL
,
2182 .ptr
= &Globals
.szAnnounceVersion
,
2185 .flags
= FLAG_ADVANCED
,
2188 .label
= "announce as",
2190 .p_class
= P_GLOBAL
,
2191 .ptr
= &Globals
.announce_as
,
2193 .enum_list
= enum_announce_as
,
2194 .flags
= FLAG_ADVANCED
,
2197 .label
= "map acl inherit",
2200 .ptr
= &sDefault
.bMap_acl_inherit
,
2203 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2206 .label
= "afs share",
2209 .ptr
= &sDefault
.bAfs_Share
,
2212 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2217 .p_class
= P_GLOBAL
,
2218 .ptr
= &Globals
.max_mux
,
2221 .flags
= FLAG_ADVANCED
,
2224 .label
= "max xmit",
2226 .p_class
= P_GLOBAL
,
2227 .ptr
= &Globals
.max_xmit
,
2230 .flags
= FLAG_ADVANCED
,
2233 .label
= "name resolve order",
2235 .p_class
= P_GLOBAL
,
2236 .ptr
= &Globals
.szNameResolveOrder
,
2239 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
2244 .p_class
= P_GLOBAL
,
2245 .ptr
= &Globals
.max_ttl
,
2248 .flags
= FLAG_ADVANCED
,
2251 .label
= "max wins ttl",
2253 .p_class
= P_GLOBAL
,
2254 .ptr
= &Globals
.max_wins_ttl
,
2257 .flags
= FLAG_ADVANCED
,
2260 .label
= "min wins ttl",
2262 .p_class
= P_GLOBAL
,
2263 .ptr
= &Globals
.min_wins_ttl
,
2266 .flags
= FLAG_ADVANCED
,
2269 .label
= "time server",
2271 .p_class
= P_GLOBAL
,
2272 .ptr
= &Globals
.bTimeServer
,
2275 .flags
= FLAG_ADVANCED
,
2278 .label
= "unix extensions",
2280 .p_class
= P_GLOBAL
,
2281 .ptr
= &Globals
.bUnixExtensions
,
2284 .flags
= FLAG_ADVANCED
,
2287 .label
= "use spnego",
2289 .p_class
= P_GLOBAL
,
2290 .ptr
= &Globals
.bUseSpnego
,
2293 .flags
= FLAG_ADVANCED
,
2296 .label
= "client signing",
2298 .p_class
= P_GLOBAL
,
2299 .ptr
= &Globals
.client_signing
,
2301 .enum_list
= enum_smb_signing_vals
,
2302 .flags
= FLAG_ADVANCED
,
2305 .label
= "server signing",
2307 .p_class
= P_GLOBAL
,
2308 .ptr
= &Globals
.server_signing
,
2310 .enum_list
= enum_smb_signing_vals
,
2311 .flags
= FLAG_ADVANCED
,
2314 .label
= "smb encrypt",
2317 .ptr
= &sDefault
.ismb_encrypt
,
2319 .enum_list
= enum_smb_signing_vals
,
2320 .flags
= FLAG_ADVANCED
,
2323 .label
= "client use spnego",
2325 .p_class
= P_GLOBAL
,
2326 .ptr
= &Globals
.bClientUseSpnego
,
2329 .flags
= FLAG_ADVANCED
,
2332 .label
= "client ldap sasl wrapping",
2334 .p_class
= P_GLOBAL
,
2335 .ptr
= &Globals
.client_ldap_sasl_wrapping
,
2337 .enum_list
= enum_ldap_sasl_wrapping
,
2338 .flags
= FLAG_ADVANCED
,
2341 .label
= "enable asu support",
2343 .p_class
= P_GLOBAL
,
2344 .ptr
= &Globals
.bASUSupport
,
2347 .flags
= FLAG_ADVANCED
,
2350 .label
= "svcctl list",
2352 .p_class
= P_GLOBAL
,
2353 .ptr
= &Globals
.szServicesList
,
2356 .flags
= FLAG_ADVANCED
,
2359 {N_("Tuning Options"), P_SEP
, P_SEPARATOR
},
2362 .label
= "block size",
2365 .ptr
= &sDefault
.iBlock_size
,
2368 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2371 .label
= "deadtime",
2373 .p_class
= P_GLOBAL
,
2374 .ptr
= &Globals
.deadtime
,
2377 .flags
= FLAG_ADVANCED
,
2380 .label
= "getwd cache",
2382 .p_class
= P_GLOBAL
,
2383 .ptr
= &Globals
.getwd_cache
,
2386 .flags
= FLAG_ADVANCED
,
2389 .label
= "keepalive",
2391 .p_class
= P_GLOBAL
,
2392 .ptr
= &Globals
.iKeepalive
,
2395 .flags
= FLAG_ADVANCED
,
2398 .label
= "change notify",
2401 .ptr
= &sDefault
.bChangeNotify
,
2404 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2407 .label
= "directory name cache size",
2410 .ptr
= &sDefault
.iDirectoryNameCacheSize
,
2413 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2416 .label
= "kernel change notify",
2419 .ptr
= &sDefault
.bKernelChangeNotify
,
2422 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2425 .label
= "lpq cache time",
2427 .p_class
= P_GLOBAL
,
2428 .ptr
= &Globals
.lpqcachetime
,
2431 .flags
= FLAG_ADVANCED
,
2434 .label
= "max smbd processes",
2436 .p_class
= P_GLOBAL
,
2437 .ptr
= &Globals
.iMaxSmbdProcesses
,
2440 .flags
= FLAG_ADVANCED
,
2443 .label
= "max connections",
2446 .ptr
= &sDefault
.iMaxConnections
,
2449 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2452 .label
= "paranoid server security",
2454 .p_class
= P_GLOBAL
,
2455 .ptr
= &Globals
.paranoid_server_security
,
2458 .flags
= FLAG_ADVANCED
,
2461 .label
= "max disk size",
2463 .p_class
= P_GLOBAL
,
2464 .ptr
= &Globals
.maxdisksize
,
2467 .flags
= FLAG_ADVANCED
,
2470 .label
= "max open files",
2472 .p_class
= P_GLOBAL
,
2473 .ptr
= &Globals
.max_open_files
,
2476 .flags
= FLAG_ADVANCED
,
2479 .label
= "min print space",
2482 .ptr
= &sDefault
.iMinPrintSpace
,
2485 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2488 .label
= "socket options",
2490 .p_class
= P_GLOBAL
,
2491 .ptr
= &Globals
.szSocketOptions
,
2494 .flags
= FLAG_ADVANCED
,
2497 .label
= "strict allocate",
2500 .ptr
= &sDefault
.bStrictAllocate
,
2503 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2506 .label
= "strict sync",
2509 .ptr
= &sDefault
.bStrictSync
,
2512 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2515 .label
= "sync always",
2518 .ptr
= &sDefault
.bSyncAlways
,
2521 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2524 .label
= "use mmap",
2526 .p_class
= P_GLOBAL
,
2527 .ptr
= &Globals
.bUseMmap
,
2530 .flags
= FLAG_ADVANCED
,
2533 .label
= "use sendfile",
2536 .ptr
= &sDefault
.bUseSendfile
,
2539 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2542 .label
= "hostname lookups",
2544 .p_class
= P_GLOBAL
,
2545 .ptr
= &Globals
.bHostnameLookups
,
2548 .flags
= FLAG_ADVANCED
,
2551 .label
= "write cache size",
2554 .ptr
= &sDefault
.iWriteCacheSize
,
2557 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2560 .label
= "name cache timeout",
2562 .p_class
= P_GLOBAL
,
2563 .ptr
= &Globals
.name_cache_timeout
,
2566 .flags
= FLAG_ADVANCED
,
2569 .label
= "ctdbd socket",
2571 .p_class
= P_GLOBAL
,
2572 .ptr
= &Globals
.ctdbdSocket
,
2575 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2578 .label
= "cluster addresses",
2580 .p_class
= P_GLOBAL
,
2581 .ptr
= &Globals
.szClusterAddresses
,
2584 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2587 .label
= "clustering",
2589 .p_class
= P_GLOBAL
,
2590 .ptr
= &Globals
.clustering
,
2593 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2596 .label
= "ctdb timeout",
2598 .p_class
= P_GLOBAL
,
2599 .ptr
= &Globals
.ctdb_timeout
,
2602 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2605 .label
= "ctdb locktime warn threshold",
2607 .p_class
= P_GLOBAL
,
2608 .ptr
= &Globals
.ctdb_locktime_warn_threshold
,
2611 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2614 .label
= "smb2 max read",
2616 .p_class
= P_GLOBAL
,
2617 .ptr
= &Globals
.ismb2_max_read
,
2620 .flags
= FLAG_ADVANCED
,
2623 .label
= "smb2 max write",
2625 .p_class
= P_GLOBAL
,
2626 .ptr
= &Globals
.ismb2_max_write
,
2629 .flags
= FLAG_ADVANCED
,
2632 .label
= "smb2 max trans",
2634 .p_class
= P_GLOBAL
,
2635 .ptr
= &Globals
.ismb2_max_trans
,
2638 .flags
= FLAG_ADVANCED
,
2641 .label
= "smb2 max credits",
2643 .p_class
= P_GLOBAL
,
2644 .ptr
= &Globals
.ismb2_max_credits
,
2647 .flags
= FLAG_ADVANCED
,
2650 {N_("Printing Options"), P_SEP
, P_SEPARATOR
},
2653 .label
= "max reported print jobs",
2656 .ptr
= &sDefault
.iMaxReportedPrintJobs
,
2659 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2662 .label
= "max print jobs",
2665 .ptr
= &sDefault
.iMaxPrintJobs
,
2668 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2671 .label
= "load printers",
2673 .p_class
= P_GLOBAL
,
2674 .ptr
= &Globals
.bLoadPrinters
,
2677 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2680 .label
= "printcap cache time",
2682 .p_class
= P_GLOBAL
,
2683 .ptr
= &Globals
.PrintcapCacheTime
,
2686 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2689 .label
= "printcap name",
2691 .p_class
= P_GLOBAL
,
2692 .ptr
= &Globals
.szPrintcapname
,
2695 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2698 .label
= "printcap",
2700 .p_class
= P_GLOBAL
,
2701 .ptr
= &Globals
.szPrintcapname
,
2707 .label
= "printable",
2710 .ptr
= &sDefault
.bPrint_ok
,
2713 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2716 .label
= "print ok",
2719 .ptr
= &sDefault
.bPrint_ok
,
2725 .label
= "printing",
2728 .ptr
= &sDefault
.iPrinting
,
2729 .special
= handle_printing
,
2730 .enum_list
= enum_printing
,
2731 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2734 .label
= "cups options",
2737 .ptr
= &sDefault
.szCupsOptions
,
2740 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2743 .label
= "cups server",
2745 .p_class
= P_GLOBAL
,
2746 .ptr
= &Globals
.szCupsServer
,
2749 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2752 .label
= "cups encrypt",
2754 .p_class
= P_GLOBAL
,
2755 .ptr
= &Globals
.CupsEncrypt
,
2757 .enum_list
= enum_bool_auto
,
2758 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2762 .label
= "cups connection timeout",
2764 .p_class
= P_GLOBAL
,
2765 .ptr
= &Globals
.cups_connection_timeout
,
2768 .flags
= FLAG_ADVANCED
,
2771 .label
= "iprint server",
2773 .p_class
= P_GLOBAL
,
2774 .ptr
= &Globals
.szIPrintServer
,
2777 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2780 .label
= "print command",
2783 .ptr
= &sDefault
.szPrintcommand
,
2786 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2789 .label
= "disable spoolss",
2791 .p_class
= P_GLOBAL
,
2792 .ptr
= &Globals
.bDisableSpoolss
,
2795 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2798 .label
= "enable spoolss",
2800 .p_class
= P_GLOBAL
,
2801 .ptr
= &Globals
.bDisableSpoolss
,
2807 .label
= "lpq command",
2810 .ptr
= &sDefault
.szLpqcommand
,
2813 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2816 .label
= "lprm command",
2819 .ptr
= &sDefault
.szLprmcommand
,
2822 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2825 .label
= "lppause command",
2828 .ptr
= &sDefault
.szLppausecommand
,
2831 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2834 .label
= "lpresume command",
2837 .ptr
= &sDefault
.szLpresumecommand
,
2840 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2843 .label
= "queuepause command",
2846 .ptr
= &sDefault
.szQueuepausecommand
,
2849 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2852 .label
= "queueresume command",
2855 .ptr
= &sDefault
.szQueueresumecommand
,
2858 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2861 .label
= "addport command",
2863 .p_class
= P_GLOBAL
,
2864 .ptr
= &Globals
.szAddPortCommand
,
2867 .flags
= FLAG_ADVANCED
,
2870 .label
= "enumports command",
2872 .p_class
= P_GLOBAL
,
2873 .ptr
= &Globals
.szEnumPortsCommand
,
2876 .flags
= FLAG_ADVANCED
,
2879 .label
= "addprinter command",
2881 .p_class
= P_GLOBAL
,
2882 .ptr
= &Globals
.szAddPrinterCommand
,
2885 .flags
= FLAG_ADVANCED
,
2888 .label
= "deleteprinter command",
2890 .p_class
= P_GLOBAL
,
2891 .ptr
= &Globals
.szDeletePrinterCommand
,
2894 .flags
= FLAG_ADVANCED
,
2897 .label
= "show add printer wizard",
2899 .p_class
= P_GLOBAL
,
2900 .ptr
= &Globals
.bMsAddPrinterWizard
,
2903 .flags
= FLAG_ADVANCED
,
2906 .label
= "os2 driver map",
2908 .p_class
= P_GLOBAL
,
2909 .ptr
= &Globals
.szOs2DriverMap
,
2912 .flags
= FLAG_ADVANCED
,
2916 .label
= "printer name",
2919 .ptr
= &sDefault
.szPrintername
,
2922 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2928 .ptr
= &sDefault
.szPrintername
,
2934 .label
= "use client driver",
2937 .ptr
= &sDefault
.bUseClientDriver
,
2940 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2943 .label
= "default devmode",
2946 .ptr
= &sDefault
.bDefaultDevmode
,
2949 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2952 .label
= "force printername",
2955 .ptr
= &sDefault
.bForcePrintername
,
2958 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2961 .label
= "printjob username",
2964 .ptr
= &sDefault
.szPrintjobUsername
,
2967 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2970 {N_("Filename Handling"), P_SEP
, P_SEPARATOR
},
2973 .label
= "mangling method",
2975 .p_class
= P_GLOBAL
,
2976 .ptr
= &Globals
.szManglingMethod
,
2979 .flags
= FLAG_ADVANCED
,
2982 .label
= "mangle prefix",
2984 .p_class
= P_GLOBAL
,
2985 .ptr
= &Globals
.mangle_prefix
,
2988 .flags
= FLAG_ADVANCED
,
2992 .label
= "default case",
2995 .ptr
= &sDefault
.iDefaultCase
,
2997 .enum_list
= enum_case
,
2998 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
3001 .label
= "case sensitive",
3004 .ptr
= &sDefault
.iCaseSensitive
,
3006 .enum_list
= enum_bool_auto
,
3007 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3010 .label
= "casesignames",
3013 .ptr
= &sDefault
.iCaseSensitive
,
3015 .enum_list
= enum_bool_auto
,
3016 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
| FLAG_HIDE
,
3019 .label
= "preserve case",
3022 .ptr
= &sDefault
.bCasePreserve
,
3025 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3028 .label
= "short preserve case",
3031 .ptr
= &sDefault
.bShortCasePreserve
,
3034 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3037 .label
= "mangling char",
3040 .ptr
= &sDefault
.magic_char
,
3043 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3046 .label
= "hide dot files",
3049 .ptr
= &sDefault
.bHideDotFiles
,
3052 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3055 .label
= "hide special files",
3058 .ptr
= &sDefault
.bHideSpecialFiles
,
3061 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3064 .label
= "hide unreadable",
3067 .ptr
= &sDefault
.bHideUnReadable
,
3070 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3073 .label
= "hide unwriteable files",
3076 .ptr
= &sDefault
.bHideUnWriteableFiles
,
3079 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3082 .label
= "delete veto files",
3085 .ptr
= &sDefault
.bDeleteVetoFiles
,
3088 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3091 .label
= "veto files",
3094 .ptr
= &sDefault
.szVetoFiles
,
3097 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3100 .label
= "hide files",
3103 .ptr
= &sDefault
.szHideFiles
,
3106 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3109 .label
= "veto oplock files",
3112 .ptr
= &sDefault
.szVetoOplockFiles
,
3115 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3118 .label
= "map archive",
3121 .ptr
= &sDefault
.bMap_archive
,
3124 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3127 .label
= "map hidden",
3130 .ptr
= &sDefault
.bMap_hidden
,
3133 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3136 .label
= "map system",
3139 .ptr
= &sDefault
.bMap_system
,
3142 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3145 .label
= "map readonly",
3148 .ptr
= &sDefault
.iMap_readonly
,
3150 .enum_list
= enum_map_readonly
,
3151 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3154 .label
= "mangled names",
3157 .ptr
= &sDefault
.bMangledNames
,
3160 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3163 .label
= "max stat cache size",
3165 .p_class
= P_GLOBAL
,
3166 .ptr
= &Globals
.iMaxStatCacheSize
,
3169 .flags
= FLAG_ADVANCED
,
3172 .label
= "stat cache",
3174 .p_class
= P_GLOBAL
,
3175 .ptr
= &Globals
.bStatCache
,
3178 .flags
= FLAG_ADVANCED
,
3181 .label
= "store dos attributes",
3184 .ptr
= &sDefault
.bStoreDosAttributes
,
3187 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3190 .label
= "dmapi support",
3193 .ptr
= &sDefault
.bDmapiSupport
,
3196 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3200 {N_("Domain Options"), P_SEP
, P_SEPARATOR
},
3203 .label
= "machine password timeout",
3205 .p_class
= P_GLOBAL
,
3206 .ptr
= &Globals
.machine_password_timeout
,
3209 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
3212 {N_("Logon Options"), P_SEP
, P_SEPARATOR
},
3215 .label
= "add user script",
3217 .p_class
= P_GLOBAL
,
3218 .ptr
= &Globals
.szAddUserScript
,
3221 .flags
= FLAG_ADVANCED
,
3224 .label
= "rename user script",
3226 .p_class
= P_GLOBAL
,
3227 .ptr
= &Globals
.szRenameUserScript
,
3230 .flags
= FLAG_ADVANCED
,
3233 .label
= "delete user script",
3235 .p_class
= P_GLOBAL
,
3236 .ptr
= &Globals
.szDelUserScript
,
3239 .flags
= FLAG_ADVANCED
,
3242 .label
= "add group script",
3244 .p_class
= P_GLOBAL
,
3245 .ptr
= &Globals
.szAddGroupScript
,
3248 .flags
= FLAG_ADVANCED
,
3251 .label
= "delete group script",
3253 .p_class
= P_GLOBAL
,
3254 .ptr
= &Globals
.szDelGroupScript
,
3257 .flags
= FLAG_ADVANCED
,
3260 .label
= "add user to group script",
3262 .p_class
= P_GLOBAL
,
3263 .ptr
= &Globals
.szAddUserToGroupScript
,
3266 .flags
= FLAG_ADVANCED
,
3269 .label
= "delete user from group script",
3271 .p_class
= P_GLOBAL
,
3272 .ptr
= &Globals
.szDelUserFromGroupScript
,
3275 .flags
= FLAG_ADVANCED
,
3278 .label
= "set primary group script",
3280 .p_class
= P_GLOBAL
,
3281 .ptr
= &Globals
.szSetPrimaryGroupScript
,
3284 .flags
= FLAG_ADVANCED
,
3287 .label
= "add machine script",
3289 .p_class
= P_GLOBAL
,
3290 .ptr
= &Globals
.szAddMachineScript
,
3293 .flags
= FLAG_ADVANCED
,
3296 .label
= "shutdown script",
3298 .p_class
= P_GLOBAL
,
3299 .ptr
= &Globals
.szShutdownScript
,
3302 .flags
= FLAG_ADVANCED
,
3305 .label
= "abort shutdown script",
3307 .p_class
= P_GLOBAL
,
3308 .ptr
= &Globals
.szAbortShutdownScript
,
3311 .flags
= FLAG_ADVANCED
,
3314 .label
= "username map script",
3316 .p_class
= P_GLOBAL
,
3317 .ptr
= &Globals
.szUsernameMapScript
,
3320 .flags
= FLAG_ADVANCED
,
3323 .label
= "username map cache time",
3325 .p_class
= P_GLOBAL
,
3326 .ptr
= &Globals
.iUsernameMapCacheTime
,
3329 .flags
= FLAG_ADVANCED
,
3332 .label
= "logon script",
3334 .p_class
= P_GLOBAL
,
3335 .ptr
= &Globals
.szLogonScript
,
3338 .flags
= FLAG_ADVANCED
,
3341 .label
= "logon path",
3343 .p_class
= P_GLOBAL
,
3344 .ptr
= &Globals
.szLogonPath
,
3347 .flags
= FLAG_ADVANCED
,
3350 .label
= "logon drive",
3352 .p_class
= P_GLOBAL
,
3353 .ptr
= &Globals
.szLogonDrive
,
3356 .flags
= FLAG_ADVANCED
,
3359 .label
= "logon home",
3361 .p_class
= P_GLOBAL
,
3362 .ptr
= &Globals
.szLogonHome
,
3365 .flags
= FLAG_ADVANCED
,
3368 .label
= "domain logons",
3370 .p_class
= P_GLOBAL
,
3371 .ptr
= &Globals
.bDomainLogons
,
3374 .flags
= FLAG_ADVANCED
,
3378 .label
= "init logon delayed hosts",
3380 .p_class
= P_GLOBAL
,
3381 .ptr
= &Globals
.szInitLogonDelayedHosts
,
3384 .flags
= FLAG_ADVANCED
,
3388 .label
= "init logon delay",
3390 .p_class
= P_GLOBAL
,
3391 .ptr
= &Globals
.InitLogonDelay
,
3394 .flags
= FLAG_ADVANCED
,
3398 {N_("Browse Options"), P_SEP
, P_SEPARATOR
},
3401 .label
= "os level",
3403 .p_class
= P_GLOBAL
,
3404 .ptr
= &Globals
.os_level
,
3407 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3410 .label
= "lm announce",
3412 .p_class
= P_GLOBAL
,
3413 .ptr
= &Globals
.lm_announce
,
3415 .enum_list
= enum_bool_auto
,
3416 .flags
= FLAG_ADVANCED
,
3419 .label
= "lm interval",
3421 .p_class
= P_GLOBAL
,
3422 .ptr
= &Globals
.lm_interval
,
3425 .flags
= FLAG_ADVANCED
,
3428 .label
= "preferred master",
3430 .p_class
= P_GLOBAL
,
3431 .ptr
= &Globals
.iPreferredMaster
,
3433 .enum_list
= enum_bool_auto
,
3434 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3437 .label
= "prefered master",
3439 .p_class
= P_GLOBAL
,
3440 .ptr
= &Globals
.iPreferredMaster
,
3442 .enum_list
= enum_bool_auto
,
3446 .label
= "local master",
3448 .p_class
= P_GLOBAL
,
3449 .ptr
= &Globals
.bLocalMaster
,
3452 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3455 .label
= "domain master",
3457 .p_class
= P_GLOBAL
,
3458 .ptr
= &Globals
.iDomainMaster
,
3460 .enum_list
= enum_bool_auto
,
3461 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3464 .label
= "browse list",
3466 .p_class
= P_GLOBAL
,
3467 .ptr
= &Globals
.bBrowseList
,
3470 .flags
= FLAG_ADVANCED
,
3473 .label
= "browseable",
3476 .ptr
= &sDefault
.bBrowseable
,
3479 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
3482 .label
= "browsable",
3485 .ptr
= &sDefault
.bBrowseable
,
3491 .label
= "access based share enum",
3494 .ptr
= &sDefault
.bAccessBasedShareEnum
,
3497 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
3500 .label
= "enhanced browsing",
3502 .p_class
= P_GLOBAL
,
3503 .ptr
= &Globals
.enhanced_browsing
,
3506 .flags
= FLAG_ADVANCED
,
3509 {N_("WINS Options"), P_SEP
, P_SEPARATOR
},
3512 .label
= "dns proxy",
3514 .p_class
= P_GLOBAL
,
3515 .ptr
= &Globals
.bDNSproxy
,
3518 .flags
= FLAG_ADVANCED
,
3521 .label
= "wins proxy",
3523 .p_class
= P_GLOBAL
,
3524 .ptr
= &Globals
.bWINSproxy
,
3527 .flags
= FLAG_ADVANCED
,
3530 .label
= "wins server",
3532 .p_class
= P_GLOBAL
,
3533 .ptr
= &Globals
.szWINSservers
,
3536 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
3539 .label
= "wins support",
3541 .p_class
= P_GLOBAL
,
3542 .ptr
= &Globals
.bWINSsupport
,
3545 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
3548 .label
= "wins hook",
3550 .p_class
= P_GLOBAL
,
3551 .ptr
= &Globals
.szWINSHook
,
3554 .flags
= FLAG_ADVANCED
,
3557 {N_("Locking Options"), P_SEP
, P_SEPARATOR
},
3560 .label
= "blocking locks",
3563 .ptr
= &sDefault
.bBlockingLocks
,
3566 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3569 .label
= "csc policy",
3572 .ptr
= &sDefault
.iCSCPolicy
,
3574 .enum_list
= enum_csc_policy
,
3575 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3578 .label
= "fake oplocks",
3581 .ptr
= &sDefault
.bFakeOplocks
,
3584 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
3587 .label
= "kernel oplocks",
3589 .p_class
= P_GLOBAL
,
3590 .ptr
= &Globals
.bKernelOplocks
,
3593 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3599 .ptr
= &sDefault
.bLocking
,
3602 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3605 .label
= "lock spin time",
3607 .p_class
= P_GLOBAL
,
3608 .ptr
= &Globals
.iLockSpinTime
,
3611 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3617 .ptr
= &sDefault
.bOpLocks
,
3620 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3623 .label
= "level2 oplocks",
3626 .ptr
= &sDefault
.bLevel2OpLocks
,
3629 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3632 .label
= "oplock break wait time",
3634 .p_class
= P_GLOBAL
,
3635 .ptr
= &Globals
.oplock_break_wait_time
,
3638 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3641 .label
= "oplock contention limit",
3644 .ptr
= &sDefault
.iOplockContentionLimit
,
3647 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3650 .label
= "posix locking",
3653 .ptr
= &sDefault
.bPosixLocking
,
3656 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3659 .label
= "strict locking",
3662 .ptr
= &sDefault
.iStrictLocking
,
3664 .enum_list
= enum_bool_auto
,
3665 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3668 .label
= "share modes",
3671 .ptr
= &sDefault
.bShareModes
,
3674 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DEPRECATED
,
3677 {N_("Ldap Options"), P_SEP
, P_SEPARATOR
},
3680 .label
= "ldap admin dn",
3682 .p_class
= P_GLOBAL
,
3683 .ptr
= &Globals
.szLdapAdminDn
,
3686 .flags
= FLAG_ADVANCED
,
3689 .label
= "ldap delete dn",
3691 .p_class
= P_GLOBAL
,
3692 .ptr
= &Globals
.ldap_delete_dn
,
3695 .flags
= FLAG_ADVANCED
,
3698 .label
= "ldap group suffix",
3700 .p_class
= P_GLOBAL
,
3701 .ptr
= &Globals
.szLdapGroupSuffix
,
3704 .flags
= FLAG_ADVANCED
,
3707 .label
= "ldap idmap suffix",
3709 .p_class
= P_GLOBAL
,
3710 .ptr
= &Globals
.szLdapIdmapSuffix
,
3713 .flags
= FLAG_ADVANCED
,
3716 .label
= "ldap machine suffix",
3718 .p_class
= P_GLOBAL
,
3719 .ptr
= &Globals
.szLdapMachineSuffix
,
3722 .flags
= FLAG_ADVANCED
,
3725 .label
= "ldap passwd sync",
3727 .p_class
= P_GLOBAL
,
3728 .ptr
= &Globals
.ldap_passwd_sync
,
3730 .enum_list
= enum_ldap_passwd_sync
,
3731 .flags
= FLAG_ADVANCED
,
3734 .label
= "ldap password sync",
3736 .p_class
= P_GLOBAL
,
3737 .ptr
= &Globals
.ldap_passwd_sync
,
3739 .enum_list
= enum_ldap_passwd_sync
,
3743 .label
= "ldap replication sleep",
3745 .p_class
= P_GLOBAL
,
3746 .ptr
= &Globals
.ldap_replication_sleep
,
3749 .flags
= FLAG_ADVANCED
,
3752 .label
= "ldap suffix",
3754 .p_class
= P_GLOBAL
,
3755 .ptr
= &Globals
.szLdapSuffix
,
3758 .flags
= FLAG_ADVANCED
,
3761 .label
= "ldap ssl",
3763 .p_class
= P_GLOBAL
,
3764 .ptr
= &Globals
.ldap_ssl
,
3766 .enum_list
= enum_ldap_ssl
,
3767 .flags
= FLAG_ADVANCED
,
3770 .label
= "ldap ssl ads",
3772 .p_class
= P_GLOBAL
,
3773 .ptr
= &Globals
.ldap_ssl_ads
,
3776 .flags
= FLAG_ADVANCED
,
3779 .label
= "ldap deref",
3781 .p_class
= P_GLOBAL
,
3782 .ptr
= &Globals
.ldap_deref
,
3784 .enum_list
= enum_ldap_deref
,
3785 .flags
= FLAG_ADVANCED
,
3788 .label
= "ldap follow referral",
3790 .p_class
= P_GLOBAL
,
3791 .ptr
= &Globals
.ldap_follow_referral
,
3793 .enum_list
= enum_bool_auto
,
3794 .flags
= FLAG_ADVANCED
,
3797 .label
= "ldap timeout",
3799 .p_class
= P_GLOBAL
,
3800 .ptr
= &Globals
.ldap_timeout
,
3803 .flags
= FLAG_ADVANCED
,
3806 .label
= "ldap connection timeout",
3808 .p_class
= P_GLOBAL
,
3809 .ptr
= &Globals
.ldap_connection_timeout
,
3812 .flags
= FLAG_ADVANCED
,
3815 .label
= "ldap page size",
3817 .p_class
= P_GLOBAL
,
3818 .ptr
= &Globals
.ldap_page_size
,
3821 .flags
= FLAG_ADVANCED
,
3824 .label
= "ldap user suffix",
3826 .p_class
= P_GLOBAL
,
3827 .ptr
= &Globals
.szLdapUserSuffix
,
3830 .flags
= FLAG_ADVANCED
,
3833 .label
= "ldap debug level",
3835 .p_class
= P_GLOBAL
,
3836 .ptr
= &Globals
.ldap_debug_level
,
3837 .special
= handle_ldap_debug_level
,
3839 .flags
= FLAG_ADVANCED
,
3842 .label
= "ldap debug threshold",
3844 .p_class
= P_GLOBAL
,
3845 .ptr
= &Globals
.ldap_debug_threshold
,
3848 .flags
= FLAG_ADVANCED
,
3851 {N_("EventLog Options"), P_SEP
, P_SEPARATOR
},
3854 .label
= "eventlog list",
3856 .p_class
= P_GLOBAL
,
3857 .ptr
= &Globals
.szEventLogs
,
3860 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
3863 {N_("Miscellaneous Options"), P_SEP
, P_SEPARATOR
},
3866 .label
= "add share command",
3868 .p_class
= P_GLOBAL
,
3869 .ptr
= &Globals
.szAddShareCommand
,
3872 .flags
= FLAG_ADVANCED
,
3875 .label
= "change share command",
3877 .p_class
= P_GLOBAL
,
3878 .ptr
= &Globals
.szChangeShareCommand
,
3881 .flags
= FLAG_ADVANCED
,
3884 .label
= "delete share command",
3886 .p_class
= P_GLOBAL
,
3887 .ptr
= &Globals
.szDeleteShareCommand
,
3890 .flags
= FLAG_ADVANCED
,
3893 .label
= "config file",
3895 .p_class
= P_GLOBAL
,
3896 .ptr
= &Globals
.szConfigFile
,
3899 .flags
= FLAG_HIDE
|FLAG_META
,
3904 .p_class
= P_GLOBAL
,
3905 .ptr
= &Globals
.szAutoServices
,
3908 .flags
= FLAG_ADVANCED
,
3911 .label
= "auto services",
3913 .p_class
= P_GLOBAL
,
3914 .ptr
= &Globals
.szAutoServices
,
3917 .flags
= FLAG_ADVANCED
,
3920 .label
= "lock directory",
3922 .p_class
= P_GLOBAL
,
3923 .ptr
= &Globals
.szLockDir
,
3926 .flags
= FLAG_ADVANCED
,
3929 .label
= "lock dir",
3931 .p_class
= P_GLOBAL
,
3932 .ptr
= &Globals
.szLockDir
,
3938 .label
= "state directory",
3940 .p_class
= P_GLOBAL
,
3941 .ptr
= &Globals
.szStateDir
,
3944 .flags
= FLAG_ADVANCED
,
3947 .label
= "cache directory",
3949 .p_class
= P_GLOBAL
,
3950 .ptr
= &Globals
.szCacheDir
,
3953 .flags
= FLAG_ADVANCED
,
3956 .label
= "pid directory",
3958 .p_class
= P_GLOBAL
,
3959 .ptr
= &Globals
.szPidDir
,
3962 .flags
= FLAG_ADVANCED
,
3966 .label
= "utmp directory",
3968 .p_class
= P_GLOBAL
,
3969 .ptr
= &Globals
.szUtmpDir
,
3972 .flags
= FLAG_ADVANCED
,
3975 .label
= "wtmp directory",
3977 .p_class
= P_GLOBAL
,
3978 .ptr
= &Globals
.szWtmpDir
,
3981 .flags
= FLAG_ADVANCED
,
3986 .p_class
= P_GLOBAL
,
3987 .ptr
= &Globals
.bUtmp
,
3990 .flags
= FLAG_ADVANCED
,
3994 .label
= "default service",
3996 .p_class
= P_GLOBAL
,
3997 .ptr
= &Globals
.szDefaultService
,
4000 .flags
= FLAG_ADVANCED
,
4005 .p_class
= P_GLOBAL
,
4006 .ptr
= &Globals
.szDefaultService
,
4009 .flags
= FLAG_ADVANCED
,
4012 .label
= "message command",
4014 .p_class
= P_GLOBAL
,
4015 .ptr
= &Globals
.szMsgCommand
,
4018 .flags
= FLAG_ADVANCED
,
4021 .label
= "dfree cache time",
4024 .ptr
= &sDefault
.iDfreeCacheTime
,
4027 .flags
= FLAG_ADVANCED
,
4030 .label
= "dfree command",
4033 .ptr
= &sDefault
.szDfree
,
4036 .flags
= FLAG_ADVANCED
,
4039 .label
= "get quota command",
4041 .p_class
= P_GLOBAL
,
4042 .ptr
= &Globals
.szGetQuota
,
4045 .flags
= FLAG_ADVANCED
,
4048 .label
= "set quota command",
4050 .p_class
= P_GLOBAL
,
4051 .ptr
= &Globals
.szSetQuota
,
4054 .flags
= FLAG_ADVANCED
,
4057 .label
= "remote announce",
4059 .p_class
= P_GLOBAL
,
4060 .ptr
= &Globals
.szRemoteAnnounce
,
4063 .flags
= FLAG_ADVANCED
,
4066 .label
= "remote browse sync",
4068 .p_class
= P_GLOBAL
,
4069 .ptr
= &Globals
.szRemoteBrowseSync
,
4072 .flags
= FLAG_ADVANCED
,
4075 .label
= "socket address",
4077 .p_class
= P_GLOBAL
,
4078 .ptr
= &Globals
.szSocketAddress
,
4081 .flags
= FLAG_ADVANCED
,
4084 .label
= "nmbd bind explicit broadcast",
4086 .p_class
= P_GLOBAL
,
4087 .ptr
= &Globals
.bNmbdBindExplicitBroadcast
,
4090 .flags
= FLAG_ADVANCED
,
4093 .label
= "homedir map",
4095 .p_class
= P_GLOBAL
,
4096 .ptr
= &Globals
.szNISHomeMapName
,
4099 .flags
= FLAG_ADVANCED
,
4102 .label
= "afs username map",
4104 .p_class
= P_GLOBAL
,
4105 .ptr
= &Globals
.szAfsUsernameMap
,
4108 .flags
= FLAG_ADVANCED
,
4111 .label
= "afs token lifetime",
4113 .p_class
= P_GLOBAL
,
4114 .ptr
= &Globals
.iAfsTokenLifetime
,
4117 .flags
= FLAG_ADVANCED
,
4120 .label
= "log nt token command",
4122 .p_class
= P_GLOBAL
,
4123 .ptr
= &Globals
.szLogNtTokenCommand
,
4126 .flags
= FLAG_ADVANCED
,
4129 .label
= "time offset",
4131 .p_class
= P_GLOBAL
,
4132 .ptr
= &extra_time_offset
,
4135 .flags
= FLAG_ADVANCED
,
4138 .label
= "NIS homedir",
4140 .p_class
= P_GLOBAL
,
4141 .ptr
= &Globals
.bNISHomeMap
,
4144 .flags
= FLAG_ADVANCED
,
4150 .ptr
= &sDefault
.valid
,
4159 .ptr
= &sDefault
.szCopy
,
4160 .special
= handle_copy
,
4168 .ptr
= &sDefault
.szInclude
,
4169 .special
= handle_include
,
4171 .flags
= FLAG_HIDE
|FLAG_META
,
4177 .ptr
= &sDefault
.szPreExec
,
4180 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4186 .ptr
= &sDefault
.szPreExec
,
4189 .flags
= FLAG_ADVANCED
,
4192 .label
= "preexec close",
4195 .ptr
= &sDefault
.bPreexecClose
,
4198 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4201 .label
= "postexec",
4204 .ptr
= &sDefault
.szPostExec
,
4207 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4210 .label
= "root preexec",
4213 .ptr
= &sDefault
.szRootPreExec
,
4216 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4219 .label
= "root preexec close",
4222 .ptr
= &sDefault
.bRootpreexecClose
,
4225 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4228 .label
= "root postexec",
4231 .ptr
= &sDefault
.szRootPostExec
,
4234 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4237 .label
= "available",
4240 .ptr
= &sDefault
.bAvailable
,
4243 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4246 .label
= "registry shares",
4248 .p_class
= P_GLOBAL
,
4249 .ptr
= &Globals
.bRegistryShares
,
4252 .flags
= FLAG_ADVANCED
,
4255 .label
= "usershare allow guests",
4257 .p_class
= P_GLOBAL
,
4258 .ptr
= &Globals
.bUsershareAllowGuests
,
4261 .flags
= FLAG_ADVANCED
,
4264 .label
= "usershare max shares",
4266 .p_class
= P_GLOBAL
,
4267 .ptr
= &Globals
.iUsershareMaxShares
,
4270 .flags
= FLAG_ADVANCED
,
4273 .label
= "usershare owner only",
4275 .p_class
= P_GLOBAL
,
4276 .ptr
= &Globals
.bUsershareOwnerOnly
,
4279 .flags
= FLAG_ADVANCED
,
4282 .label
= "usershare path",
4284 .p_class
= P_GLOBAL
,
4285 .ptr
= &Globals
.szUsersharePath
,
4288 .flags
= FLAG_ADVANCED
,
4291 .label
= "usershare prefix allow list",
4293 .p_class
= P_GLOBAL
,
4294 .ptr
= &Globals
.szUsersharePrefixAllowList
,
4297 .flags
= FLAG_ADVANCED
,
4300 .label
= "usershare prefix deny list",
4302 .p_class
= P_GLOBAL
,
4303 .ptr
= &Globals
.szUsersharePrefixDenyList
,
4306 .flags
= FLAG_ADVANCED
,
4309 .label
= "usershare template share",
4311 .p_class
= P_GLOBAL
,
4312 .ptr
= &Globals
.szUsershareTemplateShare
,
4315 .flags
= FLAG_ADVANCED
,
4321 .ptr
= &sDefault
.volume
,
4324 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4330 .ptr
= &sDefault
.fstype
,
4333 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4336 .label
= "set directory",
4339 .ptr
= &sDefault
.bNo_set_dir
,
4342 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4345 .label
= "wide links",
4348 .ptr
= &sDefault
.bWidelinks
,
4351 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4354 .label
= "follow symlinks",
4357 .ptr
= &sDefault
.bSymlinks
,
4360 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4363 .label
= "dont descend",
4366 .ptr
= &sDefault
.szDontdescend
,
4369 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4372 .label
= "magic script",
4375 .ptr
= &sDefault
.szMagicScript
,
4378 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4381 .label
= "magic output",
4384 .ptr
= &sDefault
.szMagicOutput
,
4387 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4390 .label
= "delete readonly",
4393 .ptr
= &sDefault
.bDeleteReadonly
,
4396 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4399 .label
= "dos filemode",
4402 .ptr
= &sDefault
.bDosFilemode
,
4405 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4408 .label
= "dos filetimes",
4411 .ptr
= &sDefault
.bDosFiletimes
,
4414 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4417 .label
= "dos filetime resolution",
4420 .ptr
= &sDefault
.bDosFiletimeResolution
,
4423 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4426 .label
= "fake directory create times",
4429 .ptr
= &sDefault
.bFakeDirCreateTimes
,
4432 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
4435 .label
= "async smb echo handler",
4437 .p_class
= P_GLOBAL
,
4438 .ptr
= &Globals
.bAsyncSMBEchoHandler
,
4441 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
4444 .label
= "multicast dns register",
4446 .p_class
= P_GLOBAL
,
4447 .ptr
= &Globals
.bMulticastDnsRegister
,
4450 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
4453 .label
= "panic action",
4455 .p_class
= P_GLOBAL
,
4456 .ptr
= &Globals
.szPanicAction
,
4459 .flags
= FLAG_ADVANCED
,
4462 .label
= "perfcount module",
4464 .p_class
= P_GLOBAL
,
4465 .ptr
= &Globals
.szSMBPerfcountModule
,
4468 .flags
= FLAG_ADVANCED
,
4471 {N_("VFS module options"), P_SEP
, P_SEPARATOR
},
4474 .label
= "vfs objects",
4477 .ptr
= &sDefault
.szVfsObjects
,
4480 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4483 .label
= "vfs object",
4486 .ptr
= &sDefault
.szVfsObjects
,
4493 {N_("MSDFS options"), P_SEP
, P_SEPARATOR
},
4496 .label
= "msdfs root",
4499 .ptr
= &sDefault
.bMSDfsRoot
,
4502 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4505 .label
= "msdfs proxy",
4508 .ptr
= &sDefault
.szMSDfsProxy
,
4511 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4514 .label
= "host msdfs",
4516 .p_class
= P_GLOBAL
,
4517 .ptr
= &Globals
.bHostMSDfs
,
4520 .flags
= FLAG_ADVANCED
,
4523 {N_("Winbind options"), P_SEP
, P_SEPARATOR
},
4526 .label
= "passdb expand explicit",
4528 .p_class
= P_GLOBAL
,
4529 .ptr
= &Globals
.bPassdbExpandExplicit
,
4532 .flags
= FLAG_ADVANCED
,
4535 .label
= "idmap backend",
4537 .p_class
= P_GLOBAL
,
4538 .ptr
= &Globals
.szIdmapBackend
,
4541 .flags
= FLAG_ADVANCED
,
4544 .label
= "idmap read only",
4546 .p_class
= P_GLOBAL
,
4547 .ptr
= &Globals
.bIdmapReadOnly
,
4550 .flags
= FLAG_ADVANCED
,
4553 .label
= "idmap cache time",
4555 .p_class
= P_GLOBAL
,
4556 .ptr
= &Globals
.iIdmapCacheTime
,
4559 .flags
= FLAG_ADVANCED
,
4562 .label
= "idmap negative cache time",
4564 .p_class
= P_GLOBAL
,
4565 .ptr
= &Globals
.iIdmapNegativeCacheTime
,
4568 .flags
= FLAG_ADVANCED
,
4571 .label
= "idmap uid",
4573 .p_class
= P_GLOBAL
,
4574 .ptr
= &Globals
.szIdmapUID
,
4575 .special
= handle_idmap_uid
,
4577 .flags
= FLAG_ADVANCED
,
4580 .label
= "winbind uid",
4582 .p_class
= P_GLOBAL
,
4583 .ptr
= &Globals
.szIdmapUID
,
4584 .special
= handle_idmap_uid
,
4589 .label
= "idmap gid",
4591 .p_class
= P_GLOBAL
,
4592 .ptr
= &Globals
.szIdmapGID
,
4593 .special
= handle_idmap_gid
,
4595 .flags
= FLAG_ADVANCED
,
4598 .label
= "winbind gid",
4600 .p_class
= P_GLOBAL
,
4601 .ptr
= &Globals
.szIdmapGID
,
4602 .special
= handle_idmap_gid
,
4607 .label
= "template homedir",
4609 .p_class
= P_GLOBAL
,
4610 .ptr
= &Globals
.szTemplateHomedir
,
4613 .flags
= FLAG_ADVANCED
,
4616 .label
= "template shell",
4618 .p_class
= P_GLOBAL
,
4619 .ptr
= &Globals
.szTemplateShell
,
4622 .flags
= FLAG_ADVANCED
,
4625 .label
= "winbind separator",
4627 .p_class
= P_GLOBAL
,
4628 .ptr
= &Globals
.szWinbindSeparator
,
4631 .flags
= FLAG_ADVANCED
,
4634 .label
= "winbind cache time",
4636 .p_class
= P_GLOBAL
,
4637 .ptr
= &Globals
.winbind_cache_time
,
4640 .flags
= FLAG_ADVANCED
,
4643 .label
= "winbind reconnect delay",
4645 .p_class
= P_GLOBAL
,
4646 .ptr
= &Globals
.winbind_reconnect_delay
,
4649 .flags
= FLAG_ADVANCED
,
4652 .label
= "winbind max clients",
4654 .p_class
= P_GLOBAL
,
4655 .ptr
= &Globals
.winbind_max_clients
,
4658 .flags
= FLAG_ADVANCED
,
4661 .label
= "winbind enum users",
4663 .p_class
= P_GLOBAL
,
4664 .ptr
= &Globals
.bWinbindEnumUsers
,
4667 .flags
= FLAG_ADVANCED
,
4670 .label
= "winbind enum groups",
4672 .p_class
= P_GLOBAL
,
4673 .ptr
= &Globals
.bWinbindEnumGroups
,
4676 .flags
= FLAG_ADVANCED
,
4679 .label
= "winbind use default domain",
4681 .p_class
= P_GLOBAL
,
4682 .ptr
= &Globals
.bWinbindUseDefaultDomain
,
4685 .flags
= FLAG_ADVANCED
,
4688 .label
= "winbind trusted domains only",
4690 .p_class
= P_GLOBAL
,
4691 .ptr
= &Globals
.bWinbindTrustedDomainsOnly
,
4694 .flags
= FLAG_ADVANCED
,
4697 .label
= "winbind nested groups",
4699 .p_class
= P_GLOBAL
,
4700 .ptr
= &Globals
.bWinbindNestedGroups
,
4703 .flags
= FLAG_ADVANCED
,
4706 .label
= "winbind expand groups",
4708 .p_class
= P_GLOBAL
,
4709 .ptr
= &Globals
.winbind_expand_groups
,
4712 .flags
= FLAG_ADVANCED
,
4715 .label
= "winbind nss info",
4717 .p_class
= P_GLOBAL
,
4718 .ptr
= &Globals
.szWinbindNssInfo
,
4721 .flags
= FLAG_ADVANCED
,
4724 .label
= "winbind refresh tickets",
4726 .p_class
= P_GLOBAL
,
4727 .ptr
= &Globals
.bWinbindRefreshTickets
,
4730 .flags
= FLAG_ADVANCED
,
4733 .label
= "winbind offline logon",
4735 .p_class
= P_GLOBAL
,
4736 .ptr
= &Globals
.bWinbindOfflineLogon
,
4739 .flags
= FLAG_ADVANCED
,
4742 .label
= "winbind normalize names",
4744 .p_class
= P_GLOBAL
,
4745 .ptr
= &Globals
.bWinbindNormalizeNames
,
4748 .flags
= FLAG_ADVANCED
,
4751 .label
= "winbind rpc only",
4753 .p_class
= P_GLOBAL
,
4754 .ptr
= &Globals
.bWinbindRpcOnly
,
4757 .flags
= FLAG_ADVANCED
,
4760 .label
= "create krb5 conf",
4762 .p_class
= P_GLOBAL
,
4763 .ptr
= &Globals
.bCreateKrb5Conf
,
4766 .flags
= FLAG_ADVANCED
,
4769 .label
= "ncalrpc dir",
4771 .p_class
= P_GLOBAL
,
4772 .ptr
= &Globals
.ncalrpc_dir
,
4775 .flags
= FLAG_ADVANCED
,
4778 .label
= "winbind max domain connections",
4780 .p_class
= P_GLOBAL
,
4781 .ptr
= &Globals
.winbindMaxDomainConnections
,
4784 .flags
= FLAG_ADVANCED
,
4787 {NULL
, P_BOOL
, P_NONE
, NULL
, NULL
, NULL
, 0}
4790 /***************************************************************************
4791 Initialise the sDefault parameter structure for the printer values.
4792 ***************************************************************************/
4794 static void init_printer_values(struct service
*pService
)
4796 /* choose defaults depending on the type of printing */
4797 switch (pService
->iPrinting
) {
4802 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4803 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4804 string_set(&pService
->szPrintcommand
, "lpr -r -P'%p' %s");
4809 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4810 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4811 string_set(&pService
->szPrintcommand
, "lpr -r -P'%p' %s");
4812 string_set(&pService
->szQueuepausecommand
, "lpc stop '%p'");
4813 string_set(&pService
->szQueueresumecommand
, "lpc start '%p'");
4814 string_set(&pService
->szLppausecommand
, "lpc hold '%p' %j");
4815 string_set(&pService
->szLpresumecommand
, "lpc release '%p' %j");
4821 /* set the lpq command to contain the destination printer
4822 name only. This is used by cups_queue_get() */
4823 string_set(&pService
->szLpqcommand
, "%p");
4824 string_set(&pService
->szLprmcommand
, "");
4825 string_set(&pService
->szPrintcommand
, "");
4826 string_set(&pService
->szLppausecommand
, "");
4827 string_set(&pService
->szLpresumecommand
, "");
4828 string_set(&pService
->szQueuepausecommand
, "");
4829 string_set(&pService
->szQueueresumecommand
, "");
4831 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4832 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4833 string_set(&pService
->szPrintcommand
, "lpr -P'%p' %s; rm %s");
4834 string_set(&pService
->szLppausecommand
, "lp -i '%p-%j' -H hold");
4835 string_set(&pService
->szLpresumecommand
, "lp -i '%p-%j' -H resume");
4836 string_set(&pService
->szQueuepausecommand
, "disable '%p'");
4837 string_set(&pService
->szQueueresumecommand
, "enable '%p'");
4838 #endif /* HAVE_CUPS */
4843 string_set(&pService
->szLpqcommand
, "lpstat -o%p");
4844 string_set(&pService
->szLprmcommand
, "cancel %p-%j");
4845 string_set(&pService
->szPrintcommand
, "lp -c -d%p %s; rm %s");
4846 string_set(&pService
->szQueuepausecommand
, "disable %p");
4847 string_set(&pService
->szQueueresumecommand
, "enable %p");
4849 string_set(&pService
->szLppausecommand
, "lp -i %p-%j -H hold");
4850 string_set(&pService
->szLpresumecommand
, "lp -i %p-%j -H resume");
4855 string_set(&pService
->szLpqcommand
, "lpq -P%p");
4856 string_set(&pService
->szLprmcommand
, "lprm -P%p %j");
4857 string_set(&pService
->szPrintcommand
, "lp -r -P%p %s");
4863 string_set(&pService
->szPrintcommand
, "vlp print %p %s");
4864 string_set(&pService
->szLpqcommand
, "vlp lpq %p");
4865 string_set(&pService
->szLprmcommand
, "vlp lprm %p %j");
4866 string_set(&pService
->szLppausecommand
, "vlp lppause %p %j");
4867 string_set(&pService
->szLpresumecommand
, "vlp lpresume %p %j");
4868 string_set(&pService
->szQueuepausecommand
, "vlp queuepause %p");
4869 string_set(&pService
->szQueueresumecommand
, "vlp queueresume %p");
4871 #endif /* DEVELOPER */
4876 * Function to return the default value for the maximum number of open
4877 * file descriptors permitted. This function tries to consult the
4878 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4879 * the smaller of those.
4881 static int max_open_files(void)
4883 int sysctl_max
= MAX_OPEN_FILES
;
4884 int rlimit_max
= MAX_OPEN_FILES
;
4886 #ifdef HAVE_SYSCTLBYNAME
4888 size_t size
= sizeof(sysctl_max
);
4889 sysctlbyname("kern.maxfilesperproc", &sysctl_max
, &size
, NULL
,
4894 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4900 if (getrlimit(RLIMIT_NOFILE
, &rl
) == 0)
4901 rlimit_max
= rl
.rlim_cur
;
4903 #if defined(RLIM_INFINITY)
4904 if(rl
.rlim_cur
== RLIM_INFINITY
)
4905 rlimit_max
= MAX_OPEN_FILES
;
4910 if (sysctl_max
< MIN_OPEN_FILES_WINDOWS
) {
4911 DEBUG(2,("max_open_files: sysctl_max (%d) below "
4912 "minimum Windows limit (%d)\n",
4914 MIN_OPEN_FILES_WINDOWS
));
4915 sysctl_max
= MIN_OPEN_FILES_WINDOWS
;
4918 if (rlimit_max
< MIN_OPEN_FILES_WINDOWS
) {
4919 DEBUG(2,("rlimit_max: rlimit_max (%d) below "
4920 "minimum Windows limit (%d)\n",
4922 MIN_OPEN_FILES_WINDOWS
));
4923 rlimit_max
= MIN_OPEN_FILES_WINDOWS
;
4926 return MIN(sysctl_max
, rlimit_max
);
4930 * Common part of freeing allocated data for one parameter.
4932 static void free_one_parameter_common(void *parm_ptr
,
4933 struct parm_struct parm
)
4935 if ((parm
.type
== P_STRING
) ||
4936 (parm
.type
== P_USTRING
))
4938 string_free((char**)parm_ptr
);
4939 } else if (parm
.type
== P_LIST
) {
4940 TALLOC_FREE(*((char***)parm_ptr
));
4945 * Free the allocated data for one parameter for a share
4946 * given as a service struct.
4948 static void free_one_parameter(struct service
*service
,
4949 struct parm_struct parm
)
4953 if (parm
.p_class
!= P_LOCAL
) {
4957 parm_ptr
= lp_local_ptr(service
, parm
.ptr
);
4959 free_one_parameter_common(parm_ptr
, parm
);
4963 * Free the allocated parameter data of a share given
4964 * as a service struct.
4966 static void free_parameters(struct service
*service
)
4970 for (i
=0; parm_table
[i
].label
; i
++) {
4971 free_one_parameter(service
, parm_table
[i
]);
4976 * Free the allocated data for one parameter for a given share
4977 * specified by an snum.
4979 static void free_one_parameter_by_snum(int snum
, struct parm_struct parm
)
4983 if (parm
.ptr
== NULL
) {
4988 parm_ptr
= parm
.ptr
;
4989 } else if (parm
.p_class
!= P_LOCAL
) {
4992 parm_ptr
= lp_local_ptr_by_snum(snum
, parm
.ptr
);
4995 free_one_parameter_common(parm_ptr
, parm
);
4999 * Free the allocated parameter data for a share specified
5002 static void free_parameters_by_snum(int snum
)
5006 for (i
=0; parm_table
[i
].label
; i
++) {
5007 free_one_parameter_by_snum(snum
, parm_table
[i
]);
5012 * Free the allocated global parameters.
5014 static void free_global_parameters(void)
5016 free_parameters_by_snum(GLOBAL_SECTION_SNUM
);
5019 static int map_parameter(const char *pszParmName
);
5021 struct lp_stored_option
{
5022 struct lp_stored_option
*prev
, *next
;
5027 static struct lp_stored_option
*stored_options
;
5030 save options set by lp_set_cmdline() into a list. This list is
5031 re-applied when we do a globals reset, so that cmdline set options
5032 are sticky across reloads of smb.conf
5034 static bool store_lp_set_cmdline(const char *pszParmName
, const char *pszParmValue
)
5036 struct lp_stored_option
*entry
, *entry_next
;
5037 for (entry
= stored_options
; entry
!= NULL
; entry
= entry_next
) {
5038 entry_next
= entry
->next
;
5039 if (strcmp(pszParmName
, entry
->label
) == 0) {
5040 DLIST_REMOVE(stored_options
, entry
);
5046 entry
= talloc(NULL
, struct lp_stored_option
);
5051 entry
->label
= talloc_strdup(entry
, pszParmName
);
5052 if (!entry
->label
) {
5057 entry
->value
= talloc_strdup(entry
, pszParmValue
);
5058 if (!entry
->value
) {
5063 DLIST_ADD_END(stored_options
, entry
, struct lp_stored_option
);
5068 static bool apply_lp_set_cmdline(void)
5070 struct lp_stored_option
*entry
= NULL
;
5071 for (entry
= stored_options
; entry
!= NULL
; entry
= entry
->next
) {
5072 if (!lp_set_cmdline_helper(entry
->label
, entry
->value
, false)) {
5073 DEBUG(0, ("Failed to re-apply cmdline parameter %s = %s\n",
5074 entry
->label
, entry
->value
));
5081 /***************************************************************************
5082 Initialise the global parameter structure.
5083 ***************************************************************************/
5085 static void init_globals(bool reinit_globals
)
5087 static bool done_init
= False
;
5091 /* If requested to initialize only once and we've already done it... */
5092 if (!reinit_globals
&& done_init
) {
5093 /* ... then we have nothing more to do */
5098 /* The logfile can be set before this is invoked. Free it if so. */
5099 if (Globals
.szLogFile
!= NULL
) {
5100 string_free(&Globals
.szLogFile
);
5101 Globals
.szLogFile
= NULL
;
5105 free_global_parameters();
5108 /* This memset and the free_global_parameters() above will
5109 * wipe out smb.conf options set with lp_set_cmdline(). The
5110 * apply_lp_set_cmdline() call puts these values back in the
5111 * table once the defaults are set */
5112 memset((void *)&Globals
, '\0', sizeof(Globals
));
5114 for (i
= 0; parm_table
[i
].label
; i
++) {
5115 if ((parm_table
[i
].type
== P_STRING
||
5116 parm_table
[i
].type
== P_USTRING
) &&
5119 string_set((char **)parm_table
[i
].ptr
, "");
5123 string_set(&sDefault
.fstype
, FSTYPE_STRING
);
5124 string_set(&sDefault
.szPrintjobUsername
, "%U");
5126 init_printer_values(&sDefault
);
5129 DEBUG(3, ("Initialising global parameters\n"));
5131 string_set(&Globals
.szSMBPasswdFile
, get_dyn_SMB_PASSWD_FILE());
5132 string_set(&Globals
.szPrivateDir
, get_dyn_PRIVATE_DIR());
5134 /* use the new 'hash2' method by default, with a prefix of 1 */
5135 string_set(&Globals
.szManglingMethod
, "hash2");
5136 Globals
.mangle_prefix
= 1;
5138 string_set(&Globals
.szGuestaccount
, GUEST_ACCOUNT
);
5140 /* using UTF8 by default allows us to support all chars */
5141 string_set(&Globals
.unix_charset
, DEFAULT_UNIX_CHARSET
);
5143 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
5144 /* If the system supports nl_langinfo(), try to grab the value
5145 from the user's locale */
5146 string_set(&Globals
.display_charset
, "LOCALE");
5148 string_set(&Globals
.display_charset
, DEFAULT_DISPLAY_CHARSET
);
5151 /* Use codepage 850 as a default for the dos character set */
5152 string_set(&Globals
.dos_charset
, DEFAULT_DOS_CHARSET
);
5155 * Allow the default PASSWD_CHAT to be overridden in local.h.
5157 string_set(&Globals
.szPasswdChat
, DEFAULT_PASSWD_CHAT
);
5159 set_global_myname(myhostname());
5160 string_set(&Globals
.szNetbiosName
,global_myname());
5162 set_global_myworkgroup(WORKGROUP
);
5163 string_set(&Globals
.szWorkgroup
, lp_workgroup());
5165 string_set(&Globals
.szPasswdProgram
, "");
5166 string_set(&Globals
.szLockDir
, get_dyn_LOCKDIR());
5167 string_set(&Globals
.szStateDir
, get_dyn_STATEDIR());
5168 string_set(&Globals
.szCacheDir
, get_dyn_CACHEDIR());
5169 string_set(&Globals
.szPidDir
, get_dyn_PIDDIR());
5170 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
5172 * By default support explicit binding to broadcast
5175 Globals
.bNmbdBindExplicitBroadcast
= true;
5177 if (asprintf(&s
, "Samba %s", samba_version_string()) < 0) {
5178 smb_panic("init_globals: ENOMEM");
5180 string_set(&Globals
.szServerString
, s
);
5182 if (asprintf(&s
, "%d.%d", DEFAULT_MAJOR_VERSION
,
5183 DEFAULT_MINOR_VERSION
) < 0) {
5184 smb_panic("init_globals: ENOMEM");
5186 string_set(&Globals
.szAnnounceVersion
, s
);
5189 string_set(&Globals
.szPanicAction
, "/bin/sleep 999999999");
5192 string_set(&Globals
.szSocketOptions
, DEFAULT_SOCKET_OPTIONS
);
5194 string_set(&Globals
.szLogonDrive
, "");
5195 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
5196 string_set(&Globals
.szLogonHome
, "\\\\%N\\%U");
5197 string_set(&Globals
.szLogonPath
, "\\\\%N\\%U\\profile");
5199 string_set(&Globals
.szNameResolveOrder
, "lmhosts wins host bcast");
5200 string_set(&Globals
.szPasswordServer
, "*");
5202 Globals
.AlgorithmicRidBase
= BASE_RID
;
5204 Globals
.bLoadPrinters
= True
;
5205 Globals
.PrintcapCacheTime
= 750; /* 12.5 minutes */
5207 Globals
.ConfigBackend
= config_backend
;
5209 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
5210 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
5211 Globals
.max_xmit
= 0x4104;
5212 Globals
.max_mux
= 50; /* This is *needed* for profile support. */
5213 Globals
.lpqcachetime
= 30; /* changed to handle large print servers better -- jerry */
5214 Globals
.bDisableSpoolss
= False
;
5215 Globals
.iMaxSmbdProcesses
= 0;/* no limit specified */
5216 Globals
.pwordlevel
= 0;
5217 Globals
.unamelevel
= 0;
5218 Globals
.deadtime
= 0;
5219 Globals
.getwd_cache
= true;
5220 Globals
.bLargeReadwrite
= True
;
5221 Globals
.max_log_size
= 5000;
5222 Globals
.max_open_files
= max_open_files();
5223 Globals
.open_files_db_hash_size
= SMB_OPEN_DATABASE_TDB_HASH_SIZE
;
5224 Globals
.maxprotocol
= PROTOCOL_NT1
;
5225 Globals
.minprotocol
= PROTOCOL_CORE
;
5226 Globals
.security
= SEC_USER
;
5227 Globals
.paranoid_server_security
= True
;
5228 Globals
.bEncryptPasswords
= True
;
5229 Globals
.bUpdateEncrypt
= False
;
5230 Globals
.clientSchannel
= Auto
;
5231 Globals
.serverSchannel
= Auto
;
5232 Globals
.bReadRaw
= True
;
5233 Globals
.bWriteRaw
= True
;
5234 Globals
.bNullPasswords
= False
;
5235 Globals
.bObeyPamRestrictions
= False
;
5237 Globals
.bSyslogOnly
= False
;
5238 Globals
.bTimestampLogs
= True
;
5239 string_set(&Globals
.szLogLevel
, "0");
5240 Globals
.bDebugPrefixTimestamp
= False
;
5241 Globals
.bDebugHiresTimestamp
= true;
5242 Globals
.bDebugPid
= False
;
5243 Globals
.bDebugUid
= False
;
5244 Globals
.bDebugClass
= False
;
5245 Globals
.bEnableCoreFiles
= True
;
5246 Globals
.max_ttl
= 60 * 60 * 24 * 3; /* 3 days default. */
5247 Globals
.max_wins_ttl
= 60 * 60 * 24 * 6; /* 6 days default. */
5248 Globals
.min_wins_ttl
= 60 * 60 * 6; /* 6 hours default. */
5249 Globals
.machine_password_timeout
= 60 * 60 * 24 * 7; /* 7 days default. */
5250 Globals
.lm_announce
= 2; /* = Auto: send only if LM clients found */
5251 Globals
.lm_interval
= 60;
5252 Globals
.announce_as
= ANNOUNCE_AS_NT_SERVER
;
5253 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
5254 Globals
.bNISHomeMap
= False
;
5255 #ifdef WITH_NISPLUS_HOME
5256 string_set(&Globals
.szNISHomeMapName
, "auto_home.org_dir");
5258 string_set(&Globals
.szNISHomeMapName
, "auto.home");
5261 Globals
.bTimeServer
= False
;
5262 Globals
.bBindInterfacesOnly
= False
;
5263 Globals
.bUnixPasswdSync
= False
;
5264 Globals
.bPamPasswordChange
= False
;
5265 Globals
.bPasswdChatDebug
= False
;
5266 Globals
.iPasswdChatTimeout
= 2; /* 2 second default. */
5267 Globals
.bNTPipeSupport
= True
; /* Do NT pipes by default. */
5268 Globals
.bNTStatusSupport
= True
; /* Use NT status by default. */
5269 Globals
.bStatCache
= True
; /* use stat cache by default */
5270 Globals
.iMaxStatCacheSize
= 256; /* 256k by default */
5271 Globals
.restrict_anonymous
= 0;
5272 Globals
.bClientLanManAuth
= False
; /* Do NOT use the LanMan hash if it is available */
5273 Globals
.bClientPlaintextAuth
= False
; /* Do NOT use a plaintext password even if is requested by the server */
5274 Globals
.bLanmanAuth
= False
; /* Do NOT use the LanMan hash, even if it is supplied */
5275 Globals
.bNTLMAuth
= True
; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
5276 Globals
.bClientNTLMv2Auth
= True
; /* Client should always use use NTLMv2, as we can't tell that the server supports it, but most modern servers do */
5277 /* Note, that we will also use NTLM2 session security (which is different), if it is available */
5279 Globals
.map_to_guest
= 0; /* By Default, "Never" */
5280 Globals
.oplock_break_wait_time
= 0; /* By Default, 0 msecs. */
5281 Globals
.enhanced_browsing
= true;
5282 Globals
.iLockSpinTime
= WINDOWS_MINIMUM_LOCK_TIMEOUT_MS
; /* msec. */
5283 #ifdef MMAP_BLACKLIST
5284 Globals
.bUseMmap
= False
;
5286 Globals
.bUseMmap
= True
;
5288 Globals
.bUnixExtensions
= True
;
5289 Globals
.bResetOnZeroVC
= False
;
5290 Globals
.bLogWriteableFilesOnExit
= False
;
5291 Globals
.bCreateKrb5Conf
= true;
5292 Globals
.winbindMaxDomainConnections
= 1;
5294 /* hostname lookups can be very expensive and are broken on
5295 a large number of sites (tridge) */
5296 Globals
.bHostnameLookups
= False
;
5298 string_set(&Globals
.szPassdbBackend
, "tdbsam");
5299 string_set(&Globals
.szLdapSuffix
, "");
5300 string_set(&Globals
.szLdapMachineSuffix
, "");
5301 string_set(&Globals
.szLdapUserSuffix
, "");
5302 string_set(&Globals
.szLdapGroupSuffix
, "");
5303 string_set(&Globals
.szLdapIdmapSuffix
, "");
5305 string_set(&Globals
.szLdapAdminDn
, "");
5306 Globals
.ldap_ssl
= LDAP_SSL_START_TLS
;
5307 Globals
.ldap_ssl_ads
= False
;
5308 Globals
.ldap_deref
= -1;
5309 Globals
.ldap_passwd_sync
= LDAP_PASSWD_SYNC_OFF
;
5310 Globals
.ldap_delete_dn
= False
;
5311 Globals
.ldap_replication_sleep
= 1000; /* wait 1 sec for replication */
5312 Globals
.ldap_follow_referral
= Auto
;
5313 Globals
.ldap_timeout
= LDAP_DEFAULT_TIMEOUT
;
5314 Globals
.ldap_connection_timeout
= LDAP_CONNECTION_DEFAULT_TIMEOUT
;
5315 Globals
.ldap_page_size
= LDAP_PAGE_SIZE
;
5317 Globals
.ldap_debug_level
= 0;
5318 Globals
.ldap_debug_threshold
= 10;
5320 /* This is what we tell the afs client. in reality we set the token
5321 * to never expire, though, when this runs out the afs client will
5322 * forget the token. Set to 0 to get NEVERDATE.*/
5323 Globals
.iAfsTokenLifetime
= 604800;
5324 Globals
.cups_connection_timeout
= CUPS_DEFAULT_CONNECTION_TIMEOUT
;
5326 /* these parameters are set to defaults that are more appropriate
5327 for the increasing samba install base:
5329 as a member of the workgroup, that will possibly become a
5330 _local_ master browser (lm = True). this is opposed to a forced
5331 local master browser startup (pm = True).
5333 doesn't provide WINS server service by default (wsupp = False),
5334 and doesn't provide domain master browser services by default, either.
5338 Globals
.bMsAddPrinterWizard
= True
;
5339 Globals
.os_level
= 20;
5340 Globals
.bLocalMaster
= True
;
5341 Globals
.iDomainMaster
= Auto
; /* depending on bDomainLogons */
5342 Globals
.bDomainLogons
= False
;
5343 Globals
.bBrowseList
= True
;
5344 Globals
.bWINSsupport
= False
;
5345 Globals
.bWINSproxy
= False
;
5347 TALLOC_FREE(Globals
.szInitLogonDelayedHosts
);
5348 Globals
.InitLogonDelay
= 100; /* 100 ms default delay */
5350 Globals
.bDNSproxy
= True
;
5352 /* this just means to use them if they exist */
5353 Globals
.bKernelOplocks
= True
;
5355 Globals
.bAllowTrustedDomains
= True
;
5356 string_set(&Globals
.szIdmapBackend
, "tdb");
5357 Globals
.bIdmapReadOnly
= false;
5359 string_set(&Globals
.szTemplateShell
, "/bin/false");
5360 string_set(&Globals
.szTemplateHomedir
, "/home/%D/%U");
5361 string_set(&Globals
.szWinbindSeparator
, "\\");
5363 string_set(&Globals
.szCupsServer
, "");
5364 string_set(&Globals
.szIPrintServer
, "");
5366 string_set(&Globals
.ctdbdSocket
, "");
5367 Globals
.szClusterAddresses
= NULL
;
5368 Globals
.clustering
= False
;
5369 Globals
.ctdb_timeout
= 0;
5370 Globals
.ctdb_locktime_warn_threshold
= 0;
5372 Globals
.winbind_cache_time
= 300; /* 5 minutes */
5373 Globals
.winbind_reconnect_delay
= 30; /* 30 seconds */
5374 Globals
.winbind_max_clients
= 200;
5375 Globals
.bWinbindEnumUsers
= False
;
5376 Globals
.bWinbindEnumGroups
= False
;
5377 Globals
.bWinbindUseDefaultDomain
= False
;
5378 Globals
.bWinbindTrustedDomainsOnly
= False
;
5379 Globals
.bWinbindNestedGroups
= True
;
5380 Globals
.winbind_expand_groups
= 1;
5381 Globals
.szWinbindNssInfo
= str_list_make_v3(NULL
, "template", NULL
);
5382 Globals
.bWinbindRefreshTickets
= False
;
5383 Globals
.bWinbindOfflineLogon
= False
;
5385 Globals
.iIdmapCacheTime
= 86400 * 7; /* a week by default */
5386 Globals
.iIdmapNegativeCacheTime
= 120; /* 2 minutes by default */
5388 Globals
.bPassdbExpandExplicit
= False
;
5390 Globals
.name_cache_timeout
= 660; /* In seconds */
5392 Globals
.bUseSpnego
= True
;
5393 Globals
.bClientUseSpnego
= True
;
5395 Globals
.client_signing
= Auto
;
5396 Globals
.server_signing
= False
;
5398 Globals
.bDeferSharingViolations
= True
;
5399 string_set(&Globals
.smb_ports
, SMB_PORTS
);
5401 Globals
.bEnablePrivileges
= True
;
5402 Globals
.bHostMSDfs
= True
;
5403 Globals
.bASUSupport
= False
;
5405 /* User defined shares. */
5406 if (asprintf(&s
, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5407 smb_panic("init_globals: ENOMEM");
5409 string_set(&Globals
.szUsersharePath
, s
);
5411 string_set(&Globals
.szUsershareTemplateShare
, "");
5412 Globals
.iUsershareMaxShares
= 0;
5413 /* By default disallow sharing of directories not owned by the sharer. */
5414 Globals
.bUsershareOwnerOnly
= True
;
5415 /* By default disallow guest access to usershares. */
5416 Globals
.bUsershareAllowGuests
= False
;
5418 Globals
.iKeepalive
= DEFAULT_KEEPALIVE
;
5420 /* By default no shares out of the registry */
5421 Globals
.bRegistryShares
= False
;
5423 Globals
.iminreceivefile
= 0;
5425 Globals
.bMapUntrustedToDomain
= false;
5426 Globals
.bMulticastDnsRegister
= true;
5428 Globals
.ismb2_max_read
= DEFAULT_SMB2_MAX_READ
;
5429 Globals
.ismb2_max_write
= DEFAULT_SMB2_MAX_WRITE
;
5430 Globals
.ismb2_max_trans
= DEFAULT_SMB2_MAX_TRANSACT
;
5431 Globals
.ismb2_max_credits
= DEFAULT_SMB2_MAX_CREDITS
;
5433 string_set(&Globals
.ncalrpc_dir
, get_dyn_NCALRPCDIR());
5435 /* Now put back the settings that were set with lp_set_cmdline() */
5436 apply_lp_set_cmdline();
5439 /*******************************************************************
5440 Convenience routine to grab string parameters into temporary memory
5441 and run standard_sub_basic on them. The buffers can be written to by
5442 callers without affecting the source string.
5443 ********************************************************************/
5445 static char *lp_string(const char *s
)
5448 TALLOC_CTX
*ctx
= talloc_tos();
5450 /* The follow debug is useful for tracking down memory problems
5451 especially if you have an inner loop that is calling a lp_*()
5452 function that returns a string. Perhaps this debug should be
5453 present all the time? */
5456 DEBUG(10, ("lp_string(%s)\n", s
));
5462 ret
= talloc_sub_basic(ctx
,
5463 get_current_username(),
5464 current_user_info
.domain
,
5466 if (trim_char(ret
, '\"', '\"')) {
5467 if (strchr(ret
,'\"') != NULL
) {
5469 ret
= talloc_sub_basic(ctx
,
5470 get_current_username(),
5471 current_user_info
.domain
,
5479 In this section all the functions that are used to access the
5480 parameters from the rest of the program are defined
5483 #define FN_GLOBAL_STRING(fn_name,ptr) \
5484 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
5485 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5486 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
5487 #define FN_GLOBAL_LIST(fn_name,ptr) \
5488 const char **fn_name(void) {return(*(const char ***)(ptr));}
5489 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5490 bool fn_name(void) {return(*(bool *)(ptr));}
5491 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5492 char fn_name(void) {return(*(char *)(ptr));}
5493 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5494 int fn_name(void) {return(*(int *)(ptr));}
5496 #define FN_LOCAL_STRING(fn_name,val) \
5497 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5498 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5499 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5500 #define FN_LOCAL_LIST(fn_name,val) \
5501 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5502 #define FN_LOCAL_BOOL(fn_name,val) \
5503 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5504 #define FN_LOCAL_INTEGER(fn_name,val) \
5505 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5507 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5508 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5509 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5510 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5511 #define FN_LOCAL_CHAR(fn_name,val) \
5512 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5514 FN_GLOBAL_STRING(lp_smb_ports
, &Globals
.smb_ports
)
5515 FN_GLOBAL_STRING(lp_dos_charset
, &Globals
.dos_charset
)
5516 FN_GLOBAL_STRING(lp_unix_charset
, &Globals
.unix_charset
)
5517 FN_GLOBAL_STRING(lp_display_charset
, &Globals
.display_charset
)
5518 FN_GLOBAL_STRING(lp_logfile
, &Globals
.szLogFile
)
5519 FN_GLOBAL_STRING(lp_configfile
, &Globals
.szConfigFile
)
5520 FN_GLOBAL_STRING(lp_smb_passwd_file
, &Globals
.szSMBPasswdFile
)
5521 FN_GLOBAL_STRING(lp_private_dir
, &Globals
.szPrivateDir
)
5522 FN_GLOBAL_STRING(lp_serverstring
, &Globals
.szServerString
)
5523 FN_GLOBAL_INTEGER(lp_printcap_cache_time
, &Globals
.PrintcapCacheTime
)
5524 FN_GLOBAL_STRING(lp_addport_cmd
, &Globals
.szAddPortCommand
)
5525 FN_GLOBAL_STRING(lp_enumports_cmd
, &Globals
.szEnumPortsCommand
)
5526 FN_GLOBAL_STRING(lp_addprinter_cmd
, &Globals
.szAddPrinterCommand
)
5527 FN_GLOBAL_STRING(lp_deleteprinter_cmd
, &Globals
.szDeletePrinterCommand
)
5528 FN_GLOBAL_STRING(lp_os2_driver_map
, &Globals
.szOs2DriverMap
)
5529 FN_GLOBAL_STRING(lp_lockdir
, &Globals
.szLockDir
)
5530 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5531 * build process or in smb.conf, we use that value. Otherwise they
5532 * default to the value of lp_lockdir(). */
5533 char *lp_statedir(void) {
5534 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5535 (strcmp(get_dyn_STATEDIR(), Globals
.szStateDir
) != 0))
5536 return(lp_string(*(char **)(&Globals
.szStateDir
) ?
5537 *(char **)(&Globals
.szStateDir
) : ""));
5539 return(lp_string(*(char **)(&Globals
.szLockDir
) ?
5540 *(char **)(&Globals
.szLockDir
) : ""));
5542 char *lp_cachedir(void) {
5543 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5544 (strcmp(get_dyn_CACHEDIR(), Globals
.szCacheDir
) != 0))
5545 return(lp_string(*(char **)(&Globals
.szCacheDir
) ?
5546 *(char **)(&Globals
.szCacheDir
) : ""));
5548 return(lp_string(*(char **)(&Globals
.szLockDir
) ?
5549 *(char **)(&Globals
.szLockDir
) : ""));
5551 FN_GLOBAL_STRING(lp_piddir
, &Globals
.szPidDir
)
5552 FN_GLOBAL_STRING(lp_mangling_method
, &Globals
.szManglingMethod
)
5553 FN_GLOBAL_INTEGER(lp_mangle_prefix
, &Globals
.mangle_prefix
)
5554 FN_GLOBAL_STRING(lp_utmpdir
, &Globals
.szUtmpDir
)
5555 FN_GLOBAL_STRING(lp_wtmpdir
, &Globals
.szWtmpDir
)
5556 FN_GLOBAL_BOOL(lp_utmp
, &Globals
.bUtmp
)
5557 FN_GLOBAL_STRING(lp_rootdir
, &Globals
.szRootdir
)
5558 FN_GLOBAL_STRING(lp_perfcount_module
, &Globals
.szSMBPerfcountModule
)
5559 FN_GLOBAL_STRING(lp_defaultservice
, &Globals
.szDefaultService
)
5560 FN_GLOBAL_STRING(lp_msg_command
, &Globals
.szMsgCommand
)
5561 FN_GLOBAL_STRING(lp_get_quota_command
, &Globals
.szGetQuota
)
5562 FN_GLOBAL_STRING(lp_set_quota_command
, &Globals
.szSetQuota
)
5563 FN_GLOBAL_STRING(lp_auto_services
, &Globals
.szAutoServices
)
5564 FN_GLOBAL_STRING(lp_passwd_program
, &Globals
.szPasswdProgram
)
5565 FN_GLOBAL_STRING(lp_passwd_chat
, &Globals
.szPasswdChat
)
5566 FN_GLOBAL_STRING(lp_passwordserver
, &Globals
.szPasswordServer
)
5567 FN_GLOBAL_STRING(lp_name_resolve_order
, &Globals
.szNameResolveOrder
)
5568 FN_GLOBAL_STRING(lp_realm
, &Globals
.szRealm
)
5569 FN_GLOBAL_CONST_STRING(lp_afs_username_map
, &Globals
.szAfsUsernameMap
)
5570 FN_GLOBAL_INTEGER(lp_afs_token_lifetime
, &Globals
.iAfsTokenLifetime
)
5571 FN_GLOBAL_STRING(lp_log_nt_token_command
, &Globals
.szLogNtTokenCommand
)
5572 FN_GLOBAL_STRING(lp_username_map
, &Globals
.szUsernameMap
)
5573 FN_GLOBAL_CONST_STRING(lp_logon_script
, &Globals
.szLogonScript
)
5574 FN_GLOBAL_CONST_STRING(lp_logon_path
, &Globals
.szLogonPath
)
5575 FN_GLOBAL_CONST_STRING(lp_logon_drive
, &Globals
.szLogonDrive
)
5576 FN_GLOBAL_CONST_STRING(lp_logon_home
, &Globals
.szLogonHome
)
5577 FN_GLOBAL_STRING(lp_remote_announce
, &Globals
.szRemoteAnnounce
)
5578 FN_GLOBAL_STRING(lp_remote_browse_sync
, &Globals
.szRemoteBrowseSync
)
5579 FN_GLOBAL_BOOL(lp_nmbd_bind_explicit_broadcast
, &Globals
.bNmbdBindExplicitBroadcast
)
5580 FN_GLOBAL_LIST(lp_wins_server_list
, &Globals
.szWINSservers
)
5581 FN_GLOBAL_LIST(lp_interfaces
, &Globals
.szInterfaces
)
5582 FN_GLOBAL_STRING(lp_nis_home_map_name
, &Globals
.szNISHomeMapName
)
5583 static FN_GLOBAL_STRING(lp_announce_version
, &Globals
.szAnnounceVersion
)
5584 FN_GLOBAL_LIST(lp_netbios_aliases
, &Globals
.szNetbiosAliases
)
5585 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
5586 * lp_passdb_backend() should be replace by the this macro again after
5589 const char *lp_passdb_backend(void)
5591 char *delim
, *quote
;
5593 delim
= strchr( Globals
.szPassdbBackend
, ' ');
5594 /* no space at all */
5595 if (delim
== NULL
) {
5599 quote
= strchr(Globals
.szPassdbBackend
, '"');
5600 /* no quote char or non in the first part */
5601 if (quote
== NULL
|| quote
> delim
) {
5606 quote
= strchr(quote
+1, '"');
5607 if (quote
== NULL
) {
5608 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
5610 } else if (*(quote
+1) == '\0') {
5611 /* space, fitting quote char, and one backend only */
5614 /* terminate string after the fitting quote char */
5619 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5620 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5621 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5622 "backend (%s) is used. The rest is ignored.\n", Globals
.szPassdbBackend
));
5625 return Globals
.szPassdbBackend
;
5627 FN_GLOBAL_LIST(lp_preload_modules
, &Globals
.szPreloadModules
)
5628 FN_GLOBAL_STRING(lp_panic_action
, &Globals
.szPanicAction
)
5629 FN_GLOBAL_STRING(lp_adduser_script
, &Globals
.szAddUserScript
)
5630 FN_GLOBAL_STRING(lp_renameuser_script
, &Globals
.szRenameUserScript
)
5631 FN_GLOBAL_STRING(lp_deluser_script
, &Globals
.szDelUserScript
)
5633 FN_GLOBAL_CONST_STRING(lp_guestaccount
, &Globals
.szGuestaccount
)
5634 FN_GLOBAL_STRING(lp_addgroup_script
, &Globals
.szAddGroupScript
)
5635 FN_GLOBAL_STRING(lp_delgroup_script
, &Globals
.szDelGroupScript
)
5636 FN_GLOBAL_STRING(lp_addusertogroup_script
, &Globals
.szAddUserToGroupScript
)
5637 FN_GLOBAL_STRING(lp_deluserfromgroup_script
, &Globals
.szDelUserFromGroupScript
)
5638 FN_GLOBAL_STRING(lp_setprimarygroup_script
, &Globals
.szSetPrimaryGroupScript
)
5640 FN_GLOBAL_STRING(lp_addmachine_script
, &Globals
.szAddMachineScript
)
5642 FN_GLOBAL_STRING(lp_shutdown_script
, &Globals
.szShutdownScript
)
5643 FN_GLOBAL_STRING(lp_abort_shutdown_script
, &Globals
.szAbortShutdownScript
)
5644 FN_GLOBAL_STRING(lp_username_map_script
, &Globals
.szUsernameMapScript
)
5645 FN_GLOBAL_INTEGER(lp_username_map_cache_time
, &Globals
.iUsernameMapCacheTime
)
5647 FN_GLOBAL_STRING(lp_check_password_script
, &Globals
.szCheckPasswordScript
)
5649 FN_GLOBAL_STRING(lp_wins_hook
, &Globals
.szWINSHook
)
5650 FN_GLOBAL_CONST_STRING(lp_template_homedir
, &Globals
.szTemplateHomedir
)
5651 FN_GLOBAL_CONST_STRING(lp_template_shell
, &Globals
.szTemplateShell
)
5652 FN_GLOBAL_CONST_STRING(lp_winbind_separator
, &Globals
.szWinbindSeparator
)
5653 FN_GLOBAL_INTEGER(lp_acl_compatibility
, &Globals
.iAclCompat
)
5654 FN_GLOBAL_BOOL(lp_winbind_enum_users
, &Globals
.bWinbindEnumUsers
)
5655 FN_GLOBAL_BOOL(lp_winbind_enum_groups
, &Globals
.bWinbindEnumGroups
)
5656 FN_GLOBAL_BOOL(lp_winbind_use_default_domain
, &Globals
.bWinbindUseDefaultDomain
)
5657 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only
, &Globals
.bWinbindTrustedDomainsOnly
)
5658 FN_GLOBAL_BOOL(lp_winbind_nested_groups
, &Globals
.bWinbindNestedGroups
)
5659 FN_GLOBAL_INTEGER(lp_winbind_expand_groups
, &Globals
.winbind_expand_groups
)
5660 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets
, &Globals
.bWinbindRefreshTickets
)
5661 FN_GLOBAL_BOOL(lp_winbind_offline_logon
, &Globals
.bWinbindOfflineLogon
)
5662 FN_GLOBAL_BOOL(lp_winbind_normalize_names
, &Globals
.bWinbindNormalizeNames
)
5663 FN_GLOBAL_BOOL(lp_winbind_rpc_only
, &Globals
.bWinbindRpcOnly
)
5664 FN_GLOBAL_BOOL(lp_create_krb5_conf
, &Globals
.bCreateKrb5Conf
)
5665 static FN_GLOBAL_INTEGER(lp_winbind_max_domain_connections_int
,
5666 &Globals
.winbindMaxDomainConnections
)
5668 int lp_winbind_max_domain_connections(void)
5670 if (lp_winbind_offline_logon() &&
5671 lp_winbind_max_domain_connections_int() > 1) {
5672 DEBUG(1, ("offline logons active, restricting max domain "
5673 "connections to 1\n"));
5676 return MAX(1, lp_winbind_max_domain_connections_int());
5679 FN_GLOBAL_CONST_STRING(lp_idmap_backend
, &Globals
.szIdmapBackend
)
5680 FN_GLOBAL_BOOL(lp_idmap_read_only
, &Globals
.bIdmapReadOnly
)
5681 FN_GLOBAL_INTEGER(lp_idmap_cache_time
, &Globals
.iIdmapCacheTime
)
5682 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time
, &Globals
.iIdmapNegativeCacheTime
)
5683 FN_GLOBAL_INTEGER(lp_keepalive
, &Globals
.iKeepalive
)
5684 FN_GLOBAL_BOOL(lp_passdb_expand_explicit
, &Globals
.bPassdbExpandExplicit
)
5686 FN_GLOBAL_STRING(lp_ldap_suffix
, &Globals
.szLdapSuffix
)
5687 FN_GLOBAL_STRING(lp_ldap_admin_dn
, &Globals
.szLdapAdminDn
)
5688 FN_GLOBAL_INTEGER(lp_ldap_ssl
, &Globals
.ldap_ssl
)
5689 FN_GLOBAL_BOOL(lp_ldap_ssl_ads
, &Globals
.ldap_ssl_ads
)
5690 FN_GLOBAL_INTEGER(lp_ldap_deref
, &Globals
.ldap_deref
)
5691 FN_GLOBAL_INTEGER(lp_ldap_follow_referral
, &Globals
.ldap_follow_referral
)
5692 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync
, &Globals
.ldap_passwd_sync
)
5693 FN_GLOBAL_BOOL(lp_ldap_delete_dn
, &Globals
.ldap_delete_dn
)
5694 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep
, &Globals
.ldap_replication_sleep
)
5695 FN_GLOBAL_INTEGER(lp_ldap_timeout
, &Globals
.ldap_timeout
)
5696 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout
, &Globals
.ldap_connection_timeout
)
5697 FN_GLOBAL_INTEGER(lp_ldap_page_size
, &Globals
.ldap_page_size
)
5698 FN_GLOBAL_INTEGER(lp_ldap_debug_level
, &Globals
.ldap_debug_level
)
5699 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold
, &Globals
.ldap_debug_threshold
)
5700 FN_GLOBAL_STRING(lp_add_share_cmd
, &Globals
.szAddShareCommand
)
5701 FN_GLOBAL_STRING(lp_change_share_cmd
, &Globals
.szChangeShareCommand
)
5702 FN_GLOBAL_STRING(lp_delete_share_cmd
, &Globals
.szDeleteShareCommand
)
5703 FN_GLOBAL_STRING(lp_usershare_path
, &Globals
.szUsersharePath
)
5704 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list
, &Globals
.szUsersharePrefixAllowList
)
5705 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list
, &Globals
.szUsersharePrefixDenyList
)
5707 FN_GLOBAL_LIST(lp_eventlog_list
, &Globals
.szEventLogs
)
5709 FN_GLOBAL_BOOL(lp_registry_shares
, &Globals
.bRegistryShares
)
5710 FN_GLOBAL_BOOL(lp_usershare_allow_guests
, &Globals
.bUsershareAllowGuests
)
5711 FN_GLOBAL_BOOL(lp_usershare_owner_only
, &Globals
.bUsershareOwnerOnly
)
5712 FN_GLOBAL_BOOL(lp_disable_netbios
, &Globals
.bDisableNetbios
)
5713 FN_GLOBAL_BOOL(lp_reset_on_zero_vc
, &Globals
.bResetOnZeroVC
)
5714 FN_GLOBAL_BOOL(lp_log_writeable_files_on_exit
,
5715 &Globals
.bLogWriteableFilesOnExit
)
5716 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard
, &Globals
.bMsAddPrinterWizard
)
5717 FN_GLOBAL_BOOL(lp_dns_proxy
, &Globals
.bDNSproxy
)
5718 FN_GLOBAL_BOOL(lp_wins_support
, &Globals
.bWINSsupport
)
5719 FN_GLOBAL_BOOL(lp_we_are_a_wins_server
, &Globals
.bWINSsupport
)
5720 FN_GLOBAL_BOOL(lp_wins_proxy
, &Globals
.bWINSproxy
)
5721 FN_GLOBAL_BOOL(lp_local_master
, &Globals
.bLocalMaster
)
5722 FN_GLOBAL_BOOL(lp_domain_logons
, &Globals
.bDomainLogons
)
5723 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts
, &Globals
.szInitLogonDelayedHosts
)
5724 FN_GLOBAL_INTEGER(lp_init_logon_delay
, &Globals
.InitLogonDelay
)
5725 FN_GLOBAL_BOOL(lp_load_printers
, &Globals
.bLoadPrinters
)
5726 FN_GLOBAL_BOOL(_lp_readraw
, &Globals
.bReadRaw
)
5727 FN_GLOBAL_BOOL(lp_large_readwrite
, &Globals
.bLargeReadwrite
)
5728 FN_GLOBAL_BOOL(_lp_writeraw
, &Globals
.bWriteRaw
)
5729 FN_GLOBAL_BOOL(lp_null_passwords
, &Globals
.bNullPasswords
)
5730 FN_GLOBAL_BOOL(lp_obey_pam_restrictions
, &Globals
.bObeyPamRestrictions
)
5731 FN_GLOBAL_BOOL(lp_encrypted_passwords
, &Globals
.bEncryptPasswords
)
5732 FN_GLOBAL_INTEGER(lp_client_schannel
, &Globals
.clientSchannel
)
5733 FN_GLOBAL_INTEGER(lp_server_schannel
, &Globals
.serverSchannel
)
5734 FN_GLOBAL_BOOL(lp_syslog_only
, &Globals
.bSyslogOnly
)
5735 FN_GLOBAL_BOOL(lp_timestamp_logs
, &Globals
.bTimestampLogs
)
5736 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp
, &Globals
.bDebugPrefixTimestamp
)
5737 FN_GLOBAL_BOOL(lp_debug_hires_timestamp
, &Globals
.bDebugHiresTimestamp
)
5738 FN_GLOBAL_BOOL(lp_debug_pid
, &Globals
.bDebugPid
)
5739 FN_GLOBAL_BOOL(lp_debug_uid
, &Globals
.bDebugUid
)
5740 FN_GLOBAL_BOOL(lp_debug_class
, &Globals
.bDebugClass
)
5741 FN_GLOBAL_BOOL(lp_enable_core_files
, &Globals
.bEnableCoreFiles
)
5742 FN_GLOBAL_BOOL(lp_browse_list
, &Globals
.bBrowseList
)
5743 FN_GLOBAL_BOOL(lp_nis_home_map
, &Globals
.bNISHomeMap
)
5744 static FN_GLOBAL_BOOL(lp_time_server
, &Globals
.bTimeServer
)
5745 FN_GLOBAL_BOOL(lp_bind_interfaces_only
, &Globals
.bBindInterfacesOnly
)
5746 FN_GLOBAL_BOOL(lp_pam_password_change
, &Globals
.bPamPasswordChange
)
5747 FN_GLOBAL_BOOL(lp_unix_password_sync
, &Globals
.bUnixPasswdSync
)
5748 FN_GLOBAL_BOOL(lp_passwd_chat_debug
, &Globals
.bPasswdChatDebug
)
5749 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout
, &Globals
.iPasswdChatTimeout
)
5750 FN_GLOBAL_BOOL(lp_nt_pipe_support
, &Globals
.bNTPipeSupport
)
5751 FN_GLOBAL_BOOL(lp_nt_status_support
, &Globals
.bNTStatusSupport
)
5752 FN_GLOBAL_BOOL(lp_stat_cache
, &Globals
.bStatCache
)
5753 FN_GLOBAL_INTEGER(lp_max_stat_cache_size
, &Globals
.iMaxStatCacheSize
)
5754 FN_GLOBAL_BOOL(lp_allow_trusted_domains
, &Globals
.bAllowTrustedDomains
)
5755 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain
, &Globals
.bMapUntrustedToDomain
)
5756 FN_GLOBAL_INTEGER(lp_restrict_anonymous
, &Globals
.restrict_anonymous
)
5757 FN_GLOBAL_BOOL(lp_lanman_auth
, &Globals
.bLanmanAuth
)
5758 FN_GLOBAL_BOOL(lp_ntlm_auth
, &Globals
.bNTLMAuth
)
5759 FN_GLOBAL_BOOL(lp_client_plaintext_auth
, &Globals
.bClientPlaintextAuth
)
5760 FN_GLOBAL_BOOL(lp_client_lanman_auth
, &Globals
.bClientLanManAuth
)
5761 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth
, &Globals
.bClientNTLMv2Auth
)
5762 FN_GLOBAL_BOOL(lp_host_msdfs
, &Globals
.bHostMSDfs
)
5763 FN_GLOBAL_BOOL(lp_kernel_oplocks
, &Globals
.bKernelOplocks
)
5764 FN_GLOBAL_BOOL(lp_enhanced_browsing
, &Globals
.enhanced_browsing
)
5765 FN_GLOBAL_BOOL(lp_use_mmap
, &Globals
.bUseMmap
)
5766 FN_GLOBAL_BOOL(lp_unix_extensions
, &Globals
.bUnixExtensions
)
5767 FN_GLOBAL_BOOL(lp_use_spnego
, &Globals
.bUseSpnego
)
5768 FN_GLOBAL_BOOL(lp_client_use_spnego
, &Globals
.bClientUseSpnego
)
5769 FN_GLOBAL_BOOL(lp_client_use_spnego_principal
, &Globals
.client_use_spnego_principal
)
5770 FN_GLOBAL_BOOL(lp_send_spnego_principal
, &Globals
.send_spnego_principal
)
5771 FN_GLOBAL_BOOL(lp_hostname_lookups
, &Globals
.bHostnameLookups
)
5772 FN_LOCAL_PARM_BOOL(lp_change_notify
, bChangeNotify
)
5773 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify
, bKernelChangeNotify
)
5774 FN_GLOBAL_STRING(lp_dedicated_keytab_file
, &Globals
.szDedicatedKeytabFile
)
5775 FN_GLOBAL_INTEGER(lp_kerberos_method
, &Globals
.iKerberosMethod
)
5776 FN_GLOBAL_BOOL(lp_defer_sharing_violations
, &Globals
.bDeferSharingViolations
)
5777 FN_GLOBAL_BOOL(lp_enable_privileges
, &Globals
.bEnablePrivileges
)
5778 FN_GLOBAL_BOOL(lp_enable_asu_support
, &Globals
.bASUSupport
)
5779 FN_GLOBAL_INTEGER(lp_os_level
, &Globals
.os_level
)
5780 FN_GLOBAL_INTEGER(lp_max_ttl
, &Globals
.max_ttl
)
5781 FN_GLOBAL_INTEGER(lp_max_wins_ttl
, &Globals
.max_wins_ttl
)
5782 FN_GLOBAL_INTEGER(lp_min_wins_ttl
, &Globals
.min_wins_ttl
)
5783 FN_GLOBAL_INTEGER(lp_max_log_size
, &Globals
.max_log_size
)
5784 FN_GLOBAL_INTEGER(lp_max_open_files
, &Globals
.max_open_files
)
5785 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size
, &Globals
.open_files_db_hash_size
)
5786 FN_GLOBAL_INTEGER(lp_maxxmit
, &Globals
.max_xmit
)
5787 FN_GLOBAL_INTEGER(lp_maxmux
, &Globals
.max_mux
)
5788 FN_GLOBAL_INTEGER(lp_passwordlevel
, &Globals
.pwordlevel
)
5789 FN_GLOBAL_INTEGER(lp_usernamelevel
, &Globals
.unamelevel
)
5790 FN_GLOBAL_INTEGER(lp_deadtime
, &Globals
.deadtime
)
5791 FN_GLOBAL_BOOL(lp_getwd_cache
, &Globals
.getwd_cache
)
5792 static FN_GLOBAL_INTEGER(_lp_maxprotocol
, &Globals
.maxprotocol
)
5793 int lp_maxprotocol(void)
5795 int ret
= _lp_maxprotocol();
5796 if ((ret
== PROTOCOL_SMB2
) && (lp_security() == SEC_SHARE
)) {
5797 DEBUG(2,("WARNING!!: \"security = share\" is incompatible "
5798 "with the SMB2 protocol. Resetting to SMB1.\n" ));
5799 lp_do_parameter(-1, "max protocol", "NT1");
5800 return PROTOCOL_NT1
;
5804 FN_GLOBAL_INTEGER(lp_minprotocol
, &Globals
.minprotocol
)
5805 FN_GLOBAL_INTEGER(lp_security
, &Globals
.security
)
5806 FN_GLOBAL_LIST(lp_auth_methods
, &Globals
.AuthMethods
)
5807 FN_GLOBAL_BOOL(lp_paranoid_server_security
, &Globals
.paranoid_server_security
)
5808 FN_GLOBAL_INTEGER(lp_maxdisksize
, &Globals
.maxdisksize
)
5809 FN_GLOBAL_INTEGER(lp_lpqcachetime
, &Globals
.lpqcachetime
)
5810 FN_GLOBAL_INTEGER(lp_max_smbd_processes
, &Globals
.iMaxSmbdProcesses
)
5811 FN_GLOBAL_BOOL(_lp_disable_spoolss
, &Globals
.bDisableSpoolss
)
5812 FN_GLOBAL_INTEGER(lp_syslog
, &Globals
.syslog
)
5813 static FN_GLOBAL_INTEGER(lp_announce_as
, &Globals
.announce_as
)
5814 FN_GLOBAL_INTEGER(lp_lm_announce
, &Globals
.lm_announce
)
5815 FN_GLOBAL_INTEGER(lp_lm_interval
, &Globals
.lm_interval
)
5816 FN_GLOBAL_INTEGER(lp_machine_password_timeout
, &Globals
.machine_password_timeout
)
5817 FN_GLOBAL_INTEGER(lp_map_to_guest
, &Globals
.map_to_guest
)
5818 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time
, &Globals
.oplock_break_wait_time
)
5819 FN_GLOBAL_INTEGER(lp_lock_spin_time
, &Globals
.iLockSpinTime
)
5820 FN_GLOBAL_INTEGER(lp_usershare_max_shares
, &Globals
.iUsershareMaxShares
)
5821 FN_GLOBAL_CONST_STRING(lp_socket_options
, &Globals
.szSocketOptions
)
5822 FN_GLOBAL_INTEGER(lp_config_backend
, &Globals
.ConfigBackend
)
5823 FN_GLOBAL_INTEGER(lp_smb2_max_read
, &Globals
.ismb2_max_read
)
5824 FN_GLOBAL_INTEGER(lp_smb2_max_write
, &Globals
.ismb2_max_write
)
5825 FN_GLOBAL_INTEGER(lp_smb2_max_trans
, &Globals
.ismb2_max_trans
)
5826 int lp_smb2_max_credits(void)
5828 if (Globals
.ismb2_max_credits
== 0) {
5829 Globals
.ismb2_max_credits
= DEFAULT_SMB2_MAX_CREDITS
;
5831 return Globals
.ismb2_max_credits
;
5833 FN_LOCAL_STRING(lp_preexec
, szPreExec
)
5834 FN_LOCAL_STRING(lp_postexec
, szPostExec
)
5835 FN_LOCAL_STRING(lp_rootpreexec
, szRootPreExec
)
5836 FN_LOCAL_STRING(lp_rootpostexec
, szRootPostExec
)
5837 FN_LOCAL_STRING(lp_servicename
, szService
)
5838 FN_LOCAL_CONST_STRING(lp_const_servicename
, szService
)
5839 FN_LOCAL_STRING(lp_pathname
, szPath
)
5840 FN_LOCAL_STRING(lp_dontdescend
, szDontdescend
)
5841 FN_LOCAL_STRING(lp_username
, szUsername
)
5842 FN_LOCAL_LIST(lp_invalid_users
, szInvalidUsers
)
5843 FN_LOCAL_LIST(lp_valid_users
, szValidUsers
)
5844 FN_LOCAL_LIST(lp_admin_users
, szAdminUsers
)
5845 FN_GLOBAL_LIST(lp_svcctl_list
, &Globals
.szServicesList
)
5846 FN_LOCAL_STRING(lp_cups_options
, szCupsOptions
)
5847 FN_GLOBAL_STRING(lp_cups_server
, &Globals
.szCupsServer
)
5848 int lp_cups_encrypt(void)
5851 #ifdef HAVE_HTTPCONNECTENCRYPT
5852 switch (Globals
.CupsEncrypt
) {
5854 result
= HTTP_ENCRYPT_REQUIRED
;
5857 result
= HTTP_ENCRYPT_ALWAYS
;
5860 result
= HTTP_ENCRYPT_NEVER
;
5866 FN_GLOBAL_STRING(lp_iprint_server
, &Globals
.szIPrintServer
)
5867 FN_GLOBAL_INTEGER(lp_cups_connection_timeout
, &Globals
.cups_connection_timeout
)
5868 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket
, &Globals
.ctdbdSocket
)
5869 FN_GLOBAL_LIST(lp_cluster_addresses
, &Globals
.szClusterAddresses
)
5870 FN_GLOBAL_BOOL(lp_clustering
, &Globals
.clustering
)
5871 FN_GLOBAL_INTEGER(lp_ctdb_timeout
, &Globals
.ctdb_timeout
)
5872 FN_GLOBAL_INTEGER(lp_ctdb_locktime_warn_threshold
, &Globals
.ctdb_locktime_warn_threshold
)
5873 FN_LOCAL_STRING(lp_printcommand
, szPrintcommand
)
5874 FN_LOCAL_STRING(lp_lpqcommand
, szLpqcommand
)
5875 FN_LOCAL_STRING(lp_lprmcommand
, szLprmcommand
)
5876 FN_LOCAL_STRING(lp_lppausecommand
, szLppausecommand
)
5877 FN_LOCAL_STRING(lp_lpresumecommand
, szLpresumecommand
)
5878 FN_LOCAL_STRING(lp_queuepausecommand
, szQueuepausecommand
)
5879 FN_LOCAL_STRING(lp_queueresumecommand
, szQueueresumecommand
)
5880 static FN_LOCAL_STRING(_lp_printername
, szPrintername
)
5881 FN_LOCAL_CONST_STRING(lp_printjob_username
, szPrintjobUsername
)
5882 FN_LOCAL_LIST(lp_hostsallow
, szHostsallow
)
5883 FN_LOCAL_LIST(lp_hostsdeny
, szHostsdeny
)
5884 FN_LOCAL_STRING(lp_magicscript
, szMagicScript
)
5885 FN_LOCAL_STRING(lp_magicoutput
, szMagicOutput
)
5886 FN_LOCAL_STRING(lp_comment
, comment
)
5887 FN_LOCAL_STRING(lp_force_user
, force_user
)
5888 FN_LOCAL_STRING(lp_force_group
, force_group
)
5889 FN_LOCAL_LIST(lp_readlist
, readlist
)
5890 FN_LOCAL_LIST(lp_writelist
, writelist
)
5891 FN_LOCAL_LIST(lp_printer_admin
, printer_admin
)
5892 FN_LOCAL_STRING(lp_fstype
, fstype
)
5893 FN_LOCAL_LIST(lp_vfs_objects
, szVfsObjects
)
5894 FN_LOCAL_STRING(lp_msdfs_proxy
, szMSDfsProxy
)
5895 static FN_LOCAL_STRING(lp_volume
, volume
)
5896 FN_LOCAL_STRING(lp_veto_files
, szVetoFiles
)
5897 FN_LOCAL_STRING(lp_hide_files
, szHideFiles
)
5898 FN_LOCAL_STRING(lp_veto_oplocks
, szVetoOplockFiles
)
5899 FN_LOCAL_BOOL(lp_msdfs_root
, bMSDfsRoot
)
5900 FN_LOCAL_STRING(lp_aio_write_behind
, szAioWriteBehind
)
5901 FN_LOCAL_STRING(lp_dfree_command
, szDfree
)
5902 FN_LOCAL_BOOL(lp_autoloaded
, autoloaded
)
5903 FN_LOCAL_BOOL(lp_preexec_close
, bPreexecClose
)
5904 FN_LOCAL_BOOL(lp_rootpreexec_close
, bRootpreexecClose
)
5905 FN_LOCAL_INTEGER(lp_casesensitive
, iCaseSensitive
)
5906 FN_LOCAL_BOOL(lp_preservecase
, bCasePreserve
)
5907 FN_LOCAL_BOOL(lp_shortpreservecase
, bShortCasePreserve
)
5908 FN_LOCAL_BOOL(lp_hide_dot_files
, bHideDotFiles
)
5909 FN_LOCAL_BOOL(lp_hide_special_files
, bHideSpecialFiles
)
5910 FN_LOCAL_BOOL(lp_hideunreadable
, bHideUnReadable
)
5911 FN_LOCAL_BOOL(lp_hideunwriteable_files
, bHideUnWriteableFiles
)
5912 FN_LOCAL_BOOL(lp_browseable
, bBrowseable
)
5913 FN_LOCAL_BOOL(lp_access_based_share_enum
, bAccessBasedShareEnum
)
5914 FN_LOCAL_BOOL(lp_readonly
, bRead_only
)
5915 FN_LOCAL_BOOL(lp_no_set_dir
, bNo_set_dir
)
5916 FN_LOCAL_BOOL(lp_guest_ok
, bGuest_ok
)
5917 FN_LOCAL_BOOL(lp_guest_only
, bGuest_only
)
5918 FN_LOCAL_BOOL(lp_administrative_share
, bAdministrative_share
)
5919 FN_LOCAL_BOOL(lp_print_ok
, bPrint_ok
)
5920 FN_LOCAL_BOOL(lp_map_hidden
, bMap_hidden
)
5921 FN_LOCAL_BOOL(lp_map_archive
, bMap_archive
)
5922 FN_LOCAL_BOOL(lp_store_dos_attributes
, bStoreDosAttributes
)
5923 FN_LOCAL_BOOL(lp_dmapi_support
, bDmapiSupport
)
5924 FN_LOCAL_PARM_BOOL(lp_locking
, bLocking
)
5925 FN_LOCAL_PARM_INTEGER(lp_strict_locking
, iStrictLocking
)
5926 FN_LOCAL_PARM_BOOL(lp_posix_locking
, bPosixLocking
)
5927 FN_LOCAL_BOOL(lp_share_modes
, bShareModes
)
5928 FN_LOCAL_BOOL(lp_oplocks
, bOpLocks
)
5929 FN_LOCAL_BOOL(lp_level2_oplocks
, bLevel2OpLocks
)
5930 FN_LOCAL_BOOL(lp_onlyuser
, bOnlyUser
)
5931 FN_LOCAL_PARM_BOOL(lp_manglednames
, bMangledNames
)
5932 FN_LOCAL_BOOL(lp_symlinks
, bSymlinks
)
5933 FN_LOCAL_BOOL(lp_syncalways
, bSyncAlways
)
5934 FN_LOCAL_BOOL(lp_strict_allocate
, bStrictAllocate
)
5935 FN_LOCAL_BOOL(lp_strict_sync
, bStrictSync
)
5936 FN_LOCAL_BOOL(lp_map_system
, bMap_system
)
5937 FN_LOCAL_BOOL(lp_delete_readonly
, bDeleteReadonly
)
5938 FN_LOCAL_BOOL(lp_fake_oplocks
, bFakeOplocks
)
5939 FN_LOCAL_BOOL(lp_recursive_veto_delete
, bDeleteVetoFiles
)
5940 FN_LOCAL_BOOL(lp_dos_filemode
, bDosFilemode
)
5941 FN_LOCAL_BOOL(lp_dos_filetimes
, bDosFiletimes
)
5942 FN_LOCAL_BOOL(lp_dos_filetime_resolution
, bDosFiletimeResolution
)
5943 FN_LOCAL_BOOL(lp_fake_dir_create_times
, bFakeDirCreateTimes
)
5944 FN_GLOBAL_BOOL(lp_async_smb_echo_handler
, &Globals
.bAsyncSMBEchoHandler
)
5945 FN_GLOBAL_BOOL(lp_multicast_dns_register
, &Globals
.bMulticastDnsRegister
)
5946 FN_LOCAL_BOOL(lp_blocking_locks
, bBlockingLocks
)
5947 FN_LOCAL_BOOL(lp_inherit_perms
, bInheritPerms
)
5948 FN_LOCAL_BOOL(lp_inherit_acls
, bInheritACLS
)
5949 FN_LOCAL_BOOL(lp_inherit_owner
, bInheritOwner
)
5950 FN_LOCAL_BOOL(lp_use_client_driver
, bUseClientDriver
)
5951 FN_LOCAL_BOOL(lp_default_devmode
, bDefaultDevmode
)
5952 FN_LOCAL_BOOL(lp_force_printername
, bForcePrintername
)
5953 FN_LOCAL_BOOL(lp_nt_acl_support
, bNTAclSupport
)
5954 FN_LOCAL_BOOL(lp_force_unknown_acl_user
, bForceUnknownAclUser
)
5955 FN_LOCAL_BOOL(lp_ea_support
, bEASupport
)
5956 FN_LOCAL_BOOL(_lp_use_sendfile
, bUseSendfile
)
5957 FN_LOCAL_BOOL(lp_profile_acls
, bProfileAcls
)
5958 FN_LOCAL_BOOL(lp_map_acl_inherit
, bMap_acl_inherit
)
5959 FN_LOCAL_BOOL(lp_afs_share
, bAfs_Share
)
5960 FN_LOCAL_BOOL(lp_acl_check_permissions
, bAclCheckPermissions
)
5961 FN_LOCAL_BOOL(lp_acl_group_control
, bAclGroupControl
)
5962 FN_LOCAL_BOOL(lp_acl_map_full_control
, bAclMapFullControl
)
5963 FN_LOCAL_INTEGER(lp_create_mask
, iCreate_mask
)
5964 FN_LOCAL_INTEGER(lp_force_create_mode
, iCreate_force_mode
)
5965 FN_LOCAL_INTEGER(lp_security_mask
, iSecurity_mask
)
5966 FN_LOCAL_INTEGER(lp_force_security_mode
, iSecurity_force_mode
)
5967 FN_LOCAL_INTEGER(lp_dir_mask
, iDir_mask
)
5968 FN_LOCAL_INTEGER(lp_force_dir_mode
, iDir_force_mode
)
5969 FN_LOCAL_INTEGER(lp_dir_security_mask
, iDir_Security_mask
)
5970 FN_LOCAL_INTEGER(lp_force_dir_security_mode
, iDir_Security_force_mode
)
5971 FN_LOCAL_INTEGER(lp_max_connections
, iMaxConnections
)
5972 FN_LOCAL_INTEGER(lp_defaultcase
, iDefaultCase
)
5973 FN_LOCAL_INTEGER(lp_minprintspace
, iMinPrintSpace
)
5974 FN_LOCAL_INTEGER(lp_printing
, iPrinting
)
5975 FN_LOCAL_INTEGER(lp_max_reported_jobs
, iMaxReportedPrintJobs
)
5976 FN_LOCAL_INTEGER(lp_oplock_contention_limit
, iOplockContentionLimit
)
5977 FN_LOCAL_INTEGER(lp_csc_policy
, iCSCPolicy
)
5978 FN_LOCAL_INTEGER(lp_write_cache_size
, iWriteCacheSize
)
5979 FN_LOCAL_INTEGER(lp_block_size
, iBlock_size
)
5980 FN_LOCAL_INTEGER(lp_dfree_cache_time
, iDfreeCacheTime
)
5981 FN_LOCAL_INTEGER(lp_allocation_roundup_size
, iallocation_roundup_size
)
5982 FN_LOCAL_INTEGER(lp_aio_read_size
, iAioReadSize
)
5983 FN_LOCAL_INTEGER(lp_aio_write_size
, iAioWriteSize
)
5984 FN_LOCAL_INTEGER(lp_map_readonly
, iMap_readonly
)
5985 FN_LOCAL_INTEGER(lp_directory_name_cache_size
, iDirectoryNameCacheSize
)
5986 FN_LOCAL_INTEGER(lp_smb_encrypt
, ismb_encrypt
)
5987 FN_LOCAL_CHAR(lp_magicchar
, magic_char
)
5988 FN_GLOBAL_INTEGER(lp_winbind_cache_time
, &Globals
.winbind_cache_time
)
5989 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay
, &Globals
.winbind_reconnect_delay
)
5990 FN_GLOBAL_INTEGER(lp_winbind_max_clients
, &Globals
.winbind_max_clients
)
5991 FN_GLOBAL_LIST(lp_winbind_nss_info
, &Globals
.szWinbindNssInfo
)
5992 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base
, &Globals
.AlgorithmicRidBase
)
5993 FN_GLOBAL_INTEGER(lp_name_cache_timeout
, &Globals
.name_cache_timeout
)
5994 FN_GLOBAL_INTEGER(lp_client_signing
, &Globals
.client_signing
)
5995 FN_GLOBAL_INTEGER(lp_server_signing
, &Globals
.server_signing
)
5996 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping
, &Globals
.client_ldap_sasl_wrapping
)
5998 FN_GLOBAL_STRING(lp_ncalrpc_dir
, &Globals
.ncalrpc_dir
)
6000 /* local prototypes */
6002 static int map_parameter_canonical(const char *pszParmName
, bool *inverse
);
6003 static const char *get_boolean(bool bool_value
);
6004 static int getservicebyname(const char *pszServiceName
,
6005 struct service
*pserviceDest
);
6006 static void copy_service(struct service
*pserviceDest
,
6007 struct service
*pserviceSource
,
6008 struct bitmap
*pcopymapDest
);
6009 static bool do_parameter(const char *pszParmName
, const char *pszParmValue
,
6011 static bool do_section(const char *pszSectionName
, void *userdata
);
6012 static void init_copymap(struct service
*pservice
);
6013 static bool hash_a_service(const char *name
, int number
);
6014 static void free_service_byindex(int iService
);
6015 static void free_param_opts(struct param_opt_struct
**popts
);
6016 static void show_parameter(int parmIndex
);
6017 static bool is_synonym_of(int parm1
, int parm2
, bool *inverse
);
6020 * This is a helper function for parametrical options support. It returns a
6021 * pointer to parametrical option value if it exists or NULL otherwise. Actual
6022 * parametrical functions are quite simple
6024 static struct param_opt_struct
*get_parametrics(int snum
, const char *type
,
6027 bool global_section
= False
;
6029 struct param_opt_struct
*data
;
6031 if (snum
>= iNumServices
) return NULL
;
6034 data
= Globals
.param_opt
;
6035 global_section
= True
;
6037 data
= ServicePtrs
[snum
]->param_opt
;
6040 if (asprintf(¶m_key
, "%s:%s", type
, option
) == -1) {
6041 DEBUG(0,("asprintf failed!\n"));
6046 if (strwicmp(data
->key
, param_key
) == 0) {
6047 string_free(¶m_key
);
6053 if (!global_section
) {
6054 /* Try to fetch the same option but from globals */
6055 /* but only if we are not already working with Globals */
6056 data
= Globals
.param_opt
;
6058 if (strwicmp(data
->key
, param_key
) == 0) {
6059 string_free(¶m_key
);
6066 string_free(¶m_key
);
6072 #define MISSING_PARAMETER(name) \
6073 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
6075 /*******************************************************************
6076 convenience routine to return int parameters.
6077 ********************************************************************/
6078 static int lp_int(const char *s
)
6082 MISSING_PARAMETER(lp_int
);
6086 return (int)strtol(s
, NULL
, 0);
6089 /*******************************************************************
6090 convenience routine to return unsigned long parameters.
6091 ********************************************************************/
6092 static unsigned long lp_ulong(const char *s
)
6096 MISSING_PARAMETER(lp_ulong
);
6100 return strtoul(s
, NULL
, 0);
6103 /*******************************************************************
6104 convenience routine to return boolean parameters.
6105 ********************************************************************/
6106 static bool lp_bool(const char *s
)
6111 MISSING_PARAMETER(lp_bool
);
6115 if (!set_boolean(s
, &ret
)) {
6116 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s
));
6123 /*******************************************************************
6124 convenience routine to return enum parameters.
6125 ********************************************************************/
6126 static int lp_enum(const char *s
,const struct enum_list
*_enum
)
6130 if (!s
|| !*s
|| !_enum
) {
6131 MISSING_PARAMETER(lp_enum
);
6135 for (i
=0; _enum
[i
].name
; i
++) {
6136 if (strequal(_enum
[i
].name
,s
))
6137 return _enum
[i
].value
;
6140 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s
));
6144 #undef MISSING_PARAMETER
6146 /* DO NOT USE lp_parm_string ANYMORE!!!!
6147 * use lp_parm_const_string or lp_parm_talloc_string
6149 * lp_parm_string is only used to let old modules find this symbol
6151 #undef lp_parm_string
6152 char *lp_parm_string(const char *servicename
, const char *type
, const char *option
);
6153 char *lp_parm_string(const char *servicename
, const char *type
, const char *option
)
6155 return lp_parm_talloc_string(lp_servicenumber(servicename
), type
, option
, NULL
);
6158 /* Return parametric option from a given service. Type is a part of option before ':' */
6159 /* Parametric option has following syntax: 'Type: option = value' */
6160 /* the returned value is talloced on the talloc_tos() */
6161 char *lp_parm_talloc_string(int snum
, const char *type
, const char *option
, const char *def
)
6163 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6165 if (data
== NULL
||data
->value
==NULL
) {
6167 return lp_string(def
);
6173 return lp_string(data
->value
);
6176 /* Return parametric option from a given service. Type is a part of option before ':' */
6177 /* Parametric option has following syntax: 'Type: option = value' */
6178 const char *lp_parm_const_string(int snum
, const char *type
, const char *option
, const char *def
)
6180 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6182 if (data
== NULL
||data
->value
==NULL
)
6188 /* Return parametric option from a given service. Type is a part of option before ':' */
6189 /* Parametric option has following syntax: 'Type: option = value' */
6191 const char **lp_parm_string_list(int snum
, const char *type
, const char *option
, const char **def
)
6193 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6195 if (data
== NULL
||data
->value
==NULL
)
6196 return (const char **)def
;
6198 if (data
->list
==NULL
) {
6199 data
->list
= str_list_make_v3(NULL
, data
->value
, NULL
);
6202 return (const char **)data
->list
;
6205 /* Return parametric option from a given service. Type is a part of option before ':' */
6206 /* Parametric option has following syntax: 'Type: option = value' */
6208 int lp_parm_int(int snum
, const char *type
, const char *option
, int def
)
6210 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6212 if (data
&& data
->value
&& *data
->value
)
6213 return lp_int(data
->value
);
6218 /* Return parametric option from a given service. Type is a part of option before ':' */
6219 /* Parametric option has following syntax: 'Type: option = value' */
6221 unsigned long lp_parm_ulong(int snum
, const char *type
, const char *option
, unsigned long def
)
6223 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6225 if (data
&& data
->value
&& *data
->value
)
6226 return lp_ulong(data
->value
);
6231 /* Return parametric option from a given service. Type is a part of option before ':' */
6232 /* Parametric option has following syntax: 'Type: option = value' */
6234 bool lp_parm_bool(int snum
, const char *type
, const char *option
, bool def
)
6236 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6238 if (data
&& data
->value
&& *data
->value
)
6239 return lp_bool(data
->value
);
6244 /* Return parametric option from a given service. Type is a part of option before ':' */
6245 /* Parametric option has following syntax: 'Type: option = value' */
6247 int lp_parm_enum(int snum
, const char *type
, const char *option
,
6248 const struct enum_list
*_enum
, int def
)
6250 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
6252 if (data
&& data
->value
&& *data
->value
&& _enum
)
6253 return lp_enum(data
->value
, _enum
);
6259 /***************************************************************************
6260 Initialise a service to the defaults.
6261 ***************************************************************************/
6263 static void init_service(struct service
*pservice
)
6265 memset((char *)pservice
, '\0', sizeof(struct service
));
6266 copy_service(pservice
, &sDefault
, NULL
);
6271 * free a param_opts structure.
6272 * param_opts handling should be moved to talloc;
6273 * then this whole functions reduces to a TALLOC_FREE().
6276 static void free_param_opts(struct param_opt_struct
**popts
)
6278 struct param_opt_struct
*opt
, *next_opt
;
6280 if (popts
== NULL
) {
6284 if (*popts
!= NULL
) {
6285 DEBUG(5, ("Freeing parametrics:\n"));
6288 while (opt
!= NULL
) {
6289 string_free(&opt
->key
);
6290 string_free(&opt
->value
);
6291 TALLOC_FREE(opt
->list
);
6292 next_opt
= opt
->next
;
6299 /***************************************************************************
6300 Free the dynamically allocated parts of a service struct.
6301 ***************************************************************************/
6303 static void free_service(struct service
*pservice
)
6308 if (pservice
->szService
)
6309 DEBUG(5, ("free_service: Freeing service %s\n",
6310 pservice
->szService
));
6312 free_parameters(pservice
);
6314 string_free(&pservice
->szService
);
6315 TALLOC_FREE(pservice
->copymap
);
6317 free_param_opts(&pservice
->param_opt
);
6319 ZERO_STRUCTP(pservice
);
6323 /***************************************************************************
6324 remove a service indexed in the ServicePtrs array from the ServiceHash
6325 and free the dynamically allocated parts
6326 ***************************************************************************/
6328 static void free_service_byindex(int idx
)
6330 if ( !LP_SNUM_OK(idx
) )
6333 ServicePtrs
[idx
]->valid
= False
;
6334 invalid_services
[num_invalid_services
++] = idx
;
6336 /* we have to cleanup the hash record */
6338 if (ServicePtrs
[idx
]->szService
) {
6339 char *canon_name
= canonicalize_servicename(
6341 ServicePtrs
[idx
]->szService
);
6343 dbwrap_delete_bystring(ServiceHash
, canon_name
);
6344 TALLOC_FREE(canon_name
);
6347 free_service(ServicePtrs
[idx
]);
6350 /***************************************************************************
6351 Add a new service to the services array initialising it with the given
6353 ***************************************************************************/
6355 static int add_a_service(const struct service
*pservice
, const char *name
)
6358 struct service tservice
;
6359 int num_to_alloc
= iNumServices
+ 1;
6361 tservice
= *pservice
;
6363 /* it might already exist */
6365 i
= getservicebyname(name
, NULL
);
6371 /* find an invalid one */
6373 if (num_invalid_services
> 0) {
6374 i
= invalid_services
[--num_invalid_services
];
6377 /* if not, then create one */
6378 if (i
== iNumServices
) {
6379 struct service
**tsp
;
6382 tsp
= SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs
, struct service
*, num_to_alloc
);
6384 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
6388 ServicePtrs
[iNumServices
] = SMB_MALLOC_P(struct service
);
6389 if (!ServicePtrs
[iNumServices
]) {
6390 DEBUG(0,("add_a_service: out of memory!\n"));
6395 /* enlarge invalid_services here for now... */
6396 tinvalid
= SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services
, int,
6398 if (tinvalid
== NULL
) {
6399 DEBUG(0,("add_a_service: failed to enlarge "
6400 "invalid_services!\n"));
6403 invalid_services
= tinvalid
;
6405 free_service_byindex(i
);
6408 ServicePtrs
[i
]->valid
= True
;
6410 init_service(ServicePtrs
[i
]);
6411 copy_service(ServicePtrs
[i
], &tservice
, NULL
);
6413 string_set(&ServicePtrs
[i
]->szService
, name
);
6415 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
6416 i
, ServicePtrs
[i
]->szService
));
6418 if (!hash_a_service(ServicePtrs
[i
]->szService
, i
)) {
6425 /***************************************************************************
6426 Convert a string to uppercase and remove whitespaces.
6427 ***************************************************************************/
6429 char *canonicalize_servicename(TALLOC_CTX
*ctx
, const char *src
)
6434 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
6438 result
= talloc_strdup(ctx
, src
);
6439 SMB_ASSERT(result
!= NULL
);
6445 /***************************************************************************
6446 Add a name/index pair for the services array to the hash table.
6447 ***************************************************************************/
6449 static bool hash_a_service(const char *name
, int idx
)
6453 if ( !ServiceHash
) {
6454 DEBUG(10,("hash_a_service: creating servicehash\n"));
6455 ServiceHash
= db_open_rbt(NULL
);
6456 if ( !ServiceHash
) {
6457 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
6462 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
6465 canon_name
= canonicalize_servicename(talloc_tos(), name
);
6467 dbwrap_store_bystring(ServiceHash
, canon_name
,
6468 make_tdb_data((uint8
*)&idx
, sizeof(idx
)),
6471 TALLOC_FREE(canon_name
);
6476 /***************************************************************************
6477 Add a new home service, with the specified home directory, defaults coming
6479 ***************************************************************************/
6481 bool lp_add_home(const char *pszHomename
, int iDefaultService
,
6482 const char *user
, const char *pszHomedir
)
6486 if (pszHomename
== NULL
|| user
== NULL
|| pszHomedir
== NULL
||
6487 pszHomedir
[0] == '\0') {
6491 i
= add_a_service(ServicePtrs
[iDefaultService
], pszHomename
);
6496 if (!(*(ServicePtrs
[iDefaultService
]->szPath
))
6497 || strequal(ServicePtrs
[iDefaultService
]->szPath
, lp_pathname(GLOBAL_SECTION_SNUM
))) {
6498 string_set(&ServicePtrs
[i
]->szPath
, pszHomedir
);
6501 if (!(*(ServicePtrs
[i
]->comment
))) {
6502 char *comment
= NULL
;
6503 if (asprintf(&comment
, "Home directory of %s", user
) < 0) {
6506 string_set(&ServicePtrs
[i
]->comment
, comment
);
6510 /* set the browseable flag from the global default */
6512 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6513 ServicePtrs
[i
]->bAccessBasedShareEnum
= sDefault
.bAccessBasedShareEnum
;
6515 ServicePtrs
[i
]->autoloaded
= True
;
6517 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename
,
6518 user
, ServicePtrs
[i
]->szPath
));
6523 /***************************************************************************
6524 Add a new service, based on an old one.
6525 ***************************************************************************/
6527 int lp_add_service(const char *pszService
, int iDefaultService
)
6529 if (iDefaultService
< 0) {
6530 return add_a_service(&sDefault
, pszService
);
6533 return (add_a_service(ServicePtrs
[iDefaultService
], pszService
));
6536 /***************************************************************************
6537 Add the IPC service.
6538 ***************************************************************************/
6540 static bool lp_add_ipc(const char *ipc_name
, bool guest_ok
)
6542 char *comment
= NULL
;
6543 int i
= add_a_service(&sDefault
, ipc_name
);
6548 if (asprintf(&comment
, "IPC Service (%s)",
6549 Globals
.szServerString
) < 0) {
6553 string_set(&ServicePtrs
[i
]->szPath
, tmpdir());
6554 string_set(&ServicePtrs
[i
]->szUsername
, "");
6555 string_set(&ServicePtrs
[i
]->comment
, comment
);
6556 string_set(&ServicePtrs
[i
]->fstype
, "IPC");
6557 ServicePtrs
[i
]->iMaxConnections
= 0;
6558 ServicePtrs
[i
]->bAvailable
= True
;
6559 ServicePtrs
[i
]->bRead_only
= True
;
6560 ServicePtrs
[i
]->bGuest_only
= False
;
6561 ServicePtrs
[i
]->bAdministrative_share
= True
;
6562 ServicePtrs
[i
]->bGuest_ok
= guest_ok
;
6563 ServicePtrs
[i
]->bPrint_ok
= False
;
6564 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6566 DEBUG(3, ("adding IPC service\n"));
6572 /***************************************************************************
6573 Add a new printer service, with defaults coming from service iFrom.
6574 ***************************************************************************/
6576 bool lp_add_printer(const char *pszPrintername
, int iDefaultService
)
6578 const char *comment
= "From Printcap";
6579 int i
= add_a_service(ServicePtrs
[iDefaultService
], pszPrintername
);
6584 /* note that we do NOT default the availability flag to True - */
6585 /* we take it from the default service passed. This allows all */
6586 /* dynamic printers to be disabled by disabling the [printers] */
6587 /* entry (if/when the 'available' keyword is implemented!). */
6589 /* the printer name is set to the service name. */
6590 string_set(&ServicePtrs
[i
]->szPrintername
, pszPrintername
);
6591 string_set(&ServicePtrs
[i
]->comment
, comment
);
6593 /* set the browseable flag from the gloabl default */
6594 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6596 /* Printers cannot be read_only. */
6597 ServicePtrs
[i
]->bRead_only
= False
;
6598 /* No share modes on printer services. */
6599 ServicePtrs
[i
]->bShareModes
= False
;
6600 /* No oplocks on printer services. */
6601 ServicePtrs
[i
]->bOpLocks
= False
;
6602 /* Printer services must be printable. */
6603 ServicePtrs
[i
]->bPrint_ok
= True
;
6605 DEBUG(3, ("adding printer service %s\n", pszPrintername
));
6611 /***************************************************************************
6612 Check whether the given parameter name is valid.
6613 Parametric options (names containing a colon) are considered valid.
6614 ***************************************************************************/
6616 bool lp_parameter_is_valid(const char *pszParmName
)
6618 return ((map_parameter(pszParmName
) != -1) ||
6619 (strchr(pszParmName
, ':') != NULL
));
6622 /***************************************************************************
6623 Check whether the given name is the name of a global parameter.
6624 Returns True for strings belonging to parameters of class
6625 P_GLOBAL, False for all other strings, also for parametric options
6626 and strings not belonging to any option.
6627 ***************************************************************************/
6629 bool lp_parameter_is_global(const char *pszParmName
)
6631 int num
= map_parameter(pszParmName
);
6634 return (parm_table
[num
].p_class
== P_GLOBAL
);
6640 /**************************************************************************
6641 Check whether the given name is the canonical name of a parameter.
6642 Returns False if it is not a valid parameter Name.
6643 For parametric options, True is returned.
6644 **************************************************************************/
6646 bool lp_parameter_is_canonical(const char *parm_name
)
6648 if (!lp_parameter_is_valid(parm_name
)) {
6652 return (map_parameter(parm_name
) ==
6653 map_parameter_canonical(parm_name
, NULL
));
6656 /**************************************************************************
6657 Determine the canonical name for a parameter.
6658 Indicate when it is an inverse (boolean) synonym instead of a
6660 **************************************************************************/
6662 bool lp_canonicalize_parameter(const char *parm_name
, const char **canon_parm
,
6667 if (!lp_parameter_is_valid(parm_name
)) {
6672 num
= map_parameter_canonical(parm_name
, inverse
);
6674 /* parametric option */
6675 *canon_parm
= parm_name
;
6677 *canon_parm
= parm_table
[num
].label
;
6684 /**************************************************************************
6685 Determine the canonical name for a parameter.
6686 Turn the value given into the inverse boolean expression when
6687 the synonym is an invers boolean synonym.
6689 Return True if parm_name is a valid parameter name and
6690 in case it is an invers boolean synonym, if the val string could
6691 successfully be converted to the reverse bool.
6692 Return false in all other cases.
6693 **************************************************************************/
6695 bool lp_canonicalize_parameter_with_value(const char *parm_name
,
6697 const char **canon_parm
,
6698 const char **canon_val
)
6703 if (!lp_parameter_is_valid(parm_name
)) {
6709 num
= map_parameter_canonical(parm_name
, &inverse
);
6711 /* parametric option */
6712 *canon_parm
= parm_name
;
6715 *canon_parm
= parm_table
[num
].label
;
6717 if (!lp_invert_boolean(val
, canon_val
)) {
6729 /***************************************************************************
6730 Map a parameter's string representation to something we can use.
6731 Returns False if the parameter string is not recognised, else TRUE.
6732 ***************************************************************************/
6734 static int map_parameter(const char *pszParmName
)
6738 if (*pszParmName
== '-' && !strequal(pszParmName
, "-valid"))
6741 for (iIndex
= 0; parm_table
[iIndex
].label
; iIndex
++)
6742 if (strwicmp(parm_table
[iIndex
].label
, pszParmName
) == 0)
6745 /* Warn only if it isn't parametric option */
6746 if (strchr(pszParmName
, ':') == NULL
)
6747 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName
));
6748 /* We do return 'fail' for parametric options as well because they are
6749 stored in different storage
6754 /***************************************************************************
6755 Map a parameter's string representation to the index of the canonical
6756 form of the parameter (it might be a synonym).
6757 Returns -1 if the parameter string is not recognised.
6758 ***************************************************************************/
6760 static int map_parameter_canonical(const char *pszParmName
, bool *inverse
)
6762 int parm_num
, canon_num
;
6763 bool loc_inverse
= False
;
6765 parm_num
= map_parameter(pszParmName
);
6766 if ((parm_num
< 0) || !(parm_table
[parm_num
].flags
& FLAG_HIDE
)) {
6767 /* invalid, parametric or no canidate for synonyms ... */
6771 for (canon_num
= 0; parm_table
[canon_num
].label
; canon_num
++) {
6772 if (is_synonym_of(parm_num
, canon_num
, &loc_inverse
)) {
6773 parm_num
= canon_num
;
6779 if (inverse
!= NULL
) {
6780 *inverse
= loc_inverse
;
6785 /***************************************************************************
6786 return true if parameter number parm1 is a synonym of parameter
6787 number parm2 (parm2 being the principal name).
6788 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6790 ***************************************************************************/
6792 static bool is_synonym_of(int parm1
, int parm2
, bool *inverse
)
6794 if ((parm_table
[parm1
].ptr
== parm_table
[parm2
].ptr
) &&
6795 (parm_table
[parm1
].flags
& FLAG_HIDE
) &&
6796 !(parm_table
[parm2
].flags
& FLAG_HIDE
))
6798 if (inverse
!= NULL
) {
6799 if ((parm_table
[parm1
].type
== P_BOOLREV
) &&
6800 (parm_table
[parm2
].type
== P_BOOL
))
6812 /***************************************************************************
6813 Show one parameter's name, type, [values,] and flags.
6814 (helper functions for show_parameter_list)
6815 ***************************************************************************/
6817 static void show_parameter(int parmIndex
)
6819 int enumIndex
, flagIndex
;
6824 const char *type
[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6825 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6827 unsigned flags
[] = { FLAG_BASIC
, FLAG_SHARE
, FLAG_PRINT
, FLAG_GLOBAL
,
6828 FLAG_WIZARD
, FLAG_ADVANCED
, FLAG_DEVELOPER
, FLAG_DEPRECATED
,
6829 FLAG_HIDE
, FLAG_DOS_STRING
};
6830 const char *flag_names
[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6831 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6832 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL
};
6834 printf("%s=%s", parm_table
[parmIndex
].label
,
6835 type
[parm_table
[parmIndex
].type
]);
6836 if (parm_table
[parmIndex
].type
== P_ENUM
) {
6839 parm_table
[parmIndex
].enum_list
[enumIndex
].name
;
6843 enumIndex
? "|" : "",
6844 parm_table
[parmIndex
].enum_list
[enumIndex
].name
);
6849 for (flagIndex
=0; flag_names
[flagIndex
]; flagIndex
++) {
6850 if (parm_table
[parmIndex
].flags
& flags
[flagIndex
]) {
6853 flag_names
[flagIndex
]);
6858 /* output synonyms */
6860 for (parmIndex2
=0; parm_table
[parmIndex2
].label
; parmIndex2
++) {
6861 if (is_synonym_of(parmIndex
, parmIndex2
, &inverse
)) {
6862 printf(" (%ssynonym of %s)", inverse
? "inverse " : "",
6863 parm_table
[parmIndex2
].label
);
6864 } else if (is_synonym_of(parmIndex2
, parmIndex
, &inverse
)) {
6866 printf(" (synonyms: ");
6871 printf("%s%s", parm_table
[parmIndex2
].label
,
6872 inverse
? "[i]" : "");
6882 /***************************************************************************
6883 Show all parameter's name, type, [values,] and flags.
6884 ***************************************************************************/
6886 void show_parameter_list(void)
6888 int classIndex
, parmIndex
;
6889 const char *section_names
[] = { "local", "global", NULL
};
6891 for (classIndex
=0; section_names
[classIndex
]; classIndex
++) {
6892 printf("[%s]\n", section_names
[classIndex
]);
6893 for (parmIndex
= 0; parm_table
[parmIndex
].label
; parmIndex
++) {
6894 if (parm_table
[parmIndex
].p_class
== classIndex
) {
6895 show_parameter(parmIndex
);
6901 /***************************************************************************
6902 Check if a given string correctly represents a boolean value.
6903 ***************************************************************************/
6905 bool lp_string_is_valid_boolean(const char *parm_value
)
6907 return set_boolean(parm_value
, NULL
);
6910 /***************************************************************************
6911 Get the standard string representation of a boolean value ("yes" or "no")
6912 ***************************************************************************/
6914 static const char *get_boolean(bool bool_value
)
6916 static const char *yes_str
= "yes";
6917 static const char *no_str
= "no";
6919 return (bool_value
? yes_str
: no_str
);
6922 /***************************************************************************
6923 Provide the string of the negated boolean value associated to the boolean
6924 given as a string. Returns False if the passed string does not correctly
6925 represent a boolean.
6926 ***************************************************************************/
6928 bool lp_invert_boolean(const char *str
, const char **inverse_str
)
6932 if (!set_boolean(str
, &val
)) {
6936 *inverse_str
= get_boolean(!val
);
6940 /***************************************************************************
6941 Provide the canonical string representation of a boolean value given
6942 as a string. Return True on success, False if the string given does
6943 not correctly represent a boolean.
6944 ***************************************************************************/
6946 bool lp_canonicalize_boolean(const char *str
, const char**canon_str
)
6950 if (!set_boolean(str
, &val
)) {
6954 *canon_str
= get_boolean(val
);
6958 /***************************************************************************
6959 Find a service by name. Otherwise works like get_service.
6960 ***************************************************************************/
6962 static int getservicebyname(const char *pszServiceName
, struct service
*pserviceDest
)
6968 if (ServiceHash
== NULL
) {
6972 canon_name
= canonicalize_servicename(talloc_tos(), pszServiceName
);
6974 data
= dbwrap_fetch_bystring(ServiceHash
, canon_name
, canon_name
);
6976 if ((data
.dptr
!= NULL
) && (data
.dsize
== sizeof(iService
))) {
6977 iService
= *(int *)data
.dptr
;
6980 TALLOC_FREE(canon_name
);
6982 if ((iService
!= -1) && (LP_SNUM_OK(iService
))
6983 && (pserviceDest
!= NULL
)) {
6984 copy_service(pserviceDest
, ServicePtrs
[iService
], NULL
);
6990 /***************************************************************************
6991 Copy a service structure to another.
6992 If pcopymapDest is NULL then copy all fields
6993 ***************************************************************************/
6996 * Add a parametric option to a param_opt_struct,
6997 * replacing old value, if already present.
6999 static void set_param_opt(struct param_opt_struct
**opt_list
,
7000 const char *opt_name
,
7001 const char *opt_value
,
7004 struct param_opt_struct
*new_opt
, *opt
;
7007 if (opt_list
== NULL
) {
7014 /* Traverse destination */
7016 /* If we already have same option, override it */
7017 if (strwicmp(opt
->key
, opt_name
) == 0) {
7018 if ((opt
->flags
& FLAG_CMDLINE
) &&
7019 !(flags
& FLAG_CMDLINE
)) {
7020 /* it's been marked as not to be
7024 string_free(&opt
->value
);
7025 TALLOC_FREE(opt
->list
);
7026 opt
->value
= SMB_STRDUP(opt_value
);
7034 new_opt
= SMB_XMALLOC_P(struct param_opt_struct
);
7035 new_opt
->key
= SMB_STRDUP(opt_name
);
7036 new_opt
->value
= SMB_STRDUP(opt_value
);
7037 new_opt
->list
= NULL
;
7038 new_opt
->flags
= flags
;
7039 DLIST_ADD(*opt_list
, new_opt
);
7043 static void copy_service(struct service
*pserviceDest
, struct service
*pserviceSource
,
7044 struct bitmap
*pcopymapDest
)
7047 bool bcopyall
= (pcopymapDest
== NULL
);
7048 struct param_opt_struct
*data
;
7050 for (i
= 0; parm_table
[i
].label
; i
++)
7051 if (parm_table
[i
].ptr
&& parm_table
[i
].p_class
== P_LOCAL
&&
7052 (bcopyall
|| bitmap_query(pcopymapDest
,i
))) {
7053 void *def_ptr
= parm_table
[i
].ptr
;
7055 ((char *)pserviceSource
) + PTR_DIFF(def_ptr
,
7058 ((char *)pserviceDest
) + PTR_DIFF(def_ptr
,
7061 switch (parm_table
[i
].type
) {
7064 *(bool *)dest_ptr
= *(bool *)src_ptr
;
7070 *(int *)dest_ptr
= *(int *)src_ptr
;
7074 *(char *)dest_ptr
= *(char *)src_ptr
;
7078 string_set((char **)dest_ptr
,
7083 string_set((char **)dest_ptr
,
7085 strupper_m(*(char **)dest_ptr
);
7088 TALLOC_FREE(*((char ***)dest_ptr
));
7089 *((char ***)dest_ptr
) = str_list_copy(NULL
,
7090 *(const char ***)src_ptr
);
7098 init_copymap(pserviceDest
);
7099 if (pserviceSource
->copymap
)
7100 bitmap_copy(pserviceDest
->copymap
,
7101 pserviceSource
->copymap
);
7104 data
= pserviceSource
->param_opt
;
7106 set_param_opt(&pserviceDest
->param_opt
, data
->key
, data
->value
, data
->flags
);
7111 /***************************************************************************
7112 Check a service for consistency. Return False if the service is in any way
7113 incomplete or faulty, else True.
7114 ***************************************************************************/
7116 bool service_ok(int iService
)
7121 if (ServicePtrs
[iService
]->szService
[0] == '\0') {
7122 DEBUG(0, ("The following message indicates an internal error:\n"));
7123 DEBUG(0, ("No service name in service entry.\n"));
7127 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
7128 /* I can't see why you'd want a non-printable printer service... */
7129 if (strwicmp(ServicePtrs
[iService
]->szService
, PRINTERS_NAME
) == 0) {
7130 if (!ServicePtrs
[iService
]->bPrint_ok
) {
7131 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
7132 ServicePtrs
[iService
]->szService
));
7133 ServicePtrs
[iService
]->bPrint_ok
= True
;
7135 /* [printers] service must also be non-browsable. */
7136 if (ServicePtrs
[iService
]->bBrowseable
)
7137 ServicePtrs
[iService
]->bBrowseable
= False
;
7140 if (ServicePtrs
[iService
]->szPath
[0] == '\0' &&
7141 strwicmp(ServicePtrs
[iService
]->szService
, HOMES_NAME
) != 0 &&
7142 ServicePtrs
[iService
]->szMSDfsProxy
[0] == '\0'
7144 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
7145 ServicePtrs
[iService
]->szService
));
7146 ServicePtrs
[iService
]->bAvailable
= False
;
7149 /* If a service is flagged unavailable, log the fact at level 1. */
7150 if (!ServicePtrs
[iService
]->bAvailable
)
7151 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
7152 ServicePtrs
[iService
]->szService
));
7157 static struct smbconf_ctx
*lp_smbconf_ctx(void)
7160 static struct smbconf_ctx
*conf_ctx
= NULL
;
7162 if (conf_ctx
== NULL
) {
7163 werr
= smbconf_init(NULL
, &conf_ctx
, "registry:");
7164 if (!W_ERROR_IS_OK(werr
)) {
7165 DEBUG(1, ("error initializing registry configuration: "
7166 "%s\n", win_errstr(werr
)));
7174 static bool process_smbconf_service(struct smbconf_service
*service
)
7179 if (service
== NULL
) {
7183 ret
= do_section(service
->name
, NULL
);
7187 for (count
= 0; count
< service
->num_params
; count
++) {
7188 ret
= do_parameter(service
->param_names
[count
],
7189 service
->param_values
[count
],
7195 if (iServiceIndex
>= 0) {
7196 return service_ok(iServiceIndex
);
7202 * load a service from registry and activate it
7204 bool process_registry_service(const char *service_name
)
7207 struct smbconf_service
*service
= NULL
;
7208 TALLOC_CTX
*mem_ctx
= talloc_stackframe();
7209 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
7212 if (conf_ctx
== NULL
) {
7216 DEBUG(5, ("process_registry_service: service name %s\n", service_name
));
7218 if (!smbconf_share_exists(conf_ctx
, service_name
)) {
7220 * Registry does not contain data for this service (yet),
7221 * but make sure lp_load doesn't return false.
7227 werr
= smbconf_get_share(conf_ctx
, mem_ctx
, service_name
, &service
);
7228 if (!W_ERROR_IS_OK(werr
)) {
7232 ret
= process_smbconf_service(service
);
7238 smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
, NULL
);
7241 TALLOC_FREE(mem_ctx
);
7246 * process_registry_globals
7248 static bool process_registry_globals(void)
7252 add_to_file_list(INCLUDE_REGISTRY_NAME
, INCLUDE_REGISTRY_NAME
);
7254 ret
= do_parameter("registry shares", "yes", NULL
);
7259 return process_registry_service(GLOBAL_NAME
);
7262 bool process_registry_shares(void)
7266 struct smbconf_service
**service
= NULL
;
7267 uint32_t num_shares
= 0;
7268 TALLOC_CTX
*mem_ctx
= talloc_stackframe();
7269 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
7272 if (conf_ctx
== NULL
) {
7276 werr
= smbconf_get_config(conf_ctx
, mem_ctx
, &num_shares
, &service
);
7277 if (!W_ERROR_IS_OK(werr
)) {
7283 for (count
= 0; count
< num_shares
; count
++) {
7284 if (strequal(service
[count
]->name
, GLOBAL_NAME
)) {
7287 ret
= process_smbconf_service(service
[count
]);
7294 smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
, NULL
);
7297 TALLOC_FREE(mem_ctx
);
7301 #define MAX_INCLUDE_DEPTH 100
7303 static uint8_t include_depth
;
7305 static struct file_lists
{
7306 struct file_lists
*next
;
7310 } *file_lists
= NULL
;
7312 /*******************************************************************
7313 Keep a linked list of all config files so we know when one has changed
7314 it's date and needs to be reloaded.
7315 ********************************************************************/
7317 static void add_to_file_list(const char *fname
, const char *subfname
)
7319 struct file_lists
*f
= file_lists
;
7322 if (f
->name
&& !strcmp(f
->name
, fname
))
7328 f
= SMB_MALLOC_P(struct file_lists
);
7331 f
->next
= file_lists
;
7332 f
->name
= SMB_STRDUP(fname
);
7337 f
->subfname
= SMB_STRDUP(subfname
);
7344 f
->modtime
= file_modtime(subfname
);
7346 time_t t
= file_modtime(subfname
);
7354 * Free the file lists
7356 static void free_file_list(void)
7358 struct file_lists
*f
;
7359 struct file_lists
*next
;
7364 SAFE_FREE( f
->name
);
7365 SAFE_FREE( f
->subfname
);
7374 * Utility function for outsiders to check if we're running on registry.
7376 bool lp_config_backend_is_registry(void)
7378 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY
);
7382 * Utility function to check if the config backend is FILE.
7384 bool lp_config_backend_is_file(void)
7386 return (lp_config_backend() == CONFIG_BACKEND_FILE
);
7389 /*******************************************************************
7390 Check if a config file has changed date.
7391 ********************************************************************/
7393 bool lp_file_list_changed(void)
7395 struct file_lists
*f
= file_lists
;
7397 DEBUG(6, ("lp_file_list_changed()\n"));
7402 if (strequal(f
->name
, INCLUDE_REGISTRY_NAME
)) {
7403 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
7405 if (conf_ctx
== NULL
) {
7408 if (smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
,
7411 DEBUGADD(6, ("registry config changed\n"));
7416 n2
= talloc_sub_basic(talloc_tos(),
7417 get_current_username(),
7418 current_user_info
.domain
,
7423 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
7424 f
->name
, n2
, ctime(&f
->modtime
)));
7426 mod_time
= file_modtime(n2
);
7429 ((f
->modtime
!= mod_time
) ||
7430 (f
->subfname
== NULL
) ||
7431 (strcmp(n2
, f
->subfname
) != 0)))
7434 ("file %s modified: %s\n", n2
,
7436 f
->modtime
= mod_time
;
7437 SAFE_FREE(f
->subfname
);
7438 f
->subfname
= SMB_STRDUP(n2
);
7450 /***************************************************************************
7451 Run standard_sub_basic on netbios name... needed because global_myname
7452 is not accessed through any lp_ macro.
7453 Note: We must *NOT* use string_set() here as ptr points to global_myname.
7454 ***************************************************************************/
7456 static bool handle_netbios_name(int snum
, const char *pszParmValue
, char **ptr
)
7459 char *netbios_name
= talloc_sub_basic(
7460 talloc_tos(), get_current_username(), current_user_info
.domain
,
7463 ret
= set_global_myname(netbios_name
);
7464 TALLOC_FREE(netbios_name
);
7465 string_set(&Globals
.szNetbiosName
,global_myname());
7467 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
7473 static bool handle_charset(int snum
, const char *pszParmValue
, char **ptr
)
7475 if (strcmp(*ptr
, pszParmValue
) != 0) {
7476 string_set(ptr
, pszParmValue
);
7484 static bool handle_workgroup(int snum
, const char *pszParmValue
, char **ptr
)
7488 ret
= set_global_myworkgroup(pszParmValue
);
7489 string_set(&Globals
.szWorkgroup
,lp_workgroup());
7494 static bool handle_netbios_scope(int snum
, const char *pszParmValue
, char **ptr
)
7498 ret
= set_global_scope(pszParmValue
);
7499 string_set(&Globals
.szNetbiosScope
,global_scope());
7504 static bool handle_netbios_aliases(int snum
, const char *pszParmValue
, char **ptr
)
7506 TALLOC_FREE(Globals
.szNetbiosAliases
);
7507 Globals
.szNetbiosAliases
= str_list_make_v3(NULL
, pszParmValue
, NULL
);
7508 return set_netbios_aliases((const char **)Globals
.szNetbiosAliases
);
7511 /***************************************************************************
7512 Handle the include operation.
7513 ***************************************************************************/
7514 static bool bAllowIncludeRegistry
= true;
7516 static bool handle_include(int snum
, const char *pszParmValue
, char **ptr
)
7520 if (include_depth
>= MAX_INCLUDE_DEPTH
) {
7521 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7526 if (strequal(pszParmValue
, INCLUDE_REGISTRY_NAME
)) {
7527 if (!bAllowIncludeRegistry
) {
7530 if (bInGlobalSection
) {
7533 ret
= process_registry_globals();
7537 DEBUG(1, ("\"include = registry\" only effective "
7538 "in %s section\n", GLOBAL_NAME
));
7543 fname
= talloc_sub_basic(talloc_tos(), get_current_username(),
7544 current_user_info
.domain
,
7547 add_to_file_list(pszParmValue
, fname
);
7549 string_set(ptr
, fname
);
7551 if (file_exist(fname
)) {
7554 ret
= pm_process(fname
, do_section
, do_parameter
, NULL
);
7560 DEBUG(2, ("Can't find include file %s\n", fname
));
7565 /***************************************************************************
7566 Handle the interpretation of the copy parameter.
7567 ***************************************************************************/
7569 static bool handle_copy(int snum
, const char *pszParmValue
, char **ptr
)
7573 struct service serviceTemp
;
7575 string_set(ptr
, pszParmValue
);
7577 init_service(&serviceTemp
);
7581 DEBUG(3, ("Copying service from service %s\n", pszParmValue
));
7583 if ((iTemp
= getservicebyname(pszParmValue
, &serviceTemp
)) >= 0) {
7584 if (iTemp
== iServiceIndex
) {
7585 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue
));
7587 copy_service(ServicePtrs
[iServiceIndex
],
7589 ServicePtrs
[iServiceIndex
]->copymap
);
7593 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue
));
7597 free_service(&serviceTemp
);
7601 static bool handle_ldap_debug_level(int snum
, const char *pszParmValue
, char **ptr
)
7603 Globals
.ldap_debug_level
= lp_int(pszParmValue
);
7604 init_ldap_debugging();
7608 /***************************************************************************
7609 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7614 idmap uid = 1000-1999
7617 We only do simple parsing checks here. The strings are parsed into useful
7618 structures in the idmap daemon code.
7620 ***************************************************************************/
7622 /* Some lp_ routines to return idmap [ug]id information */
7624 static uid_t idmap_uid_low
, idmap_uid_high
;
7625 static gid_t idmap_gid_low
, idmap_gid_high
;
7627 bool lp_idmap_uid(uid_t
*low
, uid_t
*high
)
7629 if (idmap_uid_low
== 0 || idmap_uid_high
== 0)
7633 *low
= idmap_uid_low
;
7636 *high
= idmap_uid_high
;
7641 bool lp_idmap_gid(gid_t
*low
, gid_t
*high
)
7643 if (idmap_gid_low
== 0 || idmap_gid_high
== 0)
7647 *low
= idmap_gid_low
;
7650 *high
= idmap_gid_high
;
7655 /* Do some simple checks on "idmap [ug]id" parameter values */
7657 static bool handle_idmap_uid(int snum
, const char *pszParmValue
, char **ptr
)
7661 if (sscanf(pszParmValue
, "%u - %u", &low
, &high
) != 2 || high
< low
)
7666 string_set(ptr
, pszParmValue
);
7668 idmap_uid_low
= low
;
7669 idmap_uid_high
= high
;
7674 static bool handle_idmap_gid(int snum
, const char *pszParmValue
, char **ptr
)
7678 if (sscanf(pszParmValue
, "%u - %u", &low
, &high
) != 2 || high
< low
)
7683 string_set(ptr
, pszParmValue
);
7685 idmap_gid_low
= low
;
7686 idmap_gid_high
= high
;
7691 /***************************************************************************
7692 Handle the DEBUG level list.
7693 ***************************************************************************/
7695 static bool handle_debug_list( int snum
, const char *pszParmValueIn
, char **ptr
)
7697 string_set(ptr
, pszParmValueIn
);
7698 return debug_parse_levels(pszParmValueIn
);
7701 /***************************************************************************
7702 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7703 ***************************************************************************/
7705 static const char *append_ldap_suffix( const char *str
)
7707 const char *suffix_string
;
7710 suffix_string
= talloc_asprintf(talloc_tos(), "%s,%s", str
,
7711 Globals
.szLdapSuffix
);
7712 if ( !suffix_string
) {
7713 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7717 return suffix_string
;
7720 const char *lp_ldap_machine_suffix(void)
7722 if (Globals
.szLdapMachineSuffix
[0])
7723 return append_ldap_suffix(Globals
.szLdapMachineSuffix
);
7725 return lp_string(Globals
.szLdapSuffix
);
7728 const char *lp_ldap_user_suffix(void)
7730 if (Globals
.szLdapUserSuffix
[0])
7731 return append_ldap_suffix(Globals
.szLdapUserSuffix
);
7733 return lp_string(Globals
.szLdapSuffix
);
7736 const char *lp_ldap_group_suffix(void)
7738 if (Globals
.szLdapGroupSuffix
[0])
7739 return append_ldap_suffix(Globals
.szLdapGroupSuffix
);
7741 return lp_string(Globals
.szLdapSuffix
);
7744 const char *lp_ldap_idmap_suffix(void)
7746 if (Globals
.szLdapIdmapSuffix
[0])
7747 return append_ldap_suffix(Globals
.szLdapIdmapSuffix
);
7749 return lp_string(Globals
.szLdapSuffix
);
7752 /****************************************************************************
7753 set the value for a P_ENUM
7754 ***************************************************************************/
7756 static void lp_set_enum_parm( struct parm_struct
*parm
, const char *pszParmValue
,
7761 for (i
= 0; parm
->enum_list
[i
].name
; i
++) {
7762 if ( strequal(pszParmValue
, parm
->enum_list
[i
].name
)) {
7763 *ptr
= parm
->enum_list
[i
].value
;
7767 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7768 pszParmValue
, parm
->label
));
7771 /***************************************************************************
7772 ***************************************************************************/
7774 static bool handle_printing(int snum
, const char *pszParmValue
, char **ptr
)
7776 static int parm_num
= -1;
7779 if ( parm_num
== -1 )
7780 parm_num
= map_parameter( "printing" );
7782 lp_set_enum_parm( &parm_table
[parm_num
], pszParmValue
, (int*)ptr
);
7787 s
= ServicePtrs
[snum
];
7789 init_printer_values( s
);
7795 /***************************************************************************
7796 Initialise a copymap.
7797 ***************************************************************************/
7799 static void init_copymap(struct service
*pservice
)
7803 TALLOC_FREE(pservice
->copymap
);
7805 pservice
->copymap
= bitmap_talloc(NULL
, NUMPARAMETERS
);
7806 if (!pservice
->copymap
)
7808 ("Couldn't allocate copymap!! (size %d)\n",
7809 (int)NUMPARAMETERS
));
7811 for (i
= 0; i
< NUMPARAMETERS
; i
++)
7812 bitmap_set(pservice
->copymap
, i
);
7815 /***************************************************************************
7816 Return the local pointer to a parameter given a service struct and the
7817 pointer into the default structure.
7818 ***************************************************************************/
7820 static void *lp_local_ptr(struct service
*service
, void *ptr
)
7822 return (void *)(((char *)service
) + PTR_DIFF(ptr
, &sDefault
));
7825 /***************************************************************************
7826 Return the local pointer to a parameter given the service number and the
7827 pointer into the default structure.
7828 ***************************************************************************/
7830 void *lp_local_ptr_by_snum(int snum
, void *ptr
)
7832 return lp_local_ptr(ServicePtrs
[snum
], ptr
);
7835 /***************************************************************************
7836 Process a parameter for a particular service number. If snum < 0
7837 then assume we are in the globals.
7838 ***************************************************************************/
7840 bool lp_do_parameter(int snum
, const char *pszParmName
, const char *pszParmValue
)
7843 void *parm_ptr
= NULL
; /* where we are going to store the result */
7844 void *def_ptr
= NULL
;
7845 struct param_opt_struct
**opt_list
;
7847 parmnum
= map_parameter(pszParmName
);
7850 if (strchr(pszParmName
, ':') == NULL
) {
7851 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7857 * We've got a parametric option
7860 opt_list
= (snum
< 0)
7861 ? &Globals
.param_opt
: &ServicePtrs
[snum
]->param_opt
;
7862 set_param_opt(opt_list
, pszParmName
, pszParmValue
, 0);
7867 /* if it's already been set by the command line, then we don't
7869 if (parm_table
[parmnum
].flags
& FLAG_CMDLINE
) {
7873 if (parm_table
[parmnum
].flags
& FLAG_DEPRECATED
) {
7874 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7878 def_ptr
= parm_table
[parmnum
].ptr
;
7880 /* we might point at a service, the default service or a global */
7884 if (parm_table
[parmnum
].p_class
== P_GLOBAL
) {
7886 ("Global parameter %s found in service section!\n",
7890 parm_ptr
= lp_local_ptr_by_snum(snum
, def_ptr
);
7894 if (!ServicePtrs
[snum
]->copymap
)
7895 init_copymap(ServicePtrs
[snum
]);
7897 /* this handles the aliases - set the copymap for other entries with
7898 the same data pointer */
7899 for (i
= 0; parm_table
[i
].label
; i
++)
7900 if (parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
)
7901 bitmap_clear(ServicePtrs
[snum
]->copymap
, i
);
7904 /* if it is a special case then go ahead */
7905 if (parm_table
[parmnum
].special
) {
7906 return parm_table
[parmnum
].special(snum
, pszParmValue
,
7910 /* now switch on the type of variable it is */
7911 switch (parm_table
[parmnum
].type
)
7914 *(bool *)parm_ptr
= lp_bool(pszParmValue
);
7918 *(bool *)parm_ptr
= !lp_bool(pszParmValue
);
7922 *(int *)parm_ptr
= lp_int(pszParmValue
);
7926 *(char *)parm_ptr
= *pszParmValue
;
7930 i
= sscanf(pszParmValue
, "%o", (int *)parm_ptr
);
7932 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName
));
7937 TALLOC_FREE(*((char ***)parm_ptr
));
7938 *(char ***)parm_ptr
= str_list_make_v3(
7939 NULL
, pszParmValue
, NULL
);
7943 string_set((char **)parm_ptr
, pszParmValue
);
7947 string_set((char **)parm_ptr
, pszParmValue
);
7948 strupper_m(*(char **)parm_ptr
);
7952 lp_set_enum_parm( &parm_table
[parmnum
], pszParmValue
, (int*)parm_ptr
);
7961 /***************************************************************************
7962 set a parameter, marking it with FLAG_CMDLINE. Parameters marked as
7963 FLAG_CMDLINE won't be overridden by loads from smb.conf.
7964 ***************************************************************************/
7966 static bool lp_set_cmdline_helper(const char *pszParmName
, const char *pszParmValue
, bool store_values
)
7969 parmnum
= map_parameter(pszParmName
);
7971 parm_table
[parmnum
].flags
&= ~FLAG_CMDLINE
;
7972 if (!lp_do_parameter(-1, pszParmName
, pszParmValue
)) {
7975 parm_table
[parmnum
].flags
|= FLAG_CMDLINE
;
7977 /* we have to also set FLAG_CMDLINE on aliases. Aliases must
7978 * be grouped in the table, so we don't have to search the
7980 for (i
=parmnum
-1;i
>=0 && parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
;i
--) {
7981 parm_table
[i
].flags
|= FLAG_CMDLINE
;
7983 for (i
=parmnum
+1;i
<NUMPARAMETERS
&& parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
;i
++) {
7984 parm_table
[i
].flags
|= FLAG_CMDLINE
;
7988 store_lp_set_cmdline(pszParmName
, pszParmValue
);
7993 /* it might be parametric */
7994 if (strchr(pszParmName
, ':') != NULL
) {
7995 set_param_opt(&Globals
.param_opt
, pszParmName
, pszParmValue
, FLAG_CMDLINE
);
7997 store_lp_set_cmdline(pszParmName
, pszParmValue
);
8002 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName
));
8006 bool lp_set_cmdline(const char *pszParmName
, const char *pszParmValue
)
8008 return lp_set_cmdline_helper(pszParmName
, pszParmValue
, true);
8011 /***************************************************************************
8012 Process a parameter.
8013 ***************************************************************************/
8015 static bool do_parameter(const char *pszParmName
, const char *pszParmValue
,
8018 if (!bInGlobalSection
&& bGlobalOnly
)
8021 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName
, pszParmValue
));
8023 return (lp_do_parameter(bInGlobalSection
? -2 : iServiceIndex
,
8024 pszParmName
, pszParmValue
));
8028 set a option from the commandline in 'a=b' format. Use to support --option
8030 bool lp_set_option(const char *option
)
8035 s
= talloc_strdup(NULL
, option
);
8048 /* skip white spaces after the = sign */
8051 } while (*p
== ' ');
8053 ret
= lp_set_cmdline(s
, p
);
8058 /**************************************************************************
8059 Print a parameter of the specified type.
8060 ***************************************************************************/
8062 static void print_parameter(struct parm_struct
*p
, void *ptr
, FILE * f
)
8068 for (i
= 0; p
->enum_list
[i
].name
; i
++) {
8069 if (*(int *)ptr
== p
->enum_list
[i
].value
) {
8071 p
->enum_list
[i
].name
);
8078 fprintf(f
, "%s", BOOLSTR(*(bool *)ptr
));
8082 fprintf(f
, "%s", BOOLSTR(!*(bool *)ptr
));
8086 fprintf(f
, "%d", *(int *)ptr
);
8090 fprintf(f
, "%c", *(char *)ptr
);
8094 char *o
= octal_string(*(int *)ptr
);
8095 fprintf(f
, "%s", o
);
8101 if ((char ***)ptr
&& *(char ***)ptr
) {
8102 char **list
= *(char ***)ptr
;
8103 for (; *list
; list
++) {
8104 /* surround strings with whitespace in double quotes */
8105 if ( strchr_m( *list
, ' ' ) )
8106 fprintf(f
, "\"%s\"%s", *list
, ((*(list
+1))?", ":""));
8108 fprintf(f
, "%s%s", *list
, ((*(list
+1))?", ":""));
8115 if (*(char **)ptr
) {
8116 fprintf(f
, "%s", *(char **)ptr
);
8124 /***************************************************************************
8125 Check if two parameters are equal.
8126 ***************************************************************************/
8128 static bool equal_parameter(parm_type type
, void *ptr1
, void *ptr2
)
8133 return (*((bool *)ptr1
) == *((bool *)ptr2
));
8138 return (*((int *)ptr1
) == *((int *)ptr2
));
8141 return (*((char *)ptr1
) == *((char *)ptr2
));
8144 return str_list_equal(*(const char ***)ptr1
, *(const char ***)ptr2
);
8149 char *p1
= *(char **)ptr1
, *p2
= *(char **)ptr2
;
8154 return (p1
== p2
|| strequal(p1
, p2
));
8162 /***************************************************************************
8163 Initialize any local varients in the sDefault table.
8164 ***************************************************************************/
8166 void init_locals(void)
8171 /***************************************************************************
8172 Process a new section (service). At this stage all sections are services.
8173 Later we'll have special sections that permit server parameters to be set.
8174 Returns True on success, False on failure.
8175 ***************************************************************************/
8177 static bool do_section(const char *pszSectionName
, void *userdata
)
8180 bool isglobal
= ((strwicmp(pszSectionName
, GLOBAL_NAME
) == 0) ||
8181 (strwicmp(pszSectionName
, GLOBAL_NAME2
) == 0));
8184 /* if we were in a global section then do the local inits */
8185 if (bInGlobalSection
&& !isglobal
)
8188 /* if we've just struck a global section, note the fact. */
8189 bInGlobalSection
= isglobal
;
8191 /* check for multiple global sections */
8192 if (bInGlobalSection
) {
8193 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName
));
8197 if (!bInGlobalSection
&& bGlobalOnly
)
8200 /* if we have a current service, tidy it up before moving on */
8203 if (iServiceIndex
>= 0)
8204 bRetval
= service_ok(iServiceIndex
);
8206 /* if all is still well, move to the next record in the services array */
8208 /* We put this here to avoid an odd message order if messages are */
8209 /* issued by the post-processing of a previous section. */
8210 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName
));
8212 if ((iServiceIndex
= add_a_service(&sDefault
, pszSectionName
))
8214 DEBUG(0, ("Failed to add a new service\n"));
8217 /* Clean all parametric options for service */
8218 /* They will be added during parsing again */
8219 free_param_opts(&ServicePtrs
[iServiceIndex
]->param_opt
);
8226 /***************************************************************************
8227 Determine if a partcular base parameter is currentl set to the default value.
8228 ***************************************************************************/
8230 static bool is_default(int i
)
8232 if (!defaults_saved
)
8234 switch (parm_table
[i
].type
) {
8236 return str_list_equal((const char **)parm_table
[i
].def
.lvalue
,
8237 *(const char ***)parm_table
[i
].ptr
);
8240 return strequal(parm_table
[i
].def
.svalue
,
8241 *(char **)parm_table
[i
].ptr
);
8244 return parm_table
[i
].def
.bvalue
==
8245 *(bool *)parm_table
[i
].ptr
;
8247 return parm_table
[i
].def
.cvalue
==
8248 *(char *)parm_table
[i
].ptr
;
8252 return parm_table
[i
].def
.ivalue
==
8253 *(int *)parm_table
[i
].ptr
;
8260 /***************************************************************************
8261 Display the contents of the global structure.
8262 ***************************************************************************/
8264 static void dump_globals(FILE *f
)
8267 struct param_opt_struct
*data
;
8269 fprintf(f
, "[global]\n");
8271 for (i
= 0; parm_table
[i
].label
; i
++)
8272 if (parm_table
[i
].p_class
== P_GLOBAL
&&
8273 !(parm_table
[i
].flags
& FLAG_META
) &&
8274 parm_table
[i
].ptr
&&
8275 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
))) {
8276 if (defaults_saved
&& is_default(i
))
8278 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
8279 print_parameter(&parm_table
[i
], parm_table
[i
].ptr
, f
);
8282 if (Globals
.param_opt
!= NULL
) {
8283 data
= Globals
.param_opt
;
8285 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
8292 /***************************************************************************
8293 Return True if a local parameter is currently set to the global default.
8294 ***************************************************************************/
8296 bool lp_is_default(int snum
, struct parm_struct
*parm
)
8298 int pdiff
= PTR_DIFF(parm
->ptr
, &sDefault
);
8300 return equal_parameter(parm
->type
,
8301 ((char *)ServicePtrs
[snum
]) + pdiff
,
8302 ((char *)&sDefault
) + pdiff
);
8305 /***************************************************************************
8306 Display the contents of a single services record.
8307 ***************************************************************************/
8309 static void dump_a_service(struct service
*pService
, FILE * f
)
8312 struct param_opt_struct
*data
;
8314 if (pService
!= &sDefault
)
8315 fprintf(f
, "[%s]\n", pService
->szService
);
8317 for (i
= 0; parm_table
[i
].label
; i
++) {
8319 if (parm_table
[i
].p_class
== P_LOCAL
&&
8320 !(parm_table
[i
].flags
& FLAG_META
) &&
8321 parm_table
[i
].ptr
&&
8322 (*parm_table
[i
].label
!= '-') &&
8323 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
8325 int pdiff
= PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
8327 if (pService
== &sDefault
) {
8328 if (defaults_saved
&& is_default(i
))
8331 if (equal_parameter(parm_table
[i
].type
,
8332 ((char *)pService
) +
8334 ((char *)&sDefault
) +
8339 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
8340 print_parameter(&parm_table
[i
],
8341 ((char *)pService
) + pdiff
, f
);
8346 if (pService
->param_opt
!= NULL
) {
8347 data
= pService
->param_opt
;
8349 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
8355 /***************************************************************************
8356 Display the contents of a parameter of a single services record.
8357 ***************************************************************************/
8359 bool dump_a_parameter(int snum
, char *parm_name
, FILE * f
, bool isGlobal
)
8362 bool result
= False
;
8365 fstring local_parm_name
;
8367 const char *parm_opt_value
;
8369 /* check for parametrical option */
8370 fstrcpy( local_parm_name
, parm_name
);
8371 parm_opt
= strchr( local_parm_name
, ':');
8376 if (strlen(parm_opt
)) {
8377 parm_opt_value
= lp_parm_const_string( snum
,
8378 local_parm_name
, parm_opt
, NULL
);
8379 if (parm_opt_value
) {
8380 printf( "%s\n", parm_opt_value
);
8387 /* check for a key and print the value */
8394 for (i
= 0; parm_table
[i
].label
; i
++) {
8395 if (strwicmp(parm_table
[i
].label
, parm_name
) == 0 &&
8396 !(parm_table
[i
].flags
& FLAG_META
) &&
8397 (parm_table
[i
].p_class
== p_class
|| parm_table
[i
].flags
& flag
) &&
8398 parm_table
[i
].ptr
&&
8399 (*parm_table
[i
].label
!= '-') &&
8400 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
8405 ptr
= parm_table
[i
].ptr
;
8407 struct service
*pService
= ServicePtrs
[snum
];
8408 ptr
= ((char *)pService
) +
8409 PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
8412 print_parameter(&parm_table
[i
],
8423 /***************************************************************************
8424 Return info about the requested parameter (given as a string).
8425 Return NULL when the string is not a valid parameter name.
8426 ***************************************************************************/
8428 struct parm_struct
*lp_get_parameter(const char *param_name
)
8430 int num
= map_parameter(param_name
);
8436 return &parm_table
[num
];
8439 /***************************************************************************
8440 Return info about the next parameter in a service.
8441 snum==GLOBAL_SECTION_SNUM gives the globals.
8442 Return NULL when out of parameters.
8443 ***************************************************************************/
8445 struct parm_struct
*lp_next_parameter(int snum
, int *i
, int allparameters
)
8448 /* do the globals */
8449 for (; parm_table
[*i
].label
; (*i
)++) {
8450 if (parm_table
[*i
].p_class
== P_SEPARATOR
)
8451 return &parm_table
[(*i
)++];
8453 if (!parm_table
[*i
].ptr
8454 || (*parm_table
[*i
].label
== '-'))
8458 && (parm_table
[*i
].ptr
==
8459 parm_table
[(*i
) - 1].ptr
))
8462 if (is_default(*i
) && !allparameters
)
8465 return &parm_table
[(*i
)++];
8468 struct service
*pService
= ServicePtrs
[snum
];
8470 for (; parm_table
[*i
].label
; (*i
)++) {
8471 if (parm_table
[*i
].p_class
== P_SEPARATOR
)
8472 return &parm_table
[(*i
)++];
8474 if (parm_table
[*i
].p_class
== P_LOCAL
&&
8475 parm_table
[*i
].ptr
&&
8476 (*parm_table
[*i
].label
!= '-') &&
8478 (parm_table
[*i
].ptr
!=
8479 parm_table
[(*i
) - 1].ptr
)))
8482 PTR_DIFF(parm_table
[*i
].ptr
,
8485 if (allparameters
||
8486 !equal_parameter(parm_table
[*i
].type
,
8487 ((char *)pService
) +
8489 ((char *)&sDefault
) +
8492 return &parm_table
[(*i
)++];
8503 /***************************************************************************
8504 Display the contents of a single copy structure.
8505 ***************************************************************************/
8506 static void dump_copy_map(bool *pcopymap
)
8512 printf("\n\tNon-Copied parameters:\n");
8514 for (i
= 0; parm_table
[i
].label
; i
++)
8515 if (parm_table
[i
].p_class
== P_LOCAL
&&
8516 parm_table
[i
].ptr
&& !pcopymap
[i
] &&
8517 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
8519 printf("\t\t%s\n", parm_table
[i
].label
);
8524 /***************************************************************************
8525 Return TRUE if the passed service number is within range.
8526 ***************************************************************************/
8528 bool lp_snum_ok(int iService
)
8530 return (LP_SNUM_OK(iService
) && ServicePtrs
[iService
]->bAvailable
);
8533 /***************************************************************************
8534 Auto-load some home services.
8535 ***************************************************************************/
8537 static void lp_add_auto_services(char *str
)
8547 s
= SMB_STRDUP(str
);
8551 homes
= lp_servicenumber(HOMES_NAME
);
8553 for (p
= strtok_r(s
, LIST_SEP
, &saveptr
); p
;
8554 p
= strtok_r(NULL
, LIST_SEP
, &saveptr
)) {
8557 if (lp_servicenumber(p
) >= 0)
8560 home
= get_user_home_dir(talloc_tos(), p
);
8562 if (home
&& home
[0] && homes
>= 0)
8563 lp_add_home(p
, homes
, p
, home
);
8570 /***************************************************************************
8571 Auto-load one printer.
8572 ***************************************************************************/
8574 void lp_add_one_printer(const char *name
, const char *comment
, void *pdata
)
8576 int printers
= lp_servicenumber(PRINTERS_NAME
);
8579 if (lp_servicenumber(name
) < 0) {
8580 lp_add_printer(name
, printers
);
8581 if ((i
= lp_servicenumber(name
)) >= 0) {
8582 string_set(&ServicePtrs
[i
]->comment
, comment
);
8583 ServicePtrs
[i
]->autoloaded
= True
;
8588 /***************************************************************************
8589 Have we loaded a services file yet?
8590 ***************************************************************************/
8592 bool lp_loaded(void)
8597 /***************************************************************************
8598 Unload unused services.
8599 ***************************************************************************/
8601 void lp_killunused(bool (*snumused
) (int))
8604 for (i
= 0; i
< iNumServices
; i
++) {
8608 /* don't kill autoloaded or usershare services */
8609 if ( ServicePtrs
[i
]->autoloaded
||
8610 ServicePtrs
[i
]->usershare
== USERSHARE_VALID
) {
8614 if (!snumused
|| !snumused(i
)) {
8615 free_service_byindex(i
);
8621 * Kill all except autoloaded and usershare services - convenience wrapper
8623 void lp_kill_all_services(void)
8625 lp_killunused(NULL
);
8628 /***************************************************************************
8630 ***************************************************************************/
8632 void lp_killservice(int iServiceIn
)
8634 if (VALID(iServiceIn
)) {
8635 free_service_byindex(iServiceIn
);
8639 /***************************************************************************
8640 Save the curent values of all global and sDefault parameters into the
8641 defaults union. This allows swat and testparm to show only the
8642 changed (ie. non-default) parameters.
8643 ***************************************************************************/
8645 static void lp_save_defaults(void)
8648 for (i
= 0; parm_table
[i
].label
; i
++) {
8649 if (i
> 0 && parm_table
[i
].ptr
== parm_table
[i
- 1].ptr
)
8651 switch (parm_table
[i
].type
) {
8653 parm_table
[i
].def
.lvalue
= str_list_copy(
8654 NULL
, *(const char ***)parm_table
[i
].ptr
);
8658 if (parm_table
[i
].ptr
) {
8659 parm_table
[i
].def
.svalue
= SMB_STRDUP(*(char **)parm_table
[i
].ptr
);
8661 parm_table
[i
].def
.svalue
= NULL
;
8666 parm_table
[i
].def
.bvalue
=
8667 *(bool *)parm_table
[i
].ptr
;
8670 parm_table
[i
].def
.cvalue
=
8671 *(char *)parm_table
[i
].ptr
;
8676 parm_table
[i
].def
.ivalue
=
8677 *(int *)parm_table
[i
].ptr
;
8683 defaults_saved
= True
;
8686 /***********************************************************
8687 If we should send plaintext/LANMAN passwords in the clinet
8688 ************************************************************/
8690 static void set_allowed_client_auth(void)
8692 if (Globals
.bClientNTLMv2Auth
) {
8693 Globals
.bClientLanManAuth
= False
;
8695 if (!Globals
.bClientLanManAuth
) {
8696 Globals
.bClientPlaintextAuth
= False
;
8700 /***************************************************************************
8702 The following code allows smbd to read a user defined share file.
8703 Yes, this is my intent. Yes, I'm comfortable with that...
8705 THE FOLLOWING IS SECURITY CRITICAL CODE.
8707 It washes your clothes, it cleans your house, it guards you while you sleep...
8708 Do not f%^k with it....
8709 ***************************************************************************/
8711 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8713 /***************************************************************************
8714 Check allowed stat state of a usershare file.
8715 Ensure we print out who is dicking with us so the admin can
8716 get their sorry ass fired.
8717 ***************************************************************************/
8719 static bool check_usershare_stat(const char *fname
,
8720 const SMB_STRUCT_STAT
*psbuf
)
8722 if (!S_ISREG(psbuf
->st_ex_mode
)) {
8723 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8724 "not a regular file\n",
8725 fname
, (unsigned int)psbuf
->st_ex_uid
));
8729 /* Ensure this doesn't have the other write bit set. */
8730 if (psbuf
->st_ex_mode
& S_IWOTH
) {
8731 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8732 "public write. Refusing to allow as a usershare file.\n",
8733 fname
, (unsigned int)psbuf
->st_ex_uid
));
8737 /* Should be 10k or less. */
8738 if (psbuf
->st_ex_size
> MAX_USERSHARE_FILE_SIZE
) {
8739 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8740 "too large (%u) to be a user share file.\n",
8741 fname
, (unsigned int)psbuf
->st_ex_uid
,
8742 (unsigned int)psbuf
->st_ex_size
));
8749 /***************************************************************************
8750 Parse the contents of a usershare file.
8751 ***************************************************************************/
8753 enum usershare_err
parse_usershare_file(TALLOC_CTX
*ctx
,
8754 SMB_STRUCT_STAT
*psbuf
,
8755 const char *servicename
,
8759 char **pp_sharepath
,
8761 char **pp_cp_servicename
,
8762 struct security_descriptor
**ppsd
,
8765 const char **prefixallowlist
= lp_usershare_prefix_allow_list();
8766 const char **prefixdenylist
= lp_usershare_prefix_deny_list();
8769 SMB_STRUCT_STAT sbuf
;
8770 char *sharepath
= NULL
;
8771 char *comment
= NULL
;
8773 *pp_sharepath
= NULL
;
8776 *pallow_guest
= False
;
8779 return USERSHARE_MALFORMED_FILE
;
8782 if (strcmp(lines
[0], "#VERSION 1") == 0) {
8784 } else if (strcmp(lines
[0], "#VERSION 2") == 0) {
8787 return USERSHARE_MALFORMED_FILE
;
8790 return USERSHARE_BAD_VERSION
;
8793 if (strncmp(lines
[1], "path=", 5) != 0) {
8794 return USERSHARE_MALFORMED_PATH
;
8797 sharepath
= talloc_strdup(ctx
, &lines
[1][5]);
8799 return USERSHARE_POSIX_ERR
;
8801 trim_string(sharepath
, " ", " ");
8803 if (strncmp(lines
[2], "comment=", 8) != 0) {
8804 return USERSHARE_MALFORMED_COMMENT_DEF
;
8807 comment
= talloc_strdup(ctx
, &lines
[2][8]);
8809 return USERSHARE_POSIX_ERR
;
8811 trim_string(comment
, " ", " ");
8812 trim_char(comment
, '"', '"');
8814 if (strncmp(lines
[3], "usershare_acl=", 14) != 0) {
8815 return USERSHARE_MALFORMED_ACL_DEF
;
8818 if (!parse_usershare_acl(ctx
, &lines
[3][14], ppsd
)) {
8819 return USERSHARE_ACL_ERR
;
8823 if (strncmp(lines
[4], "guest_ok=", 9) != 0) {
8824 return USERSHARE_MALFORMED_ACL_DEF
;
8826 if (lines
[4][9] == 'y') {
8827 *pallow_guest
= True
;
8830 /* Backwards compatible extension to file version #2. */
8832 if (strncmp(lines
[5], "sharename=", 10) != 0) {
8833 return USERSHARE_MALFORMED_SHARENAME_DEF
;
8835 if (!strequal(&lines
[5][10], servicename
)) {
8836 return USERSHARE_BAD_SHARENAME
;
8838 *pp_cp_servicename
= talloc_strdup(ctx
, &lines
[5][10]);
8839 if (!*pp_cp_servicename
) {
8840 return USERSHARE_POSIX_ERR
;
8845 if (*pp_cp_servicename
== NULL
) {
8846 *pp_cp_servicename
= talloc_strdup(ctx
, servicename
);
8847 if (!*pp_cp_servicename
) {
8848 return USERSHARE_POSIX_ERR
;
8852 if (snum
!= -1 && (strcmp(sharepath
, ServicePtrs
[snum
]->szPath
) == 0)) {
8853 /* Path didn't change, no checks needed. */
8854 *pp_sharepath
= sharepath
;
8855 *pp_comment
= comment
;
8856 return USERSHARE_OK
;
8859 /* The path *must* be absolute. */
8860 if (sharepath
[0] != '/') {
8861 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8862 servicename
, sharepath
));
8863 return USERSHARE_PATH_NOT_ABSOLUTE
;
8866 /* If there is a usershare prefix deny list ensure one of these paths
8867 doesn't match the start of the user given path. */
8868 if (prefixdenylist
) {
8870 for ( i
=0; prefixdenylist
[i
]; i
++ ) {
8871 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8872 servicename
, i
, prefixdenylist
[i
], sharepath
));
8873 if (memcmp( sharepath
, prefixdenylist
[i
], strlen(prefixdenylist
[i
])) == 0) {
8874 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8875 "usershare prefix deny list entries.\n",
8876 servicename
, sharepath
));
8877 return USERSHARE_PATH_IS_DENIED
;
8882 /* If there is a usershare prefix allow list ensure one of these paths
8883 does match the start of the user given path. */
8885 if (prefixallowlist
) {
8887 for ( i
=0; prefixallowlist
[i
]; i
++ ) {
8888 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8889 servicename
, i
, prefixallowlist
[i
], sharepath
));
8890 if (memcmp( sharepath
, prefixallowlist
[i
], strlen(prefixallowlist
[i
])) == 0) {
8894 if (prefixallowlist
[i
] == NULL
) {
8895 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8896 "usershare prefix allow list entries.\n",
8897 servicename
, sharepath
));
8898 return USERSHARE_PATH_NOT_ALLOWED
;
8902 /* Ensure this is pointing to a directory. */
8903 dp
= sys_opendir(sharepath
);
8906 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8907 servicename
, sharepath
));
8908 return USERSHARE_PATH_NOT_DIRECTORY
;
8911 /* Ensure the owner of the usershare file has permission to share
8914 if (sys_stat(sharepath
, &sbuf
, false) == -1) {
8915 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8916 servicename
, sharepath
, strerror(errno
) ));
8918 return USERSHARE_POSIX_ERR
;
8923 if (!S_ISDIR(sbuf
.st_ex_mode
)) {
8924 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8925 servicename
, sharepath
));
8926 return USERSHARE_PATH_NOT_DIRECTORY
;
8929 /* Check if sharing is restricted to owner-only. */
8930 /* psbuf is the stat of the usershare definition file,
8931 sbuf is the stat of the target directory to be shared. */
8933 if (lp_usershare_owner_only()) {
8934 /* root can share anything. */
8935 if ((psbuf
->st_ex_uid
!= 0) && (sbuf
.st_ex_uid
!= psbuf
->st_ex_uid
)) {
8936 return USERSHARE_PATH_NOT_ALLOWED
;
8940 *pp_sharepath
= sharepath
;
8941 *pp_comment
= comment
;
8942 return USERSHARE_OK
;
8945 /***************************************************************************
8946 Deal with a usershare file.
8949 -1 - Bad name, invalid contents.
8950 - service name already existed and not a usershare, problem
8951 with permissions to share directory etc.
8952 ***************************************************************************/
8954 static int process_usershare_file(const char *dir_name
, const char *file_name
, int snum_template
)
8956 SMB_STRUCT_STAT sbuf
;
8957 SMB_STRUCT_STAT lsbuf
;
8959 char *sharepath
= NULL
;
8960 char *comment
= NULL
;
8961 char *cp_service_name
= NULL
;
8962 char **lines
= NULL
;
8966 TALLOC_CTX
*ctx
= talloc_stackframe();
8967 struct security_descriptor
*psd
= NULL
;
8968 bool guest_ok
= False
;
8969 char *canon_name
= NULL
;
8970 bool added_service
= false;
8973 /* Ensure share name doesn't contain invalid characters. */
8974 if (!validate_net_name(file_name
, INVALID_SHARENAME_CHARS
, strlen(file_name
))) {
8975 DEBUG(0,("process_usershare_file: share name %s contains "
8976 "invalid characters (any of %s)\n",
8977 file_name
, INVALID_SHARENAME_CHARS
));
8981 canon_name
= canonicalize_servicename(ctx
, file_name
);
8986 fname
= talloc_asprintf(ctx
, "%s/%s", dir_name
, file_name
);
8991 /* Minimize the race condition by doing an lstat before we
8992 open and fstat. Ensure this isn't a symlink link. */
8994 if (sys_lstat(fname
, &lsbuf
, false) != 0) {
8995 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8996 fname
, strerror(errno
) ));
9000 /* This must be a regular file, not a symlink, directory or
9001 other strange filetype. */
9002 if (!check_usershare_stat(fname
, &lsbuf
)) {
9007 TDB_DATA data
= dbwrap_fetch_bystring(
9008 ServiceHash
, canon_name
, canon_name
);
9012 if ((data
.dptr
!= NULL
) && (data
.dsize
== sizeof(iService
))) {
9013 iService
= *(int *)data
.dptr
;
9017 if (iService
!= -1 &&
9018 timespec_compare(&ServicePtrs
[iService
]->usershare_last_mod
,
9019 &lsbuf
.st_ex_mtime
) == 0) {
9020 /* Nothing changed - Mark valid and return. */
9021 DEBUG(10,("process_usershare_file: service %s not changed.\n",
9023 ServicePtrs
[iService
]->usershare
= USERSHARE_VALID
;
9028 /* Try and open the file read only - no symlinks allowed. */
9030 fd
= sys_open(fname
, O_RDONLY
|O_NOFOLLOW
, 0);
9032 fd
= sys_open(fname
, O_RDONLY
, 0);
9036 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
9037 fname
, strerror(errno
) ));
9041 /* Now fstat to be *SURE* it's a regular file. */
9042 if (sys_fstat(fd
, &sbuf
, false) != 0) {
9044 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
9045 fname
, strerror(errno
) ));
9049 /* Is it the same dev/inode as was lstated ? */
9050 if (lsbuf
.st_ex_dev
!= sbuf
.st_ex_dev
|| lsbuf
.st_ex_ino
!= sbuf
.st_ex_ino
) {
9052 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
9053 "Symlink spoofing going on ?\n", fname
));
9057 /* This must be a regular file, not a symlink, directory or
9058 other strange filetype. */
9059 if (!check_usershare_stat(fname
, &sbuf
)) {
9063 lines
= fd_lines_load(fd
, &numlines
, MAX_USERSHARE_FILE_SIZE
, NULL
);
9066 if (lines
== NULL
) {
9067 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
9068 fname
, (unsigned int)sbuf
.st_ex_uid
));
9072 if (parse_usershare_file(ctx
, &sbuf
, file_name
,
9073 iService
, lines
, numlines
, &sharepath
,
9074 &comment
, &cp_service_name
,
9075 &psd
, &guest_ok
) != USERSHARE_OK
) {
9079 /* Everything ok - add the service possibly using a template. */
9081 const struct service
*sp
= &sDefault
;
9082 if (snum_template
!= -1) {
9083 sp
= ServicePtrs
[snum_template
];
9086 if ((iService
= add_a_service(sp
, cp_service_name
)) < 0) {
9087 DEBUG(0, ("process_usershare_file: Failed to add "
9088 "new service %s\n", cp_service_name
));
9092 added_service
= true;
9094 /* Read only is controlled by usershare ACL below. */
9095 ServicePtrs
[iService
]->bRead_only
= False
;
9098 /* Write the ACL of the new/modified share. */
9099 if (!set_share_security(canon_name
, psd
)) {
9100 DEBUG(0, ("process_usershare_file: Failed to set share "
9101 "security for user share %s\n",
9106 /* If from a template it may be marked invalid. */
9107 ServicePtrs
[iService
]->valid
= True
;
9109 /* Set the service as a valid usershare. */
9110 ServicePtrs
[iService
]->usershare
= USERSHARE_VALID
;
9112 /* Set guest access. */
9113 if (lp_usershare_allow_guests()) {
9114 ServicePtrs
[iService
]->bGuest_ok
= guest_ok
;
9117 /* And note when it was loaded. */
9118 ServicePtrs
[iService
]->usershare_last_mod
= sbuf
.st_ex_mtime
;
9119 string_set(&ServicePtrs
[iService
]->szPath
, sharepath
);
9120 string_set(&ServicePtrs
[iService
]->comment
, comment
);
9126 if (ret
== -1 && iService
!= -1 && added_service
) {
9127 lp_remove_service(iService
);
9135 /***************************************************************************
9136 Checks if a usershare entry has been modified since last load.
9137 ***************************************************************************/
9139 static bool usershare_exists(int iService
, struct timespec
*last_mod
)
9141 SMB_STRUCT_STAT lsbuf
;
9142 const char *usersharepath
= Globals
.szUsersharePath
;
9145 if (asprintf(&fname
, "%s/%s",
9147 ServicePtrs
[iService
]->szService
) < 0) {
9151 if (sys_lstat(fname
, &lsbuf
, false) != 0) {
9156 if (!S_ISREG(lsbuf
.st_ex_mode
)) {
9162 *last_mod
= lsbuf
.st_ex_mtime
;
9166 /***************************************************************************
9167 Load a usershare service by name. Returns a valid servicenumber or -1.
9168 ***************************************************************************/
9170 int load_usershare_service(const char *servicename
)
9172 SMB_STRUCT_STAT sbuf
;
9173 const char *usersharepath
= Globals
.szUsersharePath
;
9174 int max_user_shares
= Globals
.iUsershareMaxShares
;
9175 int snum_template
= -1;
9177 if (*usersharepath
== 0 || max_user_shares
== 0) {
9181 if (sys_stat(usersharepath
, &sbuf
, false) != 0) {
9182 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
9183 usersharepath
, strerror(errno
) ));
9187 if (!S_ISDIR(sbuf
.st_ex_mode
)) {
9188 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
9194 * This directory must be owned by root, and have the 't' bit set.
9195 * It also must not be writable by "other".
9199 if (sbuf
.st_ex_uid
!= 0 || !(sbuf
.st_ex_mode
& S_ISVTX
) || (sbuf
.st_ex_mode
& S_IWOTH
)) {
9201 if (sbuf
.st_ex_uid
!= 0 || (sbuf
.st_ex_mode
& S_IWOTH
)) {
9203 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
9204 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9209 /* Ensure the template share exists if it's set. */
9210 if (Globals
.szUsershareTemplateShare
[0]) {
9211 /* We can't use lp_servicenumber here as we are recommending that
9212 template shares have -valid=False set. */
9213 for (snum_template
= iNumServices
- 1; snum_template
>= 0; snum_template
--) {
9214 if (ServicePtrs
[snum_template
]->szService
&&
9215 strequal(ServicePtrs
[snum_template
]->szService
,
9216 Globals
.szUsershareTemplateShare
)) {
9221 if (snum_template
== -1) {
9222 DEBUG(0,("load_usershare_service: usershare template share %s "
9223 "does not exist.\n",
9224 Globals
.szUsershareTemplateShare
));
9229 return process_usershare_file(usersharepath
, servicename
, snum_template
);
9232 /***************************************************************************
9233 Load all user defined shares from the user share directory.
9234 We only do this if we're enumerating the share list.
9235 This is the function that can delete usershares that have
9237 ***************************************************************************/
9239 int load_usershare_shares(void)
9242 SMB_STRUCT_STAT sbuf
;
9243 SMB_STRUCT_DIRENT
*de
;
9244 int num_usershares
= 0;
9245 int max_user_shares
= Globals
.iUsershareMaxShares
;
9246 unsigned int num_dir_entries
, num_bad_dir_entries
, num_tmp_dir_entries
;
9247 unsigned int allowed_bad_entries
= ((2*max_user_shares
)/10);
9248 unsigned int allowed_tmp_entries
= ((2*max_user_shares
)/10);
9250 int snum_template
= -1;
9251 const char *usersharepath
= Globals
.szUsersharePath
;
9252 int ret
= lp_numservices();
9254 if (max_user_shares
== 0 || *usersharepath
== '\0') {
9255 return lp_numservices();
9258 if (sys_stat(usersharepath
, &sbuf
, false) != 0) {
9259 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
9260 usersharepath
, strerror(errno
) ));
9265 * This directory must be owned by root, and have the 't' bit set.
9266 * It also must not be writable by "other".
9270 if (sbuf
.st_ex_uid
!= 0 || !(sbuf
.st_ex_mode
& S_ISVTX
) || (sbuf
.st_ex_mode
& S_IWOTH
)) {
9272 if (sbuf
.st_ex_uid
!= 0 || (sbuf
.st_ex_mode
& S_IWOTH
)) {
9274 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
9275 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9280 /* Ensure the template share exists if it's set. */
9281 if (Globals
.szUsershareTemplateShare
[0]) {
9282 /* We can't use lp_servicenumber here as we are recommending that
9283 template shares have -valid=False set. */
9284 for (snum_template
= iNumServices
- 1; snum_template
>= 0; snum_template
--) {
9285 if (ServicePtrs
[snum_template
]->szService
&&
9286 strequal(ServicePtrs
[snum_template
]->szService
,
9287 Globals
.szUsershareTemplateShare
)) {
9292 if (snum_template
== -1) {
9293 DEBUG(0,("load_usershare_shares: usershare template share %s "
9294 "does not exist.\n",
9295 Globals
.szUsershareTemplateShare
));
9300 /* Mark all existing usershares as pending delete. */
9301 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
9302 if (VALID(iService
) && ServicePtrs
[iService
]->usershare
) {
9303 ServicePtrs
[iService
]->usershare
= USERSHARE_PENDING_DELETE
;
9307 dp
= sys_opendir(usersharepath
);
9309 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
9310 usersharepath
, strerror(errno
) ));
9314 for (num_dir_entries
= 0, num_bad_dir_entries
= 0, num_tmp_dir_entries
= 0;
9315 (de
= sys_readdir(dp
));
9316 num_dir_entries
++ ) {
9318 const char *n
= de
->d_name
;
9320 /* Ignore . and .. */
9322 if ((n
[1] == '\0') || (n
[1] == '.' && n
[2] == '\0')) {
9328 /* Temporary file used when creating a share. */
9329 num_tmp_dir_entries
++;
9332 /* Allow 20% tmp entries. */
9333 if (num_tmp_dir_entries
> allowed_tmp_entries
) {
9334 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
9335 "in directory %s\n",
9336 num_tmp_dir_entries
, usersharepath
));
9340 r
= process_usershare_file(usersharepath
, n
, snum_template
);
9342 /* Update the services count. */
9344 if (num_usershares
>= max_user_shares
) {
9345 DEBUG(0,("load_usershare_shares: max user shares reached "
9346 "on file %s in directory %s\n",
9347 n
, usersharepath
));
9350 } else if (r
== -1) {
9351 num_bad_dir_entries
++;
9354 /* Allow 20% bad entries. */
9355 if (num_bad_dir_entries
> allowed_bad_entries
) {
9356 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
9357 "in directory %s\n",
9358 num_bad_dir_entries
, usersharepath
));
9362 /* Allow 20% bad entries. */
9363 if (num_dir_entries
> max_user_shares
+ allowed_bad_entries
) {
9364 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
9365 "in directory %s\n",
9366 num_dir_entries
, usersharepath
));
9373 /* Sweep through and delete any non-refreshed usershares that are
9374 not currently in use. */
9375 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
9376 if (VALID(iService
) && (ServicePtrs
[iService
]->usershare
== USERSHARE_PENDING_DELETE
)) {
9377 if (conn_snum_used(iService
)) {
9380 /* Remove from the share ACL db. */
9381 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
9382 lp_servicename(iService
) ));
9383 delete_share_security(lp_servicename(iService
));
9384 free_service_byindex(iService
);
9388 return lp_numservices();
9391 /********************************************************
9392 Destroy global resources allocated in this file
9393 ********************************************************/
9395 void gfree_loadparm(void)
9401 /* Free resources allocated to services */
9403 for ( i
= 0; i
< iNumServices
; i
++ ) {
9405 free_service_byindex(i
);
9409 SAFE_FREE( ServicePtrs
);
9412 /* Now release all resources allocated to global
9413 parameters and the default service */
9415 free_global_parameters();
9419 /***************************************************************************
9420 Allow client apps to specify that they are a client
9421 ***************************************************************************/
9422 void lp_set_in_client(bool b
)
9428 /***************************************************************************
9429 Determine if we're running in a client app
9430 ***************************************************************************/
9431 bool lp_is_in_client(void)
9436 /***************************************************************************
9437 Load the services array from the services file. Return True on success,
9439 ***************************************************************************/
9441 static bool lp_load_ex(const char *pszFname
,
9445 bool initialize_globals
,
9446 bool allow_include_registry
,
9447 bool allow_registry_shares
)
9454 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9456 bInGlobalSection
= True
;
9457 bGlobalOnly
= global_only
;
9458 bAllowIncludeRegistry
= allow_include_registry
;
9460 init_globals(initialize_globals
);
9465 if (save_defaults
) {
9470 free_param_opts(&Globals
.param_opt
);
9472 /* We get sections first, so have to start 'behind' to make up */
9475 if (lp_config_backend_is_file()) {
9476 n2
= talloc_sub_basic(talloc_tos(), get_current_username(),
9477 current_user_info
.domain
,
9480 smb_panic("lp_load_ex: out of memory");
9483 add_to_file_list(pszFname
, n2
);
9485 bRetval
= pm_process(n2
, do_section
, do_parameter
, NULL
);
9488 /* finish up the last section */
9489 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval
)));
9491 if (iServiceIndex
>= 0) {
9492 bRetval
= service_ok(iServiceIndex
);
9496 if (lp_config_backend_is_registry()) {
9497 /* config backend changed to registry in config file */
9499 * We need to use this extra global variable here to
9500 * survive restart: init_globals uses this as a default
9501 * for ConfigBackend. Otherwise, init_globals would
9502 * send us into an endless loop here.
9504 config_backend
= CONFIG_BACKEND_REGISTRY
;
9506 DEBUG(1, ("lp_load_ex: changing to config backend "
9509 lp_kill_all_services();
9510 return lp_load_ex(pszFname
, global_only
, save_defaults
,
9511 add_ipc
, initialize_globals
,
9512 allow_include_registry
,
9513 allow_registry_shares
);
9515 } else if (lp_config_backend_is_registry()) {
9516 bRetval
= process_registry_globals();
9518 DEBUG(0, ("Illegal config backend given: %d\n",
9519 lp_config_backend()));
9523 if (bRetval
&& lp_registry_shares() && allow_registry_shares
) {
9524 bRetval
= process_registry_shares();
9527 lp_add_auto_services(lp_auto_services());
9530 /* When 'restrict anonymous = 2' guest connections to ipc$
9532 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9533 if ( lp_enable_asu_support() ) {
9534 lp_add_ipc("ADMIN$", false);
9539 set_default_server_announce_type();
9540 set_allowed_client_auth();
9544 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9545 /* if bWINSsupport is true and we are in the client */
9546 if (lp_is_in_client() && Globals
.bWINSsupport
) {
9547 lp_do_parameter(GLOBAL_SECTION_SNUM
, "wins server", "127.0.0.1");
9552 bAllowIncludeRegistry
= true;
9557 bool lp_load(const char *pszFname
,
9561 bool initialize_globals
)
9563 return lp_load_ex(pszFname
,
9568 true, /* allow_include_registry */
9569 false); /* allow_registry_shares*/
9572 bool lp_load_initial_only(const char *pszFname
)
9574 return lp_load_ex(pszFname
,
9575 true, /* global only */
9576 false, /* save_defaults */
9577 false, /* add_ipc */
9578 true, /* initialize_globals */
9579 false, /* allow_include_registry */
9580 false); /* allow_registry_shares*/
9583 bool lp_load_with_registry_shares(const char *pszFname
,
9587 bool initialize_globals
)
9589 return lp_load_ex(pszFname
,
9594 true, /* allow_include_registry */
9595 true); /* allow_registry_shares*/
9598 /***************************************************************************
9599 Return the max number of services.
9600 ***************************************************************************/
9602 int lp_numservices(void)
9604 return (iNumServices
);
9607 /***************************************************************************
9608 Display the contents of the services array in human-readable form.
9609 ***************************************************************************/
9611 void lp_dump(FILE *f
, bool show_defaults
, int maxtoprint
)
9616 defaults_saved
= False
;
9620 dump_a_service(&sDefault
, f
);
9622 for (iService
= 0; iService
< maxtoprint
; iService
++) {
9624 lp_dump_one(f
, show_defaults
, iService
);
9628 /***************************************************************************
9629 Display the contents of one service in human-readable form.
9630 ***************************************************************************/
9632 void lp_dump_one(FILE * f
, bool show_defaults
, int snum
)
9635 if (ServicePtrs
[snum
]->szService
[0] == '\0')
9637 dump_a_service(ServicePtrs
[snum
], f
);
9641 /***************************************************************************
9642 Return the number of the service with the given name, or -1 if it doesn't
9643 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9644 getservicebyname()! This works ONLY if all services have been loaded, and
9645 does not copy the found service.
9646 ***************************************************************************/
9648 int lp_servicenumber(const char *pszServiceName
)
9651 fstring serviceName
;
9653 if (!pszServiceName
) {
9654 return GLOBAL_SECTION_SNUM
;
9657 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
9658 if (VALID(iService
) && ServicePtrs
[iService
]->szService
) {
9660 * The substitution here is used to support %U is
9663 fstrcpy(serviceName
, ServicePtrs
[iService
]->szService
);
9664 standard_sub_basic(get_current_username(),
9665 current_user_info
.domain
,
9666 serviceName
,sizeof(serviceName
));
9667 if (strequal(serviceName
, pszServiceName
)) {
9673 if (iService
>= 0 && ServicePtrs
[iService
]->usershare
== USERSHARE_VALID
) {
9674 struct timespec last_mod
;
9676 if (!usershare_exists(iService
, &last_mod
)) {
9677 /* Remove the share security tdb entry for it. */
9678 delete_share_security(lp_servicename(iService
));
9679 /* Remove it from the array. */
9680 free_service_byindex(iService
);
9681 /* Doesn't exist anymore. */
9682 return GLOBAL_SECTION_SNUM
;
9685 /* Has it been modified ? If so delete and reload. */
9686 if (timespec_compare(&ServicePtrs
[iService
]->usershare_last_mod
,
9688 /* Remove it from the array. */
9689 free_service_byindex(iService
);
9690 /* and now reload it. */
9691 iService
= load_usershare_service(pszServiceName
);
9696 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName
));
9697 return GLOBAL_SECTION_SNUM
;
9703 bool share_defined(const char *service_name
)
9705 return (lp_servicenumber(service_name
) != -1);
9708 struct share_params
*get_share_params(TALLOC_CTX
*mem_ctx
,
9709 const char *sharename
)
9711 struct share_params
*result
;
9715 snum
= find_service(mem_ctx
, sharename
, &sname
);
9716 if (snum
< 0 || sname
== NULL
) {
9720 if (!(result
= TALLOC_P(mem_ctx
, struct share_params
))) {
9721 DEBUG(0, ("talloc failed\n"));
9725 result
->service
= snum
;
9729 struct share_iterator
*share_list_all(TALLOC_CTX
*mem_ctx
)
9731 struct share_iterator
*result
;
9733 if (!(result
= TALLOC_P(mem_ctx
, struct share_iterator
))) {
9734 DEBUG(0, ("talloc failed\n"));
9738 result
->next_id
= 0;
9742 struct share_params
*next_share(struct share_iterator
*list
)
9744 struct share_params
*result
;
9746 while (!lp_snum_ok(list
->next_id
) &&
9747 (list
->next_id
< lp_numservices())) {
9751 if (list
->next_id
>= lp_numservices()) {
9755 if (!(result
= TALLOC_P(list
, struct share_params
))) {
9756 DEBUG(0, ("talloc failed\n"));
9760 result
->service
= list
->next_id
;
9765 struct share_params
*next_printer(struct share_iterator
*list
)
9767 struct share_params
*result
;
9769 while ((result
= next_share(list
)) != NULL
) {
9770 if (lp_print_ok(result
->service
)) {
9778 * This is a hack for a transition period until we transformed all code from
9779 * service numbers to struct share_params.
9782 struct share_params
*snum2params_static(int snum
)
9784 static struct share_params result
;
9785 result
.service
= snum
;
9789 /*******************************************************************
9790 A useful volume label function.
9791 ********************************************************************/
9793 const char *volume_label(int snum
)
9796 const char *label
= lp_volume(snum
);
9798 label
= lp_servicename(snum
);
9801 /* This returns a 33 byte guarenteed null terminated string. */
9802 ret
= talloc_strndup(talloc_tos(), label
, 32);
9809 /*******************************************************************
9810 Set the server type we will announce as via nmbd.
9811 ********************************************************************/
9813 static void set_default_server_announce_type(void)
9815 default_server_announce
= 0;
9816 default_server_announce
|= SV_TYPE_WORKSTATION
;
9817 default_server_announce
|= SV_TYPE_SERVER
;
9818 default_server_announce
|= SV_TYPE_SERVER_UNIX
;
9820 /* note that the flag should be set only if we have a
9821 printer service but nmbd doesn't actually load the
9822 services so we can't tell --jerry */
9824 default_server_announce
|= SV_TYPE_PRINTQ_SERVER
;
9826 switch (lp_announce_as()) {
9827 case ANNOUNCE_AS_NT_SERVER
:
9828 default_server_announce
|= SV_TYPE_SERVER_NT
;
9829 /* fall through... */
9830 case ANNOUNCE_AS_NT_WORKSTATION
:
9831 default_server_announce
|= SV_TYPE_NT
;
9833 case ANNOUNCE_AS_WIN95
:
9834 default_server_announce
|= SV_TYPE_WIN95_PLUS
;
9836 case ANNOUNCE_AS_WFW
:
9837 default_server_announce
|= SV_TYPE_WFW
;
9843 switch (lp_server_role()) {
9844 case ROLE_DOMAIN_MEMBER
:
9845 default_server_announce
|= SV_TYPE_DOMAIN_MEMBER
;
9847 case ROLE_DOMAIN_PDC
:
9848 default_server_announce
|= SV_TYPE_DOMAIN_CTRL
;
9850 case ROLE_DOMAIN_BDC
:
9851 default_server_announce
|= SV_TYPE_DOMAIN_BAKCTRL
;
9853 case ROLE_STANDALONE
:
9857 if (lp_time_server())
9858 default_server_announce
|= SV_TYPE_TIME_SOURCE
;
9860 if (lp_host_msdfs())
9861 default_server_announce
|= SV_TYPE_DFS_SERVER
;
9864 /***********************************************************
9865 If we are PDC then prefer us as DMB
9866 ************************************************************/
9868 bool lp_domain_master(void)
9870 if (Globals
.iDomainMaster
== Auto
)
9871 return (lp_server_role() == ROLE_DOMAIN_PDC
);
9873 return (bool)Globals
.iDomainMaster
;
9876 /***********************************************************
9877 If we are PDC then prefer us as DMB
9878 ************************************************************/
9880 bool lp_domain_master_true_or_auto(void)
9882 if (Globals
.iDomainMaster
) /* auto or yes */
9888 /***********************************************************
9889 If we are DMB then prefer us as LMB
9890 ************************************************************/
9892 bool lp_preferred_master(void)
9894 if (Globals
.iPreferredMaster
== Auto
)
9895 return (lp_local_master() && lp_domain_master());
9897 return (bool)Globals
.iPreferredMaster
;
9900 /*******************************************************************
9902 ********************************************************************/
9904 void lp_remove_service(int snum
)
9906 ServicePtrs
[snum
]->valid
= False
;
9907 invalid_services
[num_invalid_services
++] = snum
;
9910 /*******************************************************************
9912 ********************************************************************/
9914 void lp_copy_service(int snum
, const char *new_name
)
9916 do_section(new_name
, NULL
);
9918 snum
= lp_servicenumber(new_name
);
9920 lp_do_parameter(snum
, "copy", lp_servicename(snum
));
9925 /*******************************************************************
9926 Get the default server type we will announce as via nmbd.
9927 ********************************************************************/
9929 int lp_default_server_announce(void)
9931 return default_server_announce
;
9934 /*******************************************************************
9935 Split the announce version into major and minor numbers.
9936 ********************************************************************/
9938 int lp_major_announce_version(void)
9940 static bool got_major
= False
;
9941 static int major_version
= DEFAULT_MAJOR_VERSION
;
9946 return major_version
;
9949 if ((vers
= lp_announce_version()) == NULL
)
9950 return major_version
;
9952 if ((p
= strchr_m(vers
, '.')) == 0)
9953 return major_version
;
9956 major_version
= atoi(vers
);
9957 return major_version
;
9960 int lp_minor_announce_version(void)
9962 static bool got_minor
= False
;
9963 static int minor_version
= DEFAULT_MINOR_VERSION
;
9968 return minor_version
;
9971 if ((vers
= lp_announce_version()) == NULL
)
9972 return minor_version
;
9974 if ((p
= strchr_m(vers
, '.')) == 0)
9975 return minor_version
;
9978 minor_version
= atoi(p
);
9979 return minor_version
;
9982 /***********************************************************
9983 Set the global name resolution order (used in smbclient).
9984 ************************************************************/
9986 void lp_set_name_resolve_order(const char *new_order
)
9988 string_set(&Globals
.szNameResolveOrder
, new_order
);
9991 const char *lp_printername(int snum
)
9993 const char *ret
= _lp_printername(snum
);
9994 if (ret
== NULL
|| (ret
!= NULL
&& *ret
== '\0'))
9995 ret
= lp_const_servicename(snum
);
10001 /***********************************************************
10002 Allow daemons such as winbindd to fix their logfile name.
10003 ************************************************************/
10005 void lp_set_logfile(const char *name
)
10007 string_set(&Globals
.szLogFile
, name
);
10008 debug_set_logfile(name
);
10011 /*******************************************************************
10012 Return the max print jobs per queue.
10013 ********************************************************************/
10015 int lp_maxprintjobs(int snum
)
10017 int maxjobs
= LP_SNUM_OK(snum
) ? ServicePtrs
[snum
]->iMaxPrintJobs
: sDefault
.iMaxPrintJobs
;
10018 if (maxjobs
<= 0 || maxjobs
>= PRINT_MAX_JOBID
)
10019 maxjobs
= PRINT_MAX_JOBID
- 1;
10024 const char *lp_printcapname(void)
10026 if ((Globals
.szPrintcapname
!= NULL
) &&
10027 (Globals
.szPrintcapname
[0] != '\0'))
10028 return Globals
.szPrintcapname
;
10030 if (sDefault
.iPrinting
== PRINT_CUPS
) {
10038 if (sDefault
.iPrinting
== PRINT_BSD
)
10039 return "/etc/printcap";
10041 return PRINTCAP_NAME
;
10044 static uint32 spoolss_state
;
10046 bool lp_disable_spoolss( void )
10048 if ( spoolss_state
== SVCCTL_STATE_UNKNOWN
)
10049 spoolss_state
= _lp_disable_spoolss() ? SVCCTL_STOPPED
: SVCCTL_RUNNING
;
10051 return spoolss_state
== SVCCTL_STOPPED
? True
: False
;
10054 void lp_set_spoolss_state( uint32 state
)
10056 SMB_ASSERT( (state
== SVCCTL_STOPPED
) || (state
== SVCCTL_RUNNING
) );
10058 spoolss_state
= state
;
10061 uint32
lp_get_spoolss_state( void )
10063 return lp_disable_spoolss() ? SVCCTL_STOPPED
: SVCCTL_RUNNING
;
10066 /*******************************************************************
10067 Ensure we don't use sendfile if server smb signing is active.
10068 ********************************************************************/
10070 bool lp_use_sendfile(int snum
, struct smb_signing_state
*signing_state
)
10072 bool sign_active
= false;
10074 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
10075 if (get_Protocol() < PROTOCOL_NT1
) {
10078 if (signing_state
) {
10079 sign_active
= smb_signing_is_active(signing_state
);
10081 return (_lp_use_sendfile(snum
) &&
10082 (get_remote_arch() != RA_WIN95
) &&
10086 /*******************************************************************
10087 Turn off sendfile if we find the underlying OS doesn't support it.
10088 ********************************************************************/
10090 void set_use_sendfile(int snum
, bool val
)
10092 if (LP_SNUM_OK(snum
))
10093 ServicePtrs
[snum
]->bUseSendfile
= val
;
10095 sDefault
.bUseSendfile
= val
;
10098 /*******************************************************************
10099 Turn off storing DOS attributes if this share doesn't support it.
10100 ********************************************************************/
10102 void set_store_dos_attributes(int snum
, bool val
)
10104 if (!LP_SNUM_OK(snum
))
10106 ServicePtrs
[(snum
)]->bStoreDosAttributes
= val
;
10109 void lp_set_mangling_method(const char *new_method
)
10111 string_set(&Globals
.szManglingMethod
, new_method
);
10114 /*******************************************************************
10115 Global state for POSIX pathname processing.
10116 ********************************************************************/
10118 static bool posix_pathnames
;
10120 bool lp_posix_pathnames(void)
10122 return posix_pathnames
;
10125 /*******************************************************************
10126 Change everything needed to ensure POSIX pathname processing (currently
10128 ********************************************************************/
10130 void lp_set_posix_pathnames(void)
10132 posix_pathnames
= True
;
10135 /*******************************************************************
10136 Global state for POSIX lock processing - CIFS unix extensions.
10137 ********************************************************************/
10139 bool posix_default_lock_was_set
;
10140 static enum brl_flavour posix_cifsx_locktype
; /* By default 0 == WINDOWS_LOCK */
10142 enum brl_flavour
lp_posix_cifsu_locktype(files_struct
*fsp
)
10144 if (posix_default_lock_was_set
) {
10145 return posix_cifsx_locktype
;
10147 return fsp
->posix_open
? POSIX_LOCK
: WINDOWS_LOCK
;
10151 /*******************************************************************
10152 ********************************************************************/
10154 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val
)
10156 posix_default_lock_was_set
= True
;
10157 posix_cifsx_locktype
= val
;
10160 int lp_min_receive_file_size(void)
10162 if (Globals
.iminreceivefile
< 0) {
10165 return MIN(Globals
.iminreceivefile
, BUFFER_SIZE
);
10168 /*******************************************************************
10169 If socket address is an empty character string, it is necessary to
10170 define it as "0.0.0.0".
10171 ********************************************************************/
10173 const char *lp_socket_address(void)
10175 char *sock_addr
= Globals
.szSocketAddress
;
10177 if (sock_addr
[0] == '\0'){
10178 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
10180 return Globals
.szSocketAddress
;
10183 void lp_set_passdb_backend(const char *backend
)
10185 string_set(&Globals
.szPassdbBackend
, backend
);
10188 /*******************************************************************
10189 Safe wide links checks.
10190 This helper function always verify the validity of wide links,
10191 even after a configuration file reload.
10192 ********************************************************************/
10194 static bool lp_widelinks_internal(int snum
)
10196 return (bool)(LP_SNUM_OK(snum
)? ServicePtrs
[(snum
)]->bWidelinks
:
10197 sDefault
.bWidelinks
);
10200 void widelinks_warning(int snum
)
10202 if (lp_unix_extensions() && lp_widelinks_internal(snum
)) {
10203 DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
10204 "These parameters are incompatible. "
10205 "Wide links will be disabled for this share.\n",
10206 lp_servicename(snum
) ));
10210 bool lp_widelinks(int snum
)
10212 /* wide links is always incompatible with unix extensions */
10213 if (lp_unix_extensions()) {
10217 return lp_widelinks_internal(snum
);
10220 bool lp_writeraw(void)
10222 if (lp_async_smb_echo_handler()) {
10225 return _lp_writeraw();
10228 bool lp_readraw(void)
10230 if (lp_async_smb_echo_handler()) {
10233 return _lp_readraw();