2 Unix SMB/CIFS implementation.
3 Parameter loading functions
4 Copyright (C) Karl Auer 1993-1998
6 Largely re-written by Andrew Tridgell, September 1994
8 Copyright (C) Simo Sorce 2001
9 Copyright (C) Alexander Bokovoy 2002
10 Copyright (C) Stefan (metze) Metzmacher 2002
11 Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
12 Copyright (C) Michael Adam 2008
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 3 of the License, or
17 (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>.
31 * This module provides suitable callback functions for the params
32 * module. It builds the internal table of service details which is
33 * then used by the rest of the server.
37 * 1) add it to the global or service structure definition
38 * 2) add it to the parm_table
39 * 3) add it to the list of available functions (eg: using FN_GLOBAL_STRING())
40 * 4) If it's a global then initialise it in init_globals. If a local
41 * (ie. service) parameter then initialise it in the sDefault structure
45 * The configuration file is processed sequentially for speed. It is NOT
46 * accessed randomly as happens in 'real' Windows. For this reason, there
47 * is a fair bit of sequence-dependent code here - ie., code which assumes
48 * that certain things happen before others. In particular, the code which
49 * happens at the boundary between sections is delicately poised, so be
57 #ifdef HAVE_HTTPCONNECTENCRYPT
58 #include <cups/http.h>
63 extern enum protocol_types Protocol
;
64 extern userdom_struct current_user_info
;
67 #define GLOBAL_NAME "global"
71 #define PRINTERS_NAME "printers"
75 #define HOMES_NAME "homes"
78 /* the special value for the include parameter
79 * to be interpreted not as a file name but to
80 * trigger loading of the global smb.conf options
82 #ifndef INCLUDE_REGISTRY_NAME
83 #define INCLUDE_REGISTRY_NAME "registry"
86 static bool in_client
= False
; /* Not in the client by default */
87 static struct smbconf_csn conf_last_csn
;
89 #define CONFIG_BACKEND_FILE 0
90 #define CONFIG_BACKEND_REGISTRY 1
92 static int config_backend
= CONFIG_BACKEND_FILE
;
94 /* some helpful bits */
95 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
96 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
98 #define USERSHARE_VALID 1
99 #define USERSHARE_PENDING_DELETE 2
101 static bool defaults_saved
= False
;
103 struct param_opt_struct
{
104 struct param_opt_struct
*prev
, *next
;
111 * This structure describes global (ie., server-wide) parameters.
118 char *display_charset
;
119 char *szPrintcapname
;
120 char *szAddPortCommand
;
121 char *szEnumPortsCommand
;
122 char *szAddPrinterCommand
;
123 char *szDeletePrinterCommand
;
124 char *szOs2DriverMap
;
130 char *szDefaultService
;
134 char *szServerString
;
135 char *szAutoServices
;
136 char *szPasswdProgram
;
140 char *szSMBPasswdFile
;
142 char *szPassdbBackend
;
143 char **szPreloadModules
;
144 char *szPasswordServer
;
145 char *szSocketOptions
;
147 char *szAfsUsernameMap
;
148 int iAfsTokenLifetime
;
149 char *szLogNtTokenCommand
;
155 char **szWINSservers
;
157 char *szRemoteAnnounce
;
158 char *szRemoteBrowseSync
;
159 char *szSocketAddress
;
160 char *szNISHomeMapName
;
161 char *szAnnounceVersion
; /* This is initialised in init_globals */
164 char **szNetbiosAliases
;
165 char *szNetbiosScope
;
166 char *szNameResolveOrder
;
168 char *szAddUserScript
;
169 char *szRenameUserScript
;
170 char *szDelUserScript
;
171 char *szAddGroupScript
;
172 char *szDelGroupScript
;
173 char *szAddUserToGroupScript
;
174 char *szDelUserFromGroupScript
;
175 char *szSetPrimaryGroupScript
;
176 char *szAddMachineScript
;
177 char *szShutdownScript
;
178 char *szAbortShutdownScript
;
179 char *szUsernameMapScript
;
180 char *szCheckPasswordScript
;
187 bool bPassdbExpandExplicit
;
188 int AlgorithmicRidBase
;
189 char *szTemplateHomedir
;
190 char *szTemplateShell
;
191 char *szWinbindSeparator
;
192 bool bWinbindEnumUsers
;
193 bool bWinbindEnumGroups
;
194 bool bWinbindUseDefaultDomain
;
195 bool bWinbindTrustedDomainsOnly
;
196 bool bWinbindNestedGroups
;
197 int winbind_expand_groups
;
198 bool bWinbindRefreshTickets
;
199 bool bWinbindOfflineLogon
;
200 bool bWinbindNormalizeNames
;
201 bool bWinbindRpcOnly
;
202 char *szIdmapBackend
;
203 char *szIdmapAllocBackend
;
204 char *szAddShareCommand
;
205 char *szChangeShareCommand
;
206 char *szDeleteShareCommand
;
208 char *szGuestaccount
;
209 char *szManglingMethod
;
210 char **szServicesList
;
211 char *szUsersharePath
;
212 char *szUsershareTemplateShare
;
213 char **szUsersharePrefixAllowList
;
214 char **szUsersharePrefixDenyList
;
221 int open_files_db_hash_size
;
230 bool paranoid_server_security
;
233 int iMaxSmbdProcesses
;
234 bool bDisableSpoolss
;
237 bool enhanced_browsing
;
243 int announce_as
; /* This is initialised in init_globals */
244 int machine_password_timeout
;
246 int oplock_break_wait_time
;
247 int winbind_cache_time
;
248 int winbind_reconnect_delay
;
249 int winbind_max_idle_children
;
250 char **szWinbindNssInfo
;
252 char *szLdapMachineSuffix
;
253 char *szLdapUserSuffix
;
254 char *szLdapIdmapSuffix
;
255 char *szLdapGroupSuffix
;
260 int ldap_debug_level
;
261 int ldap_debug_threshold
;
265 char *szIPrintServer
;
267 char **szClusterAddresses
;
269 int ldap_passwd_sync
;
270 int ldap_replication_sleep
;
271 int ldap_timeout
; /* This is initialised in init_globals */
272 int ldap_connection_timeout
;
275 bool bMsAddPrinterWizard
;
280 int iPreferredMaster
;
283 char **szInitLogonDelayedHosts
;
285 bool bEncryptPasswords
;
290 bool bObeyPamRestrictions
;
292 int PrintcapCacheTime
;
293 bool bLargeReadwrite
;
300 bool bBindInterfacesOnly
;
301 bool bPamPasswordChange
;
302 bool bUnixPasswdSync
;
303 bool bPasswdChatDebug
;
304 int iPasswdChatTimeout
;
308 bool bNTStatusSupport
;
310 int iMaxStatCacheSize
;
312 bool bAllowTrustedDomains
;
316 bool bClientLanManAuth
;
317 bool bClientNTLMv2Auth
;
318 bool bClientPlaintextAuth
;
319 bool bClientUseSpnego
;
320 bool bDebugPrefixTimestamp
;
321 bool bDebugHiresTimestamp
;
325 bool bEnableCoreFiles
;
328 bool bHostnameLookups
;
329 bool bUnixExtensions
;
330 bool bDisableNetbios
;
331 char * szDedicatedKeytabFile
;
333 bool bDeferSharingViolations
;
334 bool bEnablePrivileges
;
336 bool bUsershareOwnerOnly
;
337 bool bUsershareAllowGuests
;
338 bool bRegistryShares
;
339 int restrict_anonymous
;
340 int name_cache_timeout
;
343 int client_ldap_sasl_wrapping
;
344 int iUsershareMaxShares
;
346 int iIdmapNegativeCacheTime
;
350 struct param_opt_struct
*param_opt
;
351 int cups_connection_timeout
;
352 char *szSMBPerfcountModule
;
353 bool bMapUntrustedToDomain
;
356 static struct global Globals
;
359 * This structure describes a single service.
365 time_t usershare_last_mod
;
369 char **szInvalidUsers
;
377 char *szRootPostExec
;
379 char *szPrintcommand
;
382 char *szLppausecommand
;
383 char *szLpresumecommand
;
384 char *szQueuepausecommand
;
385 char *szQueueresumecommand
;
387 char *szPrintjobUsername
;
395 char *szVetoOplockFiles
;
401 char **printer_admin
;
406 char *szAioWriteBehind
;
410 int iMaxReportedPrintJobs
;
413 int iCreate_force_mode
;
415 int iSecurity_force_mode
;
418 int iDir_Security_mask
;
419 int iDir_Security_force_mode
;
423 int iOplockContentionLimit
;
428 bool bRootpreexecClose
;
431 bool bShortCasePreserve
;
433 bool bHideSpecialFiles
;
434 bool bHideUnReadable
;
435 bool bHideUnWriteableFiles
;
437 bool bAccessBasedShareEnum
;
442 bool bAdministrative_share
;
448 bool bStoreDosAttributes
;
461 bool bStrictAllocate
;
464 struct bitmap
*copymap
;
465 bool bDeleteReadonly
;
467 bool bDeleteVetoFiles
;
470 bool bDosFiletimeResolution
;
471 bool bFakeDirCreateTimes
;
477 bool bUseClientDriver
;
478 bool bDefaultDevmode
;
479 bool bForcePrintername
;
481 bool bForceUnknownAclUser
;
484 bool bMap_acl_inherit
;
487 bool bAclCheckPermissions
;
488 bool bAclMapFullControl
;
489 bool bAclGroupControl
;
491 bool bKernelChangeNotify
;
492 int iallocation_roundup_size
;
496 int iDirectoryNameCacheSize
;
498 struct param_opt_struct
*param_opt
;
500 char dummy
[3]; /* for alignment */
504 /* This is a default service used to prime a services structure */
505 static struct service sDefault
= {
507 False
, /* not autoloaded */
508 0, /* not a usershare */
509 (time_t)0, /* No last mod time */
510 NULL
, /* szService */
512 NULL
, /* szUsername */
513 NULL
, /* szInvalidUsers */
514 NULL
, /* szValidUsers */
515 NULL
, /* szAdminUsers */
517 NULL
, /* szInclude */
518 NULL
, /* szPreExec */
519 NULL
, /* szPostExec */
520 NULL
, /* szRootPreExec */
521 NULL
, /* szRootPostExec */
522 NULL
, /* szCupsOptions */
523 NULL
, /* szPrintcommand */
524 NULL
, /* szLpqcommand */
525 NULL
, /* szLprmcommand */
526 NULL
, /* szLppausecommand */
527 NULL
, /* szLpresumecommand */
528 NULL
, /* szQueuepausecommand */
529 NULL
, /* szQueueresumecommand */
530 NULL
, /* szPrintername */
531 NULL
, /* szPrintjobUsername */
532 NULL
, /* szDontdescend */
533 NULL
, /* szHostsallow */
534 NULL
, /* szHostsdeny */
535 NULL
, /* szMagicScript */
536 NULL
, /* szMagicOutput */
537 NULL
, /* szVetoFiles */
538 NULL
, /* szHideFiles */
539 NULL
, /* szVetoOplockFiles */
541 NULL
, /* force user */
542 NULL
, /* force group */
544 NULL
, /* writelist */
545 NULL
, /* printer admin */
548 NULL
, /* vfs objects */
549 NULL
, /* szMSDfsProxy */
550 NULL
, /* szAioWriteBehind */
552 0, /* iMinPrintSpace */
553 1000, /* iMaxPrintJobs */
554 0, /* iMaxReportedPrintJobs */
555 0, /* iWriteCacheSize */
556 0744, /* iCreate_mask */
557 0000, /* iCreate_force_mode */
558 0777, /* iSecurity_mask */
559 0, /* iSecurity_force_mode */
560 0755, /* iDir_mask */
561 0000, /* iDir_force_mode */
562 0777, /* iDir_Security_mask */
563 0, /* iDir_Security_force_mode */
564 0, /* iMaxConnections */
565 CASE_LOWER
, /* iDefaultCase */
566 DEFAULT_PRINTING
, /* iPrinting */
567 2, /* iOplockContentionLimit */
569 1024, /* iBlock_size */
570 0, /* iDfreeCacheTime */
571 False
, /* bPreexecClose */
572 False
, /* bRootpreexecClose */
573 Auto
, /* case sensitive */
574 True
, /* case preserve */
575 True
, /* short case preserve */
576 True
, /* bHideDotFiles */
577 False
, /* bHideSpecialFiles */
578 False
, /* bHideUnReadable */
579 False
, /* bHideUnWriteableFiles */
580 True
, /* bBrowseable */
581 False
, /* bAccessBasedShareEnum */
582 True
, /* bAvailable */
583 True
, /* bRead_only */
584 True
, /* bNo_set_dir */
585 False
, /* bGuest_only */
586 False
, /* bAdministrative_share */
587 False
, /* bGuest_ok */
588 False
, /* bPrint_ok */
589 False
, /* bMap_system */
590 False
, /* bMap_hidden */
591 True
, /* bMap_archive */
592 False
, /* bStoreDosAttributes */
593 False
, /* bDmapiSupport */
595 Auto
, /* iStrictLocking */
596 True
, /* bPosixLocking */
597 True
, /* bShareModes */
599 True
, /* bLevel2OpLocks */
600 False
, /* bOnlyUser */
601 True
, /* bMangledNames */
602 True
, /* bWidelinks */
603 True
, /* bSymlinks */
604 False
, /* bSyncAlways */
605 False
, /* bStrictAllocate */
606 False
, /* bStrictSync */
607 '~', /* magic char */
609 False
, /* bDeleteReadonly */
610 False
, /* bFakeOplocks */
611 False
, /* bDeleteVetoFiles */
612 False
, /* bDosFilemode */
613 True
, /* bDosFiletimes */
614 False
, /* bDosFiletimeResolution */
615 False
, /* bFakeDirCreateTimes */
616 True
, /* bBlockingLocks */
617 False
, /* bInheritPerms */
618 False
, /* bInheritACLS */
619 False
, /* bInheritOwner */
620 False
, /* bMSDfsRoot */
621 False
, /* bUseClientDriver */
622 True
, /* bDefaultDevmode */
623 False
, /* bForcePrintername */
624 True
, /* bNTAclSupport */
625 False
, /* bForceUnknownAclUser */
626 False
, /* bUseSendfile */
627 False
, /* bProfileAcls */
628 False
, /* bMap_acl_inherit */
629 False
, /* bAfs_Share */
630 False
, /* bEASupport */
631 True
, /* bAclCheckPermissions */
632 True
, /* bAclMapFullControl */
633 False
, /* bAclGroupControl */
634 True
, /* bChangeNotify */
635 True
, /* bKernelChangeNotify */
636 SMB_ROUNDUP_ALLOCATION_SIZE
, /* iallocation_roundup_size */
637 0, /* iAioReadSize */
638 0, /* iAioWriteSize */
639 MAP_READONLY_YES
, /* iMap_readonly */
640 #ifdef BROKEN_DIRECTORY_HANDLING
641 0, /* iDirectoryNameCacheSize */
643 100, /* iDirectoryNameCacheSize */
645 Auto
, /* ismb_encrypt */
646 NULL
, /* Parametric options */
651 /* local variables */
652 static struct service
**ServicePtrs
= NULL
;
653 static int iNumServices
= 0;
654 static int iServiceIndex
= 0;
655 static struct db_context
*ServiceHash
;
656 static int *invalid_services
= NULL
;
657 static int num_invalid_services
= 0;
658 static bool bInGlobalSection
= True
;
659 static bool bGlobalOnly
= False
;
660 static int server_role
;
661 static int default_server_announce
;
663 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
665 /* prototypes for the special type handlers */
666 static bool handle_include( int snum
, const char *pszParmValue
, char **ptr
);
667 static bool handle_copy( int snum
, const char *pszParmValue
, char **ptr
);
668 static bool handle_netbios_name( int snum
, const char *pszParmValue
, char **ptr
);
669 static bool handle_idmap_uid( int snum
, const char *pszParmValue
, char **ptr
);
670 static bool handle_idmap_gid( int snum
, const char *pszParmValue
, char **ptr
);
671 static bool handle_debug_list( int snum
, const char *pszParmValue
, char **ptr
);
672 static bool handle_workgroup( int snum
, const char *pszParmValue
, char **ptr
);
673 static bool handle_netbios_aliases( int snum
, const char *pszParmValue
, char **ptr
);
674 static bool handle_netbios_scope( int snum
, const char *pszParmValue
, char **ptr
);
675 static bool handle_charset( int snum
, const char *pszParmValue
, char **ptr
);
676 static bool handle_printing( int snum
, const char *pszParmValue
, char **ptr
);
677 static bool handle_ldap_debug_level( int snum
, const char *pszParmValue
, char **ptr
);
679 static void set_server_role(void);
680 static void set_default_server_announce_type(void);
681 static void set_allowed_client_auth(void);
683 static void *lp_local_ptr(struct service
*service
, void *ptr
);
685 static void add_to_file_list(const char *fname
, const char *subfname
);
687 static const struct enum_list enum_protocol
[] = {
688 {PROTOCOL_NT1
, "NT1"},
689 {PROTOCOL_LANMAN2
, "LANMAN2"},
690 {PROTOCOL_LANMAN1
, "LANMAN1"},
691 {PROTOCOL_CORE
, "CORE"},
692 {PROTOCOL_COREPLUS
, "COREPLUS"},
693 {PROTOCOL_COREPLUS
, "CORE+"},
697 static const struct enum_list enum_security
[] = {
698 {SEC_SHARE
, "SHARE"},
700 {SEC_SERVER
, "SERVER"},
701 {SEC_DOMAIN
, "DOMAIN"},
708 static const struct enum_list enum_printing
[] = {
709 {PRINT_SYSV
, "sysv"},
711 {PRINT_HPUX
, "hpux"},
715 {PRINT_LPRNG
, "lprng"},
716 {PRINT_CUPS
, "cups"},
717 {PRINT_IPRINT
, "iprint"},
719 {PRINT_LPROS2
, "os2"},
721 {PRINT_TEST
, "test"},
723 #endif /* DEVELOPER */
727 static const struct enum_list enum_ldap_sasl_wrapping
[] = {
729 {ADS_AUTH_SASL_SIGN
, "sign"},
730 {ADS_AUTH_SASL_SEAL
, "seal"},
734 static const struct enum_list enum_ldap_ssl
[] = {
735 {LDAP_SSL_OFF
, "no"},
736 {LDAP_SSL_OFF
, "off"},
737 {LDAP_SSL_START_TLS
, "start tls"},
738 {LDAP_SSL_START_TLS
, "start_tls"},
742 static const struct enum_list enum_ldap_passwd_sync
[] = {
743 {LDAP_PASSWD_SYNC_OFF
, "no"},
744 {LDAP_PASSWD_SYNC_OFF
, "off"},
745 {LDAP_PASSWD_SYNC_ON
, "yes"},
746 {LDAP_PASSWD_SYNC_ON
, "on"},
747 {LDAP_PASSWD_SYNC_ONLY
, "only"},
751 /* Types of machine we can announce as. */
752 #define ANNOUNCE_AS_NT_SERVER 1
753 #define ANNOUNCE_AS_WIN95 2
754 #define ANNOUNCE_AS_WFW 3
755 #define ANNOUNCE_AS_NT_WORKSTATION 4
757 static const struct enum_list enum_announce_as
[] = {
758 {ANNOUNCE_AS_NT_SERVER
, "NT"},
759 {ANNOUNCE_AS_NT_SERVER
, "NT Server"},
760 {ANNOUNCE_AS_NT_WORKSTATION
, "NT Workstation"},
761 {ANNOUNCE_AS_WIN95
, "win95"},
762 {ANNOUNCE_AS_WFW
, "WfW"},
766 static const struct enum_list enum_map_readonly
[] = {
767 {MAP_READONLY_NO
, "no"},
768 {MAP_READONLY_NO
, "false"},
769 {MAP_READONLY_NO
, "0"},
770 {MAP_READONLY_YES
, "yes"},
771 {MAP_READONLY_YES
, "true"},
772 {MAP_READONLY_YES
, "1"},
773 {MAP_READONLY_PERMISSIONS
, "permissions"},
774 {MAP_READONLY_PERMISSIONS
, "perms"},
778 static const struct enum_list enum_case
[] = {
779 {CASE_LOWER
, "lower"},
780 {CASE_UPPER
, "upper"},
786 static const struct enum_list enum_bool_auto
[] = {
797 /* Client-side offline caching policy types */
798 #define CSC_POLICY_MANUAL 0
799 #define CSC_POLICY_DOCUMENTS 1
800 #define CSC_POLICY_PROGRAMS 2
801 #define CSC_POLICY_DISABLE 3
803 static const struct enum_list enum_csc_policy
[] = {
804 {CSC_POLICY_MANUAL
, "manual"},
805 {CSC_POLICY_DOCUMENTS
, "documents"},
806 {CSC_POLICY_PROGRAMS
, "programs"},
807 {CSC_POLICY_DISABLE
, "disable"},
811 /* SMB signing types. */
812 static const struct enum_list enum_smb_signing_vals
[] = {
824 {Required
, "required"},
825 {Required
, "mandatory"},
827 {Required
, "forced"},
828 {Required
, "enforced"},
832 /* ACL compatibility options. */
833 static const struct enum_list enum_acl_compat_vals
[] = {
834 { ACL_COMPAT_AUTO
, "auto" },
835 { ACL_COMPAT_WINNT
, "winnt" },
836 { ACL_COMPAT_WIN2K
, "win2k" },
841 Do you want session setups at user level security with a invalid
842 password to be rejected or allowed in as guest? WinNT rejects them
843 but it can be a pain as it means "net view" needs to use a password
845 You have 3 choices in the setting of map_to_guest:
847 "Never" means session setups with an invalid password
848 are rejected. This is the default.
850 "Bad User" means session setups with an invalid password
851 are rejected, unless the username does not exist, in which case it
852 is treated as a guest login
854 "Bad Password" means session setups with an invalid password
855 are treated as a guest login
857 Note that map_to_guest only has an effect in user or server
861 static const struct enum_list enum_map_to_guest
[] = {
862 {NEVER_MAP_TO_GUEST
, "Never"},
863 {MAP_TO_GUEST_ON_BAD_USER
, "Bad User"},
864 {MAP_TO_GUEST_ON_BAD_PASSWORD
, "Bad Password"},
865 {MAP_TO_GUEST_ON_BAD_UID
, "Bad Uid"},
869 /* Config backend options */
871 static const struct enum_list enum_config_backend
[] = {
872 {CONFIG_BACKEND_FILE
, "file"},
873 {CONFIG_BACKEND_REGISTRY
, "registry"},
877 /* ADS kerberos ticket verification options */
879 static const struct enum_list enum_kerberos_method
[] = {
880 {KERBEROS_VERIFY_SECRETS
, "default"},
881 {KERBEROS_VERIFY_SECRETS
, "secrets only"},
882 {KERBEROS_VERIFY_SYSTEM_KEYTAB
, "system keytab"},
883 {KERBEROS_VERIFY_DEDICATED_KEYTAB
, "dedicated keytab"},
884 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB
, "secrets and keytab"},
888 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
890 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
891 * screen in SWAT. This is used to exclude parameters as well as to squash all
892 * parameters that have been duplicated by pseudonyms.
894 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
895 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
896 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
899 * NOTE2: Handling of duplicated (synonym) parameters:
900 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
901 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
902 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
903 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
906 static struct parm_struct parm_table
[] = {
907 {N_("Base Options"), P_SEP
, P_SEPARATOR
},
910 .label
= "dos charset",
913 .ptr
= &Globals
.dos_charset
,
914 .special
= handle_charset
,
916 .flags
= FLAG_ADVANCED
919 .label
= "unix charset",
922 .ptr
= &Globals
.unix_charset
,
923 .special
= handle_charset
,
925 .flags
= FLAG_ADVANCED
928 .label
= "display charset",
931 .ptr
= &Globals
.display_charset
,
932 .special
= handle_charset
,
934 .flags
= FLAG_ADVANCED
940 .ptr
= &sDefault
.comment
,
943 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
949 .ptr
= &sDefault
.szPath
,
952 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
955 .label
= "directory",
958 .ptr
= &sDefault
.szPath
,
964 .label
= "workgroup",
967 .ptr
= &Globals
.szWorkgroup
,
968 .special
= handle_workgroup
,
970 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
977 .ptr
= &Globals
.szRealm
,
980 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
984 .label
= "netbios name",
987 .ptr
= &Globals
.szNetbiosName
,
988 .special
= handle_netbios_name
,
990 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
993 .label
= "netbios aliases",
996 .ptr
= &Globals
.szNetbiosAliases
,
997 .special
= handle_netbios_aliases
,
999 .flags
= FLAG_ADVANCED
,
1002 .label
= "netbios scope",
1004 .p_class
= P_GLOBAL
,
1005 .ptr
= &Globals
.szNetbiosScope
,
1006 .special
= handle_netbios_scope
,
1008 .flags
= FLAG_ADVANCED
,
1011 .label
= "server string",
1013 .p_class
= P_GLOBAL
,
1014 .ptr
= &Globals
.szServerString
,
1017 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1020 .label
= "interfaces",
1022 .p_class
= P_GLOBAL
,
1023 .ptr
= &Globals
.szInterfaces
,
1026 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1029 .label
= "bind interfaces only",
1031 .p_class
= P_GLOBAL
,
1032 .ptr
= &Globals
.bBindInterfacesOnly
,
1035 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1038 .label
= "config backend",
1040 .p_class
= P_GLOBAL
,
1041 .ptr
= &Globals
.ConfigBackend
,
1043 .enum_list
= enum_config_backend
,
1044 .flags
= FLAG_ADVANCED
,
1047 {N_("Security Options"), P_SEP
, P_SEPARATOR
},
1050 .label
= "security",
1052 .p_class
= P_GLOBAL
,
1053 .ptr
= &Globals
.security
,
1055 .enum_list
= enum_security
,
1056 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1059 .label
= "auth methods",
1061 .p_class
= P_GLOBAL
,
1062 .ptr
= &Globals
.AuthMethods
,
1065 .flags
= FLAG_ADVANCED
,
1068 .label
= "encrypt passwords",
1070 .p_class
= P_GLOBAL
,
1071 .ptr
= &Globals
.bEncryptPasswords
,
1074 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1077 .label
= "update encrypted",
1079 .p_class
= P_GLOBAL
,
1080 .ptr
= &Globals
.bUpdateEncrypt
,
1083 .flags
= FLAG_ADVANCED
,
1086 .label
= "client schannel",
1088 .p_class
= P_GLOBAL
,
1089 .ptr
= &Globals
.clientSchannel
,
1091 .enum_list
= enum_bool_auto
,
1092 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1095 .label
= "server schannel",
1097 .p_class
= P_GLOBAL
,
1098 .ptr
= &Globals
.serverSchannel
,
1100 .enum_list
= enum_bool_auto
,
1101 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1104 .label
= "allow trusted domains",
1106 .p_class
= P_GLOBAL
,
1107 .ptr
= &Globals
.bAllowTrustedDomains
,
1110 .flags
= FLAG_ADVANCED
,
1113 .label
= "map to guest",
1115 .p_class
= P_GLOBAL
,
1116 .ptr
= &Globals
.map_to_guest
,
1118 .enum_list
= enum_map_to_guest
,
1119 .flags
= FLAG_ADVANCED
,
1122 .label
= "null passwords",
1124 .p_class
= P_GLOBAL
,
1125 .ptr
= &Globals
.bNullPasswords
,
1128 .flags
= FLAG_ADVANCED
,
1131 .label
= "obey pam restrictions",
1133 .p_class
= P_GLOBAL
,
1134 .ptr
= &Globals
.bObeyPamRestrictions
,
1137 .flags
= FLAG_ADVANCED
,
1140 .label
= "password server",
1142 .p_class
= P_GLOBAL
,
1143 .ptr
= &Globals
.szPasswordServer
,
1146 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1149 .label
= "smb passwd file",
1151 .p_class
= P_GLOBAL
,
1152 .ptr
= &Globals
.szSMBPasswdFile
,
1155 .flags
= FLAG_ADVANCED
,
1158 .label
= "private dir",
1160 .p_class
= P_GLOBAL
,
1161 .ptr
= &Globals
.szPrivateDir
,
1164 .flags
= FLAG_ADVANCED
,
1167 .label
= "passdb backend",
1169 .p_class
= P_GLOBAL
,
1170 .ptr
= &Globals
.szPassdbBackend
,
1173 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1176 .label
= "algorithmic rid base",
1178 .p_class
= P_GLOBAL
,
1179 .ptr
= &Globals
.AlgorithmicRidBase
,
1182 .flags
= FLAG_ADVANCED
,
1185 .label
= "root directory",
1187 .p_class
= P_GLOBAL
,
1188 .ptr
= &Globals
.szRootdir
,
1191 .flags
= FLAG_ADVANCED
,
1194 .label
= "root dir",
1196 .p_class
= P_GLOBAL
,
1197 .ptr
= &Globals
.szRootdir
,
1205 .p_class
= P_GLOBAL
,
1206 .ptr
= &Globals
.szRootdir
,
1212 .label
= "guest account",
1214 .p_class
= P_GLOBAL
,
1215 .ptr
= &Globals
.szGuestaccount
,
1218 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1221 .label
= "enable privileges",
1223 .p_class
= P_GLOBAL
,
1224 .ptr
= &Globals
.bEnablePrivileges
,
1227 .flags
= FLAG_ADVANCED
,
1231 .label
= "pam password change",
1233 .p_class
= P_GLOBAL
,
1234 .ptr
= &Globals
.bPamPasswordChange
,
1237 .flags
= FLAG_ADVANCED
,
1240 .label
= "passwd program",
1242 .p_class
= P_GLOBAL
,
1243 .ptr
= &Globals
.szPasswdProgram
,
1246 .flags
= FLAG_ADVANCED
,
1249 .label
= "passwd chat",
1251 .p_class
= P_GLOBAL
,
1252 .ptr
= &Globals
.szPasswdChat
,
1255 .flags
= FLAG_ADVANCED
,
1258 .label
= "passwd chat debug",
1260 .p_class
= P_GLOBAL
,
1261 .ptr
= &Globals
.bPasswdChatDebug
,
1264 .flags
= FLAG_ADVANCED
,
1267 .label
= "passwd chat timeout",
1269 .p_class
= P_GLOBAL
,
1270 .ptr
= &Globals
.iPasswdChatTimeout
,
1273 .flags
= FLAG_ADVANCED
,
1276 .label
= "check password script",
1278 .p_class
= P_GLOBAL
,
1279 .ptr
= &Globals
.szCheckPasswordScript
,
1282 .flags
= FLAG_ADVANCED
,
1285 .label
= "username map",
1287 .p_class
= P_GLOBAL
,
1288 .ptr
= &Globals
.szUsernameMap
,
1291 .flags
= FLAG_ADVANCED
,
1294 .label
= "password level",
1296 .p_class
= P_GLOBAL
,
1297 .ptr
= &Globals
.pwordlevel
,
1300 .flags
= FLAG_ADVANCED
,
1303 .label
= "username level",
1305 .p_class
= P_GLOBAL
,
1306 .ptr
= &Globals
.unamelevel
,
1309 .flags
= FLAG_ADVANCED
,
1312 .label
= "unix password sync",
1314 .p_class
= P_GLOBAL
,
1315 .ptr
= &Globals
.bUnixPasswdSync
,
1318 .flags
= FLAG_ADVANCED
,
1321 .label
= "restrict anonymous",
1323 .p_class
= P_GLOBAL
,
1324 .ptr
= &Globals
.restrict_anonymous
,
1327 .flags
= FLAG_ADVANCED
,
1330 .label
= "lanman auth",
1332 .p_class
= P_GLOBAL
,
1333 .ptr
= &Globals
.bLanmanAuth
,
1336 .flags
= FLAG_ADVANCED
,
1339 .label
= "ntlm auth",
1341 .p_class
= P_GLOBAL
,
1342 .ptr
= &Globals
.bNTLMAuth
,
1345 .flags
= FLAG_ADVANCED
,
1348 .label
= "client NTLMv2 auth",
1350 .p_class
= P_GLOBAL
,
1351 .ptr
= &Globals
.bClientNTLMv2Auth
,
1354 .flags
= FLAG_ADVANCED
,
1357 .label
= "client lanman auth",
1359 .p_class
= P_GLOBAL
,
1360 .ptr
= &Globals
.bClientLanManAuth
,
1363 .flags
= FLAG_ADVANCED
,
1366 .label
= "client plaintext auth",
1368 .p_class
= P_GLOBAL
,
1369 .ptr
= &Globals
.bClientPlaintextAuth
,
1372 .flags
= FLAG_ADVANCED
,
1375 .label
= "username",
1378 .ptr
= &sDefault
.szUsername
,
1381 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1387 .ptr
= &sDefault
.szUsername
,
1396 .ptr
= &sDefault
.szUsername
,
1402 .label
= "invalid users",
1405 .ptr
= &sDefault
.szInvalidUsers
,
1408 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1411 .label
= "valid users",
1414 .ptr
= &sDefault
.szValidUsers
,
1417 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1420 .label
= "admin users",
1423 .ptr
= &sDefault
.szAdminUsers
,
1426 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1429 .label
= "read list",
1432 .ptr
= &sDefault
.readlist
,
1435 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1438 .label
= "write list",
1441 .ptr
= &sDefault
.writelist
,
1444 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1447 .label
= "printer admin",
1450 .ptr
= &sDefault
.printer_admin
,
1453 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_PRINT
| FLAG_DEPRECATED
,
1456 .label
= "force user",
1459 .ptr
= &sDefault
.force_user
,
1462 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1465 .label
= "force group",
1468 .ptr
= &sDefault
.force_group
,
1471 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1477 .ptr
= &sDefault
.force_group
,
1480 .flags
= FLAG_ADVANCED
,
1483 .label
= "read only",
1486 .ptr
= &sDefault
.bRead_only
,
1489 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
,
1492 .label
= "write ok",
1495 .ptr
= &sDefault
.bRead_only
,
1501 .label
= "writeable",
1504 .ptr
= &sDefault
.bRead_only
,
1510 .label
= "writable",
1513 .ptr
= &sDefault
.bRead_only
,
1519 .label
= "acl check permissions",
1522 .ptr
= &sDefault
.bAclCheckPermissions
,
1525 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1528 .label
= "acl group control",
1531 .ptr
= &sDefault
.bAclGroupControl
,
1534 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1537 .label
= "acl map full control",
1540 .ptr
= &sDefault
.bAclMapFullControl
,
1543 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1546 .label
= "create mask",
1549 .ptr
= &sDefault
.iCreate_mask
,
1552 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1555 .label
= "create mode",
1558 .ptr
= &sDefault
.iCreate_mask
,
1564 .label
= "force create mode",
1567 .ptr
= &sDefault
.iCreate_force_mode
,
1570 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1573 .label
= "security mask",
1576 .ptr
= &sDefault
.iSecurity_mask
,
1579 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1582 .label
= "force security mode",
1585 .ptr
= &sDefault
.iSecurity_force_mode
,
1588 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1591 .label
= "directory mask",
1594 .ptr
= &sDefault
.iDir_mask
,
1597 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1600 .label
= "directory mode",
1603 .ptr
= &sDefault
.iDir_mask
,
1606 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1609 .label
= "force directory mode",
1612 .ptr
= &sDefault
.iDir_force_mode
,
1615 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1618 .label
= "directory security mask",
1621 .ptr
= &sDefault
.iDir_Security_mask
,
1624 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1627 .label
= "force directory security mode",
1630 .ptr
= &sDefault
.iDir_Security_force_mode
,
1633 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1636 .label
= "force unknown acl user",
1639 .ptr
= &sDefault
.bForceUnknownAclUser
,
1642 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1645 .label
= "inherit permissions",
1648 .ptr
= &sDefault
.bInheritPerms
,
1651 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1654 .label
= "inherit acls",
1657 .ptr
= &sDefault
.bInheritACLS
,
1660 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1663 .label
= "inherit owner",
1666 .ptr
= &sDefault
.bInheritOwner
,
1669 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1672 .label
= "guest only",
1675 .ptr
= &sDefault
.bGuest_only
,
1678 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1681 .label
= "only guest",
1684 .ptr
= &sDefault
.bGuest_only
,
1690 .label
= "administrative share",
1693 .ptr
= &sDefault
.bAdministrative_share
,
1696 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1700 .label
= "guest ok",
1703 .ptr
= &sDefault
.bGuest_ok
,
1706 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1712 .ptr
= &sDefault
.bGuest_ok
,
1718 .label
= "only user",
1721 .ptr
= &sDefault
.bOnlyUser
,
1724 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_DEPRECATED
,
1727 .label
= "hosts allow",
1730 .ptr
= &sDefault
.szHostsallow
,
1733 .flags
= FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1736 .label
= "allow hosts",
1739 .ptr
= &sDefault
.szHostsallow
,
1745 .label
= "hosts deny",
1748 .ptr
= &sDefault
.szHostsdeny
,
1751 .flags
= FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1754 .label
= "deny hosts",
1757 .ptr
= &sDefault
.szHostsdeny
,
1763 .label
= "preload modules",
1765 .p_class
= P_GLOBAL
,
1766 .ptr
= &Globals
.szPreloadModules
,
1769 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1772 .label
= "dedicated keytab file",
1774 .p_class
= P_GLOBAL
,
1775 .ptr
= &Globals
.szDedicatedKeytabFile
,
1778 .flags
= FLAG_ADVANCED
,
1781 .label
= "kerberos method",
1783 .p_class
= P_GLOBAL
,
1784 .ptr
= &Globals
.iKerberosMethod
,
1786 .enum_list
= enum_kerberos_method
,
1787 .flags
= FLAG_ADVANCED
,
1790 .label
= "map untrusted to domain",
1792 .p_class
= P_GLOBAL
,
1793 .ptr
= &Globals
.bMapUntrustedToDomain
,
1796 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1800 {N_("Logging Options"), P_SEP
, P_SEPARATOR
},
1803 .label
= "log level",
1805 .p_class
= P_GLOBAL
,
1806 .ptr
= &Globals
.szLogLevel
,
1807 .special
= handle_debug_list
,
1809 .flags
= FLAG_ADVANCED
,
1812 .label
= "debuglevel",
1814 .p_class
= P_GLOBAL
,
1815 .ptr
= &Globals
.szLogLevel
,
1816 .special
= handle_debug_list
,
1823 .p_class
= P_GLOBAL
,
1824 .ptr
= &Globals
.syslog
,
1827 .flags
= FLAG_ADVANCED
,
1830 .label
= "syslog only",
1832 .p_class
= P_GLOBAL
,
1833 .ptr
= &Globals
.bSyslogOnly
,
1836 .flags
= FLAG_ADVANCED
,
1839 .label
= "log file",
1841 .p_class
= P_GLOBAL
,
1842 .ptr
= &Globals
.szLogFile
,
1845 .flags
= FLAG_ADVANCED
,
1848 .label
= "max log size",
1850 .p_class
= P_GLOBAL
,
1851 .ptr
= &Globals
.max_log_size
,
1854 .flags
= FLAG_ADVANCED
,
1857 .label
= "debug timestamp",
1859 .p_class
= P_GLOBAL
,
1860 .ptr
= &Globals
.bTimestampLogs
,
1863 .flags
= FLAG_ADVANCED
,
1866 .label
= "timestamp logs",
1868 .p_class
= P_GLOBAL
,
1869 .ptr
= &Globals
.bTimestampLogs
,
1872 .flags
= FLAG_ADVANCED
,
1875 .label
= "debug prefix timestamp",
1877 .p_class
= P_GLOBAL
,
1878 .ptr
= &Globals
.bDebugPrefixTimestamp
,
1881 .flags
= FLAG_ADVANCED
,
1884 .label
= "debug hires timestamp",
1886 .p_class
= P_GLOBAL
,
1887 .ptr
= &Globals
.bDebugHiresTimestamp
,
1890 .flags
= FLAG_ADVANCED
,
1893 .label
= "debug pid",
1895 .p_class
= P_GLOBAL
,
1896 .ptr
= &Globals
.bDebugPid
,
1899 .flags
= FLAG_ADVANCED
,
1902 .label
= "debug uid",
1904 .p_class
= P_GLOBAL
,
1905 .ptr
= &Globals
.bDebugUid
,
1908 .flags
= FLAG_ADVANCED
,
1911 .label
= "debug class",
1913 .p_class
= P_GLOBAL
,
1914 .ptr
= &Globals
.bDebugClass
,
1917 .flags
= FLAG_ADVANCED
,
1920 .label
= "enable core files",
1922 .p_class
= P_GLOBAL
,
1923 .ptr
= &Globals
.bEnableCoreFiles
,
1926 .flags
= FLAG_ADVANCED
,
1929 {N_("Protocol Options"), P_SEP
, P_SEPARATOR
},
1932 .label
= "allocation roundup size",
1935 .ptr
= &sDefault
.iallocation_roundup_size
,
1938 .flags
= FLAG_ADVANCED
,
1941 .label
= "aio read size",
1944 .ptr
= &sDefault
.iAioReadSize
,
1947 .flags
= FLAG_ADVANCED
,
1950 .label
= "aio write size",
1953 .ptr
= &sDefault
.iAioWriteSize
,
1956 .flags
= FLAG_ADVANCED
,
1959 .label
= "aio write behind",
1962 .ptr
= &sDefault
.szAioWriteBehind
,
1965 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
1968 .label
= "smb ports",
1970 .p_class
= P_GLOBAL
,
1971 .ptr
= &Globals
.smb_ports
,
1974 .flags
= FLAG_ADVANCED
,
1977 .label
= "large readwrite",
1979 .p_class
= P_GLOBAL
,
1980 .ptr
= &Globals
.bLargeReadwrite
,
1983 .flags
= FLAG_ADVANCED
,
1986 .label
= "max protocol",
1988 .p_class
= P_GLOBAL
,
1989 .ptr
= &Globals
.maxprotocol
,
1991 .enum_list
= enum_protocol
,
1992 .flags
= FLAG_ADVANCED
,
1995 .label
= "protocol",
1997 .p_class
= P_GLOBAL
,
1998 .ptr
= &Globals
.maxprotocol
,
2000 .enum_list
= enum_protocol
,
2001 .flags
= FLAG_ADVANCED
,
2004 .label
= "min protocol",
2006 .p_class
= P_GLOBAL
,
2007 .ptr
= &Globals
.minprotocol
,
2009 .enum_list
= enum_protocol
,
2010 .flags
= FLAG_ADVANCED
,
2013 .label
= "min receivefile size",
2015 .p_class
= P_GLOBAL
,
2016 .ptr
= &Globals
.iminreceivefile
,
2019 .flags
= FLAG_ADVANCED
,
2022 .label
= "read raw",
2024 .p_class
= P_GLOBAL
,
2025 .ptr
= &Globals
.bReadRaw
,
2028 .flags
= FLAG_ADVANCED
,
2031 .label
= "write raw",
2033 .p_class
= P_GLOBAL
,
2034 .ptr
= &Globals
.bWriteRaw
,
2037 .flags
= FLAG_ADVANCED
,
2040 .label
= "disable netbios",
2042 .p_class
= P_GLOBAL
,
2043 .ptr
= &Globals
.bDisableNetbios
,
2046 .flags
= FLAG_ADVANCED
,
2049 .label
= "reset on zero vc",
2051 .p_class
= P_GLOBAL
,
2052 .ptr
= &Globals
.bResetOnZeroVC
,
2055 .flags
= FLAG_ADVANCED
,
2058 .label
= "acl compatibility",
2060 .p_class
= P_GLOBAL
,
2061 .ptr
= &Globals
.iAclCompat
,
2063 .enum_list
= enum_acl_compat_vals
,
2064 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2067 .label
= "defer sharing violations",
2069 .p_class
= P_GLOBAL
,
2070 .ptr
= &Globals
.bDeferSharingViolations
,
2073 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2076 .label
= "ea support",
2079 .ptr
= &sDefault
.bEASupport
,
2082 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2085 .label
= "nt acl support",
2088 .ptr
= &sDefault
.bNTAclSupport
,
2091 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2094 .label
= "nt pipe support",
2096 .p_class
= P_GLOBAL
,
2097 .ptr
= &Globals
.bNTPipeSupport
,
2100 .flags
= FLAG_ADVANCED
,
2103 .label
= "nt status support",
2105 .p_class
= P_GLOBAL
,
2106 .ptr
= &Globals
.bNTStatusSupport
,
2109 .flags
= FLAG_ADVANCED
,
2112 .label
= "profile acls",
2115 .ptr
= &sDefault
.bProfileAcls
,
2118 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
2121 .label
= "announce version",
2123 .p_class
= P_GLOBAL
,
2124 .ptr
= &Globals
.szAnnounceVersion
,
2127 .flags
= FLAG_ADVANCED
,
2130 .label
= "announce as",
2132 .p_class
= P_GLOBAL
,
2133 .ptr
= &Globals
.announce_as
,
2135 .enum_list
= enum_announce_as
,
2136 .flags
= FLAG_ADVANCED
,
2139 .label
= "map acl inherit",
2142 .ptr
= &sDefault
.bMap_acl_inherit
,
2145 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2148 .label
= "afs share",
2151 .ptr
= &sDefault
.bAfs_Share
,
2154 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2159 .p_class
= P_GLOBAL
,
2160 .ptr
= &Globals
.max_mux
,
2163 .flags
= FLAG_ADVANCED
,
2166 .label
= "max xmit",
2168 .p_class
= P_GLOBAL
,
2169 .ptr
= &Globals
.max_xmit
,
2172 .flags
= FLAG_ADVANCED
,
2175 .label
= "name resolve order",
2177 .p_class
= P_GLOBAL
,
2178 .ptr
= &Globals
.szNameResolveOrder
,
2181 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
2186 .p_class
= P_GLOBAL
,
2187 .ptr
= &Globals
.max_ttl
,
2190 .flags
= FLAG_ADVANCED
,
2193 .label
= "max wins ttl",
2195 .p_class
= P_GLOBAL
,
2196 .ptr
= &Globals
.max_wins_ttl
,
2199 .flags
= FLAG_ADVANCED
,
2202 .label
= "min wins ttl",
2204 .p_class
= P_GLOBAL
,
2205 .ptr
= &Globals
.min_wins_ttl
,
2208 .flags
= FLAG_ADVANCED
,
2211 .label
= "time server",
2213 .p_class
= P_GLOBAL
,
2214 .ptr
= &Globals
.bTimeServer
,
2217 .flags
= FLAG_ADVANCED
,
2220 .label
= "unix extensions",
2222 .p_class
= P_GLOBAL
,
2223 .ptr
= &Globals
.bUnixExtensions
,
2226 .flags
= FLAG_ADVANCED
,
2229 .label
= "use spnego",
2231 .p_class
= P_GLOBAL
,
2232 .ptr
= &Globals
.bUseSpnego
,
2235 .flags
= FLAG_ADVANCED
,
2238 .label
= "client signing",
2240 .p_class
= P_GLOBAL
,
2241 .ptr
= &Globals
.client_signing
,
2243 .enum_list
= enum_smb_signing_vals
,
2244 .flags
= FLAG_ADVANCED
,
2247 .label
= "server signing",
2249 .p_class
= P_GLOBAL
,
2250 .ptr
= &Globals
.server_signing
,
2252 .enum_list
= enum_smb_signing_vals
,
2253 .flags
= FLAG_ADVANCED
,
2256 .label
= "smb encrypt",
2259 .ptr
= &sDefault
.ismb_encrypt
,
2261 .enum_list
= enum_smb_signing_vals
,
2262 .flags
= FLAG_ADVANCED
,
2265 .label
= "client use spnego",
2267 .p_class
= P_GLOBAL
,
2268 .ptr
= &Globals
.bClientUseSpnego
,
2271 .flags
= FLAG_ADVANCED
,
2274 .label
= "client ldap sasl wrapping",
2276 .p_class
= P_GLOBAL
,
2277 .ptr
= &Globals
.client_ldap_sasl_wrapping
,
2279 .enum_list
= enum_ldap_sasl_wrapping
,
2280 .flags
= FLAG_ADVANCED
,
2283 .label
= "enable asu support",
2285 .p_class
= P_GLOBAL
,
2286 .ptr
= &Globals
.bASUSupport
,
2289 .flags
= FLAG_ADVANCED
,
2292 .label
= "svcctl list",
2294 .p_class
= P_GLOBAL
,
2295 .ptr
= &Globals
.szServicesList
,
2298 .flags
= FLAG_ADVANCED
,
2301 {N_("Tuning Options"), P_SEP
, P_SEPARATOR
},
2304 .label
= "block size",
2307 .ptr
= &sDefault
.iBlock_size
,
2310 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2313 .label
= "deadtime",
2315 .p_class
= P_GLOBAL
,
2316 .ptr
= &Globals
.deadtime
,
2319 .flags
= FLAG_ADVANCED
,
2322 .label
= "getwd cache",
2324 .p_class
= P_GLOBAL
,
2325 .ptr
= &Globals
.getwd_cache
,
2328 .flags
= FLAG_ADVANCED
,
2331 .label
= "keepalive",
2333 .p_class
= P_GLOBAL
,
2334 .ptr
= &Globals
.iKeepalive
,
2337 .flags
= FLAG_ADVANCED
,
2340 .label
= "change notify",
2343 .ptr
= &sDefault
.bChangeNotify
,
2346 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2349 .label
= "directory name cache size",
2352 .ptr
= &sDefault
.iDirectoryNameCacheSize
,
2355 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2358 .label
= "kernel change notify",
2361 .ptr
= &sDefault
.bKernelChangeNotify
,
2364 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2367 .label
= "lpq cache time",
2369 .p_class
= P_GLOBAL
,
2370 .ptr
= &Globals
.lpqcachetime
,
2373 .flags
= FLAG_ADVANCED
,
2376 .label
= "max smbd processes",
2378 .p_class
= P_GLOBAL
,
2379 .ptr
= &Globals
.iMaxSmbdProcesses
,
2382 .flags
= FLAG_ADVANCED
,
2385 .label
= "max connections",
2388 .ptr
= &sDefault
.iMaxConnections
,
2391 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2394 .label
= "paranoid server security",
2396 .p_class
= P_GLOBAL
,
2397 .ptr
= &Globals
.paranoid_server_security
,
2400 .flags
= FLAG_ADVANCED
,
2403 .label
= "max disk size",
2405 .p_class
= P_GLOBAL
,
2406 .ptr
= &Globals
.maxdisksize
,
2409 .flags
= FLAG_ADVANCED
,
2412 .label
= "max open files",
2414 .p_class
= P_GLOBAL
,
2415 .ptr
= &Globals
.max_open_files
,
2418 .flags
= FLAG_ADVANCED
,
2421 .label
= "min print space",
2424 .ptr
= &sDefault
.iMinPrintSpace
,
2427 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2430 .label
= "socket options",
2432 .p_class
= P_GLOBAL
,
2433 .ptr
= &Globals
.szSocketOptions
,
2436 .flags
= FLAG_ADVANCED
,
2439 .label
= "strict allocate",
2442 .ptr
= &sDefault
.bStrictAllocate
,
2445 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2448 .label
= "strict sync",
2451 .ptr
= &sDefault
.bStrictSync
,
2454 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2457 .label
= "sync always",
2460 .ptr
= &sDefault
.bSyncAlways
,
2463 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2466 .label
= "use mmap",
2468 .p_class
= P_GLOBAL
,
2469 .ptr
= &Globals
.bUseMmap
,
2472 .flags
= FLAG_ADVANCED
,
2475 .label
= "use sendfile",
2478 .ptr
= &sDefault
.bUseSendfile
,
2481 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2484 .label
= "hostname lookups",
2486 .p_class
= P_GLOBAL
,
2487 .ptr
= &Globals
.bHostnameLookups
,
2490 .flags
= FLAG_ADVANCED
,
2493 .label
= "write cache size",
2496 .ptr
= &sDefault
.iWriteCacheSize
,
2499 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_DEPRECATED
,
2502 .label
= "name cache timeout",
2504 .p_class
= P_GLOBAL
,
2505 .ptr
= &Globals
.name_cache_timeout
,
2508 .flags
= FLAG_ADVANCED
,
2511 .label
= "ctdbd socket",
2513 .p_class
= P_GLOBAL
,
2514 .ptr
= &Globals
.ctdbdSocket
,
2517 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2520 .label
= "cluster addresses",
2522 .p_class
= P_GLOBAL
,
2523 .ptr
= &Globals
.szClusterAddresses
,
2526 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2529 .label
= "clustering",
2531 .p_class
= P_GLOBAL
,
2532 .ptr
= &Globals
.clustering
,
2535 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2538 {N_("Printing Options"), P_SEP
, P_SEPARATOR
},
2541 .label
= "max reported print jobs",
2544 .ptr
= &sDefault
.iMaxReportedPrintJobs
,
2547 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2550 .label
= "max print jobs",
2553 .ptr
= &sDefault
.iMaxPrintJobs
,
2556 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2559 .label
= "load printers",
2561 .p_class
= P_GLOBAL
,
2562 .ptr
= &Globals
.bLoadPrinters
,
2565 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2568 .label
= "printcap cache time",
2570 .p_class
= P_GLOBAL
,
2571 .ptr
= &Globals
.PrintcapCacheTime
,
2574 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2577 .label
= "printcap name",
2579 .p_class
= P_GLOBAL
,
2580 .ptr
= &Globals
.szPrintcapname
,
2583 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2586 .label
= "printcap",
2588 .p_class
= P_GLOBAL
,
2589 .ptr
= &Globals
.szPrintcapname
,
2595 .label
= "printable",
2598 .ptr
= &sDefault
.bPrint_ok
,
2601 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2604 .label
= "print ok",
2607 .ptr
= &sDefault
.bPrint_ok
,
2613 .label
= "printing",
2616 .ptr
= &sDefault
.iPrinting
,
2617 .special
= handle_printing
,
2618 .enum_list
= enum_printing
,
2619 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2622 .label
= "cups options",
2625 .ptr
= &sDefault
.szCupsOptions
,
2628 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2631 .label
= "cups server",
2633 .p_class
= P_GLOBAL
,
2634 .ptr
= &Globals
.szCupsServer
,
2637 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2640 .label
= "cups encrypt",
2642 .p_class
= P_GLOBAL
,
2643 .ptr
= &Globals
.CupsEncrypt
,
2645 .enum_list
= enum_bool_auto
,
2646 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2650 .label
= "cups connection timeout",
2652 .p_class
= P_GLOBAL
,
2653 .ptr
= &Globals
.cups_connection_timeout
,
2656 .flags
= FLAG_ADVANCED
,
2659 .label
= "iprint server",
2661 .p_class
= P_GLOBAL
,
2662 .ptr
= &Globals
.szIPrintServer
,
2665 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2668 .label
= "print command",
2671 .ptr
= &sDefault
.szPrintcommand
,
2674 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2677 .label
= "disable spoolss",
2679 .p_class
= P_GLOBAL
,
2680 .ptr
= &Globals
.bDisableSpoolss
,
2683 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2686 .label
= "enable spoolss",
2688 .p_class
= P_GLOBAL
,
2689 .ptr
= &Globals
.bDisableSpoolss
,
2695 .label
= "lpq command",
2698 .ptr
= &sDefault
.szLpqcommand
,
2701 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2704 .label
= "lprm command",
2707 .ptr
= &sDefault
.szLprmcommand
,
2710 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2713 .label
= "lppause command",
2716 .ptr
= &sDefault
.szLppausecommand
,
2719 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2722 .label
= "lpresume command",
2725 .ptr
= &sDefault
.szLpresumecommand
,
2728 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2731 .label
= "queuepause command",
2734 .ptr
= &sDefault
.szQueuepausecommand
,
2737 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2740 .label
= "queueresume command",
2743 .ptr
= &sDefault
.szQueueresumecommand
,
2746 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2749 .label
= "addport command",
2751 .p_class
= P_GLOBAL
,
2752 .ptr
= &Globals
.szAddPortCommand
,
2755 .flags
= FLAG_ADVANCED
,
2758 .label
= "enumports command",
2760 .p_class
= P_GLOBAL
,
2761 .ptr
= &Globals
.szEnumPortsCommand
,
2764 .flags
= FLAG_ADVANCED
,
2767 .label
= "addprinter command",
2769 .p_class
= P_GLOBAL
,
2770 .ptr
= &Globals
.szAddPrinterCommand
,
2773 .flags
= FLAG_ADVANCED
,
2776 .label
= "deleteprinter command",
2778 .p_class
= P_GLOBAL
,
2779 .ptr
= &Globals
.szDeletePrinterCommand
,
2782 .flags
= FLAG_ADVANCED
,
2785 .label
= "show add printer wizard",
2787 .p_class
= P_GLOBAL
,
2788 .ptr
= &Globals
.bMsAddPrinterWizard
,
2791 .flags
= FLAG_ADVANCED
,
2794 .label
= "os2 driver map",
2796 .p_class
= P_GLOBAL
,
2797 .ptr
= &Globals
.szOs2DriverMap
,
2800 .flags
= FLAG_ADVANCED
,
2804 .label
= "printer name",
2807 .ptr
= &sDefault
.szPrintername
,
2810 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2816 .ptr
= &sDefault
.szPrintername
,
2822 .label
= "use client driver",
2825 .ptr
= &sDefault
.bUseClientDriver
,
2828 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2831 .label
= "default devmode",
2834 .ptr
= &sDefault
.bDefaultDevmode
,
2837 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2840 .label
= "force printername",
2843 .ptr
= &sDefault
.bForcePrintername
,
2846 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2849 .label
= "printjob username",
2852 .ptr
= &sDefault
.szPrintjobUsername
,
2855 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2858 {N_("Filename Handling"), P_SEP
, P_SEPARATOR
},
2861 .label
= "mangling method",
2863 .p_class
= P_GLOBAL
,
2864 .ptr
= &Globals
.szManglingMethod
,
2867 .flags
= FLAG_ADVANCED
,
2870 .label
= "mangle prefix",
2872 .p_class
= P_GLOBAL
,
2873 .ptr
= &Globals
.mangle_prefix
,
2876 .flags
= FLAG_ADVANCED
,
2880 .label
= "default case",
2883 .ptr
= &sDefault
.iDefaultCase
,
2885 .enum_list
= enum_case
,
2886 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2889 .label
= "case sensitive",
2892 .ptr
= &sDefault
.iCaseSensitive
,
2894 .enum_list
= enum_bool_auto
,
2895 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2898 .label
= "casesignames",
2901 .ptr
= &sDefault
.iCaseSensitive
,
2903 .enum_list
= enum_bool_auto
,
2904 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
| FLAG_HIDE
,
2907 .label
= "preserve case",
2910 .ptr
= &sDefault
.bCasePreserve
,
2913 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2916 .label
= "short preserve case",
2919 .ptr
= &sDefault
.bShortCasePreserve
,
2922 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2925 .label
= "mangling char",
2928 .ptr
= &sDefault
.magic_char
,
2931 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2934 .label
= "hide dot files",
2937 .ptr
= &sDefault
.bHideDotFiles
,
2940 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2943 .label
= "hide special files",
2946 .ptr
= &sDefault
.bHideSpecialFiles
,
2949 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2952 .label
= "hide unreadable",
2955 .ptr
= &sDefault
.bHideUnReadable
,
2958 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2961 .label
= "hide unwriteable files",
2964 .ptr
= &sDefault
.bHideUnWriteableFiles
,
2967 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2970 .label
= "delete veto files",
2973 .ptr
= &sDefault
.bDeleteVetoFiles
,
2976 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2979 .label
= "veto files",
2982 .ptr
= &sDefault
.szVetoFiles
,
2985 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2988 .label
= "hide files",
2991 .ptr
= &sDefault
.szHideFiles
,
2994 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2997 .label
= "veto oplock files",
3000 .ptr
= &sDefault
.szVetoOplockFiles
,
3003 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3006 .label
= "map archive",
3009 .ptr
= &sDefault
.bMap_archive
,
3012 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3015 .label
= "map hidden",
3018 .ptr
= &sDefault
.bMap_hidden
,
3021 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3024 .label
= "map system",
3027 .ptr
= &sDefault
.bMap_system
,
3030 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3033 .label
= "map readonly",
3036 .ptr
= &sDefault
.iMap_readonly
,
3038 .enum_list
= enum_map_readonly
,
3039 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3042 .label
= "mangled names",
3045 .ptr
= &sDefault
.bMangledNames
,
3048 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3051 .label
= "max stat cache size",
3053 .p_class
= P_GLOBAL
,
3054 .ptr
= &Globals
.iMaxStatCacheSize
,
3057 .flags
= FLAG_ADVANCED
,
3060 .label
= "stat cache",
3062 .p_class
= P_GLOBAL
,
3063 .ptr
= &Globals
.bStatCache
,
3066 .flags
= FLAG_ADVANCED
,
3069 .label
= "store dos attributes",
3072 .ptr
= &sDefault
.bStoreDosAttributes
,
3075 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3078 .label
= "dmapi support",
3081 .ptr
= &sDefault
.bDmapiSupport
,
3084 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3088 {N_("Domain Options"), P_SEP
, P_SEPARATOR
},
3091 .label
= "machine password timeout",
3093 .p_class
= P_GLOBAL
,
3094 .ptr
= &Globals
.machine_password_timeout
,
3097 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
3100 {N_("Logon Options"), P_SEP
, P_SEPARATOR
},
3103 .label
= "add user script",
3105 .p_class
= P_GLOBAL
,
3106 .ptr
= &Globals
.szAddUserScript
,
3109 .flags
= FLAG_ADVANCED
,
3112 .label
= "rename user script",
3114 .p_class
= P_GLOBAL
,
3115 .ptr
= &Globals
.szRenameUserScript
,
3118 .flags
= FLAG_ADVANCED
,
3121 .label
= "delete user script",
3123 .p_class
= P_GLOBAL
,
3124 .ptr
= &Globals
.szDelUserScript
,
3127 .flags
= FLAG_ADVANCED
,
3130 .label
= "add group script",
3132 .p_class
= P_GLOBAL
,
3133 .ptr
= &Globals
.szAddGroupScript
,
3136 .flags
= FLAG_ADVANCED
,
3139 .label
= "delete group script",
3141 .p_class
= P_GLOBAL
,
3142 .ptr
= &Globals
.szDelGroupScript
,
3145 .flags
= FLAG_ADVANCED
,
3148 .label
= "add user to group script",
3150 .p_class
= P_GLOBAL
,
3151 .ptr
= &Globals
.szAddUserToGroupScript
,
3154 .flags
= FLAG_ADVANCED
,
3157 .label
= "delete user from group script",
3159 .p_class
= P_GLOBAL
,
3160 .ptr
= &Globals
.szDelUserFromGroupScript
,
3163 .flags
= FLAG_ADVANCED
,
3166 .label
= "set primary group script",
3168 .p_class
= P_GLOBAL
,
3169 .ptr
= &Globals
.szSetPrimaryGroupScript
,
3172 .flags
= FLAG_ADVANCED
,
3175 .label
= "add machine script",
3177 .p_class
= P_GLOBAL
,
3178 .ptr
= &Globals
.szAddMachineScript
,
3181 .flags
= FLAG_ADVANCED
,
3184 .label
= "shutdown script",
3186 .p_class
= P_GLOBAL
,
3187 .ptr
= &Globals
.szShutdownScript
,
3190 .flags
= FLAG_ADVANCED
,
3193 .label
= "abort shutdown script",
3195 .p_class
= P_GLOBAL
,
3196 .ptr
= &Globals
.szAbortShutdownScript
,
3199 .flags
= FLAG_ADVANCED
,
3202 .label
= "username map script",
3204 .p_class
= P_GLOBAL
,
3205 .ptr
= &Globals
.szUsernameMapScript
,
3208 .flags
= FLAG_ADVANCED
,
3211 .label
= "logon script",
3213 .p_class
= P_GLOBAL
,
3214 .ptr
= &Globals
.szLogonScript
,
3217 .flags
= FLAG_ADVANCED
,
3220 .label
= "logon path",
3222 .p_class
= P_GLOBAL
,
3223 .ptr
= &Globals
.szLogonPath
,
3226 .flags
= FLAG_ADVANCED
,
3229 .label
= "logon drive",
3231 .p_class
= P_GLOBAL
,
3232 .ptr
= &Globals
.szLogonDrive
,
3235 .flags
= FLAG_ADVANCED
,
3238 .label
= "logon home",
3240 .p_class
= P_GLOBAL
,
3241 .ptr
= &Globals
.szLogonHome
,
3244 .flags
= FLAG_ADVANCED
,
3247 .label
= "domain logons",
3249 .p_class
= P_GLOBAL
,
3250 .ptr
= &Globals
.bDomainLogons
,
3253 .flags
= FLAG_ADVANCED
,
3257 .label
= "init logon delayed hosts",
3259 .p_class
= P_GLOBAL
,
3260 .ptr
= &Globals
.szInitLogonDelayedHosts
,
3261 .flags
= FLAG_ADVANCED
,
3265 .label
= "init logon delay",
3267 .p_class
= P_GLOBAL
,
3268 .ptr
= &Globals
.InitLogonDelay
,
3269 .flags
= FLAG_ADVANCED
,
3273 {N_("Browse Options"), P_SEP
, P_SEPARATOR
},
3276 .label
= "os level",
3278 .p_class
= P_GLOBAL
,
3279 .ptr
= &Globals
.os_level
,
3282 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3285 .label
= "lm announce",
3287 .p_class
= P_GLOBAL
,
3288 .ptr
= &Globals
.lm_announce
,
3290 .enum_list
= enum_bool_auto
,
3291 .flags
= FLAG_ADVANCED
,
3294 .label
= "lm interval",
3296 .p_class
= P_GLOBAL
,
3297 .ptr
= &Globals
.lm_interval
,
3300 .flags
= FLAG_ADVANCED
,
3303 .label
= "preferred master",
3305 .p_class
= P_GLOBAL
,
3306 .ptr
= &Globals
.iPreferredMaster
,
3308 .enum_list
= enum_bool_auto
,
3309 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3312 .label
= "prefered master",
3314 .p_class
= P_GLOBAL
,
3315 .ptr
= &Globals
.iPreferredMaster
,
3317 .enum_list
= enum_bool_auto
,
3321 .label
= "local master",
3323 .p_class
= P_GLOBAL
,
3324 .ptr
= &Globals
.bLocalMaster
,
3327 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3330 .label
= "domain master",
3332 .p_class
= P_GLOBAL
,
3333 .ptr
= &Globals
.iDomainMaster
,
3335 .enum_list
= enum_bool_auto
,
3336 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3339 .label
= "browse list",
3341 .p_class
= P_GLOBAL
,
3342 .ptr
= &Globals
.bBrowseList
,
3345 .flags
= FLAG_ADVANCED
,
3348 .label
= "browseable",
3351 .ptr
= &sDefault
.bBrowseable
,
3354 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
3357 .label
= "browsable",
3360 .ptr
= &sDefault
.bBrowseable
,
3366 .label
= "access based share enum",
3369 .ptr
= &sDefault
.bAccessBasedShareEnum
,
3372 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
3375 .label
= "enhanced browsing",
3377 .p_class
= P_GLOBAL
,
3378 .ptr
= &Globals
.enhanced_browsing
,
3381 .flags
= FLAG_ADVANCED
,
3384 {N_("WINS Options"), P_SEP
, P_SEPARATOR
},
3387 .label
= "dns proxy",
3389 .p_class
= P_GLOBAL
,
3390 .ptr
= &Globals
.bDNSproxy
,
3393 .flags
= FLAG_ADVANCED
,
3396 .label
= "wins proxy",
3398 .p_class
= P_GLOBAL
,
3399 .ptr
= &Globals
.bWINSproxy
,
3402 .flags
= FLAG_ADVANCED
,
3405 .label
= "wins server",
3407 .p_class
= P_GLOBAL
,
3408 .ptr
= &Globals
.szWINSservers
,
3411 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
3414 .label
= "wins support",
3416 .p_class
= P_GLOBAL
,
3417 .ptr
= &Globals
.bWINSsupport
,
3420 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
3423 .label
= "wins hook",
3425 .p_class
= P_GLOBAL
,
3426 .ptr
= &Globals
.szWINSHook
,
3429 .flags
= FLAG_ADVANCED
,
3432 {N_("Locking Options"), P_SEP
, P_SEPARATOR
},
3435 .label
= "blocking locks",
3438 .ptr
= &sDefault
.bBlockingLocks
,
3441 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3444 .label
= "csc policy",
3447 .ptr
= &sDefault
.iCSCPolicy
,
3449 .enum_list
= enum_csc_policy
,
3450 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3453 .label
= "fake oplocks",
3456 .ptr
= &sDefault
.bFakeOplocks
,
3459 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
3462 .label
= "kernel oplocks",
3464 .p_class
= P_GLOBAL
,
3465 .ptr
= &Globals
.bKernelOplocks
,
3468 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3474 .ptr
= &sDefault
.bLocking
,
3477 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3480 .label
= "lock spin time",
3482 .p_class
= P_GLOBAL
,
3483 .ptr
= &Globals
.iLockSpinTime
,
3486 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3492 .ptr
= &sDefault
.bOpLocks
,
3495 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3498 .label
= "level2 oplocks",
3501 .ptr
= &sDefault
.bLevel2OpLocks
,
3504 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3507 .label
= "oplock break wait time",
3509 .p_class
= P_GLOBAL
,
3510 .ptr
= &Globals
.oplock_break_wait_time
,
3513 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3516 .label
= "oplock contention limit",
3519 .ptr
= &sDefault
.iOplockContentionLimit
,
3522 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3525 .label
= "posix locking",
3528 .ptr
= &sDefault
.bPosixLocking
,
3531 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3534 .label
= "strict locking",
3537 .ptr
= &sDefault
.iStrictLocking
,
3539 .enum_list
= enum_bool_auto
,
3540 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3543 .label
= "share modes",
3546 .ptr
= &sDefault
.bShareModes
,
3549 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DEPRECATED
,
3552 {N_("Ldap Options"), P_SEP
, P_SEPARATOR
},
3555 .label
= "ldap admin dn",
3557 .p_class
= P_GLOBAL
,
3558 .ptr
= &Globals
.szLdapAdminDn
,
3561 .flags
= FLAG_ADVANCED
,
3564 .label
= "ldap delete dn",
3566 .p_class
= P_GLOBAL
,
3567 .ptr
= &Globals
.ldap_delete_dn
,
3570 .flags
= FLAG_ADVANCED
,
3573 .label
= "ldap group suffix",
3575 .p_class
= P_GLOBAL
,
3576 .ptr
= &Globals
.szLdapGroupSuffix
,
3579 .flags
= FLAG_ADVANCED
,
3582 .label
= "ldap idmap suffix",
3584 .p_class
= P_GLOBAL
,
3585 .ptr
= &Globals
.szLdapIdmapSuffix
,
3588 .flags
= FLAG_ADVANCED
,
3591 .label
= "ldap machine suffix",
3593 .p_class
= P_GLOBAL
,
3594 .ptr
= &Globals
.szLdapMachineSuffix
,
3597 .flags
= FLAG_ADVANCED
,
3600 .label
= "ldap passwd sync",
3602 .p_class
= P_GLOBAL
,
3603 .ptr
= &Globals
.ldap_passwd_sync
,
3605 .enum_list
= enum_ldap_passwd_sync
,
3606 .flags
= FLAG_ADVANCED
,
3609 .label
= "ldap password sync",
3611 .p_class
= P_GLOBAL
,
3612 .ptr
= &Globals
.ldap_passwd_sync
,
3614 .enum_list
= enum_ldap_passwd_sync
,
3618 .label
= "ldap replication sleep",
3620 .p_class
= P_GLOBAL
,
3621 .ptr
= &Globals
.ldap_replication_sleep
,
3624 .flags
= FLAG_ADVANCED
,
3627 .label
= "ldap suffix",
3629 .p_class
= P_GLOBAL
,
3630 .ptr
= &Globals
.szLdapSuffix
,
3633 .flags
= FLAG_ADVANCED
,
3636 .label
= "ldap ssl",
3638 .p_class
= P_GLOBAL
,
3639 .ptr
= &Globals
.ldap_ssl
,
3641 .enum_list
= enum_ldap_ssl
,
3642 .flags
= FLAG_ADVANCED
,
3645 .label
= "ldap ssl ads",
3647 .p_class
= P_GLOBAL
,
3648 .ptr
= &Globals
.ldap_ssl_ads
,
3651 .flags
= FLAG_ADVANCED
,
3654 .label
= "ldap timeout",
3656 .p_class
= P_GLOBAL
,
3657 .ptr
= &Globals
.ldap_timeout
,
3660 .flags
= FLAG_ADVANCED
,
3663 .label
= "ldap connection timeout",
3665 .p_class
= P_GLOBAL
,
3666 .ptr
= &Globals
.ldap_connection_timeout
,
3669 .flags
= FLAG_ADVANCED
,
3672 .label
= "ldap page size",
3674 .p_class
= P_GLOBAL
,
3675 .ptr
= &Globals
.ldap_page_size
,
3678 .flags
= FLAG_ADVANCED
,
3681 .label
= "ldap user suffix",
3683 .p_class
= P_GLOBAL
,
3684 .ptr
= &Globals
.szLdapUserSuffix
,
3687 .flags
= FLAG_ADVANCED
,
3690 .label
= "ldap debug level",
3692 .p_class
= P_GLOBAL
,
3693 .ptr
= &Globals
.ldap_debug_level
,
3694 .special
= handle_ldap_debug_level
,
3696 .flags
= FLAG_ADVANCED
,
3699 .label
= "ldap debug threshold",
3701 .p_class
= P_GLOBAL
,
3702 .ptr
= &Globals
.ldap_debug_threshold
,
3705 .flags
= FLAG_ADVANCED
,
3708 {N_("EventLog Options"), P_SEP
, P_SEPARATOR
},
3711 .label
= "eventlog list",
3713 .p_class
= P_GLOBAL
,
3714 .ptr
= &Globals
.szEventLogs
,
3717 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
3720 {N_("Miscellaneous Options"), P_SEP
, P_SEPARATOR
},
3723 .label
= "add share command",
3725 .p_class
= P_GLOBAL
,
3726 .ptr
= &Globals
.szAddShareCommand
,
3729 .flags
= FLAG_ADVANCED
,
3732 .label
= "change share command",
3734 .p_class
= P_GLOBAL
,
3735 .ptr
= &Globals
.szChangeShareCommand
,
3738 .flags
= FLAG_ADVANCED
,
3741 .label
= "delete share command",
3743 .p_class
= P_GLOBAL
,
3744 .ptr
= &Globals
.szDeleteShareCommand
,
3747 .flags
= FLAG_ADVANCED
,
3750 .label
= "config file",
3752 .p_class
= P_GLOBAL
,
3753 .ptr
= &Globals
.szConfigFile
,
3761 .p_class
= P_GLOBAL
,
3762 .ptr
= &Globals
.szAutoServices
,
3765 .flags
= FLAG_ADVANCED
,
3768 .label
= "auto services",
3770 .p_class
= P_GLOBAL
,
3771 .ptr
= &Globals
.szAutoServices
,
3774 .flags
= FLAG_ADVANCED
,
3777 .label
= "lock directory",
3779 .p_class
= P_GLOBAL
,
3780 .ptr
= &Globals
.szLockDir
,
3783 .flags
= FLAG_ADVANCED
,
3786 .label
= "lock dir",
3788 .p_class
= P_GLOBAL
,
3789 .ptr
= &Globals
.szLockDir
,
3795 .label
= "state directory",
3797 .p_class
= P_GLOBAL
,
3798 .ptr
= &Globals
.szStateDir
,
3801 .flags
= FLAG_ADVANCED
,
3804 .label
= "cache directory",
3806 .p_class
= P_GLOBAL
,
3807 .ptr
= &Globals
.szCacheDir
,
3810 .flags
= FLAG_ADVANCED
,
3813 .label
= "pid directory",
3815 .p_class
= P_GLOBAL
,
3816 .ptr
= &Globals
.szPidDir
,
3819 .flags
= FLAG_ADVANCED
,
3823 .label
= "utmp directory",
3825 .p_class
= P_GLOBAL
,
3826 .ptr
= &Globals
.szUtmpDir
,
3829 .flags
= FLAG_ADVANCED
,
3832 .label
= "wtmp directory",
3834 .p_class
= P_GLOBAL
,
3835 .ptr
= &Globals
.szWtmpDir
,
3838 .flags
= FLAG_ADVANCED
,
3843 .p_class
= P_GLOBAL
,
3844 .ptr
= &Globals
.bUtmp
,
3847 .flags
= FLAG_ADVANCED
,
3851 .label
= "default service",
3853 .p_class
= P_GLOBAL
,
3854 .ptr
= &Globals
.szDefaultService
,
3857 .flags
= FLAG_ADVANCED
,
3862 .p_class
= P_GLOBAL
,
3863 .ptr
= &Globals
.szDefaultService
,
3866 .flags
= FLAG_ADVANCED
,
3869 .label
= "message command",
3871 .p_class
= P_GLOBAL
,
3872 .ptr
= &Globals
.szMsgCommand
,
3875 .flags
= FLAG_ADVANCED
,
3878 .label
= "dfree cache time",
3881 .ptr
= &sDefault
.iDfreeCacheTime
,
3884 .flags
= FLAG_ADVANCED
,
3887 .label
= "dfree command",
3890 .ptr
= &sDefault
.szDfree
,
3893 .flags
= FLAG_ADVANCED
,
3896 .label
= "get quota command",
3898 .p_class
= P_GLOBAL
,
3899 .ptr
= &Globals
.szGetQuota
,
3902 .flags
= FLAG_ADVANCED
,
3905 .label
= "set quota command",
3907 .p_class
= P_GLOBAL
,
3908 .ptr
= &Globals
.szSetQuota
,
3911 .flags
= FLAG_ADVANCED
,
3914 .label
= "remote announce",
3916 .p_class
= P_GLOBAL
,
3917 .ptr
= &Globals
.szRemoteAnnounce
,
3920 .flags
= FLAG_ADVANCED
,
3923 .label
= "remote browse sync",
3925 .p_class
= P_GLOBAL
,
3926 .ptr
= &Globals
.szRemoteBrowseSync
,
3929 .flags
= FLAG_ADVANCED
,
3932 .label
= "socket address",
3934 .p_class
= P_GLOBAL
,
3935 .ptr
= &Globals
.szSocketAddress
,
3938 .flags
= FLAG_ADVANCED
,
3941 .label
= "homedir map",
3943 .p_class
= P_GLOBAL
,
3944 .ptr
= &Globals
.szNISHomeMapName
,
3947 .flags
= FLAG_ADVANCED
,
3950 .label
= "afs username map",
3952 .p_class
= P_GLOBAL
,
3953 .ptr
= &Globals
.szAfsUsernameMap
,
3956 .flags
= FLAG_ADVANCED
,
3959 .label
= "afs token lifetime",
3961 .p_class
= P_GLOBAL
,
3962 .ptr
= &Globals
.iAfsTokenLifetime
,
3965 .flags
= FLAG_ADVANCED
,
3968 .label
= "log nt token command",
3970 .p_class
= P_GLOBAL
,
3971 .ptr
= &Globals
.szLogNtTokenCommand
,
3974 .flags
= FLAG_ADVANCED
,
3977 .label
= "time offset",
3979 .p_class
= P_GLOBAL
,
3980 .ptr
= &extra_time_offset
,
3983 .flags
= FLAG_ADVANCED
,
3986 .label
= "NIS homedir",
3988 .p_class
= P_GLOBAL
,
3989 .ptr
= &Globals
.bNISHomeMap
,
3992 .flags
= FLAG_ADVANCED
,
3998 .ptr
= &sDefault
.valid
,
4007 .ptr
= &sDefault
.szCopy
,
4008 .special
= handle_copy
,
4016 .ptr
= &sDefault
.szInclude
,
4017 .special
= handle_include
,
4025 .ptr
= &sDefault
.szPreExec
,
4028 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4034 .ptr
= &sDefault
.szPreExec
,
4037 .flags
= FLAG_ADVANCED
,
4040 .label
= "preexec close",
4043 .ptr
= &sDefault
.bPreexecClose
,
4046 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4049 .label
= "postexec",
4052 .ptr
= &sDefault
.szPostExec
,
4055 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4058 .label
= "root preexec",
4061 .ptr
= &sDefault
.szRootPreExec
,
4064 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4067 .label
= "root preexec close",
4070 .ptr
= &sDefault
.bRootpreexecClose
,
4073 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4076 .label
= "root postexec",
4079 .ptr
= &sDefault
.szRootPostExec
,
4082 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4085 .label
= "available",
4088 .ptr
= &sDefault
.bAvailable
,
4091 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4094 .label
= "registry shares",
4096 .p_class
= P_GLOBAL
,
4097 .ptr
= &Globals
.bRegistryShares
,
4100 .flags
= FLAG_ADVANCED
,
4103 .label
= "usershare allow guests",
4105 .p_class
= P_GLOBAL
,
4106 .ptr
= &Globals
.bUsershareAllowGuests
,
4109 .flags
= FLAG_ADVANCED
,
4112 .label
= "usershare max shares",
4114 .p_class
= P_GLOBAL
,
4115 .ptr
= &Globals
.iUsershareMaxShares
,
4118 .flags
= FLAG_ADVANCED
,
4121 .label
= "usershare owner only",
4123 .p_class
= P_GLOBAL
,
4124 .ptr
= &Globals
.bUsershareOwnerOnly
,
4127 .flags
= FLAG_ADVANCED
,
4130 .label
= "usershare path",
4132 .p_class
= P_GLOBAL
,
4133 .ptr
= &Globals
.szUsersharePath
,
4136 .flags
= FLAG_ADVANCED
,
4139 .label
= "usershare prefix allow list",
4141 .p_class
= P_GLOBAL
,
4142 .ptr
= &Globals
.szUsersharePrefixAllowList
,
4145 .flags
= FLAG_ADVANCED
,
4148 .label
= "usershare prefix deny list",
4150 .p_class
= P_GLOBAL
,
4151 .ptr
= &Globals
.szUsersharePrefixDenyList
,
4154 .flags
= FLAG_ADVANCED
,
4157 .label
= "usershare template share",
4159 .p_class
= P_GLOBAL
,
4160 .ptr
= &Globals
.szUsershareTemplateShare
,
4163 .flags
= FLAG_ADVANCED
,
4169 .ptr
= &sDefault
.volume
,
4172 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4178 .ptr
= &sDefault
.fstype
,
4181 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4184 .label
= "set directory",
4187 .ptr
= &sDefault
.bNo_set_dir
,
4190 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4193 .label
= "wide links",
4196 .ptr
= &sDefault
.bWidelinks
,
4199 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4202 .label
= "follow symlinks",
4205 .ptr
= &sDefault
.bSymlinks
,
4208 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4211 .label
= "dont descend",
4214 .ptr
= &sDefault
.szDontdescend
,
4217 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4220 .label
= "magic script",
4223 .ptr
= &sDefault
.szMagicScript
,
4226 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4229 .label
= "magic output",
4232 .ptr
= &sDefault
.szMagicOutput
,
4235 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4238 .label
= "delete readonly",
4241 .ptr
= &sDefault
.bDeleteReadonly
,
4244 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4247 .label
= "dos filemode",
4250 .ptr
= &sDefault
.bDosFilemode
,
4253 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4256 .label
= "dos filetimes",
4259 .ptr
= &sDefault
.bDosFiletimes
,
4262 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4265 .label
= "dos filetime resolution",
4268 .ptr
= &sDefault
.bDosFiletimeResolution
,
4271 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4274 .label
= "fake directory create times",
4277 .ptr
= &sDefault
.bFakeDirCreateTimes
,
4280 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4283 .label
= "panic action",
4285 .p_class
= P_GLOBAL
,
4286 .ptr
= &Globals
.szPanicAction
,
4289 .flags
= FLAG_ADVANCED
,
4292 .label
= "perfcount module",
4294 .p_class
= P_GLOBAL
,
4295 .ptr
= &Globals
.szSMBPerfcountModule
,
4298 .flags
= FLAG_ADVANCED
,
4301 {N_("VFS module options"), P_SEP
, P_SEPARATOR
},
4304 .label
= "vfs objects",
4307 .ptr
= &sDefault
.szVfsObjects
,
4310 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4313 .label
= "vfs object",
4316 .ptr
= &sDefault
.szVfsObjects
,
4323 {N_("MSDFS options"), P_SEP
, P_SEPARATOR
},
4326 .label
= "msdfs root",
4329 .ptr
= &sDefault
.bMSDfsRoot
,
4332 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4335 .label
= "msdfs proxy",
4338 .ptr
= &sDefault
.szMSDfsProxy
,
4341 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4344 .label
= "host msdfs",
4346 .p_class
= P_GLOBAL
,
4347 .ptr
= &Globals
.bHostMSDfs
,
4350 .flags
= FLAG_ADVANCED
,
4353 {N_("Winbind options"), P_SEP
, P_SEPARATOR
},
4356 .label
= "passdb expand explicit",
4358 .p_class
= P_GLOBAL
,
4359 .ptr
= &Globals
.bPassdbExpandExplicit
,
4362 .flags
= FLAG_ADVANCED
,
4365 .label
= "idmap backend",
4367 .p_class
= P_GLOBAL
,
4368 .ptr
= &Globals
.szIdmapBackend
,
4371 .flags
= FLAG_ADVANCED
,
4374 .label
= "idmap alloc backend",
4376 .p_class
= P_GLOBAL
,
4377 .ptr
= &Globals
.szIdmapAllocBackend
,
4380 .flags
= FLAG_ADVANCED
,
4383 .label
= "idmap cache time",
4385 .p_class
= P_GLOBAL
,
4386 .ptr
= &Globals
.iIdmapCacheTime
,
4389 .flags
= FLAG_ADVANCED
,
4392 .label
= "idmap negative cache time",
4394 .p_class
= P_GLOBAL
,
4395 .ptr
= &Globals
.iIdmapNegativeCacheTime
,
4398 .flags
= FLAG_ADVANCED
,
4401 .label
= "idmap uid",
4403 .p_class
= P_GLOBAL
,
4404 .ptr
= &Globals
.szIdmapUID
,
4405 .special
= handle_idmap_uid
,
4407 .flags
= FLAG_ADVANCED
,
4410 .label
= "winbind uid",
4412 .p_class
= P_GLOBAL
,
4413 .ptr
= &Globals
.szIdmapUID
,
4414 .special
= handle_idmap_uid
,
4419 .label
= "idmap gid",
4421 .p_class
= P_GLOBAL
,
4422 .ptr
= &Globals
.szIdmapGID
,
4423 .special
= handle_idmap_gid
,
4425 .flags
= FLAG_ADVANCED
,
4428 .label
= "winbind gid",
4430 .p_class
= P_GLOBAL
,
4431 .ptr
= &Globals
.szIdmapGID
,
4432 .special
= handle_idmap_gid
,
4437 .label
= "template homedir",
4439 .p_class
= P_GLOBAL
,
4440 .ptr
= &Globals
.szTemplateHomedir
,
4443 .flags
= FLAG_ADVANCED
,
4446 .label
= "template shell",
4448 .p_class
= P_GLOBAL
,
4449 .ptr
= &Globals
.szTemplateShell
,
4452 .flags
= FLAG_ADVANCED
,
4455 .label
= "winbind separator",
4457 .p_class
= P_GLOBAL
,
4458 .ptr
= &Globals
.szWinbindSeparator
,
4461 .flags
= FLAG_ADVANCED
,
4464 .label
= "winbind cache time",
4466 .p_class
= P_GLOBAL
,
4467 .ptr
= &Globals
.winbind_cache_time
,
4470 .flags
= FLAG_ADVANCED
,
4473 .label
= "winbind reconnect delay",
4475 .p_class
= P_GLOBAL
,
4476 .ptr
= &Globals
.winbind_reconnect_delay
,
4479 .flags
= FLAG_ADVANCED
,
4482 .label
= "winbind enum users",
4484 .p_class
= P_GLOBAL
,
4485 .ptr
= &Globals
.bWinbindEnumUsers
,
4488 .flags
= FLAG_ADVANCED
,
4491 .label
= "winbind enum groups",
4493 .p_class
= P_GLOBAL
,
4494 .ptr
= &Globals
.bWinbindEnumGroups
,
4497 .flags
= FLAG_ADVANCED
,
4500 .label
= "winbind use default domain",
4502 .p_class
= P_GLOBAL
,
4503 .ptr
= &Globals
.bWinbindUseDefaultDomain
,
4506 .flags
= FLAG_ADVANCED
,
4509 .label
= "winbind trusted domains only",
4511 .p_class
= P_GLOBAL
,
4512 .ptr
= &Globals
.bWinbindTrustedDomainsOnly
,
4515 .flags
= FLAG_ADVANCED
,
4518 .label
= "winbind nested groups",
4520 .p_class
= P_GLOBAL
,
4521 .ptr
= &Globals
.bWinbindNestedGroups
,
4524 .flags
= FLAG_ADVANCED
,
4527 .label
= "winbind expand groups",
4529 .p_class
= P_GLOBAL
,
4530 .ptr
= &Globals
.winbind_expand_groups
,
4533 .flags
= FLAG_ADVANCED
,
4536 .label
= "winbind nss info",
4538 .p_class
= P_GLOBAL
,
4539 .ptr
= &Globals
.szWinbindNssInfo
,
4542 .flags
= FLAG_ADVANCED
,
4545 .label
= "winbind refresh tickets",
4547 .p_class
= P_GLOBAL
,
4548 .ptr
= &Globals
.bWinbindRefreshTickets
,
4551 .flags
= FLAG_ADVANCED
,
4554 .label
= "winbind offline logon",
4556 .p_class
= P_GLOBAL
,
4557 .ptr
= &Globals
.bWinbindOfflineLogon
,
4560 .flags
= FLAG_ADVANCED
,
4563 .label
= "winbind normalize names",
4565 .p_class
= P_GLOBAL
,
4566 .ptr
= &Globals
.bWinbindNormalizeNames
,
4569 .flags
= FLAG_ADVANCED
,
4572 .label
= "winbind rpc only",
4574 .p_class
= P_GLOBAL
,
4575 .ptr
= &Globals
.bWinbindRpcOnly
,
4578 .flags
= FLAG_ADVANCED
,
4581 {NULL
, P_BOOL
, P_NONE
, NULL
, NULL
, NULL
, 0}
4584 /***************************************************************************
4585 Initialise the sDefault parameter structure for the printer values.
4586 ***************************************************************************/
4588 static void init_printer_values(struct service
*pService
)
4590 /* choose defaults depending on the type of printing */
4591 switch (pService
->iPrinting
) {
4596 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4597 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4598 string_set(&pService
->szPrintcommand
, "lpr -r -P'%p' %s");
4603 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4604 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4605 string_set(&pService
->szPrintcommand
, "lpr -r -P'%p' %s");
4606 string_set(&pService
->szQueuepausecommand
, "lpc stop '%p'");
4607 string_set(&pService
->szQueueresumecommand
, "lpc start '%p'");
4608 string_set(&pService
->szLppausecommand
, "lpc hold '%p' %j");
4609 string_set(&pService
->szLpresumecommand
, "lpc release '%p' %j");
4615 /* set the lpq command to contain the destination printer
4616 name only. This is used by cups_queue_get() */
4617 string_set(&pService
->szLpqcommand
, "%p");
4618 string_set(&pService
->szLprmcommand
, "");
4619 string_set(&pService
->szPrintcommand
, "");
4620 string_set(&pService
->szLppausecommand
, "");
4621 string_set(&pService
->szLpresumecommand
, "");
4622 string_set(&pService
->szQueuepausecommand
, "");
4623 string_set(&pService
->szQueueresumecommand
, "");
4625 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4626 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4627 string_set(&pService
->szPrintcommand
, "lpr -P'%p' %s; rm %s");
4628 string_set(&pService
->szLppausecommand
, "lp -i '%p-%j' -H hold");
4629 string_set(&pService
->szLpresumecommand
, "lp -i '%p-%j' -H resume");
4630 string_set(&pService
->szQueuepausecommand
, "disable '%p'");
4631 string_set(&pService
->szQueueresumecommand
, "enable '%p'");
4632 #endif /* HAVE_CUPS */
4637 string_set(&pService
->szLpqcommand
, "lpstat -o%p");
4638 string_set(&pService
->szLprmcommand
, "cancel %p-%j");
4639 string_set(&pService
->szPrintcommand
, "lp -c -d%p %s; rm %s");
4640 string_set(&pService
->szQueuepausecommand
, "disable %p");
4641 string_set(&pService
->szQueueresumecommand
, "enable %p");
4643 string_set(&pService
->szLppausecommand
, "lp -i %p-%j -H hold");
4644 string_set(&pService
->szLpresumecommand
, "lp -i %p-%j -H resume");
4649 string_set(&pService
->szLpqcommand
, "lpq -P%p");
4650 string_set(&pService
->szLprmcommand
, "lprm -P%p %j");
4651 string_set(&pService
->szPrintcommand
, "lp -r -P%p %s");
4657 string_set(&pService
->szPrintcommand
, "vlp print %p %s");
4658 string_set(&pService
->szLpqcommand
, "vlp lpq %p");
4659 string_set(&pService
->szLprmcommand
, "vlp lprm %p %j");
4660 string_set(&pService
->szLppausecommand
, "vlp lppause %p %j");
4661 string_set(&pService
->szLpresumecommand
, "vlp lpresume %p %j");
4662 string_set(&pService
->szQueuepausecommand
, "vlp queuepause %p");
4663 string_set(&pService
->szQueueresumecommand
, "vlp queueresume %p");
4665 #endif /* DEVELOPER */
4670 * Function to return the default value for the maximum number of open
4671 * file descriptors permitted. This function tries to consult the
4672 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4673 * the smaller of those.
4675 static int max_open_files(void)
4677 int sysctl_max
= MAX_OPEN_FILES
;
4678 int rlimit_max
= MAX_OPEN_FILES
;
4680 #ifdef HAVE_SYSCTLBYNAME
4682 size_t size
= sizeof(sysctl_max
);
4683 sysctlbyname("kern.maxfilesperproc", &sysctl_max
, &size
, NULL
,
4688 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4694 if (getrlimit(RLIMIT_NOFILE
, &rl
) == 0)
4695 rlimit_max
= rl
.rlim_cur
;
4697 #if defined(RLIM_INFINITY)
4698 if(rl
.rlim_cur
== RLIM_INFINITY
)
4699 rlimit_max
= MAX_OPEN_FILES
;
4704 return MIN(sysctl_max
, rlimit_max
);
4708 * Common part of freeing allocated data for one parameter.
4710 static void free_one_parameter_common(void *parm_ptr
,
4711 struct parm_struct parm
)
4713 if ((parm
.type
== P_STRING
) ||
4714 (parm
.type
== P_USTRING
))
4716 string_free((char**)parm_ptr
);
4717 } else if (parm
.type
== P_LIST
) {
4718 TALLOC_FREE(*((char***)parm_ptr
));
4723 * Free the allocated data for one parameter for a share
4724 * given as a service struct.
4726 static void free_one_parameter(struct service
*service
,
4727 struct parm_struct parm
)
4731 if (parm
.p_class
!= P_LOCAL
) {
4735 parm_ptr
= lp_local_ptr(service
, parm
.ptr
);
4737 free_one_parameter_common(parm_ptr
, parm
);
4741 * Free the allocated parameter data of a share given
4742 * as a service struct.
4744 static void free_parameters(struct service
*service
)
4748 for (i
=0; parm_table
[i
].label
; i
++) {
4749 free_one_parameter(service
, parm_table
[i
]);
4754 * Free the allocated data for one parameter for a given share
4755 * specified by an snum.
4757 static void free_one_parameter_by_snum(int snum
, struct parm_struct parm
)
4761 if (parm
.ptr
== NULL
) {
4766 parm_ptr
= parm
.ptr
;
4767 } else if (parm
.p_class
!= P_LOCAL
) {
4770 parm_ptr
= lp_local_ptr_by_snum(snum
, parm
.ptr
);
4773 free_one_parameter_common(parm_ptr
, parm
);
4777 * Free the allocated parameter data for a share specified
4780 static void free_parameters_by_snum(int snum
)
4784 for (i
=0; parm_table
[i
].label
; i
++) {
4785 free_one_parameter_by_snum(snum
, parm_table
[i
]);
4790 * Free the allocated global parameters.
4792 static void free_global_parameters(void)
4794 free_parameters_by_snum(GLOBAL_SECTION_SNUM
);
4797 /***************************************************************************
4798 Initialise the global parameter structure.
4799 ***************************************************************************/
4801 static void init_globals(bool first_time_only
)
4803 static bool done_init
= False
;
4807 /* If requested to initialize only once and we've already done it... */
4808 if (first_time_only
&& done_init
) {
4809 /* ... then we have nothing more to do */
4814 /* The logfile can be set before this is invoked. Free it if so. */
4815 if (Globals
.szLogFile
!= NULL
) {
4816 string_free(&Globals
.szLogFile
);
4817 Globals
.szLogFile
= NULL
;
4821 free_global_parameters();
4824 memset((void *)&Globals
, '\0', sizeof(Globals
));
4826 for (i
= 0; parm_table
[i
].label
; i
++) {
4827 if ((parm_table
[i
].type
== P_STRING
||
4828 parm_table
[i
].type
== P_USTRING
) &&
4831 string_set((char **)parm_table
[i
].ptr
, "");
4835 string_set(&sDefault
.fstype
, FSTYPE_STRING
);
4836 string_set(&sDefault
.szPrintjobUsername
, "%U");
4838 init_printer_values(&sDefault
);
4841 DEBUG(3, ("Initialising global parameters\n"));
4843 string_set(&Globals
.szSMBPasswdFile
, get_dyn_SMB_PASSWD_FILE());
4844 string_set(&Globals
.szPrivateDir
, get_dyn_PRIVATE_DIR());
4846 /* use the new 'hash2' method by default, with a prefix of 1 */
4847 string_set(&Globals
.szManglingMethod
, "hash2");
4848 Globals
.mangle_prefix
= 1;
4850 string_set(&Globals
.szGuestaccount
, GUEST_ACCOUNT
);
4852 /* using UTF8 by default allows us to support all chars */
4853 string_set(&Globals
.unix_charset
, DEFAULT_UNIX_CHARSET
);
4855 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
4856 /* If the system supports nl_langinfo(), try to grab the value
4857 from the user's locale */
4858 string_set(&Globals
.display_charset
, "LOCALE");
4860 string_set(&Globals
.display_charset
, DEFAULT_DISPLAY_CHARSET
);
4863 /* Use codepage 850 as a default for the dos character set */
4864 string_set(&Globals
.dos_charset
, DEFAULT_DOS_CHARSET
);
4867 * Allow the default PASSWD_CHAT to be overridden in local.h.
4869 string_set(&Globals
.szPasswdChat
, DEFAULT_PASSWD_CHAT
);
4871 set_global_myname(myhostname());
4872 string_set(&Globals
.szNetbiosName
,global_myname());
4874 set_global_myworkgroup(WORKGROUP
);
4875 string_set(&Globals
.szWorkgroup
, lp_workgroup());
4877 string_set(&Globals
.szPasswdProgram
, "");
4878 string_set(&Globals
.szLockDir
, get_dyn_LOCKDIR());
4879 string_set(&Globals
.szStateDir
, get_dyn_STATEDIR());
4880 string_set(&Globals
.szCacheDir
, get_dyn_CACHEDIR());
4881 string_set(&Globals
.szPidDir
, get_dyn_PIDDIR());
4882 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
4884 if (asprintf(&s
, "Samba %s", samba_version_string()) < 0) {
4885 smb_panic("init_globals: ENOMEM");
4887 string_set(&Globals
.szServerString
, s
);
4889 if (asprintf(&s
, "%d.%d", DEFAULT_MAJOR_VERSION
,
4890 DEFAULT_MINOR_VERSION
) < 0) {
4891 smb_panic("init_globals: ENOMEM");
4893 string_set(&Globals
.szAnnounceVersion
, s
);
4896 string_set(&Globals
.szPanicAction
, "/bin/sleep 999999999");
4899 string_set(&Globals
.szSocketOptions
, DEFAULT_SOCKET_OPTIONS
);
4901 string_set(&Globals
.szLogonDrive
, "");
4902 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
4903 string_set(&Globals
.szLogonHome
, "\\\\%N\\%U");
4904 string_set(&Globals
.szLogonPath
, "\\\\%N\\%U\\profile");
4906 string_set(&Globals
.szNameResolveOrder
, "lmhosts wins host bcast");
4907 string_set(&Globals
.szPasswordServer
, "*");
4909 Globals
.AlgorithmicRidBase
= BASE_RID
;
4911 Globals
.bLoadPrinters
= True
;
4912 Globals
.PrintcapCacheTime
= 750; /* 12.5 minutes */
4914 Globals
.ConfigBackend
= config_backend
;
4916 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
4917 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
4918 Globals
.max_xmit
= 0x4104;
4919 Globals
.max_mux
= 50; /* This is *needed* for profile support. */
4920 Globals
.lpqcachetime
= 30; /* changed to handle large print servers better -- jerry */
4921 Globals
.bDisableSpoolss
= False
;
4922 Globals
.iMaxSmbdProcesses
= 0;/* no limit specified */
4923 Globals
.pwordlevel
= 0;
4924 Globals
.unamelevel
= 0;
4925 Globals
.deadtime
= 0;
4926 Globals
.getwd_cache
= true;
4927 Globals
.bLargeReadwrite
= True
;
4928 Globals
.max_log_size
= 5000;
4929 Globals
.max_open_files
= max_open_files();
4930 Globals
.open_files_db_hash_size
= SMB_OPEN_DATABASE_TDB_HASH_SIZE
;
4931 Globals
.maxprotocol
= PROTOCOL_NT1
;
4932 Globals
.minprotocol
= PROTOCOL_CORE
;
4933 Globals
.security
= SEC_USER
;
4934 Globals
.paranoid_server_security
= True
;
4935 Globals
.bEncryptPasswords
= True
;
4936 Globals
.bUpdateEncrypt
= False
;
4937 Globals
.clientSchannel
= Auto
;
4938 Globals
.serverSchannel
= Auto
;
4939 Globals
.bReadRaw
= True
;
4940 Globals
.bWriteRaw
= True
;
4941 Globals
.bNullPasswords
= False
;
4942 Globals
.bObeyPamRestrictions
= False
;
4944 Globals
.bSyslogOnly
= False
;
4945 Globals
.bTimestampLogs
= True
;
4946 string_set(&Globals
.szLogLevel
, "0");
4947 Globals
.bDebugPrefixTimestamp
= False
;
4948 Globals
.bDebugHiresTimestamp
= False
;
4949 Globals
.bDebugPid
= False
;
4950 Globals
.bDebugUid
= False
;
4951 Globals
.bDebugClass
= False
;
4952 Globals
.bEnableCoreFiles
= True
;
4953 Globals
.max_ttl
= 60 * 60 * 24 * 3; /* 3 days default. */
4954 Globals
.max_wins_ttl
= 60 * 60 * 24 * 6; /* 6 days default. */
4955 Globals
.min_wins_ttl
= 60 * 60 * 6; /* 6 hours default. */
4956 Globals
.machine_password_timeout
= 60 * 60 * 24 * 7; /* 7 days default. */
4957 Globals
.lm_announce
= 2; /* = Auto: send only if LM clients found */
4958 Globals
.lm_interval
= 60;
4959 Globals
.announce_as
= ANNOUNCE_AS_NT_SERVER
;
4960 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
4961 Globals
.bNISHomeMap
= False
;
4962 #ifdef WITH_NISPLUS_HOME
4963 string_set(&Globals
.szNISHomeMapName
, "auto_home.org_dir");
4965 string_set(&Globals
.szNISHomeMapName
, "auto.home");
4968 Globals
.bTimeServer
= False
;
4969 Globals
.bBindInterfacesOnly
= False
;
4970 Globals
.bUnixPasswdSync
= False
;
4971 Globals
.bPamPasswordChange
= False
;
4972 Globals
.bPasswdChatDebug
= False
;
4973 Globals
.iPasswdChatTimeout
= 2; /* 2 second default. */
4974 Globals
.bNTPipeSupport
= True
; /* Do NT pipes by default. */
4975 Globals
.bNTStatusSupport
= True
; /* Use NT status by default. */
4976 Globals
.bStatCache
= True
; /* use stat cache by default */
4977 Globals
.iMaxStatCacheSize
= 256; /* 256k by default */
4978 Globals
.restrict_anonymous
= 0;
4979 Globals
.bClientLanManAuth
= False
; /* Do NOT use the LanMan hash if it is available */
4980 Globals
.bClientPlaintextAuth
= False
; /* Do NOT use a plaintext password even if is requested by the server */
4981 Globals
.bLanmanAuth
= False
; /* Do NOT use the LanMan hash, even if it is supplied */
4982 Globals
.bNTLMAuth
= True
; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
4983 Globals
.bClientNTLMv2Auth
= False
; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
4984 /* Note, that we will use NTLM2 session security (which is different), if it is available */
4986 Globals
.map_to_guest
= 0; /* By Default, "Never" */
4987 Globals
.oplock_break_wait_time
= 0; /* By Default, 0 msecs. */
4988 Globals
.enhanced_browsing
= true;
4989 Globals
.iLockSpinTime
= WINDOWS_MINIMUM_LOCK_TIMEOUT_MS
; /* msec. */
4990 #ifdef MMAP_BLACKLIST
4991 Globals
.bUseMmap
= False
;
4993 Globals
.bUseMmap
= True
;
4995 Globals
.bUnixExtensions
= True
;
4996 Globals
.bResetOnZeroVC
= False
;
4998 /* hostname lookups can be very expensive and are broken on
4999 a large number of sites (tridge) */
5000 Globals
.bHostnameLookups
= False
;
5002 string_set(&Globals
.szPassdbBackend
, "smbpasswd");
5003 string_set(&Globals
.szLdapSuffix
, "");
5004 string_set(&Globals
.szLdapMachineSuffix
, "");
5005 string_set(&Globals
.szLdapUserSuffix
, "");
5006 string_set(&Globals
.szLdapGroupSuffix
, "");
5007 string_set(&Globals
.szLdapIdmapSuffix
, "");
5009 string_set(&Globals
.szLdapAdminDn
, "");
5010 Globals
.ldap_ssl
= LDAP_SSL_START_TLS
;
5011 Globals
.ldap_ssl_ads
= False
;
5012 Globals
.ldap_passwd_sync
= LDAP_PASSWD_SYNC_OFF
;
5013 Globals
.ldap_delete_dn
= False
;
5014 Globals
.ldap_replication_sleep
= 1000; /* wait 1 sec for replication */
5015 Globals
.ldap_timeout
= LDAP_DEFAULT_TIMEOUT
;
5016 Globals
.ldap_connection_timeout
= LDAP_CONNECTION_DEFAULT_TIMEOUT
;
5017 Globals
.ldap_page_size
= LDAP_PAGE_SIZE
;
5019 Globals
.ldap_debug_level
= 0;
5020 Globals
.ldap_debug_threshold
= 10;
5022 /* This is what we tell the afs client. in reality we set the token
5023 * to never expire, though, when this runs out the afs client will
5024 * forget the token. Set to 0 to get NEVERDATE.*/
5025 Globals
.iAfsTokenLifetime
= 604800;
5026 Globals
.cups_connection_timeout
= CUPS_DEFAULT_CONNECTION_TIMEOUT
;
5028 /* these parameters are set to defaults that are more appropriate
5029 for the increasing samba install base:
5031 as a member of the workgroup, that will possibly become a
5032 _local_ master browser (lm = True). this is opposed to a forced
5033 local master browser startup (pm = True).
5035 doesn't provide WINS server service by default (wsupp = False),
5036 and doesn't provide domain master browser services by default, either.
5040 Globals
.bMsAddPrinterWizard
= True
;
5041 Globals
.os_level
= 20;
5042 Globals
.bLocalMaster
= True
;
5043 Globals
.iDomainMaster
= Auto
; /* depending on bDomainLogons */
5044 Globals
.bDomainLogons
= False
;
5045 Globals
.bBrowseList
= True
;
5046 Globals
.bWINSsupport
= False
;
5047 Globals
.bWINSproxy
= False
;
5049 TALLOC_FREE(Globals
.szInitLogonDelayedHosts
);
5050 Globals
.InitLogonDelay
= 100; /* 100 ms default delay */
5052 Globals
.bDNSproxy
= True
;
5054 /* this just means to use them if they exist */
5055 Globals
.bKernelOplocks
= True
;
5057 Globals
.bAllowTrustedDomains
= True
;
5058 string_set(&Globals
.szIdmapBackend
, "tdb");
5060 string_set(&Globals
.szTemplateShell
, "/bin/false");
5061 string_set(&Globals
.szTemplateHomedir
, "/home/%D/%U");
5062 string_set(&Globals
.szWinbindSeparator
, "\\");
5064 string_set(&Globals
.szCupsServer
, "");
5065 string_set(&Globals
.szIPrintServer
, "");
5067 string_set(&Globals
.ctdbdSocket
, "");
5068 Globals
.szClusterAddresses
= NULL
;
5069 Globals
.clustering
= False
;
5071 Globals
.winbind_cache_time
= 300; /* 5 minutes */
5072 Globals
.winbind_reconnect_delay
= 30; /* 30 seconds */
5073 Globals
.bWinbindEnumUsers
= False
;
5074 Globals
.bWinbindEnumGroups
= False
;
5075 Globals
.bWinbindUseDefaultDomain
= False
;
5076 Globals
.bWinbindTrustedDomainsOnly
= False
;
5077 Globals
.bWinbindNestedGroups
= True
;
5078 Globals
.winbind_expand_groups
= 1;
5079 Globals
.szWinbindNssInfo
= str_list_make_v3(talloc_autofree_context(), "template", NULL
);
5080 Globals
.bWinbindRefreshTickets
= False
;
5081 Globals
.bWinbindOfflineLogon
= False
;
5083 Globals
.iIdmapCacheTime
= 86400 * 7; /* a week by default */
5084 Globals
.iIdmapNegativeCacheTime
= 120; /* 2 minutes by default */
5086 Globals
.bPassdbExpandExplicit
= False
;
5088 Globals
.name_cache_timeout
= 660; /* In seconds */
5090 Globals
.bUseSpnego
= True
;
5091 Globals
.bClientUseSpnego
= True
;
5093 Globals
.client_signing
= Auto
;
5094 Globals
.server_signing
= False
;
5096 Globals
.bDeferSharingViolations
= True
;
5097 string_set(&Globals
.smb_ports
, SMB_PORTS
);
5099 Globals
.bEnablePrivileges
= True
;
5100 Globals
.bHostMSDfs
= True
;
5101 Globals
.bASUSupport
= False
;
5103 /* User defined shares. */
5104 if (asprintf(&s
, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5105 smb_panic("init_globals: ENOMEM");
5107 string_set(&Globals
.szUsersharePath
, s
);
5109 string_set(&Globals
.szUsershareTemplateShare
, "");
5110 Globals
.iUsershareMaxShares
= 0;
5111 /* By default disallow sharing of directories not owned by the sharer. */
5112 Globals
.bUsershareOwnerOnly
= True
;
5113 /* By default disallow guest access to usershares. */
5114 Globals
.bUsershareAllowGuests
= False
;
5116 Globals
.iKeepalive
= DEFAULT_KEEPALIVE
;
5118 /* By default no shares out of the registry */
5119 Globals
.bRegistryShares
= False
;
5121 Globals
.iminreceivefile
= 0;
5123 Globals
.bMapUntrustedToDomain
= false;
5126 /*******************************************************************
5127 Convenience routine to grab string parameters into temporary memory
5128 and run standard_sub_basic on them. The buffers can be written to by
5129 callers without affecting the source string.
5130 ********************************************************************/
5132 static char *lp_string(const char *s
)
5135 TALLOC_CTX
*ctx
= talloc_tos();
5137 /* The follow debug is useful for tracking down memory problems
5138 especially if you have an inner loop that is calling a lp_*()
5139 function that returns a string. Perhaps this debug should be
5140 present all the time? */
5143 DEBUG(10, ("lp_string(%s)\n", s
));
5146 ret
= talloc_sub_basic(ctx
,
5147 get_current_username(),
5148 current_user_info
.domain
,
5150 if (trim_char(ret
, '\"', '\"')) {
5151 if (strchr(ret
,'\"') != NULL
) {
5153 ret
= talloc_sub_basic(ctx
,
5154 get_current_username(),
5155 current_user_info
.domain
,
5163 In this section all the functions that are used to access the
5164 parameters from the rest of the program are defined
5167 #define FN_GLOBAL_STRING(fn_name,ptr) \
5168 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
5169 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5170 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
5171 #define FN_GLOBAL_LIST(fn_name,ptr) \
5172 const char **fn_name(void) {return(*(const char ***)(ptr));}
5173 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5174 bool fn_name(void) {return(*(bool *)(ptr));}
5175 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5176 char fn_name(void) {return(*(char *)(ptr));}
5177 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5178 int fn_name(void) {return(*(int *)(ptr));}
5180 #define FN_LOCAL_STRING(fn_name,val) \
5181 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5182 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5183 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5184 #define FN_LOCAL_LIST(fn_name,val) \
5185 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5186 #define FN_LOCAL_BOOL(fn_name,val) \
5187 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5188 #define FN_LOCAL_INTEGER(fn_name,val) \
5189 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5191 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5192 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5193 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5194 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5195 #define FN_LOCAL_PARM_STRING(fn_name,val) \
5196 char *fn_name(const struct share_params *p) {return(lp_string((LP_SNUM_OK(p->service) && ServicePtrs[(p->service)]->val) ? ServicePtrs[(p->service)]->val : sDefault.val));}
5197 #define FN_LOCAL_CHAR(fn_name,val) \
5198 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5200 FN_GLOBAL_STRING(lp_smb_ports
, &Globals
.smb_ports
)
5201 FN_GLOBAL_STRING(lp_dos_charset
, &Globals
.dos_charset
)
5202 FN_GLOBAL_STRING(lp_unix_charset
, &Globals
.unix_charset
)
5203 FN_GLOBAL_STRING(lp_display_charset
, &Globals
.display_charset
)
5204 FN_GLOBAL_STRING(lp_logfile
, &Globals
.szLogFile
)
5205 FN_GLOBAL_STRING(lp_configfile
, &Globals
.szConfigFile
)
5206 FN_GLOBAL_STRING(lp_smb_passwd_file
, &Globals
.szSMBPasswdFile
)
5207 FN_GLOBAL_STRING(lp_private_dir
, &Globals
.szPrivateDir
)
5208 FN_GLOBAL_STRING(lp_serverstring
, &Globals
.szServerString
)
5209 FN_GLOBAL_INTEGER(lp_printcap_cache_time
, &Globals
.PrintcapCacheTime
)
5210 FN_GLOBAL_STRING(lp_addport_cmd
, &Globals
.szAddPortCommand
)
5211 FN_GLOBAL_STRING(lp_enumports_cmd
, &Globals
.szEnumPortsCommand
)
5212 FN_GLOBAL_STRING(lp_addprinter_cmd
, &Globals
.szAddPrinterCommand
)
5213 FN_GLOBAL_STRING(lp_deleteprinter_cmd
, &Globals
.szDeletePrinterCommand
)
5214 FN_GLOBAL_STRING(lp_os2_driver_map
, &Globals
.szOs2DriverMap
)
5215 FN_GLOBAL_STRING(lp_lockdir
, &Globals
.szLockDir
)
5216 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5217 * build process or in smb.conf, we use that value. Otherwise they
5218 * default to the value of lp_lockdir(). */
5219 char *lp_statedir(void) {
5220 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5221 (strcmp(get_dyn_STATEDIR(), Globals
.szStateDir
) != 0))
5222 return(lp_string(*(char **)(&Globals
.szStateDir
) ?
5223 *(char **)(&Globals
.szStateDir
) : ""));
5225 return(lp_string(*(char **)(&Globals
.szLockDir
) ?
5226 *(char **)(&Globals
.szLockDir
) : ""));
5228 char *lp_cachedir(void) {
5229 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5230 (strcmp(get_dyn_CACHEDIR(), Globals
.szCacheDir
) != 0))
5231 return(lp_string(*(char **)(&Globals
.szCacheDir
) ?
5232 *(char **)(&Globals
.szCacheDir
) : ""));
5234 return(lp_string(*(char **)(&Globals
.szLockDir
) ?
5235 *(char **)(&Globals
.szLockDir
) : ""));
5237 FN_GLOBAL_STRING(lp_piddir
, &Globals
.szPidDir
)
5238 FN_GLOBAL_STRING(lp_mangling_method
, &Globals
.szManglingMethod
)
5239 FN_GLOBAL_INTEGER(lp_mangle_prefix
, &Globals
.mangle_prefix
)
5240 FN_GLOBAL_STRING(lp_utmpdir
, &Globals
.szUtmpDir
)
5241 FN_GLOBAL_STRING(lp_wtmpdir
, &Globals
.szWtmpDir
)
5242 FN_GLOBAL_BOOL(lp_utmp
, &Globals
.bUtmp
)
5243 FN_GLOBAL_STRING(lp_rootdir
, &Globals
.szRootdir
)
5244 FN_GLOBAL_STRING(lp_perfcount_module
, &Globals
.szSMBPerfcountModule
)
5245 FN_GLOBAL_STRING(lp_defaultservice
, &Globals
.szDefaultService
)
5246 FN_GLOBAL_STRING(lp_msg_command
, &Globals
.szMsgCommand
)
5247 FN_GLOBAL_STRING(lp_get_quota_command
, &Globals
.szGetQuota
)
5248 FN_GLOBAL_STRING(lp_set_quota_command
, &Globals
.szSetQuota
)
5249 FN_GLOBAL_STRING(lp_auto_services
, &Globals
.szAutoServices
)
5250 FN_GLOBAL_STRING(lp_passwd_program
, &Globals
.szPasswdProgram
)
5251 FN_GLOBAL_STRING(lp_passwd_chat
, &Globals
.szPasswdChat
)
5252 FN_GLOBAL_STRING(lp_passwordserver
, &Globals
.szPasswordServer
)
5253 FN_GLOBAL_STRING(lp_name_resolve_order
, &Globals
.szNameResolveOrder
)
5254 FN_GLOBAL_STRING(lp_realm
, &Globals
.szRealm
)
5255 FN_GLOBAL_CONST_STRING(lp_afs_username_map
, &Globals
.szAfsUsernameMap
)
5256 FN_GLOBAL_INTEGER(lp_afs_token_lifetime
, &Globals
.iAfsTokenLifetime
)
5257 FN_GLOBAL_STRING(lp_log_nt_token_command
, &Globals
.szLogNtTokenCommand
)
5258 FN_GLOBAL_STRING(lp_username_map
, &Globals
.szUsernameMap
)
5259 FN_GLOBAL_CONST_STRING(lp_logon_script
, &Globals
.szLogonScript
)
5260 FN_GLOBAL_CONST_STRING(lp_logon_path
, &Globals
.szLogonPath
)
5261 FN_GLOBAL_CONST_STRING(lp_logon_drive
, &Globals
.szLogonDrive
)
5262 FN_GLOBAL_CONST_STRING(lp_logon_home
, &Globals
.szLogonHome
)
5263 FN_GLOBAL_STRING(lp_remote_announce
, &Globals
.szRemoteAnnounce
)
5264 FN_GLOBAL_STRING(lp_remote_browse_sync
, &Globals
.szRemoteBrowseSync
)
5265 FN_GLOBAL_LIST(lp_wins_server_list
, &Globals
.szWINSservers
)
5266 FN_GLOBAL_LIST(lp_interfaces
, &Globals
.szInterfaces
)
5267 FN_GLOBAL_STRING(lp_nis_home_map_name
, &Globals
.szNISHomeMapName
)
5268 static FN_GLOBAL_STRING(lp_announce_version
, &Globals
.szAnnounceVersion
)
5269 FN_GLOBAL_LIST(lp_netbios_aliases
, &Globals
.szNetbiosAliases
)
5270 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
5271 * lp_passdb_backend() should be replace by the this macro again after
5274 const char *lp_passdb_backend(void)
5276 char *delim
, *quote
;
5278 delim
= strchr( Globals
.szPassdbBackend
, ' ');
5279 /* no space at all */
5280 if (delim
== NULL
) {
5284 quote
= strchr(Globals
.szPassdbBackend
, '"');
5285 /* no quote char or non in the first part */
5286 if (quote
== NULL
|| quote
> delim
) {
5291 quote
= strchr(quote
+1, '"');
5292 if (quote
== NULL
) {
5293 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
5295 } else if (*(quote
+1) == '\0') {
5296 /* space, fitting quote char, and one backend only */
5299 /* terminate string after the fitting quote char */
5304 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5305 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5306 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5307 "backend (%s) is used. The rest is ignored.\n", Globals
.szPassdbBackend
));
5310 return Globals
.szPassdbBackend
;
5312 FN_GLOBAL_LIST(lp_preload_modules
, &Globals
.szPreloadModules
)
5313 FN_GLOBAL_STRING(lp_panic_action
, &Globals
.szPanicAction
)
5314 FN_GLOBAL_STRING(lp_adduser_script
, &Globals
.szAddUserScript
)
5315 FN_GLOBAL_STRING(lp_renameuser_script
, &Globals
.szRenameUserScript
)
5316 FN_GLOBAL_STRING(lp_deluser_script
, &Globals
.szDelUserScript
)
5318 FN_GLOBAL_CONST_STRING(lp_guestaccount
, &Globals
.szGuestaccount
)
5319 FN_GLOBAL_STRING(lp_addgroup_script
, &Globals
.szAddGroupScript
)
5320 FN_GLOBAL_STRING(lp_delgroup_script
, &Globals
.szDelGroupScript
)
5321 FN_GLOBAL_STRING(lp_addusertogroup_script
, &Globals
.szAddUserToGroupScript
)
5322 FN_GLOBAL_STRING(lp_deluserfromgroup_script
, &Globals
.szDelUserFromGroupScript
)
5323 FN_GLOBAL_STRING(lp_setprimarygroup_script
, &Globals
.szSetPrimaryGroupScript
)
5325 FN_GLOBAL_STRING(lp_addmachine_script
, &Globals
.szAddMachineScript
)
5327 FN_GLOBAL_STRING(lp_shutdown_script
, &Globals
.szShutdownScript
)
5328 FN_GLOBAL_STRING(lp_abort_shutdown_script
, &Globals
.szAbortShutdownScript
)
5329 FN_GLOBAL_STRING(lp_username_map_script
, &Globals
.szUsernameMapScript
)
5331 FN_GLOBAL_STRING(lp_check_password_script
, &Globals
.szCheckPasswordScript
)
5333 FN_GLOBAL_STRING(lp_wins_hook
, &Globals
.szWINSHook
)
5334 FN_GLOBAL_CONST_STRING(lp_template_homedir
, &Globals
.szTemplateHomedir
)
5335 FN_GLOBAL_CONST_STRING(lp_template_shell
, &Globals
.szTemplateShell
)
5336 FN_GLOBAL_CONST_STRING(lp_winbind_separator
, &Globals
.szWinbindSeparator
)
5337 FN_GLOBAL_INTEGER(lp_acl_compatibility
, &Globals
.iAclCompat
)
5338 FN_GLOBAL_BOOL(lp_winbind_enum_users
, &Globals
.bWinbindEnumUsers
)
5339 FN_GLOBAL_BOOL(lp_winbind_enum_groups
, &Globals
.bWinbindEnumGroups
)
5340 FN_GLOBAL_BOOL(lp_winbind_use_default_domain
, &Globals
.bWinbindUseDefaultDomain
)
5341 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only
, &Globals
.bWinbindTrustedDomainsOnly
)
5342 FN_GLOBAL_BOOL(lp_winbind_nested_groups
, &Globals
.bWinbindNestedGroups
)
5343 FN_GLOBAL_INTEGER(lp_winbind_expand_groups
, &Globals
.winbind_expand_groups
)
5344 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets
, &Globals
.bWinbindRefreshTickets
)
5345 FN_GLOBAL_BOOL(lp_winbind_offline_logon
, &Globals
.bWinbindOfflineLogon
)
5346 FN_GLOBAL_BOOL(lp_winbind_normalize_names
, &Globals
.bWinbindNormalizeNames
)
5347 FN_GLOBAL_BOOL(lp_winbind_rpc_only
, &Globals
.bWinbindRpcOnly
)
5349 FN_GLOBAL_CONST_STRING(lp_idmap_backend
, &Globals
.szIdmapBackend
)
5350 FN_GLOBAL_STRING(lp_idmap_alloc_backend
, &Globals
.szIdmapAllocBackend
)
5351 FN_GLOBAL_INTEGER(lp_idmap_cache_time
, &Globals
.iIdmapCacheTime
)
5352 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time
, &Globals
.iIdmapNegativeCacheTime
)
5353 FN_GLOBAL_INTEGER(lp_keepalive
, &Globals
.iKeepalive
)
5354 FN_GLOBAL_BOOL(lp_passdb_expand_explicit
, &Globals
.bPassdbExpandExplicit
)
5356 FN_GLOBAL_STRING(lp_ldap_suffix
, &Globals
.szLdapSuffix
)
5357 FN_GLOBAL_STRING(lp_ldap_admin_dn
, &Globals
.szLdapAdminDn
)
5358 FN_GLOBAL_INTEGER(lp_ldap_ssl
, &Globals
.ldap_ssl
)
5359 FN_GLOBAL_BOOL(lp_ldap_ssl_ads
, &Globals
.ldap_ssl_ads
)
5360 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync
, &Globals
.ldap_passwd_sync
)
5361 FN_GLOBAL_BOOL(lp_ldap_delete_dn
, &Globals
.ldap_delete_dn
)
5362 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep
, &Globals
.ldap_replication_sleep
)
5363 FN_GLOBAL_INTEGER(lp_ldap_timeout
, &Globals
.ldap_timeout
)
5364 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout
, &Globals
.ldap_connection_timeout
)
5365 FN_GLOBAL_INTEGER(lp_ldap_page_size
, &Globals
.ldap_page_size
)
5366 FN_GLOBAL_INTEGER(lp_ldap_debug_level
, &Globals
.ldap_debug_level
)
5367 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold
, &Globals
.ldap_debug_threshold
)
5368 FN_GLOBAL_STRING(lp_add_share_cmd
, &Globals
.szAddShareCommand
)
5369 FN_GLOBAL_STRING(lp_change_share_cmd
, &Globals
.szChangeShareCommand
)
5370 FN_GLOBAL_STRING(lp_delete_share_cmd
, &Globals
.szDeleteShareCommand
)
5371 FN_GLOBAL_STRING(lp_usershare_path
, &Globals
.szUsersharePath
)
5372 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list
, &Globals
.szUsersharePrefixAllowList
)
5373 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list
, &Globals
.szUsersharePrefixDenyList
)
5375 FN_GLOBAL_LIST(lp_eventlog_list
, &Globals
.szEventLogs
)
5377 FN_GLOBAL_BOOL(lp_registry_shares
, &Globals
.bRegistryShares
)
5378 FN_GLOBAL_BOOL(lp_usershare_allow_guests
, &Globals
.bUsershareAllowGuests
)
5379 FN_GLOBAL_BOOL(lp_usershare_owner_only
, &Globals
.bUsershareOwnerOnly
)
5380 FN_GLOBAL_BOOL(lp_disable_netbios
, &Globals
.bDisableNetbios
)
5381 FN_GLOBAL_BOOL(lp_reset_on_zero_vc
, &Globals
.bResetOnZeroVC
)
5382 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard
, &Globals
.bMsAddPrinterWizard
)
5383 FN_GLOBAL_BOOL(lp_dns_proxy
, &Globals
.bDNSproxy
)
5384 FN_GLOBAL_BOOL(lp_wins_support
, &Globals
.bWINSsupport
)
5385 FN_GLOBAL_BOOL(lp_we_are_a_wins_server
, &Globals
.bWINSsupport
)
5386 FN_GLOBAL_BOOL(lp_wins_proxy
, &Globals
.bWINSproxy
)
5387 FN_GLOBAL_BOOL(lp_local_master
, &Globals
.bLocalMaster
)
5388 FN_GLOBAL_BOOL(lp_domain_logons
, &Globals
.bDomainLogons
)
5389 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts
, &Globals
.szInitLogonDelayedHosts
)
5390 FN_GLOBAL_INTEGER(lp_init_logon_delay
, &Globals
.InitLogonDelay
)
5391 FN_GLOBAL_BOOL(lp_load_printers
, &Globals
.bLoadPrinters
)
5392 FN_GLOBAL_BOOL(lp_readraw
, &Globals
.bReadRaw
)
5393 FN_GLOBAL_BOOL(lp_large_readwrite
, &Globals
.bLargeReadwrite
)
5394 FN_GLOBAL_BOOL(lp_writeraw
, &Globals
.bWriteRaw
)
5395 FN_GLOBAL_BOOL(lp_null_passwords
, &Globals
.bNullPasswords
)
5396 FN_GLOBAL_BOOL(lp_obey_pam_restrictions
, &Globals
.bObeyPamRestrictions
)
5397 FN_GLOBAL_BOOL(lp_encrypted_passwords
, &Globals
.bEncryptPasswords
)
5398 FN_GLOBAL_BOOL(lp_update_encrypted
, &Globals
.bUpdateEncrypt
)
5399 FN_GLOBAL_INTEGER(lp_client_schannel
, &Globals
.clientSchannel
)
5400 FN_GLOBAL_INTEGER(lp_server_schannel
, &Globals
.serverSchannel
)
5401 FN_GLOBAL_BOOL(lp_syslog_only
, &Globals
.bSyslogOnly
)
5402 FN_GLOBAL_BOOL(lp_timestamp_logs
, &Globals
.bTimestampLogs
)
5403 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp
, &Globals
.bDebugPrefixTimestamp
)
5404 FN_GLOBAL_BOOL(lp_debug_hires_timestamp
, &Globals
.bDebugHiresTimestamp
)
5405 FN_GLOBAL_BOOL(lp_debug_pid
, &Globals
.bDebugPid
)
5406 FN_GLOBAL_BOOL(lp_debug_uid
, &Globals
.bDebugUid
)
5407 FN_GLOBAL_BOOL(lp_debug_class
, &Globals
.bDebugClass
)
5408 FN_GLOBAL_BOOL(lp_enable_core_files
, &Globals
.bEnableCoreFiles
)
5409 FN_GLOBAL_BOOL(lp_browse_list
, &Globals
.bBrowseList
)
5410 FN_GLOBAL_BOOL(lp_nis_home_map
, &Globals
.bNISHomeMap
)
5411 static FN_GLOBAL_BOOL(lp_time_server
, &Globals
.bTimeServer
)
5412 FN_GLOBAL_BOOL(lp_bind_interfaces_only
, &Globals
.bBindInterfacesOnly
)
5413 FN_GLOBAL_BOOL(lp_pam_password_change
, &Globals
.bPamPasswordChange
)
5414 FN_GLOBAL_BOOL(lp_unix_password_sync
, &Globals
.bUnixPasswdSync
)
5415 FN_GLOBAL_BOOL(lp_passwd_chat_debug
, &Globals
.bPasswdChatDebug
)
5416 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout
, &Globals
.iPasswdChatTimeout
)
5417 FN_GLOBAL_BOOL(lp_nt_pipe_support
, &Globals
.bNTPipeSupport
)
5418 FN_GLOBAL_BOOL(lp_nt_status_support
, &Globals
.bNTStatusSupport
)
5419 FN_GLOBAL_BOOL(lp_stat_cache
, &Globals
.bStatCache
)
5420 FN_GLOBAL_INTEGER(lp_max_stat_cache_size
, &Globals
.iMaxStatCacheSize
)
5421 FN_GLOBAL_BOOL(lp_allow_trusted_domains
, &Globals
.bAllowTrustedDomains
)
5422 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain
, &Globals
.bMapUntrustedToDomain
)
5423 FN_GLOBAL_INTEGER(lp_restrict_anonymous
, &Globals
.restrict_anonymous
)
5424 FN_GLOBAL_BOOL(lp_lanman_auth
, &Globals
.bLanmanAuth
)
5425 FN_GLOBAL_BOOL(lp_ntlm_auth
, &Globals
.bNTLMAuth
)
5426 FN_GLOBAL_BOOL(lp_client_plaintext_auth
, &Globals
.bClientPlaintextAuth
)
5427 FN_GLOBAL_BOOL(lp_client_lanman_auth
, &Globals
.bClientLanManAuth
)
5428 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth
, &Globals
.bClientNTLMv2Auth
)
5429 FN_GLOBAL_BOOL(lp_host_msdfs
, &Globals
.bHostMSDfs
)
5430 FN_GLOBAL_BOOL(lp_kernel_oplocks
, &Globals
.bKernelOplocks
)
5431 FN_GLOBAL_BOOL(lp_enhanced_browsing
, &Globals
.enhanced_browsing
)
5432 FN_GLOBAL_BOOL(lp_use_mmap
, &Globals
.bUseMmap
)
5433 FN_GLOBAL_BOOL(lp_unix_extensions
, &Globals
.bUnixExtensions
)
5434 FN_GLOBAL_BOOL(lp_use_spnego
, &Globals
.bUseSpnego
)
5435 FN_GLOBAL_BOOL(lp_client_use_spnego
, &Globals
.bClientUseSpnego
)
5436 FN_GLOBAL_BOOL(lp_hostname_lookups
, &Globals
.bHostnameLookups
)
5437 FN_LOCAL_PARM_BOOL(lp_change_notify
, bChangeNotify
)
5438 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify
, bKernelChangeNotify
)
5439 FN_GLOBAL_STRING(lp_dedicated_keytab_file
, &Globals
.szDedicatedKeytabFile
)
5440 FN_GLOBAL_INTEGER(lp_kerberos_method
, &Globals
.iKerberosMethod
)
5441 FN_GLOBAL_BOOL(lp_defer_sharing_violations
, &Globals
.bDeferSharingViolations
)
5442 FN_GLOBAL_BOOL(lp_enable_privileges
, &Globals
.bEnablePrivileges
)
5443 FN_GLOBAL_BOOL(lp_enable_asu_support
, &Globals
.bASUSupport
)
5444 FN_GLOBAL_INTEGER(lp_os_level
, &Globals
.os_level
)
5445 FN_GLOBAL_INTEGER(lp_max_ttl
, &Globals
.max_ttl
)
5446 FN_GLOBAL_INTEGER(lp_max_wins_ttl
, &Globals
.max_wins_ttl
)
5447 FN_GLOBAL_INTEGER(lp_min_wins_ttl
, &Globals
.min_wins_ttl
)
5448 FN_GLOBAL_INTEGER(lp_max_log_size
, &Globals
.max_log_size
)
5449 FN_GLOBAL_INTEGER(lp_max_open_files
, &Globals
.max_open_files
)
5450 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size
, &Globals
.open_files_db_hash_size
)
5451 FN_GLOBAL_INTEGER(lp_maxxmit
, &Globals
.max_xmit
)
5452 FN_GLOBAL_INTEGER(lp_maxmux
, &Globals
.max_mux
)
5453 FN_GLOBAL_INTEGER(lp_passwordlevel
, &Globals
.pwordlevel
)
5454 FN_GLOBAL_INTEGER(lp_usernamelevel
, &Globals
.unamelevel
)
5455 FN_GLOBAL_INTEGER(lp_deadtime
, &Globals
.deadtime
)
5456 FN_GLOBAL_BOOL(lp_getwd_cache
, &Globals
.getwd_cache
)
5457 FN_GLOBAL_INTEGER(lp_maxprotocol
, &Globals
.maxprotocol
)
5458 FN_GLOBAL_INTEGER(lp_minprotocol
, &Globals
.minprotocol
)
5459 FN_GLOBAL_INTEGER(lp_security
, &Globals
.security
)
5460 FN_GLOBAL_LIST(lp_auth_methods
, &Globals
.AuthMethods
)
5461 FN_GLOBAL_BOOL(lp_paranoid_server_security
, &Globals
.paranoid_server_security
)
5462 FN_GLOBAL_INTEGER(lp_maxdisksize
, &Globals
.maxdisksize
)
5463 FN_GLOBAL_INTEGER(lp_lpqcachetime
, &Globals
.lpqcachetime
)
5464 FN_GLOBAL_INTEGER(lp_max_smbd_processes
, &Globals
.iMaxSmbdProcesses
)
5465 FN_GLOBAL_BOOL(_lp_disable_spoolss
, &Globals
.bDisableSpoolss
)
5466 FN_GLOBAL_INTEGER(lp_syslog
, &Globals
.syslog
)
5467 static FN_GLOBAL_INTEGER(lp_announce_as
, &Globals
.announce_as
)
5468 FN_GLOBAL_INTEGER(lp_lm_announce
, &Globals
.lm_announce
)
5469 FN_GLOBAL_INTEGER(lp_lm_interval
, &Globals
.lm_interval
)
5470 FN_GLOBAL_INTEGER(lp_machine_password_timeout
, &Globals
.machine_password_timeout
)
5471 FN_GLOBAL_INTEGER(lp_map_to_guest
, &Globals
.map_to_guest
)
5472 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time
, &Globals
.oplock_break_wait_time
)
5473 FN_GLOBAL_INTEGER(lp_lock_spin_time
, &Globals
.iLockSpinTime
)
5474 FN_GLOBAL_INTEGER(lp_usershare_max_shares
, &Globals
.iUsershareMaxShares
)
5475 FN_GLOBAL_CONST_STRING(lp_socket_options
, &Globals
.szSocketOptions
)
5476 FN_GLOBAL_INTEGER(lp_config_backend
, &Globals
.ConfigBackend
)
5478 FN_LOCAL_STRING(lp_preexec
, szPreExec
)
5479 FN_LOCAL_STRING(lp_postexec
, szPostExec
)
5480 FN_LOCAL_STRING(lp_rootpreexec
, szRootPreExec
)
5481 FN_LOCAL_STRING(lp_rootpostexec
, szRootPostExec
)
5482 FN_LOCAL_STRING(lp_servicename
, szService
)
5483 FN_LOCAL_CONST_STRING(lp_const_servicename
, szService
)
5484 FN_LOCAL_STRING(lp_pathname
, szPath
)
5485 FN_LOCAL_STRING(lp_dontdescend
, szDontdescend
)
5486 FN_LOCAL_STRING(lp_username
, szUsername
)
5487 FN_LOCAL_LIST(lp_invalid_users
, szInvalidUsers
)
5488 FN_LOCAL_LIST(lp_valid_users
, szValidUsers
)
5489 FN_LOCAL_LIST(lp_admin_users
, szAdminUsers
)
5490 FN_GLOBAL_LIST(lp_svcctl_list
, &Globals
.szServicesList
)
5491 FN_LOCAL_STRING(lp_cups_options
, szCupsOptions
)
5492 FN_GLOBAL_STRING(lp_cups_server
, &Globals
.szCupsServer
)
5493 int lp_cups_encrypt(void)
5495 #ifdef HAVE_HTTPCONNECTENCRYPT
5496 switch (Globals
.CupsEncrypt
) {
5498 Globals
.CupsEncrypt
= HTTP_ENCRYPT_REQUIRED
;
5501 Globals
.CupsEncrypt
= HTTP_ENCRYPT_ALWAYS
;
5504 Globals
.CupsEncrypt
= HTTP_ENCRYPT_NEVER
;
5508 return Globals
.CupsEncrypt
;
5510 FN_GLOBAL_STRING(lp_iprint_server
, &Globals
.szIPrintServer
)
5511 FN_GLOBAL_INTEGER(lp_cups_connection_timeout
, &Globals
.cups_connection_timeout
)
5512 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket
, &Globals
.ctdbdSocket
)
5513 FN_GLOBAL_LIST(lp_cluster_addresses
, &Globals
.szClusterAddresses
)
5514 FN_GLOBAL_BOOL(lp_clustering
, &Globals
.clustering
)
5515 FN_LOCAL_STRING(lp_printcommand
, szPrintcommand
)
5516 FN_LOCAL_STRING(lp_lpqcommand
, szLpqcommand
)
5517 FN_LOCAL_STRING(lp_lprmcommand
, szLprmcommand
)
5518 FN_LOCAL_STRING(lp_lppausecommand
, szLppausecommand
)
5519 FN_LOCAL_STRING(lp_lpresumecommand
, szLpresumecommand
)
5520 FN_LOCAL_STRING(lp_queuepausecommand
, szQueuepausecommand
)
5521 FN_LOCAL_STRING(lp_queueresumecommand
, szQueueresumecommand
)
5522 static FN_LOCAL_STRING(_lp_printername
, szPrintername
)
5523 FN_LOCAL_CONST_STRING(lp_printjob_username
, szPrintjobUsername
)
5524 FN_LOCAL_LIST(lp_hostsallow
, szHostsallow
)
5525 FN_LOCAL_LIST(lp_hostsdeny
, szHostsdeny
)
5526 FN_LOCAL_STRING(lp_magicscript
, szMagicScript
)
5527 FN_LOCAL_STRING(lp_magicoutput
, szMagicOutput
)
5528 FN_LOCAL_STRING(lp_comment
, comment
)
5529 FN_LOCAL_STRING(lp_force_user
, force_user
)
5530 FN_LOCAL_STRING(lp_force_group
, force_group
)
5531 FN_LOCAL_LIST(lp_readlist
, readlist
)
5532 FN_LOCAL_LIST(lp_writelist
, writelist
)
5533 FN_LOCAL_LIST(lp_printer_admin
, printer_admin
)
5534 FN_LOCAL_STRING(lp_fstype
, fstype
)
5535 FN_LOCAL_LIST(lp_vfs_objects
, szVfsObjects
)
5536 FN_LOCAL_STRING(lp_msdfs_proxy
, szMSDfsProxy
)
5537 static FN_LOCAL_STRING(lp_volume
, volume
)
5538 FN_LOCAL_STRING(lp_veto_files
, szVetoFiles
)
5539 FN_LOCAL_STRING(lp_hide_files
, szHideFiles
)
5540 FN_LOCAL_STRING(lp_veto_oplocks
, szVetoOplockFiles
)
5541 FN_LOCAL_BOOL(lp_msdfs_root
, bMSDfsRoot
)
5542 FN_LOCAL_STRING(lp_aio_write_behind
, szAioWriteBehind
)
5543 FN_LOCAL_STRING(lp_dfree_command
, szDfree
)
5544 FN_LOCAL_BOOL(lp_autoloaded
, autoloaded
)
5545 FN_LOCAL_BOOL(lp_preexec_close
, bPreexecClose
)
5546 FN_LOCAL_BOOL(lp_rootpreexec_close
, bRootpreexecClose
)
5547 FN_LOCAL_INTEGER(lp_casesensitive
, iCaseSensitive
)
5548 FN_LOCAL_BOOL(lp_preservecase
, bCasePreserve
)
5549 FN_LOCAL_BOOL(lp_shortpreservecase
, bShortCasePreserve
)
5550 FN_LOCAL_BOOL(lp_hide_dot_files
, bHideDotFiles
)
5551 FN_LOCAL_BOOL(lp_hide_special_files
, bHideSpecialFiles
)
5552 FN_LOCAL_BOOL(lp_hideunreadable
, bHideUnReadable
)
5553 FN_LOCAL_BOOL(lp_hideunwriteable_files
, bHideUnWriteableFiles
)
5554 FN_LOCAL_BOOL(lp_browseable
, bBrowseable
)
5555 FN_LOCAL_BOOL(lp_access_based_share_enum
, bAccessBasedShareEnum
)
5556 FN_LOCAL_BOOL(lp_readonly
, bRead_only
)
5557 FN_LOCAL_BOOL(lp_no_set_dir
, bNo_set_dir
)
5558 FN_LOCAL_BOOL(lp_guest_ok
, bGuest_ok
)
5559 FN_LOCAL_BOOL(lp_guest_only
, bGuest_only
)
5560 FN_LOCAL_BOOL(lp_administrative_share
, bAdministrative_share
)
5561 FN_LOCAL_BOOL(lp_print_ok
, bPrint_ok
)
5562 FN_LOCAL_BOOL(lp_map_hidden
, bMap_hidden
)
5563 FN_LOCAL_BOOL(lp_map_archive
, bMap_archive
)
5564 FN_LOCAL_BOOL(lp_store_dos_attributes
, bStoreDosAttributes
)
5565 FN_LOCAL_BOOL(lp_dmapi_support
, bDmapiSupport
)
5566 FN_LOCAL_PARM_BOOL(lp_locking
, bLocking
)
5567 FN_LOCAL_PARM_INTEGER(lp_strict_locking
, iStrictLocking
)
5568 FN_LOCAL_PARM_BOOL(lp_posix_locking
, bPosixLocking
)
5569 FN_LOCAL_BOOL(lp_share_modes
, bShareModes
)
5570 FN_LOCAL_BOOL(lp_oplocks
, bOpLocks
)
5571 FN_LOCAL_BOOL(lp_level2_oplocks
, bLevel2OpLocks
)
5572 FN_LOCAL_BOOL(lp_onlyuser
, bOnlyUser
)
5573 FN_LOCAL_PARM_BOOL(lp_manglednames
, bMangledNames
)
5574 FN_LOCAL_BOOL(lp_widelinks
, bWidelinks
)
5575 FN_LOCAL_BOOL(lp_symlinks
, bSymlinks
)
5576 FN_LOCAL_BOOL(lp_syncalways
, bSyncAlways
)
5577 FN_LOCAL_BOOL(lp_strict_allocate
, bStrictAllocate
)
5578 FN_LOCAL_BOOL(lp_strict_sync
, bStrictSync
)
5579 FN_LOCAL_BOOL(lp_map_system
, bMap_system
)
5580 FN_LOCAL_BOOL(lp_delete_readonly
, bDeleteReadonly
)
5581 FN_LOCAL_BOOL(lp_fake_oplocks
, bFakeOplocks
)
5582 FN_LOCAL_BOOL(lp_recursive_veto_delete
, bDeleteVetoFiles
)
5583 FN_LOCAL_BOOL(lp_dos_filemode
, bDosFilemode
)
5584 FN_LOCAL_BOOL(lp_dos_filetimes
, bDosFiletimes
)
5585 FN_LOCAL_BOOL(lp_dos_filetime_resolution
, bDosFiletimeResolution
)
5586 FN_LOCAL_BOOL(lp_fake_dir_create_times
, bFakeDirCreateTimes
)
5587 FN_LOCAL_BOOL(lp_blocking_locks
, bBlockingLocks
)
5588 FN_LOCAL_BOOL(lp_inherit_perms
, bInheritPerms
)
5589 FN_LOCAL_BOOL(lp_inherit_acls
, bInheritACLS
)
5590 FN_LOCAL_BOOL(lp_inherit_owner
, bInheritOwner
)
5591 FN_LOCAL_BOOL(lp_use_client_driver
, bUseClientDriver
)
5592 FN_LOCAL_BOOL(lp_default_devmode
, bDefaultDevmode
)
5593 FN_LOCAL_BOOL(lp_force_printername
, bForcePrintername
)
5594 FN_LOCAL_BOOL(lp_nt_acl_support
, bNTAclSupport
)
5595 FN_LOCAL_BOOL(lp_force_unknown_acl_user
, bForceUnknownAclUser
)
5596 FN_LOCAL_BOOL(lp_ea_support
, bEASupport
)
5597 FN_LOCAL_BOOL(_lp_use_sendfile
, bUseSendfile
)
5598 FN_LOCAL_BOOL(lp_profile_acls
, bProfileAcls
)
5599 FN_LOCAL_BOOL(lp_map_acl_inherit
, bMap_acl_inherit
)
5600 FN_LOCAL_BOOL(lp_afs_share
, bAfs_Share
)
5601 FN_LOCAL_BOOL(lp_acl_check_permissions
, bAclCheckPermissions
)
5602 FN_LOCAL_BOOL(lp_acl_group_control
, bAclGroupControl
)
5603 FN_LOCAL_BOOL(lp_acl_map_full_control
, bAclMapFullControl
)
5604 FN_LOCAL_INTEGER(lp_create_mask
, iCreate_mask
)
5605 FN_LOCAL_INTEGER(lp_force_create_mode
, iCreate_force_mode
)
5606 FN_LOCAL_INTEGER(lp_security_mask
, iSecurity_mask
)
5607 FN_LOCAL_INTEGER(lp_force_security_mode
, iSecurity_force_mode
)
5608 FN_LOCAL_INTEGER(lp_dir_mask
, iDir_mask
)
5609 FN_LOCAL_INTEGER(lp_force_dir_mode
, iDir_force_mode
)
5610 FN_LOCAL_INTEGER(lp_dir_security_mask
, iDir_Security_mask
)
5611 FN_LOCAL_INTEGER(lp_force_dir_security_mode
, iDir_Security_force_mode
)
5612 FN_LOCAL_INTEGER(lp_max_connections
, iMaxConnections
)
5613 FN_LOCAL_INTEGER(lp_defaultcase
, iDefaultCase
)
5614 FN_LOCAL_INTEGER(lp_minprintspace
, iMinPrintSpace
)
5615 FN_LOCAL_INTEGER(lp_printing
, iPrinting
)
5616 FN_LOCAL_INTEGER(lp_max_reported_jobs
, iMaxReportedPrintJobs
)
5617 FN_LOCAL_INTEGER(lp_oplock_contention_limit
, iOplockContentionLimit
)
5618 FN_LOCAL_INTEGER(lp_csc_policy
, iCSCPolicy
)
5619 FN_LOCAL_INTEGER(lp_write_cache_size
, iWriteCacheSize
)
5620 FN_LOCAL_INTEGER(lp_block_size
, iBlock_size
)
5621 FN_LOCAL_INTEGER(lp_dfree_cache_time
, iDfreeCacheTime
)
5622 FN_LOCAL_INTEGER(lp_allocation_roundup_size
, iallocation_roundup_size
)
5623 FN_LOCAL_INTEGER(lp_aio_read_size
, iAioReadSize
)
5624 FN_LOCAL_INTEGER(lp_aio_write_size
, iAioWriteSize
)
5625 FN_LOCAL_INTEGER(lp_map_readonly
, iMap_readonly
)
5626 FN_LOCAL_INTEGER(lp_directory_name_cache_size
, iDirectoryNameCacheSize
)
5627 FN_LOCAL_INTEGER(lp_smb_encrypt
, ismb_encrypt
)
5628 FN_LOCAL_CHAR(lp_magicchar
, magic_char
)
5629 FN_GLOBAL_INTEGER(lp_winbind_cache_time
, &Globals
.winbind_cache_time
)
5630 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay
, &Globals
.winbind_reconnect_delay
)
5631 FN_GLOBAL_LIST(lp_winbind_nss_info
, &Globals
.szWinbindNssInfo
)
5632 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base
, &Globals
.AlgorithmicRidBase
)
5633 FN_GLOBAL_INTEGER(lp_name_cache_timeout
, &Globals
.name_cache_timeout
)
5634 FN_GLOBAL_INTEGER(lp_client_signing
, &Globals
.client_signing
)
5635 FN_GLOBAL_INTEGER(lp_server_signing
, &Globals
.server_signing
)
5636 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping
, &Globals
.client_ldap_sasl_wrapping
)
5638 /* local prototypes */
5640 static int map_parameter(const char *pszParmName
);
5641 static int map_parameter_canonical(const char *pszParmName
, bool *inverse
);
5642 static const char *get_boolean(bool bool_value
);
5643 static int getservicebyname(const char *pszServiceName
,
5644 struct service
*pserviceDest
);
5645 static void copy_service(struct service
*pserviceDest
,
5646 struct service
*pserviceSource
,
5647 struct bitmap
*pcopymapDest
);
5648 static bool do_parameter(const char *pszParmName
, const char *pszParmValue
,
5650 static bool do_section(const char *pszSectionName
, void *userdata
);
5651 static void init_copymap(struct service
*pservice
);
5652 static bool hash_a_service(const char *name
, int number
);
5653 static void free_service_byindex(int iService
);
5654 static void free_param_opts(struct param_opt_struct
**popts
);
5655 static char * canonicalize_servicename(const char *name
);
5656 static void show_parameter(int parmIndex
);
5657 static bool is_synonym_of(int parm1
, int parm2
, bool *inverse
);
5660 * This is a helper function for parametrical options support. It returns a
5661 * pointer to parametrical option value if it exists or NULL otherwise. Actual
5662 * parametrical functions are quite simple
5664 static struct param_opt_struct
*get_parametrics(int snum
, const char *type
,
5667 bool global_section
= False
;
5669 struct param_opt_struct
*data
;
5671 if (snum
>= iNumServices
) return NULL
;
5674 data
= Globals
.param_opt
;
5675 global_section
= True
;
5677 data
= ServicePtrs
[snum
]->param_opt
;
5680 if (asprintf(¶m_key
, "%s:%s", type
, option
) == -1) {
5681 DEBUG(0,("asprintf failed!\n"));
5686 if (strwicmp(data
->key
, param_key
) == 0) {
5687 string_free(¶m_key
);
5693 if (!global_section
) {
5694 /* Try to fetch the same option but from globals */
5695 /* but only if we are not already working with Globals */
5696 data
= Globals
.param_opt
;
5698 if (strwicmp(data
->key
, param_key
) == 0) {
5699 string_free(¶m_key
);
5706 string_free(¶m_key
);
5712 #define MISSING_PARAMETER(name) \
5713 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
5715 /*******************************************************************
5716 convenience routine to return int parameters.
5717 ********************************************************************/
5718 static int lp_int(const char *s
)
5722 MISSING_PARAMETER(lp_int
);
5726 return (int)strtol(s
, NULL
, 0);
5729 /*******************************************************************
5730 convenience routine to return unsigned long parameters.
5731 ********************************************************************/
5732 static unsigned long lp_ulong(const char *s
)
5736 MISSING_PARAMETER(lp_ulong
);
5740 return strtoul(s
, NULL
, 0);
5743 /*******************************************************************
5744 convenience routine to return boolean parameters.
5745 ********************************************************************/
5746 static bool lp_bool(const char *s
)
5751 MISSING_PARAMETER(lp_bool
);
5755 if (!set_boolean(s
, &ret
)) {
5756 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s
));
5763 /*******************************************************************
5764 convenience routine to return enum parameters.
5765 ********************************************************************/
5766 static int lp_enum(const char *s
,const struct enum_list
*_enum
)
5770 if (!s
|| !*s
|| !_enum
) {
5771 MISSING_PARAMETER(lp_enum
);
5775 for (i
=0; _enum
[i
].name
; i
++) {
5776 if (strequal(_enum
[i
].name
,s
))
5777 return _enum
[i
].value
;
5780 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s
));
5784 #undef MISSING_PARAMETER
5786 /* DO NOT USE lp_parm_string ANYMORE!!!!
5787 * use lp_parm_const_string or lp_parm_talloc_string
5789 * lp_parm_string is only used to let old modules find this symbol
5791 #undef lp_parm_string
5792 char *lp_parm_string(const char *servicename
, const char *type
, const char *option
);
5793 char *lp_parm_string(const char *servicename
, const char *type
, const char *option
)
5795 return lp_parm_talloc_string(lp_servicenumber(servicename
), type
, option
, NULL
);
5798 /* Return parametric option from a given service. Type is a part of option before ':' */
5799 /* Parametric option has following syntax: 'Type: option = value' */
5800 /* the returned value is talloced on the talloc_tos() */
5801 char *lp_parm_talloc_string(int snum
, const char *type
, const char *option
, const char *def
)
5803 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5805 if (data
== NULL
||data
->value
==NULL
) {
5807 return lp_string(def
);
5813 return lp_string(data
->value
);
5816 /* Return parametric option from a given service. Type is a part of option before ':' */
5817 /* Parametric option has following syntax: 'Type: option = value' */
5818 const char *lp_parm_const_string(int snum
, const char *type
, const char *option
, const char *def
)
5820 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5822 if (data
== NULL
||data
->value
==NULL
)
5828 /* Return parametric option from a given service. Type is a part of option before ':' */
5829 /* Parametric option has following syntax: 'Type: option = value' */
5831 const char **lp_parm_string_list(int snum
, const char *type
, const char *option
, const char **def
)
5833 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5835 if (data
== NULL
||data
->value
==NULL
)
5836 return (const char **)def
;
5838 if (data
->list
==NULL
) {
5839 data
->list
= str_list_make_v3(talloc_autofree_context(), data
->value
, NULL
);
5842 return (const char **)data
->list
;
5845 /* Return parametric option from a given service. Type is a part of option before ':' */
5846 /* Parametric option has following syntax: 'Type: option = value' */
5848 int lp_parm_int(int snum
, const char *type
, const char *option
, int def
)
5850 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5852 if (data
&& data
->value
&& *data
->value
)
5853 return lp_int(data
->value
);
5858 /* Return parametric option from a given service. Type is a part of option before ':' */
5859 /* Parametric option has following syntax: 'Type: option = value' */
5861 unsigned long lp_parm_ulong(int snum
, const char *type
, const char *option
, unsigned long def
)
5863 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5865 if (data
&& data
->value
&& *data
->value
)
5866 return lp_ulong(data
->value
);
5871 /* Return parametric option from a given service. Type is a part of option before ':' */
5872 /* Parametric option has following syntax: 'Type: option = value' */
5874 bool lp_parm_bool(int snum
, const char *type
, const char *option
, bool def
)
5876 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5878 if (data
&& data
->value
&& *data
->value
)
5879 return lp_bool(data
->value
);
5884 /* Return parametric option from a given service. Type is a part of option before ':' */
5885 /* Parametric option has following syntax: 'Type: option = value' */
5887 int lp_parm_enum(int snum
, const char *type
, const char *option
,
5888 const struct enum_list
*_enum
, int def
)
5890 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5892 if (data
&& data
->value
&& *data
->value
&& _enum
)
5893 return lp_enum(data
->value
, _enum
);
5899 /***************************************************************************
5900 Initialise a service to the defaults.
5901 ***************************************************************************/
5903 static void init_service(struct service
*pservice
)
5905 memset((char *)pservice
, '\0', sizeof(struct service
));
5906 copy_service(pservice
, &sDefault
, NULL
);
5911 * free a param_opts structure.
5912 * param_opts handling should be moved to talloc;
5913 * then this whole functions reduces to a TALLOC_FREE().
5916 static void free_param_opts(struct param_opt_struct
**popts
)
5918 struct param_opt_struct
*opt
, *next_opt
;
5920 if (popts
== NULL
) {
5924 if (*popts
!= NULL
) {
5925 DEBUG(5, ("Freeing parametrics:\n"));
5928 while (opt
!= NULL
) {
5929 string_free(&opt
->key
);
5930 string_free(&opt
->value
);
5931 TALLOC_FREE(opt
->list
);
5932 next_opt
= opt
->next
;
5939 /***************************************************************************
5940 Free the dynamically allocated parts of a service struct.
5941 ***************************************************************************/
5943 static void free_service(struct service
*pservice
)
5948 if (pservice
->szService
)
5949 DEBUG(5, ("free_service: Freeing service %s\n",
5950 pservice
->szService
));
5952 free_parameters(pservice
);
5954 string_free(&pservice
->szService
);
5955 bitmap_free(pservice
->copymap
);
5957 free_param_opts(&pservice
->param_opt
);
5959 ZERO_STRUCTP(pservice
);
5963 /***************************************************************************
5964 remove a service indexed in the ServicePtrs array from the ServiceHash
5965 and free the dynamically allocated parts
5966 ***************************************************************************/
5968 static void free_service_byindex(int idx
)
5970 if ( !LP_SNUM_OK(idx
) )
5973 ServicePtrs
[idx
]->valid
= False
;
5974 invalid_services
[num_invalid_services
++] = idx
;
5976 /* we have to cleanup the hash record */
5978 if (ServicePtrs
[idx
]->szService
) {
5979 char *canon_name
= canonicalize_servicename(
5980 ServicePtrs
[idx
]->szService
);
5982 dbwrap_delete_bystring(ServiceHash
, canon_name
);
5983 TALLOC_FREE(canon_name
);
5986 free_service(ServicePtrs
[idx
]);
5989 /***************************************************************************
5990 Add a new service to the services array initialising it with the given
5992 ***************************************************************************/
5994 static int add_a_service(const struct service
*pservice
, const char *name
)
5997 struct service tservice
;
5998 int num_to_alloc
= iNumServices
+ 1;
6000 tservice
= *pservice
;
6002 /* it might already exist */
6004 i
= getservicebyname(name
, NULL
);
6006 /* Clean all parametric options for service */
6007 /* They will be added during parsing again */
6008 free_param_opts(&ServicePtrs
[i
]->param_opt
);
6013 /* find an invalid one */
6015 if (num_invalid_services
> 0) {
6016 i
= invalid_services
[--num_invalid_services
];
6019 /* if not, then create one */
6020 if (i
== iNumServices
) {
6021 struct service
**tsp
;
6024 tsp
= SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs
, struct service
*, num_to_alloc
);
6026 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
6030 ServicePtrs
[iNumServices
] = SMB_MALLOC_P(struct service
);
6031 if (!ServicePtrs
[iNumServices
]) {
6032 DEBUG(0,("add_a_service: out of memory!\n"));
6037 /* enlarge invalid_services here for now... */
6038 tinvalid
= SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services
, int,
6040 if (tinvalid
== NULL
) {
6041 DEBUG(0,("add_a_service: failed to enlarge "
6042 "invalid_services!\n"));
6045 invalid_services
= tinvalid
;
6047 free_service_byindex(i
);
6050 ServicePtrs
[i
]->valid
= True
;
6052 init_service(ServicePtrs
[i
]);
6053 copy_service(ServicePtrs
[i
], &tservice
, NULL
);
6055 string_set(&ServicePtrs
[i
]->szService
, name
);
6057 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
6058 i
, ServicePtrs
[i
]->szService
));
6060 if (!hash_a_service(ServicePtrs
[i
]->szService
, i
)) {
6067 /***************************************************************************
6068 Convert a string to uppercase and remove whitespaces.
6069 ***************************************************************************/
6071 static char *canonicalize_servicename(const char *src
)
6076 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
6080 result
= talloc_strdup(talloc_tos(), src
);
6081 SMB_ASSERT(result
!= NULL
);
6087 /***************************************************************************
6088 Add a name/index pair for the services array to the hash table.
6089 ***************************************************************************/
6091 static bool hash_a_service(const char *name
, int idx
)
6095 if ( !ServiceHash
) {
6096 DEBUG(10,("hash_a_service: creating servicehash\n"));
6097 ServiceHash
= db_open_rbt(NULL
);
6098 if ( !ServiceHash
) {
6099 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
6104 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
6107 canon_name
= canonicalize_servicename( name
);
6109 dbwrap_store_bystring(ServiceHash
, canon_name
,
6110 make_tdb_data((uint8
*)&idx
, sizeof(idx
)),
6113 TALLOC_FREE(canon_name
);
6118 /***************************************************************************
6119 Add a new home service, with the specified home directory, defaults coming
6121 ***************************************************************************/
6123 bool lp_add_home(const char *pszHomename
, int iDefaultService
,
6124 const char *user
, const char *pszHomedir
)
6128 i
= add_a_service(ServicePtrs
[iDefaultService
], pszHomename
);
6133 if (!(*(ServicePtrs
[iDefaultService
]->szPath
))
6134 || strequal(ServicePtrs
[iDefaultService
]->szPath
, lp_pathname(GLOBAL_SECTION_SNUM
))) {
6135 string_set(&ServicePtrs
[i
]->szPath
, pszHomedir
);
6138 if (!(*(ServicePtrs
[i
]->comment
))) {
6139 char *comment
= NULL
;
6140 if (asprintf(&comment
, "Home directory of %s", user
) < 0) {
6143 string_set(&ServicePtrs
[i
]->comment
, comment
);
6147 /* set the browseable flag from the global default */
6149 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6150 ServicePtrs
[i
]->bAccessBasedShareEnum
= sDefault
.bAccessBasedShareEnum
;
6152 ServicePtrs
[i
]->autoloaded
= True
;
6154 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename
,
6155 user
, ServicePtrs
[i
]->szPath
));
6160 /***************************************************************************
6161 Add a new service, based on an old one.
6162 ***************************************************************************/
6164 int lp_add_service(const char *pszService
, int iDefaultService
)
6166 if (iDefaultService
< 0) {
6167 return add_a_service(&sDefault
, pszService
);
6170 return (add_a_service(ServicePtrs
[iDefaultService
], pszService
));
6173 /***************************************************************************
6174 Add the IPC service.
6175 ***************************************************************************/
6177 static bool lp_add_ipc(const char *ipc_name
, bool guest_ok
)
6179 char *comment
= NULL
;
6180 int i
= add_a_service(&sDefault
, ipc_name
);
6185 if (asprintf(&comment
, "IPC Service (%s)",
6186 Globals
.szServerString
) < 0) {
6190 string_set(&ServicePtrs
[i
]->szPath
, tmpdir());
6191 string_set(&ServicePtrs
[i
]->szUsername
, "");
6192 string_set(&ServicePtrs
[i
]->comment
, comment
);
6193 string_set(&ServicePtrs
[i
]->fstype
, "IPC");
6194 ServicePtrs
[i
]->iMaxConnections
= 0;
6195 ServicePtrs
[i
]->bAvailable
= True
;
6196 ServicePtrs
[i
]->bRead_only
= True
;
6197 ServicePtrs
[i
]->bGuest_only
= False
;
6198 ServicePtrs
[i
]->bAdministrative_share
= True
;
6199 ServicePtrs
[i
]->bGuest_ok
= guest_ok
;
6200 ServicePtrs
[i
]->bPrint_ok
= False
;
6201 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6203 DEBUG(3, ("adding IPC service\n"));
6209 /***************************************************************************
6210 Add a new printer service, with defaults coming from service iFrom.
6211 ***************************************************************************/
6213 bool lp_add_printer(const char *pszPrintername
, int iDefaultService
)
6215 const char *comment
= "From Printcap";
6216 int i
= add_a_service(ServicePtrs
[iDefaultService
], pszPrintername
);
6221 /* note that we do NOT default the availability flag to True - */
6222 /* we take it from the default service passed. This allows all */
6223 /* dynamic printers to be disabled by disabling the [printers] */
6224 /* entry (if/when the 'available' keyword is implemented!). */
6226 /* the printer name is set to the service name. */
6227 string_set(&ServicePtrs
[i
]->szPrintername
, pszPrintername
);
6228 string_set(&ServicePtrs
[i
]->comment
, comment
);
6230 /* set the browseable flag from the gloabl default */
6231 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6233 /* Printers cannot be read_only. */
6234 ServicePtrs
[i
]->bRead_only
= False
;
6235 /* No share modes on printer services. */
6236 ServicePtrs
[i
]->bShareModes
= False
;
6237 /* No oplocks on printer services. */
6238 ServicePtrs
[i
]->bOpLocks
= False
;
6239 /* Printer services must be printable. */
6240 ServicePtrs
[i
]->bPrint_ok
= True
;
6242 DEBUG(3, ("adding printer service %s\n", pszPrintername
));
6248 /***************************************************************************
6249 Check whether the given parameter name is valid.
6250 Parametric options (names containing a colon) are considered valid.
6251 ***************************************************************************/
6253 bool lp_parameter_is_valid(const char *pszParmName
)
6255 return ((map_parameter(pszParmName
) != -1) ||
6256 (strchr(pszParmName
, ':') != NULL
));
6259 /***************************************************************************
6260 Check whether the given name is the name of a global parameter.
6261 Returns True for strings belonging to parameters of class
6262 P_GLOBAL, False for all other strings, also for parametric options
6263 and strings not belonging to any option.
6264 ***************************************************************************/
6266 bool lp_parameter_is_global(const char *pszParmName
)
6268 int num
= map_parameter(pszParmName
);
6271 return (parm_table
[num
].p_class
== P_GLOBAL
);
6277 /**************************************************************************
6278 Check whether the given name is the canonical name of a parameter.
6279 Returns False if it is not a valid parameter Name.
6280 For parametric options, True is returned.
6281 **************************************************************************/
6283 bool lp_parameter_is_canonical(const char *parm_name
)
6285 if (!lp_parameter_is_valid(parm_name
)) {
6289 return (map_parameter(parm_name
) ==
6290 map_parameter_canonical(parm_name
, NULL
));
6293 /**************************************************************************
6294 Determine the canonical name for a parameter.
6295 Indicate when it is an inverse (boolean) synonym instead of a
6297 **************************************************************************/
6299 bool lp_canonicalize_parameter(const char *parm_name
, const char **canon_parm
,
6304 if (!lp_parameter_is_valid(parm_name
)) {
6309 num
= map_parameter_canonical(parm_name
, inverse
);
6311 /* parametric option */
6312 *canon_parm
= parm_name
;
6314 *canon_parm
= parm_table
[num
].label
;
6321 /**************************************************************************
6322 Determine the canonical name for a parameter.
6323 Turn the value given into the inverse boolean expression when
6324 the synonym is an invers boolean synonym.
6326 Return True if parm_name is a valid parameter name and
6327 in case it is an invers boolean synonym, if the val string could
6328 successfully be converted to the reverse bool.
6329 Return false in all other cases.
6330 **************************************************************************/
6332 bool lp_canonicalize_parameter_with_value(const char *parm_name
,
6334 const char **canon_parm
,
6335 const char **canon_val
)
6340 if (!lp_parameter_is_valid(parm_name
)) {
6346 num
= map_parameter_canonical(parm_name
, &inverse
);
6348 /* parametric option */
6349 *canon_parm
= parm_name
;
6352 *canon_parm
= parm_table
[num
].label
;
6354 if (!lp_invert_boolean(val
, canon_val
)) {
6366 /***************************************************************************
6367 Map a parameter's string representation to something we can use.
6368 Returns False if the parameter string is not recognised, else TRUE.
6369 ***************************************************************************/
6371 static int map_parameter(const char *pszParmName
)
6375 if (*pszParmName
== '-' && !strequal(pszParmName
, "-valid"))
6378 for (iIndex
= 0; parm_table
[iIndex
].label
; iIndex
++)
6379 if (strwicmp(parm_table
[iIndex
].label
, pszParmName
) == 0)
6382 /* Warn only if it isn't parametric option */
6383 if (strchr(pszParmName
, ':') == NULL
)
6384 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName
));
6385 /* We do return 'fail' for parametric options as well because they are
6386 stored in different storage
6391 /***************************************************************************
6392 Map a parameter's string representation to the index of the canonical
6393 form of the parameter (it might be a synonym).
6394 Returns -1 if the parameter string is not recognised.
6395 ***************************************************************************/
6397 static int map_parameter_canonical(const char *pszParmName
, bool *inverse
)
6399 int parm_num
, canon_num
;
6400 bool loc_inverse
= False
;
6402 parm_num
= map_parameter(pszParmName
);
6403 if ((parm_num
< 0) || !(parm_table
[parm_num
].flags
& FLAG_HIDE
)) {
6404 /* invalid, parametric or no canidate for synonyms ... */
6408 for (canon_num
= 0; parm_table
[canon_num
].label
; canon_num
++) {
6409 if (is_synonym_of(parm_num
, canon_num
, &loc_inverse
)) {
6410 parm_num
= canon_num
;
6416 if (inverse
!= NULL
) {
6417 *inverse
= loc_inverse
;
6422 /***************************************************************************
6423 return true if parameter number parm1 is a synonym of parameter
6424 number parm2 (parm2 being the principal name).
6425 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6427 ***************************************************************************/
6429 static bool is_synonym_of(int parm1
, int parm2
, bool *inverse
)
6431 if ((parm_table
[parm1
].ptr
== parm_table
[parm2
].ptr
) &&
6432 (parm_table
[parm1
].flags
& FLAG_HIDE
) &&
6433 !(parm_table
[parm2
].flags
& FLAG_HIDE
))
6435 if (inverse
!= NULL
) {
6436 if ((parm_table
[parm1
].type
== P_BOOLREV
) &&
6437 (parm_table
[parm2
].type
== P_BOOL
))
6449 /***************************************************************************
6450 Show one parameter's name, type, [values,] and flags.
6451 (helper functions for show_parameter_list)
6452 ***************************************************************************/
6454 static void show_parameter(int parmIndex
)
6456 int enumIndex
, flagIndex
;
6461 const char *type
[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6462 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6464 unsigned flags
[] = { FLAG_BASIC
, FLAG_SHARE
, FLAG_PRINT
, FLAG_GLOBAL
,
6465 FLAG_WIZARD
, FLAG_ADVANCED
, FLAG_DEVELOPER
, FLAG_DEPRECATED
,
6466 FLAG_HIDE
, FLAG_DOS_STRING
};
6467 const char *flag_names
[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6468 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6469 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL
};
6471 printf("%s=%s", parm_table
[parmIndex
].label
,
6472 type
[parm_table
[parmIndex
].type
]);
6473 if (parm_table
[parmIndex
].type
== P_ENUM
) {
6476 parm_table
[parmIndex
].enum_list
[enumIndex
].name
;
6480 enumIndex
? "|" : "",
6481 parm_table
[parmIndex
].enum_list
[enumIndex
].name
);
6486 for (flagIndex
=0; flag_names
[flagIndex
]; flagIndex
++) {
6487 if (parm_table
[parmIndex
].flags
& flags
[flagIndex
]) {
6490 flag_names
[flagIndex
]);
6495 /* output synonyms */
6497 for (parmIndex2
=0; parm_table
[parmIndex2
].label
; parmIndex2
++) {
6498 if (is_synonym_of(parmIndex
, parmIndex2
, &inverse
)) {
6499 printf(" (%ssynonym of %s)", inverse
? "inverse " : "",
6500 parm_table
[parmIndex2
].label
);
6501 } else if (is_synonym_of(parmIndex2
, parmIndex
, &inverse
)) {
6503 printf(" (synonyms: ");
6508 printf("%s%s", parm_table
[parmIndex2
].label
,
6509 inverse
? "[i]" : "");
6519 /***************************************************************************
6520 Show all parameter's name, type, [values,] and flags.
6521 ***************************************************************************/
6523 void show_parameter_list(void)
6525 int classIndex
, parmIndex
;
6526 const char *section_names
[] = { "local", "global", NULL
};
6528 for (classIndex
=0; section_names
[classIndex
]; classIndex
++) {
6529 printf("[%s]\n", section_names
[classIndex
]);
6530 for (parmIndex
= 0; parm_table
[parmIndex
].label
; parmIndex
++) {
6531 if (parm_table
[parmIndex
].p_class
== classIndex
) {
6532 show_parameter(parmIndex
);
6538 /***************************************************************************
6539 Check if a given string correctly represents a boolean value.
6540 ***************************************************************************/
6542 bool lp_string_is_valid_boolean(const char *parm_value
)
6544 return set_boolean(parm_value
, NULL
);
6547 /***************************************************************************
6548 Get the standard string representation of a boolean value ("yes" or "no")
6549 ***************************************************************************/
6551 static const char *get_boolean(bool bool_value
)
6553 static const char *yes_str
= "yes";
6554 static const char *no_str
= "no";
6556 return (bool_value
? yes_str
: no_str
);
6559 /***************************************************************************
6560 Provide the string of the negated boolean value associated to the boolean
6561 given as a string. Returns False if the passed string does not correctly
6562 represent a boolean.
6563 ***************************************************************************/
6565 bool lp_invert_boolean(const char *str
, const char **inverse_str
)
6569 if (!set_boolean(str
, &val
)) {
6573 *inverse_str
= get_boolean(!val
);
6577 /***************************************************************************
6578 Provide the canonical string representation of a boolean value given
6579 as a string. Return True on success, False if the string given does
6580 not correctly represent a boolean.
6581 ***************************************************************************/
6583 bool lp_canonicalize_boolean(const char *str
, const char**canon_str
)
6587 if (!set_boolean(str
, &val
)) {
6591 *canon_str
= get_boolean(val
);
6595 /***************************************************************************
6596 Find a service by name. Otherwise works like get_service.
6597 ***************************************************************************/
6599 static int getservicebyname(const char *pszServiceName
, struct service
*pserviceDest
)
6605 if (ServiceHash
== NULL
) {
6609 canon_name
= canonicalize_servicename(pszServiceName
);
6611 data
= dbwrap_fetch_bystring(ServiceHash
, canon_name
, canon_name
);
6613 if ((data
.dptr
!= NULL
) && (data
.dsize
== sizeof(iService
))) {
6614 iService
= *(int *)data
.dptr
;
6617 TALLOC_FREE(canon_name
);
6619 if ((iService
!= -1) && (LP_SNUM_OK(iService
))
6620 && (pserviceDest
!= NULL
)) {
6621 copy_service(pserviceDest
, ServicePtrs
[iService
], NULL
);
6627 /***************************************************************************
6628 Copy a service structure to another.
6629 If pcopymapDest is NULL then copy all fields
6630 ***************************************************************************/
6633 * Add a parametric option to a param_opt_struct,
6634 * replacing old value, if already present.
6636 static void set_param_opt(struct param_opt_struct
**opt_list
,
6637 const char *opt_name
,
6638 const char *opt_value
)
6640 struct param_opt_struct
*new_opt
, *opt
;
6643 if (opt_list
== NULL
) {
6650 /* Traverse destination */
6652 /* If we already have same option, override it */
6653 if (strwicmp(opt
->key
, opt_name
) == 0) {
6654 string_free(&opt
->value
);
6655 TALLOC_FREE(opt
->list
);
6656 opt
->value
= SMB_STRDUP(opt_value
);
6663 new_opt
= SMB_XMALLOC_P(struct param_opt_struct
);
6664 new_opt
->key
= SMB_STRDUP(opt_name
);
6665 new_opt
->value
= SMB_STRDUP(opt_value
);
6666 new_opt
->list
= NULL
;
6667 DLIST_ADD(*opt_list
, new_opt
);
6671 static void copy_service(struct service
*pserviceDest
, struct service
*pserviceSource
,
6672 struct bitmap
*pcopymapDest
)
6675 bool bcopyall
= (pcopymapDest
== NULL
);
6676 struct param_opt_struct
*data
;
6678 for (i
= 0; parm_table
[i
].label
; i
++)
6679 if (parm_table
[i
].ptr
&& parm_table
[i
].p_class
== P_LOCAL
&&
6680 (bcopyall
|| bitmap_query(pcopymapDest
,i
))) {
6681 void *def_ptr
= parm_table
[i
].ptr
;
6683 ((char *)pserviceSource
) + PTR_DIFF(def_ptr
,
6686 ((char *)pserviceDest
) + PTR_DIFF(def_ptr
,
6689 switch (parm_table
[i
].type
) {
6692 *(bool *)dest_ptr
= *(bool *)src_ptr
;
6698 *(int *)dest_ptr
= *(int *)src_ptr
;
6702 *(char *)dest_ptr
= *(char *)src_ptr
;
6706 string_set((char **)dest_ptr
,
6711 string_set((char **)dest_ptr
,
6713 strupper_m(*(char **)dest_ptr
);
6716 TALLOC_FREE(*((char ***)dest_ptr
));
6717 *((char ***)dest_ptr
) = str_list_copy(NULL
,
6718 *(const char ***)src_ptr
);
6726 init_copymap(pserviceDest
);
6727 if (pserviceSource
->copymap
)
6728 bitmap_copy(pserviceDest
->copymap
,
6729 pserviceSource
->copymap
);
6732 data
= pserviceSource
->param_opt
;
6734 set_param_opt(&pserviceDest
->param_opt
, data
->key
, data
->value
);
6739 /***************************************************************************
6740 Check a service for consistency. Return False if the service is in any way
6741 incomplete or faulty, else True.
6742 ***************************************************************************/
6744 bool service_ok(int iService
)
6749 if (ServicePtrs
[iService
]->szService
[0] == '\0') {
6750 DEBUG(0, ("The following message indicates an internal error:\n"));
6751 DEBUG(0, ("No service name in service entry.\n"));
6755 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
6756 /* I can't see why you'd want a non-printable printer service... */
6757 if (strwicmp(ServicePtrs
[iService
]->szService
, PRINTERS_NAME
) == 0) {
6758 if (!ServicePtrs
[iService
]->bPrint_ok
) {
6759 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
6760 ServicePtrs
[iService
]->szService
));
6761 ServicePtrs
[iService
]->bPrint_ok
= True
;
6763 /* [printers] service must also be non-browsable. */
6764 if (ServicePtrs
[iService
]->bBrowseable
)
6765 ServicePtrs
[iService
]->bBrowseable
= False
;
6768 if (ServicePtrs
[iService
]->szPath
[0] == '\0' &&
6769 strwicmp(ServicePtrs
[iService
]->szService
, HOMES_NAME
) != 0 &&
6770 ServicePtrs
[iService
]->szMSDfsProxy
[0] == '\0'
6772 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
6773 ServicePtrs
[iService
]->szService
));
6774 ServicePtrs
[iService
]->bAvailable
= False
;
6777 /* If a service is flagged unavailable, log the fact at level 1. */
6778 if (!ServicePtrs
[iService
]->bAvailable
)
6779 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
6780 ServicePtrs
[iService
]->szService
));
6785 static struct smbconf_ctx
*lp_smbconf_ctx(void)
6788 static struct smbconf_ctx
*conf_ctx
= NULL
;
6790 if (conf_ctx
== NULL
) {
6791 werr
= smbconf_init(NULL
, &conf_ctx
, "registry:");
6792 if (!W_ERROR_IS_OK(werr
)) {
6793 DEBUG(1, ("error initializing registry configuration: "
6794 "%s\n", win_errstr(werr
)));
6802 static bool process_smbconf_service(struct smbconf_service
*service
)
6807 if (service
== NULL
) {
6811 ret
= do_section(service
->name
, NULL
);
6815 for (count
= 0; count
< service
->num_params
; count
++) {
6816 ret
= do_parameter(service
->param_names
[count
],
6817 service
->param_values
[count
],
6823 if (iServiceIndex
>= 0) {
6824 return service_ok(iServiceIndex
);
6830 * load a service from registry and activate it
6832 bool process_registry_service(const char *service_name
)
6835 struct smbconf_service
*service
= NULL
;
6836 TALLOC_CTX
*mem_ctx
= talloc_stackframe();
6837 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
6840 if (conf_ctx
== NULL
) {
6844 DEBUG(5, ("process_registry_service: service name %s\n", service_name
));
6846 if (!smbconf_share_exists(conf_ctx
, service_name
)) {
6848 * Registry does not contain data for this service (yet),
6849 * but make sure lp_load doesn't return false.
6855 werr
= smbconf_get_share(conf_ctx
, mem_ctx
, service_name
, &service
);
6856 if (!W_ERROR_IS_OK(werr
)) {
6860 ret
= process_smbconf_service(service
);
6866 smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
, NULL
);
6869 TALLOC_FREE(mem_ctx
);
6874 * process_registry_globals
6876 static bool process_registry_globals(void)
6880 add_to_file_list(INCLUDE_REGISTRY_NAME
, INCLUDE_REGISTRY_NAME
);
6882 ret
= do_parameter("registry shares", "yes", NULL
);
6887 return process_registry_service(GLOBAL_NAME
);
6890 bool process_registry_shares(void)
6894 struct smbconf_service
**service
= NULL
;
6895 uint32_t num_shares
= 0;
6896 TALLOC_CTX
*mem_ctx
= talloc_stackframe();
6897 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
6900 if (conf_ctx
== NULL
) {
6904 werr
= smbconf_get_config(conf_ctx
, mem_ctx
, &num_shares
, &service
);
6905 if (!W_ERROR_IS_OK(werr
)) {
6911 for (count
= 0; count
< num_shares
; count
++) {
6912 if (strequal(service
[count
]->name
, GLOBAL_NAME
)) {
6915 ret
= process_smbconf_service(service
[count
]);
6922 smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
, NULL
);
6925 TALLOC_FREE(mem_ctx
);
6929 #define MAX_INCLUDE_DEPTH 100
6931 static uint8_t include_depth
;
6933 static struct file_lists
{
6934 struct file_lists
*next
;
6938 } *file_lists
= NULL
;
6940 /*******************************************************************
6941 Keep a linked list of all config files so we know when one has changed
6942 it's date and needs to be reloaded.
6943 ********************************************************************/
6945 static void add_to_file_list(const char *fname
, const char *subfname
)
6947 struct file_lists
*f
= file_lists
;
6950 if (f
->name
&& !strcmp(f
->name
, fname
))
6956 f
= SMB_MALLOC_P(struct file_lists
);
6959 f
->next
= file_lists
;
6960 f
->name
= SMB_STRDUP(fname
);
6965 f
->subfname
= SMB_STRDUP(subfname
);
6971 f
->modtime
= file_modtime(subfname
);
6973 time_t t
= file_modtime(subfname
);
6980 * Utility function for outsiders to check if we're running on registry.
6982 bool lp_config_backend_is_registry(void)
6984 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY
);
6988 * Utility function to check if the config backend is FILE.
6990 bool lp_config_backend_is_file(void)
6992 return (lp_config_backend() == CONFIG_BACKEND_FILE
);
6995 /*******************************************************************
6996 Check if a config file has changed date.
6997 ********************************************************************/
6999 bool lp_file_list_changed(void)
7001 struct file_lists
*f
= file_lists
;
7003 DEBUG(6, ("lp_file_list_changed()\n"));
7009 if (strequal(f
->name
, INCLUDE_REGISTRY_NAME
)) {
7010 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
7012 if (conf_ctx
== NULL
) {
7015 if (smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
,
7018 DEBUGADD(6, ("registry config changed\n"));
7022 n2
= alloc_sub_basic(get_current_username(),
7023 current_user_info
.domain
,
7028 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
7029 f
->name
, n2
, ctime(&f
->modtime
)));
7031 mod_time
= file_modtime(n2
);
7034 ((f
->modtime
!= mod_time
) ||
7035 (f
->subfname
== NULL
) ||
7036 (strcmp(n2
, f
->subfname
) != 0)))
7039 ("file %s modified: %s\n", n2
,
7041 f
->modtime
= mod_time
;
7042 SAFE_FREE(f
->subfname
);
7043 f
->subfname
= n2
; /* Passing ownership of
7044 return from alloc_sub_basic
7056 /***************************************************************************
7057 Run standard_sub_basic on netbios name... needed because global_myname
7058 is not accessed through any lp_ macro.
7059 Note: We must *NOT* use string_set() here as ptr points to global_myname.
7060 ***************************************************************************/
7062 static bool handle_netbios_name(int snum
, const char *pszParmValue
, char **ptr
)
7065 char *netbios_name
= alloc_sub_basic(get_current_username(),
7066 current_user_info
.domain
,
7069 ret
= set_global_myname(netbios_name
);
7070 SAFE_FREE(netbios_name
);
7071 string_set(&Globals
.szNetbiosName
,global_myname());
7073 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
7079 static bool handle_charset(int snum
, const char *pszParmValue
, char **ptr
)
7081 if (strcmp(*ptr
, pszParmValue
) != 0) {
7082 string_set(ptr
, pszParmValue
);
7090 static bool handle_workgroup(int snum
, const char *pszParmValue
, char **ptr
)
7094 ret
= set_global_myworkgroup(pszParmValue
);
7095 string_set(&Globals
.szWorkgroup
,lp_workgroup());
7100 static bool handle_netbios_scope(int snum
, const char *pszParmValue
, char **ptr
)
7104 ret
= set_global_scope(pszParmValue
);
7105 string_set(&Globals
.szNetbiosScope
,global_scope());
7110 static bool handle_netbios_aliases(int snum
, const char *pszParmValue
, char **ptr
)
7112 TALLOC_FREE(Globals
.szNetbiosAliases
);
7113 Globals
.szNetbiosAliases
= str_list_make_v3(talloc_autofree_context(), pszParmValue
, NULL
);
7114 return set_netbios_aliases((const char **)Globals
.szNetbiosAliases
);
7117 /***************************************************************************
7118 Handle the include operation.
7119 ***************************************************************************/
7120 static bool bAllowIncludeRegistry
= true;
7122 static bool handle_include(int snum
, const char *pszParmValue
, char **ptr
)
7126 if (include_depth
>= MAX_INCLUDE_DEPTH
) {
7127 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7132 if (strequal(pszParmValue
, INCLUDE_REGISTRY_NAME
)) {
7133 if (!bAllowIncludeRegistry
) {
7136 if (bInGlobalSection
) {
7139 ret
= process_registry_globals();
7143 DEBUG(1, ("\"include = registry\" only effective "
7144 "in %s section\n", GLOBAL_NAME
));
7149 fname
= alloc_sub_basic(get_current_username(),
7150 current_user_info
.domain
,
7153 add_to_file_list(pszParmValue
, fname
);
7155 string_set(ptr
, fname
);
7157 if (file_exist(fname
)) {
7160 ret
= pm_process(fname
, do_section
, do_parameter
, NULL
);
7166 DEBUG(2, ("Can't find include file %s\n", fname
));
7171 /***************************************************************************
7172 Handle the interpretation of the copy parameter.
7173 ***************************************************************************/
7175 static bool handle_copy(int snum
, const char *pszParmValue
, char **ptr
)
7179 struct service serviceTemp
;
7181 string_set(ptr
, pszParmValue
);
7183 init_service(&serviceTemp
);
7187 DEBUG(3, ("Copying service from service %s\n", pszParmValue
));
7189 if ((iTemp
= getservicebyname(pszParmValue
, &serviceTemp
)) >= 0) {
7190 if (iTemp
== iServiceIndex
) {
7191 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue
));
7193 copy_service(ServicePtrs
[iServiceIndex
],
7195 ServicePtrs
[iServiceIndex
]->copymap
);
7199 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue
));
7203 free_service(&serviceTemp
);
7207 static bool handle_ldap_debug_level(int snum
, const char *pszParmValue
, char **ptr
)
7209 Globals
.ldap_debug_level
= lp_int(pszParmValue
);
7210 init_ldap_debugging();
7214 /***************************************************************************
7215 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7220 idmap uid = 1000-1999
7223 We only do simple parsing checks here. The strings are parsed into useful
7224 structures in the idmap daemon code.
7226 ***************************************************************************/
7228 /* Some lp_ routines to return idmap [ug]id information */
7230 static uid_t idmap_uid_low
, idmap_uid_high
;
7231 static gid_t idmap_gid_low
, idmap_gid_high
;
7233 bool lp_idmap_uid(uid_t
*low
, uid_t
*high
)
7235 if (idmap_uid_low
== 0 || idmap_uid_high
== 0)
7239 *low
= idmap_uid_low
;
7242 *high
= idmap_uid_high
;
7247 bool lp_idmap_gid(gid_t
*low
, gid_t
*high
)
7249 if (idmap_gid_low
== 0 || idmap_gid_high
== 0)
7253 *low
= idmap_gid_low
;
7256 *high
= idmap_gid_high
;
7261 /* Do some simple checks on "idmap [ug]id" parameter values */
7263 static bool handle_idmap_uid(int snum
, const char *pszParmValue
, char **ptr
)
7267 if (sscanf(pszParmValue
, "%u - %u", &low
, &high
) != 2 || high
< low
)
7272 string_set(ptr
, pszParmValue
);
7274 idmap_uid_low
= low
;
7275 idmap_uid_high
= high
;
7280 static bool handle_idmap_gid(int snum
, const char *pszParmValue
, char **ptr
)
7284 if (sscanf(pszParmValue
, "%u - %u", &low
, &high
) != 2 || high
< low
)
7289 string_set(ptr
, pszParmValue
);
7291 idmap_gid_low
= low
;
7292 idmap_gid_high
= high
;
7297 /***************************************************************************
7298 Handle the DEBUG level list.
7299 ***************************************************************************/
7301 static bool handle_debug_list( int snum
, const char *pszParmValueIn
, char **ptr
)
7303 string_set(ptr
, pszParmValueIn
);
7304 return debug_parse_levels(pszParmValueIn
);
7307 /***************************************************************************
7308 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7309 ***************************************************************************/
7311 static const char *append_ldap_suffix( const char *str
)
7313 const char *suffix_string
;
7316 suffix_string
= talloc_asprintf(talloc_tos(), "%s,%s", str
,
7317 Globals
.szLdapSuffix
);
7318 if ( !suffix_string
) {
7319 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7323 return suffix_string
;
7326 const char *lp_ldap_machine_suffix(void)
7328 if (Globals
.szLdapMachineSuffix
[0])
7329 return append_ldap_suffix(Globals
.szLdapMachineSuffix
);
7331 return lp_string(Globals
.szLdapSuffix
);
7334 const char *lp_ldap_user_suffix(void)
7336 if (Globals
.szLdapUserSuffix
[0])
7337 return append_ldap_suffix(Globals
.szLdapUserSuffix
);
7339 return lp_string(Globals
.szLdapSuffix
);
7342 const char *lp_ldap_group_suffix(void)
7344 if (Globals
.szLdapGroupSuffix
[0])
7345 return append_ldap_suffix(Globals
.szLdapGroupSuffix
);
7347 return lp_string(Globals
.szLdapSuffix
);
7350 const char *lp_ldap_idmap_suffix(void)
7352 if (Globals
.szLdapIdmapSuffix
[0])
7353 return append_ldap_suffix(Globals
.szLdapIdmapSuffix
);
7355 return lp_string(Globals
.szLdapSuffix
);
7358 /****************************************************************************
7359 set the value for a P_ENUM
7360 ***************************************************************************/
7362 static void lp_set_enum_parm( struct parm_struct
*parm
, const char *pszParmValue
,
7367 for (i
= 0; parm
->enum_list
[i
].name
; i
++) {
7368 if ( strequal(pszParmValue
, parm
->enum_list
[i
].name
)) {
7369 *ptr
= parm
->enum_list
[i
].value
;
7373 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7374 pszParmValue
, parm
->label
));
7377 /***************************************************************************
7378 ***************************************************************************/
7380 static bool handle_printing(int snum
, const char *pszParmValue
, char **ptr
)
7382 static int parm_num
= -1;
7385 if ( parm_num
== -1 )
7386 parm_num
= map_parameter( "printing" );
7388 lp_set_enum_parm( &parm_table
[parm_num
], pszParmValue
, (int*)ptr
);
7393 s
= ServicePtrs
[snum
];
7395 init_printer_values( s
);
7401 /***************************************************************************
7402 Initialise a copymap.
7403 ***************************************************************************/
7405 static void init_copymap(struct service
*pservice
)
7408 if (pservice
->copymap
) {
7409 bitmap_free(pservice
->copymap
);
7411 pservice
->copymap
= bitmap_allocate(NUMPARAMETERS
);
7412 if (!pservice
->copymap
)
7414 ("Couldn't allocate copymap!! (size %d)\n",
7415 (int)NUMPARAMETERS
));
7417 for (i
= 0; i
< NUMPARAMETERS
; i
++)
7418 bitmap_set(pservice
->copymap
, i
);
7421 /***************************************************************************
7422 Return the local pointer to a parameter given a service struct and the
7423 pointer into the default structure.
7424 ***************************************************************************/
7426 static void *lp_local_ptr(struct service
*service
, void *ptr
)
7428 return (void *)(((char *)service
) + PTR_DIFF(ptr
, &sDefault
));
7431 /***************************************************************************
7432 Return the local pointer to a parameter given the service number and the
7433 pointer into the default structure.
7434 ***************************************************************************/
7436 void *lp_local_ptr_by_snum(int snum
, void *ptr
)
7438 return lp_local_ptr(ServicePtrs
[snum
], ptr
);
7441 /***************************************************************************
7442 Process a parameter for a particular service number. If snum < 0
7443 then assume we are in the globals.
7444 ***************************************************************************/
7446 bool lp_do_parameter(int snum
, const char *pszParmName
, const char *pszParmValue
)
7449 void *parm_ptr
= NULL
; /* where we are going to store the result */
7450 void *def_ptr
= NULL
;
7451 struct param_opt_struct
**opt_list
;
7453 parmnum
= map_parameter(pszParmName
);
7456 if (strchr(pszParmName
, ':') == NULL
) {
7457 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7463 * We've got a parametric option
7466 opt_list
= (snum
< 0)
7467 ? &Globals
.param_opt
: &ServicePtrs
[snum
]->param_opt
;
7468 set_param_opt(opt_list
, pszParmName
, pszParmValue
);
7473 if (parm_table
[parmnum
].flags
& FLAG_DEPRECATED
) {
7474 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7478 def_ptr
= parm_table
[parmnum
].ptr
;
7480 /* we might point at a service, the default service or a global */
7484 if (parm_table
[parmnum
].p_class
== P_GLOBAL
) {
7486 ("Global parameter %s found in service section!\n",
7490 parm_ptr
= lp_local_ptr_by_snum(snum
, def_ptr
);
7494 if (!ServicePtrs
[snum
]->copymap
)
7495 init_copymap(ServicePtrs
[snum
]);
7497 /* this handles the aliases - set the copymap for other entries with
7498 the same data pointer */
7499 for (i
= 0; parm_table
[i
].label
; i
++)
7500 if (parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
)
7501 bitmap_clear(ServicePtrs
[snum
]->copymap
, i
);
7504 /* if it is a special case then go ahead */
7505 if (parm_table
[parmnum
].special
) {
7506 return parm_table
[parmnum
].special(snum
, pszParmValue
,
7510 /* now switch on the type of variable it is */
7511 switch (parm_table
[parmnum
].type
)
7514 *(bool *)parm_ptr
= lp_bool(pszParmValue
);
7518 *(bool *)parm_ptr
= !lp_bool(pszParmValue
);
7522 *(int *)parm_ptr
= lp_int(pszParmValue
);
7526 *(char *)parm_ptr
= *pszParmValue
;
7530 i
= sscanf(pszParmValue
, "%o", (int *)parm_ptr
);
7532 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName
));
7537 TALLOC_FREE(*((char ***)parm_ptr
));
7538 *(char ***)parm_ptr
= str_list_make_v3(
7539 talloc_autofree_context(), pszParmValue
, NULL
);
7543 string_set((char **)parm_ptr
, pszParmValue
);
7547 string_set((char **)parm_ptr
, pszParmValue
);
7548 strupper_m(*(char **)parm_ptr
);
7552 lp_set_enum_parm( &parm_table
[parmnum
], pszParmValue
, (int*)parm_ptr
);
7561 /***************************************************************************
7562 Process a parameter.
7563 ***************************************************************************/
7565 static bool do_parameter(const char *pszParmName
, const char *pszParmValue
,
7568 if (!bInGlobalSection
&& bGlobalOnly
)
7571 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName
, pszParmValue
));
7573 return (lp_do_parameter(bInGlobalSection
? -2 : iServiceIndex
,
7574 pszParmName
, pszParmValue
));
7577 /***************************************************************************
7578 Print a parameter of the specified type.
7579 ***************************************************************************/
7581 static void print_parameter(struct parm_struct
*p
, void *ptr
, FILE * f
)
7587 for (i
= 0; p
->enum_list
[i
].name
; i
++) {
7588 if (*(int *)ptr
== p
->enum_list
[i
].value
) {
7590 p
->enum_list
[i
].name
);
7597 fprintf(f
, "%s", BOOLSTR(*(bool *)ptr
));
7601 fprintf(f
, "%s", BOOLSTR(!*(bool *)ptr
));
7605 fprintf(f
, "%d", *(int *)ptr
);
7609 fprintf(f
, "%c", *(char *)ptr
);
7613 char *o
= octal_string(*(int *)ptr
);
7614 fprintf(f
, "%s", o
);
7620 if ((char ***)ptr
&& *(char ***)ptr
) {
7621 char **list
= *(char ***)ptr
;
7622 for (; *list
; list
++) {
7623 /* surround strings with whitespace in double quotes */
7624 if ( strchr_m( *list
, ' ' ) )
7625 fprintf(f
, "\"%s\"%s", *list
, ((*(list
+1))?", ":""));
7627 fprintf(f
, "%s%s", *list
, ((*(list
+1))?", ":""));
7634 if (*(char **)ptr
) {
7635 fprintf(f
, "%s", *(char **)ptr
);
7643 /***************************************************************************
7644 Check if two parameters are equal.
7645 ***************************************************************************/
7647 static bool equal_parameter(parm_type type
, void *ptr1
, void *ptr2
)
7652 return (*((bool *)ptr1
) == *((bool *)ptr2
));
7657 return (*((int *)ptr1
) == *((int *)ptr2
));
7660 return (*((char *)ptr1
) == *((char *)ptr2
));
7663 return str_list_equal(*(const char ***)ptr1
, *(const char ***)ptr2
);
7668 char *p1
= *(char **)ptr1
, *p2
= *(char **)ptr2
;
7673 return (p1
== p2
|| strequal(p1
, p2
));
7681 /***************************************************************************
7682 Initialize any local varients in the sDefault table.
7683 ***************************************************************************/
7685 void init_locals(void)
7690 /***************************************************************************
7691 Process a new section (service). At this stage all sections are services.
7692 Later we'll have special sections that permit server parameters to be set.
7693 Returns True on success, False on failure.
7694 ***************************************************************************/
7696 static bool do_section(const char *pszSectionName
, void *userdata
)
7699 bool isglobal
= ((strwicmp(pszSectionName
, GLOBAL_NAME
) == 0) ||
7700 (strwicmp(pszSectionName
, GLOBAL_NAME2
) == 0));
7703 /* if we were in a global section then do the local inits */
7704 if (bInGlobalSection
&& !isglobal
)
7707 /* if we've just struck a global section, note the fact. */
7708 bInGlobalSection
= isglobal
;
7710 /* check for multiple global sections */
7711 if (bInGlobalSection
) {
7712 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName
));
7716 if (!bInGlobalSection
&& bGlobalOnly
)
7719 /* if we have a current service, tidy it up before moving on */
7722 if (iServiceIndex
>= 0)
7723 bRetval
= service_ok(iServiceIndex
);
7725 /* if all is still well, move to the next record in the services array */
7727 /* We put this here to avoid an odd message order if messages are */
7728 /* issued by the post-processing of a previous section. */
7729 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName
));
7731 if ((iServiceIndex
= add_a_service(&sDefault
, pszSectionName
))
7733 DEBUG(0, ("Failed to add a new service\n"));
7742 /***************************************************************************
7743 Determine if a partcular base parameter is currentl set to the default value.
7744 ***************************************************************************/
7746 static bool is_default(int i
)
7748 if (!defaults_saved
)
7750 switch (parm_table
[i
].type
) {
7752 return str_list_equal((const char **)parm_table
[i
].def
.lvalue
,
7753 *(const char ***)parm_table
[i
].ptr
);
7756 return strequal(parm_table
[i
].def
.svalue
,
7757 *(char **)parm_table
[i
].ptr
);
7760 return parm_table
[i
].def
.bvalue
==
7761 *(bool *)parm_table
[i
].ptr
;
7763 return parm_table
[i
].def
.cvalue
==
7764 *(char *)parm_table
[i
].ptr
;
7768 return parm_table
[i
].def
.ivalue
==
7769 *(int *)parm_table
[i
].ptr
;
7776 /***************************************************************************
7777 Display the contents of the global structure.
7778 ***************************************************************************/
7780 static void dump_globals(FILE *f
)
7783 struct param_opt_struct
*data
;
7785 fprintf(f
, "[global]\n");
7787 for (i
= 0; parm_table
[i
].label
; i
++)
7788 if (parm_table
[i
].p_class
== P_GLOBAL
&&
7789 parm_table
[i
].ptr
&&
7790 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
))) {
7791 if (defaults_saved
&& is_default(i
))
7793 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
7794 print_parameter(&parm_table
[i
], parm_table
[i
].ptr
, f
);
7797 if (Globals
.param_opt
!= NULL
) {
7798 data
= Globals
.param_opt
;
7800 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
7807 /***************************************************************************
7808 Return True if a local parameter is currently set to the global default.
7809 ***************************************************************************/
7811 bool lp_is_default(int snum
, struct parm_struct
*parm
)
7813 int pdiff
= PTR_DIFF(parm
->ptr
, &sDefault
);
7815 return equal_parameter(parm
->type
,
7816 ((char *)ServicePtrs
[snum
]) + pdiff
,
7817 ((char *)&sDefault
) + pdiff
);
7820 /***************************************************************************
7821 Display the contents of a single services record.
7822 ***************************************************************************/
7824 static void dump_a_service(struct service
*pService
, FILE * f
)
7827 struct param_opt_struct
*data
;
7829 if (pService
!= &sDefault
)
7830 fprintf(f
, "[%s]\n", pService
->szService
);
7832 for (i
= 0; parm_table
[i
].label
; i
++) {
7834 if (parm_table
[i
].p_class
== P_LOCAL
&&
7835 parm_table
[i
].ptr
&&
7836 (*parm_table
[i
].label
!= '-') &&
7837 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
7840 int pdiff
= PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
7842 if (pService
== &sDefault
) {
7843 if (defaults_saved
&& is_default(i
))
7846 if (equal_parameter(parm_table
[i
].type
,
7847 ((char *)pService
) +
7849 ((char *)&sDefault
) +
7854 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
7855 print_parameter(&parm_table
[i
],
7856 ((char *)pService
) + pdiff
, f
);
7861 if (pService
->param_opt
!= NULL
) {
7862 data
= pService
->param_opt
;
7864 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
7870 /***************************************************************************
7871 Display the contents of a parameter of a single services record.
7872 ***************************************************************************/
7874 bool dump_a_parameter(int snum
, char *parm_name
, FILE * f
, bool isGlobal
)
7877 bool result
= False
;
7880 fstring local_parm_name
;
7882 const char *parm_opt_value
;
7884 /* check for parametrical option */
7885 fstrcpy( local_parm_name
, parm_name
);
7886 parm_opt
= strchr( local_parm_name
, ':');
7891 if (strlen(parm_opt
)) {
7892 parm_opt_value
= lp_parm_const_string( snum
,
7893 local_parm_name
, parm_opt
, NULL
);
7894 if (parm_opt_value
) {
7895 printf( "%s\n", parm_opt_value
);
7902 /* check for a key and print the value */
7909 for (i
= 0; parm_table
[i
].label
; i
++) {
7910 if (strwicmp(parm_table
[i
].label
, parm_name
) == 0 &&
7911 (parm_table
[i
].p_class
== p_class
|| parm_table
[i
].flags
& flag
) &&
7912 parm_table
[i
].ptr
&&
7913 (*parm_table
[i
].label
!= '-') &&
7914 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
7919 ptr
= parm_table
[i
].ptr
;
7921 struct service
*pService
= ServicePtrs
[snum
];
7922 ptr
= ((char *)pService
) +
7923 PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
7926 print_parameter(&parm_table
[i
],
7937 /***************************************************************************
7938 Return info about the requested parameter (given as a string).
7939 Return NULL when the string is not a valid parameter name.
7940 ***************************************************************************/
7942 struct parm_struct
*lp_get_parameter(const char *param_name
)
7944 int num
= map_parameter(param_name
);
7950 return &parm_table
[num
];
7953 /***************************************************************************
7954 Return info about the next parameter in a service.
7955 snum==GLOBAL_SECTION_SNUM gives the globals.
7956 Return NULL when out of parameters.
7957 ***************************************************************************/
7959 struct parm_struct
*lp_next_parameter(int snum
, int *i
, int allparameters
)
7962 /* do the globals */
7963 for (; parm_table
[*i
].label
; (*i
)++) {
7964 if (parm_table
[*i
].p_class
== P_SEPARATOR
)
7965 return &parm_table
[(*i
)++];
7967 if (!parm_table
[*i
].ptr
7968 || (*parm_table
[*i
].label
== '-'))
7972 && (parm_table
[*i
].ptr
==
7973 parm_table
[(*i
) - 1].ptr
))
7976 if (is_default(*i
) && !allparameters
)
7979 return &parm_table
[(*i
)++];
7982 struct service
*pService
= ServicePtrs
[snum
];
7984 for (; parm_table
[*i
].label
; (*i
)++) {
7985 if (parm_table
[*i
].p_class
== P_SEPARATOR
)
7986 return &parm_table
[(*i
)++];
7988 if (parm_table
[*i
].p_class
== P_LOCAL
&&
7989 parm_table
[*i
].ptr
&&
7990 (*parm_table
[*i
].label
!= '-') &&
7992 (parm_table
[*i
].ptr
!=
7993 parm_table
[(*i
) - 1].ptr
)))
7996 PTR_DIFF(parm_table
[*i
].ptr
,
7999 if (allparameters
||
8000 !equal_parameter(parm_table
[*i
].type
,
8001 ((char *)pService
) +
8003 ((char *)&sDefault
) +
8006 return &parm_table
[(*i
)++];
8017 /***************************************************************************
8018 Display the contents of a single copy structure.
8019 ***************************************************************************/
8020 static void dump_copy_map(bool *pcopymap
)
8026 printf("\n\tNon-Copied parameters:\n");
8028 for (i
= 0; parm_table
[i
].label
; i
++)
8029 if (parm_table
[i
].p_class
== P_LOCAL
&&
8030 parm_table
[i
].ptr
&& !pcopymap
[i
] &&
8031 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
8033 printf("\t\t%s\n", parm_table
[i
].label
);
8038 /***************************************************************************
8039 Return TRUE if the passed service number is within range.
8040 ***************************************************************************/
8042 bool lp_snum_ok(int iService
)
8044 return (LP_SNUM_OK(iService
) && ServicePtrs
[iService
]->bAvailable
);
8047 /***************************************************************************
8048 Auto-load some home services.
8049 ***************************************************************************/
8051 static void lp_add_auto_services(char *str
)
8061 s
= SMB_STRDUP(str
);
8065 homes
= lp_servicenumber(HOMES_NAME
);
8067 for (p
= strtok_r(s
, LIST_SEP
, &saveptr
); p
;
8068 p
= strtok_r(NULL
, LIST_SEP
, &saveptr
)) {
8071 if (lp_servicenumber(p
) >= 0)
8074 home
= get_user_home_dir(talloc_tos(), p
);
8076 if (home
&& homes
>= 0)
8077 lp_add_home(p
, homes
, p
, home
);
8084 /***************************************************************************
8085 Auto-load one printer.
8086 ***************************************************************************/
8088 void lp_add_one_printer(const char *name
, const char *comment
, void *pdata
)
8090 int printers
= lp_servicenumber(PRINTERS_NAME
);
8093 if (lp_servicenumber(name
) < 0) {
8094 lp_add_printer(name
, printers
);
8095 if ((i
= lp_servicenumber(name
)) >= 0) {
8096 string_set(&ServicePtrs
[i
]->comment
, comment
);
8097 ServicePtrs
[i
]->autoloaded
= True
;
8102 /***************************************************************************
8103 Have we loaded a services file yet?
8104 ***************************************************************************/
8106 bool lp_loaded(void)
8111 /***************************************************************************
8112 Unload unused services.
8113 ***************************************************************************/
8115 void lp_killunused(bool (*snumused
) (int))
8118 for (i
= 0; i
< iNumServices
; i
++) {
8122 /* don't kill autoloaded or usershare services */
8123 if ( ServicePtrs
[i
]->autoloaded
||
8124 ServicePtrs
[i
]->usershare
== USERSHARE_VALID
) {
8128 if (!snumused
|| !snumused(i
)) {
8129 free_service_byindex(i
);
8135 * Kill all except autoloaded and usershare services - convenience wrapper
8137 void lp_kill_all_services(void)
8139 lp_killunused(NULL
);
8142 /***************************************************************************
8144 ***************************************************************************/
8146 void lp_killservice(int iServiceIn
)
8148 if (VALID(iServiceIn
)) {
8149 free_service_byindex(iServiceIn
);
8153 /***************************************************************************
8154 Save the curent values of all global and sDefault parameters into the
8155 defaults union. This allows swat and testparm to show only the
8156 changed (ie. non-default) parameters.
8157 ***************************************************************************/
8159 static void lp_save_defaults(void)
8162 for (i
= 0; parm_table
[i
].label
; i
++) {
8163 if (i
> 0 && parm_table
[i
].ptr
== parm_table
[i
- 1].ptr
)
8165 switch (parm_table
[i
].type
) {
8167 parm_table
[i
].def
.lvalue
= str_list_copy(
8168 NULL
, *(const char ***)parm_table
[i
].ptr
);
8172 if (parm_table
[i
].ptr
) {
8173 parm_table
[i
].def
.svalue
= SMB_STRDUP(*(char **)parm_table
[i
].ptr
);
8175 parm_table
[i
].def
.svalue
= NULL
;
8180 parm_table
[i
].def
.bvalue
=
8181 *(bool *)parm_table
[i
].ptr
;
8184 parm_table
[i
].def
.cvalue
=
8185 *(char *)parm_table
[i
].ptr
;
8190 parm_table
[i
].def
.ivalue
=
8191 *(int *)parm_table
[i
].ptr
;
8197 defaults_saved
= True
;
8200 /*******************************************************************
8201 Set the server type we will announce as via nmbd.
8202 ********************************************************************/
8204 static const struct srv_role_tab
{
8206 const char *role_str
;
8207 } srv_role_tab
[] = {
8208 { ROLE_STANDALONE
, "ROLE_STANDALONE" },
8209 { ROLE_DOMAIN_MEMBER
, "ROLE_DOMAIN_MEMBER" },
8210 { ROLE_DOMAIN_BDC
, "ROLE_DOMAIN_BDC" },
8211 { ROLE_DOMAIN_PDC
, "ROLE_DOMAIN_PDC" },
8215 const char* server_role_str(uint32 role
)
8218 for (i
=0; srv_role_tab
[i
].role_str
; i
++) {
8219 if (role
== srv_role_tab
[i
].role
) {
8220 return srv_role_tab
[i
].role_str
;
8226 static void set_server_role(void)
8228 server_role
= ROLE_STANDALONE
;
8230 switch (lp_security()) {
8232 if (lp_domain_logons())
8233 DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
8236 if (lp_domain_logons())
8237 DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
8238 /* this used to be considered ROLE_DOMAIN_MEMBER but that's just wrong */
8239 server_role
= ROLE_STANDALONE
;
8242 if (lp_domain_logons()) {
8243 DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
8244 server_role
= ROLE_DOMAIN_BDC
;
8247 server_role
= ROLE_DOMAIN_MEMBER
;
8250 if (lp_domain_logons()) {
8251 server_role
= ROLE_DOMAIN_PDC
;
8254 server_role
= ROLE_DOMAIN_MEMBER
;
8257 if (lp_domain_logons()) {
8259 if (Globals
.iDomainMaster
) /* auto or yes */
8260 server_role
= ROLE_DOMAIN_PDC
;
8262 server_role
= ROLE_DOMAIN_BDC
;
8266 DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
8270 DEBUG(10, ("set_server_role: role = %s\n", server_role_str(server_role
)));
8273 /***********************************************************
8274 If we should send plaintext/LANMAN passwords in the clinet
8275 ************************************************************/
8277 static void set_allowed_client_auth(void)
8279 if (Globals
.bClientNTLMv2Auth
) {
8280 Globals
.bClientLanManAuth
= False
;
8282 if (!Globals
.bClientLanManAuth
) {
8283 Globals
.bClientPlaintextAuth
= False
;
8287 /***************************************************************************
8289 The following code allows smbd to read a user defined share file.
8290 Yes, this is my intent. Yes, I'm comfortable with that...
8292 THE FOLLOWING IS SECURITY CRITICAL CODE.
8294 It washes your clothes, it cleans your house, it guards you while you sleep...
8295 Do not f%^k with it....
8296 ***************************************************************************/
8298 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8300 /***************************************************************************
8301 Check allowed stat state of a usershare file.
8302 Ensure we print out who is dicking with us so the admin can
8303 get their sorry ass fired.
8304 ***************************************************************************/
8306 static bool check_usershare_stat(const char *fname
, SMB_STRUCT_STAT
*psbuf
)
8308 if (!S_ISREG(psbuf
->st_mode
)) {
8309 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8310 "not a regular file\n",
8311 fname
, (unsigned int)psbuf
->st_uid
));
8315 /* Ensure this doesn't have the other write bit set. */
8316 if (psbuf
->st_mode
& S_IWOTH
) {
8317 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8318 "public write. Refusing to allow as a usershare file.\n",
8319 fname
, (unsigned int)psbuf
->st_uid
));
8323 /* Should be 10k or less. */
8324 if (psbuf
->st_size
> MAX_USERSHARE_FILE_SIZE
) {
8325 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8326 "too large (%u) to be a user share file.\n",
8327 fname
, (unsigned int)psbuf
->st_uid
,
8328 (unsigned int)psbuf
->st_size
));
8335 /***************************************************************************
8336 Parse the contents of a usershare file.
8337 ***************************************************************************/
8339 enum usershare_err
parse_usershare_file(TALLOC_CTX
*ctx
,
8340 SMB_STRUCT_STAT
*psbuf
,
8341 const char *servicename
,
8345 char **pp_sharepath
,
8350 const char **prefixallowlist
= lp_usershare_prefix_allow_list();
8351 const char **prefixdenylist
= lp_usershare_prefix_deny_list();
8354 SMB_STRUCT_STAT sbuf
;
8355 char *sharepath
= NULL
;
8356 char *comment
= NULL
;
8358 *pp_sharepath
= NULL
;
8361 *pallow_guest
= False
;
8364 return USERSHARE_MALFORMED_FILE
;
8367 if (strcmp(lines
[0], "#VERSION 1") == 0) {
8369 } else if (strcmp(lines
[0], "#VERSION 2") == 0) {
8372 return USERSHARE_MALFORMED_FILE
;
8375 return USERSHARE_BAD_VERSION
;
8378 if (strncmp(lines
[1], "path=", 5) != 0) {
8379 return USERSHARE_MALFORMED_PATH
;
8382 sharepath
= talloc_strdup(ctx
, &lines
[1][5]);
8384 return USERSHARE_POSIX_ERR
;
8386 trim_string(sharepath
, " ", " ");
8388 if (strncmp(lines
[2], "comment=", 8) != 0) {
8389 return USERSHARE_MALFORMED_COMMENT_DEF
;
8392 comment
= talloc_strdup(ctx
, &lines
[2][8]);
8394 return USERSHARE_POSIX_ERR
;
8396 trim_string(comment
, " ", " ");
8397 trim_char(comment
, '"', '"');
8399 if (strncmp(lines
[3], "usershare_acl=", 14) != 0) {
8400 return USERSHARE_MALFORMED_ACL_DEF
;
8403 if (!parse_usershare_acl(ctx
, &lines
[3][14], ppsd
)) {
8404 return USERSHARE_ACL_ERR
;
8408 if (strncmp(lines
[4], "guest_ok=", 9) != 0) {
8409 return USERSHARE_MALFORMED_ACL_DEF
;
8411 if (lines
[4][9] == 'y') {
8412 *pallow_guest
= True
;
8416 if (snum
!= -1 && (strcmp(sharepath
, ServicePtrs
[snum
]->szPath
) == 0)) {
8417 /* Path didn't change, no checks needed. */
8418 *pp_sharepath
= sharepath
;
8419 *pp_comment
= comment
;
8420 return USERSHARE_OK
;
8423 /* The path *must* be absolute. */
8424 if (sharepath
[0] != '/') {
8425 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8426 servicename
, sharepath
));
8427 return USERSHARE_PATH_NOT_ABSOLUTE
;
8430 /* If there is a usershare prefix deny list ensure one of these paths
8431 doesn't match the start of the user given path. */
8432 if (prefixdenylist
) {
8434 for ( i
=0; prefixdenylist
[i
]; i
++ ) {
8435 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8436 servicename
, i
, prefixdenylist
[i
], sharepath
));
8437 if (memcmp( sharepath
, prefixdenylist
[i
], strlen(prefixdenylist
[i
])) == 0) {
8438 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8439 "usershare prefix deny list entries.\n",
8440 servicename
, sharepath
));
8441 return USERSHARE_PATH_IS_DENIED
;
8446 /* If there is a usershare prefix allow list ensure one of these paths
8447 does match the start of the user given path. */
8449 if (prefixallowlist
) {
8451 for ( i
=0; prefixallowlist
[i
]; i
++ ) {
8452 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8453 servicename
, i
, prefixallowlist
[i
], sharepath
));
8454 if (memcmp( sharepath
, prefixallowlist
[i
], strlen(prefixallowlist
[i
])) == 0) {
8458 if (prefixallowlist
[i
] == NULL
) {
8459 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8460 "usershare prefix allow list entries.\n",
8461 servicename
, sharepath
));
8462 return USERSHARE_PATH_NOT_ALLOWED
;
8466 /* Ensure this is pointing to a directory. */
8467 dp
= sys_opendir(sharepath
);
8470 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8471 servicename
, sharepath
));
8472 return USERSHARE_PATH_NOT_DIRECTORY
;
8475 /* Ensure the owner of the usershare file has permission to share
8478 if (sys_stat(sharepath
, &sbuf
) == -1) {
8479 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8480 servicename
, sharepath
, strerror(errno
) ));
8482 return USERSHARE_POSIX_ERR
;
8487 if (!S_ISDIR(sbuf
.st_mode
)) {
8488 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8489 servicename
, sharepath
));
8490 return USERSHARE_PATH_NOT_DIRECTORY
;
8493 /* Check if sharing is restricted to owner-only. */
8494 /* psbuf is the stat of the usershare definition file,
8495 sbuf is the stat of the target directory to be shared. */
8497 if (lp_usershare_owner_only()) {
8498 /* root can share anything. */
8499 if ((psbuf
->st_uid
!= 0) && (sbuf
.st_uid
!= psbuf
->st_uid
)) {
8500 return USERSHARE_PATH_NOT_ALLOWED
;
8504 *pp_sharepath
= sharepath
;
8505 *pp_comment
= comment
;
8506 return USERSHARE_OK
;
8509 /***************************************************************************
8510 Deal with a usershare file.
8513 -1 - Bad name, invalid contents.
8514 - service name already existed and not a usershare, problem
8515 with permissions to share directory etc.
8516 ***************************************************************************/
8518 static int process_usershare_file(const char *dir_name
, const char *file_name
, int snum_template
)
8520 SMB_STRUCT_STAT sbuf
;
8521 SMB_STRUCT_STAT lsbuf
;
8523 char *sharepath
= NULL
;
8524 char *comment
= NULL
;
8525 fstring service_name
;
8526 char **lines
= NULL
;
8530 TALLOC_CTX
*ctx
= NULL
;
8531 SEC_DESC
*psd
= NULL
;
8532 bool guest_ok
= False
;
8534 /* Ensure share name doesn't contain invalid characters. */
8535 if (!validate_net_name(file_name
, INVALID_SHARENAME_CHARS
, strlen(file_name
))) {
8536 DEBUG(0,("process_usershare_file: share name %s contains "
8537 "invalid characters (any of %s)\n",
8538 file_name
, INVALID_SHARENAME_CHARS
));
8542 fstrcpy(service_name
, file_name
);
8544 if (asprintf(&fname
, "%s/%s", dir_name
, file_name
) < 0) {
8547 /* Minimize the race condition by doing an lstat before we
8548 open and fstat. Ensure this isn't a symlink link. */
8550 if (sys_lstat(fname
, &lsbuf
) != 0) {
8551 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8552 fname
, strerror(errno
) ));
8557 /* This must be a regular file, not a symlink, directory or
8558 other strange filetype. */
8559 if (!check_usershare_stat(fname
, &lsbuf
)) {
8565 char *canon_name
= canonicalize_servicename(service_name
);
8566 TDB_DATA data
= dbwrap_fetch_bystring(
8567 ServiceHash
, canon_name
, canon_name
);
8571 if ((data
.dptr
!= NULL
) && (data
.dsize
== sizeof(iService
))) {
8572 iService
= *(int *)data
.dptr
;
8574 TALLOC_FREE(canon_name
);
8577 if (iService
!= -1 && ServicePtrs
[iService
]->usershare_last_mod
== lsbuf
.st_mtime
) {
8578 /* Nothing changed - Mark valid and return. */
8579 DEBUG(10,("process_usershare_file: service %s not changed.\n",
8581 ServicePtrs
[iService
]->usershare
= USERSHARE_VALID
;
8586 /* Try and open the file read only - no symlinks allowed. */
8588 fd
= sys_open(fname
, O_RDONLY
|O_NOFOLLOW
, 0);
8590 fd
= sys_open(fname
, O_RDONLY
, 0);
8594 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
8595 fname
, strerror(errno
) ));
8600 /* Now fstat to be *SURE* it's a regular file. */
8601 if (sys_fstat(fd
, &sbuf
) != 0) {
8603 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
8604 fname
, strerror(errno
) ));
8609 /* Is it the same dev/inode as was lstated ? */
8610 if (lsbuf
.st_dev
!= sbuf
.st_dev
|| lsbuf
.st_ino
!= sbuf
.st_ino
) {
8612 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
8613 "Symlink spoofing going on ?\n", fname
));
8618 /* This must be a regular file, not a symlink, directory or
8619 other strange filetype. */
8620 if (!check_usershare_stat(fname
, &sbuf
)) {
8625 lines
= fd_lines_load(fd
, &numlines
, MAX_USERSHARE_FILE_SIZE
, NULL
);
8628 if (lines
== NULL
) {
8629 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
8630 fname
, (unsigned int)sbuf
.st_uid
));
8637 /* Should we allow printers to be shared... ? */
8638 ctx
= talloc_init("usershare_sd_xctx");
8644 if (parse_usershare_file(ctx
, &sbuf
, service_name
,
8645 iService
, lines
, numlines
, &sharepath
,
8646 &comment
, &psd
, &guest_ok
) != USERSHARE_OK
) {
8647 talloc_destroy(ctx
);
8654 /* Everything ok - add the service possibly using a template. */
8656 const struct service
*sp
= &sDefault
;
8657 if (snum_template
!= -1) {
8658 sp
= ServicePtrs
[snum_template
];
8661 if ((iService
= add_a_service(sp
, service_name
)) < 0) {
8662 DEBUG(0, ("process_usershare_file: Failed to add "
8663 "new service %s\n", service_name
));
8664 talloc_destroy(ctx
);
8668 /* Read only is controlled by usershare ACL below. */
8669 ServicePtrs
[iService
]->bRead_only
= False
;
8672 /* Write the ACL of the new/modified share. */
8673 if (!set_share_security(service_name
, psd
)) {
8674 DEBUG(0, ("process_usershare_file: Failed to set share "
8675 "security for user share %s\n",
8677 lp_remove_service(iService
);
8678 talloc_destroy(ctx
);
8682 /* If from a template it may be marked invalid. */
8683 ServicePtrs
[iService
]->valid
= True
;
8685 /* Set the service as a valid usershare. */
8686 ServicePtrs
[iService
]->usershare
= USERSHARE_VALID
;
8688 /* Set guest access. */
8689 if (lp_usershare_allow_guests()) {
8690 ServicePtrs
[iService
]->bGuest_ok
= guest_ok
;
8693 /* And note when it was loaded. */
8694 ServicePtrs
[iService
]->usershare_last_mod
= sbuf
.st_mtime
;
8695 string_set(&ServicePtrs
[iService
]->szPath
, sharepath
);
8696 string_set(&ServicePtrs
[iService
]->comment
, comment
);
8698 talloc_destroy(ctx
);
8703 /***************************************************************************
8704 Checks if a usershare entry has been modified since last load.
8705 ***************************************************************************/
8707 static bool usershare_exists(int iService
, time_t *last_mod
)
8709 SMB_STRUCT_STAT lsbuf
;
8710 const char *usersharepath
= Globals
.szUsersharePath
;
8713 if (asprintf(&fname
, "%s/%s",
8715 ServicePtrs
[iService
]->szService
) < 0) {
8719 if (sys_lstat(fname
, &lsbuf
) != 0) {
8724 if (!S_ISREG(lsbuf
.st_mode
)) {
8730 *last_mod
= lsbuf
.st_mtime
;
8734 /***************************************************************************
8735 Load a usershare service by name. Returns a valid servicenumber or -1.
8736 ***************************************************************************/
8738 int load_usershare_service(const char *servicename
)
8740 SMB_STRUCT_STAT sbuf
;
8741 const char *usersharepath
= Globals
.szUsersharePath
;
8742 int max_user_shares
= Globals
.iUsershareMaxShares
;
8743 int snum_template
= -1;
8745 if (*usersharepath
== 0 || max_user_shares
== 0) {
8749 if (sys_stat(usersharepath
, &sbuf
) != 0) {
8750 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
8751 usersharepath
, strerror(errno
) ));
8755 if (!S_ISDIR(sbuf
.st_mode
)) {
8756 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
8762 * This directory must be owned by root, and have the 't' bit set.
8763 * It also must not be writable by "other".
8767 if (sbuf
.st_uid
!= 0 || !(sbuf
.st_mode
& S_ISVTX
) || (sbuf
.st_mode
& S_IWOTH
)) {
8769 if (sbuf
.st_uid
!= 0 || (sbuf
.st_mode
& S_IWOTH
)) {
8771 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
8772 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8777 /* Ensure the template share exists if it's set. */
8778 if (Globals
.szUsershareTemplateShare
[0]) {
8779 /* We can't use lp_servicenumber here as we are recommending that
8780 template shares have -valid=False set. */
8781 for (snum_template
= iNumServices
- 1; snum_template
>= 0; snum_template
--) {
8782 if (ServicePtrs
[snum_template
]->szService
&&
8783 strequal(ServicePtrs
[snum_template
]->szService
,
8784 Globals
.szUsershareTemplateShare
)) {
8789 if (snum_template
== -1) {
8790 DEBUG(0,("load_usershare_service: usershare template share %s "
8791 "does not exist.\n",
8792 Globals
.szUsershareTemplateShare
));
8797 return process_usershare_file(usersharepath
, servicename
, snum_template
);
8800 /***************************************************************************
8801 Load all user defined shares from the user share directory.
8802 We only do this if we're enumerating the share list.
8803 This is the function that can delete usershares that have
8805 ***************************************************************************/
8807 int load_usershare_shares(void)
8810 SMB_STRUCT_STAT sbuf
;
8811 SMB_STRUCT_DIRENT
*de
;
8812 int num_usershares
= 0;
8813 int max_user_shares
= Globals
.iUsershareMaxShares
;
8814 unsigned int num_dir_entries
, num_bad_dir_entries
, num_tmp_dir_entries
;
8815 unsigned int allowed_bad_entries
= ((2*max_user_shares
)/10);
8816 unsigned int allowed_tmp_entries
= ((2*max_user_shares
)/10);
8818 int snum_template
= -1;
8819 const char *usersharepath
= Globals
.szUsersharePath
;
8820 int ret
= lp_numservices();
8822 if (max_user_shares
== 0 || *usersharepath
== '\0') {
8823 return lp_numservices();
8826 if (sys_stat(usersharepath
, &sbuf
) != 0) {
8827 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
8828 usersharepath
, strerror(errno
) ));
8833 * This directory must be owned by root, and have the 't' bit set.
8834 * It also must not be writable by "other".
8838 if (sbuf
.st_uid
!= 0 || !(sbuf
.st_mode
& S_ISVTX
) || (sbuf
.st_mode
& S_IWOTH
)) {
8840 if (sbuf
.st_uid
!= 0 || (sbuf
.st_mode
& S_IWOTH
)) {
8842 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
8843 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8848 /* Ensure the template share exists if it's set. */
8849 if (Globals
.szUsershareTemplateShare
[0]) {
8850 /* We can't use lp_servicenumber here as we are recommending that
8851 template shares have -valid=False set. */
8852 for (snum_template
= iNumServices
- 1; snum_template
>= 0; snum_template
--) {
8853 if (ServicePtrs
[snum_template
]->szService
&&
8854 strequal(ServicePtrs
[snum_template
]->szService
,
8855 Globals
.szUsershareTemplateShare
)) {
8860 if (snum_template
== -1) {
8861 DEBUG(0,("load_usershare_shares: usershare template share %s "
8862 "does not exist.\n",
8863 Globals
.szUsershareTemplateShare
));
8868 /* Mark all existing usershares as pending delete. */
8869 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
8870 if (VALID(iService
) && ServicePtrs
[iService
]->usershare
) {
8871 ServicePtrs
[iService
]->usershare
= USERSHARE_PENDING_DELETE
;
8875 dp
= sys_opendir(usersharepath
);
8877 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
8878 usersharepath
, strerror(errno
) ));
8882 for (num_dir_entries
= 0, num_bad_dir_entries
= 0, num_tmp_dir_entries
= 0;
8883 (de
= sys_readdir(dp
));
8884 num_dir_entries
++ ) {
8886 const char *n
= de
->d_name
;
8888 /* Ignore . and .. */
8890 if ((n
[1] == '\0') || (n
[1] == '.' && n
[2] == '\0')) {
8896 /* Temporary file used when creating a share. */
8897 num_tmp_dir_entries
++;
8900 /* Allow 20% tmp entries. */
8901 if (num_tmp_dir_entries
> allowed_tmp_entries
) {
8902 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
8903 "in directory %s\n",
8904 num_tmp_dir_entries
, usersharepath
));
8908 r
= process_usershare_file(usersharepath
, n
, snum_template
);
8910 /* Update the services count. */
8912 if (num_usershares
>= max_user_shares
) {
8913 DEBUG(0,("load_usershare_shares: max user shares reached "
8914 "on file %s in directory %s\n",
8915 n
, usersharepath
));
8918 } else if (r
== -1) {
8919 num_bad_dir_entries
++;
8922 /* Allow 20% bad entries. */
8923 if (num_bad_dir_entries
> allowed_bad_entries
) {
8924 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
8925 "in directory %s\n",
8926 num_bad_dir_entries
, usersharepath
));
8930 /* Allow 20% bad entries. */
8931 if (num_dir_entries
> max_user_shares
+ allowed_bad_entries
) {
8932 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
8933 "in directory %s\n",
8934 num_dir_entries
, usersharepath
));
8941 /* Sweep through and delete any non-refreshed usershares that are
8942 not currently in use. */
8943 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
8944 if (VALID(iService
) && (ServicePtrs
[iService
]->usershare
== USERSHARE_PENDING_DELETE
)) {
8945 if (conn_snum_used(iService
)) {
8948 /* Remove from the share ACL db. */
8949 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
8950 lp_servicename(iService
) ));
8951 delete_share_security(lp_servicename(iService
));
8952 free_service_byindex(iService
);
8956 return lp_numservices();
8959 /********************************************************
8960 Destroy global resources allocated in this file
8961 ********************************************************/
8963 void gfree_loadparm(void)
8965 struct file_lists
*f
;
8966 struct file_lists
*next
;
8969 /* Free the file lists */
8974 SAFE_FREE( f
->name
);
8975 SAFE_FREE( f
->subfname
);
8981 /* Free resources allocated to services */
8983 for ( i
= 0; i
< iNumServices
; i
++ ) {
8985 free_service_byindex(i
);
8989 SAFE_FREE( ServicePtrs
);
8992 /* Now release all resources allocated to global
8993 parameters and the default service */
8995 free_global_parameters();
8999 /***************************************************************************
9000 Allow client apps to specify that they are a client
9001 ***************************************************************************/
9002 void lp_set_in_client(bool b
)
9008 /***************************************************************************
9009 Determine if we're running in a client app
9010 ***************************************************************************/
9011 bool lp_is_in_client(void)
9016 /***************************************************************************
9017 Load the services array from the services file. Return True on success,
9019 ***************************************************************************/
9021 bool lp_load_ex(const char *pszFname
,
9025 bool initialize_globals
,
9026 bool allow_include_registry
,
9027 bool allow_registry_shares
)
9034 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9036 bInGlobalSection
= True
;
9037 bGlobalOnly
= global_only
;
9038 bAllowIncludeRegistry
= allow_include_registry
;
9040 init_globals(! initialize_globals
);
9043 if (save_defaults
) {
9048 free_param_opts(&Globals
.param_opt
);
9050 /* We get sections first, so have to start 'behind' to make up */
9053 if (lp_config_backend_is_file()) {
9054 n2
= alloc_sub_basic(get_current_username(),
9055 current_user_info
.domain
,
9058 smb_panic("lp_load_ex: out of memory");
9061 add_to_file_list(pszFname
, n2
);
9063 bRetval
= pm_process(n2
, do_section
, do_parameter
, NULL
);
9066 /* finish up the last section */
9067 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval
)));
9069 if (iServiceIndex
>= 0) {
9070 bRetval
= service_ok(iServiceIndex
);
9074 if (lp_config_backend_is_registry()) {
9075 /* config backend changed to registry in config file */
9077 * We need to use this extra global variable here to
9078 * survive restart: init_globals uses this as a default
9079 * for ConfigBackend. Otherwise, init_globals would
9080 * send us into an endless loop here.
9082 config_backend
= CONFIG_BACKEND_REGISTRY
;
9084 DEBUG(1, ("lp_load_ex: changing to config backend "
9086 init_globals(false);
9087 lp_kill_all_services();
9088 return lp_load_ex(pszFname
, global_only
, save_defaults
,
9089 add_ipc
, initialize_globals
,
9090 allow_include_registry
,
9091 allow_registry_shares
);
9093 } else if (lp_config_backend_is_registry()) {
9094 bRetval
= process_registry_globals();
9096 DEBUG(0, ("Illegal config backend given: %d\n",
9097 lp_config_backend()));
9101 if (bRetval
&& lp_registry_shares() && allow_registry_shares
) {
9102 bRetval
= process_registry_shares();
9105 lp_add_auto_services(lp_auto_services());
9108 /* When 'restrict anonymous = 2' guest connections to ipc$
9110 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9111 if ( lp_enable_asu_support() ) {
9112 lp_add_ipc("ADMIN$", false);
9117 set_default_server_announce_type();
9118 set_allowed_client_auth();
9122 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9123 /* if bWINSsupport is true and we are in the client */
9124 if (lp_is_in_client() && Globals
.bWINSsupport
) {
9125 lp_do_parameter(GLOBAL_SECTION_SNUM
, "wins server", "127.0.0.1");
9130 bAllowIncludeRegistry
= true;
9135 bool lp_load(const char *pszFname
,
9139 bool initialize_globals
)
9141 return lp_load_ex(pszFname
,
9149 bool lp_load_initial_only(const char *pszFname
)
9151 return lp_load_ex(pszFname
,
9160 bool lp_load_with_registry_shares(const char *pszFname
,
9164 bool initialize_globals
)
9166 return lp_load_ex(pszFname
,
9175 /***************************************************************************
9176 Return the max number of services.
9177 ***************************************************************************/
9179 int lp_numservices(void)
9181 return (iNumServices
);
9184 /***************************************************************************
9185 Display the contents of the services array in human-readable form.
9186 ***************************************************************************/
9188 void lp_dump(FILE *f
, bool show_defaults
, int maxtoprint
)
9193 defaults_saved
= False
;
9197 dump_a_service(&sDefault
, f
);
9199 for (iService
= 0; iService
< maxtoprint
; iService
++) {
9201 lp_dump_one(f
, show_defaults
, iService
);
9205 /***************************************************************************
9206 Display the contents of one service in human-readable form.
9207 ***************************************************************************/
9209 void lp_dump_one(FILE * f
, bool show_defaults
, int snum
)
9212 if (ServicePtrs
[snum
]->szService
[0] == '\0')
9214 dump_a_service(ServicePtrs
[snum
], f
);
9218 /***************************************************************************
9219 Return the number of the service with the given name, or -1 if it doesn't
9220 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9221 getservicebyname()! This works ONLY if all services have been loaded, and
9222 does not copy the found service.
9223 ***************************************************************************/
9225 int lp_servicenumber(const char *pszServiceName
)
9228 fstring serviceName
;
9230 if (!pszServiceName
) {
9231 return GLOBAL_SECTION_SNUM
;
9234 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
9235 if (VALID(iService
) && ServicePtrs
[iService
]->szService
) {
9237 * The substitution here is used to support %U is
9240 fstrcpy(serviceName
, ServicePtrs
[iService
]->szService
);
9241 standard_sub_basic(get_current_username(),
9242 current_user_info
.domain
,
9243 serviceName
,sizeof(serviceName
));
9244 if (strequal(serviceName
, pszServiceName
)) {
9250 if (iService
>= 0 && ServicePtrs
[iService
]->usershare
== USERSHARE_VALID
) {
9253 if (!usershare_exists(iService
, &last_mod
)) {
9254 /* Remove the share security tdb entry for it. */
9255 delete_share_security(lp_servicename(iService
));
9256 /* Remove it from the array. */
9257 free_service_byindex(iService
);
9258 /* Doesn't exist anymore. */
9259 return GLOBAL_SECTION_SNUM
;
9262 /* Has it been modified ? If so delete and reload. */
9263 if (ServicePtrs
[iService
]->usershare_last_mod
< last_mod
) {
9264 /* Remove it from the array. */
9265 free_service_byindex(iService
);
9266 /* and now reload it. */
9267 iService
= load_usershare_service(pszServiceName
);
9272 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName
));
9273 return GLOBAL_SECTION_SNUM
;
9279 bool share_defined(const char *service_name
)
9281 return (lp_servicenumber(service_name
) != -1);
9284 struct share_params
*get_share_params(TALLOC_CTX
*mem_ctx
,
9285 const char *sharename
)
9287 struct share_params
*result
;
9291 if (!(sname
= SMB_STRDUP(sharename
))) {
9295 snum
= find_service(sname
);
9302 if (!(result
= TALLOC_P(mem_ctx
, struct share_params
))) {
9303 DEBUG(0, ("talloc failed\n"));
9307 result
->service
= snum
;
9311 struct share_iterator
*share_list_all(TALLOC_CTX
*mem_ctx
)
9313 struct share_iterator
*result
;
9315 if (!(result
= TALLOC_P(mem_ctx
, struct share_iterator
))) {
9316 DEBUG(0, ("talloc failed\n"));
9320 result
->next_id
= 0;
9324 struct share_params
*next_share(struct share_iterator
*list
)
9326 struct share_params
*result
;
9328 while (!lp_snum_ok(list
->next_id
) &&
9329 (list
->next_id
< lp_numservices())) {
9333 if (list
->next_id
>= lp_numservices()) {
9337 if (!(result
= TALLOC_P(list
, struct share_params
))) {
9338 DEBUG(0, ("talloc failed\n"));
9342 result
->service
= list
->next_id
;
9347 struct share_params
*next_printer(struct share_iterator
*list
)
9349 struct share_params
*result
;
9351 while ((result
= next_share(list
)) != NULL
) {
9352 if (lp_print_ok(result
->service
)) {
9360 * This is a hack for a transition period until we transformed all code from
9361 * service numbers to struct share_params.
9364 struct share_params
*snum2params_static(int snum
)
9366 static struct share_params result
;
9367 result
.service
= snum
;
9371 /*******************************************************************
9372 A useful volume label function.
9373 ********************************************************************/
9375 const char *volume_label(int snum
)
9378 const char *label
= lp_volume(snum
);
9380 label
= lp_servicename(snum
);
9383 /* This returns a 33 byte guarenteed null terminated string. */
9384 ret
= talloc_strndup(talloc_tos(), label
, 32);
9391 /*******************************************************************
9392 Set the server type we will announce as via nmbd.
9393 ********************************************************************/
9395 static void set_default_server_announce_type(void)
9397 default_server_announce
= 0;
9398 default_server_announce
|= SV_TYPE_WORKSTATION
;
9399 default_server_announce
|= SV_TYPE_SERVER
;
9400 default_server_announce
|= SV_TYPE_SERVER_UNIX
;
9402 /* note that the flag should be set only if we have a
9403 printer service but nmbd doesn't actually load the
9404 services so we can't tell --jerry */
9406 default_server_announce
|= SV_TYPE_PRINTQ_SERVER
;
9408 switch (lp_announce_as()) {
9409 case ANNOUNCE_AS_NT_SERVER
:
9410 default_server_announce
|= SV_TYPE_SERVER_NT
;
9411 /* fall through... */
9412 case ANNOUNCE_AS_NT_WORKSTATION
:
9413 default_server_announce
|= SV_TYPE_NT
;
9415 case ANNOUNCE_AS_WIN95
:
9416 default_server_announce
|= SV_TYPE_WIN95_PLUS
;
9418 case ANNOUNCE_AS_WFW
:
9419 default_server_announce
|= SV_TYPE_WFW
;
9425 switch (lp_server_role()) {
9426 case ROLE_DOMAIN_MEMBER
:
9427 default_server_announce
|= SV_TYPE_DOMAIN_MEMBER
;
9429 case ROLE_DOMAIN_PDC
:
9430 default_server_announce
|= SV_TYPE_DOMAIN_CTRL
;
9432 case ROLE_DOMAIN_BDC
:
9433 default_server_announce
|= SV_TYPE_DOMAIN_BAKCTRL
;
9435 case ROLE_STANDALONE
:
9439 if (lp_time_server())
9440 default_server_announce
|= SV_TYPE_TIME_SOURCE
;
9442 if (lp_host_msdfs())
9443 default_server_announce
|= SV_TYPE_DFS_SERVER
;
9446 /***********************************************************
9447 returns role of Samba server
9448 ************************************************************/
9450 int lp_server_role(void)
9455 /***********************************************************
9456 If we are PDC then prefer us as DMB
9457 ************************************************************/
9459 bool lp_domain_master(void)
9461 if (Globals
.iDomainMaster
== Auto
)
9462 return (lp_server_role() == ROLE_DOMAIN_PDC
);
9464 return (bool)Globals
.iDomainMaster
;
9467 /***********************************************************
9468 If we are DMB then prefer us as LMB
9469 ************************************************************/
9471 bool lp_preferred_master(void)
9473 if (Globals
.iPreferredMaster
== Auto
)
9474 return (lp_local_master() && lp_domain_master());
9476 return (bool)Globals
.iPreferredMaster
;
9479 /*******************************************************************
9481 ********************************************************************/
9483 void lp_remove_service(int snum
)
9485 ServicePtrs
[snum
]->valid
= False
;
9486 invalid_services
[num_invalid_services
++] = snum
;
9489 /*******************************************************************
9491 ********************************************************************/
9493 void lp_copy_service(int snum
, const char *new_name
)
9495 do_section(new_name
, NULL
);
9497 snum
= lp_servicenumber(new_name
);
9499 lp_do_parameter(snum
, "copy", lp_servicename(snum
));
9504 /*******************************************************************
9505 Get the default server type we will announce as via nmbd.
9506 ********************************************************************/
9508 int lp_default_server_announce(void)
9510 return default_server_announce
;
9513 /*******************************************************************
9514 Split the announce version into major and minor numbers.
9515 ********************************************************************/
9517 int lp_major_announce_version(void)
9519 static bool got_major
= False
;
9520 static int major_version
= DEFAULT_MAJOR_VERSION
;
9525 return major_version
;
9528 if ((vers
= lp_announce_version()) == NULL
)
9529 return major_version
;
9531 if ((p
= strchr_m(vers
, '.')) == 0)
9532 return major_version
;
9535 major_version
= atoi(vers
);
9536 return major_version
;
9539 int lp_minor_announce_version(void)
9541 static bool got_minor
= False
;
9542 static int minor_version
= DEFAULT_MINOR_VERSION
;
9547 return minor_version
;
9550 if ((vers
= lp_announce_version()) == NULL
)
9551 return minor_version
;
9553 if ((p
= strchr_m(vers
, '.')) == 0)
9554 return minor_version
;
9557 minor_version
= atoi(p
);
9558 return minor_version
;
9561 /***********************************************************
9562 Set the global name resolution order (used in smbclient).
9563 ************************************************************/
9565 void lp_set_name_resolve_order(const char *new_order
)
9567 string_set(&Globals
.szNameResolveOrder
, new_order
);
9570 const char *lp_printername(int snum
)
9572 const char *ret
= _lp_printername(snum
);
9573 if (ret
== NULL
|| (ret
!= NULL
&& *ret
== '\0'))
9574 ret
= lp_const_servicename(snum
);
9580 /***********************************************************
9581 Allow daemons such as winbindd to fix their logfile name.
9582 ************************************************************/
9584 void lp_set_logfile(const char *name
)
9586 string_set(&Globals
.szLogFile
, name
);
9587 debug_set_logfile(name
);
9590 /*******************************************************************
9591 Return the max print jobs per queue.
9592 ********************************************************************/
9594 int lp_maxprintjobs(int snum
)
9596 int maxjobs
= LP_SNUM_OK(snum
) ? ServicePtrs
[snum
]->iMaxPrintJobs
: sDefault
.iMaxPrintJobs
;
9597 if (maxjobs
<= 0 || maxjobs
>= PRINT_MAX_JOBID
)
9598 maxjobs
= PRINT_MAX_JOBID
- 1;
9603 const char *lp_printcapname(void)
9605 if ((Globals
.szPrintcapname
!= NULL
) &&
9606 (Globals
.szPrintcapname
[0] != '\0'))
9607 return Globals
.szPrintcapname
;
9609 if (sDefault
.iPrinting
== PRINT_CUPS
) {
9617 if (sDefault
.iPrinting
== PRINT_BSD
)
9618 return "/etc/printcap";
9620 return PRINTCAP_NAME
;
9623 static uint32 spoolss_state
;
9625 bool lp_disable_spoolss( void )
9627 if ( spoolss_state
== SVCCTL_STATE_UNKNOWN
)
9628 spoolss_state
= _lp_disable_spoolss() ? SVCCTL_STOPPED
: SVCCTL_RUNNING
;
9630 return spoolss_state
== SVCCTL_STOPPED
? True
: False
;
9633 void lp_set_spoolss_state( uint32 state
)
9635 SMB_ASSERT( (state
== SVCCTL_STOPPED
) || (state
== SVCCTL_RUNNING
) );
9637 spoolss_state
= state
;
9640 uint32
lp_get_spoolss_state( void )
9642 return lp_disable_spoolss() ? SVCCTL_STOPPED
: SVCCTL_RUNNING
;
9645 /*******************************************************************
9646 Ensure we don't use sendfile if server smb signing is active.
9647 ********************************************************************/
9649 bool lp_use_sendfile(int snum
, struct smb_signing_state
*signing_state
)
9651 bool sign_active
= false;
9653 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
9654 if (Protocol
< PROTOCOL_NT1
) {
9657 if (signing_state
) {
9658 sign_active
= smb_signing_is_active(signing_state
);
9660 return (_lp_use_sendfile(snum
) &&
9661 (get_remote_arch() != RA_WIN95
) &&
9665 /*******************************************************************
9666 Turn off sendfile if we find the underlying OS doesn't support it.
9667 ********************************************************************/
9669 void set_use_sendfile(int snum
, bool val
)
9671 if (LP_SNUM_OK(snum
))
9672 ServicePtrs
[snum
]->bUseSendfile
= val
;
9674 sDefault
.bUseSendfile
= val
;
9677 /*******************************************************************
9678 Turn off storing DOS attributes if this share doesn't support it.
9679 ********************************************************************/
9681 void set_store_dos_attributes(int snum
, bool val
)
9683 if (!LP_SNUM_OK(snum
))
9685 ServicePtrs
[(snum
)]->bStoreDosAttributes
= val
;
9688 void lp_set_mangling_method(const char *new_method
)
9690 string_set(&Globals
.szManglingMethod
, new_method
);
9693 /*******************************************************************
9694 Global state for POSIX pathname processing.
9695 ********************************************************************/
9697 static bool posix_pathnames
;
9699 bool lp_posix_pathnames(void)
9701 return posix_pathnames
;
9704 /*******************************************************************
9705 Change everything needed to ensure POSIX pathname processing (currently
9707 ********************************************************************/
9709 void lp_set_posix_pathnames(void)
9711 posix_pathnames
= True
;
9714 /*******************************************************************
9715 Global state for POSIX lock processing - CIFS unix extensions.
9716 ********************************************************************/
9718 bool posix_default_lock_was_set
;
9719 static enum brl_flavour posix_cifsx_locktype
; /* By default 0 == WINDOWS_LOCK */
9721 enum brl_flavour
lp_posix_cifsu_locktype(files_struct
*fsp
)
9723 if (posix_default_lock_was_set
) {
9724 return posix_cifsx_locktype
;
9726 return fsp
->posix_open
? POSIX_LOCK
: WINDOWS_LOCK
;
9730 /*******************************************************************
9731 ********************************************************************/
9733 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val
)
9735 posix_default_lock_was_set
= True
;
9736 posix_cifsx_locktype
= val
;
9739 int lp_min_receive_file_size(void)
9741 if (Globals
.iminreceivefile
< 0) {
9744 return MIN(Globals
.iminreceivefile
, BUFFER_SIZE
);
9747 /*******************************************************************
9748 If socket address is an empty character string, it is necessary to
9749 define it as "0.0.0.0".
9750 ********************************************************************/
9752 const char *lp_socket_address(void)
9754 char *sock_addr
= Globals
.szSocketAddress
;
9756 if (sock_addr
[0] == '\0'){
9757 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
9759 return Globals
.szSocketAddress
;