2 Unix SMB/CIFS implementation.
3 Parameter loading functions
4 Copyright (C) Karl Auer 1993-1998
6 Largely re-written by Andrew Tridgell, September 1994
8 Copyright (C) Simo Sorce 2001
9 Copyright (C) Alexander Bokovoy 2002
10 Copyright (C) Stefan (metze) Metzmacher 2002
11 Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
12 Copyright (C) Michael Adam 2008
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 3 of the License, or
17 (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>.
31 * This module provides suitable callback functions for the params
32 * module. It builds the internal table of service details which is
33 * then used by the rest of the server.
37 * 1) add it to the global or service structure definition
38 * 2) add it to the parm_table
39 * 3) add it to the list of available functions (eg: using FN_GLOBAL_STRING())
40 * 4) If it's a global then initialise it in init_globals. If a local
41 * (ie. service) parameter then initialise it in the sDefault structure
45 * The configuration file is processed sequentially for speed. It is NOT
46 * accessed randomly as happens in 'real' Windows. For this reason, there
47 * is a fair bit of sequence-dependent code here - ie., code which assumes
48 * that certain things happen before others. In particular, the code which
49 * happens at the boundary between sections is delicately poised, so be
57 #ifdef HAVE_SYS_SYSCTL_H
58 #include <sys/sysctl.h>
61 #ifdef HAVE_HTTPCONNECTENCRYPT
62 #include <cups/http.h>
67 extern enum protocol_types Protocol
;
68 extern userdom_struct current_user_info
;
71 #define GLOBAL_NAME "global"
75 #define PRINTERS_NAME "printers"
79 #define HOMES_NAME "homes"
82 /* the special value for the include parameter
83 * to be interpreted not as a file name but to
84 * trigger loading of the global smb.conf options
86 #ifndef INCLUDE_REGISTRY_NAME
87 #define INCLUDE_REGISTRY_NAME "registry"
90 static bool in_client
= False
; /* Not in the client by default */
91 static struct smbconf_csn conf_last_csn
;
93 #define CONFIG_BACKEND_FILE 0
94 #define CONFIG_BACKEND_REGISTRY 1
96 static int config_backend
= CONFIG_BACKEND_FILE
;
98 /* some helpful bits */
99 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
100 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
102 #define USERSHARE_VALID 1
103 #define USERSHARE_PENDING_DELETE 2
105 static bool defaults_saved
= False
;
107 struct param_opt_struct
{
108 struct param_opt_struct
*prev
, *next
;
115 * This structure describes global (ie., server-wide) parameters.
122 char *display_charset
;
123 char *szPrintcapname
;
124 char *szAddPortCommand
;
125 char *szEnumPortsCommand
;
126 char *szAddPrinterCommand
;
127 char *szDeletePrinterCommand
;
128 char *szOs2DriverMap
;
134 char *szDefaultService
;
138 char *szServerString
;
139 char *szAutoServices
;
140 char *szPasswdProgram
;
144 char *szSMBPasswdFile
;
146 char *szPassdbBackend
;
147 char **szPreloadModules
;
148 char *szPasswordServer
;
149 char *szSocketOptions
;
151 char *szAfsUsernameMap
;
152 int iAfsTokenLifetime
;
153 char *szLogNtTokenCommand
;
159 char **szWINSservers
;
161 char *szRemoteAnnounce
;
162 char *szRemoteBrowseSync
;
163 char *szSocketAddress
;
164 char *szNISHomeMapName
;
165 char *szAnnounceVersion
; /* This is initialised in init_globals */
168 char **szNetbiosAliases
;
169 char *szNetbiosScope
;
170 char *szNameResolveOrder
;
172 char *szAddUserScript
;
173 char *szRenameUserScript
;
174 char *szDelUserScript
;
175 char *szAddGroupScript
;
176 char *szDelGroupScript
;
177 char *szAddUserToGroupScript
;
178 char *szDelUserFromGroupScript
;
179 char *szSetPrimaryGroupScript
;
180 char *szAddMachineScript
;
181 char *szShutdownScript
;
182 char *szAbortShutdownScript
;
183 char *szUsernameMapScript
;
184 char *szCheckPasswordScript
;
191 bool bPassdbExpandExplicit
;
192 int AlgorithmicRidBase
;
193 char *szTemplateHomedir
;
194 char *szTemplateShell
;
195 char *szWinbindSeparator
;
196 bool bWinbindEnumUsers
;
197 bool bWinbindEnumGroups
;
198 bool bWinbindUseDefaultDomain
;
199 bool bWinbindTrustedDomainsOnly
;
200 bool bWinbindNestedGroups
;
201 int winbind_expand_groups
;
202 bool bWinbindRefreshTickets
;
203 bool bWinbindOfflineLogon
;
204 bool bWinbindNormalizeNames
;
205 bool bWinbindRpcOnly
;
206 bool bCreateKrb5Conf
;
207 char *szIdmapBackend
;
208 char *szIdmapAllocBackend
;
209 char *szAddShareCommand
;
210 char *szChangeShareCommand
;
211 char *szDeleteShareCommand
;
213 char *szGuestaccount
;
214 char *szManglingMethod
;
215 char **szServicesList
;
216 char *szUsersharePath
;
217 char *szUsershareTemplateShare
;
218 char **szUsersharePrefixAllowList
;
219 char **szUsersharePrefixDenyList
;
226 int open_files_db_hash_size
;
235 bool paranoid_server_security
;
238 int iMaxSmbdProcesses
;
239 bool bDisableSpoolss
;
242 bool enhanced_browsing
;
248 int announce_as
; /* This is initialised in init_globals */
249 int machine_password_timeout
;
251 int oplock_break_wait_time
;
252 int winbind_cache_time
;
253 int winbind_reconnect_delay
;
254 int winbind_max_idle_children
;
255 char **szWinbindNssInfo
;
257 char *szLdapMachineSuffix
;
258 char *szLdapUserSuffix
;
259 char *szLdapIdmapSuffix
;
260 char *szLdapGroupSuffix
;
265 int ldap_debug_level
;
266 int ldap_debug_threshold
;
270 char *szIPrintServer
;
272 char **szClusterAddresses
;
274 int ldap_passwd_sync
;
275 int ldap_replication_sleep
;
276 int ldap_timeout
; /* This is initialised in init_globals */
277 int ldap_connection_timeout
;
280 bool bMsAddPrinterWizard
;
285 int iPreferredMaster
;
288 char **szInitLogonDelayedHosts
;
290 bool bEncryptPasswords
;
295 bool bObeyPamRestrictions
;
297 int PrintcapCacheTime
;
298 bool bLargeReadwrite
;
305 bool bBindInterfacesOnly
;
306 bool bPamPasswordChange
;
307 bool bUnixPasswdSync
;
308 bool bPasswdChatDebug
;
309 int iPasswdChatTimeout
;
313 bool bNTStatusSupport
;
315 int iMaxStatCacheSize
;
317 bool bAllowTrustedDomains
;
321 bool bClientLanManAuth
;
322 bool bClientNTLMv2Auth
;
323 bool bClientPlaintextAuth
;
324 bool bClientUseSpnego
;
325 bool bDebugPrefixTimestamp
;
326 bool bDebugHiresTimestamp
;
330 bool bEnableCoreFiles
;
333 bool bHostnameLookups
;
334 bool bUnixExtensions
;
335 bool bDisableNetbios
;
336 char * szDedicatedKeytabFile
;
338 bool bDeferSharingViolations
;
339 bool bEnablePrivileges
;
341 bool bUsershareOwnerOnly
;
342 bool bUsershareAllowGuests
;
343 bool bRegistryShares
;
344 int restrict_anonymous
;
345 int name_cache_timeout
;
348 int client_ldap_sasl_wrapping
;
349 int iUsershareMaxShares
;
351 int iIdmapNegativeCacheTime
;
355 struct param_opt_struct
*param_opt
;
356 int cups_connection_timeout
;
357 char *szSMBPerfcountModule
;
358 bool bMapUntrustedToDomain
;
359 bool bFakeDirCreateTimes
;
362 static struct global Globals
;
365 * This structure describes a single service.
371 struct timespec usershare_last_mod
;
375 char **szInvalidUsers
;
383 char *szRootPostExec
;
385 char *szPrintcommand
;
388 char *szLppausecommand
;
389 char *szLpresumecommand
;
390 char *szQueuepausecommand
;
391 char *szQueueresumecommand
;
393 char *szPrintjobUsername
;
401 char *szVetoOplockFiles
;
407 char **printer_admin
;
412 char *szAioWriteBehind
;
416 int iMaxReportedPrintJobs
;
419 int iCreate_force_mode
;
421 int iSecurity_force_mode
;
424 int iDir_Security_mask
;
425 int iDir_Security_force_mode
;
429 int iOplockContentionLimit
;
434 bool bRootpreexecClose
;
437 bool bShortCasePreserve
;
439 bool bHideSpecialFiles
;
440 bool bHideUnReadable
;
441 bool bHideUnWriteableFiles
;
443 bool bAccessBasedShareEnum
;
448 bool bAdministrative_share
;
454 bool bStoreCreateTime
;
455 bool bStoreDosAttributes
;
468 bool bStrictAllocate
;
471 struct bitmap
*copymap
;
472 bool bDeleteReadonly
;
474 bool bDeleteVetoFiles
;
477 bool bDosFiletimeResolution
;
483 bool bUseClientDriver
;
484 bool bDefaultDevmode
;
485 bool bForcePrintername
;
487 bool bForceUnknownAclUser
;
490 bool bMap_acl_inherit
;
493 bool bAclCheckPermissions
;
494 bool bAclMapFullControl
;
495 bool bAclGroupControl
;
497 bool bKernelChangeNotify
;
498 int iallocation_roundup_size
;
502 int iDirectoryNameCacheSize
;
504 struct param_opt_struct
*param_opt
;
506 char dummy
[3]; /* for alignment */
510 /* This is a default service used to prime a services structure */
511 static struct service sDefault
= {
513 False
, /* not autoloaded */
514 0, /* not a usershare */
515 {0, }, /* No last mod time */
516 NULL
, /* szService */
518 NULL
, /* szUsername */
519 NULL
, /* szInvalidUsers */
520 NULL
, /* szValidUsers */
521 NULL
, /* szAdminUsers */
523 NULL
, /* szInclude */
524 NULL
, /* szPreExec */
525 NULL
, /* szPostExec */
526 NULL
, /* szRootPreExec */
527 NULL
, /* szRootPostExec */
528 NULL
, /* szCupsOptions */
529 NULL
, /* szPrintcommand */
530 NULL
, /* szLpqcommand */
531 NULL
, /* szLprmcommand */
532 NULL
, /* szLppausecommand */
533 NULL
, /* szLpresumecommand */
534 NULL
, /* szQueuepausecommand */
535 NULL
, /* szQueueresumecommand */
536 NULL
, /* szPrintername */
537 NULL
, /* szPrintjobUsername */
538 NULL
, /* szDontdescend */
539 NULL
, /* szHostsallow */
540 NULL
, /* szHostsdeny */
541 NULL
, /* szMagicScript */
542 NULL
, /* szMagicOutput */
543 NULL
, /* szVetoFiles */
544 NULL
, /* szHideFiles */
545 NULL
, /* szVetoOplockFiles */
547 NULL
, /* force user */
548 NULL
, /* force group */
550 NULL
, /* writelist */
551 NULL
, /* printer admin */
554 NULL
, /* vfs objects */
555 NULL
, /* szMSDfsProxy */
556 NULL
, /* szAioWriteBehind */
558 0, /* iMinPrintSpace */
559 1000, /* iMaxPrintJobs */
560 0, /* iMaxReportedPrintJobs */
561 0, /* iWriteCacheSize */
562 0744, /* iCreate_mask */
563 0000, /* iCreate_force_mode */
564 0777, /* iSecurity_mask */
565 0, /* iSecurity_force_mode */
566 0755, /* iDir_mask */
567 0000, /* iDir_force_mode */
568 0777, /* iDir_Security_mask */
569 0, /* iDir_Security_force_mode */
570 0, /* iMaxConnections */
571 CASE_LOWER
, /* iDefaultCase */
572 DEFAULT_PRINTING
, /* iPrinting */
573 2, /* iOplockContentionLimit */
575 1024, /* iBlock_size */
576 0, /* iDfreeCacheTime */
577 False
, /* bPreexecClose */
578 False
, /* bRootpreexecClose */
579 Auto
, /* case sensitive */
580 True
, /* case preserve */
581 True
, /* short case preserve */
582 True
, /* bHideDotFiles */
583 False
, /* bHideSpecialFiles */
584 False
, /* bHideUnReadable */
585 False
, /* bHideUnWriteableFiles */
586 True
, /* bBrowseable */
587 False
, /* bAccessBasedShareEnum */
588 True
, /* bAvailable */
589 True
, /* bRead_only */
590 True
, /* bNo_set_dir */
591 False
, /* bGuest_only */
592 False
, /* bAdministrative_share */
593 False
, /* bGuest_ok */
594 False
, /* bPrint_ok */
595 False
, /* bMap_system */
596 False
, /* bMap_hidden */
597 True
, /* bMap_archive */
598 False
, /* bStoreCreateTime */
599 False
, /* bStoreDosAttributes */
600 False
, /* bDmapiSupport */
602 Auto
, /* iStrictLocking */
603 True
, /* bPosixLocking */
604 True
, /* bShareModes */
606 True
, /* bLevel2OpLocks */
607 False
, /* bOnlyUser */
608 True
, /* bMangledNames */
609 True
, /* bWidelinks */
610 True
, /* bSymlinks */
611 False
, /* bSyncAlways */
612 False
, /* bStrictAllocate */
613 False
, /* bStrictSync */
614 '~', /* magic char */
616 False
, /* bDeleteReadonly */
617 False
, /* bFakeOplocks */
618 False
, /* bDeleteVetoFiles */
619 False
, /* bDosFilemode */
620 True
, /* bDosFiletimes */
621 False
, /* bDosFiletimeResolution */
622 True
, /* bBlockingLocks */
623 False
, /* bInheritPerms */
624 False
, /* bInheritACLS */
625 False
, /* bInheritOwner */
626 False
, /* bMSDfsRoot */
627 False
, /* bUseClientDriver */
628 True
, /* bDefaultDevmode */
629 False
, /* bForcePrintername */
630 True
, /* bNTAclSupport */
631 False
, /* bForceUnknownAclUser */
632 False
, /* bUseSendfile */
633 False
, /* bProfileAcls */
634 False
, /* bMap_acl_inherit */
635 False
, /* bAfs_Share */
636 False
, /* bEASupport */
637 True
, /* bAclCheckPermissions */
638 True
, /* bAclMapFullControl */
639 False
, /* bAclGroupControl */
640 True
, /* bChangeNotify */
641 True
, /* bKernelChangeNotify */
642 SMB_ROUNDUP_ALLOCATION_SIZE
, /* iallocation_roundup_size */
643 0, /* iAioReadSize */
644 0, /* iAioWriteSize */
645 MAP_READONLY_YES
, /* iMap_readonly */
646 #ifdef BROKEN_DIRECTORY_HANDLING
647 0, /* iDirectoryNameCacheSize */
649 100, /* iDirectoryNameCacheSize */
651 Auto
, /* ismb_encrypt */
652 NULL
, /* Parametric options */
657 /* local variables */
658 static struct service
**ServicePtrs
= NULL
;
659 static int iNumServices
= 0;
660 static int iServiceIndex
= 0;
661 static struct db_context
*ServiceHash
;
662 static int *invalid_services
= NULL
;
663 static int num_invalid_services
= 0;
664 static bool bInGlobalSection
= True
;
665 static bool bGlobalOnly
= False
;
666 static int server_role
;
667 static int default_server_announce
;
669 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
671 /* prototypes for the special type handlers */
672 static bool handle_include( int snum
, const char *pszParmValue
, char **ptr
);
673 static bool handle_copy( int snum
, const char *pszParmValue
, char **ptr
);
674 static bool handle_netbios_name( int snum
, const char *pszParmValue
, char **ptr
);
675 static bool handle_idmap_uid( int snum
, const char *pszParmValue
, char **ptr
);
676 static bool handle_idmap_gid( int snum
, const char *pszParmValue
, char **ptr
);
677 static bool handle_debug_list( int snum
, const char *pszParmValue
, char **ptr
);
678 static bool handle_workgroup( int snum
, const char *pszParmValue
, char **ptr
);
679 static bool handle_netbios_aliases( int snum
, const char *pszParmValue
, char **ptr
);
680 static bool handle_netbios_scope( int snum
, const char *pszParmValue
, char **ptr
);
681 static bool handle_charset( int snum
, const char *pszParmValue
, char **ptr
);
682 static bool handle_printing( int snum
, const char *pszParmValue
, char **ptr
);
683 static bool handle_ldap_debug_level( int snum
, const char *pszParmValue
, char **ptr
);
685 static void set_server_role(void);
686 static void set_default_server_announce_type(void);
687 static void set_allowed_client_auth(void);
689 static void *lp_local_ptr(struct service
*service
, void *ptr
);
691 static void add_to_file_list(const char *fname
, const char *subfname
);
693 static const struct enum_list enum_protocol
[] = {
694 {PROTOCOL_SMB2
, "SMB2"},
695 {PROTOCOL_NT1
, "NT1"},
696 {PROTOCOL_LANMAN2
, "LANMAN2"},
697 {PROTOCOL_LANMAN1
, "LANMAN1"},
698 {PROTOCOL_CORE
, "CORE"},
699 {PROTOCOL_COREPLUS
, "COREPLUS"},
700 {PROTOCOL_COREPLUS
, "CORE+"},
704 static const struct enum_list enum_security
[] = {
705 {SEC_SHARE
, "SHARE"},
707 {SEC_SERVER
, "SERVER"},
708 {SEC_DOMAIN
, "DOMAIN"},
715 static const struct enum_list enum_printing
[] = {
716 {PRINT_SYSV
, "sysv"},
718 {PRINT_HPUX
, "hpux"},
722 {PRINT_LPRNG
, "lprng"},
723 {PRINT_CUPS
, "cups"},
724 {PRINT_IPRINT
, "iprint"},
726 {PRINT_LPROS2
, "os2"},
728 {PRINT_TEST
, "test"},
730 #endif /* DEVELOPER */
734 static const struct enum_list enum_ldap_sasl_wrapping
[] = {
736 {ADS_AUTH_SASL_SIGN
, "sign"},
737 {ADS_AUTH_SASL_SEAL
, "seal"},
741 static const struct enum_list enum_ldap_ssl
[] = {
742 {LDAP_SSL_OFF
, "no"},
743 {LDAP_SSL_OFF
, "off"},
744 {LDAP_SSL_START_TLS
, "start tls"},
745 {LDAP_SSL_START_TLS
, "start_tls"},
749 static const struct enum_list enum_ldap_passwd_sync
[] = {
750 {LDAP_PASSWD_SYNC_OFF
, "no"},
751 {LDAP_PASSWD_SYNC_OFF
, "off"},
752 {LDAP_PASSWD_SYNC_ON
, "yes"},
753 {LDAP_PASSWD_SYNC_ON
, "on"},
754 {LDAP_PASSWD_SYNC_ONLY
, "only"},
758 /* Types of machine we can announce as. */
759 #define ANNOUNCE_AS_NT_SERVER 1
760 #define ANNOUNCE_AS_WIN95 2
761 #define ANNOUNCE_AS_WFW 3
762 #define ANNOUNCE_AS_NT_WORKSTATION 4
764 static const struct enum_list enum_announce_as
[] = {
765 {ANNOUNCE_AS_NT_SERVER
, "NT"},
766 {ANNOUNCE_AS_NT_SERVER
, "NT Server"},
767 {ANNOUNCE_AS_NT_WORKSTATION
, "NT Workstation"},
768 {ANNOUNCE_AS_WIN95
, "win95"},
769 {ANNOUNCE_AS_WFW
, "WfW"},
773 static const struct enum_list enum_map_readonly
[] = {
774 {MAP_READONLY_NO
, "no"},
775 {MAP_READONLY_NO
, "false"},
776 {MAP_READONLY_NO
, "0"},
777 {MAP_READONLY_YES
, "yes"},
778 {MAP_READONLY_YES
, "true"},
779 {MAP_READONLY_YES
, "1"},
780 {MAP_READONLY_PERMISSIONS
, "permissions"},
781 {MAP_READONLY_PERMISSIONS
, "perms"},
785 static const struct enum_list enum_case
[] = {
786 {CASE_LOWER
, "lower"},
787 {CASE_UPPER
, "upper"},
793 static const struct enum_list enum_bool_auto
[] = {
804 /* Client-side offline caching policy types */
805 #define CSC_POLICY_MANUAL 0
806 #define CSC_POLICY_DOCUMENTS 1
807 #define CSC_POLICY_PROGRAMS 2
808 #define CSC_POLICY_DISABLE 3
810 static const struct enum_list enum_csc_policy
[] = {
811 {CSC_POLICY_MANUAL
, "manual"},
812 {CSC_POLICY_DOCUMENTS
, "documents"},
813 {CSC_POLICY_PROGRAMS
, "programs"},
814 {CSC_POLICY_DISABLE
, "disable"},
818 /* SMB signing types. */
819 static const struct enum_list enum_smb_signing_vals
[] = {
831 {Required
, "required"},
832 {Required
, "mandatory"},
834 {Required
, "forced"},
835 {Required
, "enforced"},
839 /* ACL compatibility options. */
840 static const struct enum_list enum_acl_compat_vals
[] = {
841 { ACL_COMPAT_AUTO
, "auto" },
842 { ACL_COMPAT_WINNT
, "winnt" },
843 { ACL_COMPAT_WIN2K
, "win2k" },
848 Do you want session setups at user level security with a invalid
849 password to be rejected or allowed in as guest? WinNT rejects them
850 but it can be a pain as it means "net view" needs to use a password
852 You have 3 choices in the setting of map_to_guest:
854 "Never" means session setups with an invalid password
855 are rejected. This is the default.
857 "Bad User" means session setups with an invalid password
858 are rejected, unless the username does not exist, in which case it
859 is treated as a guest login
861 "Bad Password" means session setups with an invalid password
862 are treated as a guest login
864 Note that map_to_guest only has an effect in user or server
868 static const struct enum_list enum_map_to_guest
[] = {
869 {NEVER_MAP_TO_GUEST
, "Never"},
870 {MAP_TO_GUEST_ON_BAD_USER
, "Bad User"},
871 {MAP_TO_GUEST_ON_BAD_PASSWORD
, "Bad Password"},
872 {MAP_TO_GUEST_ON_BAD_UID
, "Bad Uid"},
876 /* Config backend options */
878 static const struct enum_list enum_config_backend
[] = {
879 {CONFIG_BACKEND_FILE
, "file"},
880 {CONFIG_BACKEND_REGISTRY
, "registry"},
884 /* ADS kerberos ticket verification options */
886 static const struct enum_list enum_kerberos_method
[] = {
887 {KERBEROS_VERIFY_SECRETS
, "default"},
888 {KERBEROS_VERIFY_SECRETS
, "secrets only"},
889 {KERBEROS_VERIFY_SYSTEM_KEYTAB
, "system keytab"},
890 {KERBEROS_VERIFY_DEDICATED_KEYTAB
, "dedicated keytab"},
891 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB
, "secrets and keytab"},
895 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
897 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
898 * screen in SWAT. This is used to exclude parameters as well as to squash all
899 * parameters that have been duplicated by pseudonyms.
901 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
902 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
903 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
906 * NOTE2: Handling of duplicated (synonym) parameters:
907 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
908 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
909 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
910 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
913 static struct parm_struct parm_table
[] = {
914 {N_("Base Options"), P_SEP
, P_SEPARATOR
},
917 .label
= "dos charset",
920 .ptr
= &Globals
.dos_charset
,
921 .special
= handle_charset
,
923 .flags
= FLAG_ADVANCED
926 .label
= "unix charset",
929 .ptr
= &Globals
.unix_charset
,
930 .special
= handle_charset
,
932 .flags
= FLAG_ADVANCED
935 .label
= "display charset",
938 .ptr
= &Globals
.display_charset
,
939 .special
= handle_charset
,
941 .flags
= FLAG_ADVANCED
947 .ptr
= &sDefault
.comment
,
950 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
956 .ptr
= &sDefault
.szPath
,
959 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
962 .label
= "directory",
965 .ptr
= &sDefault
.szPath
,
971 .label
= "workgroup",
974 .ptr
= &Globals
.szWorkgroup
,
975 .special
= handle_workgroup
,
977 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
984 .ptr
= &Globals
.szRealm
,
987 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
991 .label
= "netbios name",
994 .ptr
= &Globals
.szNetbiosName
,
995 .special
= handle_netbios_name
,
997 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1000 .label
= "netbios aliases",
1002 .p_class
= P_GLOBAL
,
1003 .ptr
= &Globals
.szNetbiosAliases
,
1004 .special
= handle_netbios_aliases
,
1006 .flags
= FLAG_ADVANCED
,
1009 .label
= "netbios scope",
1011 .p_class
= P_GLOBAL
,
1012 .ptr
= &Globals
.szNetbiosScope
,
1013 .special
= handle_netbios_scope
,
1015 .flags
= FLAG_ADVANCED
,
1018 .label
= "server string",
1020 .p_class
= P_GLOBAL
,
1021 .ptr
= &Globals
.szServerString
,
1024 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1027 .label
= "interfaces",
1029 .p_class
= P_GLOBAL
,
1030 .ptr
= &Globals
.szInterfaces
,
1033 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1036 .label
= "bind interfaces only",
1038 .p_class
= P_GLOBAL
,
1039 .ptr
= &Globals
.bBindInterfacesOnly
,
1042 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1045 .label
= "config backend",
1047 .p_class
= P_GLOBAL
,
1048 .ptr
= &Globals
.ConfigBackend
,
1050 .enum_list
= enum_config_backend
,
1051 .flags
= FLAG_HIDE
|FLAG_ADVANCED
|FLAG_META
,
1054 {N_("Security Options"), P_SEP
, P_SEPARATOR
},
1057 .label
= "security",
1059 .p_class
= P_GLOBAL
,
1060 .ptr
= &Globals
.security
,
1062 .enum_list
= enum_security
,
1063 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1066 .label
= "auth methods",
1068 .p_class
= P_GLOBAL
,
1069 .ptr
= &Globals
.AuthMethods
,
1072 .flags
= FLAG_ADVANCED
,
1075 .label
= "encrypt passwords",
1077 .p_class
= P_GLOBAL
,
1078 .ptr
= &Globals
.bEncryptPasswords
,
1081 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1084 .label
= "update encrypted",
1086 .p_class
= P_GLOBAL
,
1087 .ptr
= &Globals
.bUpdateEncrypt
,
1090 .flags
= FLAG_ADVANCED
,
1093 .label
= "client schannel",
1095 .p_class
= P_GLOBAL
,
1096 .ptr
= &Globals
.clientSchannel
,
1098 .enum_list
= enum_bool_auto
,
1099 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1102 .label
= "server schannel",
1104 .p_class
= P_GLOBAL
,
1105 .ptr
= &Globals
.serverSchannel
,
1107 .enum_list
= enum_bool_auto
,
1108 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1111 .label
= "allow trusted domains",
1113 .p_class
= P_GLOBAL
,
1114 .ptr
= &Globals
.bAllowTrustedDomains
,
1117 .flags
= FLAG_ADVANCED
,
1120 .label
= "map to guest",
1122 .p_class
= P_GLOBAL
,
1123 .ptr
= &Globals
.map_to_guest
,
1125 .enum_list
= enum_map_to_guest
,
1126 .flags
= FLAG_ADVANCED
,
1129 .label
= "null passwords",
1131 .p_class
= P_GLOBAL
,
1132 .ptr
= &Globals
.bNullPasswords
,
1135 .flags
= FLAG_ADVANCED
,
1138 .label
= "obey pam restrictions",
1140 .p_class
= P_GLOBAL
,
1141 .ptr
= &Globals
.bObeyPamRestrictions
,
1144 .flags
= FLAG_ADVANCED
,
1147 .label
= "password server",
1149 .p_class
= P_GLOBAL
,
1150 .ptr
= &Globals
.szPasswordServer
,
1153 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1156 .label
= "smb passwd file",
1158 .p_class
= P_GLOBAL
,
1159 .ptr
= &Globals
.szSMBPasswdFile
,
1162 .flags
= FLAG_ADVANCED
,
1165 .label
= "private dir",
1167 .p_class
= P_GLOBAL
,
1168 .ptr
= &Globals
.szPrivateDir
,
1171 .flags
= FLAG_ADVANCED
,
1174 .label
= "passdb backend",
1176 .p_class
= P_GLOBAL
,
1177 .ptr
= &Globals
.szPassdbBackend
,
1180 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1183 .label
= "algorithmic rid base",
1185 .p_class
= P_GLOBAL
,
1186 .ptr
= &Globals
.AlgorithmicRidBase
,
1189 .flags
= FLAG_ADVANCED
,
1192 .label
= "root directory",
1194 .p_class
= P_GLOBAL
,
1195 .ptr
= &Globals
.szRootdir
,
1198 .flags
= FLAG_ADVANCED
,
1201 .label
= "root dir",
1203 .p_class
= P_GLOBAL
,
1204 .ptr
= &Globals
.szRootdir
,
1212 .p_class
= P_GLOBAL
,
1213 .ptr
= &Globals
.szRootdir
,
1219 .label
= "guest account",
1221 .p_class
= P_GLOBAL
,
1222 .ptr
= &Globals
.szGuestaccount
,
1225 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1228 .label
= "enable privileges",
1230 .p_class
= P_GLOBAL
,
1231 .ptr
= &Globals
.bEnablePrivileges
,
1234 .flags
= FLAG_ADVANCED
,
1238 .label
= "pam password change",
1240 .p_class
= P_GLOBAL
,
1241 .ptr
= &Globals
.bPamPasswordChange
,
1244 .flags
= FLAG_ADVANCED
,
1247 .label
= "passwd program",
1249 .p_class
= P_GLOBAL
,
1250 .ptr
= &Globals
.szPasswdProgram
,
1253 .flags
= FLAG_ADVANCED
,
1256 .label
= "passwd chat",
1258 .p_class
= P_GLOBAL
,
1259 .ptr
= &Globals
.szPasswdChat
,
1262 .flags
= FLAG_ADVANCED
,
1265 .label
= "passwd chat debug",
1267 .p_class
= P_GLOBAL
,
1268 .ptr
= &Globals
.bPasswdChatDebug
,
1271 .flags
= FLAG_ADVANCED
,
1274 .label
= "passwd chat timeout",
1276 .p_class
= P_GLOBAL
,
1277 .ptr
= &Globals
.iPasswdChatTimeout
,
1280 .flags
= FLAG_ADVANCED
,
1283 .label
= "check password script",
1285 .p_class
= P_GLOBAL
,
1286 .ptr
= &Globals
.szCheckPasswordScript
,
1289 .flags
= FLAG_ADVANCED
,
1292 .label
= "username map",
1294 .p_class
= P_GLOBAL
,
1295 .ptr
= &Globals
.szUsernameMap
,
1298 .flags
= FLAG_ADVANCED
,
1301 .label
= "password level",
1303 .p_class
= P_GLOBAL
,
1304 .ptr
= &Globals
.pwordlevel
,
1307 .flags
= FLAG_ADVANCED
,
1310 .label
= "username level",
1312 .p_class
= P_GLOBAL
,
1313 .ptr
= &Globals
.unamelevel
,
1316 .flags
= FLAG_ADVANCED
,
1319 .label
= "unix password sync",
1321 .p_class
= P_GLOBAL
,
1322 .ptr
= &Globals
.bUnixPasswdSync
,
1325 .flags
= FLAG_ADVANCED
,
1328 .label
= "restrict anonymous",
1330 .p_class
= P_GLOBAL
,
1331 .ptr
= &Globals
.restrict_anonymous
,
1334 .flags
= FLAG_ADVANCED
,
1337 .label
= "lanman auth",
1339 .p_class
= P_GLOBAL
,
1340 .ptr
= &Globals
.bLanmanAuth
,
1343 .flags
= FLAG_ADVANCED
,
1346 .label
= "ntlm auth",
1348 .p_class
= P_GLOBAL
,
1349 .ptr
= &Globals
.bNTLMAuth
,
1352 .flags
= FLAG_ADVANCED
,
1355 .label
= "client NTLMv2 auth",
1357 .p_class
= P_GLOBAL
,
1358 .ptr
= &Globals
.bClientNTLMv2Auth
,
1361 .flags
= FLAG_ADVANCED
,
1364 .label
= "client lanman auth",
1366 .p_class
= P_GLOBAL
,
1367 .ptr
= &Globals
.bClientLanManAuth
,
1370 .flags
= FLAG_ADVANCED
,
1373 .label
= "client plaintext auth",
1375 .p_class
= P_GLOBAL
,
1376 .ptr
= &Globals
.bClientPlaintextAuth
,
1379 .flags
= FLAG_ADVANCED
,
1382 .label
= "username",
1385 .ptr
= &sDefault
.szUsername
,
1388 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1394 .ptr
= &sDefault
.szUsername
,
1403 .ptr
= &sDefault
.szUsername
,
1409 .label
= "invalid users",
1412 .ptr
= &sDefault
.szInvalidUsers
,
1415 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1418 .label
= "valid users",
1421 .ptr
= &sDefault
.szValidUsers
,
1424 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1427 .label
= "admin users",
1430 .ptr
= &sDefault
.szAdminUsers
,
1433 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1436 .label
= "read list",
1439 .ptr
= &sDefault
.readlist
,
1442 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1445 .label
= "write list",
1448 .ptr
= &sDefault
.writelist
,
1451 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1454 .label
= "printer admin",
1457 .ptr
= &sDefault
.printer_admin
,
1460 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_PRINT
| FLAG_DEPRECATED
,
1463 .label
= "force user",
1466 .ptr
= &sDefault
.force_user
,
1469 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1472 .label
= "force group",
1475 .ptr
= &sDefault
.force_group
,
1478 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1484 .ptr
= &sDefault
.force_group
,
1487 .flags
= FLAG_ADVANCED
,
1490 .label
= "read only",
1493 .ptr
= &sDefault
.bRead_only
,
1496 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
,
1499 .label
= "write ok",
1502 .ptr
= &sDefault
.bRead_only
,
1508 .label
= "writeable",
1511 .ptr
= &sDefault
.bRead_only
,
1517 .label
= "writable",
1520 .ptr
= &sDefault
.bRead_only
,
1526 .label
= "acl check permissions",
1529 .ptr
= &sDefault
.bAclCheckPermissions
,
1532 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1535 .label
= "acl group control",
1538 .ptr
= &sDefault
.bAclGroupControl
,
1541 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1544 .label
= "acl map full control",
1547 .ptr
= &sDefault
.bAclMapFullControl
,
1550 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1553 .label
= "create mask",
1556 .ptr
= &sDefault
.iCreate_mask
,
1559 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1562 .label
= "create mode",
1565 .ptr
= &sDefault
.iCreate_mask
,
1571 .label
= "force create mode",
1574 .ptr
= &sDefault
.iCreate_force_mode
,
1577 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1580 .label
= "security mask",
1583 .ptr
= &sDefault
.iSecurity_mask
,
1586 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1589 .label
= "force security mode",
1592 .ptr
= &sDefault
.iSecurity_force_mode
,
1595 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1598 .label
= "directory mask",
1601 .ptr
= &sDefault
.iDir_mask
,
1604 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1607 .label
= "directory mode",
1610 .ptr
= &sDefault
.iDir_mask
,
1613 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1616 .label
= "force directory mode",
1619 .ptr
= &sDefault
.iDir_force_mode
,
1622 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1625 .label
= "directory security mask",
1628 .ptr
= &sDefault
.iDir_Security_mask
,
1631 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1634 .label
= "force directory security mode",
1637 .ptr
= &sDefault
.iDir_Security_force_mode
,
1640 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1643 .label
= "force unknown acl user",
1646 .ptr
= &sDefault
.bForceUnknownAclUser
,
1649 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1652 .label
= "inherit permissions",
1655 .ptr
= &sDefault
.bInheritPerms
,
1658 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1661 .label
= "inherit acls",
1664 .ptr
= &sDefault
.bInheritACLS
,
1667 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1670 .label
= "inherit owner",
1673 .ptr
= &sDefault
.bInheritOwner
,
1676 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1679 .label
= "guest only",
1682 .ptr
= &sDefault
.bGuest_only
,
1685 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1688 .label
= "only guest",
1691 .ptr
= &sDefault
.bGuest_only
,
1697 .label
= "administrative share",
1700 .ptr
= &sDefault
.bAdministrative_share
,
1703 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1707 .label
= "guest ok",
1710 .ptr
= &sDefault
.bGuest_ok
,
1713 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1719 .ptr
= &sDefault
.bGuest_ok
,
1725 .label
= "only user",
1728 .ptr
= &sDefault
.bOnlyUser
,
1731 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_DEPRECATED
,
1734 .label
= "hosts allow",
1737 .ptr
= &sDefault
.szHostsallow
,
1740 .flags
= FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1743 .label
= "allow hosts",
1746 .ptr
= &sDefault
.szHostsallow
,
1752 .label
= "hosts deny",
1755 .ptr
= &sDefault
.szHostsdeny
,
1758 .flags
= FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1761 .label
= "deny hosts",
1764 .ptr
= &sDefault
.szHostsdeny
,
1770 .label
= "preload modules",
1772 .p_class
= P_GLOBAL
,
1773 .ptr
= &Globals
.szPreloadModules
,
1776 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1779 .label
= "dedicated keytab file",
1781 .p_class
= P_GLOBAL
,
1782 .ptr
= &Globals
.szDedicatedKeytabFile
,
1785 .flags
= FLAG_ADVANCED
,
1788 .label
= "kerberos method",
1790 .p_class
= P_GLOBAL
,
1791 .ptr
= &Globals
.iKerberosMethod
,
1793 .enum_list
= enum_kerberos_method
,
1794 .flags
= FLAG_ADVANCED
,
1797 .label
= "map untrusted to domain",
1799 .p_class
= P_GLOBAL
,
1800 .ptr
= &Globals
.bMapUntrustedToDomain
,
1803 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1807 {N_("Logging Options"), P_SEP
, P_SEPARATOR
},
1810 .label
= "log level",
1812 .p_class
= P_GLOBAL
,
1813 .ptr
= &Globals
.szLogLevel
,
1814 .special
= handle_debug_list
,
1816 .flags
= FLAG_ADVANCED
,
1819 .label
= "debuglevel",
1821 .p_class
= P_GLOBAL
,
1822 .ptr
= &Globals
.szLogLevel
,
1823 .special
= handle_debug_list
,
1830 .p_class
= P_GLOBAL
,
1831 .ptr
= &Globals
.syslog
,
1834 .flags
= FLAG_ADVANCED
,
1837 .label
= "syslog only",
1839 .p_class
= P_GLOBAL
,
1840 .ptr
= &Globals
.bSyslogOnly
,
1843 .flags
= FLAG_ADVANCED
,
1846 .label
= "log file",
1848 .p_class
= P_GLOBAL
,
1849 .ptr
= &Globals
.szLogFile
,
1852 .flags
= FLAG_ADVANCED
,
1855 .label
= "max log size",
1857 .p_class
= P_GLOBAL
,
1858 .ptr
= &Globals
.max_log_size
,
1861 .flags
= FLAG_ADVANCED
,
1864 .label
= "debug timestamp",
1866 .p_class
= P_GLOBAL
,
1867 .ptr
= &Globals
.bTimestampLogs
,
1870 .flags
= FLAG_ADVANCED
,
1873 .label
= "timestamp logs",
1875 .p_class
= P_GLOBAL
,
1876 .ptr
= &Globals
.bTimestampLogs
,
1879 .flags
= FLAG_ADVANCED
,
1882 .label
= "debug prefix timestamp",
1884 .p_class
= P_GLOBAL
,
1885 .ptr
= &Globals
.bDebugPrefixTimestamp
,
1888 .flags
= FLAG_ADVANCED
,
1891 .label
= "debug hires timestamp",
1893 .p_class
= P_GLOBAL
,
1894 .ptr
= &Globals
.bDebugHiresTimestamp
,
1897 .flags
= FLAG_ADVANCED
,
1900 .label
= "debug pid",
1902 .p_class
= P_GLOBAL
,
1903 .ptr
= &Globals
.bDebugPid
,
1906 .flags
= FLAG_ADVANCED
,
1909 .label
= "debug uid",
1911 .p_class
= P_GLOBAL
,
1912 .ptr
= &Globals
.bDebugUid
,
1915 .flags
= FLAG_ADVANCED
,
1918 .label
= "debug class",
1920 .p_class
= P_GLOBAL
,
1921 .ptr
= &Globals
.bDebugClass
,
1924 .flags
= FLAG_ADVANCED
,
1927 .label
= "enable core files",
1929 .p_class
= P_GLOBAL
,
1930 .ptr
= &Globals
.bEnableCoreFiles
,
1933 .flags
= FLAG_ADVANCED
,
1936 {N_("Protocol Options"), P_SEP
, P_SEPARATOR
},
1939 .label
= "allocation roundup size",
1942 .ptr
= &sDefault
.iallocation_roundup_size
,
1945 .flags
= FLAG_ADVANCED
,
1948 .label
= "aio read size",
1951 .ptr
= &sDefault
.iAioReadSize
,
1954 .flags
= FLAG_ADVANCED
,
1957 .label
= "aio write size",
1960 .ptr
= &sDefault
.iAioWriteSize
,
1963 .flags
= FLAG_ADVANCED
,
1966 .label
= "aio write behind",
1969 .ptr
= &sDefault
.szAioWriteBehind
,
1972 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
1975 .label
= "smb ports",
1977 .p_class
= P_GLOBAL
,
1978 .ptr
= &Globals
.smb_ports
,
1981 .flags
= FLAG_ADVANCED
,
1984 .label
= "large readwrite",
1986 .p_class
= P_GLOBAL
,
1987 .ptr
= &Globals
.bLargeReadwrite
,
1990 .flags
= FLAG_ADVANCED
,
1993 .label
= "max protocol",
1995 .p_class
= P_GLOBAL
,
1996 .ptr
= &Globals
.maxprotocol
,
1998 .enum_list
= enum_protocol
,
1999 .flags
= FLAG_ADVANCED
,
2002 .label
= "protocol",
2004 .p_class
= P_GLOBAL
,
2005 .ptr
= &Globals
.maxprotocol
,
2007 .enum_list
= enum_protocol
,
2008 .flags
= FLAG_ADVANCED
,
2011 .label
= "min protocol",
2013 .p_class
= P_GLOBAL
,
2014 .ptr
= &Globals
.minprotocol
,
2016 .enum_list
= enum_protocol
,
2017 .flags
= FLAG_ADVANCED
,
2020 .label
= "min receivefile size",
2022 .p_class
= P_GLOBAL
,
2023 .ptr
= &Globals
.iminreceivefile
,
2026 .flags
= FLAG_ADVANCED
,
2029 .label
= "read raw",
2031 .p_class
= P_GLOBAL
,
2032 .ptr
= &Globals
.bReadRaw
,
2035 .flags
= FLAG_ADVANCED
,
2038 .label
= "write raw",
2040 .p_class
= P_GLOBAL
,
2041 .ptr
= &Globals
.bWriteRaw
,
2044 .flags
= FLAG_ADVANCED
,
2047 .label
= "disable netbios",
2049 .p_class
= P_GLOBAL
,
2050 .ptr
= &Globals
.bDisableNetbios
,
2053 .flags
= FLAG_ADVANCED
,
2056 .label
= "reset on zero vc",
2058 .p_class
= P_GLOBAL
,
2059 .ptr
= &Globals
.bResetOnZeroVC
,
2062 .flags
= FLAG_ADVANCED
,
2065 .label
= "acl compatibility",
2067 .p_class
= P_GLOBAL
,
2068 .ptr
= &Globals
.iAclCompat
,
2070 .enum_list
= enum_acl_compat_vals
,
2071 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2074 .label
= "defer sharing violations",
2076 .p_class
= P_GLOBAL
,
2077 .ptr
= &Globals
.bDeferSharingViolations
,
2080 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2083 .label
= "ea support",
2086 .ptr
= &sDefault
.bEASupport
,
2089 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2092 .label
= "nt acl support",
2095 .ptr
= &sDefault
.bNTAclSupport
,
2098 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2101 .label
= "nt pipe support",
2103 .p_class
= P_GLOBAL
,
2104 .ptr
= &Globals
.bNTPipeSupport
,
2107 .flags
= FLAG_ADVANCED
,
2110 .label
= "nt status support",
2112 .p_class
= P_GLOBAL
,
2113 .ptr
= &Globals
.bNTStatusSupport
,
2116 .flags
= FLAG_ADVANCED
,
2119 .label
= "profile acls",
2122 .ptr
= &sDefault
.bProfileAcls
,
2125 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
2128 .label
= "announce version",
2130 .p_class
= P_GLOBAL
,
2131 .ptr
= &Globals
.szAnnounceVersion
,
2134 .flags
= FLAG_ADVANCED
,
2137 .label
= "announce as",
2139 .p_class
= P_GLOBAL
,
2140 .ptr
= &Globals
.announce_as
,
2142 .enum_list
= enum_announce_as
,
2143 .flags
= FLAG_ADVANCED
,
2146 .label
= "map acl inherit",
2149 .ptr
= &sDefault
.bMap_acl_inherit
,
2152 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2155 .label
= "afs share",
2158 .ptr
= &sDefault
.bAfs_Share
,
2161 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2166 .p_class
= P_GLOBAL
,
2167 .ptr
= &Globals
.max_mux
,
2170 .flags
= FLAG_ADVANCED
,
2173 .label
= "max xmit",
2175 .p_class
= P_GLOBAL
,
2176 .ptr
= &Globals
.max_xmit
,
2179 .flags
= FLAG_ADVANCED
,
2182 .label
= "name resolve order",
2184 .p_class
= P_GLOBAL
,
2185 .ptr
= &Globals
.szNameResolveOrder
,
2188 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
2193 .p_class
= P_GLOBAL
,
2194 .ptr
= &Globals
.max_ttl
,
2197 .flags
= FLAG_ADVANCED
,
2200 .label
= "max wins ttl",
2202 .p_class
= P_GLOBAL
,
2203 .ptr
= &Globals
.max_wins_ttl
,
2206 .flags
= FLAG_ADVANCED
,
2209 .label
= "min wins ttl",
2211 .p_class
= P_GLOBAL
,
2212 .ptr
= &Globals
.min_wins_ttl
,
2215 .flags
= FLAG_ADVANCED
,
2218 .label
= "time server",
2220 .p_class
= P_GLOBAL
,
2221 .ptr
= &Globals
.bTimeServer
,
2224 .flags
= FLAG_ADVANCED
,
2227 .label
= "unix extensions",
2229 .p_class
= P_GLOBAL
,
2230 .ptr
= &Globals
.bUnixExtensions
,
2233 .flags
= FLAG_ADVANCED
,
2236 .label
= "use spnego",
2238 .p_class
= P_GLOBAL
,
2239 .ptr
= &Globals
.bUseSpnego
,
2242 .flags
= FLAG_ADVANCED
,
2245 .label
= "client signing",
2247 .p_class
= P_GLOBAL
,
2248 .ptr
= &Globals
.client_signing
,
2250 .enum_list
= enum_smb_signing_vals
,
2251 .flags
= FLAG_ADVANCED
,
2254 .label
= "server signing",
2256 .p_class
= P_GLOBAL
,
2257 .ptr
= &Globals
.server_signing
,
2259 .enum_list
= enum_smb_signing_vals
,
2260 .flags
= FLAG_ADVANCED
,
2263 .label
= "smb encrypt",
2266 .ptr
= &sDefault
.ismb_encrypt
,
2268 .enum_list
= enum_smb_signing_vals
,
2269 .flags
= FLAG_ADVANCED
,
2272 .label
= "client use spnego",
2274 .p_class
= P_GLOBAL
,
2275 .ptr
= &Globals
.bClientUseSpnego
,
2278 .flags
= FLAG_ADVANCED
,
2281 .label
= "client ldap sasl wrapping",
2283 .p_class
= P_GLOBAL
,
2284 .ptr
= &Globals
.client_ldap_sasl_wrapping
,
2286 .enum_list
= enum_ldap_sasl_wrapping
,
2287 .flags
= FLAG_ADVANCED
,
2290 .label
= "enable asu support",
2292 .p_class
= P_GLOBAL
,
2293 .ptr
= &Globals
.bASUSupport
,
2296 .flags
= FLAG_ADVANCED
,
2299 .label
= "svcctl list",
2301 .p_class
= P_GLOBAL
,
2302 .ptr
= &Globals
.szServicesList
,
2305 .flags
= FLAG_ADVANCED
,
2308 {N_("Tuning Options"), P_SEP
, P_SEPARATOR
},
2311 .label
= "block size",
2314 .ptr
= &sDefault
.iBlock_size
,
2317 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2320 .label
= "deadtime",
2322 .p_class
= P_GLOBAL
,
2323 .ptr
= &Globals
.deadtime
,
2326 .flags
= FLAG_ADVANCED
,
2329 .label
= "getwd cache",
2331 .p_class
= P_GLOBAL
,
2332 .ptr
= &Globals
.getwd_cache
,
2335 .flags
= FLAG_ADVANCED
,
2338 .label
= "keepalive",
2340 .p_class
= P_GLOBAL
,
2341 .ptr
= &Globals
.iKeepalive
,
2344 .flags
= FLAG_ADVANCED
,
2347 .label
= "change notify",
2350 .ptr
= &sDefault
.bChangeNotify
,
2353 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2356 .label
= "directory name cache size",
2359 .ptr
= &sDefault
.iDirectoryNameCacheSize
,
2362 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2365 .label
= "kernel change notify",
2368 .ptr
= &sDefault
.bKernelChangeNotify
,
2371 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2374 .label
= "lpq cache time",
2376 .p_class
= P_GLOBAL
,
2377 .ptr
= &Globals
.lpqcachetime
,
2380 .flags
= FLAG_ADVANCED
,
2383 .label
= "max smbd processes",
2385 .p_class
= P_GLOBAL
,
2386 .ptr
= &Globals
.iMaxSmbdProcesses
,
2389 .flags
= FLAG_ADVANCED
,
2392 .label
= "max connections",
2395 .ptr
= &sDefault
.iMaxConnections
,
2398 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2401 .label
= "paranoid server security",
2403 .p_class
= P_GLOBAL
,
2404 .ptr
= &Globals
.paranoid_server_security
,
2407 .flags
= FLAG_ADVANCED
,
2410 .label
= "max disk size",
2412 .p_class
= P_GLOBAL
,
2413 .ptr
= &Globals
.maxdisksize
,
2416 .flags
= FLAG_ADVANCED
,
2419 .label
= "max open files",
2421 .p_class
= P_GLOBAL
,
2422 .ptr
= &Globals
.max_open_files
,
2425 .flags
= FLAG_ADVANCED
,
2428 .label
= "min print space",
2431 .ptr
= &sDefault
.iMinPrintSpace
,
2434 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2437 .label
= "socket options",
2439 .p_class
= P_GLOBAL
,
2440 .ptr
= &Globals
.szSocketOptions
,
2443 .flags
= FLAG_ADVANCED
,
2446 .label
= "strict allocate",
2449 .ptr
= &sDefault
.bStrictAllocate
,
2452 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2455 .label
= "strict sync",
2458 .ptr
= &sDefault
.bStrictSync
,
2461 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2464 .label
= "sync always",
2467 .ptr
= &sDefault
.bSyncAlways
,
2470 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2473 .label
= "use mmap",
2475 .p_class
= P_GLOBAL
,
2476 .ptr
= &Globals
.bUseMmap
,
2479 .flags
= FLAG_ADVANCED
,
2482 .label
= "use sendfile",
2485 .ptr
= &sDefault
.bUseSendfile
,
2488 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2491 .label
= "hostname lookups",
2493 .p_class
= P_GLOBAL
,
2494 .ptr
= &Globals
.bHostnameLookups
,
2497 .flags
= FLAG_ADVANCED
,
2500 .label
= "write cache size",
2503 .ptr
= &sDefault
.iWriteCacheSize
,
2506 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_DEPRECATED
,
2509 .label
= "name cache timeout",
2511 .p_class
= P_GLOBAL
,
2512 .ptr
= &Globals
.name_cache_timeout
,
2515 .flags
= FLAG_ADVANCED
,
2518 .label
= "ctdbd socket",
2520 .p_class
= P_GLOBAL
,
2521 .ptr
= &Globals
.ctdbdSocket
,
2524 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2527 .label
= "cluster addresses",
2529 .p_class
= P_GLOBAL
,
2530 .ptr
= &Globals
.szClusterAddresses
,
2533 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2536 .label
= "clustering",
2538 .p_class
= P_GLOBAL
,
2539 .ptr
= &Globals
.clustering
,
2542 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2545 {N_("Printing Options"), P_SEP
, P_SEPARATOR
},
2548 .label
= "max reported print jobs",
2551 .ptr
= &sDefault
.iMaxReportedPrintJobs
,
2554 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2557 .label
= "max print jobs",
2560 .ptr
= &sDefault
.iMaxPrintJobs
,
2563 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2566 .label
= "load printers",
2568 .p_class
= P_GLOBAL
,
2569 .ptr
= &Globals
.bLoadPrinters
,
2572 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2575 .label
= "printcap cache time",
2577 .p_class
= P_GLOBAL
,
2578 .ptr
= &Globals
.PrintcapCacheTime
,
2581 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2584 .label
= "printcap name",
2586 .p_class
= P_GLOBAL
,
2587 .ptr
= &Globals
.szPrintcapname
,
2590 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2593 .label
= "printcap",
2595 .p_class
= P_GLOBAL
,
2596 .ptr
= &Globals
.szPrintcapname
,
2602 .label
= "printable",
2605 .ptr
= &sDefault
.bPrint_ok
,
2608 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2611 .label
= "print ok",
2614 .ptr
= &sDefault
.bPrint_ok
,
2620 .label
= "printing",
2623 .ptr
= &sDefault
.iPrinting
,
2624 .special
= handle_printing
,
2625 .enum_list
= enum_printing
,
2626 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2629 .label
= "cups options",
2632 .ptr
= &sDefault
.szCupsOptions
,
2635 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2638 .label
= "cups server",
2640 .p_class
= P_GLOBAL
,
2641 .ptr
= &Globals
.szCupsServer
,
2644 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2647 .label
= "cups encrypt",
2649 .p_class
= P_GLOBAL
,
2650 .ptr
= &Globals
.CupsEncrypt
,
2652 .enum_list
= enum_bool_auto
,
2653 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2657 .label
= "cups connection timeout",
2659 .p_class
= P_GLOBAL
,
2660 .ptr
= &Globals
.cups_connection_timeout
,
2663 .flags
= FLAG_ADVANCED
,
2666 .label
= "iprint server",
2668 .p_class
= P_GLOBAL
,
2669 .ptr
= &Globals
.szIPrintServer
,
2672 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2675 .label
= "print command",
2678 .ptr
= &sDefault
.szPrintcommand
,
2681 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2684 .label
= "disable spoolss",
2686 .p_class
= P_GLOBAL
,
2687 .ptr
= &Globals
.bDisableSpoolss
,
2690 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2693 .label
= "enable spoolss",
2695 .p_class
= P_GLOBAL
,
2696 .ptr
= &Globals
.bDisableSpoolss
,
2702 .label
= "lpq command",
2705 .ptr
= &sDefault
.szLpqcommand
,
2708 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2711 .label
= "lprm command",
2714 .ptr
= &sDefault
.szLprmcommand
,
2717 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2720 .label
= "lppause command",
2723 .ptr
= &sDefault
.szLppausecommand
,
2726 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2729 .label
= "lpresume command",
2732 .ptr
= &sDefault
.szLpresumecommand
,
2735 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2738 .label
= "queuepause command",
2741 .ptr
= &sDefault
.szQueuepausecommand
,
2744 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2747 .label
= "queueresume command",
2750 .ptr
= &sDefault
.szQueueresumecommand
,
2753 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2756 .label
= "addport command",
2758 .p_class
= P_GLOBAL
,
2759 .ptr
= &Globals
.szAddPortCommand
,
2762 .flags
= FLAG_ADVANCED
,
2765 .label
= "enumports command",
2767 .p_class
= P_GLOBAL
,
2768 .ptr
= &Globals
.szEnumPortsCommand
,
2771 .flags
= FLAG_ADVANCED
,
2774 .label
= "addprinter command",
2776 .p_class
= P_GLOBAL
,
2777 .ptr
= &Globals
.szAddPrinterCommand
,
2780 .flags
= FLAG_ADVANCED
,
2783 .label
= "deleteprinter command",
2785 .p_class
= P_GLOBAL
,
2786 .ptr
= &Globals
.szDeletePrinterCommand
,
2789 .flags
= FLAG_ADVANCED
,
2792 .label
= "show add printer wizard",
2794 .p_class
= P_GLOBAL
,
2795 .ptr
= &Globals
.bMsAddPrinterWizard
,
2798 .flags
= FLAG_ADVANCED
,
2801 .label
= "os2 driver map",
2803 .p_class
= P_GLOBAL
,
2804 .ptr
= &Globals
.szOs2DriverMap
,
2807 .flags
= FLAG_ADVANCED
,
2811 .label
= "printer name",
2814 .ptr
= &sDefault
.szPrintername
,
2817 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2823 .ptr
= &sDefault
.szPrintername
,
2829 .label
= "use client driver",
2832 .ptr
= &sDefault
.bUseClientDriver
,
2835 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2838 .label
= "default devmode",
2841 .ptr
= &sDefault
.bDefaultDevmode
,
2844 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2847 .label
= "force printername",
2850 .ptr
= &sDefault
.bForcePrintername
,
2853 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2856 .label
= "printjob username",
2859 .ptr
= &sDefault
.szPrintjobUsername
,
2862 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2865 {N_("Filename Handling"), P_SEP
, P_SEPARATOR
},
2868 .label
= "mangling method",
2870 .p_class
= P_GLOBAL
,
2871 .ptr
= &Globals
.szManglingMethod
,
2874 .flags
= FLAG_ADVANCED
,
2877 .label
= "mangle prefix",
2879 .p_class
= P_GLOBAL
,
2880 .ptr
= &Globals
.mangle_prefix
,
2883 .flags
= FLAG_ADVANCED
,
2887 .label
= "default case",
2890 .ptr
= &sDefault
.iDefaultCase
,
2892 .enum_list
= enum_case
,
2893 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2896 .label
= "case sensitive",
2899 .ptr
= &sDefault
.iCaseSensitive
,
2901 .enum_list
= enum_bool_auto
,
2902 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2905 .label
= "casesignames",
2908 .ptr
= &sDefault
.iCaseSensitive
,
2910 .enum_list
= enum_bool_auto
,
2911 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
| FLAG_HIDE
,
2914 .label
= "preserve case",
2917 .ptr
= &sDefault
.bCasePreserve
,
2920 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2923 .label
= "short preserve case",
2926 .ptr
= &sDefault
.bShortCasePreserve
,
2929 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2932 .label
= "mangling char",
2935 .ptr
= &sDefault
.magic_char
,
2938 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2941 .label
= "hide dot files",
2944 .ptr
= &sDefault
.bHideDotFiles
,
2947 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2950 .label
= "hide special files",
2953 .ptr
= &sDefault
.bHideSpecialFiles
,
2956 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2959 .label
= "hide unreadable",
2962 .ptr
= &sDefault
.bHideUnReadable
,
2965 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2968 .label
= "hide unwriteable files",
2971 .ptr
= &sDefault
.bHideUnWriteableFiles
,
2974 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2977 .label
= "delete veto files",
2980 .ptr
= &sDefault
.bDeleteVetoFiles
,
2983 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2986 .label
= "veto files",
2989 .ptr
= &sDefault
.szVetoFiles
,
2992 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2995 .label
= "hide files",
2998 .ptr
= &sDefault
.szHideFiles
,
3001 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3004 .label
= "veto oplock files",
3007 .ptr
= &sDefault
.szVetoOplockFiles
,
3010 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3013 .label
= "map archive",
3016 .ptr
= &sDefault
.bMap_archive
,
3019 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3022 .label
= "map hidden",
3025 .ptr
= &sDefault
.bMap_hidden
,
3028 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3031 .label
= "map system",
3034 .ptr
= &sDefault
.bMap_system
,
3037 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3040 .label
= "map readonly",
3043 .ptr
= &sDefault
.iMap_readonly
,
3045 .enum_list
= enum_map_readonly
,
3046 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3049 .label
= "mangled names",
3052 .ptr
= &sDefault
.bMangledNames
,
3055 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3058 .label
= "max stat cache size",
3060 .p_class
= P_GLOBAL
,
3061 .ptr
= &Globals
.iMaxStatCacheSize
,
3064 .flags
= FLAG_ADVANCED
,
3067 .label
= "stat cache",
3069 .p_class
= P_GLOBAL
,
3070 .ptr
= &Globals
.bStatCache
,
3073 .flags
= FLAG_ADVANCED
,
3076 .label
= "store create time",
3079 .ptr
= &sDefault
.bStoreCreateTime
,
3082 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3085 .label
= "store dos attributes",
3088 .ptr
= &sDefault
.bStoreDosAttributes
,
3091 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3094 .label
= "dmapi support",
3097 .ptr
= &sDefault
.bDmapiSupport
,
3100 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3104 {N_("Domain Options"), P_SEP
, P_SEPARATOR
},
3107 .label
= "machine password timeout",
3109 .p_class
= P_GLOBAL
,
3110 .ptr
= &Globals
.machine_password_timeout
,
3113 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
3116 {N_("Logon Options"), P_SEP
, P_SEPARATOR
},
3119 .label
= "add user script",
3121 .p_class
= P_GLOBAL
,
3122 .ptr
= &Globals
.szAddUserScript
,
3125 .flags
= FLAG_ADVANCED
,
3128 .label
= "rename user script",
3130 .p_class
= P_GLOBAL
,
3131 .ptr
= &Globals
.szRenameUserScript
,
3134 .flags
= FLAG_ADVANCED
,
3137 .label
= "delete user script",
3139 .p_class
= P_GLOBAL
,
3140 .ptr
= &Globals
.szDelUserScript
,
3143 .flags
= FLAG_ADVANCED
,
3146 .label
= "add group script",
3148 .p_class
= P_GLOBAL
,
3149 .ptr
= &Globals
.szAddGroupScript
,
3152 .flags
= FLAG_ADVANCED
,
3155 .label
= "delete group script",
3157 .p_class
= P_GLOBAL
,
3158 .ptr
= &Globals
.szDelGroupScript
,
3161 .flags
= FLAG_ADVANCED
,
3164 .label
= "add user to group script",
3166 .p_class
= P_GLOBAL
,
3167 .ptr
= &Globals
.szAddUserToGroupScript
,
3170 .flags
= FLAG_ADVANCED
,
3173 .label
= "delete user from group script",
3175 .p_class
= P_GLOBAL
,
3176 .ptr
= &Globals
.szDelUserFromGroupScript
,
3179 .flags
= FLAG_ADVANCED
,
3182 .label
= "set primary group script",
3184 .p_class
= P_GLOBAL
,
3185 .ptr
= &Globals
.szSetPrimaryGroupScript
,
3188 .flags
= FLAG_ADVANCED
,
3191 .label
= "add machine script",
3193 .p_class
= P_GLOBAL
,
3194 .ptr
= &Globals
.szAddMachineScript
,
3197 .flags
= FLAG_ADVANCED
,
3200 .label
= "shutdown script",
3202 .p_class
= P_GLOBAL
,
3203 .ptr
= &Globals
.szShutdownScript
,
3206 .flags
= FLAG_ADVANCED
,
3209 .label
= "abort shutdown script",
3211 .p_class
= P_GLOBAL
,
3212 .ptr
= &Globals
.szAbortShutdownScript
,
3215 .flags
= FLAG_ADVANCED
,
3218 .label
= "username map script",
3220 .p_class
= P_GLOBAL
,
3221 .ptr
= &Globals
.szUsernameMapScript
,
3224 .flags
= FLAG_ADVANCED
,
3227 .label
= "logon script",
3229 .p_class
= P_GLOBAL
,
3230 .ptr
= &Globals
.szLogonScript
,
3233 .flags
= FLAG_ADVANCED
,
3236 .label
= "logon path",
3238 .p_class
= P_GLOBAL
,
3239 .ptr
= &Globals
.szLogonPath
,
3242 .flags
= FLAG_ADVANCED
,
3245 .label
= "logon drive",
3247 .p_class
= P_GLOBAL
,
3248 .ptr
= &Globals
.szLogonDrive
,
3251 .flags
= FLAG_ADVANCED
,
3254 .label
= "logon home",
3256 .p_class
= P_GLOBAL
,
3257 .ptr
= &Globals
.szLogonHome
,
3260 .flags
= FLAG_ADVANCED
,
3263 .label
= "domain logons",
3265 .p_class
= P_GLOBAL
,
3266 .ptr
= &Globals
.bDomainLogons
,
3269 .flags
= FLAG_ADVANCED
,
3273 .label
= "init logon delayed hosts",
3275 .p_class
= P_GLOBAL
,
3276 .ptr
= &Globals
.szInitLogonDelayedHosts
,
3277 .flags
= FLAG_ADVANCED
,
3281 .label
= "init logon delay",
3283 .p_class
= P_GLOBAL
,
3284 .ptr
= &Globals
.InitLogonDelay
,
3285 .flags
= FLAG_ADVANCED
,
3289 {N_("Browse Options"), P_SEP
, P_SEPARATOR
},
3292 .label
= "os level",
3294 .p_class
= P_GLOBAL
,
3295 .ptr
= &Globals
.os_level
,
3298 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3301 .label
= "lm announce",
3303 .p_class
= P_GLOBAL
,
3304 .ptr
= &Globals
.lm_announce
,
3306 .enum_list
= enum_bool_auto
,
3307 .flags
= FLAG_ADVANCED
,
3310 .label
= "lm interval",
3312 .p_class
= P_GLOBAL
,
3313 .ptr
= &Globals
.lm_interval
,
3316 .flags
= FLAG_ADVANCED
,
3319 .label
= "preferred master",
3321 .p_class
= P_GLOBAL
,
3322 .ptr
= &Globals
.iPreferredMaster
,
3324 .enum_list
= enum_bool_auto
,
3325 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3328 .label
= "prefered master",
3330 .p_class
= P_GLOBAL
,
3331 .ptr
= &Globals
.iPreferredMaster
,
3333 .enum_list
= enum_bool_auto
,
3337 .label
= "local master",
3339 .p_class
= P_GLOBAL
,
3340 .ptr
= &Globals
.bLocalMaster
,
3343 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3346 .label
= "domain master",
3348 .p_class
= P_GLOBAL
,
3349 .ptr
= &Globals
.iDomainMaster
,
3351 .enum_list
= enum_bool_auto
,
3352 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3355 .label
= "browse list",
3357 .p_class
= P_GLOBAL
,
3358 .ptr
= &Globals
.bBrowseList
,
3361 .flags
= FLAG_ADVANCED
,
3364 .label
= "browseable",
3367 .ptr
= &sDefault
.bBrowseable
,
3370 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
3373 .label
= "browsable",
3376 .ptr
= &sDefault
.bBrowseable
,
3382 .label
= "access based share enum",
3385 .ptr
= &sDefault
.bAccessBasedShareEnum
,
3388 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
3391 .label
= "enhanced browsing",
3393 .p_class
= P_GLOBAL
,
3394 .ptr
= &Globals
.enhanced_browsing
,
3397 .flags
= FLAG_ADVANCED
,
3400 {N_("WINS Options"), P_SEP
, P_SEPARATOR
},
3403 .label
= "dns proxy",
3405 .p_class
= P_GLOBAL
,
3406 .ptr
= &Globals
.bDNSproxy
,
3409 .flags
= FLAG_ADVANCED
,
3412 .label
= "wins proxy",
3414 .p_class
= P_GLOBAL
,
3415 .ptr
= &Globals
.bWINSproxy
,
3418 .flags
= FLAG_ADVANCED
,
3421 .label
= "wins server",
3423 .p_class
= P_GLOBAL
,
3424 .ptr
= &Globals
.szWINSservers
,
3427 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
3430 .label
= "wins support",
3432 .p_class
= P_GLOBAL
,
3433 .ptr
= &Globals
.bWINSsupport
,
3436 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
3439 .label
= "wins hook",
3441 .p_class
= P_GLOBAL
,
3442 .ptr
= &Globals
.szWINSHook
,
3445 .flags
= FLAG_ADVANCED
,
3448 {N_("Locking Options"), P_SEP
, P_SEPARATOR
},
3451 .label
= "blocking locks",
3454 .ptr
= &sDefault
.bBlockingLocks
,
3457 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3460 .label
= "csc policy",
3463 .ptr
= &sDefault
.iCSCPolicy
,
3465 .enum_list
= enum_csc_policy
,
3466 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3469 .label
= "fake oplocks",
3472 .ptr
= &sDefault
.bFakeOplocks
,
3475 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
3478 .label
= "kernel oplocks",
3480 .p_class
= P_GLOBAL
,
3481 .ptr
= &Globals
.bKernelOplocks
,
3484 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3490 .ptr
= &sDefault
.bLocking
,
3493 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3496 .label
= "lock spin time",
3498 .p_class
= P_GLOBAL
,
3499 .ptr
= &Globals
.iLockSpinTime
,
3502 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3508 .ptr
= &sDefault
.bOpLocks
,
3511 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3514 .label
= "level2 oplocks",
3517 .ptr
= &sDefault
.bLevel2OpLocks
,
3520 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3523 .label
= "oplock break wait time",
3525 .p_class
= P_GLOBAL
,
3526 .ptr
= &Globals
.oplock_break_wait_time
,
3529 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3532 .label
= "oplock contention limit",
3535 .ptr
= &sDefault
.iOplockContentionLimit
,
3538 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3541 .label
= "posix locking",
3544 .ptr
= &sDefault
.bPosixLocking
,
3547 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3550 .label
= "strict locking",
3553 .ptr
= &sDefault
.iStrictLocking
,
3555 .enum_list
= enum_bool_auto
,
3556 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3559 .label
= "share modes",
3562 .ptr
= &sDefault
.bShareModes
,
3565 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DEPRECATED
,
3568 {N_("Ldap Options"), P_SEP
, P_SEPARATOR
},
3571 .label
= "ldap admin dn",
3573 .p_class
= P_GLOBAL
,
3574 .ptr
= &Globals
.szLdapAdminDn
,
3577 .flags
= FLAG_ADVANCED
,
3580 .label
= "ldap delete dn",
3582 .p_class
= P_GLOBAL
,
3583 .ptr
= &Globals
.ldap_delete_dn
,
3586 .flags
= FLAG_ADVANCED
,
3589 .label
= "ldap group suffix",
3591 .p_class
= P_GLOBAL
,
3592 .ptr
= &Globals
.szLdapGroupSuffix
,
3595 .flags
= FLAG_ADVANCED
,
3598 .label
= "ldap idmap suffix",
3600 .p_class
= P_GLOBAL
,
3601 .ptr
= &Globals
.szLdapIdmapSuffix
,
3604 .flags
= FLAG_ADVANCED
,
3607 .label
= "ldap machine suffix",
3609 .p_class
= P_GLOBAL
,
3610 .ptr
= &Globals
.szLdapMachineSuffix
,
3613 .flags
= FLAG_ADVANCED
,
3616 .label
= "ldap passwd sync",
3618 .p_class
= P_GLOBAL
,
3619 .ptr
= &Globals
.ldap_passwd_sync
,
3621 .enum_list
= enum_ldap_passwd_sync
,
3622 .flags
= FLAG_ADVANCED
,
3625 .label
= "ldap password sync",
3627 .p_class
= P_GLOBAL
,
3628 .ptr
= &Globals
.ldap_passwd_sync
,
3630 .enum_list
= enum_ldap_passwd_sync
,
3634 .label
= "ldap replication sleep",
3636 .p_class
= P_GLOBAL
,
3637 .ptr
= &Globals
.ldap_replication_sleep
,
3640 .flags
= FLAG_ADVANCED
,
3643 .label
= "ldap suffix",
3645 .p_class
= P_GLOBAL
,
3646 .ptr
= &Globals
.szLdapSuffix
,
3649 .flags
= FLAG_ADVANCED
,
3652 .label
= "ldap ssl",
3654 .p_class
= P_GLOBAL
,
3655 .ptr
= &Globals
.ldap_ssl
,
3657 .enum_list
= enum_ldap_ssl
,
3658 .flags
= FLAG_ADVANCED
,
3661 .label
= "ldap ssl ads",
3663 .p_class
= P_GLOBAL
,
3664 .ptr
= &Globals
.ldap_ssl_ads
,
3667 .flags
= FLAG_ADVANCED
,
3670 .label
= "ldap timeout",
3672 .p_class
= P_GLOBAL
,
3673 .ptr
= &Globals
.ldap_timeout
,
3676 .flags
= FLAG_ADVANCED
,
3679 .label
= "ldap connection timeout",
3681 .p_class
= P_GLOBAL
,
3682 .ptr
= &Globals
.ldap_connection_timeout
,
3685 .flags
= FLAG_ADVANCED
,
3688 .label
= "ldap page size",
3690 .p_class
= P_GLOBAL
,
3691 .ptr
= &Globals
.ldap_page_size
,
3694 .flags
= FLAG_ADVANCED
,
3697 .label
= "ldap user suffix",
3699 .p_class
= P_GLOBAL
,
3700 .ptr
= &Globals
.szLdapUserSuffix
,
3703 .flags
= FLAG_ADVANCED
,
3706 .label
= "ldap debug level",
3708 .p_class
= P_GLOBAL
,
3709 .ptr
= &Globals
.ldap_debug_level
,
3710 .special
= handle_ldap_debug_level
,
3712 .flags
= FLAG_ADVANCED
,
3715 .label
= "ldap debug threshold",
3717 .p_class
= P_GLOBAL
,
3718 .ptr
= &Globals
.ldap_debug_threshold
,
3721 .flags
= FLAG_ADVANCED
,
3724 {N_("EventLog Options"), P_SEP
, P_SEPARATOR
},
3727 .label
= "eventlog list",
3729 .p_class
= P_GLOBAL
,
3730 .ptr
= &Globals
.szEventLogs
,
3733 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
3736 {N_("Miscellaneous Options"), P_SEP
, P_SEPARATOR
},
3739 .label
= "add share command",
3741 .p_class
= P_GLOBAL
,
3742 .ptr
= &Globals
.szAddShareCommand
,
3745 .flags
= FLAG_ADVANCED
,
3748 .label
= "change share command",
3750 .p_class
= P_GLOBAL
,
3751 .ptr
= &Globals
.szChangeShareCommand
,
3754 .flags
= FLAG_ADVANCED
,
3757 .label
= "delete share command",
3759 .p_class
= P_GLOBAL
,
3760 .ptr
= &Globals
.szDeleteShareCommand
,
3763 .flags
= FLAG_ADVANCED
,
3766 .label
= "config file",
3768 .p_class
= P_GLOBAL
,
3769 .ptr
= &Globals
.szConfigFile
,
3772 .flags
= FLAG_HIDE
|FLAG_META
,
3777 .p_class
= P_GLOBAL
,
3778 .ptr
= &Globals
.szAutoServices
,
3781 .flags
= FLAG_ADVANCED
,
3784 .label
= "auto services",
3786 .p_class
= P_GLOBAL
,
3787 .ptr
= &Globals
.szAutoServices
,
3790 .flags
= FLAG_ADVANCED
,
3793 .label
= "lock directory",
3795 .p_class
= P_GLOBAL
,
3796 .ptr
= &Globals
.szLockDir
,
3799 .flags
= FLAG_ADVANCED
,
3802 .label
= "lock dir",
3804 .p_class
= P_GLOBAL
,
3805 .ptr
= &Globals
.szLockDir
,
3811 .label
= "state directory",
3813 .p_class
= P_GLOBAL
,
3814 .ptr
= &Globals
.szStateDir
,
3817 .flags
= FLAG_ADVANCED
,
3820 .label
= "cache directory",
3822 .p_class
= P_GLOBAL
,
3823 .ptr
= &Globals
.szCacheDir
,
3826 .flags
= FLAG_ADVANCED
,
3829 .label
= "pid directory",
3831 .p_class
= P_GLOBAL
,
3832 .ptr
= &Globals
.szPidDir
,
3835 .flags
= FLAG_ADVANCED
,
3839 .label
= "utmp directory",
3841 .p_class
= P_GLOBAL
,
3842 .ptr
= &Globals
.szUtmpDir
,
3845 .flags
= FLAG_ADVANCED
,
3848 .label
= "wtmp directory",
3850 .p_class
= P_GLOBAL
,
3851 .ptr
= &Globals
.szWtmpDir
,
3854 .flags
= FLAG_ADVANCED
,
3859 .p_class
= P_GLOBAL
,
3860 .ptr
= &Globals
.bUtmp
,
3863 .flags
= FLAG_ADVANCED
,
3867 .label
= "default service",
3869 .p_class
= P_GLOBAL
,
3870 .ptr
= &Globals
.szDefaultService
,
3873 .flags
= FLAG_ADVANCED
,
3878 .p_class
= P_GLOBAL
,
3879 .ptr
= &Globals
.szDefaultService
,
3882 .flags
= FLAG_ADVANCED
,
3885 .label
= "message command",
3887 .p_class
= P_GLOBAL
,
3888 .ptr
= &Globals
.szMsgCommand
,
3891 .flags
= FLAG_ADVANCED
,
3894 .label
= "dfree cache time",
3897 .ptr
= &sDefault
.iDfreeCacheTime
,
3900 .flags
= FLAG_ADVANCED
,
3903 .label
= "dfree command",
3906 .ptr
= &sDefault
.szDfree
,
3909 .flags
= FLAG_ADVANCED
,
3912 .label
= "get quota command",
3914 .p_class
= P_GLOBAL
,
3915 .ptr
= &Globals
.szGetQuota
,
3918 .flags
= FLAG_ADVANCED
,
3921 .label
= "set quota command",
3923 .p_class
= P_GLOBAL
,
3924 .ptr
= &Globals
.szSetQuota
,
3927 .flags
= FLAG_ADVANCED
,
3930 .label
= "remote announce",
3932 .p_class
= P_GLOBAL
,
3933 .ptr
= &Globals
.szRemoteAnnounce
,
3936 .flags
= FLAG_ADVANCED
,
3939 .label
= "remote browse sync",
3941 .p_class
= P_GLOBAL
,
3942 .ptr
= &Globals
.szRemoteBrowseSync
,
3945 .flags
= FLAG_ADVANCED
,
3948 .label
= "socket address",
3950 .p_class
= P_GLOBAL
,
3951 .ptr
= &Globals
.szSocketAddress
,
3954 .flags
= FLAG_ADVANCED
,
3957 .label
= "homedir map",
3959 .p_class
= P_GLOBAL
,
3960 .ptr
= &Globals
.szNISHomeMapName
,
3963 .flags
= FLAG_ADVANCED
,
3966 .label
= "afs username map",
3968 .p_class
= P_GLOBAL
,
3969 .ptr
= &Globals
.szAfsUsernameMap
,
3972 .flags
= FLAG_ADVANCED
,
3975 .label
= "afs token lifetime",
3977 .p_class
= P_GLOBAL
,
3978 .ptr
= &Globals
.iAfsTokenLifetime
,
3981 .flags
= FLAG_ADVANCED
,
3984 .label
= "log nt token command",
3986 .p_class
= P_GLOBAL
,
3987 .ptr
= &Globals
.szLogNtTokenCommand
,
3990 .flags
= FLAG_ADVANCED
,
3993 .label
= "time offset",
3995 .p_class
= P_GLOBAL
,
3996 .ptr
= &extra_time_offset
,
3999 .flags
= FLAG_ADVANCED
,
4002 .label
= "NIS homedir",
4004 .p_class
= P_GLOBAL
,
4005 .ptr
= &Globals
.bNISHomeMap
,
4008 .flags
= FLAG_ADVANCED
,
4014 .ptr
= &sDefault
.valid
,
4023 .ptr
= &sDefault
.szCopy
,
4024 .special
= handle_copy
,
4032 .ptr
= &sDefault
.szInclude
,
4033 .special
= handle_include
,
4035 .flags
= FLAG_HIDE
|FLAG_META
,
4041 .ptr
= &sDefault
.szPreExec
,
4044 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4050 .ptr
= &sDefault
.szPreExec
,
4053 .flags
= FLAG_ADVANCED
,
4056 .label
= "preexec close",
4059 .ptr
= &sDefault
.bPreexecClose
,
4062 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4065 .label
= "postexec",
4068 .ptr
= &sDefault
.szPostExec
,
4071 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4074 .label
= "root preexec",
4077 .ptr
= &sDefault
.szRootPreExec
,
4080 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4083 .label
= "root preexec close",
4086 .ptr
= &sDefault
.bRootpreexecClose
,
4089 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4092 .label
= "root postexec",
4095 .ptr
= &sDefault
.szRootPostExec
,
4098 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4101 .label
= "available",
4104 .ptr
= &sDefault
.bAvailable
,
4107 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
4110 .label
= "registry shares",
4112 .p_class
= P_GLOBAL
,
4113 .ptr
= &Globals
.bRegistryShares
,
4116 .flags
= FLAG_ADVANCED
,
4119 .label
= "usershare allow guests",
4121 .p_class
= P_GLOBAL
,
4122 .ptr
= &Globals
.bUsershareAllowGuests
,
4125 .flags
= FLAG_ADVANCED
,
4128 .label
= "usershare max shares",
4130 .p_class
= P_GLOBAL
,
4131 .ptr
= &Globals
.iUsershareMaxShares
,
4134 .flags
= FLAG_ADVANCED
,
4137 .label
= "usershare owner only",
4139 .p_class
= P_GLOBAL
,
4140 .ptr
= &Globals
.bUsershareOwnerOnly
,
4143 .flags
= FLAG_ADVANCED
,
4146 .label
= "usershare path",
4148 .p_class
= P_GLOBAL
,
4149 .ptr
= &Globals
.szUsersharePath
,
4152 .flags
= FLAG_ADVANCED
,
4155 .label
= "usershare prefix allow list",
4157 .p_class
= P_GLOBAL
,
4158 .ptr
= &Globals
.szUsersharePrefixAllowList
,
4161 .flags
= FLAG_ADVANCED
,
4164 .label
= "usershare prefix deny list",
4166 .p_class
= P_GLOBAL
,
4167 .ptr
= &Globals
.szUsersharePrefixDenyList
,
4170 .flags
= FLAG_ADVANCED
,
4173 .label
= "usershare template share",
4175 .p_class
= P_GLOBAL
,
4176 .ptr
= &Globals
.szUsershareTemplateShare
,
4179 .flags
= FLAG_ADVANCED
,
4185 .ptr
= &sDefault
.volume
,
4188 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4194 .ptr
= &sDefault
.fstype
,
4197 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4200 .label
= "set directory",
4203 .ptr
= &sDefault
.bNo_set_dir
,
4206 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4209 .label
= "wide links",
4212 .ptr
= &sDefault
.bWidelinks
,
4215 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4218 .label
= "follow symlinks",
4221 .ptr
= &sDefault
.bSymlinks
,
4224 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4227 .label
= "dont descend",
4230 .ptr
= &sDefault
.szDontdescend
,
4233 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4236 .label
= "magic script",
4239 .ptr
= &sDefault
.szMagicScript
,
4242 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4245 .label
= "magic output",
4248 .ptr
= &sDefault
.szMagicOutput
,
4251 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4254 .label
= "delete readonly",
4257 .ptr
= &sDefault
.bDeleteReadonly
,
4260 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4263 .label
= "dos filemode",
4266 .ptr
= &sDefault
.bDosFilemode
,
4269 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4272 .label
= "dos filetimes",
4275 .ptr
= &sDefault
.bDosFiletimes
,
4278 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4281 .label
= "dos filetime resolution",
4284 .ptr
= &sDefault
.bDosFiletimeResolution
,
4287 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4290 .label
= "fake directory create times",
4292 .p_class
= P_GLOBAL
,
4293 .ptr
= &Globals
.bFakeDirCreateTimes
,
4296 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
4299 .label
= "panic action",
4301 .p_class
= P_GLOBAL
,
4302 .ptr
= &Globals
.szPanicAction
,
4305 .flags
= FLAG_ADVANCED
,
4308 .label
= "perfcount module",
4310 .p_class
= P_GLOBAL
,
4311 .ptr
= &Globals
.szSMBPerfcountModule
,
4314 .flags
= FLAG_ADVANCED
,
4317 {N_("VFS module options"), P_SEP
, P_SEPARATOR
},
4320 .label
= "vfs objects",
4323 .ptr
= &sDefault
.szVfsObjects
,
4326 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4329 .label
= "vfs object",
4332 .ptr
= &sDefault
.szVfsObjects
,
4339 {N_("MSDFS options"), P_SEP
, P_SEPARATOR
},
4342 .label
= "msdfs root",
4345 .ptr
= &sDefault
.bMSDfsRoot
,
4348 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4351 .label
= "msdfs proxy",
4354 .ptr
= &sDefault
.szMSDfsProxy
,
4357 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4360 .label
= "host msdfs",
4362 .p_class
= P_GLOBAL
,
4363 .ptr
= &Globals
.bHostMSDfs
,
4366 .flags
= FLAG_ADVANCED
,
4369 {N_("Winbind options"), P_SEP
, P_SEPARATOR
},
4372 .label
= "passdb expand explicit",
4374 .p_class
= P_GLOBAL
,
4375 .ptr
= &Globals
.bPassdbExpandExplicit
,
4378 .flags
= FLAG_ADVANCED
,
4381 .label
= "idmap backend",
4383 .p_class
= P_GLOBAL
,
4384 .ptr
= &Globals
.szIdmapBackend
,
4387 .flags
= FLAG_ADVANCED
,
4390 .label
= "idmap alloc backend",
4392 .p_class
= P_GLOBAL
,
4393 .ptr
= &Globals
.szIdmapAllocBackend
,
4396 .flags
= FLAG_ADVANCED
,
4399 .label
= "idmap cache time",
4401 .p_class
= P_GLOBAL
,
4402 .ptr
= &Globals
.iIdmapCacheTime
,
4405 .flags
= FLAG_ADVANCED
,
4408 .label
= "idmap negative cache time",
4410 .p_class
= P_GLOBAL
,
4411 .ptr
= &Globals
.iIdmapNegativeCacheTime
,
4414 .flags
= FLAG_ADVANCED
,
4417 .label
= "idmap uid",
4419 .p_class
= P_GLOBAL
,
4420 .ptr
= &Globals
.szIdmapUID
,
4421 .special
= handle_idmap_uid
,
4423 .flags
= FLAG_ADVANCED
,
4426 .label
= "winbind uid",
4428 .p_class
= P_GLOBAL
,
4429 .ptr
= &Globals
.szIdmapUID
,
4430 .special
= handle_idmap_uid
,
4435 .label
= "idmap gid",
4437 .p_class
= P_GLOBAL
,
4438 .ptr
= &Globals
.szIdmapGID
,
4439 .special
= handle_idmap_gid
,
4441 .flags
= FLAG_ADVANCED
,
4444 .label
= "winbind gid",
4446 .p_class
= P_GLOBAL
,
4447 .ptr
= &Globals
.szIdmapGID
,
4448 .special
= handle_idmap_gid
,
4453 .label
= "template homedir",
4455 .p_class
= P_GLOBAL
,
4456 .ptr
= &Globals
.szTemplateHomedir
,
4459 .flags
= FLAG_ADVANCED
,
4462 .label
= "template shell",
4464 .p_class
= P_GLOBAL
,
4465 .ptr
= &Globals
.szTemplateShell
,
4468 .flags
= FLAG_ADVANCED
,
4471 .label
= "winbind separator",
4473 .p_class
= P_GLOBAL
,
4474 .ptr
= &Globals
.szWinbindSeparator
,
4477 .flags
= FLAG_ADVANCED
,
4480 .label
= "winbind cache time",
4482 .p_class
= P_GLOBAL
,
4483 .ptr
= &Globals
.winbind_cache_time
,
4486 .flags
= FLAG_ADVANCED
,
4489 .label
= "winbind reconnect delay",
4491 .p_class
= P_GLOBAL
,
4492 .ptr
= &Globals
.winbind_reconnect_delay
,
4495 .flags
= FLAG_ADVANCED
,
4498 .label
= "winbind enum users",
4500 .p_class
= P_GLOBAL
,
4501 .ptr
= &Globals
.bWinbindEnumUsers
,
4504 .flags
= FLAG_ADVANCED
,
4507 .label
= "winbind enum groups",
4509 .p_class
= P_GLOBAL
,
4510 .ptr
= &Globals
.bWinbindEnumGroups
,
4513 .flags
= FLAG_ADVANCED
,
4516 .label
= "winbind use default domain",
4518 .p_class
= P_GLOBAL
,
4519 .ptr
= &Globals
.bWinbindUseDefaultDomain
,
4522 .flags
= FLAG_ADVANCED
,
4525 .label
= "winbind trusted domains only",
4527 .p_class
= P_GLOBAL
,
4528 .ptr
= &Globals
.bWinbindTrustedDomainsOnly
,
4531 .flags
= FLAG_ADVANCED
,
4534 .label
= "winbind nested groups",
4536 .p_class
= P_GLOBAL
,
4537 .ptr
= &Globals
.bWinbindNestedGroups
,
4540 .flags
= FLAG_ADVANCED
,
4543 .label
= "winbind expand groups",
4545 .p_class
= P_GLOBAL
,
4546 .ptr
= &Globals
.winbind_expand_groups
,
4549 .flags
= FLAG_ADVANCED
,
4552 .label
= "winbind nss info",
4554 .p_class
= P_GLOBAL
,
4555 .ptr
= &Globals
.szWinbindNssInfo
,
4558 .flags
= FLAG_ADVANCED
,
4561 .label
= "winbind refresh tickets",
4563 .p_class
= P_GLOBAL
,
4564 .ptr
= &Globals
.bWinbindRefreshTickets
,
4567 .flags
= FLAG_ADVANCED
,
4570 .label
= "winbind offline logon",
4572 .p_class
= P_GLOBAL
,
4573 .ptr
= &Globals
.bWinbindOfflineLogon
,
4576 .flags
= FLAG_ADVANCED
,
4579 .label
= "winbind normalize names",
4581 .p_class
= P_GLOBAL
,
4582 .ptr
= &Globals
.bWinbindNormalizeNames
,
4585 .flags
= FLAG_ADVANCED
,
4588 .label
= "winbind rpc only",
4590 .p_class
= P_GLOBAL
,
4591 .ptr
= &Globals
.bWinbindRpcOnly
,
4594 .flags
= FLAG_ADVANCED
,
4597 .label
= "create krb5 conf",
4599 .p_class
= P_GLOBAL
,
4600 .ptr
= &Globals
.bCreateKrb5Conf
,
4603 .flags
= FLAG_ADVANCED
,
4606 {NULL
, P_BOOL
, P_NONE
, NULL
, NULL
, NULL
, 0}
4609 /***************************************************************************
4610 Initialise the sDefault parameter structure for the printer values.
4611 ***************************************************************************/
4613 static void init_printer_values(struct service
*pService
)
4615 /* choose defaults depending on the type of printing */
4616 switch (pService
->iPrinting
) {
4621 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4622 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4623 string_set(&pService
->szPrintcommand
, "lpr -r -P'%p' %s");
4628 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4629 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4630 string_set(&pService
->szPrintcommand
, "lpr -r -P'%p' %s");
4631 string_set(&pService
->szQueuepausecommand
, "lpc stop '%p'");
4632 string_set(&pService
->szQueueresumecommand
, "lpc start '%p'");
4633 string_set(&pService
->szLppausecommand
, "lpc hold '%p' %j");
4634 string_set(&pService
->szLpresumecommand
, "lpc release '%p' %j");
4640 /* set the lpq command to contain the destination printer
4641 name only. This is used by cups_queue_get() */
4642 string_set(&pService
->szLpqcommand
, "%p");
4643 string_set(&pService
->szLprmcommand
, "");
4644 string_set(&pService
->szPrintcommand
, "");
4645 string_set(&pService
->szLppausecommand
, "");
4646 string_set(&pService
->szLpresumecommand
, "");
4647 string_set(&pService
->szQueuepausecommand
, "");
4648 string_set(&pService
->szQueueresumecommand
, "");
4650 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4651 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4652 string_set(&pService
->szPrintcommand
, "lpr -P'%p' %s; rm %s");
4653 string_set(&pService
->szLppausecommand
, "lp -i '%p-%j' -H hold");
4654 string_set(&pService
->szLpresumecommand
, "lp -i '%p-%j' -H resume");
4655 string_set(&pService
->szQueuepausecommand
, "disable '%p'");
4656 string_set(&pService
->szQueueresumecommand
, "enable '%p'");
4657 #endif /* HAVE_CUPS */
4662 string_set(&pService
->szLpqcommand
, "lpstat -o%p");
4663 string_set(&pService
->szLprmcommand
, "cancel %p-%j");
4664 string_set(&pService
->szPrintcommand
, "lp -c -d%p %s; rm %s");
4665 string_set(&pService
->szQueuepausecommand
, "disable %p");
4666 string_set(&pService
->szQueueresumecommand
, "enable %p");
4668 string_set(&pService
->szLppausecommand
, "lp -i %p-%j -H hold");
4669 string_set(&pService
->szLpresumecommand
, "lp -i %p-%j -H resume");
4674 string_set(&pService
->szLpqcommand
, "lpq -P%p");
4675 string_set(&pService
->szLprmcommand
, "lprm -P%p %j");
4676 string_set(&pService
->szPrintcommand
, "lp -r -P%p %s");
4682 string_set(&pService
->szPrintcommand
, "vlp print %p %s");
4683 string_set(&pService
->szLpqcommand
, "vlp lpq %p");
4684 string_set(&pService
->szLprmcommand
, "vlp lprm %p %j");
4685 string_set(&pService
->szLppausecommand
, "vlp lppause %p %j");
4686 string_set(&pService
->szLpresumecommand
, "vlp lpresume %p %j");
4687 string_set(&pService
->szQueuepausecommand
, "vlp queuepause %p");
4688 string_set(&pService
->szQueueresumecommand
, "vlp queueresume %p");
4690 #endif /* DEVELOPER */
4695 * Function to return the default value for the maximum number of open
4696 * file descriptors permitted. This function tries to consult the
4697 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4698 * the smaller of those.
4700 static int max_open_files(void)
4702 int sysctl_max
= MAX_OPEN_FILES
;
4703 int rlimit_max
= MAX_OPEN_FILES
;
4705 #ifdef HAVE_SYSCTLBYNAME
4707 size_t size
= sizeof(sysctl_max
);
4708 sysctlbyname("kern.maxfilesperproc", &sysctl_max
, &size
, NULL
,
4713 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4719 if (getrlimit(RLIMIT_NOFILE
, &rl
) == 0)
4720 rlimit_max
= rl
.rlim_cur
;
4722 #if defined(RLIM_INFINITY)
4723 if(rl
.rlim_cur
== RLIM_INFINITY
)
4724 rlimit_max
= MAX_OPEN_FILES
;
4729 return MIN(sysctl_max
, rlimit_max
);
4733 * Common part of freeing allocated data for one parameter.
4735 static void free_one_parameter_common(void *parm_ptr
,
4736 struct parm_struct parm
)
4738 if ((parm
.type
== P_STRING
) ||
4739 (parm
.type
== P_USTRING
))
4741 string_free((char**)parm_ptr
);
4742 } else if (parm
.type
== P_LIST
) {
4743 TALLOC_FREE(*((char***)parm_ptr
));
4748 * Free the allocated data for one parameter for a share
4749 * given as a service struct.
4751 static void free_one_parameter(struct service
*service
,
4752 struct parm_struct parm
)
4756 if (parm
.p_class
!= P_LOCAL
) {
4760 parm_ptr
= lp_local_ptr(service
, parm
.ptr
);
4762 free_one_parameter_common(parm_ptr
, parm
);
4766 * Free the allocated parameter data of a share given
4767 * as a service struct.
4769 static void free_parameters(struct service
*service
)
4773 for (i
=0; parm_table
[i
].label
; i
++) {
4774 free_one_parameter(service
, parm_table
[i
]);
4779 * Free the allocated data for one parameter for a given share
4780 * specified by an snum.
4782 static void free_one_parameter_by_snum(int snum
, struct parm_struct parm
)
4786 if (parm
.ptr
== NULL
) {
4791 parm_ptr
= parm
.ptr
;
4792 } else if (parm
.p_class
!= P_LOCAL
) {
4795 parm_ptr
= lp_local_ptr_by_snum(snum
, parm
.ptr
);
4798 free_one_parameter_common(parm_ptr
, parm
);
4802 * Free the allocated parameter data for a share specified
4805 static void free_parameters_by_snum(int snum
)
4809 for (i
=0; parm_table
[i
].label
; i
++) {
4810 free_one_parameter_by_snum(snum
, parm_table
[i
]);
4815 * Free the allocated global parameters.
4817 static void free_global_parameters(void)
4819 free_parameters_by_snum(GLOBAL_SECTION_SNUM
);
4822 /***************************************************************************
4823 Initialise the global parameter structure.
4824 ***************************************************************************/
4826 static void init_globals(bool first_time_only
)
4828 static bool done_init
= False
;
4832 /* If requested to initialize only once and we've already done it... */
4833 if (first_time_only
&& done_init
) {
4834 /* ... then we have nothing more to do */
4839 /* The logfile can be set before this is invoked. Free it if so. */
4840 if (Globals
.szLogFile
!= NULL
) {
4841 string_free(&Globals
.szLogFile
);
4842 Globals
.szLogFile
= NULL
;
4846 free_global_parameters();
4849 memset((void *)&Globals
, '\0', sizeof(Globals
));
4851 for (i
= 0; parm_table
[i
].label
; i
++) {
4852 if ((parm_table
[i
].type
== P_STRING
||
4853 parm_table
[i
].type
== P_USTRING
) &&
4856 string_set((char **)parm_table
[i
].ptr
, "");
4860 string_set(&sDefault
.fstype
, FSTYPE_STRING
);
4861 string_set(&sDefault
.szPrintjobUsername
, "%U");
4863 init_printer_values(&sDefault
);
4866 DEBUG(3, ("Initialising global parameters\n"));
4868 string_set(&Globals
.szSMBPasswdFile
, get_dyn_SMB_PASSWD_FILE());
4869 string_set(&Globals
.szPrivateDir
, get_dyn_PRIVATE_DIR());
4871 /* use the new 'hash2' method by default, with a prefix of 1 */
4872 string_set(&Globals
.szManglingMethod
, "hash2");
4873 Globals
.mangle_prefix
= 1;
4875 string_set(&Globals
.szGuestaccount
, GUEST_ACCOUNT
);
4877 /* using UTF8 by default allows us to support all chars */
4878 string_set(&Globals
.unix_charset
, DEFAULT_UNIX_CHARSET
);
4880 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
4881 /* If the system supports nl_langinfo(), try to grab the value
4882 from the user's locale */
4883 string_set(&Globals
.display_charset
, "LOCALE");
4885 string_set(&Globals
.display_charset
, DEFAULT_DISPLAY_CHARSET
);
4888 /* Use codepage 850 as a default for the dos character set */
4889 string_set(&Globals
.dos_charset
, DEFAULT_DOS_CHARSET
);
4892 * Allow the default PASSWD_CHAT to be overridden in local.h.
4894 string_set(&Globals
.szPasswdChat
, DEFAULT_PASSWD_CHAT
);
4896 set_global_myname(myhostname());
4897 string_set(&Globals
.szNetbiosName
,global_myname());
4899 set_global_myworkgroup(WORKGROUP
);
4900 string_set(&Globals
.szWorkgroup
, lp_workgroup());
4902 string_set(&Globals
.szPasswdProgram
, "");
4903 string_set(&Globals
.szLockDir
, get_dyn_LOCKDIR());
4904 string_set(&Globals
.szStateDir
, get_dyn_STATEDIR());
4905 string_set(&Globals
.szCacheDir
, get_dyn_CACHEDIR());
4906 string_set(&Globals
.szPidDir
, get_dyn_PIDDIR());
4907 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
4909 if (asprintf(&s
, "Samba %s", samba_version_string()) < 0) {
4910 smb_panic("init_globals: ENOMEM");
4912 string_set(&Globals
.szServerString
, s
);
4914 if (asprintf(&s
, "%d.%d", DEFAULT_MAJOR_VERSION
,
4915 DEFAULT_MINOR_VERSION
) < 0) {
4916 smb_panic("init_globals: ENOMEM");
4918 string_set(&Globals
.szAnnounceVersion
, s
);
4921 string_set(&Globals
.szPanicAction
, "/bin/sleep 999999999");
4924 string_set(&Globals
.szSocketOptions
, DEFAULT_SOCKET_OPTIONS
);
4926 string_set(&Globals
.szLogonDrive
, "");
4927 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
4928 string_set(&Globals
.szLogonHome
, "\\\\%N\\%U");
4929 string_set(&Globals
.szLogonPath
, "\\\\%N\\%U\\profile");
4931 string_set(&Globals
.szNameResolveOrder
, "lmhosts wins host bcast");
4932 string_set(&Globals
.szPasswordServer
, "*");
4934 Globals
.AlgorithmicRidBase
= BASE_RID
;
4936 Globals
.bLoadPrinters
= True
;
4937 Globals
.PrintcapCacheTime
= 750; /* 12.5 minutes */
4939 Globals
.ConfigBackend
= config_backend
;
4941 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
4942 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
4943 Globals
.max_xmit
= 0x4104;
4944 Globals
.max_mux
= 50; /* This is *needed* for profile support. */
4945 Globals
.lpqcachetime
= 30; /* changed to handle large print servers better -- jerry */
4946 Globals
.bDisableSpoolss
= False
;
4947 Globals
.iMaxSmbdProcesses
= 0;/* no limit specified */
4948 Globals
.pwordlevel
= 0;
4949 Globals
.unamelevel
= 0;
4950 Globals
.deadtime
= 0;
4951 Globals
.getwd_cache
= true;
4952 Globals
.bLargeReadwrite
= True
;
4953 Globals
.max_log_size
= 5000;
4954 Globals
.max_open_files
= max_open_files();
4955 Globals
.open_files_db_hash_size
= SMB_OPEN_DATABASE_TDB_HASH_SIZE
;
4956 Globals
.maxprotocol
= PROTOCOL_NT1
;
4957 Globals
.minprotocol
= PROTOCOL_CORE
;
4958 Globals
.security
= SEC_USER
;
4959 Globals
.paranoid_server_security
= True
;
4960 Globals
.bEncryptPasswords
= True
;
4961 Globals
.bUpdateEncrypt
= False
;
4962 Globals
.clientSchannel
= Auto
;
4963 Globals
.serverSchannel
= Auto
;
4964 Globals
.bReadRaw
= True
;
4965 Globals
.bWriteRaw
= True
;
4966 Globals
.bNullPasswords
= False
;
4967 Globals
.bObeyPamRestrictions
= False
;
4969 Globals
.bSyslogOnly
= False
;
4970 Globals
.bTimestampLogs
= True
;
4971 string_set(&Globals
.szLogLevel
, "0");
4972 Globals
.bDebugPrefixTimestamp
= False
;
4973 Globals
.bDebugHiresTimestamp
= False
;
4974 Globals
.bDebugPid
= False
;
4975 Globals
.bDebugUid
= False
;
4976 Globals
.bDebugClass
= False
;
4977 Globals
.bEnableCoreFiles
= True
;
4978 Globals
.max_ttl
= 60 * 60 * 24 * 3; /* 3 days default. */
4979 Globals
.max_wins_ttl
= 60 * 60 * 24 * 6; /* 6 days default. */
4980 Globals
.min_wins_ttl
= 60 * 60 * 6; /* 6 hours default. */
4981 Globals
.machine_password_timeout
= 60 * 60 * 24 * 7; /* 7 days default. */
4982 Globals
.lm_announce
= 2; /* = Auto: send only if LM clients found */
4983 Globals
.lm_interval
= 60;
4984 Globals
.announce_as
= ANNOUNCE_AS_NT_SERVER
;
4985 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
4986 Globals
.bNISHomeMap
= False
;
4987 #ifdef WITH_NISPLUS_HOME
4988 string_set(&Globals
.szNISHomeMapName
, "auto_home.org_dir");
4990 string_set(&Globals
.szNISHomeMapName
, "auto.home");
4993 Globals
.bTimeServer
= False
;
4994 Globals
.bBindInterfacesOnly
= False
;
4995 Globals
.bUnixPasswdSync
= False
;
4996 Globals
.bPamPasswordChange
= False
;
4997 Globals
.bPasswdChatDebug
= False
;
4998 Globals
.iPasswdChatTimeout
= 2; /* 2 second default. */
4999 Globals
.bNTPipeSupport
= True
; /* Do NT pipes by default. */
5000 Globals
.bNTStatusSupport
= True
; /* Use NT status by default. */
5001 Globals
.bStatCache
= True
; /* use stat cache by default */
5002 Globals
.iMaxStatCacheSize
= 256; /* 256k by default */
5003 Globals
.restrict_anonymous
= 0;
5004 Globals
.bClientLanManAuth
= False
; /* Do NOT use the LanMan hash if it is available */
5005 Globals
.bClientPlaintextAuth
= False
; /* Do NOT use a plaintext password even if is requested by the server */
5006 Globals
.bLanmanAuth
= False
; /* Do NOT use the LanMan hash, even if it is supplied */
5007 Globals
.bNTLMAuth
= True
; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
5008 Globals
.bClientNTLMv2Auth
= False
; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
5009 /* Note, that we will use NTLM2 session security (which is different), if it is available */
5011 Globals
.map_to_guest
= 0; /* By Default, "Never" */
5012 Globals
.oplock_break_wait_time
= 0; /* By Default, 0 msecs. */
5013 Globals
.enhanced_browsing
= true;
5014 Globals
.iLockSpinTime
= WINDOWS_MINIMUM_LOCK_TIMEOUT_MS
; /* msec. */
5015 #ifdef MMAP_BLACKLIST
5016 Globals
.bUseMmap
= False
;
5018 Globals
.bUseMmap
= True
;
5020 Globals
.bUnixExtensions
= True
;
5021 Globals
.bResetOnZeroVC
= False
;
5022 Globals
.bCreateKrb5Conf
= true;
5024 /* hostname lookups can be very expensive and are broken on
5025 a large number of sites (tridge) */
5026 Globals
.bHostnameLookups
= False
;
5028 string_set(&Globals
.szPassdbBackend
, "tdbsam");
5029 string_set(&Globals
.szLdapSuffix
, "");
5030 string_set(&Globals
.szLdapMachineSuffix
, "");
5031 string_set(&Globals
.szLdapUserSuffix
, "");
5032 string_set(&Globals
.szLdapGroupSuffix
, "");
5033 string_set(&Globals
.szLdapIdmapSuffix
, "");
5035 string_set(&Globals
.szLdapAdminDn
, "");
5036 Globals
.ldap_ssl
= LDAP_SSL_START_TLS
;
5037 Globals
.ldap_ssl_ads
= False
;
5038 Globals
.ldap_passwd_sync
= LDAP_PASSWD_SYNC_OFF
;
5039 Globals
.ldap_delete_dn
= False
;
5040 Globals
.ldap_replication_sleep
= 1000; /* wait 1 sec for replication */
5041 Globals
.ldap_timeout
= LDAP_DEFAULT_TIMEOUT
;
5042 Globals
.ldap_connection_timeout
= LDAP_CONNECTION_DEFAULT_TIMEOUT
;
5043 Globals
.ldap_page_size
= LDAP_PAGE_SIZE
;
5045 Globals
.ldap_debug_level
= 0;
5046 Globals
.ldap_debug_threshold
= 10;
5048 /* This is what we tell the afs client. in reality we set the token
5049 * to never expire, though, when this runs out the afs client will
5050 * forget the token. Set to 0 to get NEVERDATE.*/
5051 Globals
.iAfsTokenLifetime
= 604800;
5052 Globals
.cups_connection_timeout
= CUPS_DEFAULT_CONNECTION_TIMEOUT
;
5054 /* these parameters are set to defaults that are more appropriate
5055 for the increasing samba install base:
5057 as a member of the workgroup, that will possibly become a
5058 _local_ master browser (lm = True). this is opposed to a forced
5059 local master browser startup (pm = True).
5061 doesn't provide WINS server service by default (wsupp = False),
5062 and doesn't provide domain master browser services by default, either.
5066 Globals
.bMsAddPrinterWizard
= True
;
5067 Globals
.os_level
= 20;
5068 Globals
.bLocalMaster
= True
;
5069 Globals
.iDomainMaster
= Auto
; /* depending on bDomainLogons */
5070 Globals
.bDomainLogons
= False
;
5071 Globals
.bBrowseList
= True
;
5072 Globals
.bWINSsupport
= False
;
5073 Globals
.bWINSproxy
= False
;
5075 TALLOC_FREE(Globals
.szInitLogonDelayedHosts
);
5076 Globals
.InitLogonDelay
= 100; /* 100 ms default delay */
5078 Globals
.bDNSproxy
= True
;
5080 /* this just means to use them if they exist */
5081 Globals
.bKernelOplocks
= True
;
5083 Globals
.bAllowTrustedDomains
= True
;
5084 string_set(&Globals
.szIdmapBackend
, "tdb");
5086 string_set(&Globals
.szTemplateShell
, "/bin/false");
5087 string_set(&Globals
.szTemplateHomedir
, "/home/%D/%U");
5088 string_set(&Globals
.szWinbindSeparator
, "\\");
5090 string_set(&Globals
.szCupsServer
, "");
5091 string_set(&Globals
.szIPrintServer
, "");
5093 string_set(&Globals
.ctdbdSocket
, "");
5094 Globals
.szClusterAddresses
= NULL
;
5095 Globals
.clustering
= False
;
5097 Globals
.winbind_cache_time
= 300; /* 5 minutes */
5098 Globals
.winbind_reconnect_delay
= 30; /* 30 seconds */
5099 Globals
.bWinbindEnumUsers
= False
;
5100 Globals
.bWinbindEnumGroups
= False
;
5101 Globals
.bWinbindUseDefaultDomain
= False
;
5102 Globals
.bWinbindTrustedDomainsOnly
= False
;
5103 Globals
.bWinbindNestedGroups
= True
;
5104 Globals
.winbind_expand_groups
= 1;
5105 Globals
.szWinbindNssInfo
= str_list_make_v3(talloc_autofree_context(), "template", NULL
);
5106 Globals
.bWinbindRefreshTickets
= False
;
5107 Globals
.bWinbindOfflineLogon
= False
;
5109 Globals
.iIdmapCacheTime
= 86400 * 7; /* a week by default */
5110 Globals
.iIdmapNegativeCacheTime
= 120; /* 2 minutes by default */
5112 Globals
.bPassdbExpandExplicit
= False
;
5114 Globals
.name_cache_timeout
= 660; /* In seconds */
5116 Globals
.bUseSpnego
= True
;
5117 Globals
.bClientUseSpnego
= True
;
5119 Globals
.client_signing
= Auto
;
5120 Globals
.server_signing
= False
;
5122 Globals
.bDeferSharingViolations
= True
;
5123 string_set(&Globals
.smb_ports
, SMB_PORTS
);
5125 Globals
.bEnablePrivileges
= True
;
5126 Globals
.bHostMSDfs
= True
;
5127 Globals
.bASUSupport
= False
;
5129 /* User defined shares. */
5130 if (asprintf(&s
, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5131 smb_panic("init_globals: ENOMEM");
5133 string_set(&Globals
.szUsersharePath
, s
);
5135 string_set(&Globals
.szUsershareTemplateShare
, "");
5136 Globals
.iUsershareMaxShares
= 0;
5137 /* By default disallow sharing of directories not owned by the sharer. */
5138 Globals
.bUsershareOwnerOnly
= True
;
5139 /* By default disallow guest access to usershares. */
5140 Globals
.bUsershareAllowGuests
= False
;
5142 Globals
.iKeepalive
= DEFAULT_KEEPALIVE
;
5144 /* By default no shares out of the registry */
5145 Globals
.bRegistryShares
= False
;
5147 Globals
.iminreceivefile
= 0;
5149 Globals
.bMapUntrustedToDomain
= false;
5152 /*******************************************************************
5153 Convenience routine to grab string parameters into temporary memory
5154 and run standard_sub_basic on them. The buffers can be written to by
5155 callers without affecting the source string.
5156 ********************************************************************/
5158 static char *lp_string(const char *s
)
5161 TALLOC_CTX
*ctx
= talloc_tos();
5163 /* The follow debug is useful for tracking down memory problems
5164 especially if you have an inner loop that is calling a lp_*()
5165 function that returns a string. Perhaps this debug should be
5166 present all the time? */
5169 DEBUG(10, ("lp_string(%s)\n", s
));
5175 ret
= talloc_sub_basic(ctx
,
5176 get_current_username(),
5177 current_user_info
.domain
,
5179 if (trim_char(ret
, '\"', '\"')) {
5180 if (strchr(ret
,'\"') != NULL
) {
5182 ret
= talloc_sub_basic(ctx
,
5183 get_current_username(),
5184 current_user_info
.domain
,
5192 In this section all the functions that are used to access the
5193 parameters from the rest of the program are defined
5196 #define FN_GLOBAL_STRING(fn_name,ptr) \
5197 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
5198 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5199 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
5200 #define FN_GLOBAL_LIST(fn_name,ptr) \
5201 const char **fn_name(void) {return(*(const char ***)(ptr));}
5202 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5203 bool fn_name(void) {return(*(bool *)(ptr));}
5204 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5205 char fn_name(void) {return(*(char *)(ptr));}
5206 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5207 int fn_name(void) {return(*(int *)(ptr));}
5209 #define FN_LOCAL_STRING(fn_name,val) \
5210 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5211 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5212 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5213 #define FN_LOCAL_LIST(fn_name,val) \
5214 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5215 #define FN_LOCAL_BOOL(fn_name,val) \
5216 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5217 #define FN_LOCAL_INTEGER(fn_name,val) \
5218 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5220 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5221 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5222 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5223 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5224 #define FN_LOCAL_PARM_STRING(fn_name,val) \
5225 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));}
5226 #define FN_LOCAL_CHAR(fn_name,val) \
5227 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5229 FN_GLOBAL_STRING(lp_smb_ports
, &Globals
.smb_ports
)
5230 FN_GLOBAL_STRING(lp_dos_charset
, &Globals
.dos_charset
)
5231 FN_GLOBAL_STRING(lp_unix_charset
, &Globals
.unix_charset
)
5232 FN_GLOBAL_STRING(lp_display_charset
, &Globals
.display_charset
)
5233 FN_GLOBAL_STRING(lp_logfile
, &Globals
.szLogFile
)
5234 FN_GLOBAL_STRING(lp_configfile
, &Globals
.szConfigFile
)
5235 FN_GLOBAL_STRING(lp_smb_passwd_file
, &Globals
.szSMBPasswdFile
)
5236 FN_GLOBAL_STRING(lp_private_dir
, &Globals
.szPrivateDir
)
5237 FN_GLOBAL_STRING(lp_serverstring
, &Globals
.szServerString
)
5238 FN_GLOBAL_INTEGER(lp_printcap_cache_time
, &Globals
.PrintcapCacheTime
)
5239 FN_GLOBAL_STRING(lp_addport_cmd
, &Globals
.szAddPortCommand
)
5240 FN_GLOBAL_STRING(lp_enumports_cmd
, &Globals
.szEnumPortsCommand
)
5241 FN_GLOBAL_STRING(lp_addprinter_cmd
, &Globals
.szAddPrinterCommand
)
5242 FN_GLOBAL_STRING(lp_deleteprinter_cmd
, &Globals
.szDeletePrinterCommand
)
5243 FN_GLOBAL_STRING(lp_os2_driver_map
, &Globals
.szOs2DriverMap
)
5244 FN_GLOBAL_STRING(lp_lockdir
, &Globals
.szLockDir
)
5245 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5246 * build process or in smb.conf, we use that value. Otherwise they
5247 * default to the value of lp_lockdir(). */
5248 char *lp_statedir(void) {
5249 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5250 (strcmp(get_dyn_STATEDIR(), Globals
.szStateDir
) != 0))
5251 return(lp_string(*(char **)(&Globals
.szStateDir
) ?
5252 *(char **)(&Globals
.szStateDir
) : ""));
5254 return(lp_string(*(char **)(&Globals
.szLockDir
) ?
5255 *(char **)(&Globals
.szLockDir
) : ""));
5257 char *lp_cachedir(void) {
5258 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5259 (strcmp(get_dyn_CACHEDIR(), Globals
.szCacheDir
) != 0))
5260 return(lp_string(*(char **)(&Globals
.szCacheDir
) ?
5261 *(char **)(&Globals
.szCacheDir
) : ""));
5263 return(lp_string(*(char **)(&Globals
.szLockDir
) ?
5264 *(char **)(&Globals
.szLockDir
) : ""));
5266 FN_GLOBAL_STRING(lp_piddir
, &Globals
.szPidDir
)
5267 FN_GLOBAL_STRING(lp_mangling_method
, &Globals
.szManglingMethod
)
5268 FN_GLOBAL_INTEGER(lp_mangle_prefix
, &Globals
.mangle_prefix
)
5269 FN_GLOBAL_STRING(lp_utmpdir
, &Globals
.szUtmpDir
)
5270 FN_GLOBAL_STRING(lp_wtmpdir
, &Globals
.szWtmpDir
)
5271 FN_GLOBAL_BOOL(lp_utmp
, &Globals
.bUtmp
)
5272 FN_GLOBAL_STRING(lp_rootdir
, &Globals
.szRootdir
)
5273 FN_GLOBAL_STRING(lp_perfcount_module
, &Globals
.szSMBPerfcountModule
)
5274 FN_GLOBAL_STRING(lp_defaultservice
, &Globals
.szDefaultService
)
5275 FN_GLOBAL_STRING(lp_msg_command
, &Globals
.szMsgCommand
)
5276 FN_GLOBAL_STRING(lp_get_quota_command
, &Globals
.szGetQuota
)
5277 FN_GLOBAL_STRING(lp_set_quota_command
, &Globals
.szSetQuota
)
5278 FN_GLOBAL_STRING(lp_auto_services
, &Globals
.szAutoServices
)
5279 FN_GLOBAL_STRING(lp_passwd_program
, &Globals
.szPasswdProgram
)
5280 FN_GLOBAL_STRING(lp_passwd_chat
, &Globals
.szPasswdChat
)
5281 FN_GLOBAL_STRING(lp_passwordserver
, &Globals
.szPasswordServer
)
5282 FN_GLOBAL_STRING(lp_name_resolve_order
, &Globals
.szNameResolveOrder
)
5283 FN_GLOBAL_STRING(lp_realm
, &Globals
.szRealm
)
5284 FN_GLOBAL_CONST_STRING(lp_afs_username_map
, &Globals
.szAfsUsernameMap
)
5285 FN_GLOBAL_INTEGER(lp_afs_token_lifetime
, &Globals
.iAfsTokenLifetime
)
5286 FN_GLOBAL_STRING(lp_log_nt_token_command
, &Globals
.szLogNtTokenCommand
)
5287 FN_GLOBAL_STRING(lp_username_map
, &Globals
.szUsernameMap
)
5288 FN_GLOBAL_CONST_STRING(lp_logon_script
, &Globals
.szLogonScript
)
5289 FN_GLOBAL_CONST_STRING(lp_logon_path
, &Globals
.szLogonPath
)
5290 FN_GLOBAL_CONST_STRING(lp_logon_drive
, &Globals
.szLogonDrive
)
5291 FN_GLOBAL_CONST_STRING(lp_logon_home
, &Globals
.szLogonHome
)
5292 FN_GLOBAL_STRING(lp_remote_announce
, &Globals
.szRemoteAnnounce
)
5293 FN_GLOBAL_STRING(lp_remote_browse_sync
, &Globals
.szRemoteBrowseSync
)
5294 FN_GLOBAL_LIST(lp_wins_server_list
, &Globals
.szWINSservers
)
5295 FN_GLOBAL_LIST(lp_interfaces
, &Globals
.szInterfaces
)
5296 FN_GLOBAL_STRING(lp_nis_home_map_name
, &Globals
.szNISHomeMapName
)
5297 static FN_GLOBAL_STRING(lp_announce_version
, &Globals
.szAnnounceVersion
)
5298 FN_GLOBAL_LIST(lp_netbios_aliases
, &Globals
.szNetbiosAliases
)
5299 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
5300 * lp_passdb_backend() should be replace by the this macro again after
5303 const char *lp_passdb_backend(void)
5305 char *delim
, *quote
;
5307 delim
= strchr( Globals
.szPassdbBackend
, ' ');
5308 /* no space at all */
5309 if (delim
== NULL
) {
5313 quote
= strchr(Globals
.szPassdbBackend
, '"');
5314 /* no quote char or non in the first part */
5315 if (quote
== NULL
|| quote
> delim
) {
5320 quote
= strchr(quote
+1, '"');
5321 if (quote
== NULL
) {
5322 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
5324 } else if (*(quote
+1) == '\0') {
5325 /* space, fitting quote char, and one backend only */
5328 /* terminate string after the fitting quote char */
5333 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5334 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5335 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5336 "backend (%s) is used. The rest is ignored.\n", Globals
.szPassdbBackend
));
5339 return Globals
.szPassdbBackend
;
5341 FN_GLOBAL_LIST(lp_preload_modules
, &Globals
.szPreloadModules
)
5342 FN_GLOBAL_STRING(lp_panic_action
, &Globals
.szPanicAction
)
5343 FN_GLOBAL_STRING(lp_adduser_script
, &Globals
.szAddUserScript
)
5344 FN_GLOBAL_STRING(lp_renameuser_script
, &Globals
.szRenameUserScript
)
5345 FN_GLOBAL_STRING(lp_deluser_script
, &Globals
.szDelUserScript
)
5347 FN_GLOBAL_CONST_STRING(lp_guestaccount
, &Globals
.szGuestaccount
)
5348 FN_GLOBAL_STRING(lp_addgroup_script
, &Globals
.szAddGroupScript
)
5349 FN_GLOBAL_STRING(lp_delgroup_script
, &Globals
.szDelGroupScript
)
5350 FN_GLOBAL_STRING(lp_addusertogroup_script
, &Globals
.szAddUserToGroupScript
)
5351 FN_GLOBAL_STRING(lp_deluserfromgroup_script
, &Globals
.szDelUserFromGroupScript
)
5352 FN_GLOBAL_STRING(lp_setprimarygroup_script
, &Globals
.szSetPrimaryGroupScript
)
5354 FN_GLOBAL_STRING(lp_addmachine_script
, &Globals
.szAddMachineScript
)
5356 FN_GLOBAL_STRING(lp_shutdown_script
, &Globals
.szShutdownScript
)
5357 FN_GLOBAL_STRING(lp_abort_shutdown_script
, &Globals
.szAbortShutdownScript
)
5358 FN_GLOBAL_STRING(lp_username_map_script
, &Globals
.szUsernameMapScript
)
5360 FN_GLOBAL_STRING(lp_check_password_script
, &Globals
.szCheckPasswordScript
)
5362 FN_GLOBAL_STRING(lp_wins_hook
, &Globals
.szWINSHook
)
5363 FN_GLOBAL_CONST_STRING(lp_template_homedir
, &Globals
.szTemplateHomedir
)
5364 FN_GLOBAL_CONST_STRING(lp_template_shell
, &Globals
.szTemplateShell
)
5365 FN_GLOBAL_CONST_STRING(lp_winbind_separator
, &Globals
.szWinbindSeparator
)
5366 FN_GLOBAL_INTEGER(lp_acl_compatibility
, &Globals
.iAclCompat
)
5367 FN_GLOBAL_BOOL(lp_winbind_enum_users
, &Globals
.bWinbindEnumUsers
)
5368 FN_GLOBAL_BOOL(lp_winbind_enum_groups
, &Globals
.bWinbindEnumGroups
)
5369 FN_GLOBAL_BOOL(lp_winbind_use_default_domain
, &Globals
.bWinbindUseDefaultDomain
)
5370 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only
, &Globals
.bWinbindTrustedDomainsOnly
)
5371 FN_GLOBAL_BOOL(lp_winbind_nested_groups
, &Globals
.bWinbindNestedGroups
)
5372 FN_GLOBAL_INTEGER(lp_winbind_expand_groups
, &Globals
.winbind_expand_groups
)
5373 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets
, &Globals
.bWinbindRefreshTickets
)
5374 FN_GLOBAL_BOOL(lp_winbind_offline_logon
, &Globals
.bWinbindOfflineLogon
)
5375 FN_GLOBAL_BOOL(lp_winbind_normalize_names
, &Globals
.bWinbindNormalizeNames
)
5376 FN_GLOBAL_BOOL(lp_winbind_rpc_only
, &Globals
.bWinbindRpcOnly
)
5377 FN_GLOBAL_BOOL(lp_create_krb5_conf
, &Globals
.bCreateKrb5Conf
)
5379 FN_GLOBAL_CONST_STRING(lp_idmap_backend
, &Globals
.szIdmapBackend
)
5380 FN_GLOBAL_STRING(lp_idmap_alloc_backend
, &Globals
.szIdmapAllocBackend
)
5381 FN_GLOBAL_INTEGER(lp_idmap_cache_time
, &Globals
.iIdmapCacheTime
)
5382 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time
, &Globals
.iIdmapNegativeCacheTime
)
5383 FN_GLOBAL_INTEGER(lp_keepalive
, &Globals
.iKeepalive
)
5384 FN_GLOBAL_BOOL(lp_passdb_expand_explicit
, &Globals
.bPassdbExpandExplicit
)
5386 FN_GLOBAL_STRING(lp_ldap_suffix
, &Globals
.szLdapSuffix
)
5387 FN_GLOBAL_STRING(lp_ldap_admin_dn
, &Globals
.szLdapAdminDn
)
5388 FN_GLOBAL_INTEGER(lp_ldap_ssl
, &Globals
.ldap_ssl
)
5389 FN_GLOBAL_BOOL(lp_ldap_ssl_ads
, &Globals
.ldap_ssl_ads
)
5390 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync
, &Globals
.ldap_passwd_sync
)
5391 FN_GLOBAL_BOOL(lp_ldap_delete_dn
, &Globals
.ldap_delete_dn
)
5392 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep
, &Globals
.ldap_replication_sleep
)
5393 FN_GLOBAL_INTEGER(lp_ldap_timeout
, &Globals
.ldap_timeout
)
5394 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout
, &Globals
.ldap_connection_timeout
)
5395 FN_GLOBAL_INTEGER(lp_ldap_page_size
, &Globals
.ldap_page_size
)
5396 FN_GLOBAL_INTEGER(lp_ldap_debug_level
, &Globals
.ldap_debug_level
)
5397 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold
, &Globals
.ldap_debug_threshold
)
5398 FN_GLOBAL_STRING(lp_add_share_cmd
, &Globals
.szAddShareCommand
)
5399 FN_GLOBAL_STRING(lp_change_share_cmd
, &Globals
.szChangeShareCommand
)
5400 FN_GLOBAL_STRING(lp_delete_share_cmd
, &Globals
.szDeleteShareCommand
)
5401 FN_GLOBAL_STRING(lp_usershare_path
, &Globals
.szUsersharePath
)
5402 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list
, &Globals
.szUsersharePrefixAllowList
)
5403 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list
, &Globals
.szUsersharePrefixDenyList
)
5405 FN_GLOBAL_LIST(lp_eventlog_list
, &Globals
.szEventLogs
)
5407 FN_GLOBAL_BOOL(lp_registry_shares
, &Globals
.bRegistryShares
)
5408 FN_GLOBAL_BOOL(lp_usershare_allow_guests
, &Globals
.bUsershareAllowGuests
)
5409 FN_GLOBAL_BOOL(lp_usershare_owner_only
, &Globals
.bUsershareOwnerOnly
)
5410 FN_GLOBAL_BOOL(lp_disable_netbios
, &Globals
.bDisableNetbios
)
5411 FN_GLOBAL_BOOL(lp_reset_on_zero_vc
, &Globals
.bResetOnZeroVC
)
5412 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard
, &Globals
.bMsAddPrinterWizard
)
5413 FN_GLOBAL_BOOL(lp_dns_proxy
, &Globals
.bDNSproxy
)
5414 FN_GLOBAL_BOOL(lp_wins_support
, &Globals
.bWINSsupport
)
5415 FN_GLOBAL_BOOL(lp_we_are_a_wins_server
, &Globals
.bWINSsupport
)
5416 FN_GLOBAL_BOOL(lp_wins_proxy
, &Globals
.bWINSproxy
)
5417 FN_GLOBAL_BOOL(lp_local_master
, &Globals
.bLocalMaster
)
5418 FN_GLOBAL_BOOL(lp_domain_logons
, &Globals
.bDomainLogons
)
5419 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts
, &Globals
.szInitLogonDelayedHosts
)
5420 FN_GLOBAL_INTEGER(lp_init_logon_delay
, &Globals
.InitLogonDelay
)
5421 FN_GLOBAL_BOOL(lp_load_printers
, &Globals
.bLoadPrinters
)
5422 FN_GLOBAL_BOOL(lp_readraw
, &Globals
.bReadRaw
)
5423 FN_GLOBAL_BOOL(lp_large_readwrite
, &Globals
.bLargeReadwrite
)
5424 FN_GLOBAL_BOOL(lp_writeraw
, &Globals
.bWriteRaw
)
5425 FN_GLOBAL_BOOL(lp_null_passwords
, &Globals
.bNullPasswords
)
5426 FN_GLOBAL_BOOL(lp_obey_pam_restrictions
, &Globals
.bObeyPamRestrictions
)
5427 FN_GLOBAL_BOOL(lp_encrypted_passwords
, &Globals
.bEncryptPasswords
)
5428 FN_GLOBAL_BOOL(lp_update_encrypted
, &Globals
.bUpdateEncrypt
)
5429 FN_GLOBAL_INTEGER(lp_client_schannel
, &Globals
.clientSchannel
)
5430 FN_GLOBAL_INTEGER(lp_server_schannel
, &Globals
.serverSchannel
)
5431 FN_GLOBAL_BOOL(lp_syslog_only
, &Globals
.bSyslogOnly
)
5432 FN_GLOBAL_BOOL(lp_timestamp_logs
, &Globals
.bTimestampLogs
)
5433 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp
, &Globals
.bDebugPrefixTimestamp
)
5434 FN_GLOBAL_BOOL(lp_debug_hires_timestamp
, &Globals
.bDebugHiresTimestamp
)
5435 FN_GLOBAL_BOOL(lp_debug_pid
, &Globals
.bDebugPid
)
5436 FN_GLOBAL_BOOL(lp_debug_uid
, &Globals
.bDebugUid
)
5437 FN_GLOBAL_BOOL(lp_debug_class
, &Globals
.bDebugClass
)
5438 FN_GLOBAL_BOOL(lp_enable_core_files
, &Globals
.bEnableCoreFiles
)
5439 FN_GLOBAL_BOOL(lp_browse_list
, &Globals
.bBrowseList
)
5440 FN_GLOBAL_BOOL(lp_nis_home_map
, &Globals
.bNISHomeMap
)
5441 static FN_GLOBAL_BOOL(lp_time_server
, &Globals
.bTimeServer
)
5442 FN_GLOBAL_BOOL(lp_bind_interfaces_only
, &Globals
.bBindInterfacesOnly
)
5443 FN_GLOBAL_BOOL(lp_pam_password_change
, &Globals
.bPamPasswordChange
)
5444 FN_GLOBAL_BOOL(lp_unix_password_sync
, &Globals
.bUnixPasswdSync
)
5445 FN_GLOBAL_BOOL(lp_passwd_chat_debug
, &Globals
.bPasswdChatDebug
)
5446 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout
, &Globals
.iPasswdChatTimeout
)
5447 FN_GLOBAL_BOOL(lp_nt_pipe_support
, &Globals
.bNTPipeSupport
)
5448 FN_GLOBAL_BOOL(lp_nt_status_support
, &Globals
.bNTStatusSupport
)
5449 FN_GLOBAL_BOOL(lp_stat_cache
, &Globals
.bStatCache
)
5450 FN_GLOBAL_INTEGER(lp_max_stat_cache_size
, &Globals
.iMaxStatCacheSize
)
5451 FN_GLOBAL_BOOL(lp_allow_trusted_domains
, &Globals
.bAllowTrustedDomains
)
5452 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain
, &Globals
.bMapUntrustedToDomain
)
5453 FN_GLOBAL_INTEGER(lp_restrict_anonymous
, &Globals
.restrict_anonymous
)
5454 FN_GLOBAL_BOOL(lp_lanman_auth
, &Globals
.bLanmanAuth
)
5455 FN_GLOBAL_BOOL(lp_ntlm_auth
, &Globals
.bNTLMAuth
)
5456 FN_GLOBAL_BOOL(lp_client_plaintext_auth
, &Globals
.bClientPlaintextAuth
)
5457 FN_GLOBAL_BOOL(lp_client_lanman_auth
, &Globals
.bClientLanManAuth
)
5458 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth
, &Globals
.bClientNTLMv2Auth
)
5459 FN_GLOBAL_BOOL(lp_host_msdfs
, &Globals
.bHostMSDfs
)
5460 FN_GLOBAL_BOOL(lp_kernel_oplocks
, &Globals
.bKernelOplocks
)
5461 FN_GLOBAL_BOOL(lp_enhanced_browsing
, &Globals
.enhanced_browsing
)
5462 FN_GLOBAL_BOOL(lp_use_mmap
, &Globals
.bUseMmap
)
5463 FN_GLOBAL_BOOL(lp_unix_extensions
, &Globals
.bUnixExtensions
)
5464 FN_GLOBAL_BOOL(lp_use_spnego
, &Globals
.bUseSpnego
)
5465 FN_GLOBAL_BOOL(lp_client_use_spnego
, &Globals
.bClientUseSpnego
)
5466 FN_GLOBAL_BOOL(lp_hostname_lookups
, &Globals
.bHostnameLookups
)
5467 FN_LOCAL_PARM_BOOL(lp_change_notify
, bChangeNotify
)
5468 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify
, bKernelChangeNotify
)
5469 FN_GLOBAL_STRING(lp_dedicated_keytab_file
, &Globals
.szDedicatedKeytabFile
)
5470 FN_GLOBAL_INTEGER(lp_kerberos_method
, &Globals
.iKerberosMethod
)
5471 FN_GLOBAL_BOOL(lp_defer_sharing_violations
, &Globals
.bDeferSharingViolations
)
5472 FN_GLOBAL_BOOL(lp_enable_privileges
, &Globals
.bEnablePrivileges
)
5473 FN_GLOBAL_BOOL(lp_enable_asu_support
, &Globals
.bASUSupport
)
5474 FN_GLOBAL_INTEGER(lp_os_level
, &Globals
.os_level
)
5475 FN_GLOBAL_INTEGER(lp_max_ttl
, &Globals
.max_ttl
)
5476 FN_GLOBAL_INTEGER(lp_max_wins_ttl
, &Globals
.max_wins_ttl
)
5477 FN_GLOBAL_INTEGER(lp_min_wins_ttl
, &Globals
.min_wins_ttl
)
5478 FN_GLOBAL_INTEGER(lp_max_log_size
, &Globals
.max_log_size
)
5479 FN_GLOBAL_INTEGER(lp_max_open_files
, &Globals
.max_open_files
)
5480 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size
, &Globals
.open_files_db_hash_size
)
5481 FN_GLOBAL_INTEGER(lp_maxxmit
, &Globals
.max_xmit
)
5482 FN_GLOBAL_INTEGER(lp_maxmux
, &Globals
.max_mux
)
5483 FN_GLOBAL_INTEGER(lp_passwordlevel
, &Globals
.pwordlevel
)
5484 FN_GLOBAL_INTEGER(lp_usernamelevel
, &Globals
.unamelevel
)
5485 FN_GLOBAL_INTEGER(lp_deadtime
, &Globals
.deadtime
)
5486 FN_GLOBAL_BOOL(lp_getwd_cache
, &Globals
.getwd_cache
)
5487 FN_GLOBAL_INTEGER(lp_maxprotocol
, &Globals
.maxprotocol
)
5488 FN_GLOBAL_INTEGER(lp_minprotocol
, &Globals
.minprotocol
)
5489 FN_GLOBAL_INTEGER(lp_security
, &Globals
.security
)
5490 FN_GLOBAL_LIST(lp_auth_methods
, &Globals
.AuthMethods
)
5491 FN_GLOBAL_BOOL(lp_paranoid_server_security
, &Globals
.paranoid_server_security
)
5492 FN_GLOBAL_INTEGER(lp_maxdisksize
, &Globals
.maxdisksize
)
5493 FN_GLOBAL_INTEGER(lp_lpqcachetime
, &Globals
.lpqcachetime
)
5494 FN_GLOBAL_INTEGER(lp_max_smbd_processes
, &Globals
.iMaxSmbdProcesses
)
5495 FN_GLOBAL_BOOL(_lp_disable_spoolss
, &Globals
.bDisableSpoolss
)
5496 FN_GLOBAL_INTEGER(lp_syslog
, &Globals
.syslog
)
5497 static FN_GLOBAL_INTEGER(lp_announce_as
, &Globals
.announce_as
)
5498 FN_GLOBAL_INTEGER(lp_lm_announce
, &Globals
.lm_announce
)
5499 FN_GLOBAL_INTEGER(lp_lm_interval
, &Globals
.lm_interval
)
5500 FN_GLOBAL_INTEGER(lp_machine_password_timeout
, &Globals
.machine_password_timeout
)
5501 FN_GLOBAL_INTEGER(lp_map_to_guest
, &Globals
.map_to_guest
)
5502 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time
, &Globals
.oplock_break_wait_time
)
5503 FN_GLOBAL_INTEGER(lp_lock_spin_time
, &Globals
.iLockSpinTime
)
5504 FN_GLOBAL_INTEGER(lp_usershare_max_shares
, &Globals
.iUsershareMaxShares
)
5505 FN_GLOBAL_CONST_STRING(lp_socket_options
, &Globals
.szSocketOptions
)
5506 FN_GLOBAL_INTEGER(lp_config_backend
, &Globals
.ConfigBackend
)
5508 FN_LOCAL_STRING(lp_preexec
, szPreExec
)
5509 FN_LOCAL_STRING(lp_postexec
, szPostExec
)
5510 FN_LOCAL_STRING(lp_rootpreexec
, szRootPreExec
)
5511 FN_LOCAL_STRING(lp_rootpostexec
, szRootPostExec
)
5512 FN_LOCAL_STRING(lp_servicename
, szService
)
5513 FN_LOCAL_CONST_STRING(lp_const_servicename
, szService
)
5514 FN_LOCAL_STRING(lp_pathname
, szPath
)
5515 FN_LOCAL_STRING(lp_dontdescend
, szDontdescend
)
5516 FN_LOCAL_STRING(lp_username
, szUsername
)
5517 FN_LOCAL_LIST(lp_invalid_users
, szInvalidUsers
)
5518 FN_LOCAL_LIST(lp_valid_users
, szValidUsers
)
5519 FN_LOCAL_LIST(lp_admin_users
, szAdminUsers
)
5520 FN_GLOBAL_LIST(lp_svcctl_list
, &Globals
.szServicesList
)
5521 FN_LOCAL_STRING(lp_cups_options
, szCupsOptions
)
5522 FN_GLOBAL_STRING(lp_cups_server
, &Globals
.szCupsServer
)
5523 int lp_cups_encrypt(void)
5525 #ifdef HAVE_HTTPCONNECTENCRYPT
5526 switch (Globals
.CupsEncrypt
) {
5528 Globals
.CupsEncrypt
= HTTP_ENCRYPT_REQUIRED
;
5531 Globals
.CupsEncrypt
= HTTP_ENCRYPT_ALWAYS
;
5534 Globals
.CupsEncrypt
= HTTP_ENCRYPT_NEVER
;
5538 return Globals
.CupsEncrypt
;
5540 FN_GLOBAL_STRING(lp_iprint_server
, &Globals
.szIPrintServer
)
5541 FN_GLOBAL_INTEGER(lp_cups_connection_timeout
, &Globals
.cups_connection_timeout
)
5542 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket
, &Globals
.ctdbdSocket
)
5543 FN_GLOBAL_LIST(lp_cluster_addresses
, &Globals
.szClusterAddresses
)
5544 FN_GLOBAL_BOOL(lp_clustering
, &Globals
.clustering
)
5545 FN_LOCAL_STRING(lp_printcommand
, szPrintcommand
)
5546 FN_LOCAL_STRING(lp_lpqcommand
, szLpqcommand
)
5547 FN_LOCAL_STRING(lp_lprmcommand
, szLprmcommand
)
5548 FN_LOCAL_STRING(lp_lppausecommand
, szLppausecommand
)
5549 FN_LOCAL_STRING(lp_lpresumecommand
, szLpresumecommand
)
5550 FN_LOCAL_STRING(lp_queuepausecommand
, szQueuepausecommand
)
5551 FN_LOCAL_STRING(lp_queueresumecommand
, szQueueresumecommand
)
5552 static FN_LOCAL_STRING(_lp_printername
, szPrintername
)
5553 FN_LOCAL_CONST_STRING(lp_printjob_username
, szPrintjobUsername
)
5554 FN_LOCAL_LIST(lp_hostsallow
, szHostsallow
)
5555 FN_LOCAL_LIST(lp_hostsdeny
, szHostsdeny
)
5556 FN_LOCAL_STRING(lp_magicscript
, szMagicScript
)
5557 FN_LOCAL_STRING(lp_magicoutput
, szMagicOutput
)
5558 FN_LOCAL_STRING(lp_comment
, comment
)
5559 FN_LOCAL_STRING(lp_force_user
, force_user
)
5560 FN_LOCAL_STRING(lp_force_group
, force_group
)
5561 FN_LOCAL_LIST(lp_readlist
, readlist
)
5562 FN_LOCAL_LIST(lp_writelist
, writelist
)
5563 FN_LOCAL_LIST(lp_printer_admin
, printer_admin
)
5564 FN_LOCAL_STRING(lp_fstype
, fstype
)
5565 FN_LOCAL_LIST(lp_vfs_objects
, szVfsObjects
)
5566 FN_LOCAL_STRING(lp_msdfs_proxy
, szMSDfsProxy
)
5567 static FN_LOCAL_STRING(lp_volume
, volume
)
5568 FN_LOCAL_STRING(lp_veto_files
, szVetoFiles
)
5569 FN_LOCAL_STRING(lp_hide_files
, szHideFiles
)
5570 FN_LOCAL_STRING(lp_veto_oplocks
, szVetoOplockFiles
)
5571 FN_LOCAL_BOOL(lp_msdfs_root
, bMSDfsRoot
)
5572 FN_LOCAL_STRING(lp_aio_write_behind
, szAioWriteBehind
)
5573 FN_LOCAL_STRING(lp_dfree_command
, szDfree
)
5574 FN_LOCAL_BOOL(lp_autoloaded
, autoloaded
)
5575 FN_LOCAL_BOOL(lp_preexec_close
, bPreexecClose
)
5576 FN_LOCAL_BOOL(lp_rootpreexec_close
, bRootpreexecClose
)
5577 FN_LOCAL_INTEGER(lp_casesensitive
, iCaseSensitive
)
5578 FN_LOCAL_BOOL(lp_preservecase
, bCasePreserve
)
5579 FN_LOCAL_BOOL(lp_shortpreservecase
, bShortCasePreserve
)
5580 FN_LOCAL_BOOL(lp_hide_dot_files
, bHideDotFiles
)
5581 FN_LOCAL_BOOL(lp_hide_special_files
, bHideSpecialFiles
)
5582 FN_LOCAL_BOOL(lp_hideunreadable
, bHideUnReadable
)
5583 FN_LOCAL_BOOL(lp_hideunwriteable_files
, bHideUnWriteableFiles
)
5584 FN_LOCAL_BOOL(lp_browseable
, bBrowseable
)
5585 FN_LOCAL_BOOL(lp_access_based_share_enum
, bAccessBasedShareEnum
)
5586 FN_LOCAL_BOOL(lp_readonly
, bRead_only
)
5587 FN_LOCAL_BOOL(lp_no_set_dir
, bNo_set_dir
)
5588 FN_LOCAL_BOOL(lp_guest_ok
, bGuest_ok
)
5589 FN_LOCAL_BOOL(lp_guest_only
, bGuest_only
)
5590 FN_LOCAL_BOOL(lp_administrative_share
, bAdministrative_share
)
5591 FN_LOCAL_BOOL(lp_print_ok
, bPrint_ok
)
5592 FN_LOCAL_BOOL(lp_map_hidden
, bMap_hidden
)
5593 FN_LOCAL_BOOL(lp_map_archive
, bMap_archive
)
5594 FN_LOCAL_BOOL(lp_store_create_time
, bStoreCreateTime
)
5595 FN_LOCAL_BOOL(lp_store_dos_attributes
, bStoreDosAttributes
)
5596 FN_LOCAL_BOOL(lp_dmapi_support
, bDmapiSupport
)
5597 FN_LOCAL_PARM_BOOL(lp_locking
, bLocking
)
5598 FN_LOCAL_PARM_INTEGER(lp_strict_locking
, iStrictLocking
)
5599 FN_LOCAL_PARM_BOOL(lp_posix_locking
, bPosixLocking
)
5600 FN_LOCAL_BOOL(lp_share_modes
, bShareModes
)
5601 FN_LOCAL_BOOL(lp_oplocks
, bOpLocks
)
5602 FN_LOCAL_BOOL(lp_level2_oplocks
, bLevel2OpLocks
)
5603 FN_LOCAL_BOOL(lp_onlyuser
, bOnlyUser
)
5604 FN_LOCAL_PARM_BOOL(lp_manglednames
, bMangledNames
)
5605 FN_LOCAL_BOOL(lp_widelinks
, bWidelinks
)
5606 FN_LOCAL_BOOL(lp_symlinks
, bSymlinks
)
5607 FN_LOCAL_BOOL(lp_syncalways
, bSyncAlways
)
5608 FN_LOCAL_BOOL(lp_strict_allocate
, bStrictAllocate
)
5609 FN_LOCAL_BOOL(lp_strict_sync
, bStrictSync
)
5610 FN_LOCAL_BOOL(lp_map_system
, bMap_system
)
5611 FN_LOCAL_BOOL(lp_delete_readonly
, bDeleteReadonly
)
5612 FN_LOCAL_BOOL(lp_fake_oplocks
, bFakeOplocks
)
5613 FN_LOCAL_BOOL(lp_recursive_veto_delete
, bDeleteVetoFiles
)
5614 FN_LOCAL_BOOL(lp_dos_filemode
, bDosFilemode
)
5615 FN_LOCAL_BOOL(lp_dos_filetimes
, bDosFiletimes
)
5616 FN_LOCAL_BOOL(lp_dos_filetime_resolution
, bDosFiletimeResolution
)
5617 FN_GLOBAL_BOOL(lp_fake_dir_create_times
, &Globals
.bFakeDirCreateTimes
)
5618 FN_LOCAL_BOOL(lp_blocking_locks
, bBlockingLocks
)
5619 FN_LOCAL_BOOL(lp_inherit_perms
, bInheritPerms
)
5620 FN_LOCAL_BOOL(lp_inherit_acls
, bInheritACLS
)
5621 FN_LOCAL_BOOL(lp_inherit_owner
, bInheritOwner
)
5622 FN_LOCAL_BOOL(lp_use_client_driver
, bUseClientDriver
)
5623 FN_LOCAL_BOOL(lp_default_devmode
, bDefaultDevmode
)
5624 FN_LOCAL_BOOL(lp_force_printername
, bForcePrintername
)
5625 FN_LOCAL_BOOL(lp_nt_acl_support
, bNTAclSupport
)
5626 FN_LOCAL_BOOL(lp_force_unknown_acl_user
, bForceUnknownAclUser
)
5627 FN_LOCAL_BOOL(lp_ea_support
, bEASupport
)
5628 FN_LOCAL_BOOL(_lp_use_sendfile
, bUseSendfile
)
5629 FN_LOCAL_BOOL(lp_profile_acls
, bProfileAcls
)
5630 FN_LOCAL_BOOL(lp_map_acl_inherit
, bMap_acl_inherit
)
5631 FN_LOCAL_BOOL(lp_afs_share
, bAfs_Share
)
5632 FN_LOCAL_BOOL(lp_acl_check_permissions
, bAclCheckPermissions
)
5633 FN_LOCAL_BOOL(lp_acl_group_control
, bAclGroupControl
)
5634 FN_LOCAL_BOOL(lp_acl_map_full_control
, bAclMapFullControl
)
5635 FN_LOCAL_INTEGER(lp_create_mask
, iCreate_mask
)
5636 FN_LOCAL_INTEGER(lp_force_create_mode
, iCreate_force_mode
)
5637 FN_LOCAL_INTEGER(lp_security_mask
, iSecurity_mask
)
5638 FN_LOCAL_INTEGER(lp_force_security_mode
, iSecurity_force_mode
)
5639 FN_LOCAL_INTEGER(lp_dir_mask
, iDir_mask
)
5640 FN_LOCAL_INTEGER(lp_force_dir_mode
, iDir_force_mode
)
5641 FN_LOCAL_INTEGER(lp_dir_security_mask
, iDir_Security_mask
)
5642 FN_LOCAL_INTEGER(lp_force_dir_security_mode
, iDir_Security_force_mode
)
5643 FN_LOCAL_INTEGER(lp_max_connections
, iMaxConnections
)
5644 FN_LOCAL_INTEGER(lp_defaultcase
, iDefaultCase
)
5645 FN_LOCAL_INTEGER(lp_minprintspace
, iMinPrintSpace
)
5646 FN_LOCAL_INTEGER(lp_printing
, iPrinting
)
5647 FN_LOCAL_INTEGER(lp_max_reported_jobs
, iMaxReportedPrintJobs
)
5648 FN_LOCAL_INTEGER(lp_oplock_contention_limit
, iOplockContentionLimit
)
5649 FN_LOCAL_INTEGER(lp_csc_policy
, iCSCPolicy
)
5650 FN_LOCAL_INTEGER(lp_write_cache_size
, iWriteCacheSize
)
5651 FN_LOCAL_INTEGER(lp_block_size
, iBlock_size
)
5652 FN_LOCAL_INTEGER(lp_dfree_cache_time
, iDfreeCacheTime
)
5653 FN_LOCAL_INTEGER(lp_allocation_roundup_size
, iallocation_roundup_size
)
5654 FN_LOCAL_INTEGER(lp_aio_read_size
, iAioReadSize
)
5655 FN_LOCAL_INTEGER(lp_aio_write_size
, iAioWriteSize
)
5656 FN_LOCAL_INTEGER(lp_map_readonly
, iMap_readonly
)
5657 FN_LOCAL_INTEGER(lp_directory_name_cache_size
, iDirectoryNameCacheSize
)
5658 FN_LOCAL_INTEGER(lp_smb_encrypt
, ismb_encrypt
)
5659 FN_LOCAL_CHAR(lp_magicchar
, magic_char
)
5660 FN_GLOBAL_INTEGER(lp_winbind_cache_time
, &Globals
.winbind_cache_time
)
5661 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay
, &Globals
.winbind_reconnect_delay
)
5662 FN_GLOBAL_LIST(lp_winbind_nss_info
, &Globals
.szWinbindNssInfo
)
5663 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base
, &Globals
.AlgorithmicRidBase
)
5664 FN_GLOBAL_INTEGER(lp_name_cache_timeout
, &Globals
.name_cache_timeout
)
5665 FN_GLOBAL_INTEGER(lp_client_signing
, &Globals
.client_signing
)
5666 FN_GLOBAL_INTEGER(lp_server_signing
, &Globals
.server_signing
)
5667 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping
, &Globals
.client_ldap_sasl_wrapping
)
5669 /* local prototypes */
5671 static int map_parameter(const char *pszParmName
);
5672 static int map_parameter_canonical(const char *pszParmName
, bool *inverse
);
5673 static const char *get_boolean(bool bool_value
);
5674 static int getservicebyname(const char *pszServiceName
,
5675 struct service
*pserviceDest
);
5676 static void copy_service(struct service
*pserviceDest
,
5677 struct service
*pserviceSource
,
5678 struct bitmap
*pcopymapDest
);
5679 static bool do_parameter(const char *pszParmName
, const char *pszParmValue
,
5681 static bool do_section(const char *pszSectionName
, void *userdata
);
5682 static void init_copymap(struct service
*pservice
);
5683 static bool hash_a_service(const char *name
, int number
);
5684 static void free_service_byindex(int iService
);
5685 static void free_param_opts(struct param_opt_struct
**popts
);
5686 static char * canonicalize_servicename(const char *name
);
5687 static void show_parameter(int parmIndex
);
5688 static bool is_synonym_of(int parm1
, int parm2
, bool *inverse
);
5691 * This is a helper function for parametrical options support. It returns a
5692 * pointer to parametrical option value if it exists or NULL otherwise. Actual
5693 * parametrical functions are quite simple
5695 static struct param_opt_struct
*get_parametrics(int snum
, const char *type
,
5698 bool global_section
= False
;
5700 struct param_opt_struct
*data
;
5702 if (snum
>= iNumServices
) return NULL
;
5705 data
= Globals
.param_opt
;
5706 global_section
= True
;
5708 data
= ServicePtrs
[snum
]->param_opt
;
5711 if (asprintf(¶m_key
, "%s:%s", type
, option
) == -1) {
5712 DEBUG(0,("asprintf failed!\n"));
5717 if (strwicmp(data
->key
, param_key
) == 0) {
5718 string_free(¶m_key
);
5724 if (!global_section
) {
5725 /* Try to fetch the same option but from globals */
5726 /* but only if we are not already working with Globals */
5727 data
= Globals
.param_opt
;
5729 if (strwicmp(data
->key
, param_key
) == 0) {
5730 string_free(¶m_key
);
5737 string_free(¶m_key
);
5743 #define MISSING_PARAMETER(name) \
5744 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
5746 /*******************************************************************
5747 convenience routine to return int parameters.
5748 ********************************************************************/
5749 static int lp_int(const char *s
)
5753 MISSING_PARAMETER(lp_int
);
5757 return (int)strtol(s
, NULL
, 0);
5760 /*******************************************************************
5761 convenience routine to return unsigned long parameters.
5762 ********************************************************************/
5763 static unsigned long lp_ulong(const char *s
)
5767 MISSING_PARAMETER(lp_ulong
);
5771 return strtoul(s
, NULL
, 0);
5774 /*******************************************************************
5775 convenience routine to return boolean parameters.
5776 ********************************************************************/
5777 static bool lp_bool(const char *s
)
5782 MISSING_PARAMETER(lp_bool
);
5786 if (!set_boolean(s
, &ret
)) {
5787 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s
));
5794 /*******************************************************************
5795 convenience routine to return enum parameters.
5796 ********************************************************************/
5797 static int lp_enum(const char *s
,const struct enum_list
*_enum
)
5801 if (!s
|| !*s
|| !_enum
) {
5802 MISSING_PARAMETER(lp_enum
);
5806 for (i
=0; _enum
[i
].name
; i
++) {
5807 if (strequal(_enum
[i
].name
,s
))
5808 return _enum
[i
].value
;
5811 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s
));
5815 #undef MISSING_PARAMETER
5817 /* DO NOT USE lp_parm_string ANYMORE!!!!
5818 * use lp_parm_const_string or lp_parm_talloc_string
5820 * lp_parm_string is only used to let old modules find this symbol
5822 #undef lp_parm_string
5823 char *lp_parm_string(const char *servicename
, const char *type
, const char *option
);
5824 char *lp_parm_string(const char *servicename
, const char *type
, const char *option
)
5826 return lp_parm_talloc_string(lp_servicenumber(servicename
), type
, option
, NULL
);
5829 /* Return parametric option from a given service. Type is a part of option before ':' */
5830 /* Parametric option has following syntax: 'Type: option = value' */
5831 /* the returned value is talloced on the talloc_tos() */
5832 char *lp_parm_talloc_string(int snum
, const char *type
, const char *option
, const char *def
)
5834 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5836 if (data
== NULL
||data
->value
==NULL
) {
5838 return lp_string(def
);
5844 return lp_string(data
->value
);
5847 /* Return parametric option from a given service. Type is a part of option before ':' */
5848 /* Parametric option has following syntax: 'Type: option = value' */
5849 const char *lp_parm_const_string(int snum
, const char *type
, const char *option
, const char *def
)
5851 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5853 if (data
== NULL
||data
->value
==NULL
)
5859 /* Return parametric option from a given service. Type is a part of option before ':' */
5860 /* Parametric option has following syntax: 'Type: option = value' */
5862 const char **lp_parm_string_list(int snum
, const char *type
, const char *option
, const char **def
)
5864 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5866 if (data
== NULL
||data
->value
==NULL
)
5867 return (const char **)def
;
5869 if (data
->list
==NULL
) {
5870 data
->list
= str_list_make_v3(talloc_autofree_context(), data
->value
, NULL
);
5873 return (const char **)data
->list
;
5876 /* Return parametric option from a given service. Type is a part of option before ':' */
5877 /* Parametric option has following syntax: 'Type: option = value' */
5879 int lp_parm_int(int snum
, const char *type
, const char *option
, int def
)
5881 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5883 if (data
&& data
->value
&& *data
->value
)
5884 return lp_int(data
->value
);
5889 /* Return parametric option from a given service. Type is a part of option before ':' */
5890 /* Parametric option has following syntax: 'Type: option = value' */
5892 unsigned long lp_parm_ulong(int snum
, const char *type
, const char *option
, unsigned long def
)
5894 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5896 if (data
&& data
->value
&& *data
->value
)
5897 return lp_ulong(data
->value
);
5902 /* Return parametric option from a given service. Type is a part of option before ':' */
5903 /* Parametric option has following syntax: 'Type: option = value' */
5905 bool lp_parm_bool(int snum
, const char *type
, const char *option
, bool def
)
5907 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5909 if (data
&& data
->value
&& *data
->value
)
5910 return lp_bool(data
->value
);
5915 /* Return parametric option from a given service. Type is a part of option before ':' */
5916 /* Parametric option has following syntax: 'Type: option = value' */
5918 int lp_parm_enum(int snum
, const char *type
, const char *option
,
5919 const struct enum_list
*_enum
, int def
)
5921 struct param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5923 if (data
&& data
->value
&& *data
->value
&& _enum
)
5924 return lp_enum(data
->value
, _enum
);
5930 /***************************************************************************
5931 Initialise a service to the defaults.
5932 ***************************************************************************/
5934 static void init_service(struct service
*pservice
)
5936 memset((char *)pservice
, '\0', sizeof(struct service
));
5937 copy_service(pservice
, &sDefault
, NULL
);
5942 * free a param_opts structure.
5943 * param_opts handling should be moved to talloc;
5944 * then this whole functions reduces to a TALLOC_FREE().
5947 static void free_param_opts(struct param_opt_struct
**popts
)
5949 struct param_opt_struct
*opt
, *next_opt
;
5951 if (popts
== NULL
) {
5955 if (*popts
!= NULL
) {
5956 DEBUG(5, ("Freeing parametrics:\n"));
5959 while (opt
!= NULL
) {
5960 string_free(&opt
->key
);
5961 string_free(&opt
->value
);
5962 TALLOC_FREE(opt
->list
);
5963 next_opt
= opt
->next
;
5970 /***************************************************************************
5971 Free the dynamically allocated parts of a service struct.
5972 ***************************************************************************/
5974 static void free_service(struct service
*pservice
)
5979 if (pservice
->szService
)
5980 DEBUG(5, ("free_service: Freeing service %s\n",
5981 pservice
->szService
));
5983 free_parameters(pservice
);
5985 string_free(&pservice
->szService
);
5986 bitmap_free(pservice
->copymap
);
5988 free_param_opts(&pservice
->param_opt
);
5990 ZERO_STRUCTP(pservice
);
5994 /***************************************************************************
5995 remove a service indexed in the ServicePtrs array from the ServiceHash
5996 and free the dynamically allocated parts
5997 ***************************************************************************/
5999 static void free_service_byindex(int idx
)
6001 if ( !LP_SNUM_OK(idx
) )
6004 ServicePtrs
[idx
]->valid
= False
;
6005 invalid_services
[num_invalid_services
++] = idx
;
6007 /* we have to cleanup the hash record */
6009 if (ServicePtrs
[idx
]->szService
) {
6010 char *canon_name
= canonicalize_servicename(
6011 ServicePtrs
[idx
]->szService
);
6013 dbwrap_delete_bystring(ServiceHash
, canon_name
);
6014 TALLOC_FREE(canon_name
);
6017 free_service(ServicePtrs
[idx
]);
6020 /***************************************************************************
6021 Add a new service to the services array initialising it with the given
6023 ***************************************************************************/
6025 static int add_a_service(const struct service
*pservice
, const char *name
)
6028 struct service tservice
;
6029 int num_to_alloc
= iNumServices
+ 1;
6031 tservice
= *pservice
;
6033 /* it might already exist */
6035 i
= getservicebyname(name
, NULL
);
6037 /* Clean all parametric options for service */
6038 /* They will be added during parsing again */
6039 free_param_opts(&ServicePtrs
[i
]->param_opt
);
6044 /* find an invalid one */
6046 if (num_invalid_services
> 0) {
6047 i
= invalid_services
[--num_invalid_services
];
6050 /* if not, then create one */
6051 if (i
== iNumServices
) {
6052 struct service
**tsp
;
6055 tsp
= SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs
, struct service
*, num_to_alloc
);
6057 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
6061 ServicePtrs
[iNumServices
] = SMB_MALLOC_P(struct service
);
6062 if (!ServicePtrs
[iNumServices
]) {
6063 DEBUG(0,("add_a_service: out of memory!\n"));
6068 /* enlarge invalid_services here for now... */
6069 tinvalid
= SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services
, int,
6071 if (tinvalid
== NULL
) {
6072 DEBUG(0,("add_a_service: failed to enlarge "
6073 "invalid_services!\n"));
6076 invalid_services
= tinvalid
;
6078 free_service_byindex(i
);
6081 ServicePtrs
[i
]->valid
= True
;
6083 init_service(ServicePtrs
[i
]);
6084 copy_service(ServicePtrs
[i
], &tservice
, NULL
);
6086 string_set(&ServicePtrs
[i
]->szService
, name
);
6088 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
6089 i
, ServicePtrs
[i
]->szService
));
6091 if (!hash_a_service(ServicePtrs
[i
]->szService
, i
)) {
6098 /***************************************************************************
6099 Convert a string to uppercase and remove whitespaces.
6100 ***************************************************************************/
6102 static char *canonicalize_servicename(const char *src
)
6107 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
6111 result
= talloc_strdup(talloc_tos(), src
);
6112 SMB_ASSERT(result
!= NULL
);
6118 /***************************************************************************
6119 Add a name/index pair for the services array to the hash table.
6120 ***************************************************************************/
6122 static bool hash_a_service(const char *name
, int idx
)
6126 if ( !ServiceHash
) {
6127 DEBUG(10,("hash_a_service: creating servicehash\n"));
6128 ServiceHash
= db_open_rbt(NULL
);
6129 if ( !ServiceHash
) {
6130 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
6135 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
6138 canon_name
= canonicalize_servicename( name
);
6140 dbwrap_store_bystring(ServiceHash
, canon_name
,
6141 make_tdb_data((uint8
*)&idx
, sizeof(idx
)),
6144 TALLOC_FREE(canon_name
);
6149 /***************************************************************************
6150 Add a new home service, with the specified home directory, defaults coming
6152 ***************************************************************************/
6154 bool lp_add_home(const char *pszHomename
, int iDefaultService
,
6155 const char *user
, const char *pszHomedir
)
6159 if (pszHomename
== NULL
|| user
== NULL
|| pszHomedir
== NULL
||
6160 pszHomedir
[0] == '\0') {
6164 i
= add_a_service(ServicePtrs
[iDefaultService
], pszHomename
);
6169 if (!(*(ServicePtrs
[iDefaultService
]->szPath
))
6170 || strequal(ServicePtrs
[iDefaultService
]->szPath
, lp_pathname(GLOBAL_SECTION_SNUM
))) {
6171 string_set(&ServicePtrs
[i
]->szPath
, pszHomedir
);
6174 if (!(*(ServicePtrs
[i
]->comment
))) {
6175 char *comment
= NULL
;
6176 if (asprintf(&comment
, "Home directory of %s", user
) < 0) {
6179 string_set(&ServicePtrs
[i
]->comment
, comment
);
6183 /* set the browseable flag from the global default */
6185 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6186 ServicePtrs
[i
]->bAccessBasedShareEnum
= sDefault
.bAccessBasedShareEnum
;
6188 ServicePtrs
[i
]->autoloaded
= True
;
6190 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename
,
6191 user
, ServicePtrs
[i
]->szPath
));
6196 /***************************************************************************
6197 Add a new service, based on an old one.
6198 ***************************************************************************/
6200 int lp_add_service(const char *pszService
, int iDefaultService
)
6202 if (iDefaultService
< 0) {
6203 return add_a_service(&sDefault
, pszService
);
6206 return (add_a_service(ServicePtrs
[iDefaultService
], pszService
));
6209 /***************************************************************************
6210 Add the IPC service.
6211 ***************************************************************************/
6213 static bool lp_add_ipc(const char *ipc_name
, bool guest_ok
)
6215 char *comment
= NULL
;
6216 int i
= add_a_service(&sDefault
, ipc_name
);
6221 if (asprintf(&comment
, "IPC Service (%s)",
6222 Globals
.szServerString
) < 0) {
6226 string_set(&ServicePtrs
[i
]->szPath
, tmpdir());
6227 string_set(&ServicePtrs
[i
]->szUsername
, "");
6228 string_set(&ServicePtrs
[i
]->comment
, comment
);
6229 string_set(&ServicePtrs
[i
]->fstype
, "IPC");
6230 ServicePtrs
[i
]->iMaxConnections
= 0;
6231 ServicePtrs
[i
]->bAvailable
= True
;
6232 ServicePtrs
[i
]->bRead_only
= True
;
6233 ServicePtrs
[i
]->bGuest_only
= False
;
6234 ServicePtrs
[i
]->bAdministrative_share
= True
;
6235 ServicePtrs
[i
]->bGuest_ok
= guest_ok
;
6236 ServicePtrs
[i
]->bPrint_ok
= False
;
6237 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6239 DEBUG(3, ("adding IPC service\n"));
6245 /***************************************************************************
6246 Add a new printer service, with defaults coming from service iFrom.
6247 ***************************************************************************/
6249 bool lp_add_printer(const char *pszPrintername
, int iDefaultService
)
6251 const char *comment
= "From Printcap";
6252 int i
= add_a_service(ServicePtrs
[iDefaultService
], pszPrintername
);
6257 /* note that we do NOT default the availability flag to True - */
6258 /* we take it from the default service passed. This allows all */
6259 /* dynamic printers to be disabled by disabling the [printers] */
6260 /* entry (if/when the 'available' keyword is implemented!). */
6262 /* the printer name is set to the service name. */
6263 string_set(&ServicePtrs
[i
]->szPrintername
, pszPrintername
);
6264 string_set(&ServicePtrs
[i
]->comment
, comment
);
6266 /* set the browseable flag from the gloabl default */
6267 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
6269 /* Printers cannot be read_only. */
6270 ServicePtrs
[i
]->bRead_only
= False
;
6271 /* No share modes on printer services. */
6272 ServicePtrs
[i
]->bShareModes
= False
;
6273 /* No oplocks on printer services. */
6274 ServicePtrs
[i
]->bOpLocks
= False
;
6275 /* Printer services must be printable. */
6276 ServicePtrs
[i
]->bPrint_ok
= True
;
6278 DEBUG(3, ("adding printer service %s\n", pszPrintername
));
6284 /***************************************************************************
6285 Check whether the given parameter name is valid.
6286 Parametric options (names containing a colon) are considered valid.
6287 ***************************************************************************/
6289 bool lp_parameter_is_valid(const char *pszParmName
)
6291 return ((map_parameter(pszParmName
) != -1) ||
6292 (strchr(pszParmName
, ':') != NULL
));
6295 /***************************************************************************
6296 Check whether the given name is the name of a global parameter.
6297 Returns True for strings belonging to parameters of class
6298 P_GLOBAL, False for all other strings, also for parametric options
6299 and strings not belonging to any option.
6300 ***************************************************************************/
6302 bool lp_parameter_is_global(const char *pszParmName
)
6304 int num
= map_parameter(pszParmName
);
6307 return (parm_table
[num
].p_class
== P_GLOBAL
);
6313 /**************************************************************************
6314 Check whether the given name is the canonical name of a parameter.
6315 Returns False if it is not a valid parameter Name.
6316 For parametric options, True is returned.
6317 **************************************************************************/
6319 bool lp_parameter_is_canonical(const char *parm_name
)
6321 if (!lp_parameter_is_valid(parm_name
)) {
6325 return (map_parameter(parm_name
) ==
6326 map_parameter_canonical(parm_name
, NULL
));
6329 /**************************************************************************
6330 Determine the canonical name for a parameter.
6331 Indicate when it is an inverse (boolean) synonym instead of a
6333 **************************************************************************/
6335 bool lp_canonicalize_parameter(const char *parm_name
, const char **canon_parm
,
6340 if (!lp_parameter_is_valid(parm_name
)) {
6345 num
= map_parameter_canonical(parm_name
, inverse
);
6347 /* parametric option */
6348 *canon_parm
= parm_name
;
6350 *canon_parm
= parm_table
[num
].label
;
6357 /**************************************************************************
6358 Determine the canonical name for a parameter.
6359 Turn the value given into the inverse boolean expression when
6360 the synonym is an invers boolean synonym.
6362 Return True if parm_name is a valid parameter name and
6363 in case it is an invers boolean synonym, if the val string could
6364 successfully be converted to the reverse bool.
6365 Return false in all other cases.
6366 **************************************************************************/
6368 bool lp_canonicalize_parameter_with_value(const char *parm_name
,
6370 const char **canon_parm
,
6371 const char **canon_val
)
6376 if (!lp_parameter_is_valid(parm_name
)) {
6382 num
= map_parameter_canonical(parm_name
, &inverse
);
6384 /* parametric option */
6385 *canon_parm
= parm_name
;
6388 *canon_parm
= parm_table
[num
].label
;
6390 if (!lp_invert_boolean(val
, canon_val
)) {
6402 /***************************************************************************
6403 Map a parameter's string representation to something we can use.
6404 Returns False if the parameter string is not recognised, else TRUE.
6405 ***************************************************************************/
6407 static int map_parameter(const char *pszParmName
)
6411 if (*pszParmName
== '-' && !strequal(pszParmName
, "-valid"))
6414 for (iIndex
= 0; parm_table
[iIndex
].label
; iIndex
++)
6415 if (strwicmp(parm_table
[iIndex
].label
, pszParmName
) == 0)
6418 /* Warn only if it isn't parametric option */
6419 if (strchr(pszParmName
, ':') == NULL
)
6420 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName
));
6421 /* We do return 'fail' for parametric options as well because they are
6422 stored in different storage
6427 /***************************************************************************
6428 Map a parameter's string representation to the index of the canonical
6429 form of the parameter (it might be a synonym).
6430 Returns -1 if the parameter string is not recognised.
6431 ***************************************************************************/
6433 static int map_parameter_canonical(const char *pszParmName
, bool *inverse
)
6435 int parm_num
, canon_num
;
6436 bool loc_inverse
= False
;
6438 parm_num
= map_parameter(pszParmName
);
6439 if ((parm_num
< 0) || !(parm_table
[parm_num
].flags
& FLAG_HIDE
)) {
6440 /* invalid, parametric or no canidate for synonyms ... */
6444 for (canon_num
= 0; parm_table
[canon_num
].label
; canon_num
++) {
6445 if (is_synonym_of(parm_num
, canon_num
, &loc_inverse
)) {
6446 parm_num
= canon_num
;
6452 if (inverse
!= NULL
) {
6453 *inverse
= loc_inverse
;
6458 /***************************************************************************
6459 return true if parameter number parm1 is a synonym of parameter
6460 number parm2 (parm2 being the principal name).
6461 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6463 ***************************************************************************/
6465 static bool is_synonym_of(int parm1
, int parm2
, bool *inverse
)
6467 if ((parm_table
[parm1
].ptr
== parm_table
[parm2
].ptr
) &&
6468 (parm_table
[parm1
].flags
& FLAG_HIDE
) &&
6469 !(parm_table
[parm2
].flags
& FLAG_HIDE
))
6471 if (inverse
!= NULL
) {
6472 if ((parm_table
[parm1
].type
== P_BOOLREV
) &&
6473 (parm_table
[parm2
].type
== P_BOOL
))
6485 /***************************************************************************
6486 Show one parameter's name, type, [values,] and flags.
6487 (helper functions for show_parameter_list)
6488 ***************************************************************************/
6490 static void show_parameter(int parmIndex
)
6492 int enumIndex
, flagIndex
;
6497 const char *type
[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6498 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6500 unsigned flags
[] = { FLAG_BASIC
, FLAG_SHARE
, FLAG_PRINT
, FLAG_GLOBAL
,
6501 FLAG_WIZARD
, FLAG_ADVANCED
, FLAG_DEVELOPER
, FLAG_DEPRECATED
,
6502 FLAG_HIDE
, FLAG_DOS_STRING
};
6503 const char *flag_names
[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6504 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6505 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL
};
6507 printf("%s=%s", parm_table
[parmIndex
].label
,
6508 type
[parm_table
[parmIndex
].type
]);
6509 if (parm_table
[parmIndex
].type
== P_ENUM
) {
6512 parm_table
[parmIndex
].enum_list
[enumIndex
].name
;
6516 enumIndex
? "|" : "",
6517 parm_table
[parmIndex
].enum_list
[enumIndex
].name
);
6522 for (flagIndex
=0; flag_names
[flagIndex
]; flagIndex
++) {
6523 if (parm_table
[parmIndex
].flags
& flags
[flagIndex
]) {
6526 flag_names
[flagIndex
]);
6531 /* output synonyms */
6533 for (parmIndex2
=0; parm_table
[parmIndex2
].label
; parmIndex2
++) {
6534 if (is_synonym_of(parmIndex
, parmIndex2
, &inverse
)) {
6535 printf(" (%ssynonym of %s)", inverse
? "inverse " : "",
6536 parm_table
[parmIndex2
].label
);
6537 } else if (is_synonym_of(parmIndex2
, parmIndex
, &inverse
)) {
6539 printf(" (synonyms: ");
6544 printf("%s%s", parm_table
[parmIndex2
].label
,
6545 inverse
? "[i]" : "");
6555 /***************************************************************************
6556 Show all parameter's name, type, [values,] and flags.
6557 ***************************************************************************/
6559 void show_parameter_list(void)
6561 int classIndex
, parmIndex
;
6562 const char *section_names
[] = { "local", "global", NULL
};
6564 for (classIndex
=0; section_names
[classIndex
]; classIndex
++) {
6565 printf("[%s]\n", section_names
[classIndex
]);
6566 for (parmIndex
= 0; parm_table
[parmIndex
].label
; parmIndex
++) {
6567 if (parm_table
[parmIndex
].p_class
== classIndex
) {
6568 show_parameter(parmIndex
);
6574 /***************************************************************************
6575 Check if a given string correctly represents a boolean value.
6576 ***************************************************************************/
6578 bool lp_string_is_valid_boolean(const char *parm_value
)
6580 return set_boolean(parm_value
, NULL
);
6583 /***************************************************************************
6584 Get the standard string representation of a boolean value ("yes" or "no")
6585 ***************************************************************************/
6587 static const char *get_boolean(bool bool_value
)
6589 static const char *yes_str
= "yes";
6590 static const char *no_str
= "no";
6592 return (bool_value
? yes_str
: no_str
);
6595 /***************************************************************************
6596 Provide the string of the negated boolean value associated to the boolean
6597 given as a string. Returns False if the passed string does not correctly
6598 represent a boolean.
6599 ***************************************************************************/
6601 bool lp_invert_boolean(const char *str
, const char **inverse_str
)
6605 if (!set_boolean(str
, &val
)) {
6609 *inverse_str
= get_boolean(!val
);
6613 /***************************************************************************
6614 Provide the canonical string representation of a boolean value given
6615 as a string. Return True on success, False if the string given does
6616 not correctly represent a boolean.
6617 ***************************************************************************/
6619 bool lp_canonicalize_boolean(const char *str
, const char**canon_str
)
6623 if (!set_boolean(str
, &val
)) {
6627 *canon_str
= get_boolean(val
);
6631 /***************************************************************************
6632 Find a service by name. Otherwise works like get_service.
6633 ***************************************************************************/
6635 static int getservicebyname(const char *pszServiceName
, struct service
*pserviceDest
)
6641 if (ServiceHash
== NULL
) {
6645 canon_name
= canonicalize_servicename(pszServiceName
);
6647 data
= dbwrap_fetch_bystring(ServiceHash
, canon_name
, canon_name
);
6649 if ((data
.dptr
!= NULL
) && (data
.dsize
== sizeof(iService
))) {
6650 iService
= *(int *)data
.dptr
;
6653 TALLOC_FREE(canon_name
);
6655 if ((iService
!= -1) && (LP_SNUM_OK(iService
))
6656 && (pserviceDest
!= NULL
)) {
6657 copy_service(pserviceDest
, ServicePtrs
[iService
], NULL
);
6663 /***************************************************************************
6664 Copy a service structure to another.
6665 If pcopymapDest is NULL then copy all fields
6666 ***************************************************************************/
6669 * Add a parametric option to a param_opt_struct,
6670 * replacing old value, if already present.
6672 static void set_param_opt(struct param_opt_struct
**opt_list
,
6673 const char *opt_name
,
6674 const char *opt_value
)
6676 struct param_opt_struct
*new_opt
, *opt
;
6679 if (opt_list
== NULL
) {
6686 /* Traverse destination */
6688 /* If we already have same option, override it */
6689 if (strwicmp(opt
->key
, opt_name
) == 0) {
6690 string_free(&opt
->value
);
6691 TALLOC_FREE(opt
->list
);
6692 opt
->value
= SMB_STRDUP(opt_value
);
6699 new_opt
= SMB_XMALLOC_P(struct param_opt_struct
);
6700 new_opt
->key
= SMB_STRDUP(opt_name
);
6701 new_opt
->value
= SMB_STRDUP(opt_value
);
6702 new_opt
->list
= NULL
;
6703 DLIST_ADD(*opt_list
, new_opt
);
6707 static void copy_service(struct service
*pserviceDest
, struct service
*pserviceSource
,
6708 struct bitmap
*pcopymapDest
)
6711 bool bcopyall
= (pcopymapDest
== NULL
);
6712 struct param_opt_struct
*data
;
6714 for (i
= 0; parm_table
[i
].label
; i
++)
6715 if (parm_table
[i
].ptr
&& parm_table
[i
].p_class
== P_LOCAL
&&
6716 (bcopyall
|| bitmap_query(pcopymapDest
,i
))) {
6717 void *def_ptr
= parm_table
[i
].ptr
;
6719 ((char *)pserviceSource
) + PTR_DIFF(def_ptr
,
6722 ((char *)pserviceDest
) + PTR_DIFF(def_ptr
,
6725 switch (parm_table
[i
].type
) {
6728 *(bool *)dest_ptr
= *(bool *)src_ptr
;
6734 *(int *)dest_ptr
= *(int *)src_ptr
;
6738 *(char *)dest_ptr
= *(char *)src_ptr
;
6742 string_set((char **)dest_ptr
,
6747 string_set((char **)dest_ptr
,
6749 strupper_m(*(char **)dest_ptr
);
6752 TALLOC_FREE(*((char ***)dest_ptr
));
6753 *((char ***)dest_ptr
) = str_list_copy(NULL
,
6754 *(const char ***)src_ptr
);
6762 init_copymap(pserviceDest
);
6763 if (pserviceSource
->copymap
)
6764 bitmap_copy(pserviceDest
->copymap
,
6765 pserviceSource
->copymap
);
6768 data
= pserviceSource
->param_opt
;
6770 set_param_opt(&pserviceDest
->param_opt
, data
->key
, data
->value
);
6775 /***************************************************************************
6776 Check a service for consistency. Return False if the service is in any way
6777 incomplete or faulty, else True.
6778 ***************************************************************************/
6780 bool service_ok(int iService
)
6785 if (ServicePtrs
[iService
]->szService
[0] == '\0') {
6786 DEBUG(0, ("The following message indicates an internal error:\n"));
6787 DEBUG(0, ("No service name in service entry.\n"));
6791 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
6792 /* I can't see why you'd want a non-printable printer service... */
6793 if (strwicmp(ServicePtrs
[iService
]->szService
, PRINTERS_NAME
) == 0) {
6794 if (!ServicePtrs
[iService
]->bPrint_ok
) {
6795 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
6796 ServicePtrs
[iService
]->szService
));
6797 ServicePtrs
[iService
]->bPrint_ok
= True
;
6799 /* [printers] service must also be non-browsable. */
6800 if (ServicePtrs
[iService
]->bBrowseable
)
6801 ServicePtrs
[iService
]->bBrowseable
= False
;
6804 if (ServicePtrs
[iService
]->szPath
[0] == '\0' &&
6805 strwicmp(ServicePtrs
[iService
]->szService
, HOMES_NAME
) != 0 &&
6806 ServicePtrs
[iService
]->szMSDfsProxy
[0] == '\0'
6808 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
6809 ServicePtrs
[iService
]->szService
));
6810 ServicePtrs
[iService
]->bAvailable
= False
;
6813 /* If a service is flagged unavailable, log the fact at level 1. */
6814 if (!ServicePtrs
[iService
]->bAvailable
)
6815 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
6816 ServicePtrs
[iService
]->szService
));
6821 static struct smbconf_ctx
*lp_smbconf_ctx(void)
6824 static struct smbconf_ctx
*conf_ctx
= NULL
;
6826 if (conf_ctx
== NULL
) {
6827 werr
= smbconf_init(NULL
, &conf_ctx
, "registry:");
6828 if (!W_ERROR_IS_OK(werr
)) {
6829 DEBUG(1, ("error initializing registry configuration: "
6830 "%s\n", win_errstr(werr
)));
6838 static bool process_smbconf_service(struct smbconf_service
*service
)
6843 if (service
== NULL
) {
6847 ret
= do_section(service
->name
, NULL
);
6851 for (count
= 0; count
< service
->num_params
; count
++) {
6852 ret
= do_parameter(service
->param_names
[count
],
6853 service
->param_values
[count
],
6859 if (iServiceIndex
>= 0) {
6860 return service_ok(iServiceIndex
);
6866 * load a service from registry and activate it
6868 bool process_registry_service(const char *service_name
)
6871 struct smbconf_service
*service
= NULL
;
6872 TALLOC_CTX
*mem_ctx
= talloc_stackframe();
6873 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
6876 if (conf_ctx
== NULL
) {
6880 DEBUG(5, ("process_registry_service: service name %s\n", service_name
));
6882 if (!smbconf_share_exists(conf_ctx
, service_name
)) {
6884 * Registry does not contain data for this service (yet),
6885 * but make sure lp_load doesn't return false.
6891 werr
= smbconf_get_share(conf_ctx
, mem_ctx
, service_name
, &service
);
6892 if (!W_ERROR_IS_OK(werr
)) {
6896 ret
= process_smbconf_service(service
);
6902 smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
, NULL
);
6905 TALLOC_FREE(mem_ctx
);
6910 * process_registry_globals
6912 static bool process_registry_globals(void)
6916 add_to_file_list(INCLUDE_REGISTRY_NAME
, INCLUDE_REGISTRY_NAME
);
6918 ret
= do_parameter("registry shares", "yes", NULL
);
6923 return process_registry_service(GLOBAL_NAME
);
6926 bool process_registry_shares(void)
6930 struct smbconf_service
**service
= NULL
;
6931 uint32_t num_shares
= 0;
6932 TALLOC_CTX
*mem_ctx
= talloc_stackframe();
6933 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
6936 if (conf_ctx
== NULL
) {
6940 werr
= smbconf_get_config(conf_ctx
, mem_ctx
, &num_shares
, &service
);
6941 if (!W_ERROR_IS_OK(werr
)) {
6947 for (count
= 0; count
< num_shares
; count
++) {
6948 if (strequal(service
[count
]->name
, GLOBAL_NAME
)) {
6951 ret
= process_smbconf_service(service
[count
]);
6958 smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
, NULL
);
6961 TALLOC_FREE(mem_ctx
);
6965 #define MAX_INCLUDE_DEPTH 100
6967 static uint8_t include_depth
;
6969 static struct file_lists
{
6970 struct file_lists
*next
;
6974 } *file_lists
= NULL
;
6976 /*******************************************************************
6977 Keep a linked list of all config files so we know when one has changed
6978 it's date and needs to be reloaded.
6979 ********************************************************************/
6981 static void add_to_file_list(const char *fname
, const char *subfname
)
6983 struct file_lists
*f
= file_lists
;
6986 if (f
->name
&& !strcmp(f
->name
, fname
))
6992 f
= SMB_MALLOC_P(struct file_lists
);
6995 f
->next
= file_lists
;
6996 f
->name
= SMB_STRDUP(fname
);
7001 f
->subfname
= SMB_STRDUP(subfname
);
7007 f
->modtime
= file_modtime(subfname
);
7009 time_t t
= file_modtime(subfname
);
7016 * Free the file lists
7018 static void free_file_list(void)
7020 struct file_lists
*f
;
7021 struct file_lists
*next
;
7026 SAFE_FREE( f
->name
);
7027 SAFE_FREE( f
->subfname
);
7036 * Utility function for outsiders to check if we're running on registry.
7038 bool lp_config_backend_is_registry(void)
7040 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY
);
7044 * Utility function to check if the config backend is FILE.
7046 bool lp_config_backend_is_file(void)
7048 return (lp_config_backend() == CONFIG_BACKEND_FILE
);
7051 /*******************************************************************
7052 Check if a config file has changed date.
7053 ********************************************************************/
7055 bool lp_file_list_changed(void)
7057 struct file_lists
*f
= file_lists
;
7059 DEBUG(6, ("lp_file_list_changed()\n"));
7065 if (strequal(f
->name
, INCLUDE_REGISTRY_NAME
)) {
7066 struct smbconf_ctx
*conf_ctx
= lp_smbconf_ctx();
7068 if (conf_ctx
== NULL
) {
7071 if (smbconf_changed(conf_ctx
, &conf_last_csn
, NULL
,
7074 DEBUGADD(6, ("registry config changed\n"));
7078 n2
= alloc_sub_basic(get_current_username(),
7079 current_user_info
.domain
,
7084 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
7085 f
->name
, n2
, ctime(&f
->modtime
)));
7087 mod_time
= file_modtime(n2
);
7090 ((f
->modtime
!= mod_time
) ||
7091 (f
->subfname
== NULL
) ||
7092 (strcmp(n2
, f
->subfname
) != 0)))
7095 ("file %s modified: %s\n", n2
,
7097 f
->modtime
= mod_time
;
7098 SAFE_FREE(f
->subfname
);
7099 f
->subfname
= n2
; /* Passing ownership of
7100 return from alloc_sub_basic
7112 /***************************************************************************
7113 Run standard_sub_basic on netbios name... needed because global_myname
7114 is not accessed through any lp_ macro.
7115 Note: We must *NOT* use string_set() here as ptr points to global_myname.
7116 ***************************************************************************/
7118 static bool handle_netbios_name(int snum
, const char *pszParmValue
, char **ptr
)
7121 char *netbios_name
= alloc_sub_basic(get_current_username(),
7122 current_user_info
.domain
,
7125 ret
= set_global_myname(netbios_name
);
7126 SAFE_FREE(netbios_name
);
7127 string_set(&Globals
.szNetbiosName
,global_myname());
7129 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
7135 static bool handle_charset(int snum
, const char *pszParmValue
, char **ptr
)
7137 if (strcmp(*ptr
, pszParmValue
) != 0) {
7138 string_set(ptr
, pszParmValue
);
7146 static bool handle_workgroup(int snum
, const char *pszParmValue
, char **ptr
)
7150 ret
= set_global_myworkgroup(pszParmValue
);
7151 string_set(&Globals
.szWorkgroup
,lp_workgroup());
7156 static bool handle_netbios_scope(int snum
, const char *pszParmValue
, char **ptr
)
7160 ret
= set_global_scope(pszParmValue
);
7161 string_set(&Globals
.szNetbiosScope
,global_scope());
7166 static bool handle_netbios_aliases(int snum
, const char *pszParmValue
, char **ptr
)
7168 TALLOC_FREE(Globals
.szNetbiosAliases
);
7169 Globals
.szNetbiosAliases
= str_list_make_v3(talloc_autofree_context(), pszParmValue
, NULL
);
7170 return set_netbios_aliases((const char **)Globals
.szNetbiosAliases
);
7173 /***************************************************************************
7174 Handle the include operation.
7175 ***************************************************************************/
7176 static bool bAllowIncludeRegistry
= true;
7178 static bool handle_include(int snum
, const char *pszParmValue
, char **ptr
)
7182 if (include_depth
>= MAX_INCLUDE_DEPTH
) {
7183 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7188 if (strequal(pszParmValue
, INCLUDE_REGISTRY_NAME
)) {
7189 if (!bAllowIncludeRegistry
) {
7192 if (bInGlobalSection
) {
7195 ret
= process_registry_globals();
7199 DEBUG(1, ("\"include = registry\" only effective "
7200 "in %s section\n", GLOBAL_NAME
));
7205 fname
= alloc_sub_basic(get_current_username(),
7206 current_user_info
.domain
,
7209 add_to_file_list(pszParmValue
, fname
);
7211 string_set(ptr
, fname
);
7213 if (file_exist(fname
)) {
7216 ret
= pm_process(fname
, do_section
, do_parameter
, NULL
);
7222 DEBUG(2, ("Can't find include file %s\n", fname
));
7227 /***************************************************************************
7228 Handle the interpretation of the copy parameter.
7229 ***************************************************************************/
7231 static bool handle_copy(int snum
, const char *pszParmValue
, char **ptr
)
7235 struct service serviceTemp
;
7237 string_set(ptr
, pszParmValue
);
7239 init_service(&serviceTemp
);
7243 DEBUG(3, ("Copying service from service %s\n", pszParmValue
));
7245 if ((iTemp
= getservicebyname(pszParmValue
, &serviceTemp
)) >= 0) {
7246 if (iTemp
== iServiceIndex
) {
7247 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue
));
7249 copy_service(ServicePtrs
[iServiceIndex
],
7251 ServicePtrs
[iServiceIndex
]->copymap
);
7255 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue
));
7259 free_service(&serviceTemp
);
7263 static bool handle_ldap_debug_level(int snum
, const char *pszParmValue
, char **ptr
)
7265 Globals
.ldap_debug_level
= lp_int(pszParmValue
);
7266 init_ldap_debugging();
7270 /***************************************************************************
7271 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7276 idmap uid = 1000-1999
7279 We only do simple parsing checks here. The strings are parsed into useful
7280 structures in the idmap daemon code.
7282 ***************************************************************************/
7284 /* Some lp_ routines to return idmap [ug]id information */
7286 static uid_t idmap_uid_low
, idmap_uid_high
;
7287 static gid_t idmap_gid_low
, idmap_gid_high
;
7289 bool lp_idmap_uid(uid_t
*low
, uid_t
*high
)
7291 if (idmap_uid_low
== 0 || idmap_uid_high
== 0)
7295 *low
= idmap_uid_low
;
7298 *high
= idmap_uid_high
;
7303 bool lp_idmap_gid(gid_t
*low
, gid_t
*high
)
7305 if (idmap_gid_low
== 0 || idmap_gid_high
== 0)
7309 *low
= idmap_gid_low
;
7312 *high
= idmap_gid_high
;
7317 /* Do some simple checks on "idmap [ug]id" parameter values */
7319 static bool handle_idmap_uid(int snum
, const char *pszParmValue
, char **ptr
)
7323 if (sscanf(pszParmValue
, "%u - %u", &low
, &high
) != 2 || high
< low
)
7328 string_set(ptr
, pszParmValue
);
7330 idmap_uid_low
= low
;
7331 idmap_uid_high
= high
;
7336 static bool handle_idmap_gid(int snum
, const char *pszParmValue
, char **ptr
)
7340 if (sscanf(pszParmValue
, "%u - %u", &low
, &high
) != 2 || high
< low
)
7345 string_set(ptr
, pszParmValue
);
7347 idmap_gid_low
= low
;
7348 idmap_gid_high
= high
;
7353 /***************************************************************************
7354 Handle the DEBUG level list.
7355 ***************************************************************************/
7357 static bool handle_debug_list( int snum
, const char *pszParmValueIn
, char **ptr
)
7359 string_set(ptr
, pszParmValueIn
);
7360 return debug_parse_levels(pszParmValueIn
);
7363 /***************************************************************************
7364 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7365 ***************************************************************************/
7367 static const char *append_ldap_suffix( const char *str
)
7369 const char *suffix_string
;
7372 suffix_string
= talloc_asprintf(talloc_tos(), "%s,%s", str
,
7373 Globals
.szLdapSuffix
);
7374 if ( !suffix_string
) {
7375 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7379 return suffix_string
;
7382 const char *lp_ldap_machine_suffix(void)
7384 if (Globals
.szLdapMachineSuffix
[0])
7385 return append_ldap_suffix(Globals
.szLdapMachineSuffix
);
7387 return lp_string(Globals
.szLdapSuffix
);
7390 const char *lp_ldap_user_suffix(void)
7392 if (Globals
.szLdapUserSuffix
[0])
7393 return append_ldap_suffix(Globals
.szLdapUserSuffix
);
7395 return lp_string(Globals
.szLdapSuffix
);
7398 const char *lp_ldap_group_suffix(void)
7400 if (Globals
.szLdapGroupSuffix
[0])
7401 return append_ldap_suffix(Globals
.szLdapGroupSuffix
);
7403 return lp_string(Globals
.szLdapSuffix
);
7406 const char *lp_ldap_idmap_suffix(void)
7408 if (Globals
.szLdapIdmapSuffix
[0])
7409 return append_ldap_suffix(Globals
.szLdapIdmapSuffix
);
7411 return lp_string(Globals
.szLdapSuffix
);
7414 /****************************************************************************
7415 set the value for a P_ENUM
7416 ***************************************************************************/
7418 static void lp_set_enum_parm( struct parm_struct
*parm
, const char *pszParmValue
,
7423 for (i
= 0; parm
->enum_list
[i
].name
; i
++) {
7424 if ( strequal(pszParmValue
, parm
->enum_list
[i
].name
)) {
7425 *ptr
= parm
->enum_list
[i
].value
;
7429 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7430 pszParmValue
, parm
->label
));
7433 /***************************************************************************
7434 ***************************************************************************/
7436 static bool handle_printing(int snum
, const char *pszParmValue
, char **ptr
)
7438 static int parm_num
= -1;
7441 if ( parm_num
== -1 )
7442 parm_num
= map_parameter( "printing" );
7444 lp_set_enum_parm( &parm_table
[parm_num
], pszParmValue
, (int*)ptr
);
7449 s
= ServicePtrs
[snum
];
7451 init_printer_values( s
);
7457 /***************************************************************************
7458 Initialise a copymap.
7459 ***************************************************************************/
7461 static void init_copymap(struct service
*pservice
)
7464 if (pservice
->copymap
) {
7465 bitmap_free(pservice
->copymap
);
7467 pservice
->copymap
= bitmap_allocate(NUMPARAMETERS
);
7468 if (!pservice
->copymap
)
7470 ("Couldn't allocate copymap!! (size %d)\n",
7471 (int)NUMPARAMETERS
));
7473 for (i
= 0; i
< NUMPARAMETERS
; i
++)
7474 bitmap_set(pservice
->copymap
, i
);
7477 /***************************************************************************
7478 Return the local pointer to a parameter given a service struct and the
7479 pointer into the default structure.
7480 ***************************************************************************/
7482 static void *lp_local_ptr(struct service
*service
, void *ptr
)
7484 return (void *)(((char *)service
) + PTR_DIFF(ptr
, &sDefault
));
7487 /***************************************************************************
7488 Return the local pointer to a parameter given the service number and the
7489 pointer into the default structure.
7490 ***************************************************************************/
7492 void *lp_local_ptr_by_snum(int snum
, void *ptr
)
7494 return lp_local_ptr(ServicePtrs
[snum
], ptr
);
7497 /***************************************************************************
7498 Process a parameter for a particular service number. If snum < 0
7499 then assume we are in the globals.
7500 ***************************************************************************/
7502 bool lp_do_parameter(int snum
, const char *pszParmName
, const char *pszParmValue
)
7505 void *parm_ptr
= NULL
; /* where we are going to store the result */
7506 void *def_ptr
= NULL
;
7507 struct param_opt_struct
**opt_list
;
7509 parmnum
= map_parameter(pszParmName
);
7512 if (strchr(pszParmName
, ':') == NULL
) {
7513 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7519 * We've got a parametric option
7522 opt_list
= (snum
< 0)
7523 ? &Globals
.param_opt
: &ServicePtrs
[snum
]->param_opt
;
7524 set_param_opt(opt_list
, pszParmName
, pszParmValue
);
7529 if (parm_table
[parmnum
].flags
& FLAG_DEPRECATED
) {
7530 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7534 def_ptr
= parm_table
[parmnum
].ptr
;
7536 /* we might point at a service, the default service or a global */
7540 if (parm_table
[parmnum
].p_class
== P_GLOBAL
) {
7542 ("Global parameter %s found in service section!\n",
7546 parm_ptr
= lp_local_ptr_by_snum(snum
, def_ptr
);
7550 if (!ServicePtrs
[snum
]->copymap
)
7551 init_copymap(ServicePtrs
[snum
]);
7553 /* this handles the aliases - set the copymap for other entries with
7554 the same data pointer */
7555 for (i
= 0; parm_table
[i
].label
; i
++)
7556 if (parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
)
7557 bitmap_clear(ServicePtrs
[snum
]->copymap
, i
);
7560 /* if it is a special case then go ahead */
7561 if (parm_table
[parmnum
].special
) {
7562 return parm_table
[parmnum
].special(snum
, pszParmValue
,
7566 /* now switch on the type of variable it is */
7567 switch (parm_table
[parmnum
].type
)
7570 *(bool *)parm_ptr
= lp_bool(pszParmValue
);
7574 *(bool *)parm_ptr
= !lp_bool(pszParmValue
);
7578 *(int *)parm_ptr
= lp_int(pszParmValue
);
7582 *(char *)parm_ptr
= *pszParmValue
;
7586 i
= sscanf(pszParmValue
, "%o", (int *)parm_ptr
);
7588 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName
));
7593 TALLOC_FREE(*((char ***)parm_ptr
));
7594 *(char ***)parm_ptr
= str_list_make_v3(
7595 talloc_autofree_context(), pszParmValue
, NULL
);
7599 string_set((char **)parm_ptr
, pszParmValue
);
7603 string_set((char **)parm_ptr
, pszParmValue
);
7604 strupper_m(*(char **)parm_ptr
);
7608 lp_set_enum_parm( &parm_table
[parmnum
], pszParmValue
, (int*)parm_ptr
);
7617 /***************************************************************************
7618 Process a parameter.
7619 ***************************************************************************/
7621 static bool do_parameter(const char *pszParmName
, const char *pszParmValue
,
7624 if (!bInGlobalSection
&& bGlobalOnly
)
7627 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName
, pszParmValue
));
7629 return (lp_do_parameter(bInGlobalSection
? -2 : iServiceIndex
,
7630 pszParmName
, pszParmValue
));
7633 /***************************************************************************
7634 Print a parameter of the specified type.
7635 ***************************************************************************/
7637 static void print_parameter(struct parm_struct
*p
, void *ptr
, FILE * f
)
7643 for (i
= 0; p
->enum_list
[i
].name
; i
++) {
7644 if (*(int *)ptr
== p
->enum_list
[i
].value
) {
7646 p
->enum_list
[i
].name
);
7653 fprintf(f
, "%s", BOOLSTR(*(bool *)ptr
));
7657 fprintf(f
, "%s", BOOLSTR(!*(bool *)ptr
));
7661 fprintf(f
, "%d", *(int *)ptr
);
7665 fprintf(f
, "%c", *(char *)ptr
);
7669 char *o
= octal_string(*(int *)ptr
);
7670 fprintf(f
, "%s", o
);
7676 if ((char ***)ptr
&& *(char ***)ptr
) {
7677 char **list
= *(char ***)ptr
;
7678 for (; *list
; list
++) {
7679 /* surround strings with whitespace in double quotes */
7680 if ( strchr_m( *list
, ' ' ) )
7681 fprintf(f
, "\"%s\"%s", *list
, ((*(list
+1))?", ":""));
7683 fprintf(f
, "%s%s", *list
, ((*(list
+1))?", ":""));
7690 if (*(char **)ptr
) {
7691 fprintf(f
, "%s", *(char **)ptr
);
7699 /***************************************************************************
7700 Check if two parameters are equal.
7701 ***************************************************************************/
7703 static bool equal_parameter(parm_type type
, void *ptr1
, void *ptr2
)
7708 return (*((bool *)ptr1
) == *((bool *)ptr2
));
7713 return (*((int *)ptr1
) == *((int *)ptr2
));
7716 return (*((char *)ptr1
) == *((char *)ptr2
));
7719 return str_list_equal(*(const char ***)ptr1
, *(const char ***)ptr2
);
7724 char *p1
= *(char **)ptr1
, *p2
= *(char **)ptr2
;
7729 return (p1
== p2
|| strequal(p1
, p2
));
7737 /***************************************************************************
7738 Initialize any local varients in the sDefault table.
7739 ***************************************************************************/
7741 void init_locals(void)
7746 /***************************************************************************
7747 Process a new section (service). At this stage all sections are services.
7748 Later we'll have special sections that permit server parameters to be set.
7749 Returns True on success, False on failure.
7750 ***************************************************************************/
7752 static bool do_section(const char *pszSectionName
, void *userdata
)
7755 bool isglobal
= ((strwicmp(pszSectionName
, GLOBAL_NAME
) == 0) ||
7756 (strwicmp(pszSectionName
, GLOBAL_NAME2
) == 0));
7759 /* if we were in a global section then do the local inits */
7760 if (bInGlobalSection
&& !isglobal
)
7763 /* if we've just struck a global section, note the fact. */
7764 bInGlobalSection
= isglobal
;
7766 /* check for multiple global sections */
7767 if (bInGlobalSection
) {
7768 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName
));
7772 if (!bInGlobalSection
&& bGlobalOnly
)
7775 /* if we have a current service, tidy it up before moving on */
7778 if (iServiceIndex
>= 0)
7779 bRetval
= service_ok(iServiceIndex
);
7781 /* if all is still well, move to the next record in the services array */
7783 /* We put this here to avoid an odd message order if messages are */
7784 /* issued by the post-processing of a previous section. */
7785 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName
));
7787 if ((iServiceIndex
= add_a_service(&sDefault
, pszSectionName
))
7789 DEBUG(0, ("Failed to add a new service\n"));
7798 /***************************************************************************
7799 Determine if a partcular base parameter is currentl set to the default value.
7800 ***************************************************************************/
7802 static bool is_default(int i
)
7804 if (!defaults_saved
)
7806 switch (parm_table
[i
].type
) {
7808 return str_list_equal((const char **)parm_table
[i
].def
.lvalue
,
7809 *(const char ***)parm_table
[i
].ptr
);
7812 return strequal(parm_table
[i
].def
.svalue
,
7813 *(char **)parm_table
[i
].ptr
);
7816 return parm_table
[i
].def
.bvalue
==
7817 *(bool *)parm_table
[i
].ptr
;
7819 return parm_table
[i
].def
.cvalue
==
7820 *(char *)parm_table
[i
].ptr
;
7824 return parm_table
[i
].def
.ivalue
==
7825 *(int *)parm_table
[i
].ptr
;
7832 /***************************************************************************
7833 Display the contents of the global structure.
7834 ***************************************************************************/
7836 static void dump_globals(FILE *f
)
7839 struct param_opt_struct
*data
;
7841 fprintf(f
, "[global]\n");
7843 for (i
= 0; parm_table
[i
].label
; i
++)
7844 if (parm_table
[i
].p_class
== P_GLOBAL
&&
7845 !(parm_table
[i
].flags
& FLAG_META
) &&
7846 parm_table
[i
].ptr
&&
7847 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
))) {
7848 if (defaults_saved
&& is_default(i
))
7850 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
7851 print_parameter(&parm_table
[i
], parm_table
[i
].ptr
, f
);
7854 if (Globals
.param_opt
!= NULL
) {
7855 data
= Globals
.param_opt
;
7857 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
7864 /***************************************************************************
7865 Return True if a local parameter is currently set to the global default.
7866 ***************************************************************************/
7868 bool lp_is_default(int snum
, struct parm_struct
*parm
)
7870 int pdiff
= PTR_DIFF(parm
->ptr
, &sDefault
);
7872 return equal_parameter(parm
->type
,
7873 ((char *)ServicePtrs
[snum
]) + pdiff
,
7874 ((char *)&sDefault
) + pdiff
);
7877 /***************************************************************************
7878 Display the contents of a single services record.
7879 ***************************************************************************/
7881 static void dump_a_service(struct service
*pService
, FILE * f
)
7884 struct param_opt_struct
*data
;
7886 if (pService
!= &sDefault
)
7887 fprintf(f
, "[%s]\n", pService
->szService
);
7889 for (i
= 0; parm_table
[i
].label
; i
++) {
7891 if (parm_table
[i
].p_class
== P_LOCAL
&&
7892 !(parm_table
[i
].flags
& FLAG_META
) &&
7893 parm_table
[i
].ptr
&&
7894 (*parm_table
[i
].label
!= '-') &&
7895 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
7898 int pdiff
= PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
7900 if (pService
== &sDefault
) {
7901 if (defaults_saved
&& is_default(i
))
7904 if (equal_parameter(parm_table
[i
].type
,
7905 ((char *)pService
) +
7907 ((char *)&sDefault
) +
7912 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
7913 print_parameter(&parm_table
[i
],
7914 ((char *)pService
) + pdiff
, f
);
7919 if (pService
->param_opt
!= NULL
) {
7920 data
= pService
->param_opt
;
7922 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
7928 /***************************************************************************
7929 Display the contents of a parameter of a single services record.
7930 ***************************************************************************/
7932 bool dump_a_parameter(int snum
, char *parm_name
, FILE * f
, bool isGlobal
)
7935 bool result
= False
;
7938 fstring local_parm_name
;
7940 const char *parm_opt_value
;
7942 /* check for parametrical option */
7943 fstrcpy( local_parm_name
, parm_name
);
7944 parm_opt
= strchr( local_parm_name
, ':');
7949 if (strlen(parm_opt
)) {
7950 parm_opt_value
= lp_parm_const_string( snum
,
7951 local_parm_name
, parm_opt
, NULL
);
7952 if (parm_opt_value
) {
7953 printf( "%s\n", parm_opt_value
);
7960 /* check for a key and print the value */
7967 for (i
= 0; parm_table
[i
].label
; i
++) {
7968 if (strwicmp(parm_table
[i
].label
, parm_name
) == 0 &&
7969 !(parm_table
[i
].flags
& FLAG_META
) &&
7970 (parm_table
[i
].p_class
== p_class
|| parm_table
[i
].flags
& flag
) &&
7971 parm_table
[i
].ptr
&&
7972 (*parm_table
[i
].label
!= '-') &&
7973 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
7978 ptr
= parm_table
[i
].ptr
;
7980 struct service
*pService
= ServicePtrs
[snum
];
7981 ptr
= ((char *)pService
) +
7982 PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
7985 print_parameter(&parm_table
[i
],
7996 /***************************************************************************
7997 Return info about the requested parameter (given as a string).
7998 Return NULL when the string is not a valid parameter name.
7999 ***************************************************************************/
8001 struct parm_struct
*lp_get_parameter(const char *param_name
)
8003 int num
= map_parameter(param_name
);
8009 return &parm_table
[num
];
8012 /***************************************************************************
8013 Return info about the next parameter in a service.
8014 snum==GLOBAL_SECTION_SNUM gives the globals.
8015 Return NULL when out of parameters.
8016 ***************************************************************************/
8018 struct parm_struct
*lp_next_parameter(int snum
, int *i
, int allparameters
)
8021 /* do the globals */
8022 for (; parm_table
[*i
].label
; (*i
)++) {
8023 if (parm_table
[*i
].p_class
== P_SEPARATOR
)
8024 return &parm_table
[(*i
)++];
8026 if (!parm_table
[*i
].ptr
8027 || (*parm_table
[*i
].label
== '-'))
8031 && (parm_table
[*i
].ptr
==
8032 parm_table
[(*i
) - 1].ptr
))
8035 if (is_default(*i
) && !allparameters
)
8038 return &parm_table
[(*i
)++];
8041 struct service
*pService
= ServicePtrs
[snum
];
8043 for (; parm_table
[*i
].label
; (*i
)++) {
8044 if (parm_table
[*i
].p_class
== P_SEPARATOR
)
8045 return &parm_table
[(*i
)++];
8047 if (parm_table
[*i
].p_class
== P_LOCAL
&&
8048 parm_table
[*i
].ptr
&&
8049 (*parm_table
[*i
].label
!= '-') &&
8051 (parm_table
[*i
].ptr
!=
8052 parm_table
[(*i
) - 1].ptr
)))
8055 PTR_DIFF(parm_table
[*i
].ptr
,
8058 if (allparameters
||
8059 !equal_parameter(parm_table
[*i
].type
,
8060 ((char *)pService
) +
8062 ((char *)&sDefault
) +
8065 return &parm_table
[(*i
)++];
8076 /***************************************************************************
8077 Display the contents of a single copy structure.
8078 ***************************************************************************/
8079 static void dump_copy_map(bool *pcopymap
)
8085 printf("\n\tNon-Copied parameters:\n");
8087 for (i
= 0; parm_table
[i
].label
; i
++)
8088 if (parm_table
[i
].p_class
== P_LOCAL
&&
8089 parm_table
[i
].ptr
&& !pcopymap
[i
] &&
8090 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
8092 printf("\t\t%s\n", parm_table
[i
].label
);
8097 /***************************************************************************
8098 Return TRUE if the passed service number is within range.
8099 ***************************************************************************/
8101 bool lp_snum_ok(int iService
)
8103 return (LP_SNUM_OK(iService
) && ServicePtrs
[iService
]->bAvailable
);
8106 /***************************************************************************
8107 Auto-load some home services.
8108 ***************************************************************************/
8110 static void lp_add_auto_services(char *str
)
8120 s
= SMB_STRDUP(str
);
8124 homes
= lp_servicenumber(HOMES_NAME
);
8126 for (p
= strtok_r(s
, LIST_SEP
, &saveptr
); p
;
8127 p
= strtok_r(NULL
, LIST_SEP
, &saveptr
)) {
8130 if (lp_servicenumber(p
) >= 0)
8133 home
= get_user_home_dir(talloc_tos(), p
);
8135 if (home
&& home
[0] && homes
>= 0)
8136 lp_add_home(p
, homes
, p
, home
);
8143 /***************************************************************************
8144 Auto-load one printer.
8145 ***************************************************************************/
8147 void lp_add_one_printer(const char *name
, const char *comment
, void *pdata
)
8149 int printers
= lp_servicenumber(PRINTERS_NAME
);
8152 if (lp_servicenumber(name
) < 0) {
8153 lp_add_printer(name
, printers
);
8154 if ((i
= lp_servicenumber(name
)) >= 0) {
8155 string_set(&ServicePtrs
[i
]->comment
, comment
);
8156 ServicePtrs
[i
]->autoloaded
= True
;
8161 /***************************************************************************
8162 Have we loaded a services file yet?
8163 ***************************************************************************/
8165 bool lp_loaded(void)
8170 /***************************************************************************
8171 Unload unused services.
8172 ***************************************************************************/
8174 void lp_killunused(bool (*snumused
) (int))
8177 for (i
= 0; i
< iNumServices
; i
++) {
8181 /* don't kill autoloaded or usershare services */
8182 if ( ServicePtrs
[i
]->autoloaded
||
8183 ServicePtrs
[i
]->usershare
== USERSHARE_VALID
) {
8187 if (!snumused
|| !snumused(i
)) {
8188 free_service_byindex(i
);
8194 * Kill all except autoloaded and usershare services - convenience wrapper
8196 void lp_kill_all_services(void)
8198 lp_killunused(NULL
);
8201 /***************************************************************************
8203 ***************************************************************************/
8205 void lp_killservice(int iServiceIn
)
8207 if (VALID(iServiceIn
)) {
8208 free_service_byindex(iServiceIn
);
8212 /***************************************************************************
8213 Save the curent values of all global and sDefault parameters into the
8214 defaults union. This allows swat and testparm to show only the
8215 changed (ie. non-default) parameters.
8216 ***************************************************************************/
8218 static void lp_save_defaults(void)
8221 for (i
= 0; parm_table
[i
].label
; i
++) {
8222 if (i
> 0 && parm_table
[i
].ptr
== parm_table
[i
- 1].ptr
)
8224 switch (parm_table
[i
].type
) {
8226 parm_table
[i
].def
.lvalue
= str_list_copy(
8227 NULL
, *(const char ***)parm_table
[i
].ptr
);
8231 if (parm_table
[i
].ptr
) {
8232 parm_table
[i
].def
.svalue
= SMB_STRDUP(*(char **)parm_table
[i
].ptr
);
8234 parm_table
[i
].def
.svalue
= NULL
;
8239 parm_table
[i
].def
.bvalue
=
8240 *(bool *)parm_table
[i
].ptr
;
8243 parm_table
[i
].def
.cvalue
=
8244 *(char *)parm_table
[i
].ptr
;
8249 parm_table
[i
].def
.ivalue
=
8250 *(int *)parm_table
[i
].ptr
;
8256 defaults_saved
= True
;
8259 /*******************************************************************
8260 Set the server type we will announce as via nmbd.
8261 ********************************************************************/
8263 static const struct srv_role_tab
{
8265 const char *role_str
;
8266 } srv_role_tab
[] = {
8267 { ROLE_STANDALONE
, "ROLE_STANDALONE" },
8268 { ROLE_DOMAIN_MEMBER
, "ROLE_DOMAIN_MEMBER" },
8269 { ROLE_DOMAIN_BDC
, "ROLE_DOMAIN_BDC" },
8270 { ROLE_DOMAIN_PDC
, "ROLE_DOMAIN_PDC" },
8274 const char* server_role_str(uint32 role
)
8277 for (i
=0; srv_role_tab
[i
].role_str
; i
++) {
8278 if (role
== srv_role_tab
[i
].role
) {
8279 return srv_role_tab
[i
].role_str
;
8285 static void set_server_role(void)
8287 server_role
= ROLE_STANDALONE
;
8289 switch (lp_security()) {
8291 if (lp_domain_logons())
8292 DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
8295 if (lp_domain_logons())
8296 DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
8297 /* this used to be considered ROLE_DOMAIN_MEMBER but that's just wrong */
8298 server_role
= ROLE_STANDALONE
;
8301 if (lp_domain_logons()) {
8302 DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
8303 server_role
= ROLE_DOMAIN_BDC
;
8306 server_role
= ROLE_DOMAIN_MEMBER
;
8309 if (lp_domain_logons()) {
8310 server_role
= ROLE_DOMAIN_PDC
;
8313 server_role
= ROLE_DOMAIN_MEMBER
;
8316 if (lp_domain_logons()) {
8318 if (Globals
.iDomainMaster
) /* auto or yes */
8319 server_role
= ROLE_DOMAIN_PDC
;
8321 server_role
= ROLE_DOMAIN_BDC
;
8325 DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
8329 DEBUG(10, ("set_server_role: role = %s\n", server_role_str(server_role
)));
8332 /***********************************************************
8333 If we should send plaintext/LANMAN passwords in the clinet
8334 ************************************************************/
8336 static void set_allowed_client_auth(void)
8338 if (Globals
.bClientNTLMv2Auth
) {
8339 Globals
.bClientLanManAuth
= False
;
8341 if (!Globals
.bClientLanManAuth
) {
8342 Globals
.bClientPlaintextAuth
= False
;
8346 /***************************************************************************
8348 The following code allows smbd to read a user defined share file.
8349 Yes, this is my intent. Yes, I'm comfortable with that...
8351 THE FOLLOWING IS SECURITY CRITICAL CODE.
8353 It washes your clothes, it cleans your house, it guards you while you sleep...
8354 Do not f%^k with it....
8355 ***************************************************************************/
8357 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8359 /***************************************************************************
8360 Check allowed stat state of a usershare file.
8361 Ensure we print out who is dicking with us so the admin can
8362 get their sorry ass fired.
8363 ***************************************************************************/
8365 static bool check_usershare_stat(const char *fname
,
8366 const SMB_STRUCT_STAT
*psbuf
)
8368 if (!S_ISREG(psbuf
->st_ex_mode
)) {
8369 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8370 "not a regular file\n",
8371 fname
, (unsigned int)psbuf
->st_ex_uid
));
8375 /* Ensure this doesn't have the other write bit set. */
8376 if (psbuf
->st_ex_mode
& S_IWOTH
) {
8377 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8378 "public write. Refusing to allow as a usershare file.\n",
8379 fname
, (unsigned int)psbuf
->st_ex_uid
));
8383 /* Should be 10k or less. */
8384 if (psbuf
->st_ex_size
> MAX_USERSHARE_FILE_SIZE
) {
8385 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8386 "too large (%u) to be a user share file.\n",
8387 fname
, (unsigned int)psbuf
->st_ex_uid
,
8388 (unsigned int)psbuf
->st_ex_size
));
8395 /***************************************************************************
8396 Parse the contents of a usershare file.
8397 ***************************************************************************/
8399 enum usershare_err
parse_usershare_file(TALLOC_CTX
*ctx
,
8400 SMB_STRUCT_STAT
*psbuf
,
8401 const char *servicename
,
8405 char **pp_sharepath
,
8410 const char **prefixallowlist
= lp_usershare_prefix_allow_list();
8411 const char **prefixdenylist
= lp_usershare_prefix_deny_list();
8414 SMB_STRUCT_STAT sbuf
;
8415 char *sharepath
= NULL
;
8416 char *comment
= NULL
;
8418 *pp_sharepath
= NULL
;
8421 *pallow_guest
= False
;
8424 return USERSHARE_MALFORMED_FILE
;
8427 if (strcmp(lines
[0], "#VERSION 1") == 0) {
8429 } else if (strcmp(lines
[0], "#VERSION 2") == 0) {
8432 return USERSHARE_MALFORMED_FILE
;
8435 return USERSHARE_BAD_VERSION
;
8438 if (strncmp(lines
[1], "path=", 5) != 0) {
8439 return USERSHARE_MALFORMED_PATH
;
8442 sharepath
= talloc_strdup(ctx
, &lines
[1][5]);
8444 return USERSHARE_POSIX_ERR
;
8446 trim_string(sharepath
, " ", " ");
8448 if (strncmp(lines
[2], "comment=", 8) != 0) {
8449 return USERSHARE_MALFORMED_COMMENT_DEF
;
8452 comment
= talloc_strdup(ctx
, &lines
[2][8]);
8454 return USERSHARE_POSIX_ERR
;
8456 trim_string(comment
, " ", " ");
8457 trim_char(comment
, '"', '"');
8459 if (strncmp(lines
[3], "usershare_acl=", 14) != 0) {
8460 return USERSHARE_MALFORMED_ACL_DEF
;
8463 if (!parse_usershare_acl(ctx
, &lines
[3][14], ppsd
)) {
8464 return USERSHARE_ACL_ERR
;
8468 if (strncmp(lines
[4], "guest_ok=", 9) != 0) {
8469 return USERSHARE_MALFORMED_ACL_DEF
;
8471 if (lines
[4][9] == 'y') {
8472 *pallow_guest
= True
;
8476 if (snum
!= -1 && (strcmp(sharepath
, ServicePtrs
[snum
]->szPath
) == 0)) {
8477 /* Path didn't change, no checks needed. */
8478 *pp_sharepath
= sharepath
;
8479 *pp_comment
= comment
;
8480 return USERSHARE_OK
;
8483 /* The path *must* be absolute. */
8484 if (sharepath
[0] != '/') {
8485 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8486 servicename
, sharepath
));
8487 return USERSHARE_PATH_NOT_ABSOLUTE
;
8490 /* If there is a usershare prefix deny list ensure one of these paths
8491 doesn't match the start of the user given path. */
8492 if (prefixdenylist
) {
8494 for ( i
=0; prefixdenylist
[i
]; i
++ ) {
8495 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8496 servicename
, i
, prefixdenylist
[i
], sharepath
));
8497 if (memcmp( sharepath
, prefixdenylist
[i
], strlen(prefixdenylist
[i
])) == 0) {
8498 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8499 "usershare prefix deny list entries.\n",
8500 servicename
, sharepath
));
8501 return USERSHARE_PATH_IS_DENIED
;
8506 /* If there is a usershare prefix allow list ensure one of these paths
8507 does match the start of the user given path. */
8509 if (prefixallowlist
) {
8511 for ( i
=0; prefixallowlist
[i
]; i
++ ) {
8512 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8513 servicename
, i
, prefixallowlist
[i
], sharepath
));
8514 if (memcmp( sharepath
, prefixallowlist
[i
], strlen(prefixallowlist
[i
])) == 0) {
8518 if (prefixallowlist
[i
] == NULL
) {
8519 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8520 "usershare prefix allow list entries.\n",
8521 servicename
, sharepath
));
8522 return USERSHARE_PATH_NOT_ALLOWED
;
8526 /* Ensure this is pointing to a directory. */
8527 dp
= sys_opendir(sharepath
);
8530 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8531 servicename
, sharepath
));
8532 return USERSHARE_PATH_NOT_DIRECTORY
;
8535 /* Ensure the owner of the usershare file has permission to share
8538 if (sys_stat(sharepath
, &sbuf
) == -1) {
8539 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8540 servicename
, sharepath
, strerror(errno
) ));
8542 return USERSHARE_POSIX_ERR
;
8547 if (!S_ISDIR(sbuf
.st_ex_mode
)) {
8548 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8549 servicename
, sharepath
));
8550 return USERSHARE_PATH_NOT_DIRECTORY
;
8553 /* Check if sharing is restricted to owner-only. */
8554 /* psbuf is the stat of the usershare definition file,
8555 sbuf is the stat of the target directory to be shared. */
8557 if (lp_usershare_owner_only()) {
8558 /* root can share anything. */
8559 if ((psbuf
->st_ex_uid
!= 0) && (sbuf
.st_ex_uid
!= psbuf
->st_ex_uid
)) {
8560 return USERSHARE_PATH_NOT_ALLOWED
;
8564 *pp_sharepath
= sharepath
;
8565 *pp_comment
= comment
;
8566 return USERSHARE_OK
;
8569 /***************************************************************************
8570 Deal with a usershare file.
8573 -1 - Bad name, invalid contents.
8574 - service name already existed and not a usershare, problem
8575 with permissions to share directory etc.
8576 ***************************************************************************/
8578 static int process_usershare_file(const char *dir_name
, const char *file_name
, int snum_template
)
8580 SMB_STRUCT_STAT sbuf
;
8581 SMB_STRUCT_STAT lsbuf
;
8583 char *sharepath
= NULL
;
8584 char *comment
= NULL
;
8585 fstring service_name
;
8586 char **lines
= NULL
;
8590 TALLOC_CTX
*ctx
= NULL
;
8591 SEC_DESC
*psd
= NULL
;
8592 bool guest_ok
= False
;
8594 /* Ensure share name doesn't contain invalid characters. */
8595 if (!validate_net_name(file_name
, INVALID_SHARENAME_CHARS
, strlen(file_name
))) {
8596 DEBUG(0,("process_usershare_file: share name %s contains "
8597 "invalid characters (any of %s)\n",
8598 file_name
, INVALID_SHARENAME_CHARS
));
8602 fstrcpy(service_name
, file_name
);
8604 if (asprintf(&fname
, "%s/%s", dir_name
, file_name
) < 0) {
8607 /* Minimize the race condition by doing an lstat before we
8608 open and fstat. Ensure this isn't a symlink link. */
8610 if (sys_lstat(fname
, &lsbuf
) != 0) {
8611 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8612 fname
, strerror(errno
) ));
8617 /* This must be a regular file, not a symlink, directory or
8618 other strange filetype. */
8619 if (!check_usershare_stat(fname
, &lsbuf
)) {
8625 char *canon_name
= canonicalize_servicename(service_name
);
8626 TDB_DATA data
= dbwrap_fetch_bystring(
8627 ServiceHash
, canon_name
, canon_name
);
8631 if ((data
.dptr
!= NULL
) && (data
.dsize
== sizeof(iService
))) {
8632 iService
= *(int *)data
.dptr
;
8634 TALLOC_FREE(canon_name
);
8637 if (iService
!= -1 &&
8638 timespec_compare(&ServicePtrs
[iService
]->usershare_last_mod
,
8639 &lsbuf
.st_ex_mtime
) == 0) {
8640 /* Nothing changed - Mark valid and return. */
8641 DEBUG(10,("process_usershare_file: service %s not changed.\n",
8643 ServicePtrs
[iService
]->usershare
= USERSHARE_VALID
;
8648 /* Try and open the file read only - no symlinks allowed. */
8650 fd
= sys_open(fname
, O_RDONLY
|O_NOFOLLOW
, 0);
8652 fd
= sys_open(fname
, O_RDONLY
, 0);
8656 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
8657 fname
, strerror(errno
) ));
8662 /* Now fstat to be *SURE* it's a regular file. */
8663 if (sys_fstat(fd
, &sbuf
) != 0) {
8665 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
8666 fname
, strerror(errno
) ));
8671 /* Is it the same dev/inode as was lstated ? */
8672 if (lsbuf
.st_ex_dev
!= sbuf
.st_ex_dev
|| lsbuf
.st_ex_ino
!= sbuf
.st_ex_ino
) {
8674 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
8675 "Symlink spoofing going on ?\n", fname
));
8680 /* This must be a regular file, not a symlink, directory or
8681 other strange filetype. */
8682 if (!check_usershare_stat(fname
, &sbuf
)) {
8687 lines
= fd_lines_load(fd
, &numlines
, MAX_USERSHARE_FILE_SIZE
, NULL
);
8690 if (lines
== NULL
) {
8691 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
8692 fname
, (unsigned int)sbuf
.st_ex_uid
));
8699 /* Should we allow printers to be shared... ? */
8700 ctx
= talloc_init("usershare_sd_xctx");
8706 if (parse_usershare_file(ctx
, &sbuf
, service_name
,
8707 iService
, lines
, numlines
, &sharepath
,
8708 &comment
, &psd
, &guest_ok
) != USERSHARE_OK
) {
8709 talloc_destroy(ctx
);
8716 /* Everything ok - add the service possibly using a template. */
8718 const struct service
*sp
= &sDefault
;
8719 if (snum_template
!= -1) {
8720 sp
= ServicePtrs
[snum_template
];
8723 if ((iService
= add_a_service(sp
, service_name
)) < 0) {
8724 DEBUG(0, ("process_usershare_file: Failed to add "
8725 "new service %s\n", service_name
));
8726 talloc_destroy(ctx
);
8730 /* Read only is controlled by usershare ACL below. */
8731 ServicePtrs
[iService
]->bRead_only
= False
;
8734 /* Write the ACL of the new/modified share. */
8735 if (!set_share_security(service_name
, psd
)) {
8736 DEBUG(0, ("process_usershare_file: Failed to set share "
8737 "security for user share %s\n",
8739 lp_remove_service(iService
);
8740 talloc_destroy(ctx
);
8744 /* If from a template it may be marked invalid. */
8745 ServicePtrs
[iService
]->valid
= True
;
8747 /* Set the service as a valid usershare. */
8748 ServicePtrs
[iService
]->usershare
= USERSHARE_VALID
;
8750 /* Set guest access. */
8751 if (lp_usershare_allow_guests()) {
8752 ServicePtrs
[iService
]->bGuest_ok
= guest_ok
;
8755 /* And note when it was loaded. */
8756 ServicePtrs
[iService
]->usershare_last_mod
= sbuf
.st_ex_mtime
;
8757 string_set(&ServicePtrs
[iService
]->szPath
, sharepath
);
8758 string_set(&ServicePtrs
[iService
]->comment
, comment
);
8760 talloc_destroy(ctx
);
8765 /***************************************************************************
8766 Checks if a usershare entry has been modified since last load.
8767 ***************************************************************************/
8769 static bool usershare_exists(int iService
, struct timespec
*last_mod
)
8771 SMB_STRUCT_STAT lsbuf
;
8772 const char *usersharepath
= Globals
.szUsersharePath
;
8775 if (asprintf(&fname
, "%s/%s",
8777 ServicePtrs
[iService
]->szService
) < 0) {
8781 if (sys_lstat(fname
, &lsbuf
) != 0) {
8786 if (!S_ISREG(lsbuf
.st_ex_mode
)) {
8792 *last_mod
= lsbuf
.st_ex_mtime
;
8796 /***************************************************************************
8797 Load a usershare service by name. Returns a valid servicenumber or -1.
8798 ***************************************************************************/
8800 int load_usershare_service(const char *servicename
)
8802 SMB_STRUCT_STAT sbuf
;
8803 const char *usersharepath
= Globals
.szUsersharePath
;
8804 int max_user_shares
= Globals
.iUsershareMaxShares
;
8805 int snum_template
= -1;
8807 if (*usersharepath
== 0 || max_user_shares
== 0) {
8811 if (sys_stat(usersharepath
, &sbuf
) != 0) {
8812 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
8813 usersharepath
, strerror(errno
) ));
8817 if (!S_ISDIR(sbuf
.st_ex_mode
)) {
8818 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
8824 * This directory must be owned by root, and have the 't' bit set.
8825 * It also must not be writable by "other".
8829 if (sbuf
.st_ex_uid
!= 0 || !(sbuf
.st_ex_mode
& S_ISVTX
) || (sbuf
.st_ex_mode
& S_IWOTH
)) {
8831 if (sbuf
.st_ex_uid
!= 0 || (sbuf
.st_ex_mode
& S_IWOTH
)) {
8833 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
8834 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8839 /* Ensure the template share exists if it's set. */
8840 if (Globals
.szUsershareTemplateShare
[0]) {
8841 /* We can't use lp_servicenumber here as we are recommending that
8842 template shares have -valid=False set. */
8843 for (snum_template
= iNumServices
- 1; snum_template
>= 0; snum_template
--) {
8844 if (ServicePtrs
[snum_template
]->szService
&&
8845 strequal(ServicePtrs
[snum_template
]->szService
,
8846 Globals
.szUsershareTemplateShare
)) {
8851 if (snum_template
== -1) {
8852 DEBUG(0,("load_usershare_service: usershare template share %s "
8853 "does not exist.\n",
8854 Globals
.szUsershareTemplateShare
));
8859 return process_usershare_file(usersharepath
, servicename
, snum_template
);
8862 /***************************************************************************
8863 Load all user defined shares from the user share directory.
8864 We only do this if we're enumerating the share list.
8865 This is the function that can delete usershares that have
8867 ***************************************************************************/
8869 int load_usershare_shares(void)
8872 SMB_STRUCT_STAT sbuf
;
8873 SMB_STRUCT_DIRENT
*de
;
8874 int num_usershares
= 0;
8875 int max_user_shares
= Globals
.iUsershareMaxShares
;
8876 unsigned int num_dir_entries
, num_bad_dir_entries
, num_tmp_dir_entries
;
8877 unsigned int allowed_bad_entries
= ((2*max_user_shares
)/10);
8878 unsigned int allowed_tmp_entries
= ((2*max_user_shares
)/10);
8880 int snum_template
= -1;
8881 const char *usersharepath
= Globals
.szUsersharePath
;
8882 int ret
= lp_numservices();
8884 if (max_user_shares
== 0 || *usersharepath
== '\0') {
8885 return lp_numservices();
8888 if (sys_stat(usersharepath
, &sbuf
) != 0) {
8889 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
8890 usersharepath
, strerror(errno
) ));
8895 * This directory must be owned by root, and have the 't' bit set.
8896 * It also must not be writable by "other".
8900 if (sbuf
.st_ex_uid
!= 0 || !(sbuf
.st_ex_mode
& S_ISVTX
) || (sbuf
.st_ex_mode
& S_IWOTH
)) {
8902 if (sbuf
.st_ex_uid
!= 0 || (sbuf
.st_ex_mode
& S_IWOTH
)) {
8904 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
8905 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8910 /* Ensure the template share exists if it's set. */
8911 if (Globals
.szUsershareTemplateShare
[0]) {
8912 /* We can't use lp_servicenumber here as we are recommending that
8913 template shares have -valid=False set. */
8914 for (snum_template
= iNumServices
- 1; snum_template
>= 0; snum_template
--) {
8915 if (ServicePtrs
[snum_template
]->szService
&&
8916 strequal(ServicePtrs
[snum_template
]->szService
,
8917 Globals
.szUsershareTemplateShare
)) {
8922 if (snum_template
== -1) {
8923 DEBUG(0,("load_usershare_shares: usershare template share %s "
8924 "does not exist.\n",
8925 Globals
.szUsershareTemplateShare
));
8930 /* Mark all existing usershares as pending delete. */
8931 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
8932 if (VALID(iService
) && ServicePtrs
[iService
]->usershare
) {
8933 ServicePtrs
[iService
]->usershare
= USERSHARE_PENDING_DELETE
;
8937 dp
= sys_opendir(usersharepath
);
8939 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
8940 usersharepath
, strerror(errno
) ));
8944 for (num_dir_entries
= 0, num_bad_dir_entries
= 0, num_tmp_dir_entries
= 0;
8945 (de
= sys_readdir(dp
));
8946 num_dir_entries
++ ) {
8948 const char *n
= de
->d_name
;
8950 /* Ignore . and .. */
8952 if ((n
[1] == '\0') || (n
[1] == '.' && n
[2] == '\0')) {
8958 /* Temporary file used when creating a share. */
8959 num_tmp_dir_entries
++;
8962 /* Allow 20% tmp entries. */
8963 if (num_tmp_dir_entries
> allowed_tmp_entries
) {
8964 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
8965 "in directory %s\n",
8966 num_tmp_dir_entries
, usersharepath
));
8970 r
= process_usershare_file(usersharepath
, n
, snum_template
);
8972 /* Update the services count. */
8974 if (num_usershares
>= max_user_shares
) {
8975 DEBUG(0,("load_usershare_shares: max user shares reached "
8976 "on file %s in directory %s\n",
8977 n
, usersharepath
));
8980 } else if (r
== -1) {
8981 num_bad_dir_entries
++;
8984 /* Allow 20% bad entries. */
8985 if (num_bad_dir_entries
> allowed_bad_entries
) {
8986 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
8987 "in directory %s\n",
8988 num_bad_dir_entries
, usersharepath
));
8992 /* Allow 20% bad entries. */
8993 if (num_dir_entries
> max_user_shares
+ allowed_bad_entries
) {
8994 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
8995 "in directory %s\n",
8996 num_dir_entries
, usersharepath
));
9003 /* Sweep through and delete any non-refreshed usershares that are
9004 not currently in use. */
9005 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
9006 if (VALID(iService
) && (ServicePtrs
[iService
]->usershare
== USERSHARE_PENDING_DELETE
)) {
9007 if (conn_snum_used(iService
)) {
9010 /* Remove from the share ACL db. */
9011 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
9012 lp_servicename(iService
) ));
9013 delete_share_security(lp_servicename(iService
));
9014 free_service_byindex(iService
);
9018 return lp_numservices();
9021 /********************************************************
9022 Destroy global resources allocated in this file
9023 ********************************************************/
9025 void gfree_loadparm(void)
9031 /* Free resources allocated to services */
9033 for ( i
= 0; i
< iNumServices
; i
++ ) {
9035 free_service_byindex(i
);
9039 SAFE_FREE( ServicePtrs
);
9042 /* Now release all resources allocated to global
9043 parameters and the default service */
9045 free_global_parameters();
9049 /***************************************************************************
9050 Allow client apps to specify that they are a client
9051 ***************************************************************************/
9052 void lp_set_in_client(bool b
)
9058 /***************************************************************************
9059 Determine if we're running in a client app
9060 ***************************************************************************/
9061 bool lp_is_in_client(void)
9066 /***************************************************************************
9067 Load the services array from the services file. Return True on success,
9069 ***************************************************************************/
9071 bool lp_load_ex(const char *pszFname
,
9075 bool initialize_globals
,
9076 bool allow_include_registry
,
9077 bool allow_registry_shares
)
9084 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9086 bInGlobalSection
= True
;
9087 bGlobalOnly
= global_only
;
9088 bAllowIncludeRegistry
= allow_include_registry
;
9090 init_globals(! initialize_globals
);
9095 if (save_defaults
) {
9100 free_param_opts(&Globals
.param_opt
);
9102 /* We get sections first, so have to start 'behind' to make up */
9105 if (lp_config_backend_is_file()) {
9106 n2
= alloc_sub_basic(get_current_username(),
9107 current_user_info
.domain
,
9110 smb_panic("lp_load_ex: out of memory");
9113 add_to_file_list(pszFname
, n2
);
9115 bRetval
= pm_process(n2
, do_section
, do_parameter
, NULL
);
9118 /* finish up the last section */
9119 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval
)));
9121 if (iServiceIndex
>= 0) {
9122 bRetval
= service_ok(iServiceIndex
);
9126 if (lp_config_backend_is_registry()) {
9127 /* config backend changed to registry in config file */
9129 * We need to use this extra global variable here to
9130 * survive restart: init_globals uses this as a default
9131 * for ConfigBackend. Otherwise, init_globals would
9132 * send us into an endless loop here.
9134 config_backend
= CONFIG_BACKEND_REGISTRY
;
9136 DEBUG(1, ("lp_load_ex: changing to config backend "
9138 init_globals(false);
9139 lp_kill_all_services();
9140 return lp_load_ex(pszFname
, global_only
, save_defaults
,
9141 add_ipc
, initialize_globals
,
9142 allow_include_registry
,
9143 allow_registry_shares
);
9145 } else if (lp_config_backend_is_registry()) {
9146 bRetval
= process_registry_globals();
9148 DEBUG(0, ("Illegal config backend given: %d\n",
9149 lp_config_backend()));
9153 if (bRetval
&& lp_registry_shares() && allow_registry_shares
) {
9154 bRetval
= process_registry_shares();
9157 lp_add_auto_services(lp_auto_services());
9160 /* When 'restrict anonymous = 2' guest connections to ipc$
9162 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9163 if ( lp_enable_asu_support() ) {
9164 lp_add_ipc("ADMIN$", false);
9169 set_default_server_announce_type();
9170 set_allowed_client_auth();
9174 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9175 /* if bWINSsupport is true and we are in the client */
9176 if (lp_is_in_client() && Globals
.bWINSsupport
) {
9177 lp_do_parameter(GLOBAL_SECTION_SNUM
, "wins server", "127.0.0.1");
9182 bAllowIncludeRegistry
= true;
9187 bool lp_load(const char *pszFname
,
9191 bool initialize_globals
)
9193 return lp_load_ex(pszFname
,
9201 bool lp_load_initial_only(const char *pszFname
)
9203 return lp_load_ex(pszFname
,
9212 bool lp_load_with_registry_shares(const char *pszFname
,
9216 bool initialize_globals
)
9218 return lp_load_ex(pszFname
,
9227 /***************************************************************************
9228 Return the max number of services.
9229 ***************************************************************************/
9231 int lp_numservices(void)
9233 return (iNumServices
);
9236 /***************************************************************************
9237 Display the contents of the services array in human-readable form.
9238 ***************************************************************************/
9240 void lp_dump(FILE *f
, bool show_defaults
, int maxtoprint
)
9245 defaults_saved
= False
;
9249 dump_a_service(&sDefault
, f
);
9251 for (iService
= 0; iService
< maxtoprint
; iService
++) {
9253 lp_dump_one(f
, show_defaults
, iService
);
9257 /***************************************************************************
9258 Display the contents of one service in human-readable form.
9259 ***************************************************************************/
9261 void lp_dump_one(FILE * f
, bool show_defaults
, int snum
)
9264 if (ServicePtrs
[snum
]->szService
[0] == '\0')
9266 dump_a_service(ServicePtrs
[snum
], f
);
9270 /***************************************************************************
9271 Return the number of the service with the given name, or -1 if it doesn't
9272 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9273 getservicebyname()! This works ONLY if all services have been loaded, and
9274 does not copy the found service.
9275 ***************************************************************************/
9277 int lp_servicenumber(const char *pszServiceName
)
9280 fstring serviceName
;
9282 if (!pszServiceName
) {
9283 return GLOBAL_SECTION_SNUM
;
9286 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
9287 if (VALID(iService
) && ServicePtrs
[iService
]->szService
) {
9289 * The substitution here is used to support %U is
9292 fstrcpy(serviceName
, ServicePtrs
[iService
]->szService
);
9293 standard_sub_basic(get_current_username(),
9294 current_user_info
.domain
,
9295 serviceName
,sizeof(serviceName
));
9296 if (strequal(serviceName
, pszServiceName
)) {
9302 if (iService
>= 0 && ServicePtrs
[iService
]->usershare
== USERSHARE_VALID
) {
9303 struct timespec last_mod
;
9305 if (!usershare_exists(iService
, &last_mod
)) {
9306 /* Remove the share security tdb entry for it. */
9307 delete_share_security(lp_servicename(iService
));
9308 /* Remove it from the array. */
9309 free_service_byindex(iService
);
9310 /* Doesn't exist anymore. */
9311 return GLOBAL_SECTION_SNUM
;
9314 /* Has it been modified ? If so delete and reload. */
9315 if (timespec_compare(&ServicePtrs
[iService
]->usershare_last_mod
,
9317 /* Remove it from the array. */
9318 free_service_byindex(iService
);
9319 /* and now reload it. */
9320 iService
= load_usershare_service(pszServiceName
);
9325 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName
));
9326 return GLOBAL_SECTION_SNUM
;
9332 bool share_defined(const char *service_name
)
9334 return (lp_servicenumber(service_name
) != -1);
9337 struct share_params
*get_share_params(TALLOC_CTX
*mem_ctx
,
9338 const char *sharename
)
9340 struct share_params
*result
;
9344 if (!(sname
= SMB_STRDUP(sharename
))) {
9348 snum
= find_service(sname
);
9355 if (!(result
= TALLOC_P(mem_ctx
, struct share_params
))) {
9356 DEBUG(0, ("talloc failed\n"));
9360 result
->service
= snum
;
9364 struct share_iterator
*share_list_all(TALLOC_CTX
*mem_ctx
)
9366 struct share_iterator
*result
;
9368 if (!(result
= TALLOC_P(mem_ctx
, struct share_iterator
))) {
9369 DEBUG(0, ("talloc failed\n"));
9373 result
->next_id
= 0;
9377 struct share_params
*next_share(struct share_iterator
*list
)
9379 struct share_params
*result
;
9381 while (!lp_snum_ok(list
->next_id
) &&
9382 (list
->next_id
< lp_numservices())) {
9386 if (list
->next_id
>= lp_numservices()) {
9390 if (!(result
= TALLOC_P(list
, struct share_params
))) {
9391 DEBUG(0, ("talloc failed\n"));
9395 result
->service
= list
->next_id
;
9400 struct share_params
*next_printer(struct share_iterator
*list
)
9402 struct share_params
*result
;
9404 while ((result
= next_share(list
)) != NULL
) {
9405 if (lp_print_ok(result
->service
)) {
9413 * This is a hack for a transition period until we transformed all code from
9414 * service numbers to struct share_params.
9417 struct share_params
*snum2params_static(int snum
)
9419 static struct share_params result
;
9420 result
.service
= snum
;
9424 /*******************************************************************
9425 A useful volume label function.
9426 ********************************************************************/
9428 const char *volume_label(int snum
)
9431 const char *label
= lp_volume(snum
);
9433 label
= lp_servicename(snum
);
9436 /* This returns a 33 byte guarenteed null terminated string. */
9437 ret
= talloc_strndup(talloc_tos(), label
, 32);
9444 /*******************************************************************
9445 Set the server type we will announce as via nmbd.
9446 ********************************************************************/
9448 static void set_default_server_announce_type(void)
9450 default_server_announce
= 0;
9451 default_server_announce
|= SV_TYPE_WORKSTATION
;
9452 default_server_announce
|= SV_TYPE_SERVER
;
9453 default_server_announce
|= SV_TYPE_SERVER_UNIX
;
9455 /* note that the flag should be set only if we have a
9456 printer service but nmbd doesn't actually load the
9457 services so we can't tell --jerry */
9459 default_server_announce
|= SV_TYPE_PRINTQ_SERVER
;
9461 switch (lp_announce_as()) {
9462 case ANNOUNCE_AS_NT_SERVER
:
9463 default_server_announce
|= SV_TYPE_SERVER_NT
;
9464 /* fall through... */
9465 case ANNOUNCE_AS_NT_WORKSTATION
:
9466 default_server_announce
|= SV_TYPE_NT
;
9468 case ANNOUNCE_AS_WIN95
:
9469 default_server_announce
|= SV_TYPE_WIN95_PLUS
;
9471 case ANNOUNCE_AS_WFW
:
9472 default_server_announce
|= SV_TYPE_WFW
;
9478 switch (lp_server_role()) {
9479 case ROLE_DOMAIN_MEMBER
:
9480 default_server_announce
|= SV_TYPE_DOMAIN_MEMBER
;
9482 case ROLE_DOMAIN_PDC
:
9483 default_server_announce
|= SV_TYPE_DOMAIN_CTRL
;
9485 case ROLE_DOMAIN_BDC
:
9486 default_server_announce
|= SV_TYPE_DOMAIN_BAKCTRL
;
9488 case ROLE_STANDALONE
:
9492 if (lp_time_server())
9493 default_server_announce
|= SV_TYPE_TIME_SOURCE
;
9495 if (lp_host_msdfs())
9496 default_server_announce
|= SV_TYPE_DFS_SERVER
;
9499 /***********************************************************
9500 returns role of Samba server
9501 ************************************************************/
9503 int lp_server_role(void)
9508 /***********************************************************
9509 If we are PDC then prefer us as DMB
9510 ************************************************************/
9512 bool lp_domain_master(void)
9514 if (Globals
.iDomainMaster
== Auto
)
9515 return (lp_server_role() == ROLE_DOMAIN_PDC
);
9517 return (bool)Globals
.iDomainMaster
;
9520 /***********************************************************
9521 If we are DMB then prefer us as LMB
9522 ************************************************************/
9524 bool lp_preferred_master(void)
9526 if (Globals
.iPreferredMaster
== Auto
)
9527 return (lp_local_master() && lp_domain_master());
9529 return (bool)Globals
.iPreferredMaster
;
9532 /*******************************************************************
9534 ********************************************************************/
9536 void lp_remove_service(int snum
)
9538 ServicePtrs
[snum
]->valid
= False
;
9539 invalid_services
[num_invalid_services
++] = snum
;
9542 /*******************************************************************
9544 ********************************************************************/
9546 void lp_copy_service(int snum
, const char *new_name
)
9548 do_section(new_name
, NULL
);
9550 snum
= lp_servicenumber(new_name
);
9552 lp_do_parameter(snum
, "copy", lp_servicename(snum
));
9557 /*******************************************************************
9558 Get the default server type we will announce as via nmbd.
9559 ********************************************************************/
9561 int lp_default_server_announce(void)
9563 return default_server_announce
;
9566 /*******************************************************************
9567 Split the announce version into major and minor numbers.
9568 ********************************************************************/
9570 int lp_major_announce_version(void)
9572 static bool got_major
= False
;
9573 static int major_version
= DEFAULT_MAJOR_VERSION
;
9578 return major_version
;
9581 if ((vers
= lp_announce_version()) == NULL
)
9582 return major_version
;
9584 if ((p
= strchr_m(vers
, '.')) == 0)
9585 return major_version
;
9588 major_version
= atoi(vers
);
9589 return major_version
;
9592 int lp_minor_announce_version(void)
9594 static bool got_minor
= False
;
9595 static int minor_version
= DEFAULT_MINOR_VERSION
;
9600 return minor_version
;
9603 if ((vers
= lp_announce_version()) == NULL
)
9604 return minor_version
;
9606 if ((p
= strchr_m(vers
, '.')) == 0)
9607 return minor_version
;
9610 minor_version
= atoi(p
);
9611 return minor_version
;
9614 /***********************************************************
9615 Set the global name resolution order (used in smbclient).
9616 ************************************************************/
9618 void lp_set_name_resolve_order(const char *new_order
)
9620 string_set(&Globals
.szNameResolveOrder
, new_order
);
9623 const char *lp_printername(int snum
)
9625 const char *ret
= _lp_printername(snum
);
9626 if (ret
== NULL
|| (ret
!= NULL
&& *ret
== '\0'))
9627 ret
= lp_const_servicename(snum
);
9633 /***********************************************************
9634 Allow daemons such as winbindd to fix their logfile name.
9635 ************************************************************/
9637 void lp_set_logfile(const char *name
)
9639 string_set(&Globals
.szLogFile
, name
);
9640 debug_set_logfile(name
);
9643 /*******************************************************************
9644 Return the max print jobs per queue.
9645 ********************************************************************/
9647 int lp_maxprintjobs(int snum
)
9649 int maxjobs
= LP_SNUM_OK(snum
) ? ServicePtrs
[snum
]->iMaxPrintJobs
: sDefault
.iMaxPrintJobs
;
9650 if (maxjobs
<= 0 || maxjobs
>= PRINT_MAX_JOBID
)
9651 maxjobs
= PRINT_MAX_JOBID
- 1;
9656 const char *lp_printcapname(void)
9658 if ((Globals
.szPrintcapname
!= NULL
) &&
9659 (Globals
.szPrintcapname
[0] != '\0'))
9660 return Globals
.szPrintcapname
;
9662 if (sDefault
.iPrinting
== PRINT_CUPS
) {
9670 if (sDefault
.iPrinting
== PRINT_BSD
)
9671 return "/etc/printcap";
9673 return PRINTCAP_NAME
;
9676 static uint32 spoolss_state
;
9678 bool lp_disable_spoolss( void )
9680 if ( spoolss_state
== SVCCTL_STATE_UNKNOWN
)
9681 spoolss_state
= _lp_disable_spoolss() ? SVCCTL_STOPPED
: SVCCTL_RUNNING
;
9683 return spoolss_state
== SVCCTL_STOPPED
? True
: False
;
9686 void lp_set_spoolss_state( uint32 state
)
9688 SMB_ASSERT( (state
== SVCCTL_STOPPED
) || (state
== SVCCTL_RUNNING
) );
9690 spoolss_state
= state
;
9693 uint32
lp_get_spoolss_state( void )
9695 return lp_disable_spoolss() ? SVCCTL_STOPPED
: SVCCTL_RUNNING
;
9698 /*******************************************************************
9699 Ensure we don't use sendfile if server smb signing is active.
9700 ********************************************************************/
9702 bool lp_use_sendfile(int snum
, struct smb_signing_state
*signing_state
)
9704 bool sign_active
= false;
9706 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
9707 if (Protocol
< PROTOCOL_NT1
) {
9710 if (signing_state
) {
9711 sign_active
= smb_signing_is_active(signing_state
);
9713 return (_lp_use_sendfile(snum
) &&
9714 (get_remote_arch() != RA_WIN95
) &&
9718 /*******************************************************************
9719 Turn off sendfile if we find the underlying OS doesn't support it.
9720 ********************************************************************/
9722 void set_use_sendfile(int snum
, bool val
)
9724 if (LP_SNUM_OK(snum
))
9725 ServicePtrs
[snum
]->bUseSendfile
= val
;
9727 sDefault
.bUseSendfile
= val
;
9730 /*******************************************************************
9731 Turn off storing DOS attributes if this share doesn't support it.
9732 ********************************************************************/
9734 void set_store_dos_attributes(int snum
, bool val
)
9736 if (!LP_SNUM_OK(snum
))
9738 ServicePtrs
[(snum
)]->bStoreDosAttributes
= val
;
9741 void lp_set_mangling_method(const char *new_method
)
9743 string_set(&Globals
.szManglingMethod
, new_method
);
9746 /*******************************************************************
9747 Global state for POSIX pathname processing.
9748 ********************************************************************/
9750 static bool posix_pathnames
;
9752 bool lp_posix_pathnames(void)
9754 return posix_pathnames
;
9757 /*******************************************************************
9758 Change everything needed to ensure POSIX pathname processing (currently
9760 ********************************************************************/
9762 void lp_set_posix_pathnames(void)
9764 posix_pathnames
= True
;
9767 /*******************************************************************
9768 Global state for POSIX lock processing - CIFS unix extensions.
9769 ********************************************************************/
9771 bool posix_default_lock_was_set
;
9772 static enum brl_flavour posix_cifsx_locktype
; /* By default 0 == WINDOWS_LOCK */
9774 enum brl_flavour
lp_posix_cifsu_locktype(files_struct
*fsp
)
9776 if (posix_default_lock_was_set
) {
9777 return posix_cifsx_locktype
;
9779 return fsp
->posix_open
? POSIX_LOCK
: WINDOWS_LOCK
;
9783 /*******************************************************************
9784 ********************************************************************/
9786 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val
)
9788 posix_default_lock_was_set
= True
;
9789 posix_cifsx_locktype
= val
;
9792 int lp_min_receive_file_size(void)
9794 if (Globals
.iminreceivefile
< 0) {
9797 return MIN(Globals
.iminreceivefile
, BUFFER_SIZE
);
9800 /*******************************************************************
9801 If socket address is an empty character string, it is necessary to
9802 define it as "0.0.0.0".
9803 ********************************************************************/
9805 const char *lp_socket_address(void)
9807 char *sock_addr
= Globals
.szSocketAddress
;
9809 if (sock_addr
[0] == '\0'){
9810 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
9812 return Globals
.szSocketAddress
;
9815 void lp_set_passdb_backend(const char *backend
)
9817 string_set(&Globals
.szPassdbBackend
, backend
);