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
55 #include "libnet/libnet.h"
57 bool in_client
= False
; /* Not in the client by default */
60 extern enum protocol_types Protocol
;
61 extern userdom_struct current_user_info
;
64 #define GLOBAL_NAME "global"
68 #define PRINTERS_NAME "printers"
72 #define HOMES_NAME "homes"
75 static uint64_t conf_last_seqnum
= 0;
76 static struct libnet_conf_ctx
*conf_ctx
= NULL
;
78 #define CONFIG_BACKEND_FILE 0
79 #define CONFIG_BACKEND_REGISTRY 1
81 static int config_backend
= CONFIG_BACKEND_FILE
;
83 /* some helpful bits */
84 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
85 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
87 #define USERSHARE_VALID 1
88 #define USERSHARE_PENDING_DELETE 2
90 extern int extra_time_offset
;
92 static bool defaults_saved
= False
;
94 typedef struct _param_opt_struct param_opt_struct
;
95 struct _param_opt_struct
{
96 param_opt_struct
*prev
, *next
;
103 * This structure describes global (ie., server-wide) parameters.
110 char *display_charset
;
111 char *szPrintcapname
;
112 char *szAddPortCommand
;
113 char *szEnumPortsCommand
;
114 char *szAddPrinterCommand
;
115 char *szDeletePrinterCommand
;
116 char *szOs2DriverMap
;
120 char *szDefaultService
;
124 char *szServerString
;
125 char *szAutoServices
;
126 char *szPasswdProgram
;
130 char *szSMBPasswdFile
;
132 char *szPassdbBackend
;
133 char **szPreloadModules
;
134 char *szPasswordServer
;
135 char *szSocketOptions
;
137 char *szAfsUsernameMap
;
138 int iAfsTokenLifetime
;
139 char *szLogNtTokenCommand
;
145 char **szWINSservers
;
147 char *szRemoteAnnounce
;
148 char *szRemoteBrowseSync
;
149 char *szSocketAddress
;
150 char *szNISHomeMapName
;
151 char *szAnnounceVersion
; /* This is initialised in init_globals */
154 char **szNetbiosAliases
;
155 char *szNetbiosScope
;
156 char *szNameResolveOrder
;
158 char *szAddUserScript
;
159 char *szRenameUserScript
;
160 char *szDelUserScript
;
161 char *szAddGroupScript
;
162 char *szDelGroupScript
;
163 char *szAddUserToGroupScript
;
164 char *szDelUserFromGroupScript
;
165 char *szSetPrimaryGroupScript
;
166 char *szAddMachineScript
;
167 char *szShutdownScript
;
168 char *szAbortShutdownScript
;
169 char *szUsernameMapScript
;
170 char *szCheckPasswordScript
;
177 bool bPassdbExpandExplicit
;
178 int AlgorithmicRidBase
;
179 char *szTemplateHomedir
;
180 char *szTemplateShell
;
181 char *szWinbindSeparator
;
182 bool bWinbindEnumUsers
;
183 bool bWinbindEnumGroups
;
184 bool bWinbindUseDefaultDomain
;
185 bool bWinbindTrustedDomainsOnly
;
186 bool bWinbindNestedGroups
;
187 int winbind_expand_groups
;
188 bool bWinbindRefreshTickets
;
189 bool bWinbindOfflineLogon
;
190 bool bWinbindNormalizeNames
;
191 bool bWinbindRpcOnly
;
192 char **szIdmapDomains
;
193 char **szIdmapBackend
; /* deprecated */
194 char *szIdmapAllocBackend
;
195 char *szAddShareCommand
;
196 char *szChangeShareCommand
;
197 char *szDeleteShareCommand
;
199 char *szGuestaccount
;
200 char *szManglingMethod
;
201 char **szServicesList
;
202 char *szUsersharePath
;
203 char *szUsershareTemplateShare
;
204 char **szUsersharePrefixAllowList
;
205 char **szUsersharePrefixDenyList
;
212 int open_files_db_hash_size
;
221 bool paranoid_server_security
;
224 int iMaxSmbdProcesses
;
225 bool bDisableSpoolss
;
228 bool enhanced_browsing
;
234 int announce_as
; /* This is initialised in init_globals */
235 int machine_password_timeout
;
237 int oplock_break_wait_time
;
238 int winbind_cache_time
;
239 int winbind_max_idle_children
;
240 char **szWinbindNssInfo
;
242 char *szLdapMachineSuffix
;
243 char *szLdapUserSuffix
;
244 char *szLdapIdmapSuffix
;
245 char *szLdapGroupSuffix
;
249 int ldap_debug_level
;
250 int ldap_debug_threshold
;
253 char *szIPrintServer
;
255 char **szClusterAddresses
;
257 int ldap_passwd_sync
;
258 int ldap_replication_sleep
;
259 int ldap_timeout
; /* This is initialised in init_globals */
262 bool bMsAddPrinterWizard
;
267 int iPreferredMaster
;
270 bool bEncryptPasswords
;
275 bool bObeyPamRestrictions
;
277 int PrintcapCacheTime
;
278 bool bLargeReadwrite
;
285 bool bBindInterfacesOnly
;
286 bool bPamPasswordChange
;
287 bool bUnixPasswdSync
;
288 bool bPasswdChatDebug
;
289 int iPasswdChatTimeout
;
293 bool bNTStatusSupport
;
295 int iMaxStatCacheSize
;
297 bool bAllowTrustedDomains
;
301 bool bClientLanManAuth
;
302 bool bClientNTLMv2Auth
;
303 bool bClientPlaintextAuth
;
304 bool bClientUseSpnego
;
305 bool bDebugPrefixTimestamp
;
306 bool bDebugHiresTimestamp
;
310 bool bEnableCoreFiles
;
313 bool bHostnameLookups
;
314 bool bUnixExtensions
;
315 bool bDisableNetbios
;
316 bool bUseKerberosKeytab
;
317 bool bDeferSharingViolations
;
318 bool bEnablePrivileges
;
320 bool bUsershareOwnerOnly
;
321 bool bUsershareAllowGuests
;
322 bool bRegistryShares
;
323 int restrict_anonymous
;
324 int name_cache_timeout
;
327 int client_ldap_sasl_wrapping
;
328 int iUsershareMaxShares
;
330 int iIdmapNegativeCacheTime
;
334 param_opt_struct
*param_opt
;
337 static struct global Globals
;
340 * This structure describes a single service.
346 time_t usershare_last_mod
;
350 char **szInvalidUsers
;
358 char *szRootPostExec
;
360 char *szPrintcommand
;
363 char *szLppausecommand
;
364 char *szLpresumecommand
;
365 char *szQueuepausecommand
;
366 char *szQueueresumecommand
;
368 char *szPrintjobUsername
;
376 char *szVetoOplockFiles
;
382 char **printer_admin
;
387 char *szAioWriteBehind
;
391 int iMaxReportedPrintJobs
;
394 int iCreate_force_mode
;
396 int iSecurity_force_mode
;
399 int iDir_Security_mask
;
400 int iDir_Security_force_mode
;
404 int iOplockContentionLimit
;
409 bool bRootpreexecClose
;
412 bool bShortCasePreserve
;
414 bool bHideSpecialFiles
;
415 bool bHideUnReadable
;
416 bool bHideUnWriteableFiles
;
422 bool bAdministrative_share
;
428 bool bStoreDosAttributes
;
441 bool bStrictAllocate
;
444 struct bitmap
*copymap
;
445 bool bDeleteReadonly
;
447 bool bDeleteVetoFiles
;
450 bool bDosFiletimeResolution
;
451 bool bFakeDirCreateTimes
;
457 bool bUseClientDriver
;
458 bool bDefaultDevmode
;
459 bool bForcePrintername
;
461 bool bForceUnknownAclUser
;
464 bool bMap_acl_inherit
;
467 bool bAclCheckPermissions
;
468 bool bAclMapFullControl
;
469 bool bAclGroupControl
;
471 bool bKernelChangeNotify
;
472 int iallocation_roundup_size
;
476 int iDirectoryNameCacheSize
;
478 param_opt_struct
*param_opt
;
480 char dummy
[3]; /* for alignment */
484 /* This is a default service used to prime a services structure */
485 static struct service sDefault
= {
487 False
, /* not autoloaded */
488 0, /* not a usershare */
489 (time_t)0, /* No last mod time */
490 NULL
, /* szService */
492 NULL
, /* szUsername */
493 NULL
, /* szInvalidUsers */
494 NULL
, /* szValidUsers */
495 NULL
, /* szAdminUsers */
497 NULL
, /* szInclude */
498 NULL
, /* szPreExec */
499 NULL
, /* szPostExec */
500 NULL
, /* szRootPreExec */
501 NULL
, /* szRootPostExec */
502 NULL
, /* szCupsOptions */
503 NULL
, /* szPrintcommand */
504 NULL
, /* szLpqcommand */
505 NULL
, /* szLprmcommand */
506 NULL
, /* szLppausecommand */
507 NULL
, /* szLpresumecommand */
508 NULL
, /* szQueuepausecommand */
509 NULL
, /* szQueueresumecommand */
510 NULL
, /* szPrintername */
511 NULL
, /* szPrintjobUsername */
512 NULL
, /* szDontdescend */
513 NULL
, /* szHostsallow */
514 NULL
, /* szHostsdeny */
515 NULL
, /* szMagicScript */
516 NULL
, /* szMagicOutput */
517 NULL
, /* szVetoFiles */
518 NULL
, /* szHideFiles */
519 NULL
, /* szVetoOplockFiles */
521 NULL
, /* force user */
522 NULL
, /* force group */
524 NULL
, /* writelist */
525 NULL
, /* printer admin */
528 NULL
, /* vfs objects */
529 NULL
, /* szMSDfsProxy */
530 NULL
, /* szAioWriteBehind */
532 0, /* iMinPrintSpace */
533 1000, /* iMaxPrintJobs */
534 0, /* iMaxReportedPrintJobs */
535 0, /* iWriteCacheSize */
536 0744, /* iCreate_mask */
537 0000, /* iCreate_force_mode */
538 0777, /* iSecurity_mask */
539 0, /* iSecurity_force_mode */
540 0755, /* iDir_mask */
541 0000, /* iDir_force_mode */
542 0777, /* iDir_Security_mask */
543 0, /* iDir_Security_force_mode */
544 0, /* iMaxConnections */
545 CASE_LOWER
, /* iDefaultCase */
546 DEFAULT_PRINTING
, /* iPrinting */
547 2, /* iOplockContentionLimit */
549 1024, /* iBlock_size */
550 0, /* iDfreeCacheTime */
551 False
, /* bPreexecClose */
552 False
, /* bRootpreexecClose */
553 Auto
, /* case sensitive */
554 True
, /* case preserve */
555 True
, /* short case preserve */
556 True
, /* bHideDotFiles */
557 False
, /* bHideSpecialFiles */
558 False
, /* bHideUnReadable */
559 False
, /* bHideUnWriteableFiles */
560 True
, /* bBrowseable */
561 True
, /* bAvailable */
562 True
, /* bRead_only */
563 True
, /* bNo_set_dir */
564 False
, /* bGuest_only */
565 False
, /* bAdministrative_share */
566 False
, /* bGuest_ok */
567 False
, /* bPrint_ok */
568 False
, /* bMap_system */
569 False
, /* bMap_hidden */
570 True
, /* bMap_archive */
571 False
, /* bStoreDosAttributes */
572 False
, /* bDmapiSupport */
574 Auto
, /* iStrictLocking */
575 True
, /* bPosixLocking */
576 True
, /* bShareModes */
578 True
, /* bLevel2OpLocks */
579 False
, /* bOnlyUser */
580 True
, /* bMangledNames */
581 True
, /* bWidelinks */
582 True
, /* bSymlinks */
583 False
, /* bSyncAlways */
584 False
, /* bStrictAllocate */
585 False
, /* bStrictSync */
586 '~', /* magic char */
588 False
, /* bDeleteReadonly */
589 False
, /* bFakeOplocks */
590 False
, /* bDeleteVetoFiles */
591 False
, /* bDosFilemode */
592 True
, /* bDosFiletimes */
593 False
, /* bDosFiletimeResolution */
594 False
, /* bFakeDirCreateTimes */
595 True
, /* bBlockingLocks */
596 False
, /* bInheritPerms */
597 False
, /* bInheritACLS */
598 False
, /* bInheritOwner */
599 False
, /* bMSDfsRoot */
600 False
, /* bUseClientDriver */
601 True
, /* bDefaultDevmode */
602 False
, /* bForcePrintername */
603 True
, /* bNTAclSupport */
604 False
, /* bForceUnknownAclUser */
605 False
, /* bUseSendfile */
606 False
, /* bProfileAcls */
607 False
, /* bMap_acl_inherit */
608 False
, /* bAfs_Share */
609 False
, /* bEASupport */
610 True
, /* bAclCheckPermissions */
611 True
, /* bAclMapFullControl */
612 False
, /* bAclGroupControl */
613 True
, /* bChangeNotify */
614 True
, /* bKernelChangeNotify */
615 SMB_ROUNDUP_ALLOCATION_SIZE
, /* iallocation_roundup_size */
616 0, /* iAioReadSize */
617 0, /* iAioWriteSize */
618 MAP_READONLY_YES
, /* iMap_readonly */
619 #ifdef BROKEN_DIRECTORY_HANDLING
620 0, /* iDirectoryNameCacheSize */
622 100, /* iDirectoryNameCacheSize */
624 Auto
, /* ismb_encrypt */
625 NULL
, /* Parametric options */
630 /* local variables */
631 static struct service
**ServicePtrs
= NULL
;
632 static int iNumServices
= 0;
633 static int iServiceIndex
= 0;
634 static struct db_context
*ServiceHash
;
635 static int *invalid_services
= NULL
;
636 static int num_invalid_services
= 0;
637 static bool bInGlobalSection
= True
;
638 static bool bGlobalOnly
= False
;
639 static int server_role
;
640 static int default_server_announce
;
642 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
644 /* prototypes for the special type handlers */
645 static bool handle_include( int snum
, const char *pszParmValue
, char **ptr
);
646 static bool handle_copy( int snum
, const char *pszParmValue
, char **ptr
);
647 static bool handle_netbios_name( int snum
, const char *pszParmValue
, char **ptr
);
648 static bool handle_idmap_uid( int snum
, const char *pszParmValue
, char **ptr
);
649 static bool handle_idmap_gid( int snum
, const char *pszParmValue
, char **ptr
);
650 static bool handle_debug_list( int snum
, const char *pszParmValue
, char **ptr
);
651 static bool handle_workgroup( int snum
, const char *pszParmValue
, char **ptr
);
652 static bool handle_netbios_aliases( int snum
, const char *pszParmValue
, char **ptr
);
653 static bool handle_netbios_scope( int snum
, const char *pszParmValue
, char **ptr
);
654 static bool handle_charset( int snum
, const char *pszParmValue
, char **ptr
);
655 static bool handle_printing( int snum
, const char *pszParmValue
, char **ptr
);
656 static bool handle_ldap_debug_level( int snum
, const char *pszParmValue
, char **ptr
);
658 static void set_server_role(void);
659 static void set_default_server_announce_type(void);
660 static void set_allowed_client_auth(void);
662 static const struct enum_list enum_protocol
[] = {
663 {PROTOCOL_NT1
, "NT1"},
664 {PROTOCOL_LANMAN2
, "LANMAN2"},
665 {PROTOCOL_LANMAN1
, "LANMAN1"},
666 {PROTOCOL_CORE
, "CORE"},
667 {PROTOCOL_COREPLUS
, "COREPLUS"},
668 {PROTOCOL_COREPLUS
, "CORE+"},
672 static const struct enum_list enum_security
[] = {
673 {SEC_SHARE
, "SHARE"},
675 {SEC_SERVER
, "SERVER"},
676 {SEC_DOMAIN
, "DOMAIN"},
683 static const struct enum_list enum_printing
[] = {
684 {PRINT_SYSV
, "sysv"},
686 {PRINT_HPUX
, "hpux"},
690 {PRINT_LPRNG
, "lprng"},
691 {PRINT_CUPS
, "cups"},
692 {PRINT_IPRINT
, "iprint"},
694 {PRINT_LPROS2
, "os2"},
696 {PRINT_TEST
, "test"},
698 #endif /* DEVELOPER */
702 static const struct enum_list enum_ldap_sasl_wrapping
[] = {
704 {ADS_AUTH_SASL_SIGN
, "sign"},
705 {ADS_AUTH_SASL_SEAL
, "seal"},
709 static const struct enum_list enum_ldap_ssl
[] = {
710 {LDAP_SSL_OFF
, "no"},
711 {LDAP_SSL_OFF
, "No"},
712 {LDAP_SSL_OFF
, "off"},
713 {LDAP_SSL_OFF
, "Off"},
714 {LDAP_SSL_START_TLS
, "start tls"},
715 {LDAP_SSL_START_TLS
, "Start_tls"},
719 static const struct enum_list enum_ldap_passwd_sync
[] = {
720 {LDAP_PASSWD_SYNC_OFF
, "no"},
721 {LDAP_PASSWD_SYNC_OFF
, "No"},
722 {LDAP_PASSWD_SYNC_OFF
, "off"},
723 {LDAP_PASSWD_SYNC_OFF
, "Off"},
724 {LDAP_PASSWD_SYNC_ON
, "Yes"},
725 {LDAP_PASSWD_SYNC_ON
, "yes"},
726 {LDAP_PASSWD_SYNC_ON
, "on"},
727 {LDAP_PASSWD_SYNC_ON
, "On"},
728 {LDAP_PASSWD_SYNC_ONLY
, "Only"},
729 {LDAP_PASSWD_SYNC_ONLY
, "only"},
733 /* Types of machine we can announce as. */
734 #define ANNOUNCE_AS_NT_SERVER 1
735 #define ANNOUNCE_AS_WIN95 2
736 #define ANNOUNCE_AS_WFW 3
737 #define ANNOUNCE_AS_NT_WORKSTATION 4
739 static const struct enum_list enum_announce_as
[] = {
740 {ANNOUNCE_AS_NT_SERVER
, "NT"},
741 {ANNOUNCE_AS_NT_SERVER
, "NT Server"},
742 {ANNOUNCE_AS_NT_WORKSTATION
, "NT Workstation"},
743 {ANNOUNCE_AS_WIN95
, "win95"},
744 {ANNOUNCE_AS_WFW
, "WfW"},
748 static const struct enum_list enum_map_readonly
[] = {
749 {MAP_READONLY_NO
, "no"},
750 {MAP_READONLY_NO
, "false"},
751 {MAP_READONLY_NO
, "0"},
752 {MAP_READONLY_YES
, "yes"},
753 {MAP_READONLY_YES
, "true"},
754 {MAP_READONLY_YES
, "1"},
755 {MAP_READONLY_PERMISSIONS
, "permissions"},
756 {MAP_READONLY_PERMISSIONS
, "perms"},
760 static const struct enum_list enum_case
[] = {
761 {CASE_LOWER
, "lower"},
762 {CASE_UPPER
, "upper"},
766 static const struct enum_list enum_bool_auto
[] = {
777 /* Client-side offline caching policy types */
778 #define CSC_POLICY_MANUAL 0
779 #define CSC_POLICY_DOCUMENTS 1
780 #define CSC_POLICY_PROGRAMS 2
781 #define CSC_POLICY_DISABLE 3
783 static const struct enum_list enum_csc_policy
[] = {
784 {CSC_POLICY_MANUAL
, "manual"},
785 {CSC_POLICY_DOCUMENTS
, "documents"},
786 {CSC_POLICY_PROGRAMS
, "programs"},
787 {CSC_POLICY_DISABLE
, "disable"},
791 /* SMB signing types. */
792 static const struct enum_list enum_smb_signing_vals
[] = {
804 {Required
, "required"},
805 {Required
, "mandatory"},
807 {Required
, "forced"},
808 {Required
, "enforced"},
812 /* ACL compatibility options. */
813 static const struct enum_list enum_acl_compat_vals
[] = {
814 { ACL_COMPAT_AUTO
, "auto" },
815 { ACL_COMPAT_WINNT
, "winnt" },
816 { ACL_COMPAT_WIN2K
, "win2k" },
821 Do you want session setups at user level security with a invalid
822 password to be rejected or allowed in as guest? WinNT rejects them
823 but it can be a pain as it means "net view" needs to use a password
825 You have 3 choices in the setting of map_to_guest:
827 "Never" means session setups with an invalid password
828 are rejected. This is the default.
830 "Bad User" means session setups with an invalid password
831 are rejected, unless the username does not exist, in which case it
832 is treated as a guest login
834 "Bad Password" means session setups with an invalid password
835 are treated as a guest login
837 Note that map_to_guest only has an effect in user or server
841 static const struct enum_list enum_map_to_guest
[] = {
842 {NEVER_MAP_TO_GUEST
, "Never"},
843 {MAP_TO_GUEST_ON_BAD_USER
, "Bad User"},
844 {MAP_TO_GUEST_ON_BAD_PASSWORD
, "Bad Password"},
845 {MAP_TO_GUEST_ON_BAD_UID
, "Bad Uid"},
849 /* Config backend options */
851 static const struct enum_list enum_config_backend
[] = {
852 {CONFIG_BACKEND_FILE
, "file"},
853 {CONFIG_BACKEND_REGISTRY
, "registry"},
857 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
859 * The FLAG_HIDE is explicit. Paramters set this way do NOT appear in any edit
860 * screen in SWAT. This is used to exclude parameters as well as to squash all
861 * parameters that have been duplicated by pseudonyms.
863 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
864 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
865 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
868 * NOTE2: Handling of duplicated (synonym) paramters:
869 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
870 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
871 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
872 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
875 static struct parm_struct parm_table
[] = {
876 {N_("Base Options"), P_SEP
, P_SEPARATOR
},
879 .label
= "dos charset",
882 .ptr
= &Globals
.dos_charset
,
883 .special
= handle_charset
,
885 .flags
= FLAG_ADVANCED
888 .label
= "unix charset",
891 .ptr
= &Globals
.unix_charset
,
892 .special
= handle_charset
,
894 .flags
= FLAG_ADVANCED
897 .label
= "display charset",
900 .ptr
= &Globals
.display_charset
,
901 .special
= handle_charset
,
903 .flags
= FLAG_ADVANCED
909 .ptr
= &sDefault
.comment
,
912 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
918 .ptr
= &sDefault
.szPath
,
921 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
924 .label
= "directory",
927 .ptr
= &sDefault
.szPath
,
933 .label
= "workgroup",
936 .ptr
= &Globals
.szWorkgroup
,
937 .special
= handle_workgroup
,
939 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
946 .ptr
= &Globals
.szRealm
,
949 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
953 .label
= "netbios name",
956 .ptr
= &Globals
.szNetbiosName
,
957 .special
= handle_netbios_name
,
959 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
962 .label
= "netbios aliases",
965 .ptr
= &Globals
.szNetbiosAliases
,
966 .special
= handle_netbios_aliases
,
968 .flags
= FLAG_ADVANCED
,
971 .label
= "netbios scope",
974 .ptr
= &Globals
.szNetbiosScope
,
975 .special
= handle_netbios_scope
,
977 .flags
= FLAG_ADVANCED
,
980 .label
= "server string",
983 .ptr
= &Globals
.szServerString
,
986 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
989 .label
= "interfaces",
992 .ptr
= &Globals
.szInterfaces
,
995 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
998 .label
= "bind interfaces only",
1000 .p_class
= P_GLOBAL
,
1001 .ptr
= &Globals
.bBindInterfacesOnly
,
1004 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1007 .label
= "config backend",
1009 .p_class
= P_GLOBAL
,
1010 .ptr
= &Globals
.ConfigBackend
,
1012 .enum_list
= enum_config_backend
,
1013 .flags
= FLAG_ADVANCED
,
1016 {N_("Security Options"), P_SEP
, P_SEPARATOR
},
1019 .label
= "security",
1021 .p_class
= P_GLOBAL
,
1022 .ptr
= &Globals
.security
,
1024 .enum_list
= enum_security
,
1025 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1028 .label
= "auth methods",
1030 .p_class
= P_GLOBAL
,
1031 .ptr
= &Globals
.AuthMethods
,
1034 .flags
= FLAG_ADVANCED
,
1037 .label
= "encrypt passwords",
1039 .p_class
= P_GLOBAL
,
1040 .ptr
= &Globals
.bEncryptPasswords
,
1043 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
1046 .label
= "update encrypted",
1048 .p_class
= P_GLOBAL
,
1049 .ptr
= &Globals
.bUpdateEncrypt
,
1052 .flags
= FLAG_ADVANCED
,
1055 .label
= "client schannel",
1057 .p_class
= P_GLOBAL
,
1058 .ptr
= &Globals
.clientSchannel
,
1060 .enum_list
= enum_bool_auto
,
1061 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1064 .label
= "server schannel",
1066 .p_class
= P_GLOBAL
,
1067 .ptr
= &Globals
.serverSchannel
,
1069 .enum_list
= enum_bool_auto
,
1070 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1073 .label
= "allow trusted domains",
1075 .p_class
= P_GLOBAL
,
1076 .ptr
= &Globals
.bAllowTrustedDomains
,
1079 .flags
= FLAG_ADVANCED
,
1082 .label
= "map to guest",
1084 .p_class
= P_GLOBAL
,
1085 .ptr
= &Globals
.map_to_guest
,
1087 .enum_list
= enum_map_to_guest
,
1088 .flags
= FLAG_ADVANCED
,
1091 .label
= "null passwords",
1093 .p_class
= P_GLOBAL
,
1094 .ptr
= &Globals
.bNullPasswords
,
1097 .flags
= FLAG_ADVANCED
,
1100 .label
= "obey pam restrictions",
1102 .p_class
= P_GLOBAL
,
1103 .ptr
= &Globals
.bObeyPamRestrictions
,
1106 .flags
= FLAG_ADVANCED
,
1109 .label
= "password server",
1111 .p_class
= P_GLOBAL
,
1112 .ptr
= &Globals
.szPasswordServer
,
1115 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1118 .label
= "smb passwd file",
1120 .p_class
= P_GLOBAL
,
1121 .ptr
= &Globals
.szSMBPasswdFile
,
1124 .flags
= FLAG_ADVANCED
,
1127 .label
= "private dir",
1129 .p_class
= P_GLOBAL
,
1130 .ptr
= &Globals
.szPrivateDir
,
1133 .flags
= FLAG_ADVANCED
,
1136 .label
= "passdb backend",
1138 .p_class
= P_GLOBAL
,
1139 .ptr
= &Globals
.szPassdbBackend
,
1142 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
1145 .label
= "algorithmic rid base",
1147 .p_class
= P_GLOBAL
,
1148 .ptr
= &Globals
.AlgorithmicRidBase
,
1151 .flags
= FLAG_ADVANCED
,
1154 .label
= "root directory",
1156 .p_class
= P_GLOBAL
,
1157 .ptr
= &Globals
.szRootdir
,
1160 .flags
= FLAG_ADVANCED
,
1163 .label
= "root dir",
1165 .p_class
= P_GLOBAL
,
1166 .ptr
= &Globals
.szRootdir
,
1174 .p_class
= P_GLOBAL
,
1175 .ptr
= &Globals
.szRootdir
,
1181 .label
= "guest account",
1183 .p_class
= P_GLOBAL
,
1184 .ptr
= &Globals
.szGuestaccount
,
1187 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
1190 .label
= "enable privileges",
1192 .p_class
= P_GLOBAL
,
1193 .ptr
= &Globals
.bEnablePrivileges
,
1196 .flags
= FLAG_ADVANCED
,
1200 .label
= "pam password change",
1202 .p_class
= P_GLOBAL
,
1203 .ptr
= &Globals
.bPamPasswordChange
,
1206 .flags
= FLAG_ADVANCED
,
1209 .label
= "passwd program",
1211 .p_class
= P_GLOBAL
,
1212 .ptr
= &Globals
.szPasswdProgram
,
1215 .flags
= FLAG_ADVANCED
,
1218 .label
= "passwd chat",
1220 .p_class
= P_GLOBAL
,
1221 .ptr
= &Globals
.szPasswdChat
,
1224 .flags
= FLAG_ADVANCED
,
1227 .label
= "passwd chat debug",
1229 .p_class
= P_GLOBAL
,
1230 .ptr
= &Globals
.bPasswdChatDebug
,
1233 .flags
= FLAG_ADVANCED
,
1236 .label
= "passwd chat timeout",
1238 .p_class
= P_GLOBAL
,
1239 .ptr
= &Globals
.iPasswdChatTimeout
,
1242 .flags
= FLAG_ADVANCED
,
1245 .label
= "check password script",
1247 .p_class
= P_GLOBAL
,
1248 .ptr
= &Globals
.szCheckPasswordScript
,
1251 .flags
= FLAG_ADVANCED
,
1254 .label
= "username map",
1256 .p_class
= P_GLOBAL
,
1257 .ptr
= &Globals
.szUsernameMap
,
1260 .flags
= FLAG_ADVANCED
,
1263 .label
= "password level",
1265 .p_class
= P_GLOBAL
,
1266 .ptr
= &Globals
.pwordlevel
,
1269 .flags
= FLAG_ADVANCED
,
1272 .label
= "username level",
1274 .p_class
= P_GLOBAL
,
1275 .ptr
= &Globals
.unamelevel
,
1278 .flags
= FLAG_ADVANCED
,
1281 .label
= "unix password sync",
1283 .p_class
= P_GLOBAL
,
1284 .ptr
= &Globals
.bUnixPasswdSync
,
1287 .flags
= FLAG_ADVANCED
,
1290 .label
= "restrict anonymous",
1292 .p_class
= P_GLOBAL
,
1293 .ptr
= &Globals
.restrict_anonymous
,
1296 .flags
= FLAG_ADVANCED
,
1299 .label
= "lanman auth",
1301 .p_class
= P_GLOBAL
,
1302 .ptr
= &Globals
.bLanmanAuth
,
1305 .flags
= FLAG_ADVANCED
,
1308 .label
= "ntlm auth",
1310 .p_class
= P_GLOBAL
,
1311 .ptr
= &Globals
.bNTLMAuth
,
1314 .flags
= FLAG_ADVANCED
,
1317 .label
= "client NTLMv2 auth",
1319 .p_class
= P_GLOBAL
,
1320 .ptr
= &Globals
.bClientNTLMv2Auth
,
1323 .flags
= FLAG_ADVANCED
,
1326 .label
= "client lanman auth",
1328 .p_class
= P_GLOBAL
,
1329 .ptr
= &Globals
.bClientLanManAuth
,
1332 .flags
= FLAG_ADVANCED
,
1335 .label
= "client plaintext auth",
1337 .p_class
= P_GLOBAL
,
1338 .ptr
= &Globals
.bClientPlaintextAuth
,
1341 .flags
= FLAG_ADVANCED
,
1344 .label
= "username",
1347 .ptr
= &sDefault
.szUsername
,
1350 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1356 .ptr
= &sDefault
.szUsername
,
1365 .ptr
= &sDefault
.szUsername
,
1371 .label
= "invalid users",
1374 .ptr
= &sDefault
.szInvalidUsers
,
1377 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1380 .label
= "valid users",
1383 .ptr
= &sDefault
.szValidUsers
,
1386 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1389 .label
= "admin users",
1392 .ptr
= &sDefault
.szAdminUsers
,
1395 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1398 .label
= "read list",
1401 .ptr
= &sDefault
.readlist
,
1404 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1407 .label
= "write list",
1410 .ptr
= &sDefault
.writelist
,
1413 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1416 .label
= "printer admin",
1419 .ptr
= &sDefault
.printer_admin
,
1422 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_PRINT
| FLAG_DEPRECATED
,
1425 .label
= "force user",
1428 .ptr
= &sDefault
.force_user
,
1431 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1434 .label
= "force group",
1437 .ptr
= &sDefault
.force_group
,
1440 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1446 .ptr
= &sDefault
.force_group
,
1449 .flags
= FLAG_ADVANCED
,
1452 .label
= "read only",
1455 .ptr
= &sDefault
.bRead_only
,
1458 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
,
1461 .label
= "write ok",
1464 .ptr
= &sDefault
.bRead_only
,
1470 .label
= "writeable",
1473 .ptr
= &sDefault
.bRead_only
,
1479 .label
= "writable",
1482 .ptr
= &sDefault
.bRead_only
,
1488 .label
= "acl check permissions",
1491 .ptr
= &sDefault
.bAclCheckPermissions
,
1494 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1497 .label
= "acl group control",
1500 .ptr
= &sDefault
.bAclGroupControl
,
1503 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
| FLAG_DEPRECATED
,
1506 .label
= "acl map full control",
1509 .ptr
= &sDefault
.bAclMapFullControl
,
1512 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1515 .label
= "create mask",
1518 .ptr
= &sDefault
.iCreate_mask
,
1521 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1524 .label
= "create mode",
1527 .ptr
= &sDefault
.iCreate_mask
,
1533 .label
= "force create mode",
1536 .ptr
= &sDefault
.iCreate_force_mode
,
1539 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1542 .label
= "security mask",
1545 .ptr
= &sDefault
.iSecurity_mask
,
1548 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1551 .label
= "force security mode",
1554 .ptr
= &sDefault
.iSecurity_force_mode
,
1557 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1560 .label
= "directory mask",
1563 .ptr
= &sDefault
.iDir_mask
,
1566 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1569 .label
= "directory mode",
1572 .ptr
= &sDefault
.iDir_mask
,
1575 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1578 .label
= "force directory mode",
1581 .ptr
= &sDefault
.iDir_force_mode
,
1584 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1587 .label
= "directory security mask",
1590 .ptr
= &sDefault
.iDir_Security_mask
,
1593 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1596 .label
= "force directory security mode",
1599 .ptr
= &sDefault
.iDir_Security_force_mode
,
1602 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1605 .label
= "force unknown acl user",
1608 .ptr
= &sDefault
.bForceUnknownAclUser
,
1611 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
1614 .label
= "inherit permissions",
1617 .ptr
= &sDefault
.bInheritPerms
,
1620 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1623 .label
= "inherit acls",
1626 .ptr
= &sDefault
.bInheritACLS
,
1629 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1632 .label
= "inherit owner",
1635 .ptr
= &sDefault
.bInheritOwner
,
1638 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1641 .label
= "guest only",
1644 .ptr
= &sDefault
.bGuest_only
,
1647 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
1650 .label
= "only guest",
1653 .ptr
= &sDefault
.bGuest_only
,
1659 .label
= "administrative share",
1662 .ptr
= &sDefault
.bAdministrative_share
,
1665 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1669 .label
= "guest ok",
1672 .ptr
= &sDefault
.bGuest_ok
,
1675 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1681 .ptr
= &sDefault
.bGuest_ok
,
1687 .label
= "only user",
1690 .ptr
= &sDefault
.bOnlyUser
,
1693 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_DEPRECATED
,
1696 .label
= "hosts allow",
1699 .ptr
= &sDefault
.szHostsallow
,
1702 .flags
= FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1705 .label
= "allow hosts",
1708 .ptr
= &sDefault
.szHostsallow
,
1714 .label
= "hosts deny",
1717 .ptr
= &sDefault
.szHostsdeny
,
1720 .flags
= FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
1723 .label
= "deny hosts",
1726 .ptr
= &sDefault
.szHostsdeny
,
1732 .label
= "preload modules",
1734 .p_class
= P_GLOBAL
,
1735 .ptr
= &Globals
.szPreloadModules
,
1738 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
1741 .label
= "use kerberos keytab",
1743 .p_class
= P_GLOBAL
,
1744 .ptr
= &Globals
.bUseKerberosKeytab
,
1747 .flags
= FLAG_ADVANCED
,
1750 {N_("Logging Options"), P_SEP
, P_SEPARATOR
},
1753 .label
= "log level",
1755 .p_class
= P_GLOBAL
,
1756 .ptr
= &Globals
.szLogLevel
,
1757 .special
= handle_debug_list
,
1759 .flags
= FLAG_ADVANCED
,
1762 .label
= "debuglevel",
1764 .p_class
= P_GLOBAL
,
1765 .ptr
= &Globals
.szLogLevel
,
1766 .special
= handle_debug_list
,
1773 .p_class
= P_GLOBAL
,
1774 .ptr
= &Globals
.syslog
,
1777 .flags
= FLAG_ADVANCED
,
1780 .label
= "syslog only",
1782 .p_class
= P_GLOBAL
,
1783 .ptr
= &Globals
.bSyslogOnly
,
1786 .flags
= FLAG_ADVANCED
,
1789 .label
= "log file",
1791 .p_class
= P_GLOBAL
,
1792 .ptr
= &Globals
.szLogFile
,
1795 .flags
= FLAG_ADVANCED
,
1798 .label
= "max log size",
1800 .p_class
= P_GLOBAL
,
1801 .ptr
= &Globals
.max_log_size
,
1804 .flags
= FLAG_ADVANCED
,
1807 .label
= "debug timestamp",
1809 .p_class
= P_GLOBAL
,
1810 .ptr
= &Globals
.bTimestampLogs
,
1813 .flags
= FLAG_ADVANCED
,
1816 .label
= "timestamp logs",
1818 .p_class
= P_GLOBAL
,
1819 .ptr
= &Globals
.bTimestampLogs
,
1822 .flags
= FLAG_ADVANCED
,
1825 .label
= "debug prefix timestamp",
1827 .p_class
= P_GLOBAL
,
1828 .ptr
= &Globals
.bDebugPrefixTimestamp
,
1831 .flags
= FLAG_ADVANCED
,
1834 .label
= "debug hires timestamp",
1836 .p_class
= P_GLOBAL
,
1837 .ptr
= &Globals
.bDebugHiresTimestamp
,
1840 .flags
= FLAG_ADVANCED
,
1843 .label
= "debug pid",
1845 .p_class
= P_GLOBAL
,
1846 .ptr
= &Globals
.bDebugPid
,
1849 .flags
= FLAG_ADVANCED
,
1852 .label
= "debug uid",
1854 .p_class
= P_GLOBAL
,
1855 .ptr
= &Globals
.bDebugUid
,
1858 .flags
= FLAG_ADVANCED
,
1861 .label
= "debug class",
1863 .p_class
= P_GLOBAL
,
1864 .ptr
= &Globals
.bDebugClass
,
1867 .flags
= FLAG_ADVANCED
,
1870 .label
= "enable core files",
1872 .p_class
= P_GLOBAL
,
1873 .ptr
= &Globals
.bEnableCoreFiles
,
1876 .flags
= FLAG_ADVANCED
,
1879 {N_("Protocol Options"), P_SEP
, P_SEPARATOR
},
1882 .label
= "allocation roundup size",
1885 .ptr
= &sDefault
.iallocation_roundup_size
,
1888 .flags
= FLAG_ADVANCED
,
1891 .label
= "aio read size",
1894 .ptr
= &sDefault
.iAioReadSize
,
1897 .flags
= FLAG_ADVANCED
,
1900 .label
= "aio write size",
1903 .ptr
= &sDefault
.iAioWriteSize
,
1906 .flags
= FLAG_ADVANCED
,
1909 .label
= "aio write behind",
1912 .ptr
= &sDefault
.szAioWriteBehind
,
1915 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
1918 .label
= "smb ports",
1920 .p_class
= P_GLOBAL
,
1921 .ptr
= &Globals
.smb_ports
,
1924 .flags
= FLAG_ADVANCED
,
1927 .label
= "large readwrite",
1929 .p_class
= P_GLOBAL
,
1930 .ptr
= &Globals
.bLargeReadwrite
,
1933 .flags
= FLAG_ADVANCED
,
1936 .label
= "max protocol",
1938 .p_class
= P_GLOBAL
,
1939 .ptr
= &Globals
.maxprotocol
,
1941 .enum_list
= enum_protocol
,
1942 .flags
= FLAG_ADVANCED
,
1945 .label
= "protocol",
1947 .p_class
= P_GLOBAL
,
1948 .ptr
= &Globals
.maxprotocol
,
1950 .enum_list
= enum_protocol
,
1951 .flags
= FLAG_ADVANCED
,
1954 .label
= "min protocol",
1956 .p_class
= P_GLOBAL
,
1957 .ptr
= &Globals
.minprotocol
,
1959 .enum_list
= enum_protocol
,
1960 .flags
= FLAG_ADVANCED
,
1963 .label
= "min receivefile size",
1965 .p_class
= P_GLOBAL
,
1966 .ptr
= &Globals
.iminreceivefile
,
1969 .flags
= FLAG_ADVANCED
,
1972 .label
= "read raw",
1974 .p_class
= P_GLOBAL
,
1975 .ptr
= &Globals
.bReadRaw
,
1978 .flags
= FLAG_ADVANCED
,
1981 .label
= "write raw",
1983 .p_class
= P_GLOBAL
,
1984 .ptr
= &Globals
.bWriteRaw
,
1987 .flags
= FLAG_ADVANCED
,
1990 .label
= "disable netbios",
1992 .p_class
= P_GLOBAL
,
1993 .ptr
= &Globals
.bDisableNetbios
,
1996 .flags
= FLAG_ADVANCED
,
1999 .label
= "reset on zero vc",
2001 .p_class
= P_GLOBAL
,
2002 .ptr
= &Globals
.bResetOnZeroVC
,
2005 .flags
= FLAG_ADVANCED
,
2008 .label
= "acl compatibility",
2010 .p_class
= P_GLOBAL
,
2011 .ptr
= &Globals
.iAclCompat
,
2013 .enum_list
= enum_acl_compat_vals
,
2014 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2017 .label
= "defer sharing violations",
2019 .p_class
= P_GLOBAL
,
2020 .ptr
= &Globals
.bDeferSharingViolations
,
2023 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2026 .label
= "ea support",
2029 .ptr
= &sDefault
.bEASupport
,
2032 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2035 .label
= "nt acl support",
2038 .ptr
= &sDefault
.bNTAclSupport
,
2041 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2044 .label
= "nt pipe support",
2046 .p_class
= P_GLOBAL
,
2047 .ptr
= &Globals
.bNTPipeSupport
,
2050 .flags
= FLAG_ADVANCED
,
2053 .label
= "nt status support",
2055 .p_class
= P_GLOBAL
,
2056 .ptr
= &Globals
.bNTStatusSupport
,
2059 .flags
= FLAG_ADVANCED
,
2062 .label
= "profile acls",
2065 .ptr
= &sDefault
.bProfileAcls
,
2068 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
2071 .label
= "announce version",
2073 .p_class
= P_GLOBAL
,
2074 .ptr
= &Globals
.szAnnounceVersion
,
2077 .flags
= FLAG_ADVANCED
,
2080 .label
= "announce as",
2082 .p_class
= P_GLOBAL
,
2083 .ptr
= &Globals
.announce_as
,
2085 .enum_list
= enum_announce_as
,
2086 .flags
= FLAG_ADVANCED
,
2089 .label
= "map acl inherit",
2092 .ptr
= &sDefault
.bMap_acl_inherit
,
2095 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2098 .label
= "afs share",
2101 .ptr
= &sDefault
.bAfs_Share
,
2104 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2109 .p_class
= P_GLOBAL
,
2110 .ptr
= &Globals
.max_mux
,
2113 .flags
= FLAG_ADVANCED
,
2116 .label
= "max xmit",
2118 .p_class
= P_GLOBAL
,
2119 .ptr
= &Globals
.max_xmit
,
2122 .flags
= FLAG_ADVANCED
,
2125 .label
= "name resolve order",
2127 .p_class
= P_GLOBAL
,
2128 .ptr
= &Globals
.szNameResolveOrder
,
2131 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
2136 .p_class
= P_GLOBAL
,
2137 .ptr
= &Globals
.max_ttl
,
2140 .flags
= FLAG_ADVANCED
,
2143 .label
= "max wins ttl",
2145 .p_class
= P_GLOBAL
,
2146 .ptr
= &Globals
.max_wins_ttl
,
2149 .flags
= FLAG_ADVANCED
,
2152 .label
= "min wins ttl",
2154 .p_class
= P_GLOBAL
,
2155 .ptr
= &Globals
.min_wins_ttl
,
2158 .flags
= FLAG_ADVANCED
,
2161 .label
= "time server",
2163 .p_class
= P_GLOBAL
,
2164 .ptr
= &Globals
.bTimeServer
,
2167 .flags
= FLAG_ADVANCED
,
2170 .label
= "unix extensions",
2172 .p_class
= P_GLOBAL
,
2173 .ptr
= &Globals
.bUnixExtensions
,
2176 .flags
= FLAG_ADVANCED
,
2179 .label
= "use spnego",
2181 .p_class
= P_GLOBAL
,
2182 .ptr
= &Globals
.bUseSpnego
,
2185 .flags
= FLAG_ADVANCED
,
2188 .label
= "client signing",
2190 .p_class
= P_GLOBAL
,
2191 .ptr
= &Globals
.client_signing
,
2193 .enum_list
= enum_smb_signing_vals
,
2194 .flags
= FLAG_ADVANCED
,
2197 .label
= "server signing",
2199 .p_class
= P_GLOBAL
,
2200 .ptr
= &Globals
.server_signing
,
2202 .enum_list
= enum_smb_signing_vals
,
2203 .flags
= FLAG_ADVANCED
,
2206 .label
= "smb encrypt",
2209 .ptr
= &sDefault
.ismb_encrypt
,
2211 .enum_list
= enum_smb_signing_vals
,
2212 .flags
= FLAG_ADVANCED
,
2215 .label
= "client use spnego",
2217 .p_class
= P_GLOBAL
,
2218 .ptr
= &Globals
.bClientUseSpnego
,
2221 .flags
= FLAG_ADVANCED
,
2224 .label
= "client ldap sasl wrapping",
2226 .p_class
= P_GLOBAL
,
2227 .ptr
= &Globals
.client_ldap_sasl_wrapping
,
2229 .enum_list
= enum_ldap_sasl_wrapping
,
2230 .flags
= FLAG_ADVANCED
,
2233 .label
= "enable asu support",
2235 .p_class
= P_GLOBAL
,
2236 .ptr
= &Globals
.bASUSupport
,
2239 .flags
= FLAG_ADVANCED
,
2242 .label
= "svcctl list",
2244 .p_class
= P_GLOBAL
,
2245 .ptr
= &Globals
.szServicesList
,
2248 .flags
= FLAG_ADVANCED
,
2251 {N_("Tuning Options"), P_SEP
, P_SEPARATOR
},
2254 .label
= "block size",
2257 .ptr
= &sDefault
.iBlock_size
,
2260 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2263 .label
= "deadtime",
2265 .p_class
= P_GLOBAL
,
2266 .ptr
= &Globals
.deadtime
,
2269 .flags
= FLAG_ADVANCED
,
2272 .label
= "getwd cache",
2274 .p_class
= P_GLOBAL
,
2275 .ptr
= &Globals
.getwd_cache
,
2278 .flags
= FLAG_ADVANCED
,
2281 .label
= "keepalive",
2283 .p_class
= P_GLOBAL
,
2284 .ptr
= &Globals
.iKeepalive
,
2287 .flags
= FLAG_ADVANCED
,
2290 .label
= "change notify",
2293 .ptr
= &sDefault
.bChangeNotify
,
2296 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2299 .label
= "directory name cache size",
2302 .ptr
= &sDefault
.iDirectoryNameCacheSize
,
2305 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2308 .label
= "kernel change notify",
2311 .ptr
= &sDefault
.bKernelChangeNotify
,
2314 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2317 .label
= "lpq cache time",
2319 .p_class
= P_GLOBAL
,
2320 .ptr
= &Globals
.lpqcachetime
,
2323 .flags
= FLAG_ADVANCED
,
2326 .label
= "max smbd processes",
2328 .p_class
= P_GLOBAL
,
2329 .ptr
= &Globals
.iMaxSmbdProcesses
,
2332 .flags
= FLAG_ADVANCED
,
2335 .label
= "max connections",
2338 .ptr
= &sDefault
.iMaxConnections
,
2341 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2344 .label
= "paranoid server security",
2346 .p_class
= P_GLOBAL
,
2347 .ptr
= &Globals
.paranoid_server_security
,
2350 .flags
= FLAG_ADVANCED
,
2353 .label
= "max disk size",
2355 .p_class
= P_GLOBAL
,
2356 .ptr
= &Globals
.maxdisksize
,
2359 .flags
= FLAG_ADVANCED
,
2362 .label
= "max open files",
2364 .p_class
= P_GLOBAL
,
2365 .ptr
= &Globals
.max_open_files
,
2368 .flags
= FLAG_ADVANCED
,
2371 .label
= "min print space",
2374 .ptr
= &sDefault
.iMinPrintSpace
,
2377 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2380 .label
= "socket options",
2382 .p_class
= P_GLOBAL
,
2383 .ptr
= &Globals
.szSocketOptions
,
2386 .flags
= FLAG_ADVANCED
,
2389 .label
= "strict allocate",
2392 .ptr
= &sDefault
.bStrictAllocate
,
2395 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2398 .label
= "strict sync",
2401 .ptr
= &sDefault
.bStrictSync
,
2404 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2407 .label
= "sync always",
2410 .ptr
= &sDefault
.bSyncAlways
,
2413 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2416 .label
= "use mmap",
2418 .p_class
= P_GLOBAL
,
2419 .ptr
= &Globals
.bUseMmap
,
2422 .flags
= FLAG_ADVANCED
,
2425 .label
= "use sendfile",
2428 .ptr
= &sDefault
.bUseSendfile
,
2431 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2434 .label
= "hostname lookups",
2436 .p_class
= P_GLOBAL
,
2437 .ptr
= &Globals
.bHostnameLookups
,
2440 .flags
= FLAG_ADVANCED
,
2443 .label
= "write cache size",
2446 .ptr
= &sDefault
.iWriteCacheSize
,
2449 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_DEPRECATED
,
2452 .label
= "name cache timeout",
2454 .p_class
= P_GLOBAL
,
2455 .ptr
= &Globals
.name_cache_timeout
,
2458 .flags
= FLAG_ADVANCED
,
2461 .label
= "ctdbd socket",
2463 .p_class
= P_GLOBAL
,
2464 .ptr
= &Globals
.ctdbdSocket
,
2467 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2470 .label
= "cluster addresses",
2472 .p_class
= P_GLOBAL
,
2473 .ptr
= &Globals
.szClusterAddresses
,
2476 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2479 .label
= "clustering",
2481 .p_class
= P_GLOBAL
,
2482 .ptr
= &Globals
.clustering
,
2485 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
2488 {N_("Printing Options"), P_SEP
, P_SEPARATOR
},
2491 .label
= "max reported print jobs",
2494 .ptr
= &sDefault
.iMaxReportedPrintJobs
,
2497 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2500 .label
= "max print jobs",
2503 .ptr
= &sDefault
.iMaxPrintJobs
,
2506 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2509 .label
= "load printers",
2511 .p_class
= P_GLOBAL
,
2512 .ptr
= &Globals
.bLoadPrinters
,
2515 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2518 .label
= "printcap cache time",
2520 .p_class
= P_GLOBAL
,
2521 .ptr
= &Globals
.PrintcapCacheTime
,
2524 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2527 .label
= "printcap name",
2529 .p_class
= P_GLOBAL
,
2530 .ptr
= &Globals
.szPrintcapname
,
2533 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2536 .label
= "printcap",
2538 .p_class
= P_GLOBAL
,
2539 .ptr
= &Globals
.szPrintcapname
,
2545 .label
= "printable",
2548 .ptr
= &sDefault
.bPrint_ok
,
2551 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2554 .label
= "print ok",
2557 .ptr
= &sDefault
.bPrint_ok
,
2563 .label
= "printing",
2566 .ptr
= &sDefault
.iPrinting
,
2567 .special
= handle_printing
,
2568 .enum_list
= enum_printing
,
2569 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2572 .label
= "cups options",
2575 .ptr
= &sDefault
.szCupsOptions
,
2578 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2581 .label
= "cups server",
2583 .p_class
= P_GLOBAL
,
2584 .ptr
= &Globals
.szCupsServer
,
2587 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2590 .label
= "iprint server",
2592 .p_class
= P_GLOBAL
,
2593 .ptr
= &Globals
.szIPrintServer
,
2596 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2599 .label
= "print command",
2602 .ptr
= &sDefault
.szPrintcommand
,
2605 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2608 .label
= "disable spoolss",
2610 .p_class
= P_GLOBAL
,
2611 .ptr
= &Globals
.bDisableSpoolss
,
2614 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2617 .label
= "enable spoolss",
2619 .p_class
= P_GLOBAL
,
2620 .ptr
= &Globals
.bDisableSpoolss
,
2626 .label
= "lpq command",
2629 .ptr
= &sDefault
.szLpqcommand
,
2632 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2635 .label
= "lprm command",
2638 .ptr
= &sDefault
.szLprmcommand
,
2641 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2644 .label
= "lppause command",
2647 .ptr
= &sDefault
.szLppausecommand
,
2650 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2653 .label
= "lpresume command",
2656 .ptr
= &sDefault
.szLpresumecommand
,
2659 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2662 .label
= "queuepause command",
2665 .ptr
= &sDefault
.szQueuepausecommand
,
2668 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2671 .label
= "queueresume command",
2674 .ptr
= &sDefault
.szQueueresumecommand
,
2677 .flags
= FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
,
2680 .label
= "addport command",
2682 .p_class
= P_GLOBAL
,
2683 .ptr
= &Globals
.szAddPortCommand
,
2686 .flags
= FLAG_ADVANCED
,
2689 .label
= "enumports command",
2691 .p_class
= P_GLOBAL
,
2692 .ptr
= &Globals
.szEnumPortsCommand
,
2695 .flags
= FLAG_ADVANCED
,
2698 .label
= "addprinter command",
2700 .p_class
= P_GLOBAL
,
2701 .ptr
= &Globals
.szAddPrinterCommand
,
2704 .flags
= FLAG_ADVANCED
,
2707 .label
= "deleteprinter command",
2709 .p_class
= P_GLOBAL
,
2710 .ptr
= &Globals
.szDeletePrinterCommand
,
2713 .flags
= FLAG_ADVANCED
,
2716 .label
= "show add printer wizard",
2718 .p_class
= P_GLOBAL
,
2719 .ptr
= &Globals
.bMsAddPrinterWizard
,
2722 .flags
= FLAG_ADVANCED
,
2725 .label
= "os2 driver map",
2727 .p_class
= P_GLOBAL
,
2728 .ptr
= &Globals
.szOs2DriverMap
,
2731 .flags
= FLAG_ADVANCED
,
2735 .label
= "printer name",
2738 .ptr
= &sDefault
.szPrintername
,
2741 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2747 .ptr
= &sDefault
.szPrintername
,
2753 .label
= "use client driver",
2756 .ptr
= &sDefault
.bUseClientDriver
,
2759 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2762 .label
= "default devmode",
2765 .ptr
= &sDefault
.bDefaultDevmode
,
2768 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2771 .label
= "force printername",
2774 .ptr
= &sDefault
.bForcePrintername
,
2777 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2780 .label
= "printjob username",
2783 .ptr
= &sDefault
.szPrintjobUsername
,
2786 .flags
= FLAG_ADVANCED
| FLAG_PRINT
,
2789 {N_("Filename Handling"), P_SEP
, P_SEPARATOR
},
2792 .label
= "mangling method",
2794 .p_class
= P_GLOBAL
,
2795 .ptr
= &Globals
.szManglingMethod
,
2798 .flags
= FLAG_ADVANCED
,
2801 .label
= "mangle prefix",
2803 .p_class
= P_GLOBAL
,
2804 .ptr
= &Globals
.mangle_prefix
,
2807 .flags
= FLAG_ADVANCED
,
2811 .label
= "default case",
2814 .ptr
= &sDefault
.iDefaultCase
,
2816 .enum_list
= enum_case
,
2817 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
2820 .label
= "case sensitive",
2823 .ptr
= &sDefault
.iCaseSensitive
,
2825 .enum_list
= enum_bool_auto
,
2826 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2829 .label
= "casesignames",
2832 .ptr
= &sDefault
.iCaseSensitive
,
2834 .enum_list
= enum_bool_auto
,
2835 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
| FLAG_HIDE
,
2838 .label
= "preserve case",
2841 .ptr
= &sDefault
.bCasePreserve
,
2844 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2847 .label
= "short preserve case",
2850 .ptr
= &sDefault
.bShortCasePreserve
,
2853 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2856 .label
= "mangling char",
2859 .ptr
= &sDefault
.magic_char
,
2862 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2865 .label
= "hide dot files",
2868 .ptr
= &sDefault
.bHideDotFiles
,
2871 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2874 .label
= "hide special files",
2877 .ptr
= &sDefault
.bHideSpecialFiles
,
2880 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2883 .label
= "hide unreadable",
2886 .ptr
= &sDefault
.bHideUnReadable
,
2889 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2892 .label
= "hide unwriteable files",
2895 .ptr
= &sDefault
.bHideUnWriteableFiles
,
2898 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2901 .label
= "delete veto files",
2904 .ptr
= &sDefault
.bDeleteVetoFiles
,
2907 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2910 .label
= "veto files",
2913 .ptr
= &sDefault
.szVetoFiles
,
2916 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2919 .label
= "hide files",
2922 .ptr
= &sDefault
.szHideFiles
,
2925 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2928 .label
= "veto oplock files",
2931 .ptr
= &sDefault
.szVetoOplockFiles
,
2934 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2937 .label
= "map archive",
2940 .ptr
= &sDefault
.bMap_archive
,
2943 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2946 .label
= "map hidden",
2949 .ptr
= &sDefault
.bMap_hidden
,
2952 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2955 .label
= "map system",
2958 .ptr
= &sDefault
.bMap_system
,
2961 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2964 .label
= "map readonly",
2967 .ptr
= &sDefault
.iMap_readonly
,
2969 .enum_list
= enum_map_readonly
,
2970 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2973 .label
= "mangled names",
2976 .ptr
= &sDefault
.bMangledNames
,
2979 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
2982 .label
= "max stat cache size",
2984 .p_class
= P_GLOBAL
,
2985 .ptr
= &Globals
.iMaxStatCacheSize
,
2988 .flags
= FLAG_ADVANCED
,
2991 .label
= "stat cache",
2993 .p_class
= P_GLOBAL
,
2994 .ptr
= &Globals
.bStatCache
,
2997 .flags
= FLAG_ADVANCED
,
3000 .label
= "store dos attributes",
3003 .ptr
= &sDefault
.bStoreDosAttributes
,
3006 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3009 .label
= "dmapi support",
3012 .ptr
= &sDefault
.bDmapiSupport
,
3015 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3019 {N_("Domain Options"), P_SEP
, P_SEPARATOR
},
3022 .label
= "machine password timeout",
3024 .p_class
= P_GLOBAL
,
3025 .ptr
= &Globals
.machine_password_timeout
,
3028 .flags
= FLAG_ADVANCED
| FLAG_WIZARD
,
3031 {N_("Logon Options"), P_SEP
, P_SEPARATOR
},
3034 .label
= "add user script",
3036 .p_class
= P_GLOBAL
,
3037 .ptr
= &Globals
.szAddUserScript
,
3040 .flags
= FLAG_ADVANCED
,
3043 .label
= "rename user script",
3045 .p_class
= P_GLOBAL
,
3046 .ptr
= &Globals
.szRenameUserScript
,
3049 .flags
= FLAG_ADVANCED
,
3052 .label
= "delete user script",
3054 .p_class
= P_GLOBAL
,
3055 .ptr
= &Globals
.szDelUserScript
,
3058 .flags
= FLAG_ADVANCED
,
3061 .label
= "add group script",
3063 .p_class
= P_GLOBAL
,
3064 .ptr
= &Globals
.szAddGroupScript
,
3067 .flags
= FLAG_ADVANCED
,
3070 .label
= "delete group script",
3072 .p_class
= P_GLOBAL
,
3073 .ptr
= &Globals
.szDelGroupScript
,
3076 .flags
= FLAG_ADVANCED
,
3079 .label
= "add user to group script",
3081 .p_class
= P_GLOBAL
,
3082 .ptr
= &Globals
.szAddUserToGroupScript
,
3085 .flags
= FLAG_ADVANCED
,
3088 .label
= "delete user from group script",
3090 .p_class
= P_GLOBAL
,
3091 .ptr
= &Globals
.szDelUserFromGroupScript
,
3094 .flags
= FLAG_ADVANCED
,
3097 .label
= "set primary group script",
3099 .p_class
= P_GLOBAL
,
3100 .ptr
= &Globals
.szSetPrimaryGroupScript
,
3103 .flags
= FLAG_ADVANCED
,
3106 .label
= "add machine script",
3108 .p_class
= P_GLOBAL
,
3109 .ptr
= &Globals
.szAddMachineScript
,
3112 .flags
= FLAG_ADVANCED
,
3115 .label
= "shutdown script",
3117 .p_class
= P_GLOBAL
,
3118 .ptr
= &Globals
.szShutdownScript
,
3121 .flags
= FLAG_ADVANCED
,
3124 .label
= "abort shutdown script",
3126 .p_class
= P_GLOBAL
,
3127 .ptr
= &Globals
.szAbortShutdownScript
,
3130 .flags
= FLAG_ADVANCED
,
3133 .label
= "username map script",
3135 .p_class
= P_GLOBAL
,
3136 .ptr
= &Globals
.szUsernameMapScript
,
3139 .flags
= FLAG_ADVANCED
,
3142 .label
= "logon script",
3144 .p_class
= P_GLOBAL
,
3145 .ptr
= &Globals
.szLogonScript
,
3148 .flags
= FLAG_ADVANCED
,
3151 .label
= "logon path",
3153 .p_class
= P_GLOBAL
,
3154 .ptr
= &Globals
.szLogonPath
,
3157 .flags
= FLAG_ADVANCED
,
3160 .label
= "logon drive",
3162 .p_class
= P_GLOBAL
,
3163 .ptr
= &Globals
.szLogonDrive
,
3166 .flags
= FLAG_ADVANCED
,
3169 .label
= "logon home",
3171 .p_class
= P_GLOBAL
,
3172 .ptr
= &Globals
.szLogonHome
,
3175 .flags
= FLAG_ADVANCED
,
3178 .label
= "domain logons",
3180 .p_class
= P_GLOBAL
,
3181 .ptr
= &Globals
.bDomainLogons
,
3184 .flags
= FLAG_ADVANCED
,
3187 {N_("Browse Options"), P_SEP
, P_SEPARATOR
},
3190 .label
= "os level",
3192 .p_class
= P_GLOBAL
,
3193 .ptr
= &Globals
.os_level
,
3196 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3199 .label
= "lm announce",
3201 .p_class
= P_GLOBAL
,
3202 .ptr
= &Globals
.lm_announce
,
3204 .enum_list
= enum_bool_auto
,
3205 .flags
= FLAG_ADVANCED
,
3208 .label
= "lm interval",
3210 .p_class
= P_GLOBAL
,
3211 .ptr
= &Globals
.lm_interval
,
3214 .flags
= FLAG_ADVANCED
,
3217 .label
= "preferred master",
3219 .p_class
= P_GLOBAL
,
3220 .ptr
= &Globals
.iPreferredMaster
,
3222 .enum_list
= enum_bool_auto
,
3223 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3226 .label
= "prefered master",
3228 .p_class
= P_GLOBAL
,
3229 .ptr
= &Globals
.iPreferredMaster
,
3231 .enum_list
= enum_bool_auto
,
3235 .label
= "local master",
3237 .p_class
= P_GLOBAL
,
3238 .ptr
= &Globals
.bLocalMaster
,
3241 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3244 .label
= "domain master",
3246 .p_class
= P_GLOBAL
,
3247 .ptr
= &Globals
.iDomainMaster
,
3249 .enum_list
= enum_bool_auto
,
3250 .flags
= FLAG_BASIC
| FLAG_ADVANCED
,
3253 .label
= "browse list",
3255 .p_class
= P_GLOBAL
,
3256 .ptr
= &Globals
.bBrowseList
,
3259 .flags
= FLAG_ADVANCED
,
3262 .label
= "browseable",
3265 .ptr
= &sDefault
.bBrowseable
,
3268 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
3271 .label
= "browsable",
3274 .ptr
= &sDefault
.bBrowseable
,
3280 .label
= "enhanced browsing",
3282 .p_class
= P_GLOBAL
,
3283 .ptr
= &Globals
.enhanced_browsing
,
3286 .flags
= FLAG_ADVANCED
,
3289 {N_("WINS Options"), P_SEP
, P_SEPARATOR
},
3292 .label
= "dns proxy",
3294 .p_class
= P_GLOBAL
,
3295 .ptr
= &Globals
.bDNSproxy
,
3298 .flags
= FLAG_ADVANCED
,
3301 .label
= "wins proxy",
3303 .p_class
= P_GLOBAL
,
3304 .ptr
= &Globals
.bWINSproxy
,
3307 .flags
= FLAG_ADVANCED
,
3310 .label
= "wins server",
3312 .p_class
= P_GLOBAL
,
3313 .ptr
= &Globals
.szWINSservers
,
3316 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
3319 .label
= "wins support",
3321 .p_class
= P_GLOBAL
,
3322 .ptr
= &Globals
.bWINSsupport
,
3325 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
,
3328 .label
= "wins hook",
3330 .p_class
= P_GLOBAL
,
3331 .ptr
= &Globals
.szWINSHook
,
3334 .flags
= FLAG_ADVANCED
,
3337 {N_("Locking Options"), P_SEP
, P_SEPARATOR
},
3340 .label
= "blocking locks",
3343 .ptr
= &sDefault
.bBlockingLocks
,
3346 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3349 .label
= "csc policy",
3352 .ptr
= &sDefault
.iCSCPolicy
,
3354 .enum_list
= enum_csc_policy
,
3355 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3358 .label
= "fake oplocks",
3361 .ptr
= &sDefault
.bFakeOplocks
,
3364 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
3367 .label
= "kernel oplocks",
3369 .p_class
= P_GLOBAL
,
3370 .ptr
= &Globals
.bKernelOplocks
,
3373 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3379 .ptr
= &sDefault
.bLocking
,
3382 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3385 .label
= "lock spin time",
3387 .p_class
= P_GLOBAL
,
3388 .ptr
= &Globals
.iLockSpinTime
,
3391 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3397 .ptr
= &sDefault
.bOpLocks
,
3400 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3403 .label
= "level2 oplocks",
3406 .ptr
= &sDefault
.bLevel2OpLocks
,
3409 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3412 .label
= "oplock break wait time",
3414 .p_class
= P_GLOBAL
,
3415 .ptr
= &Globals
.oplock_break_wait_time
,
3418 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
,
3421 .label
= "oplock contention limit",
3424 .ptr
= &sDefault
.iOplockContentionLimit
,
3427 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3430 .label
= "posix locking",
3433 .ptr
= &sDefault
.bPosixLocking
,
3436 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3439 .label
= "strict locking",
3442 .ptr
= &sDefault
.iStrictLocking
,
3444 .enum_list
= enum_bool_auto
,
3445 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3448 .label
= "share modes",
3451 .ptr
= &sDefault
.bShareModes
,
3454 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
3457 {N_("Ldap Options"), P_SEP
, P_SEPARATOR
},
3460 .label
= "ldap admin dn",
3462 .p_class
= P_GLOBAL
,
3463 .ptr
= &Globals
.szLdapAdminDn
,
3466 .flags
= FLAG_ADVANCED
,
3469 .label
= "ldap delete dn",
3471 .p_class
= P_GLOBAL
,
3472 .ptr
= &Globals
.ldap_delete_dn
,
3475 .flags
= FLAG_ADVANCED
,
3478 .label
= "ldap group suffix",
3480 .p_class
= P_GLOBAL
,
3481 .ptr
= &Globals
.szLdapGroupSuffix
,
3484 .flags
= FLAG_ADVANCED
,
3487 .label
= "ldap idmap suffix",
3489 .p_class
= P_GLOBAL
,
3490 .ptr
= &Globals
.szLdapIdmapSuffix
,
3493 .flags
= FLAG_ADVANCED
,
3496 .label
= "ldap machine suffix",
3498 .p_class
= P_GLOBAL
,
3499 .ptr
= &Globals
.szLdapMachineSuffix
,
3502 .flags
= FLAG_ADVANCED
,
3505 .label
= "ldap passwd sync",
3507 .p_class
= P_GLOBAL
,
3508 .ptr
= &Globals
.ldap_passwd_sync
,
3510 .enum_list
= enum_ldap_passwd_sync
,
3511 .flags
= FLAG_ADVANCED
,
3514 .label
= "ldap password sync",
3516 .p_class
= P_GLOBAL
,
3517 .ptr
= &Globals
.ldap_passwd_sync
,
3519 .enum_list
= enum_ldap_passwd_sync
,
3523 .label
= "ldap replication sleep",
3525 .p_class
= P_GLOBAL
,
3526 .ptr
= &Globals
.ldap_replication_sleep
,
3529 .flags
= FLAG_ADVANCED
,
3532 .label
= "ldap suffix",
3534 .p_class
= P_GLOBAL
,
3535 .ptr
= &Globals
.szLdapSuffix
,
3538 .flags
= FLAG_ADVANCED
,
3541 .label
= "ldap ssl",
3543 .p_class
= P_GLOBAL
,
3544 .ptr
= &Globals
.ldap_ssl
,
3546 .enum_list
= enum_ldap_ssl
,
3547 .flags
= FLAG_ADVANCED
,
3550 .label
= "ldap timeout",
3552 .p_class
= P_GLOBAL
,
3553 .ptr
= &Globals
.ldap_timeout
,
3556 .flags
= FLAG_ADVANCED
,
3559 .label
= "ldap page size",
3561 .p_class
= P_GLOBAL
,
3562 .ptr
= &Globals
.ldap_page_size
,
3565 .flags
= FLAG_ADVANCED
,
3568 .label
= "ldap user suffix",
3570 .p_class
= P_GLOBAL
,
3571 .ptr
= &Globals
.szLdapUserSuffix
,
3574 .flags
= FLAG_ADVANCED
,
3577 .label
= "ldap debug level",
3579 .p_class
= P_GLOBAL
,
3580 .ptr
= &Globals
.ldap_debug_level
,
3581 .special
= handle_ldap_debug_level
,
3583 .flags
= FLAG_ADVANCED
,
3586 .label
= "ldap debug threshold",
3588 .p_class
= P_GLOBAL
,
3589 .ptr
= &Globals
.ldap_debug_threshold
,
3592 .flags
= FLAG_ADVANCED
,
3595 {N_("EventLog Options"), P_SEP
, P_SEPARATOR
},
3598 .label
= "eventlog list",
3600 .p_class
= P_GLOBAL
,
3601 .ptr
= &Globals
.szEventLogs
,
3604 .flags
= FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
,
3607 {N_("Miscellaneous Options"), P_SEP
, P_SEPARATOR
},
3610 .label
= "add share command",
3612 .p_class
= P_GLOBAL
,
3613 .ptr
= &Globals
.szAddShareCommand
,
3616 .flags
= FLAG_ADVANCED
,
3619 .label
= "change share command",
3621 .p_class
= P_GLOBAL
,
3622 .ptr
= &Globals
.szChangeShareCommand
,
3625 .flags
= FLAG_ADVANCED
,
3628 .label
= "delete share command",
3630 .p_class
= P_GLOBAL
,
3631 .ptr
= &Globals
.szDeleteShareCommand
,
3634 .flags
= FLAG_ADVANCED
,
3637 .label
= "config file",
3639 .p_class
= P_GLOBAL
,
3640 .ptr
= &Globals
.szConfigFile
,
3648 .p_class
= P_GLOBAL
,
3649 .ptr
= &Globals
.szAutoServices
,
3652 .flags
= FLAG_ADVANCED
,
3655 .label
= "auto services",
3657 .p_class
= P_GLOBAL
,
3658 .ptr
= &Globals
.szAutoServices
,
3661 .flags
= FLAG_ADVANCED
,
3664 .label
= "lock directory",
3666 .p_class
= P_GLOBAL
,
3667 .ptr
= &Globals
.szLockDir
,
3670 .flags
= FLAG_ADVANCED
,
3673 .label
= "lock dir",
3675 .p_class
= P_GLOBAL
,
3676 .ptr
= &Globals
.szLockDir
,
3682 .label
= "pid directory",
3684 .p_class
= P_GLOBAL
,
3685 .ptr
= &Globals
.szPidDir
,
3688 .flags
= FLAG_ADVANCED
,
3692 .label
= "utmp directory",
3694 .p_class
= P_GLOBAL
,
3695 .ptr
= &Globals
.szUtmpDir
,
3698 .flags
= FLAG_ADVANCED
,
3701 .label
= "wtmp directory",
3703 .p_class
= P_GLOBAL
,
3704 .ptr
= &Globals
.szWtmpDir
,
3707 .flags
= FLAG_ADVANCED
,
3712 .p_class
= P_GLOBAL
,
3713 .ptr
= &Globals
.bUtmp
,
3716 .flags
= FLAG_ADVANCED
,
3720 .label
= "default service",
3722 .p_class
= P_GLOBAL
,
3723 .ptr
= &Globals
.szDefaultService
,
3726 .flags
= FLAG_ADVANCED
,
3731 .p_class
= P_GLOBAL
,
3732 .ptr
= &Globals
.szDefaultService
,
3735 .flags
= FLAG_ADVANCED
,
3738 .label
= "message command",
3740 .p_class
= P_GLOBAL
,
3741 .ptr
= &Globals
.szMsgCommand
,
3744 .flags
= FLAG_ADVANCED
,
3747 .label
= "dfree cache time",
3750 .ptr
= &sDefault
.iDfreeCacheTime
,
3753 .flags
= FLAG_ADVANCED
,
3756 .label
= "dfree command",
3759 .ptr
= &sDefault
.szDfree
,
3762 .flags
= FLAG_ADVANCED
,
3765 .label
= "get quota command",
3767 .p_class
= P_GLOBAL
,
3768 .ptr
= &Globals
.szGetQuota
,
3771 .flags
= FLAG_ADVANCED
,
3774 .label
= "set quota command",
3776 .p_class
= P_GLOBAL
,
3777 .ptr
= &Globals
.szSetQuota
,
3780 .flags
= FLAG_ADVANCED
,
3783 .label
= "remote announce",
3785 .p_class
= P_GLOBAL
,
3786 .ptr
= &Globals
.szRemoteAnnounce
,
3789 .flags
= FLAG_ADVANCED
,
3792 .label
= "remote browse sync",
3794 .p_class
= P_GLOBAL
,
3795 .ptr
= &Globals
.szRemoteBrowseSync
,
3798 .flags
= FLAG_ADVANCED
,
3801 .label
= "socket address",
3803 .p_class
= P_GLOBAL
,
3804 .ptr
= &Globals
.szSocketAddress
,
3807 .flags
= FLAG_ADVANCED
,
3810 .label
= "homedir map",
3812 .p_class
= P_GLOBAL
,
3813 .ptr
= &Globals
.szNISHomeMapName
,
3816 .flags
= FLAG_ADVANCED
,
3819 .label
= "afs username map",
3821 .p_class
= P_GLOBAL
,
3822 .ptr
= &Globals
.szAfsUsernameMap
,
3825 .flags
= FLAG_ADVANCED
,
3828 .label
= "afs token lifetime",
3830 .p_class
= P_GLOBAL
,
3831 .ptr
= &Globals
.iAfsTokenLifetime
,
3834 .flags
= FLAG_ADVANCED
,
3837 .label
= "log nt token command",
3839 .p_class
= P_GLOBAL
,
3840 .ptr
= &Globals
.szLogNtTokenCommand
,
3843 .flags
= FLAG_ADVANCED
,
3846 .label
= "time offset",
3848 .p_class
= P_GLOBAL
,
3849 .ptr
= &extra_time_offset
,
3852 .flags
= FLAG_ADVANCED
,
3855 .label
= "NIS homedir",
3857 .p_class
= P_GLOBAL
,
3858 .ptr
= &Globals
.bNISHomeMap
,
3861 .flags
= FLAG_ADVANCED
,
3867 .ptr
= &sDefault
.valid
,
3876 .ptr
= &sDefault
.szCopy
,
3877 .special
= handle_copy
,
3885 .ptr
= &sDefault
.szInclude
,
3886 .special
= handle_include
,
3894 .ptr
= &sDefault
.szPreExec
,
3897 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
3903 .ptr
= &sDefault
.szPreExec
,
3906 .flags
= FLAG_ADVANCED
,
3909 .label
= "preexec close",
3912 .ptr
= &sDefault
.bPreexecClose
,
3915 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
3918 .label
= "postexec",
3921 .ptr
= &sDefault
.szPostExec
,
3924 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
3927 .label
= "root preexec",
3930 .ptr
= &sDefault
.szRootPreExec
,
3933 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
3936 .label
= "root preexec close",
3939 .ptr
= &sDefault
.bRootpreexecClose
,
3942 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
3945 .label
= "root postexec",
3948 .ptr
= &sDefault
.szRootPostExec
,
3951 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
3954 .label
= "available",
3957 .ptr
= &sDefault
.bAvailable
,
3960 .flags
= FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
,
3963 .label
= "registry shares",
3965 .p_class
= P_GLOBAL
,
3966 .ptr
= &Globals
.bRegistryShares
,
3969 .flags
= FLAG_ADVANCED
,
3972 .label
= "usershare allow guests",
3974 .p_class
= P_GLOBAL
,
3975 .ptr
= &Globals
.bUsershareAllowGuests
,
3978 .flags
= FLAG_ADVANCED
,
3981 .label
= "usershare max shares",
3983 .p_class
= P_GLOBAL
,
3984 .ptr
= &Globals
.iUsershareMaxShares
,
3987 .flags
= FLAG_ADVANCED
,
3990 .label
= "usershare owner only",
3992 .p_class
= P_GLOBAL
,
3993 .ptr
= &Globals
.bUsershareOwnerOnly
,
3996 .flags
= FLAG_ADVANCED
,
3999 .label
= "usershare path",
4001 .p_class
= P_GLOBAL
,
4002 .ptr
= &Globals
.szUsersharePath
,
4005 .flags
= FLAG_ADVANCED
,
4008 .label
= "usershare prefix allow list",
4010 .p_class
= P_GLOBAL
,
4011 .ptr
= &Globals
.szUsersharePrefixAllowList
,
4014 .flags
= FLAG_ADVANCED
,
4017 .label
= "usershare prefix deny list",
4019 .p_class
= P_GLOBAL
,
4020 .ptr
= &Globals
.szUsersharePrefixDenyList
,
4023 .flags
= FLAG_ADVANCED
,
4026 .label
= "usershare template share",
4028 .p_class
= P_GLOBAL
,
4029 .ptr
= &Globals
.szUsershareTemplateShare
,
4032 .flags
= FLAG_ADVANCED
,
4038 .ptr
= &sDefault
.volume
,
4041 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4047 .ptr
= &sDefault
.fstype
,
4050 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4053 .label
= "set directory",
4056 .ptr
= &sDefault
.bNo_set_dir
,
4059 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4062 .label
= "wide links",
4065 .ptr
= &sDefault
.bWidelinks
,
4068 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4071 .label
= "follow symlinks",
4074 .ptr
= &sDefault
.bSymlinks
,
4077 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4080 .label
= "dont descend",
4083 .ptr
= &sDefault
.szDontdescend
,
4086 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4089 .label
= "magic script",
4092 .ptr
= &sDefault
.szMagicScript
,
4095 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4098 .label
= "magic output",
4101 .ptr
= &sDefault
.szMagicOutput
,
4104 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4107 .label
= "delete readonly",
4110 .ptr
= &sDefault
.bDeleteReadonly
,
4113 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4116 .label
= "dos filemode",
4119 .ptr
= &sDefault
.bDosFilemode
,
4122 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4125 .label
= "dos filetimes",
4128 .ptr
= &sDefault
.bDosFiletimes
,
4131 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4134 .label
= "dos filetime resolution",
4137 .ptr
= &sDefault
.bDosFiletimeResolution
,
4140 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4143 .label
= "fake directory create times",
4146 .ptr
= &sDefault
.bFakeDirCreateTimes
,
4149 .flags
= FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
,
4152 .label
= "panic action",
4154 .p_class
= P_GLOBAL
,
4155 .ptr
= &Globals
.szPanicAction
,
4158 .flags
= FLAG_ADVANCED
,
4161 {N_("VFS module options"), P_SEP
, P_SEPARATOR
},
4164 .label
= "vfs objects",
4167 .ptr
= &sDefault
.szVfsObjects
,
4170 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4173 .label
= "vfs object",
4176 .ptr
= &sDefault
.szVfsObjects
,
4183 {N_("MSDFS options"), P_SEP
, P_SEPARATOR
},
4186 .label
= "msdfs root",
4189 .ptr
= &sDefault
.bMSDfsRoot
,
4192 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4195 .label
= "msdfs proxy",
4198 .ptr
= &sDefault
.szMSDfsProxy
,
4201 .flags
= FLAG_ADVANCED
| FLAG_SHARE
,
4204 .label
= "host msdfs",
4206 .p_class
= P_GLOBAL
,
4207 .ptr
= &Globals
.bHostMSDfs
,
4210 .flags
= FLAG_ADVANCED
,
4213 {N_("Winbind options"), P_SEP
, P_SEPARATOR
},
4216 .label
= "passdb expand explicit",
4218 .p_class
= P_GLOBAL
,
4219 .ptr
= &Globals
.bPassdbExpandExplicit
,
4222 .flags
= FLAG_ADVANCED
,
4225 .label
= "idmap domains",
4227 .p_class
= P_GLOBAL
,
4228 .ptr
= &Globals
.szIdmapDomains
,
4231 .flags
= FLAG_ADVANCED
,
4234 .label
= "idmap backend",
4236 .p_class
= P_GLOBAL
,
4237 .ptr
= &Globals
.szIdmapBackend
,
4240 .flags
= FLAG_ADVANCED
,
4243 .label
= "idmap alloc backend",
4245 .p_class
= P_GLOBAL
,
4246 .ptr
= &Globals
.szIdmapAllocBackend
,
4249 .flags
= FLAG_ADVANCED
,
4252 .label
= "idmap cache time",
4254 .p_class
= P_GLOBAL
,
4255 .ptr
= &Globals
.iIdmapCacheTime
,
4258 .flags
= FLAG_ADVANCED
,
4261 .label
= "idmap negative cache time",
4263 .p_class
= P_GLOBAL
,
4264 .ptr
= &Globals
.iIdmapNegativeCacheTime
,
4267 .flags
= FLAG_ADVANCED
,
4270 .label
= "idmap uid",
4272 .p_class
= P_GLOBAL
,
4273 .ptr
= &Globals
.szIdmapUID
,
4274 .special
= handle_idmap_uid
,
4276 .flags
= FLAG_ADVANCED
,
4279 .label
= "winbind uid",
4281 .p_class
= P_GLOBAL
,
4282 .ptr
= &Globals
.szIdmapUID
,
4283 .special
= handle_idmap_uid
,
4288 .label
= "idmap gid",
4290 .p_class
= P_GLOBAL
,
4291 .ptr
= &Globals
.szIdmapGID
,
4292 .special
= handle_idmap_gid
,
4294 .flags
= FLAG_ADVANCED
,
4297 .label
= "winbind gid",
4299 .p_class
= P_GLOBAL
,
4300 .ptr
= &Globals
.szIdmapGID
,
4301 .special
= handle_idmap_gid
,
4306 .label
= "template homedir",
4308 .p_class
= P_GLOBAL
,
4309 .ptr
= &Globals
.szTemplateHomedir
,
4312 .flags
= FLAG_ADVANCED
,
4315 .label
= "template shell",
4317 .p_class
= P_GLOBAL
,
4318 .ptr
= &Globals
.szTemplateShell
,
4321 .flags
= FLAG_ADVANCED
,
4324 .label
= "winbind separator",
4326 .p_class
= P_GLOBAL
,
4327 .ptr
= &Globals
.szWinbindSeparator
,
4330 .flags
= FLAG_ADVANCED
,
4333 .label
= "winbind cache time",
4335 .p_class
= P_GLOBAL
,
4336 .ptr
= &Globals
.winbind_cache_time
,
4339 .flags
= FLAG_ADVANCED
,
4342 .label
= "winbind enum users",
4344 .p_class
= P_GLOBAL
,
4345 .ptr
= &Globals
.bWinbindEnumUsers
,
4348 .flags
= FLAG_ADVANCED
,
4351 .label
= "winbind enum groups",
4353 .p_class
= P_GLOBAL
,
4354 .ptr
= &Globals
.bWinbindEnumGroups
,
4357 .flags
= FLAG_ADVANCED
,
4360 .label
= "winbind use default domain",
4362 .p_class
= P_GLOBAL
,
4363 .ptr
= &Globals
.bWinbindUseDefaultDomain
,
4366 .flags
= FLAG_ADVANCED
,
4369 .label
= "winbind trusted domains only",
4371 .p_class
= P_GLOBAL
,
4372 .ptr
= &Globals
.bWinbindTrustedDomainsOnly
,
4375 .flags
= FLAG_ADVANCED
,
4378 .label
= "winbind nested groups",
4380 .p_class
= P_GLOBAL
,
4381 .ptr
= &Globals
.bWinbindNestedGroups
,
4384 .flags
= FLAG_ADVANCED
,
4387 .label
= "winbind expand groups",
4389 .p_class
= P_GLOBAL
,
4390 .ptr
= &Globals
.winbind_expand_groups
,
4393 .flags
= FLAG_ADVANCED
,
4396 .label
= "winbind nss info",
4398 .p_class
= P_GLOBAL
,
4399 .ptr
= &Globals
.szWinbindNssInfo
,
4402 .flags
= FLAG_ADVANCED
,
4405 .label
= "winbind refresh tickets",
4407 .p_class
= P_GLOBAL
,
4408 .ptr
= &Globals
.bWinbindRefreshTickets
,
4411 .flags
= FLAG_ADVANCED
,
4414 .label
= "winbind offline logon",
4416 .p_class
= P_GLOBAL
,
4417 .ptr
= &Globals
.bWinbindOfflineLogon
,
4420 .flags
= FLAG_ADVANCED
,
4423 .label
= "winbind normalize names",
4425 .p_class
= P_GLOBAL
,
4426 .ptr
= &Globals
.bWinbindNormalizeNames
,
4429 .flags
= FLAG_ADVANCED
,
4432 .label
= "winbind rpc only",
4434 .p_class
= P_GLOBAL
,
4435 .ptr
= &Globals
.bWinbindRpcOnly
,
4438 .flags
= FLAG_ADVANCED
,
4441 {NULL
, P_BOOL
, P_NONE
, NULL
, NULL
, NULL
, 0}
4444 /***************************************************************************
4445 Initialise the sDefault parameter structure for the printer values.
4446 ***************************************************************************/
4448 static void init_printer_values(struct service
*pService
)
4450 /* choose defaults depending on the type of printing */
4451 switch (pService
->iPrinting
) {
4456 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4457 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4458 string_set(&pService
->szPrintcommand
, "lpr -r -P'%p' %s");
4463 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4464 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4465 string_set(&pService
->szPrintcommand
, "lpr -r -P'%p' %s");
4466 string_set(&pService
->szQueuepausecommand
, "lpc stop '%p'");
4467 string_set(&pService
->szQueueresumecommand
, "lpc start '%p'");
4468 string_set(&pService
->szLppausecommand
, "lpc hold '%p' %j");
4469 string_set(&pService
->szLpresumecommand
, "lpc release '%p' %j");
4475 /* set the lpq command to contain the destination printer
4476 name only. This is used by cups_queue_get() */
4477 string_set(&pService
->szLpqcommand
, "%p");
4478 string_set(&pService
->szLprmcommand
, "");
4479 string_set(&pService
->szPrintcommand
, "");
4480 string_set(&pService
->szLppausecommand
, "");
4481 string_set(&pService
->szLpresumecommand
, "");
4482 string_set(&pService
->szQueuepausecommand
, "");
4483 string_set(&pService
->szQueueresumecommand
, "");
4485 string_set(&pService
->szLpqcommand
, "lpq -P'%p'");
4486 string_set(&pService
->szLprmcommand
, "lprm -P'%p' %j");
4487 string_set(&pService
->szPrintcommand
, "lpr -P'%p' %s; rm %s");
4488 string_set(&pService
->szLppausecommand
, "lp -i '%p-%j' -H hold");
4489 string_set(&pService
->szLpresumecommand
, "lp -i '%p-%j' -H resume");
4490 string_set(&pService
->szQueuepausecommand
, "disable '%p'");
4491 string_set(&pService
->szQueueresumecommand
, "enable '%p'");
4492 #endif /* HAVE_CUPS */
4497 string_set(&pService
->szLpqcommand
, "lpstat -o%p");
4498 string_set(&pService
->szLprmcommand
, "cancel %p-%j");
4499 string_set(&pService
->szPrintcommand
, "lp -c -d%p %s; rm %s");
4500 string_set(&pService
->szQueuepausecommand
, "disable %p");
4501 string_set(&pService
->szQueueresumecommand
, "enable %p");
4503 string_set(&pService
->szLppausecommand
, "lp -i %p-%j -H hold");
4504 string_set(&pService
->szLpresumecommand
, "lp -i %p-%j -H resume");
4509 string_set(&pService
->szLpqcommand
, "lpq -P%p");
4510 string_set(&pService
->szLprmcommand
, "lprm -P%p %j");
4511 string_set(&pService
->szPrintcommand
, "lp -r -P%p %s");
4517 string_set(&pService
->szPrintcommand
, "vlp print %p %s");
4518 string_set(&pService
->szLpqcommand
, "vlp lpq %p");
4519 string_set(&pService
->szLprmcommand
, "vlp lprm %p %j");
4520 string_set(&pService
->szLppausecommand
, "vlp lppause %p %j");
4521 string_set(&pService
->szLpresumecommand
, "vlp lpresum %p %j");
4522 string_set(&pService
->szQueuepausecommand
, "vlp queuepause %p");
4523 string_set(&pService
->szQueueresumecommand
, "vlp queueresume %p");
4525 #endif /* DEVELOPER */
4530 /***************************************************************************
4531 Initialise the global parameter structure.
4532 ***************************************************************************/
4534 static void init_globals(bool first_time_only
)
4536 static bool done_init
= False
;
4539 /* If requested to initialize only once and we've already done it... */
4540 if (first_time_only
&& done_init
) {
4541 /* ... then we have nothing more to do */
4548 /* The logfile can be set before this is invoked. Free it if so. */
4549 if (Globals
.szLogFile
!= NULL
) {
4550 string_free(&Globals
.szLogFile
);
4551 Globals
.szLogFile
= NULL
;
4554 memset((void *)&Globals
, '\0', sizeof(Globals
));
4556 for (i
= 0; parm_table
[i
].label
; i
++)
4557 if ((parm_table
[i
].type
== P_STRING
||
4558 parm_table
[i
].type
== P_USTRING
) &&
4560 string_set((char **)parm_table
[i
].ptr
, "");
4562 string_set(&sDefault
.fstype
, FSTYPE_STRING
);
4563 string_set(&sDefault
.szPrintjobUsername
, "%U");
4565 init_printer_values(&sDefault
);
4571 DEBUG(3, ("Initialising global parameters\n"));
4573 string_set(&Globals
.szSMBPasswdFile
, get_dyn_SMB_PASSWD_FILE());
4574 string_set(&Globals
.szPrivateDir
, get_dyn_PRIVATE_DIR());
4576 /* use the new 'hash2' method by default, with a prefix of 1 */
4577 string_set(&Globals
.szManglingMethod
, "hash2");
4578 Globals
.mangle_prefix
= 1;
4580 string_set(&Globals
.szGuestaccount
, GUEST_ACCOUNT
);
4582 /* using UTF8 by default allows us to support all chars */
4583 string_set(&Globals
.unix_charset
, DEFAULT_UNIX_CHARSET
);
4585 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
4586 /* If the system supports nl_langinfo(), try to grab the value
4587 from the user's locale */
4588 string_set(&Globals
.display_charset
, "LOCALE");
4590 string_set(&Globals
.display_charset
, DEFAULT_DISPLAY_CHARSET
);
4593 /* Use codepage 850 as a default for the dos character set */
4594 string_set(&Globals
.dos_charset
, DEFAULT_DOS_CHARSET
);
4597 * Allow the default PASSWD_CHAT to be overridden in local.h.
4599 string_set(&Globals
.szPasswdChat
, DEFAULT_PASSWD_CHAT
);
4601 set_global_myname(myhostname());
4602 string_set(&Globals
.szNetbiosName
,global_myname());
4604 set_global_myworkgroup(WORKGROUP
);
4605 string_set(&Globals
.szWorkgroup
, lp_workgroup());
4607 string_set(&Globals
.szPasswdProgram
, "");
4608 string_set(&Globals
.szPidDir
, get_dyn_PIDDIR());
4609 string_set(&Globals
.szLockDir
, get_dyn_LOCKDIR());
4610 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
4612 if (asprintf(&s
, "Samba %s", SAMBA_VERSION_STRING
) < 0) {
4613 smb_panic("init_globals: ENOMEM");
4615 string_set(&Globals
.szServerString
, s
);
4617 if (asprintf(&s
, "%d.%d", DEFAULT_MAJOR_VERSION
,
4618 DEFAULT_MINOR_VERSION
) < 0) {
4619 smb_panic("init_globals: ENOMEM");
4621 string_set(&Globals
.szAnnounceVersion
, s
);
4624 string_set(&Globals
.szPanicAction
, "/bin/sleep 999999999");
4627 string_set(&Globals
.szSocketOptions
, DEFAULT_SOCKET_OPTIONS
);
4629 string_set(&Globals
.szLogonDrive
, "");
4630 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
4631 string_set(&Globals
.szLogonHome
, "\\\\%N\\%U");
4632 string_set(&Globals
.szLogonPath
, "\\\\%N\\%U\\profile");
4634 string_set(&Globals
.szNameResolveOrder
, "lmhosts wins host bcast");
4635 string_set(&Globals
.szPasswordServer
, "*");
4637 Globals
.AlgorithmicRidBase
= BASE_RID
;
4639 Globals
.bLoadPrinters
= True
;
4640 Globals
.PrintcapCacheTime
= 750; /* 12.5 minutes */
4642 Globals
.ConfigBackend
= config_backend
;
4644 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
4645 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
4646 Globals
.max_xmit
= 0x4104;
4647 Globals
.max_mux
= 50; /* This is *needed* for profile support. */
4648 Globals
.lpqcachetime
= 30; /* changed to handle large print servers better -- jerry */
4649 Globals
.bDisableSpoolss
= False
;
4650 Globals
.iMaxSmbdProcesses
= 0;/* no limit specified */
4651 Globals
.pwordlevel
= 0;
4652 Globals
.unamelevel
= 0;
4653 Globals
.deadtime
= 0;
4654 Globals
.getwd_cache
= true;
4655 Globals
.bLargeReadwrite
= True
;
4656 Globals
.max_log_size
= 5000;
4657 Globals
.max_open_files
= MAX_OPEN_FILES
;
4658 Globals
.open_files_db_hash_size
= SMB_OPEN_DATABASE_TDB_HASH_SIZE
;
4659 Globals
.maxprotocol
= PROTOCOL_NT1
;
4660 Globals
.minprotocol
= PROTOCOL_CORE
;
4661 Globals
.security
= SEC_USER
;
4662 Globals
.paranoid_server_security
= True
;
4663 Globals
.bEncryptPasswords
= True
;
4664 Globals
.bUpdateEncrypt
= False
;
4665 Globals
.clientSchannel
= Auto
;
4666 Globals
.serverSchannel
= Auto
;
4667 Globals
.bReadRaw
= True
;
4668 Globals
.bWriteRaw
= True
;
4669 Globals
.bNullPasswords
= False
;
4670 Globals
.bObeyPamRestrictions
= False
;
4672 Globals
.bSyslogOnly
= False
;
4673 Globals
.bTimestampLogs
= True
;
4674 string_set(&Globals
.szLogLevel
, "0");
4675 Globals
.bDebugPrefixTimestamp
= False
;
4676 Globals
.bDebugHiresTimestamp
= False
;
4677 Globals
.bDebugPid
= False
;
4678 Globals
.bDebugUid
= False
;
4679 Globals
.bDebugClass
= False
;
4680 Globals
.bEnableCoreFiles
= True
;
4681 Globals
.max_ttl
= 60 * 60 * 24 * 3; /* 3 days default. */
4682 Globals
.max_wins_ttl
= 60 * 60 * 24 * 6; /* 6 days default. */
4683 Globals
.min_wins_ttl
= 60 * 60 * 6; /* 6 hours default. */
4684 Globals
.machine_password_timeout
= 60 * 60 * 24 * 7; /* 7 days default. */
4685 Globals
.lm_announce
= 2; /* = Auto: send only if LM clients found */
4686 Globals
.lm_interval
= 60;
4687 Globals
.announce_as
= ANNOUNCE_AS_NT_SERVER
;
4688 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
4689 Globals
.bNISHomeMap
= False
;
4690 #ifdef WITH_NISPLUS_HOME
4691 string_set(&Globals
.szNISHomeMapName
, "auto_home.org_dir");
4693 string_set(&Globals
.szNISHomeMapName
, "auto.home");
4696 Globals
.bTimeServer
= False
;
4697 Globals
.bBindInterfacesOnly
= False
;
4698 Globals
.bUnixPasswdSync
= False
;
4699 Globals
.bPamPasswordChange
= False
;
4700 Globals
.bPasswdChatDebug
= False
;
4701 Globals
.iPasswdChatTimeout
= 2; /* 2 second default. */
4702 Globals
.bNTPipeSupport
= True
; /* Do NT pipes by default. */
4703 Globals
.bNTStatusSupport
= True
; /* Use NT status by default. */
4704 Globals
.bStatCache
= True
; /* use stat cache by default */
4705 Globals
.iMaxStatCacheSize
= 256; /* 256k by default */
4706 Globals
.restrict_anonymous
= 0;
4707 Globals
.bClientLanManAuth
= False
; /* Do NOT use the LanMan hash if it is available */
4708 Globals
.bClientPlaintextAuth
= False
; /* Do NOT use a plaintext password even if is requested by the server */
4709 Globals
.bLanmanAuth
= False
; /* Do NOT use the LanMan hash, even if it is supplied */
4710 Globals
.bNTLMAuth
= True
; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
4711 Globals
.bClientNTLMv2Auth
= False
; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
4712 /* Note, that we will use NTLM2 session security (which is different), if it is available */
4714 Globals
.map_to_guest
= 0; /* By Default, "Never" */
4715 Globals
.oplock_break_wait_time
= 0; /* By Default, 0 msecs. */
4716 Globals
.enhanced_browsing
= true;
4717 Globals
.iLockSpinTime
= WINDOWS_MINIMUM_LOCK_TIMEOUT_MS
; /* msec. */
4718 #ifdef MMAP_BLACKLIST
4719 Globals
.bUseMmap
= False
;
4721 Globals
.bUseMmap
= True
;
4723 Globals
.bUnixExtensions
= True
;
4724 Globals
.bResetOnZeroVC
= False
;
4726 /* hostname lookups can be very expensive and are broken on
4727 a large number of sites (tridge) */
4728 Globals
.bHostnameLookups
= False
;
4730 string_set(&Globals
.szPassdbBackend
, "smbpasswd");
4731 string_set(&Globals
.szLdapSuffix
, "");
4732 string_set(&Globals
.szLdapMachineSuffix
, "");
4733 string_set(&Globals
.szLdapUserSuffix
, "");
4734 string_set(&Globals
.szLdapGroupSuffix
, "");
4735 string_set(&Globals
.szLdapIdmapSuffix
, "");
4737 string_set(&Globals
.szLdapAdminDn
, "");
4738 Globals
.ldap_ssl
= LDAP_SSL_ON
;
4739 Globals
.ldap_passwd_sync
= LDAP_PASSWD_SYNC_OFF
;
4740 Globals
.ldap_delete_dn
= False
;
4741 Globals
.ldap_replication_sleep
= 1000; /* wait 1 sec for replication */
4742 Globals
.ldap_timeout
= LDAP_CONNECT_DEFAULT_TIMEOUT
;
4743 Globals
.ldap_page_size
= LDAP_PAGE_SIZE
;
4745 Globals
.ldap_debug_level
= 0;
4746 Globals
.ldap_debug_threshold
= 10;
4748 /* This is what we tell the afs client. in reality we set the token
4749 * to never expire, though, when this runs out the afs client will
4750 * forget the token. Set to 0 to get NEVERDATE.*/
4751 Globals
.iAfsTokenLifetime
= 604800;
4753 /* these parameters are set to defaults that are more appropriate
4754 for the increasing samba install base:
4756 as a member of the workgroup, that will possibly become a
4757 _local_ master browser (lm = True). this is opposed to a forced
4758 local master browser startup (pm = True).
4760 doesn't provide WINS server service by default (wsupp = False),
4761 and doesn't provide domain master browser services by default, either.
4765 Globals
.bMsAddPrinterWizard
= True
;
4766 Globals
.os_level
= 20;
4767 Globals
.bLocalMaster
= True
;
4768 Globals
.iDomainMaster
= Auto
; /* depending on bDomainLogons */
4769 Globals
.bDomainLogons
= False
;
4770 Globals
.bBrowseList
= True
;
4771 Globals
.bWINSsupport
= False
;
4772 Globals
.bWINSproxy
= False
;
4774 Globals
.bDNSproxy
= True
;
4776 /* this just means to use them if they exist */
4777 Globals
.bKernelOplocks
= True
;
4779 Globals
.bAllowTrustedDomains
= True
;
4781 string_set(&Globals
.szTemplateShell
, "/bin/false");
4782 string_set(&Globals
.szTemplateHomedir
, "/home/%D/%U");
4783 string_set(&Globals
.szWinbindSeparator
, "\\");
4785 string_set(&Globals
.szCupsServer
, "");
4786 string_set(&Globals
.szIPrintServer
, "");
4788 string_set(&Globals
.ctdbdSocket
, "");
4789 Globals
.szClusterAddresses
= NULL
;
4790 Globals
.clustering
= False
;
4792 Globals
.winbind_cache_time
= 300; /* 5 minutes */
4793 Globals
.bWinbindEnumUsers
= False
;
4794 Globals
.bWinbindEnumGroups
= False
;
4795 Globals
.bWinbindUseDefaultDomain
= False
;
4796 Globals
.bWinbindTrustedDomainsOnly
= False
;
4797 Globals
.bWinbindNestedGroups
= True
;
4798 Globals
.winbind_expand_groups
= 1;
4799 Globals
.szWinbindNssInfo
= str_list_make(NULL
, "template", NULL
);
4800 Globals
.bWinbindRefreshTickets
= False
;
4801 Globals
.bWinbindOfflineLogon
= False
;
4803 Globals
.iIdmapCacheTime
= 900; /* 15 minutes by default */
4804 Globals
.iIdmapNegativeCacheTime
= 120; /* 2 minutes by default */
4806 Globals
.bPassdbExpandExplicit
= False
;
4808 Globals
.name_cache_timeout
= 660; /* In seconds */
4810 Globals
.bUseSpnego
= True
;
4811 Globals
.bClientUseSpnego
= True
;
4813 Globals
.client_signing
= Auto
;
4814 Globals
.server_signing
= False
;
4816 Globals
.bDeferSharingViolations
= True
;
4817 string_set(&Globals
.smb_ports
, SMB_PORTS
);
4819 Globals
.bEnablePrivileges
= True
;
4820 Globals
.bHostMSDfs
= True
;
4821 Globals
.bASUSupport
= False
;
4823 /* User defined shares. */
4824 if (asprintf(&s
, "%s/usershares", get_dyn_STATEDIR()) < 0) {
4825 smb_panic("init_globals: ENOMEM");
4827 string_set(&Globals
.szUsersharePath
, s
);
4829 string_set(&Globals
.szUsershareTemplateShare
, "");
4830 Globals
.iUsershareMaxShares
= 0;
4831 /* By default disallow sharing of directories not owned by the sharer. */
4832 Globals
.bUsershareOwnerOnly
= True
;
4833 /* By default disallow guest access to usershares. */
4834 Globals
.bUsershareAllowGuests
= False
;
4836 Globals
.iKeepalive
= DEFAULT_KEEPALIVE
;
4838 /* By default no shares out of the registry */
4839 Globals
.bRegistryShares
= False
;
4841 Globals
.iminreceivefile
= 0;
4844 /*******************************************************************
4845 Convenience routine to grab string parameters into temporary memory
4846 and run standard_sub_basic on them. The buffers can be written to by
4847 callers without affecting the source string.
4848 ********************************************************************/
4850 static char *lp_string(const char *s
)
4853 TALLOC_CTX
*ctx
= talloc_tos();
4855 /* The follow debug is useful for tracking down memory problems
4856 especially if you have an inner loop that is calling a lp_*()
4857 function that returns a string. Perhaps this debug should be
4858 present all the time? */
4861 DEBUG(10, ("lp_string(%s)\n", s
));
4864 ret
= talloc_sub_basic(ctx
,
4865 get_current_username(),
4866 current_user_info
.domain
,
4868 if (trim_char(ret
, '\"', '\"')) {
4869 if (strchr(ret
,'\"') != NULL
) {
4871 ret
= talloc_sub_basic(ctx
,
4872 get_current_username(),
4873 current_user_info
.domain
,
4881 In this section all the functions that are used to access the
4882 parameters from the rest of the program are defined
4885 #define FN_GLOBAL_STRING(fn_name,ptr) \
4886 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
4887 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
4888 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
4889 #define FN_GLOBAL_LIST(fn_name,ptr) \
4890 const char **fn_name(void) {return(*(const char ***)(ptr));}
4891 #define FN_GLOBAL_BOOL(fn_name,ptr) \
4892 bool fn_name(void) {return(*(bool *)(ptr));}
4893 #define FN_GLOBAL_CHAR(fn_name,ptr) \
4894 char fn_name(void) {return(*(char *)(ptr));}
4895 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
4896 int fn_name(void) {return(*(int *)(ptr));}
4898 #define FN_LOCAL_STRING(fn_name,val) \
4899 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
4900 #define FN_LOCAL_CONST_STRING(fn_name,val) \
4901 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
4902 #define FN_LOCAL_LIST(fn_name,val) \
4903 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
4904 #define FN_LOCAL_BOOL(fn_name,val) \
4905 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
4906 #define FN_LOCAL_INTEGER(fn_name,val) \
4907 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
4909 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
4910 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
4911 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
4912 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
4913 #define FN_LOCAL_PARM_STRING(fn_name,val) \
4914 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));}
4915 #define FN_LOCAL_CHAR(fn_name,val) \
4916 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
4918 FN_GLOBAL_STRING(lp_smb_ports
, &Globals
.smb_ports
)
4919 FN_GLOBAL_STRING(lp_dos_charset
, &Globals
.dos_charset
)
4920 FN_GLOBAL_STRING(lp_unix_charset
, &Globals
.unix_charset
)
4921 FN_GLOBAL_STRING(lp_display_charset
, &Globals
.display_charset
)
4922 FN_GLOBAL_STRING(lp_logfile
, &Globals
.szLogFile
)
4923 FN_GLOBAL_STRING(lp_configfile
, &Globals
.szConfigFile
)
4924 FN_GLOBAL_STRING(lp_smb_passwd_file
, &Globals
.szSMBPasswdFile
)
4925 FN_GLOBAL_STRING(lp_private_dir
, &Globals
.szPrivateDir
)
4926 FN_GLOBAL_STRING(lp_serverstring
, &Globals
.szServerString
)
4927 FN_GLOBAL_INTEGER(lp_printcap_cache_time
, &Globals
.PrintcapCacheTime
)
4928 FN_GLOBAL_STRING(lp_addport_cmd
, &Globals
.szAddPortCommand
)
4929 FN_GLOBAL_STRING(lp_enumports_cmd
, &Globals
.szEnumPortsCommand
)
4930 FN_GLOBAL_STRING(lp_addprinter_cmd
, &Globals
.szAddPrinterCommand
)
4931 FN_GLOBAL_STRING(lp_deleteprinter_cmd
, &Globals
.szDeletePrinterCommand
)
4932 FN_GLOBAL_STRING(lp_os2_driver_map
, &Globals
.szOs2DriverMap
)
4933 FN_GLOBAL_STRING(lp_lockdir
, &Globals
.szLockDir
)
4934 FN_GLOBAL_STRING(lp_piddir
, &Globals
.szPidDir
)
4935 FN_GLOBAL_STRING(lp_mangling_method
, &Globals
.szManglingMethod
)
4936 FN_GLOBAL_INTEGER(lp_mangle_prefix
, &Globals
.mangle_prefix
)
4937 FN_GLOBAL_STRING(lp_utmpdir
, &Globals
.szUtmpDir
)
4938 FN_GLOBAL_STRING(lp_wtmpdir
, &Globals
.szWtmpDir
)
4939 FN_GLOBAL_BOOL(lp_utmp
, &Globals
.bUtmp
)
4940 FN_GLOBAL_STRING(lp_rootdir
, &Globals
.szRootdir
)
4941 FN_GLOBAL_STRING(lp_defaultservice
, &Globals
.szDefaultService
)
4942 FN_GLOBAL_STRING(lp_msg_command
, &Globals
.szMsgCommand
)
4943 FN_GLOBAL_STRING(lp_get_quota_command
, &Globals
.szGetQuota
)
4944 FN_GLOBAL_STRING(lp_set_quota_command
, &Globals
.szSetQuota
)
4945 FN_GLOBAL_STRING(lp_auto_services
, &Globals
.szAutoServices
)
4946 FN_GLOBAL_STRING(lp_passwd_program
, &Globals
.szPasswdProgram
)
4947 FN_GLOBAL_STRING(lp_passwd_chat
, &Globals
.szPasswdChat
)
4948 FN_GLOBAL_STRING(lp_passwordserver
, &Globals
.szPasswordServer
)
4949 FN_GLOBAL_STRING(lp_name_resolve_order
, &Globals
.szNameResolveOrder
)
4950 FN_GLOBAL_STRING(lp_realm
, &Globals
.szRealm
)
4951 FN_GLOBAL_CONST_STRING(lp_afs_username_map
, &Globals
.szAfsUsernameMap
)
4952 FN_GLOBAL_INTEGER(lp_afs_token_lifetime
, &Globals
.iAfsTokenLifetime
)
4953 FN_GLOBAL_STRING(lp_log_nt_token_command
, &Globals
.szLogNtTokenCommand
)
4954 FN_GLOBAL_STRING(lp_username_map
, &Globals
.szUsernameMap
)
4955 FN_GLOBAL_CONST_STRING(lp_logon_script
, &Globals
.szLogonScript
)
4956 FN_GLOBAL_CONST_STRING(lp_logon_path
, &Globals
.szLogonPath
)
4957 FN_GLOBAL_CONST_STRING(lp_logon_drive
, &Globals
.szLogonDrive
)
4958 FN_GLOBAL_CONST_STRING(lp_logon_home
, &Globals
.szLogonHome
)
4959 FN_GLOBAL_STRING(lp_remote_announce
, &Globals
.szRemoteAnnounce
)
4960 FN_GLOBAL_STRING(lp_remote_browse_sync
, &Globals
.szRemoteBrowseSync
)
4961 FN_GLOBAL_LIST(lp_wins_server_list
, &Globals
.szWINSservers
)
4962 FN_GLOBAL_LIST(lp_interfaces
, &Globals
.szInterfaces
)
4963 FN_GLOBAL_STRING(lp_socket_address
, &Globals
.szSocketAddress
)
4964 FN_GLOBAL_STRING(lp_nis_home_map_name
, &Globals
.szNISHomeMapName
)
4965 static FN_GLOBAL_STRING(lp_announce_version
, &Globals
.szAnnounceVersion
)
4966 FN_GLOBAL_LIST(lp_netbios_aliases
, &Globals
.szNetbiosAliases
)
4967 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
4968 * lp_passdb_backend() should be replace by the this macro again after
4971 const char *lp_passdb_backend(void)
4973 char *delim
, *quote
;
4975 delim
= strchr( Globals
.szPassdbBackend
, ' ');
4976 /* no space at all */
4977 if (delim
== NULL
) {
4981 quote
= strchr(Globals
.szPassdbBackend
, '"');
4982 /* no quote char or non in the first part */
4983 if (quote
== NULL
|| quote
> delim
) {
4988 quote
= strchr(quote
+1, '"');
4989 if (quote
== NULL
) {
4990 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
4992 } else if (*(quote
+1) == '\0') {
4993 /* space, fitting quote char, and one backend only */
4996 /* terminate string after the fitting quote char */
5001 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5002 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5003 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5004 "backend (%s) is used. The rest is ignored.\n", Globals
.szPassdbBackend
));
5007 return Globals
.szPassdbBackend
;
5009 FN_GLOBAL_LIST(lp_preload_modules
, &Globals
.szPreloadModules
)
5010 FN_GLOBAL_STRING(lp_panic_action
, &Globals
.szPanicAction
)
5011 FN_GLOBAL_STRING(lp_adduser_script
, &Globals
.szAddUserScript
)
5012 FN_GLOBAL_STRING(lp_renameuser_script
, &Globals
.szRenameUserScript
)
5013 FN_GLOBAL_STRING(lp_deluser_script
, &Globals
.szDelUserScript
)
5015 FN_GLOBAL_CONST_STRING(lp_guestaccount
, &Globals
.szGuestaccount
)
5016 FN_GLOBAL_STRING(lp_addgroup_script
, &Globals
.szAddGroupScript
)
5017 FN_GLOBAL_STRING(lp_delgroup_script
, &Globals
.szDelGroupScript
)
5018 FN_GLOBAL_STRING(lp_addusertogroup_script
, &Globals
.szAddUserToGroupScript
)
5019 FN_GLOBAL_STRING(lp_deluserfromgroup_script
, &Globals
.szDelUserFromGroupScript
)
5020 FN_GLOBAL_STRING(lp_setprimarygroup_script
, &Globals
.szSetPrimaryGroupScript
)
5022 FN_GLOBAL_STRING(lp_addmachine_script
, &Globals
.szAddMachineScript
)
5024 FN_GLOBAL_STRING(lp_shutdown_script
, &Globals
.szShutdownScript
)
5025 FN_GLOBAL_STRING(lp_abort_shutdown_script
, &Globals
.szAbortShutdownScript
)
5026 FN_GLOBAL_STRING(lp_username_map_script
, &Globals
.szUsernameMapScript
)
5028 FN_GLOBAL_STRING(lp_check_password_script
, &Globals
.szCheckPasswordScript
)
5030 FN_GLOBAL_STRING(lp_wins_hook
, &Globals
.szWINSHook
)
5031 FN_GLOBAL_CONST_STRING(lp_template_homedir
, &Globals
.szTemplateHomedir
)
5032 FN_GLOBAL_CONST_STRING(lp_template_shell
, &Globals
.szTemplateShell
)
5033 FN_GLOBAL_CONST_STRING(lp_winbind_separator
, &Globals
.szWinbindSeparator
)
5034 FN_GLOBAL_INTEGER(lp_acl_compatibility
, &Globals
.iAclCompat
)
5035 FN_GLOBAL_BOOL(lp_winbind_enum_users
, &Globals
.bWinbindEnumUsers
)
5036 FN_GLOBAL_BOOL(lp_winbind_enum_groups
, &Globals
.bWinbindEnumGroups
)
5037 FN_GLOBAL_BOOL(lp_winbind_use_default_domain
, &Globals
.bWinbindUseDefaultDomain
)
5038 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only
, &Globals
.bWinbindTrustedDomainsOnly
)
5039 FN_GLOBAL_BOOL(lp_winbind_nested_groups
, &Globals
.bWinbindNestedGroups
)
5040 FN_GLOBAL_INTEGER(lp_winbind_expand_groups
, &Globals
.winbind_expand_groups
)
5041 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets
, &Globals
.bWinbindRefreshTickets
)
5042 FN_GLOBAL_BOOL(lp_winbind_offline_logon
, &Globals
.bWinbindOfflineLogon
)
5043 FN_GLOBAL_BOOL(lp_winbind_normalize_names
, &Globals
.bWinbindNormalizeNames
)
5044 FN_GLOBAL_BOOL(lp_winbind_rpc_only
, &Globals
.bWinbindRpcOnly
)
5046 FN_GLOBAL_LIST(lp_idmap_domains
, &Globals
.szIdmapDomains
)
5047 FN_GLOBAL_LIST(lp_idmap_backend
, &Globals
.szIdmapBackend
) /* deprecated */
5048 FN_GLOBAL_STRING(lp_idmap_alloc_backend
, &Globals
.szIdmapAllocBackend
)
5049 FN_GLOBAL_INTEGER(lp_idmap_cache_time
, &Globals
.iIdmapCacheTime
)
5050 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time
, &Globals
.iIdmapNegativeCacheTime
)
5051 FN_GLOBAL_INTEGER(lp_keepalive
, &Globals
.iKeepalive
)
5052 FN_GLOBAL_BOOL(lp_passdb_expand_explicit
, &Globals
.bPassdbExpandExplicit
)
5054 FN_GLOBAL_STRING(lp_ldap_suffix
, &Globals
.szLdapSuffix
)
5055 FN_GLOBAL_STRING(lp_ldap_admin_dn
, &Globals
.szLdapAdminDn
)
5056 FN_GLOBAL_INTEGER(lp_ldap_ssl
, &Globals
.ldap_ssl
)
5057 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync
, &Globals
.ldap_passwd_sync
)
5058 FN_GLOBAL_BOOL(lp_ldap_delete_dn
, &Globals
.ldap_delete_dn
)
5059 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep
, &Globals
.ldap_replication_sleep
)
5060 FN_GLOBAL_INTEGER(lp_ldap_timeout
, &Globals
.ldap_timeout
)
5061 FN_GLOBAL_INTEGER(lp_ldap_page_size
, &Globals
.ldap_page_size
)
5062 FN_GLOBAL_INTEGER(lp_ldap_debug_level
, &Globals
.ldap_debug_level
)
5063 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold
, &Globals
.ldap_debug_threshold
)
5064 FN_GLOBAL_STRING(lp_add_share_cmd
, &Globals
.szAddShareCommand
)
5065 FN_GLOBAL_STRING(lp_change_share_cmd
, &Globals
.szChangeShareCommand
)
5066 FN_GLOBAL_STRING(lp_delete_share_cmd
, &Globals
.szDeleteShareCommand
)
5067 FN_GLOBAL_STRING(lp_usershare_path
, &Globals
.szUsersharePath
)
5068 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list
, &Globals
.szUsersharePrefixAllowList
)
5069 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list
, &Globals
.szUsersharePrefixDenyList
)
5071 FN_GLOBAL_LIST(lp_eventlog_list
, &Globals
.szEventLogs
)
5073 FN_GLOBAL_BOOL(lp_registry_shares
, &Globals
.bRegistryShares
)
5074 FN_GLOBAL_BOOL(lp_usershare_allow_guests
, &Globals
.bUsershareAllowGuests
)
5075 FN_GLOBAL_BOOL(lp_usershare_owner_only
, &Globals
.bUsershareOwnerOnly
)
5076 FN_GLOBAL_BOOL(lp_disable_netbios
, &Globals
.bDisableNetbios
)
5077 FN_GLOBAL_BOOL(lp_reset_on_zero_vc
, &Globals
.bResetOnZeroVC
)
5078 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard
, &Globals
.bMsAddPrinterWizard
)
5079 FN_GLOBAL_BOOL(lp_dns_proxy
, &Globals
.bDNSproxy
)
5080 FN_GLOBAL_BOOL(lp_wins_support
, &Globals
.bWINSsupport
)
5081 FN_GLOBAL_BOOL(lp_we_are_a_wins_server
, &Globals
.bWINSsupport
)
5082 FN_GLOBAL_BOOL(lp_wins_proxy
, &Globals
.bWINSproxy
)
5083 FN_GLOBAL_BOOL(lp_local_master
, &Globals
.bLocalMaster
)
5084 FN_GLOBAL_BOOL(lp_domain_logons
, &Globals
.bDomainLogons
)
5085 FN_GLOBAL_BOOL(lp_load_printers
, &Globals
.bLoadPrinters
)
5086 FN_GLOBAL_BOOL(lp_readraw
, &Globals
.bReadRaw
)
5087 FN_GLOBAL_BOOL(lp_large_readwrite
, &Globals
.bLargeReadwrite
)
5088 FN_GLOBAL_BOOL(lp_writeraw
, &Globals
.bWriteRaw
)
5089 FN_GLOBAL_BOOL(lp_null_passwords
, &Globals
.bNullPasswords
)
5090 FN_GLOBAL_BOOL(lp_obey_pam_restrictions
, &Globals
.bObeyPamRestrictions
)
5091 FN_GLOBAL_BOOL(lp_encrypted_passwords
, &Globals
.bEncryptPasswords
)
5092 FN_GLOBAL_BOOL(lp_update_encrypted
, &Globals
.bUpdateEncrypt
)
5093 FN_GLOBAL_INTEGER(lp_client_schannel
, &Globals
.clientSchannel
)
5094 FN_GLOBAL_INTEGER(lp_server_schannel
, &Globals
.serverSchannel
)
5095 FN_GLOBAL_BOOL(lp_syslog_only
, &Globals
.bSyslogOnly
)
5096 FN_GLOBAL_BOOL(lp_timestamp_logs
, &Globals
.bTimestampLogs
)
5097 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp
, &Globals
.bDebugPrefixTimestamp
)
5098 FN_GLOBAL_BOOL(lp_debug_hires_timestamp
, &Globals
.bDebugHiresTimestamp
)
5099 FN_GLOBAL_BOOL(lp_debug_pid
, &Globals
.bDebugPid
)
5100 FN_GLOBAL_BOOL(lp_debug_uid
, &Globals
.bDebugUid
)
5101 FN_GLOBAL_BOOL(lp_debug_class
, &Globals
.bDebugClass
)
5102 FN_GLOBAL_BOOL(lp_enable_core_files
, &Globals
.bEnableCoreFiles
)
5103 FN_GLOBAL_BOOL(lp_browse_list
, &Globals
.bBrowseList
)
5104 FN_GLOBAL_BOOL(lp_nis_home_map
, &Globals
.bNISHomeMap
)
5105 static FN_GLOBAL_BOOL(lp_time_server
, &Globals
.bTimeServer
)
5106 FN_GLOBAL_BOOL(lp_bind_interfaces_only
, &Globals
.bBindInterfacesOnly
)
5107 FN_GLOBAL_BOOL(lp_pam_password_change
, &Globals
.bPamPasswordChange
)
5108 FN_GLOBAL_BOOL(lp_unix_password_sync
, &Globals
.bUnixPasswdSync
)
5109 FN_GLOBAL_BOOL(lp_passwd_chat_debug
, &Globals
.bPasswdChatDebug
)
5110 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout
, &Globals
.iPasswdChatTimeout
)
5111 FN_GLOBAL_BOOL(lp_nt_pipe_support
, &Globals
.bNTPipeSupport
)
5112 FN_GLOBAL_BOOL(lp_nt_status_support
, &Globals
.bNTStatusSupport
)
5113 FN_GLOBAL_BOOL(lp_stat_cache
, &Globals
.bStatCache
)
5114 FN_GLOBAL_INTEGER(lp_max_stat_cache_size
, &Globals
.iMaxStatCacheSize
)
5115 FN_GLOBAL_BOOL(lp_allow_trusted_domains
, &Globals
.bAllowTrustedDomains
)
5116 FN_GLOBAL_INTEGER(lp_restrict_anonymous
, &Globals
.restrict_anonymous
)
5117 FN_GLOBAL_BOOL(lp_lanman_auth
, &Globals
.bLanmanAuth
)
5118 FN_GLOBAL_BOOL(lp_ntlm_auth
, &Globals
.bNTLMAuth
)
5119 FN_GLOBAL_BOOL(lp_client_plaintext_auth
, &Globals
.bClientPlaintextAuth
)
5120 FN_GLOBAL_BOOL(lp_client_lanman_auth
, &Globals
.bClientLanManAuth
)
5121 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth
, &Globals
.bClientNTLMv2Auth
)
5122 FN_GLOBAL_BOOL(lp_host_msdfs
, &Globals
.bHostMSDfs
)
5123 FN_GLOBAL_BOOL(lp_kernel_oplocks
, &Globals
.bKernelOplocks
)
5124 FN_GLOBAL_BOOL(lp_enhanced_browsing
, &Globals
.enhanced_browsing
)
5125 FN_GLOBAL_BOOL(lp_use_mmap
, &Globals
.bUseMmap
)
5126 FN_GLOBAL_BOOL(lp_unix_extensions
, &Globals
.bUnixExtensions
)
5127 FN_GLOBAL_BOOL(lp_use_spnego
, &Globals
.bUseSpnego
)
5128 FN_GLOBAL_BOOL(lp_client_use_spnego
, &Globals
.bClientUseSpnego
)
5129 FN_GLOBAL_BOOL(lp_hostname_lookups
, &Globals
.bHostnameLookups
)
5130 FN_LOCAL_PARM_BOOL(lp_change_notify
, bChangeNotify
)
5131 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify
, bKernelChangeNotify
)
5132 FN_GLOBAL_BOOL(lp_use_kerberos_keytab
, &Globals
.bUseKerberosKeytab
)
5133 FN_GLOBAL_BOOL(lp_defer_sharing_violations
, &Globals
.bDeferSharingViolations
)
5134 FN_GLOBAL_BOOL(lp_enable_privileges
, &Globals
.bEnablePrivileges
)
5135 FN_GLOBAL_BOOL(lp_enable_asu_support
, &Globals
.bASUSupport
)
5136 FN_GLOBAL_INTEGER(lp_os_level
, &Globals
.os_level
)
5137 FN_GLOBAL_INTEGER(lp_max_ttl
, &Globals
.max_ttl
)
5138 FN_GLOBAL_INTEGER(lp_max_wins_ttl
, &Globals
.max_wins_ttl
)
5139 FN_GLOBAL_INTEGER(lp_min_wins_ttl
, &Globals
.min_wins_ttl
)
5140 FN_GLOBAL_INTEGER(lp_max_log_size
, &Globals
.max_log_size
)
5141 FN_GLOBAL_INTEGER(lp_max_open_files
, &Globals
.max_open_files
)
5142 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size
, &Globals
.open_files_db_hash_size
)
5143 FN_GLOBAL_INTEGER(lp_maxxmit
, &Globals
.max_xmit
)
5144 FN_GLOBAL_INTEGER(lp_maxmux
, &Globals
.max_mux
)
5145 FN_GLOBAL_INTEGER(lp_passwordlevel
, &Globals
.pwordlevel
)
5146 FN_GLOBAL_INTEGER(lp_usernamelevel
, &Globals
.unamelevel
)
5147 FN_GLOBAL_INTEGER(lp_deadtime
, &Globals
.deadtime
)
5148 FN_GLOBAL_BOOL(lp_getwd_cache
, &Globals
.getwd_cache
)
5149 FN_GLOBAL_INTEGER(lp_maxprotocol
, &Globals
.maxprotocol
)
5150 FN_GLOBAL_INTEGER(lp_minprotocol
, &Globals
.minprotocol
)
5151 FN_GLOBAL_INTEGER(lp_security
, &Globals
.security
)
5152 FN_GLOBAL_LIST(lp_auth_methods
, &Globals
.AuthMethods
)
5153 FN_GLOBAL_BOOL(lp_paranoid_server_security
, &Globals
.paranoid_server_security
)
5154 FN_GLOBAL_INTEGER(lp_maxdisksize
, &Globals
.maxdisksize
)
5155 FN_GLOBAL_INTEGER(lp_lpqcachetime
, &Globals
.lpqcachetime
)
5156 FN_GLOBAL_INTEGER(lp_max_smbd_processes
, &Globals
.iMaxSmbdProcesses
)
5157 FN_GLOBAL_BOOL(_lp_disable_spoolss
, &Globals
.bDisableSpoolss
)
5158 FN_GLOBAL_INTEGER(lp_syslog
, &Globals
.syslog
)
5159 static FN_GLOBAL_INTEGER(lp_announce_as
, &Globals
.announce_as
)
5160 FN_GLOBAL_INTEGER(lp_lm_announce
, &Globals
.lm_announce
)
5161 FN_GLOBAL_INTEGER(lp_lm_interval
, &Globals
.lm_interval
)
5162 FN_GLOBAL_INTEGER(lp_machine_password_timeout
, &Globals
.machine_password_timeout
)
5163 FN_GLOBAL_INTEGER(lp_map_to_guest
, &Globals
.map_to_guest
)
5164 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time
, &Globals
.oplock_break_wait_time
)
5165 FN_GLOBAL_INTEGER(lp_lock_spin_time
, &Globals
.iLockSpinTime
)
5166 FN_GLOBAL_INTEGER(lp_usershare_max_shares
, &Globals
.iUsershareMaxShares
)
5167 FN_GLOBAL_CONST_STRING(lp_socket_options
, &Globals
.szSocketOptions
)
5168 FN_GLOBAL_INTEGER(lp_config_backend
, &Globals
.ConfigBackend
);
5170 FN_LOCAL_STRING(lp_preexec
, szPreExec
)
5171 FN_LOCAL_STRING(lp_postexec
, szPostExec
)
5172 FN_LOCAL_STRING(lp_rootpreexec
, szRootPreExec
)
5173 FN_LOCAL_STRING(lp_rootpostexec
, szRootPostExec
)
5174 FN_LOCAL_STRING(lp_servicename
, szService
)
5175 FN_LOCAL_CONST_STRING(lp_const_servicename
, szService
)
5176 FN_LOCAL_STRING(lp_pathname
, szPath
)
5177 FN_LOCAL_STRING(lp_dontdescend
, szDontdescend
)
5178 FN_LOCAL_STRING(lp_username
, szUsername
)
5179 FN_LOCAL_LIST(lp_invalid_users
, szInvalidUsers
)
5180 FN_LOCAL_LIST(lp_valid_users
, szValidUsers
)
5181 FN_LOCAL_LIST(lp_admin_users
, szAdminUsers
)
5182 FN_GLOBAL_LIST(lp_svcctl_list
, &Globals
.szServicesList
)
5183 FN_LOCAL_STRING(lp_cups_options
, szCupsOptions
)
5184 FN_GLOBAL_STRING(lp_cups_server
, &Globals
.szCupsServer
)
5185 FN_GLOBAL_STRING(lp_iprint_server
, &Globals
.szIPrintServer
)
5186 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket
, &Globals
.ctdbdSocket
)
5187 FN_GLOBAL_LIST(lp_cluster_addresses
, &Globals
.szClusterAddresses
)
5188 FN_GLOBAL_BOOL(lp_clustering
, &Globals
.clustering
);
5189 FN_LOCAL_STRING(lp_printcommand
, szPrintcommand
)
5190 FN_LOCAL_STRING(lp_lpqcommand
, szLpqcommand
)
5191 FN_LOCAL_STRING(lp_lprmcommand
, szLprmcommand
)
5192 FN_LOCAL_STRING(lp_lppausecommand
, szLppausecommand
)
5193 FN_LOCAL_STRING(lp_lpresumecommand
, szLpresumecommand
)
5194 FN_LOCAL_STRING(lp_queuepausecommand
, szQueuepausecommand
)
5195 FN_LOCAL_STRING(lp_queueresumecommand
, szQueueresumecommand
)
5196 static FN_LOCAL_STRING(_lp_printername
, szPrintername
)
5197 FN_LOCAL_CONST_STRING(lp_printjob_username
, szPrintjobUsername
)
5198 FN_LOCAL_LIST(lp_hostsallow
, szHostsallow
)
5199 FN_LOCAL_LIST(lp_hostsdeny
, szHostsdeny
)
5200 FN_LOCAL_STRING(lp_magicscript
, szMagicScript
)
5201 FN_LOCAL_STRING(lp_magicoutput
, szMagicOutput
)
5202 FN_LOCAL_STRING(lp_comment
, comment
)
5203 FN_LOCAL_STRING(lp_force_user
, force_user
)
5204 FN_LOCAL_STRING(lp_force_group
, force_group
)
5205 FN_LOCAL_LIST(lp_readlist
, readlist
)
5206 FN_LOCAL_LIST(lp_writelist
, writelist
)
5207 FN_LOCAL_LIST(lp_printer_admin
, printer_admin
)
5208 FN_LOCAL_STRING(lp_fstype
, fstype
)
5209 FN_LOCAL_LIST(lp_vfs_objects
, szVfsObjects
)
5210 FN_LOCAL_STRING(lp_msdfs_proxy
, szMSDfsProxy
)
5211 static FN_LOCAL_STRING(lp_volume
, volume
)
5212 FN_LOCAL_STRING(lp_veto_files
, szVetoFiles
)
5213 FN_LOCAL_STRING(lp_hide_files
, szHideFiles
)
5214 FN_LOCAL_STRING(lp_veto_oplocks
, szVetoOplockFiles
)
5215 FN_LOCAL_BOOL(lp_msdfs_root
, bMSDfsRoot
)
5216 FN_LOCAL_STRING(lp_aio_write_behind
, szAioWriteBehind
)
5217 FN_LOCAL_STRING(lp_dfree_command
, szDfree
)
5218 FN_LOCAL_BOOL(lp_autoloaded
, autoloaded
)
5219 FN_LOCAL_BOOL(lp_preexec_close
, bPreexecClose
)
5220 FN_LOCAL_BOOL(lp_rootpreexec_close
, bRootpreexecClose
)
5221 FN_LOCAL_INTEGER(lp_casesensitive
, iCaseSensitive
)
5222 FN_LOCAL_BOOL(lp_preservecase
, bCasePreserve
)
5223 FN_LOCAL_BOOL(lp_shortpreservecase
, bShortCasePreserve
)
5224 FN_LOCAL_BOOL(lp_hide_dot_files
, bHideDotFiles
)
5225 FN_LOCAL_BOOL(lp_hide_special_files
, bHideSpecialFiles
)
5226 FN_LOCAL_BOOL(lp_hideunreadable
, bHideUnReadable
)
5227 FN_LOCAL_BOOL(lp_hideunwriteable_files
, bHideUnWriteableFiles
)
5228 FN_LOCAL_BOOL(lp_browseable
, bBrowseable
)
5229 FN_LOCAL_BOOL(lp_readonly
, bRead_only
)
5230 FN_LOCAL_BOOL(lp_no_set_dir
, bNo_set_dir
)
5231 FN_LOCAL_BOOL(lp_guest_ok
, bGuest_ok
)
5232 FN_LOCAL_BOOL(lp_guest_only
, bGuest_only
)
5233 FN_LOCAL_BOOL(lp_administrative_share
, bAdministrative_share
)
5234 FN_LOCAL_BOOL(lp_print_ok
, bPrint_ok
)
5235 FN_LOCAL_BOOL(lp_map_hidden
, bMap_hidden
)
5236 FN_LOCAL_BOOL(lp_map_archive
, bMap_archive
)
5237 FN_LOCAL_BOOL(lp_store_dos_attributes
, bStoreDosAttributes
)
5238 FN_LOCAL_BOOL(lp_dmapi_support
, bDmapiSupport
)
5239 FN_LOCAL_PARM_BOOL(lp_locking
, bLocking
)
5240 FN_LOCAL_PARM_INTEGER(lp_strict_locking
, iStrictLocking
)
5241 FN_LOCAL_PARM_BOOL(lp_posix_locking
, bPosixLocking
)
5242 FN_LOCAL_BOOL(lp_share_modes
, bShareModes
)
5243 FN_LOCAL_BOOL(lp_oplocks
, bOpLocks
)
5244 FN_LOCAL_BOOL(lp_level2_oplocks
, bLevel2OpLocks
)
5245 FN_LOCAL_BOOL(lp_onlyuser
, bOnlyUser
)
5246 FN_LOCAL_PARM_BOOL(lp_manglednames
, bMangledNames
)
5247 FN_LOCAL_BOOL(lp_widelinks
, bWidelinks
)
5248 FN_LOCAL_BOOL(lp_symlinks
, bSymlinks
)
5249 FN_LOCAL_BOOL(lp_syncalways
, bSyncAlways
)
5250 FN_LOCAL_BOOL(lp_strict_allocate
, bStrictAllocate
)
5251 FN_LOCAL_BOOL(lp_strict_sync
, bStrictSync
)
5252 FN_LOCAL_BOOL(lp_map_system
, bMap_system
)
5253 FN_LOCAL_BOOL(lp_delete_readonly
, bDeleteReadonly
)
5254 FN_LOCAL_BOOL(lp_fake_oplocks
, bFakeOplocks
)
5255 FN_LOCAL_BOOL(lp_recursive_veto_delete
, bDeleteVetoFiles
)
5256 FN_LOCAL_BOOL(lp_dos_filemode
, bDosFilemode
)
5257 FN_LOCAL_BOOL(lp_dos_filetimes
, bDosFiletimes
)
5258 FN_LOCAL_BOOL(lp_dos_filetime_resolution
, bDosFiletimeResolution
)
5259 FN_LOCAL_BOOL(lp_fake_dir_create_times
, bFakeDirCreateTimes
)
5260 FN_LOCAL_BOOL(lp_blocking_locks
, bBlockingLocks
)
5261 FN_LOCAL_BOOL(lp_inherit_perms
, bInheritPerms
)
5262 FN_LOCAL_BOOL(lp_inherit_acls
, bInheritACLS
)
5263 FN_LOCAL_BOOL(lp_inherit_owner
, bInheritOwner
)
5264 FN_LOCAL_BOOL(lp_use_client_driver
, bUseClientDriver
)
5265 FN_LOCAL_BOOL(lp_default_devmode
, bDefaultDevmode
)
5266 FN_LOCAL_BOOL(lp_force_printername
, bForcePrintername
)
5267 FN_LOCAL_BOOL(lp_nt_acl_support
, bNTAclSupport
)
5268 FN_LOCAL_BOOL(lp_force_unknown_acl_user
, bForceUnknownAclUser
)
5269 FN_LOCAL_BOOL(lp_ea_support
, bEASupport
)
5270 FN_LOCAL_BOOL(_lp_use_sendfile
, bUseSendfile
)
5271 FN_LOCAL_BOOL(lp_profile_acls
, bProfileAcls
)
5272 FN_LOCAL_BOOL(lp_map_acl_inherit
, bMap_acl_inherit
)
5273 FN_LOCAL_BOOL(lp_afs_share
, bAfs_Share
)
5274 FN_LOCAL_BOOL(lp_acl_check_permissions
, bAclCheckPermissions
)
5275 FN_LOCAL_BOOL(lp_acl_group_control
, bAclGroupControl
)
5276 FN_LOCAL_BOOL(lp_acl_map_full_control
, bAclMapFullControl
)
5277 FN_LOCAL_INTEGER(lp_create_mask
, iCreate_mask
)
5278 FN_LOCAL_INTEGER(lp_force_create_mode
, iCreate_force_mode
)
5279 FN_LOCAL_INTEGER(lp_security_mask
, iSecurity_mask
)
5280 FN_LOCAL_INTEGER(lp_force_security_mode
, iSecurity_force_mode
)
5281 FN_LOCAL_INTEGER(lp_dir_mask
, iDir_mask
)
5282 FN_LOCAL_INTEGER(lp_force_dir_mode
, iDir_force_mode
)
5283 FN_LOCAL_INTEGER(lp_dir_security_mask
, iDir_Security_mask
)
5284 FN_LOCAL_INTEGER(lp_force_dir_security_mode
, iDir_Security_force_mode
)
5285 FN_LOCAL_INTEGER(lp_max_connections
, iMaxConnections
)
5286 FN_LOCAL_INTEGER(lp_defaultcase
, iDefaultCase
)
5287 FN_LOCAL_INTEGER(lp_minprintspace
, iMinPrintSpace
)
5288 FN_LOCAL_INTEGER(lp_printing
, iPrinting
)
5289 FN_LOCAL_INTEGER(lp_max_reported_jobs
, iMaxReportedPrintJobs
)
5290 FN_LOCAL_INTEGER(lp_oplock_contention_limit
, iOplockContentionLimit
)
5291 FN_LOCAL_INTEGER(lp_csc_policy
, iCSCPolicy
)
5292 FN_LOCAL_INTEGER(lp_write_cache_size
, iWriteCacheSize
)
5293 FN_LOCAL_INTEGER(lp_block_size
, iBlock_size
)
5294 FN_LOCAL_INTEGER(lp_dfree_cache_time
, iDfreeCacheTime
)
5295 FN_LOCAL_INTEGER(lp_allocation_roundup_size
, iallocation_roundup_size
)
5296 FN_LOCAL_INTEGER(lp_aio_read_size
, iAioReadSize
)
5297 FN_LOCAL_INTEGER(lp_aio_write_size
, iAioWriteSize
)
5298 FN_LOCAL_INTEGER(lp_map_readonly
, iMap_readonly
)
5299 FN_LOCAL_INTEGER(lp_directory_name_cache_size
, iDirectoryNameCacheSize
)
5300 FN_LOCAL_INTEGER(lp_smb_encrypt
, ismb_encrypt
)
5301 FN_LOCAL_CHAR(lp_magicchar
, magic_char
)
5302 FN_GLOBAL_INTEGER(lp_winbind_cache_time
, &Globals
.winbind_cache_time
)
5303 FN_GLOBAL_LIST(lp_winbind_nss_info
, &Globals
.szWinbindNssInfo
)
5304 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base
, &Globals
.AlgorithmicRidBase
)
5305 FN_GLOBAL_INTEGER(lp_name_cache_timeout
, &Globals
.name_cache_timeout
)
5306 FN_GLOBAL_INTEGER(lp_client_signing
, &Globals
.client_signing
)
5307 FN_GLOBAL_INTEGER(lp_server_signing
, &Globals
.server_signing
)
5308 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping
, &Globals
.client_ldap_sasl_wrapping
)
5310 /* local prototypes */
5312 static int map_parameter(const char *pszParmName
);
5313 static int map_parameter_canonical(const char *pszParmName
, bool *inverse
);
5314 static bool set_boolean(bool *pb
, const char *pszParmValue
);
5315 static const char *get_boolean(bool bool_value
);
5316 static int getservicebyname(const char *pszServiceName
,
5317 struct service
*pserviceDest
);
5318 static void copy_service(struct service
*pserviceDest
,
5319 struct service
*pserviceSource
,
5320 struct bitmap
*pcopymapDest
);
5321 static bool do_parameter(const char *pszParmName
, const char *pszParmValue
);
5322 static bool do_section(const char *pszSectionName
);
5323 static void init_copymap(struct service
*pservice
);
5324 static bool hash_a_service(const char *name
, int number
);
5325 static void free_service_byindex(int iService
);
5326 static char * canonicalize_servicename(const char *name
);
5327 static void show_parameter(int parmIndex
);
5328 static bool is_synonym_of(int parm1
, int parm2
, bool *inverse
);
5330 /* This is a helper function for parametrical options support. */
5331 /* It returns a pointer to parametrical option value if it exists or NULL otherwise */
5332 /* Actual parametrical functions are quite simple */
5333 static param_opt_struct
*get_parametrics(int snum
, const char *type
, const char *option
)
5335 bool global_section
= False
;
5337 param_opt_struct
*data
;
5339 if (snum
>= iNumServices
) return NULL
;
5342 data
= Globals
.param_opt
;
5343 global_section
= True
;
5345 data
= ServicePtrs
[snum
]->param_opt
;
5348 if (asprintf(¶m_key
, "%s:%s", type
, option
) == -1) {
5349 DEBUG(0,("asprintf failed!\n"));
5354 if (strcmp(data
->key
, param_key
) == 0) {
5355 string_free(¶m_key
);
5361 if (!global_section
) {
5362 /* Try to fetch the same option but from globals */
5363 /* but only if we are not already working with Globals */
5364 data
= Globals
.param_opt
;
5366 if (strcmp(data
->key
, param_key
) == 0) {
5367 string_free(¶m_key
);
5374 string_free(¶m_key
);
5380 #define MISSING_PARAMETER(name) \
5381 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
5383 /*******************************************************************
5384 convenience routine to return int parameters.
5385 ********************************************************************/
5386 static int lp_int(const char *s
)
5390 MISSING_PARAMETER(lp_int
);
5394 return (int)strtol(s
, NULL
, 0);
5397 /*******************************************************************
5398 convenience routine to return unsigned long parameters.
5399 ********************************************************************/
5400 static unsigned long lp_ulong(const char *s
)
5404 MISSING_PARAMETER(lp_ulong
);
5408 return strtoul(s
, NULL
, 0);
5411 /*******************************************************************
5412 convenience routine to return boolean parameters.
5413 ********************************************************************/
5414 static bool lp_bool(const char *s
)
5419 MISSING_PARAMETER(lp_bool
);
5423 if (!set_boolean(&ret
,s
)) {
5424 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s
));
5431 /*******************************************************************
5432 convenience routine to return enum parameters.
5433 ********************************************************************/
5434 static int lp_enum(const char *s
,const struct enum_list
*_enum
)
5438 if (!s
|| !*s
|| !_enum
) {
5439 MISSING_PARAMETER(lp_enum
);
5443 for (i
=0; _enum
[i
].name
; i
++) {
5444 if (strequal(_enum
[i
].name
,s
))
5445 return _enum
[i
].value
;
5448 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s
));
5452 #undef MISSING_PARAMETER
5454 /* DO NOT USE lp_parm_string ANYMORE!!!!
5455 * use lp_parm_const_string or lp_parm_talloc_string
5457 * lp_parm_string is only used to let old modules find this symbol
5459 #undef lp_parm_string
5460 char *lp_parm_string(const char *servicename
, const char *type
, const char *option
);
5461 char *lp_parm_string(const char *servicename
, const char *type
, const char *option
)
5463 return lp_parm_talloc_string(lp_servicenumber(servicename
), type
, option
, NULL
);
5466 /* Return parametric option from a given service. Type is a part of option before ':' */
5467 /* Parametric option has following syntax: 'Type: option = value' */
5468 /* the returned value is talloced on the talloc_tos() */
5469 char *lp_parm_talloc_string(int snum
, const char *type
, const char *option
, const char *def
)
5471 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5473 if (data
== NULL
||data
->value
==NULL
) {
5475 return lp_string(def
);
5481 return lp_string(data
->value
);
5484 /* Return parametric option from a given service. Type is a part of option before ':' */
5485 /* Parametric option has following syntax: 'Type: option = value' */
5486 const char *lp_parm_const_string(int snum
, const char *type
, const char *option
, const char *def
)
5488 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5490 if (data
== NULL
||data
->value
==NULL
)
5496 /* Return parametric option from a given service. Type is a part of option before ':' */
5497 /* Parametric option has following syntax: 'Type: option = value' */
5499 const char **lp_parm_string_list(int snum
, const char *type
, const char *option
, const char **def
)
5501 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5503 if (data
== NULL
||data
->value
==NULL
)
5504 return (const char **)def
;
5506 if (data
->list
==NULL
) {
5507 data
->list
= str_list_make(NULL
, data
->value
, NULL
);
5510 return (const char **)data
->list
;
5513 /* Return parametric option from a given service. Type is a part of option before ':' */
5514 /* Parametric option has following syntax: 'Type: option = value' */
5516 int lp_parm_int(int snum
, const char *type
, const char *option
, int def
)
5518 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5520 if (data
&& data
->value
&& *data
->value
)
5521 return lp_int(data
->value
);
5526 /* Return parametric option from a given service. Type is a part of option before ':' */
5527 /* Parametric option has following syntax: 'Type: option = value' */
5529 unsigned long lp_parm_ulong(int snum
, const char *type
, const char *option
, unsigned long def
)
5531 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5533 if (data
&& data
->value
&& *data
->value
)
5534 return lp_ulong(data
->value
);
5539 /* Return parametric option from a given service. Type is a part of option before ':' */
5540 /* Parametric option has following syntax: 'Type: option = value' */
5542 bool lp_parm_bool(int snum
, const char *type
, const char *option
, bool def
)
5544 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5546 if (data
&& data
->value
&& *data
->value
)
5547 return lp_bool(data
->value
);
5552 /* Return parametric option from a given service. Type is a part of option before ':' */
5553 /* Parametric option has following syntax: 'Type: option = value' */
5555 int lp_parm_enum(int snum
, const char *type
, const char *option
,
5556 const struct enum_list
*_enum
, int def
)
5558 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
5560 if (data
&& data
->value
&& *data
->value
&& _enum
)
5561 return lp_enum(data
->value
, _enum
);
5567 /***************************************************************************
5568 Initialise a service to the defaults.
5569 ***************************************************************************/
5571 static void init_service(struct service
*pservice
)
5573 memset((char *)pservice
, '\0', sizeof(struct service
));
5574 copy_service(pservice
, &sDefault
, NULL
);
5577 /***************************************************************************
5578 Free the dynamically allocated parts of a service struct.
5579 ***************************************************************************/
5581 static void free_service(struct service
*pservice
)
5584 param_opt_struct
*data
, *pdata
;
5588 if (pservice
->szService
)
5589 DEBUG(5, ("free_service: Freeing service %s\n",
5590 pservice
->szService
));
5592 string_free(&pservice
->szService
);
5593 bitmap_free(pservice
->copymap
);
5595 for (i
= 0; parm_table
[i
].label
; i
++) {
5596 if ((parm_table
[i
].type
== P_STRING
||
5597 parm_table
[i
].type
== P_USTRING
) &&
5598 parm_table
[i
].p_class
== P_LOCAL
)
5599 string_free((char **)
5600 (((char *)pservice
) +
5601 PTR_DIFF(parm_table
[i
].ptr
, &sDefault
)));
5602 else if (parm_table
[i
].type
== P_LIST
&&
5603 parm_table
[i
].p_class
== P_LOCAL
)
5604 TALLOC_FREE(*((char ***)
5605 (((char *)pservice
) +
5606 PTR_DIFF(parm_table
[i
].ptr
,
5610 data
= pservice
->param_opt
;
5612 DEBUG(5,("Freeing parametrics:\n"));
5614 DEBUG(5,("[%s = %s]\n", data
->key
, data
->value
));
5615 string_free(&data
->key
);
5616 string_free(&data
->value
);
5617 TALLOC_FREE(data
->list
);
5623 ZERO_STRUCTP(pservice
);
5627 /***************************************************************************
5628 remove a service indexed in the ServicePtrs array from the ServiceHash
5629 and free the dynamically allocated parts
5630 ***************************************************************************/
5632 static void free_service_byindex(int idx
)
5634 if ( !LP_SNUM_OK(idx
) )
5637 ServicePtrs
[idx
]->valid
= False
;
5638 invalid_services
[num_invalid_services
++] = idx
;
5640 /* we have to cleanup the hash record */
5642 if (ServicePtrs
[idx
]->szService
) {
5643 char *canon_name
= canonicalize_servicename(
5644 ServicePtrs
[idx
]->szService
);
5646 dbwrap_delete_bystring(ServiceHash
, canon_name
);
5647 TALLOC_FREE(canon_name
);
5650 free_service(ServicePtrs
[idx
]);
5653 /***************************************************************************
5654 Add a new service to the services array initialising it with the given
5656 ***************************************************************************/
5658 static int add_a_service(const struct service
*pservice
, const char *name
)
5661 struct service tservice
;
5662 int num_to_alloc
= iNumServices
+ 1;
5663 param_opt_struct
*data
, *pdata
;
5665 tservice
= *pservice
;
5667 /* it might already exist */
5669 i
= getservicebyname(name
, NULL
);
5671 /* Clean all parametric options for service */
5672 /* They will be added during parsing again */
5673 data
= ServicePtrs
[i
]->param_opt
;
5675 string_free(&data
->key
);
5676 string_free(&data
->value
);
5677 TALLOC_FREE(data
->list
);
5682 ServicePtrs
[i
]->param_opt
= NULL
;
5687 /* find an invalid one */
5689 if (num_invalid_services
> 0) {
5690 i
= invalid_services
[--num_invalid_services
];
5693 /* if not, then create one */
5694 if (i
== iNumServices
) {
5695 struct service
**tsp
;
5698 tsp
= SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs
, struct service
*, num_to_alloc
);
5700 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
5704 ServicePtrs
[iNumServices
] = SMB_MALLOC_P(struct service
);
5705 if (!ServicePtrs
[iNumServices
]) {
5706 DEBUG(0,("add_a_service: out of memory!\n"));
5711 /* enlarge invalid_services here for now... */
5712 tinvalid
= SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services
, int,
5714 if (tinvalid
== NULL
) {
5715 DEBUG(0,("add_a_service: failed to enlarge "
5716 "invalid_services!\n"));
5719 invalid_services
= tinvalid
;
5721 free_service_byindex(i
);
5724 ServicePtrs
[i
]->valid
= True
;
5726 init_service(ServicePtrs
[i
]);
5727 copy_service(ServicePtrs
[i
], &tservice
, NULL
);
5729 string_set(&ServicePtrs
[i
]->szService
, name
);
5731 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
5732 i
, ServicePtrs
[i
]->szService
));
5734 if (!hash_a_service(ServicePtrs
[i
]->szService
, i
)) {
5741 /***************************************************************************
5742 Convert a string to uppercase and remove whitespaces.
5743 ***************************************************************************/
5745 static char *canonicalize_servicename(const char *src
)
5750 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
5754 result
= talloc_strdup(talloc_tos(), src
);
5755 SMB_ASSERT(result
!= NULL
);
5761 /***************************************************************************
5762 Add a name/index pair for the services array to the hash table.
5763 ***************************************************************************/
5765 static bool hash_a_service(const char *name
, int idx
)
5769 if ( !ServiceHash
) {
5770 DEBUG(10,("hash_a_service: creating servicehash\n"));
5771 ServiceHash
= db_open_rbt(NULL
);
5772 if ( !ServiceHash
) {
5773 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
5778 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
5781 canon_name
= canonicalize_servicename( name
);
5783 dbwrap_store_bystring(ServiceHash
, canon_name
,
5784 make_tdb_data((uint8
*)&idx
, sizeof(idx
)),
5787 TALLOC_FREE(canon_name
);
5792 /***************************************************************************
5793 Add a new home service, with the specified home directory, defaults coming
5795 ***************************************************************************/
5797 bool lp_add_home(const char *pszHomename
, int iDefaultService
,
5798 const char *user
, const char *pszHomedir
)
5802 i
= add_a_service(ServicePtrs
[iDefaultService
], pszHomename
);
5807 if (!(*(ServicePtrs
[iDefaultService
]->szPath
))
5808 || strequal(ServicePtrs
[iDefaultService
]->szPath
, lp_pathname(GLOBAL_SECTION_SNUM
))) {
5809 string_set(&ServicePtrs
[i
]->szPath
, pszHomedir
);
5812 if (!(*(ServicePtrs
[i
]->comment
))) {
5813 char *comment
= NULL
;
5814 if (asprintf(&comment
, "Home directory of %s", user
) < 0) {
5817 string_set(&ServicePtrs
[i
]->comment
, comment
);
5821 /* set the browseable flag from the global default */
5823 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
5825 ServicePtrs
[i
]->autoloaded
= True
;
5827 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename
,
5828 user
, ServicePtrs
[i
]->szPath
));
5833 /***************************************************************************
5834 Add a new service, based on an old one.
5835 ***************************************************************************/
5837 int lp_add_service(const char *pszService
, int iDefaultService
)
5839 if (iDefaultService
< 0) {
5840 return add_a_service(&sDefault
, pszService
);
5843 return (add_a_service(ServicePtrs
[iDefaultService
], pszService
));
5846 /***************************************************************************
5847 Add the IPC service.
5848 ***************************************************************************/
5850 static bool lp_add_ipc(const char *ipc_name
, bool guest_ok
)
5852 char *comment
= NULL
;
5853 int i
= add_a_service(&sDefault
, ipc_name
);
5858 if (asprintf(&comment
, "IPC Service (%s)",
5859 Globals
.szServerString
) < 0) {
5863 string_set(&ServicePtrs
[i
]->szPath
, tmpdir());
5864 string_set(&ServicePtrs
[i
]->szUsername
, "");
5865 string_set(&ServicePtrs
[i
]->comment
, comment
);
5866 string_set(&ServicePtrs
[i
]->fstype
, "IPC");
5867 ServicePtrs
[i
]->iMaxConnections
= 0;
5868 ServicePtrs
[i
]->bAvailable
= True
;
5869 ServicePtrs
[i
]->bRead_only
= True
;
5870 ServicePtrs
[i
]->bGuest_only
= False
;
5871 ServicePtrs
[i
]->bAdministrative_share
= True
;
5872 ServicePtrs
[i
]->bGuest_ok
= guest_ok
;
5873 ServicePtrs
[i
]->bPrint_ok
= False
;
5874 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
5876 DEBUG(3, ("adding IPC service\n"));
5882 /***************************************************************************
5883 Add a new printer service, with defaults coming from service iFrom.
5884 ***************************************************************************/
5886 bool lp_add_printer(const char *pszPrintername
, int iDefaultService
)
5888 const char *comment
= "From Printcap";
5889 int i
= add_a_service(ServicePtrs
[iDefaultService
], pszPrintername
);
5894 /* note that we do NOT default the availability flag to True - */
5895 /* we take it from the default service passed. This allows all */
5896 /* dynamic printers to be disabled by disabling the [printers] */
5897 /* entry (if/when the 'available' keyword is implemented!). */
5899 /* the printer name is set to the service name. */
5900 string_set(&ServicePtrs
[i
]->szPrintername
, pszPrintername
);
5901 string_set(&ServicePtrs
[i
]->comment
, comment
);
5903 /* set the browseable flag from the gloabl default */
5904 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
5906 /* Printers cannot be read_only. */
5907 ServicePtrs
[i
]->bRead_only
= False
;
5908 /* No share modes on printer services. */
5909 ServicePtrs
[i
]->bShareModes
= False
;
5910 /* No oplocks on printer services. */
5911 ServicePtrs
[i
]->bOpLocks
= False
;
5912 /* Printer services must be printable. */
5913 ServicePtrs
[i
]->bPrint_ok
= True
;
5915 DEBUG(3, ("adding printer service %s\n", pszPrintername
));
5921 /***************************************************************************
5922 Check whether the given parameter name is valid.
5923 Parametric options (names containing a colon) are considered valid.
5924 ***************************************************************************/
5926 bool lp_parameter_is_valid(const char *pszParmName
)
5928 return ((map_parameter(pszParmName
) != -1) ||
5929 (strchr(pszParmName
, ':') != NULL
));
5932 /***************************************************************************
5933 Check whether the given name is the name of a global parameter.
5934 Returns True for strings belonging to parameters of class
5935 P_GLOBAL, False for all other strings, also for parametric options
5936 and strings not belonging to any option.
5937 ***************************************************************************/
5939 bool lp_parameter_is_global(const char *pszParmName
)
5941 int num
= map_parameter(pszParmName
);
5944 return (parm_table
[num
].p_class
== P_GLOBAL
);
5950 /**************************************************************************
5951 Check whether the given name is the canonical name of a parameter.
5952 Returns False if it is not a valid parameter Name.
5953 For parametric options, True is returned.
5954 **************************************************************************/
5956 bool lp_parameter_is_canonical(const char *parm_name
)
5958 if (!lp_parameter_is_valid(parm_name
)) {
5962 return (map_parameter(parm_name
) ==
5963 map_parameter_canonical(parm_name
, NULL
));
5966 /**************************************************************************
5967 Determine the canonical name for a parameter.
5968 Indicate when it is an inverse (boolean) synonym instead of a
5970 **************************************************************************/
5972 bool lp_canonicalize_parameter(const char *parm_name
, const char **canon_parm
,
5977 if (!lp_parameter_is_valid(parm_name
)) {
5982 num
= map_parameter_canonical(parm_name
, inverse
);
5984 /* parametric option */
5985 *canon_parm
= parm_name
;
5987 *canon_parm
= parm_table
[num
].label
;
5994 /**************************************************************************
5995 Determine the canonical name for a parameter.
5996 Turn the value given into the inverse boolean expression when
5997 the synonym is an invers boolean synonym.
5999 Return True if parm_name is a valid parameter name and
6000 in case it is an invers boolean synonym, if the val string could
6001 successfully be converted to the reverse bool.
6002 Return false in all other cases.
6003 **************************************************************************/
6005 bool lp_canonicalize_parameter_with_value(const char *parm_name
,
6007 const char **canon_parm
,
6008 const char **canon_val
)
6013 if (!lp_parameter_is_valid(parm_name
)) {
6019 num
= map_parameter_canonical(parm_name
, &inverse
);
6021 /* parametric option */
6022 *canon_parm
= parm_name
;
6025 *canon_parm
= parm_table
[num
].label
;
6027 if (!lp_invert_boolean(val
, canon_val
)) {
6039 /***************************************************************************
6040 Map a parameter's string representation to something we can use.
6041 Returns False if the parameter string is not recognised, else TRUE.
6042 ***************************************************************************/
6044 static int map_parameter(const char *pszParmName
)
6048 if (*pszParmName
== '-')
6051 for (iIndex
= 0; parm_table
[iIndex
].label
; iIndex
++)
6052 if (strwicmp(parm_table
[iIndex
].label
, pszParmName
) == 0)
6055 /* Warn only if it isn't parametric option */
6056 if (strchr(pszParmName
, ':') == NULL
)
6057 DEBUG(0, ("Unknown parameter encountered: \"%s\"\n", pszParmName
));
6058 /* We do return 'fail' for parametric options as well because they are
6059 stored in different storage
6064 /***************************************************************************
6065 Map a parameter's string representation to the index of the canonical
6066 form of the parameter (it might be a synonym).
6067 Returns -1 if the parameter string is not recognised.
6068 ***************************************************************************/
6070 static int map_parameter_canonical(const char *pszParmName
, bool *inverse
)
6072 int parm_num
, canon_num
;
6073 bool loc_inverse
= False
;
6075 parm_num
= map_parameter(pszParmName
);
6076 if ((parm_num
< 0) || !(parm_table
[parm_num
].flags
& FLAG_HIDE
)) {
6077 /* invalid, parametric or no canidate for synonyms ... */
6081 for (canon_num
= 0; parm_table
[canon_num
].label
; canon_num
++) {
6082 if (is_synonym_of(parm_num
, canon_num
, &loc_inverse
)) {
6083 parm_num
= canon_num
;
6089 if (inverse
!= NULL
) {
6090 *inverse
= loc_inverse
;
6095 /***************************************************************************
6096 return true if parameter number parm1 is a synonym of parameter
6097 number parm2 (parm2 being the principal name).
6098 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6100 ***************************************************************************/
6102 static bool is_synonym_of(int parm1
, int parm2
, bool *inverse
)
6104 if ((parm_table
[parm1
].ptr
== parm_table
[parm2
].ptr
) &&
6105 (parm_table
[parm1
].flags
& FLAG_HIDE
) &&
6106 !(parm_table
[parm2
].flags
& FLAG_HIDE
))
6108 if (inverse
!= NULL
) {
6109 if ((parm_table
[parm1
].type
== P_BOOLREV
) &&
6110 (parm_table
[parm2
].type
== P_BOOL
))
6122 /***************************************************************************
6123 Show one parameter's name, type, [values,] and flags.
6124 (helper functions for show_parameter_list)
6125 ***************************************************************************/
6127 static void show_parameter(int parmIndex
)
6129 int enumIndex
, flagIndex
;
6134 const char *type
[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6135 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6137 unsigned flags
[] = { FLAG_BASIC
, FLAG_SHARE
, FLAG_PRINT
, FLAG_GLOBAL
,
6138 FLAG_WIZARD
, FLAG_ADVANCED
, FLAG_DEVELOPER
, FLAG_DEPRECATED
,
6139 FLAG_HIDE
, FLAG_DOS_STRING
};
6140 const char *flag_names
[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6141 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6142 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL
};
6144 printf("%s=%s", parm_table
[parmIndex
].label
,
6145 type
[parm_table
[parmIndex
].type
]);
6146 if (parm_table
[parmIndex
].type
== P_ENUM
) {
6149 parm_table
[parmIndex
].enum_list
[enumIndex
].name
;
6153 enumIndex
? "|" : "",
6154 parm_table
[parmIndex
].enum_list
[enumIndex
].name
);
6159 for (flagIndex
=0; flag_names
[flagIndex
]; flagIndex
++) {
6160 if (parm_table
[parmIndex
].flags
& flags
[flagIndex
]) {
6163 flag_names
[flagIndex
]);
6168 /* output synonyms */
6170 for (parmIndex2
=0; parm_table
[parmIndex2
].label
; parmIndex2
++) {
6171 if (is_synonym_of(parmIndex
, parmIndex2
, &inverse
)) {
6172 printf(" (%ssynonym of %s)", inverse
? "inverse " : "",
6173 parm_table
[parmIndex2
].label
);
6174 } else if (is_synonym_of(parmIndex2
, parmIndex
, &inverse
)) {
6176 printf(" (synonyms: ");
6181 printf("%s%s", parm_table
[parmIndex2
].label
,
6182 inverse
? "[i]" : "");
6192 /***************************************************************************
6193 Show all parameter's name, type, [values,] and flags.
6194 ***************************************************************************/
6196 void show_parameter_list(void)
6198 int classIndex
, parmIndex
;
6199 const char *section_names
[] = { "local", "global", NULL
};
6201 for (classIndex
=0; section_names
[classIndex
]; classIndex
++) {
6202 printf("[%s]\n", section_names
[classIndex
]);
6203 for (parmIndex
= 0; parm_table
[parmIndex
].label
; parmIndex
++) {
6204 if (parm_table
[parmIndex
].p_class
== classIndex
) {
6205 show_parameter(parmIndex
);
6211 /***************************************************************************
6212 Set a boolean variable from the text value stored in the passed string.
6213 Returns True in success, False if the passed string does not correctly
6214 represent a boolean.
6215 ***************************************************************************/
6217 static bool set_boolean(bool *pb
, const char *pszParmValue
)
6224 if (strwicmp(pszParmValue
, "yes") == 0 ||
6225 strwicmp(pszParmValue
, "true") == 0 ||
6226 strwicmp(pszParmValue
, "1") == 0)
6228 else if (strwicmp(pszParmValue
, "no") == 0 ||
6229 strwicmp(pszParmValue
, "False") == 0 ||
6230 strwicmp(pszParmValue
, "0") == 0)
6234 ("ERROR: Badly formed boolean in configuration file: \"%s\".\n",
6239 if ((pb
!= NULL
) && (bRetval
!= False
)) {
6247 /***************************************************************************
6248 Check if a given string correctly represents a boolean value.
6249 ***************************************************************************/
6251 bool lp_string_is_valid_boolean(const char *parm_value
)
6253 return set_boolean(NULL
, parm_value
);
6256 /***************************************************************************
6257 Get the standard string representation of a boolean value ("yes" or "no")
6258 ***************************************************************************/
6260 static const char *get_boolean(bool bool_value
)
6262 static const char *yes_str
= "yes";
6263 static const char *no_str
= "no";
6265 return (bool_value
? yes_str
: no_str
);
6268 /***************************************************************************
6269 Provide the string of the negated boolean value associated to the boolean
6270 given as a string. Returns False if the passed string does not correctly
6271 represent a boolean.
6272 ***************************************************************************/
6274 bool lp_invert_boolean(const char *str
, const char **inverse_str
)
6278 if (!set_boolean(&val
, str
)) {
6282 *inverse_str
= get_boolean(!val
);
6286 /***************************************************************************
6287 Provide the canonical string representation of a boolean value given
6288 as a string. Return True on success, False if the string given does
6289 not correctly represent a boolean.
6290 ***************************************************************************/
6292 bool lp_canonicalize_boolean(const char *str
, const char**canon_str
)
6296 if (!set_boolean(&val
, str
)) {
6300 *canon_str
= get_boolean(val
);
6304 /***************************************************************************
6305 Find a service by name. Otherwise works like get_service.
6306 ***************************************************************************/
6308 static int getservicebyname(const char *pszServiceName
, struct service
*pserviceDest
)
6314 if (ServiceHash
== NULL
) {
6318 canon_name
= canonicalize_servicename(pszServiceName
);
6320 data
= dbwrap_fetch_bystring(ServiceHash
, canon_name
, canon_name
);
6322 if ((data
.dptr
!= NULL
) && (data
.dsize
== sizeof(iService
))) {
6323 iService
= *(int *)data
.dptr
;
6326 TALLOC_FREE(canon_name
);
6328 if ((iService
!= -1) && (LP_SNUM_OK(iService
))
6329 && (pserviceDest
!= NULL
)) {
6330 copy_service(pserviceDest
, ServicePtrs
[iService
], NULL
);
6336 /***************************************************************************
6337 Copy a service structure to another.
6338 If pcopymapDest is NULL then copy all fields
6339 ***************************************************************************/
6341 static void copy_service(struct service
*pserviceDest
, struct service
*pserviceSource
,
6342 struct bitmap
*pcopymapDest
)
6345 bool bcopyall
= (pcopymapDest
== NULL
);
6346 param_opt_struct
*data
, *pdata
, *paramo
;
6349 for (i
= 0; parm_table
[i
].label
; i
++)
6350 if (parm_table
[i
].ptr
&& parm_table
[i
].p_class
== P_LOCAL
&&
6351 (bcopyall
|| bitmap_query(pcopymapDest
,i
))) {
6352 void *def_ptr
= parm_table
[i
].ptr
;
6354 ((char *)pserviceSource
) + PTR_DIFF(def_ptr
,
6357 ((char *)pserviceDest
) + PTR_DIFF(def_ptr
,
6360 switch (parm_table
[i
].type
) {
6363 *(bool *)dest_ptr
= *(bool *)src_ptr
;
6369 *(int *)dest_ptr
= *(int *)src_ptr
;
6373 *(char *)dest_ptr
= *(char *)src_ptr
;
6377 string_set((char **)dest_ptr
,
6382 string_set((char **)dest_ptr
,
6384 strupper_m(*(char **)dest_ptr
);
6387 TALLOC_FREE(*((char ***)dest_ptr
));
6388 str_list_copy(NULL
, (char ***)dest_ptr
,
6389 *(const char ***)src_ptr
);
6397 init_copymap(pserviceDest
);
6398 if (pserviceSource
->copymap
)
6399 bitmap_copy(pserviceDest
->copymap
,
6400 pserviceSource
->copymap
);
6403 data
= pserviceSource
->param_opt
;
6406 pdata
= pserviceDest
->param_opt
;
6407 /* Traverse destination */
6409 /* If we already have same option, override it */
6410 if (strcmp(pdata
->key
, data
->key
) == 0) {
6411 string_free(&pdata
->value
);
6412 TALLOC_FREE(data
->list
);
6413 pdata
->value
= SMB_STRDUP(data
->value
);
6417 pdata
= pdata
->next
;
6420 paramo
= SMB_XMALLOC_P(param_opt_struct
);
6421 paramo
->key
= SMB_STRDUP(data
->key
);
6422 paramo
->value
= SMB_STRDUP(data
->value
);
6423 paramo
->list
= NULL
;
6424 DLIST_ADD(pserviceDest
->param_opt
, paramo
);
6430 /***************************************************************************
6431 Check a service for consistency. Return False if the service is in any way
6432 incomplete or faulty, else True.
6433 ***************************************************************************/
6435 bool service_ok(int iService
)
6440 if (ServicePtrs
[iService
]->szService
[0] == '\0') {
6441 DEBUG(0, ("The following message indicates an internal error:\n"));
6442 DEBUG(0, ("No service name in service entry.\n"));
6446 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
6447 /* I can't see why you'd want a non-printable printer service... */
6448 if (strwicmp(ServicePtrs
[iService
]->szService
, PRINTERS_NAME
) == 0) {
6449 if (!ServicePtrs
[iService
]->bPrint_ok
) {
6450 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
6451 ServicePtrs
[iService
]->szService
));
6452 ServicePtrs
[iService
]->bPrint_ok
= True
;
6454 /* [printers] service must also be non-browsable. */
6455 if (ServicePtrs
[iService
]->bBrowseable
)
6456 ServicePtrs
[iService
]->bBrowseable
= False
;
6459 if (ServicePtrs
[iService
]->szPath
[0] == '\0' &&
6460 strwicmp(ServicePtrs
[iService
]->szService
, HOMES_NAME
) != 0 &&
6461 ServicePtrs
[iService
]->szMSDfsProxy
[0] == '\0'
6463 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
6464 ServicePtrs
[iService
]->szService
));
6465 ServicePtrs
[iService
]->bAvailable
= False
;
6468 /* If a service is flagged unavailable, log the fact at level 1. */
6469 if (!ServicePtrs
[iService
]->bAvailable
)
6470 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
6471 ServicePtrs
[iService
]->szService
));
6477 * process_registry_globals
6479 static bool process_registry_globals(bool (*pfunc
)(const char *, const char *))
6483 char **param_values
;
6484 uint32_t num_params
;
6486 TALLOC_CTX
*mem_ctx
= talloc_stackframe();
6489 if (conf_ctx
== NULL
) {
6491 werr
= libnet_conf_open(NULL
, &conf_ctx
);
6492 if (!W_ERROR_IS_OK(werr
)) {
6497 if (!libnet_conf_share_exists(conf_ctx
, GLOBAL_NAME
)) {
6498 /* nothing to read from the registry yet but make sure lp_load
6499 * doesn't return false */
6504 werr
= libnet_conf_get_share(mem_ctx
, conf_ctx
, GLOBAL_NAME
,
6505 &num_params
, ¶m_names
, ¶m_values
);
6506 if (!W_ERROR_IS_OK(werr
)) {
6510 for (count
= 0; count
< num_params
; count
++) {
6511 ret
= pfunc(param_names
[count
], param_values
[count
]);
6517 ret
= pfunc("registry shares", "yes");
6518 conf_last_seqnum
= libnet_conf_get_seqnum(conf_ctx
, NULL
, NULL
);
6521 TALLOC_FREE(mem_ctx
);
6525 static struct file_lists
{
6526 struct file_lists
*next
;
6530 } *file_lists
= NULL
;
6532 /*******************************************************************
6533 Keep a linked list of all config files so we know when one has changed
6534 it's date and needs to be reloaded.
6535 ********************************************************************/
6537 static void add_to_file_list(const char *fname
, const char *subfname
)
6539 struct file_lists
*f
= file_lists
;
6542 if (f
->name
&& !strcmp(f
->name
, fname
))
6548 f
= SMB_MALLOC_P(struct file_lists
);
6551 f
->next
= file_lists
;
6552 f
->name
= SMB_STRDUP(fname
);
6557 f
->subfname
= SMB_STRDUP(subfname
);
6563 f
->modtime
= file_modtime(subfname
);
6565 time_t t
= file_modtime(subfname
);
6572 * Utility function for outsiders to check if we're running on registry.
6574 bool lp_config_backend_is_registry(void)
6576 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY
);
6579 /*******************************************************************
6580 Check if a config file has changed date.
6581 ********************************************************************/
6583 bool lp_file_list_changed(void)
6585 struct file_lists
*f
= file_lists
;
6587 DEBUG(6, ("lp_file_list_changed()\n"));
6589 if (lp_config_backend() == CONFIG_BACKEND_REGISTRY
) {
6590 uint64_t conf_cur_seqnum
;
6591 if (conf_ctx
== NULL
) {
6593 werr
= libnet_conf_open(NULL
, &conf_ctx
);
6594 if (!W_ERROR_IS_OK(werr
)) {
6595 DEBUG(0, ("error opening configuration: %s\n",
6600 conf_cur_seqnum
= libnet_conf_get_seqnum(conf_ctx
, NULL
, NULL
);
6601 if (conf_last_seqnum
!= conf_cur_seqnum
) {
6602 DEBUGADD(6, ("regdb seqnum changed: old = %llu, "
6604 (unsigned long long)conf_last_seqnum
,
6605 (unsigned long long)conf_cur_seqnum
));
6609 * Don't check files when config_backend is registry.
6610 * Remove this to obtain checking of files even with
6611 * registry config backend. That would enable switching
6612 * off registry configuration by changing smb.conf even
6613 * without restarting smbd.
6623 n2
= alloc_sub_basic(get_current_username(),
6624 current_user_info
.domain
,
6629 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
6630 f
->name
, n2
, ctime(&f
->modtime
)));
6632 mod_time
= file_modtime(n2
);
6634 if (mod_time
&& ((f
->modtime
!= mod_time
) || (f
->subfname
== NULL
) || (strcmp(n2
, f
->subfname
) != 0))) {
6636 ("file %s modified: %s\n", n2
,
6638 f
->modtime
= mod_time
;
6639 SAFE_FREE(f
->subfname
);
6640 f
->subfname
= n2
; /* Passing ownership of
6641 return from alloc_sub_basic
6652 /***************************************************************************
6653 Run standard_sub_basic on netbios name... needed because global_myname
6654 is not accessed through any lp_ macro.
6655 Note: We must *NOT* use string_set() here as ptr points to global_myname.
6656 ***************************************************************************/
6658 static bool handle_netbios_name(int snum
, const char *pszParmValue
, char **ptr
)
6661 char *netbios_name
= alloc_sub_basic(get_current_username(),
6662 current_user_info
.domain
,
6665 ret
= set_global_myname(netbios_name
);
6666 SAFE_FREE(netbios_name
);
6667 string_set(&Globals
.szNetbiosName
,global_myname());
6669 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
6675 static bool handle_charset(int snum
, const char *pszParmValue
, char **ptr
)
6677 if (strcmp(*ptr
, pszParmValue
) != 0) {
6678 string_set(ptr
, pszParmValue
);
6686 static bool handle_workgroup(int snum
, const char *pszParmValue
, char **ptr
)
6690 ret
= set_global_myworkgroup(pszParmValue
);
6691 string_set(&Globals
.szWorkgroup
,lp_workgroup());
6696 static bool handle_netbios_scope(int snum
, const char *pszParmValue
, char **ptr
)
6700 ret
= set_global_scope(pszParmValue
);
6701 string_set(&Globals
.szNetbiosScope
,global_scope());
6706 static bool handle_netbios_aliases(int snum
, const char *pszParmValue
, char **ptr
)
6708 TALLOC_FREE(Globals
.szNetbiosAliases
);
6709 Globals
.szNetbiosAliases
= str_list_make(NULL
, pszParmValue
, NULL
);
6710 return set_netbios_aliases((const char **)Globals
.szNetbiosAliases
);
6713 /***************************************************************************
6714 Handle the include operation.
6715 ***************************************************************************/
6717 static bool handle_include(int snum
, const char *pszParmValue
, char **ptr
)
6721 fname
= alloc_sub_basic(get_current_username(),
6722 current_user_info
.domain
,
6725 add_to_file_list(pszParmValue
, fname
);
6727 string_set(ptr
, fname
);
6729 if (file_exist(fname
, NULL
)) {
6730 bool ret
= pm_process(fname
, do_section
, do_parameter
);
6735 DEBUG(2, ("Can't find include file %s\n", fname
));
6740 /***************************************************************************
6741 Handle the interpretation of the copy parameter.
6742 ***************************************************************************/
6744 static bool handle_copy(int snum
, const char *pszParmValue
, char **ptr
)
6748 struct service serviceTemp
;
6750 string_set(ptr
, pszParmValue
);
6752 init_service(&serviceTemp
);
6756 DEBUG(3, ("Copying service from service %s\n", pszParmValue
));
6758 if ((iTemp
= getservicebyname(pszParmValue
, &serviceTemp
)) >= 0) {
6759 if (iTemp
== iServiceIndex
) {
6760 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue
));
6762 copy_service(ServicePtrs
[iServiceIndex
],
6764 ServicePtrs
[iServiceIndex
]->copymap
);
6768 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue
));
6772 free_service(&serviceTemp
);
6776 static bool handle_ldap_debug_level(int snum
, const char *pszParmValue
, char **ptr
)
6778 Globals
.ldap_debug_level
= lp_int(pszParmValue
);
6779 init_ldap_debugging();
6783 /***************************************************************************
6784 Handle idmap/non unix account uid and gid allocation parameters. The format of these
6789 idmap uid = 1000-1999
6792 We only do simple parsing checks here. The strings are parsed into useful
6793 structures in the idmap daemon code.
6795 ***************************************************************************/
6797 /* Some lp_ routines to return idmap [ug]id information */
6799 static uid_t idmap_uid_low
, idmap_uid_high
;
6800 static gid_t idmap_gid_low
, idmap_gid_high
;
6802 bool lp_idmap_uid(uid_t
*low
, uid_t
*high
)
6804 if (idmap_uid_low
== 0 || idmap_uid_high
== 0)
6808 *low
= idmap_uid_low
;
6811 *high
= idmap_uid_high
;
6816 bool lp_idmap_gid(gid_t
*low
, gid_t
*high
)
6818 if (idmap_gid_low
== 0 || idmap_gid_high
== 0)
6822 *low
= idmap_gid_low
;
6825 *high
= idmap_gid_high
;
6830 /* Do some simple checks on "idmap [ug]id" parameter values */
6832 static bool handle_idmap_uid(int snum
, const char *pszParmValue
, char **ptr
)
6836 if (sscanf(pszParmValue
, "%u - %u", &low
, &high
) != 2 || high
< low
)
6841 string_set(ptr
, pszParmValue
);
6843 idmap_uid_low
= low
;
6844 idmap_uid_high
= high
;
6849 static bool handle_idmap_gid(int snum
, const char *pszParmValue
, char **ptr
)
6853 if (sscanf(pszParmValue
, "%u - %u", &low
, &high
) != 2 || high
< low
)
6858 string_set(ptr
, pszParmValue
);
6860 idmap_gid_low
= low
;
6861 idmap_gid_high
= high
;
6866 /***************************************************************************
6867 Handle the DEBUG level list.
6868 ***************************************************************************/
6870 static bool handle_debug_list( int snum
, const char *pszParmValueIn
, char **ptr
)
6872 string_set(ptr
, pszParmValueIn
);
6873 return debug_parse_levels(pszParmValueIn
);
6876 /***************************************************************************
6877 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
6878 ***************************************************************************/
6880 static const char *append_ldap_suffix( const char *str
)
6882 const char *suffix_string
;
6885 suffix_string
= talloc_asprintf(talloc_tos(), "%s,%s", str
,
6886 Globals
.szLdapSuffix
);
6887 if ( !suffix_string
) {
6888 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
6892 return suffix_string
;
6895 const char *lp_ldap_machine_suffix(void)
6897 if (Globals
.szLdapMachineSuffix
[0])
6898 return append_ldap_suffix(Globals
.szLdapMachineSuffix
);
6900 return lp_string(Globals
.szLdapSuffix
);
6903 const char *lp_ldap_user_suffix(void)
6905 if (Globals
.szLdapUserSuffix
[0])
6906 return append_ldap_suffix(Globals
.szLdapUserSuffix
);
6908 return lp_string(Globals
.szLdapSuffix
);
6911 const char *lp_ldap_group_suffix(void)
6913 if (Globals
.szLdapGroupSuffix
[0])
6914 return append_ldap_suffix(Globals
.szLdapGroupSuffix
);
6916 return lp_string(Globals
.szLdapSuffix
);
6919 const char *lp_ldap_idmap_suffix(void)
6921 if (Globals
.szLdapIdmapSuffix
[0])
6922 return append_ldap_suffix(Globals
.szLdapIdmapSuffix
);
6924 return lp_string(Globals
.szLdapSuffix
);
6927 /****************************************************************************
6928 set the value for a P_ENUM
6929 ***************************************************************************/
6931 static void lp_set_enum_parm( struct parm_struct
*parm
, const char *pszParmValue
,
6936 for (i
= 0; parm
->enum_list
[i
].name
; i
++) {
6937 if ( strequal(pszParmValue
, parm
->enum_list
[i
].name
)) {
6938 *ptr
= parm
->enum_list
[i
].value
;
6944 /***************************************************************************
6945 ***************************************************************************/
6947 static bool handle_printing(int snum
, const char *pszParmValue
, char **ptr
)
6949 static int parm_num
= -1;
6952 if ( parm_num
== -1 )
6953 parm_num
= map_parameter( "printing" );
6955 lp_set_enum_parm( &parm_table
[parm_num
], pszParmValue
, (int*)ptr
);
6960 s
= ServicePtrs
[snum
];
6962 init_printer_values( s
);
6968 /***************************************************************************
6969 Initialise a copymap.
6970 ***************************************************************************/
6972 static void init_copymap(struct service
*pservice
)
6975 if (pservice
->copymap
) {
6976 bitmap_free(pservice
->copymap
);
6978 pservice
->copymap
= bitmap_allocate(NUMPARAMETERS
);
6979 if (!pservice
->copymap
)
6981 ("Couldn't allocate copymap!! (size %d)\n",
6982 (int)NUMPARAMETERS
));
6984 for (i
= 0; i
< NUMPARAMETERS
; i
++)
6985 bitmap_set(pservice
->copymap
, i
);
6988 /***************************************************************************
6989 Return the local pointer to a parameter given the service number and the
6990 pointer into the default structure.
6991 ***************************************************************************/
6993 void *lp_local_ptr(int snum
, void *ptr
)
6995 return (void *)(((char *)ServicePtrs
[snum
]) + PTR_DIFF(ptr
, &sDefault
));
6998 /***************************************************************************
6999 Process a parameter for a particular service number. If snum < 0
7000 then assume we are in the globals.
7001 ***************************************************************************/
7003 bool lp_do_parameter(int snum
, const char *pszParmName
, const char *pszParmValue
)
7005 int parmnum
, i
, slen
;
7006 void *parm_ptr
= NULL
; /* where we are going to store the result */
7007 void *def_ptr
= NULL
;
7008 char *param_key
= NULL
;
7010 param_opt_struct
*paramo
, *data
;
7013 parmnum
= map_parameter(pszParmName
);
7016 if ((sep
=strchr(pszParmName
, ':')) != NULL
) {
7017 TALLOC_CTX
*frame
= talloc_stackframe();
7020 param_key
= talloc_asprintf(frame
, "%s:", pszParmName
);
7025 slen
= strlen(param_key
);
7026 param_key
= talloc_asprintf_append(param_key
, sep
+1);
7031 trim_char(param_key
+slen
, ' ', ' ');
7033 data
= (snum
< 0) ? Globals
.param_opt
:
7034 ServicePtrs
[snum
]->param_opt
;
7035 /* Traverse destination */
7037 /* If we already have same option, override it */
7038 if (strcmp(data
->key
, param_key
) == 0) {
7039 string_free(&data
->value
);
7040 TALLOC_FREE(data
->list
);
7041 data
->value
= SMB_STRDUP(pszParmValue
);
7048 paramo
= SMB_XMALLOC_P(param_opt_struct
);
7049 paramo
->key
= SMB_STRDUP(param_key
);
7050 paramo
->value
= SMB_STRDUP(pszParmValue
);
7051 paramo
->list
= NULL
;
7053 DLIST_ADD(Globals
.param_opt
, paramo
);
7055 DLIST_ADD(ServicePtrs
[snum
]->param_opt
, paramo
);
7063 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName
));
7067 if (parm_table
[parmnum
].flags
& FLAG_DEPRECATED
) {
7068 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7072 def_ptr
= parm_table
[parmnum
].ptr
;
7074 /* we might point at a service, the default service or a global */
7078 if (parm_table
[parmnum
].p_class
== P_GLOBAL
) {
7080 ("Global parameter %s found in service section!\n",
7085 ((char *)ServicePtrs
[snum
]) + PTR_DIFF(def_ptr
,
7090 if (!ServicePtrs
[snum
]->copymap
)
7091 init_copymap(ServicePtrs
[snum
]);
7093 /* this handles the aliases - set the copymap for other entries with
7094 the same data pointer */
7095 for (i
= 0; parm_table
[i
].label
; i
++)
7096 if (parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
)
7097 bitmap_clear(ServicePtrs
[snum
]->copymap
, i
);
7100 /* if it is a special case then go ahead */
7101 if (parm_table
[parmnum
].special
) {
7102 parm_table
[parmnum
].special(snum
, pszParmValue
, (char **)parm_ptr
);
7106 /* now switch on the type of variable it is */
7107 switch (parm_table
[parmnum
].type
)
7110 *(bool *)parm_ptr
= lp_bool(pszParmValue
);
7114 *(bool *)parm_ptr
= !lp_bool(pszParmValue
);
7118 *(int *)parm_ptr
= lp_int(pszParmValue
);
7122 *(char *)parm_ptr
= *pszParmValue
;
7126 i
= sscanf(pszParmValue
, "%o", (int *)parm_ptr
);
7128 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName
));
7133 TALLOC_FREE(*((char ***)parm_ptr
));
7134 *(char ***)parm_ptr
= str_list_make(
7135 NULL
, pszParmValue
, NULL
);
7139 string_set((char **)parm_ptr
, pszParmValue
);
7143 string_set((char **)parm_ptr
, pszParmValue
);
7144 strupper_m(*(char **)parm_ptr
);
7148 lp_set_enum_parm( &parm_table
[parmnum
], pszParmValue
, (int*)parm_ptr
);
7157 /***************************************************************************
7158 Process a parameter.
7159 ***************************************************************************/
7161 static bool do_parameter(const char *pszParmName
, const char *pszParmValue
)
7163 if (!bInGlobalSection
&& bGlobalOnly
)
7166 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName
, pszParmValue
));
7168 return (lp_do_parameter(bInGlobalSection
? -2 : iServiceIndex
,
7169 pszParmName
, pszParmValue
));
7172 /***************************************************************************
7173 Print a parameter of the specified type.
7174 ***************************************************************************/
7176 static void print_parameter(struct parm_struct
*p
, void *ptr
, FILE * f
)
7182 for (i
= 0; p
->enum_list
[i
].name
; i
++) {
7183 if (*(int *)ptr
== p
->enum_list
[i
].value
) {
7185 p
->enum_list
[i
].name
);
7192 fprintf(f
, "%s", BOOLSTR(*(bool *)ptr
));
7196 fprintf(f
, "%s", BOOLSTR(!*(bool *)ptr
));
7200 fprintf(f
, "%d", *(int *)ptr
);
7204 fprintf(f
, "%c", *(char *)ptr
);
7208 char *o
= octal_string(*(int *)ptr
);
7209 fprintf(f
, "%s", o
);
7215 if ((char ***)ptr
&& *(char ***)ptr
) {
7216 char **list
= *(char ***)ptr
;
7217 for (; *list
; list
++) {
7218 /* surround strings with whitespace in double quotes */
7219 if ( strchr_m( *list
, ' ' ) )
7220 fprintf(f
, "\"%s\"%s", *list
, ((*(list
+1))?", ":""));
7222 fprintf(f
, "%s%s", *list
, ((*(list
+1))?", ":""));
7229 if (*(char **)ptr
) {
7230 fprintf(f
, "%s", *(char **)ptr
);
7238 /***************************************************************************
7239 Check if two parameters are equal.
7240 ***************************************************************************/
7242 static bool equal_parameter(parm_type type
, void *ptr1
, void *ptr2
)
7247 return (*((bool *)ptr1
) == *((bool *)ptr2
));
7252 return (*((int *)ptr1
) == *((int *)ptr2
));
7255 return (*((char *)ptr1
) == *((char *)ptr2
));
7258 return str_list_compare(*(char ***)ptr1
, *(char ***)ptr2
);
7263 char *p1
= *(char **)ptr1
, *p2
= *(char **)ptr2
;
7268 return (p1
== p2
|| strequal(p1
, p2
));
7276 /***************************************************************************
7277 Initialize any local varients in the sDefault table.
7278 ***************************************************************************/
7280 void init_locals(void)
7285 /***************************************************************************
7286 Process a new section (service). At this stage all sections are services.
7287 Later we'll have special sections that permit server parameters to be set.
7288 Returns True on success, False on failure.
7289 ***************************************************************************/
7291 static bool do_section(const char *pszSectionName
)
7294 bool isglobal
= ((strwicmp(pszSectionName
, GLOBAL_NAME
) == 0) ||
7295 (strwicmp(pszSectionName
, GLOBAL_NAME2
) == 0));
7298 /* if we were in a global section then do the local inits */
7299 if (bInGlobalSection
&& !isglobal
)
7302 /* if we've just struck a global section, note the fact. */
7303 bInGlobalSection
= isglobal
;
7305 /* check for multiple global sections */
7306 if (bInGlobalSection
) {
7307 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName
));
7311 if (!bInGlobalSection
&& bGlobalOnly
)
7314 /* if we have a current service, tidy it up before moving on */
7317 if (iServiceIndex
>= 0)
7318 bRetval
= service_ok(iServiceIndex
);
7320 /* if all is still well, move to the next record in the services array */
7322 /* We put this here to avoid an odd message order if messages are */
7323 /* issued by the post-processing of a previous section. */
7324 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName
));
7326 if ((iServiceIndex
= add_a_service(&sDefault
, pszSectionName
))
7328 DEBUG(0, ("Failed to add a new service\n"));
7337 /***************************************************************************
7338 Determine if a partcular base parameter is currentl set to the default value.
7339 ***************************************************************************/
7341 static bool is_default(int i
)
7343 if (!defaults_saved
)
7345 switch (parm_table
[i
].type
) {
7347 return str_list_compare (parm_table
[i
].def
.lvalue
,
7348 *(char ***)parm_table
[i
].ptr
);
7351 return strequal(parm_table
[i
].def
.svalue
,
7352 *(char **)parm_table
[i
].ptr
);
7355 return parm_table
[i
].def
.bvalue
==
7356 *(bool *)parm_table
[i
].ptr
;
7358 return parm_table
[i
].def
.cvalue
==
7359 *(char *)parm_table
[i
].ptr
;
7363 return parm_table
[i
].def
.ivalue
==
7364 *(int *)parm_table
[i
].ptr
;
7371 /***************************************************************************
7372 Display the contents of the global structure.
7373 ***************************************************************************/
7375 static void dump_globals(FILE *f
)
7378 param_opt_struct
*data
;
7380 fprintf(f
, "[global]\n");
7382 for (i
= 0; parm_table
[i
].label
; i
++)
7383 if (parm_table
[i
].p_class
== P_GLOBAL
&&
7384 parm_table
[i
].ptr
&&
7385 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
))) {
7386 if (defaults_saved
&& is_default(i
))
7388 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
7389 print_parameter(&parm_table
[i
], parm_table
[i
].ptr
, f
);
7392 if (Globals
.param_opt
!= NULL
) {
7393 data
= Globals
.param_opt
;
7395 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
7402 /***************************************************************************
7403 Return True if a local parameter is currently set to the global default.
7404 ***************************************************************************/
7406 bool lp_is_default(int snum
, struct parm_struct
*parm
)
7408 int pdiff
= PTR_DIFF(parm
->ptr
, &sDefault
);
7410 return equal_parameter(parm
->type
,
7411 ((char *)ServicePtrs
[snum
]) + pdiff
,
7412 ((char *)&sDefault
) + pdiff
);
7415 /***************************************************************************
7416 Display the contents of a single services record.
7417 ***************************************************************************/
7419 static void dump_a_service(struct service
*pService
, FILE * f
)
7422 param_opt_struct
*data
;
7424 if (pService
!= &sDefault
)
7425 fprintf(f
, "[%s]\n", pService
->szService
);
7427 for (i
= 0; parm_table
[i
].label
; i
++) {
7429 if (parm_table
[i
].p_class
== P_LOCAL
&&
7430 parm_table
[i
].ptr
&&
7431 (*parm_table
[i
].label
!= '-') &&
7432 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
7435 int pdiff
= PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
7437 if (pService
== &sDefault
) {
7438 if (defaults_saved
&& is_default(i
))
7441 if (equal_parameter(parm_table
[i
].type
,
7442 ((char *)pService
) +
7444 ((char *)&sDefault
) +
7449 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
7450 print_parameter(&parm_table
[i
],
7451 ((char *)pService
) + pdiff
, f
);
7456 if (pService
->param_opt
!= NULL
) {
7457 data
= pService
->param_opt
;
7459 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
7465 /***************************************************************************
7466 Display the contents of a parameter of a single services record.
7467 ***************************************************************************/
7469 bool dump_a_parameter(int snum
, char *parm_name
, FILE * f
, bool isGlobal
)
7472 bool result
= False
;
7475 fstring local_parm_name
;
7477 const char *parm_opt_value
;
7479 /* check for parametrical option */
7480 fstrcpy( local_parm_name
, parm_name
);
7481 parm_opt
= strchr( local_parm_name
, ':');
7486 if (strlen(parm_opt
)) {
7487 parm_opt_value
= lp_parm_const_string( snum
,
7488 local_parm_name
, parm_opt
, NULL
);
7489 if (parm_opt_value
) {
7490 printf( "%s\n", parm_opt_value
);
7497 /* check for a key and print the value */
7504 for (i
= 0; parm_table
[i
].label
; i
++) {
7505 if (strwicmp(parm_table
[i
].label
, parm_name
) == 0 &&
7506 (parm_table
[i
].p_class
== p_class
|| parm_table
[i
].flags
& flag
) &&
7507 parm_table
[i
].ptr
&&
7508 (*parm_table
[i
].label
!= '-') &&
7509 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
7514 ptr
= parm_table
[i
].ptr
;
7516 struct service
*pService
= ServicePtrs
[snum
];
7517 ptr
= ((char *)pService
) +
7518 PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
7521 print_parameter(&parm_table
[i
],
7532 /***************************************************************************
7533 Return info about the requested parameter (given as a string).
7534 Return NULL when the string is not a valid parameter name.
7535 ***************************************************************************/
7537 struct parm_struct
*lp_get_parameter(const char *param_name
)
7539 int num
= map_parameter(param_name
);
7545 return &parm_table
[num
];
7548 /***************************************************************************
7549 Return info about the next parameter in a service.
7550 snum==GLOBAL_SECTION_SNUM gives the globals.
7551 Return NULL when out of parameters.
7552 ***************************************************************************/
7554 struct parm_struct
*lp_next_parameter(int snum
, int *i
, int allparameters
)
7557 /* do the globals */
7558 for (; parm_table
[*i
].label
; (*i
)++) {
7559 if (parm_table
[*i
].p_class
== P_SEPARATOR
)
7560 return &parm_table
[(*i
)++];
7562 if (!parm_table
[*i
].ptr
7563 || (*parm_table
[*i
].label
== '-'))
7567 && (parm_table
[*i
].ptr
==
7568 parm_table
[(*i
) - 1].ptr
))
7571 if (is_default(*i
) && !allparameters
)
7574 return &parm_table
[(*i
)++];
7577 struct service
*pService
= ServicePtrs
[snum
];
7579 for (; parm_table
[*i
].label
; (*i
)++) {
7580 if (parm_table
[*i
].p_class
== P_SEPARATOR
)
7581 return &parm_table
[(*i
)++];
7583 if (parm_table
[*i
].p_class
== P_LOCAL
&&
7584 parm_table
[*i
].ptr
&&
7585 (*parm_table
[*i
].label
!= '-') &&
7587 (parm_table
[*i
].ptr
!=
7588 parm_table
[(*i
) - 1].ptr
)))
7591 PTR_DIFF(parm_table
[*i
].ptr
,
7594 if (allparameters
||
7595 !equal_parameter(parm_table
[*i
].type
,
7596 ((char *)pService
) +
7598 ((char *)&sDefault
) +
7601 return &parm_table
[(*i
)++];
7612 /***************************************************************************
7613 Display the contents of a single copy structure.
7614 ***************************************************************************/
7615 static void dump_copy_map(bool *pcopymap
)
7621 printf("\n\tNon-Copied parameters:\n");
7623 for (i
= 0; parm_table
[i
].label
; i
++)
7624 if (parm_table
[i
].p_class
== P_LOCAL
&&
7625 parm_table
[i
].ptr
&& !pcopymap
[i
] &&
7626 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
7628 printf("\t\t%s\n", parm_table
[i
].label
);
7633 /***************************************************************************
7634 Return TRUE if the passed service number is within range.
7635 ***************************************************************************/
7637 bool lp_snum_ok(int iService
)
7639 return (LP_SNUM_OK(iService
) && ServicePtrs
[iService
]->bAvailable
);
7642 /***************************************************************************
7643 Auto-load some home services.
7644 ***************************************************************************/
7646 static void lp_add_auto_services(char *str
)
7656 s
= SMB_STRDUP(str
);
7660 homes
= lp_servicenumber(HOMES_NAME
);
7662 for (p
= strtok_r(s
, LIST_SEP
, &saveptr
); p
;
7663 p
= strtok_r(NULL
, LIST_SEP
, &saveptr
)) {
7666 if (lp_servicenumber(p
) >= 0)
7669 home
= get_user_home_dir(talloc_tos(), p
);
7671 if (home
&& homes
>= 0)
7672 lp_add_home(p
, homes
, p
, home
);
7679 /***************************************************************************
7680 Auto-load one printer.
7681 ***************************************************************************/
7683 void lp_add_one_printer(char *name
, char *comment
)
7685 int printers
= lp_servicenumber(PRINTERS_NAME
);
7688 if (lp_servicenumber(name
) < 0) {
7689 lp_add_printer(name
, printers
);
7690 if ((i
= lp_servicenumber(name
)) >= 0) {
7691 string_set(&ServicePtrs
[i
]->comment
, comment
);
7692 ServicePtrs
[i
]->autoloaded
= True
;
7697 /***************************************************************************
7698 Have we loaded a services file yet?
7699 ***************************************************************************/
7701 bool lp_loaded(void)
7706 /***************************************************************************
7707 Unload unused services.
7708 ***************************************************************************/
7710 void lp_killunused(bool (*snumused
) (int))
7713 for (i
= 0; i
< iNumServices
; i
++) {
7717 /* don't kill autoloaded or usershare services */
7718 if ( ServicePtrs
[i
]->autoloaded
||
7719 ServicePtrs
[i
]->usershare
== USERSHARE_VALID
) {
7723 if (!snumused
|| !snumused(i
)) {
7724 free_service_byindex(i
);
7729 /***************************************************************************
7731 ***************************************************************************/
7733 void lp_killservice(int iServiceIn
)
7735 if (VALID(iServiceIn
)) {
7736 free_service_byindex(iServiceIn
);
7740 /***************************************************************************
7741 Save the curent values of all global and sDefault parameters into the
7742 defaults union. This allows swat and testparm to show only the
7743 changed (ie. non-default) parameters.
7744 ***************************************************************************/
7746 static void lp_save_defaults(void)
7749 for (i
= 0; parm_table
[i
].label
; i
++) {
7750 if (i
> 0 && parm_table
[i
].ptr
== parm_table
[i
- 1].ptr
)
7752 switch (parm_table
[i
].type
) {
7755 NULL
, &(parm_table
[i
].def
.lvalue
),
7756 *(const char ***)parm_table
[i
].ptr
);
7760 if (parm_table
[i
].ptr
) {
7761 parm_table
[i
].def
.svalue
= SMB_STRDUP(*(char **)parm_table
[i
].ptr
);
7763 parm_table
[i
].def
.svalue
= NULL
;
7768 parm_table
[i
].def
.bvalue
=
7769 *(bool *)parm_table
[i
].ptr
;
7772 parm_table
[i
].def
.cvalue
=
7773 *(char *)parm_table
[i
].ptr
;
7778 parm_table
[i
].def
.ivalue
=
7779 *(int *)parm_table
[i
].ptr
;
7785 defaults_saved
= True
;
7788 /*******************************************************************
7789 Set the server type we will announce as via nmbd.
7790 ********************************************************************/
7792 static const struct srv_role_tab
{
7794 const char *role_str
;
7795 } srv_role_tab
[] = {
7796 { ROLE_STANDALONE
, "ROLE_STANDALONE" },
7797 { ROLE_DOMAIN_MEMBER
, "ROLE_DOMAIN_MEMBER" },
7798 { ROLE_DOMAIN_BDC
, "ROLE_DOMAIN_BDC" },
7799 { ROLE_DOMAIN_PDC
, "ROLE_DOMAIN_PDC" },
7803 const char* server_role_str(uint32 role
)
7806 for (i
=0; srv_role_tab
[i
].role_str
; i
++) {
7807 if (role
== srv_role_tab
[i
].role
) {
7808 return srv_role_tab
[i
].role_str
;
7814 static void set_server_role(void)
7816 server_role
= ROLE_STANDALONE
;
7818 switch (lp_security()) {
7820 if (lp_domain_logons())
7821 DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
7824 if (lp_domain_logons())
7825 DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
7826 /* this used to be considered ROLE_DOMAIN_MEMBER but that's just wrong */
7827 server_role
= ROLE_STANDALONE
;
7830 if (lp_domain_logons()) {
7831 DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
7832 server_role
= ROLE_DOMAIN_BDC
;
7835 server_role
= ROLE_DOMAIN_MEMBER
;
7838 if (lp_domain_logons()) {
7839 server_role
= ROLE_DOMAIN_PDC
;
7842 server_role
= ROLE_DOMAIN_MEMBER
;
7845 if (lp_domain_logons()) {
7847 if (Globals
.iDomainMaster
) /* auto or yes */
7848 server_role
= ROLE_DOMAIN_PDC
;
7850 server_role
= ROLE_DOMAIN_BDC
;
7854 DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
7858 DEBUG(10, ("set_server_role: role = %s\n", server_role_str(server_role
)));
7861 /***********************************************************
7862 If we should send plaintext/LANMAN passwords in the clinet
7863 ************************************************************/
7865 static void set_allowed_client_auth(void)
7867 if (Globals
.bClientNTLMv2Auth
) {
7868 Globals
.bClientLanManAuth
= False
;
7870 if (!Globals
.bClientLanManAuth
) {
7871 Globals
.bClientPlaintextAuth
= False
;
7875 /***************************************************************************
7877 The following code allows smbd to read a user defined share file.
7878 Yes, this is my intent. Yes, I'm comfortable with that...
7880 THE FOLLOWING IS SECURITY CRITICAL CODE.
7882 It washes your clothes, it cleans your house, it guards you while you sleep...
7883 Do not f%^k with it....
7884 ***************************************************************************/
7886 #define MAX_USERSHARE_FILE_SIZE (10*1024)
7888 /***************************************************************************
7889 Check allowed stat state of a usershare file.
7890 Ensure we print out who is dicking with us so the admin can
7891 get their sorry ass fired.
7892 ***************************************************************************/
7894 static bool check_usershare_stat(const char *fname
, SMB_STRUCT_STAT
*psbuf
)
7896 if (!S_ISREG(psbuf
->st_mode
)) {
7897 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
7898 "not a regular file\n",
7899 fname
, (unsigned int)psbuf
->st_uid
));
7903 /* Ensure this doesn't have the other write bit set. */
7904 if (psbuf
->st_mode
& S_IWOTH
) {
7905 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
7906 "public write. Refusing to allow as a usershare file.\n",
7907 fname
, (unsigned int)psbuf
->st_uid
));
7911 /* Should be 10k or less. */
7912 if (psbuf
->st_size
> MAX_USERSHARE_FILE_SIZE
) {
7913 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
7914 "too large (%u) to be a user share file.\n",
7915 fname
, (unsigned int)psbuf
->st_uid
,
7916 (unsigned int)psbuf
->st_size
));
7923 /***************************************************************************
7924 Parse the contents of a usershare file.
7925 ***************************************************************************/
7927 enum usershare_err
parse_usershare_file(TALLOC_CTX
*ctx
,
7928 SMB_STRUCT_STAT
*psbuf
,
7929 const char *servicename
,
7933 char **pp_sharepath
,
7938 const char **prefixallowlist
= lp_usershare_prefix_allow_list();
7939 const char **prefixdenylist
= lp_usershare_prefix_deny_list();
7942 SMB_STRUCT_STAT sbuf
;
7943 char *sharepath
= NULL
;
7944 char *comment
= NULL
;
7946 *pp_sharepath
= NULL
;
7949 *pallow_guest
= False
;
7952 return USERSHARE_MALFORMED_FILE
;
7955 if (strcmp(lines
[0], "#VERSION 1") == 0) {
7957 } else if (strcmp(lines
[0], "#VERSION 2") == 0) {
7960 return USERSHARE_MALFORMED_FILE
;
7963 return USERSHARE_BAD_VERSION
;
7966 if (strncmp(lines
[1], "path=", 5) != 0) {
7967 return USERSHARE_MALFORMED_PATH
;
7970 sharepath
= talloc_strdup(ctx
, &lines
[1][5]);
7972 return USERSHARE_POSIX_ERR
;
7974 trim_string(sharepath
, " ", " ");
7976 if (strncmp(lines
[2], "comment=", 8) != 0) {
7977 return USERSHARE_MALFORMED_COMMENT_DEF
;
7980 comment
= talloc_strdup(ctx
, &lines
[2][8]);
7982 return USERSHARE_POSIX_ERR
;
7984 trim_string(comment
, " ", " ");
7985 trim_char(comment
, '"', '"');
7987 if (strncmp(lines
[3], "usershare_acl=", 14) != 0) {
7988 return USERSHARE_MALFORMED_ACL_DEF
;
7991 if (!parse_usershare_acl(ctx
, &lines
[3][14], ppsd
)) {
7992 return USERSHARE_ACL_ERR
;
7996 if (strncmp(lines
[4], "guest_ok=", 9) != 0) {
7997 return USERSHARE_MALFORMED_ACL_DEF
;
7999 if (lines
[4][9] == 'y') {
8000 *pallow_guest
= True
;
8004 if (snum
!= -1 && (strcmp(sharepath
, ServicePtrs
[snum
]->szPath
) == 0)) {
8005 /* Path didn't change, no checks needed. */
8006 *pp_sharepath
= sharepath
;
8007 *pp_comment
= comment
;
8008 return USERSHARE_OK
;
8011 /* The path *must* be absolute. */
8012 if (sharepath
[0] != '/') {
8013 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8014 servicename
, sharepath
));
8015 return USERSHARE_PATH_NOT_ABSOLUTE
;
8018 /* If there is a usershare prefix deny list ensure one of these paths
8019 doesn't match the start of the user given path. */
8020 if (prefixdenylist
) {
8022 for ( i
=0; prefixdenylist
[i
]; i
++ ) {
8023 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8024 servicename
, i
, prefixdenylist
[i
], sharepath
));
8025 if (memcmp( sharepath
, prefixdenylist
[i
], strlen(prefixdenylist
[i
])) == 0) {
8026 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8027 "usershare prefix deny list entries.\n",
8028 servicename
, sharepath
));
8029 return USERSHARE_PATH_IS_DENIED
;
8034 /* If there is a usershare prefix allow list ensure one of these paths
8035 does match the start of the user given path. */
8037 if (prefixallowlist
) {
8039 for ( i
=0; prefixallowlist
[i
]; i
++ ) {
8040 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8041 servicename
, i
, prefixallowlist
[i
], sharepath
));
8042 if (memcmp( sharepath
, prefixallowlist
[i
], strlen(prefixallowlist
[i
])) == 0) {
8046 if (prefixallowlist
[i
] == NULL
) {
8047 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8048 "usershare prefix allow list entries.\n",
8049 servicename
, sharepath
));
8050 return USERSHARE_PATH_NOT_ALLOWED
;
8054 /* Ensure this is pointing to a directory. */
8055 dp
= sys_opendir(sharepath
);
8058 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8059 servicename
, sharepath
));
8060 return USERSHARE_PATH_NOT_DIRECTORY
;
8063 /* Ensure the owner of the usershare file has permission to share
8066 if (sys_stat(sharepath
, &sbuf
) == -1) {
8067 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8068 servicename
, sharepath
, strerror(errno
) ));
8070 return USERSHARE_POSIX_ERR
;
8075 if (!S_ISDIR(sbuf
.st_mode
)) {
8076 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8077 servicename
, sharepath
));
8078 return USERSHARE_PATH_NOT_DIRECTORY
;
8081 /* Check if sharing is restricted to owner-only. */
8082 /* psbuf is the stat of the usershare definition file,
8083 sbuf is the stat of the target directory to be shared. */
8085 if (lp_usershare_owner_only()) {
8086 /* root can share anything. */
8087 if ((psbuf
->st_uid
!= 0) && (sbuf
.st_uid
!= psbuf
->st_uid
)) {
8088 return USERSHARE_PATH_NOT_ALLOWED
;
8092 *pp_sharepath
= sharepath
;
8093 *pp_comment
= comment
;
8094 return USERSHARE_OK
;
8097 /***************************************************************************
8098 Deal with a usershare file.
8101 -1 - Bad name, invalid contents.
8102 - service name already existed and not a usershare, problem
8103 with permissions to share directory etc.
8104 ***************************************************************************/
8106 static int process_usershare_file(const char *dir_name
, const char *file_name
, int snum_template
)
8108 SMB_STRUCT_STAT sbuf
;
8109 SMB_STRUCT_STAT lsbuf
;
8111 char *sharepath
= NULL
;
8112 char *comment
= NULL
;
8113 fstring service_name
;
8114 char **lines
= NULL
;
8118 TALLOC_CTX
*ctx
= NULL
;
8119 SEC_DESC
*psd
= NULL
;
8120 bool guest_ok
= False
;
8122 /* Ensure share name doesn't contain invalid characters. */
8123 if (!validate_net_name(file_name
, INVALID_SHARENAME_CHARS
, strlen(file_name
))) {
8124 DEBUG(0,("process_usershare_file: share name %s contains "
8125 "invalid characters (any of %s)\n",
8126 file_name
, INVALID_SHARENAME_CHARS
));
8130 fstrcpy(service_name
, file_name
);
8132 if (asprintf(&fname
, "%s/%s", dir_name
, file_name
) < 0) {
8135 /* Minimize the race condition by doing an lstat before we
8136 open and fstat. Ensure this isn't a symlink link. */
8138 if (sys_lstat(fname
, &lsbuf
) != 0) {
8139 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8140 fname
, strerror(errno
) ));
8145 /* This must be a regular file, not a symlink, directory or
8146 other strange filetype. */
8147 if (!check_usershare_stat(fname
, &lsbuf
)) {
8153 char *canon_name
= canonicalize_servicename(service_name
);
8154 TDB_DATA data
= dbwrap_fetch_bystring(
8155 ServiceHash
, canon_name
, canon_name
);
8159 if ((data
.dptr
!= NULL
) && (data
.dsize
== sizeof(iService
))) {
8160 iService
= *(int *)data
.dptr
;
8162 TALLOC_FREE(canon_name
);
8165 if (iService
!= -1 && ServicePtrs
[iService
]->usershare_last_mod
== lsbuf
.st_mtime
) {
8166 /* Nothing changed - Mark valid and return. */
8167 DEBUG(10,("process_usershare_file: service %s not changed.\n",
8169 ServicePtrs
[iService
]->usershare
= USERSHARE_VALID
;
8174 /* Try and open the file read only - no symlinks allowed. */
8176 fd
= sys_open(fname
, O_RDONLY
|O_NOFOLLOW
, 0);
8178 fd
= sys_open(fname
, O_RDONLY
, 0);
8182 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
8183 fname
, strerror(errno
) ));
8188 /* Now fstat to be *SURE* it's a regular file. */
8189 if (sys_fstat(fd
, &sbuf
) != 0) {
8191 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
8192 fname
, strerror(errno
) ));
8197 /* Is it the same dev/inode as was lstated ? */
8198 if (lsbuf
.st_dev
!= sbuf
.st_dev
|| lsbuf
.st_ino
!= sbuf
.st_ino
) {
8200 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
8201 "Symlink spoofing going on ?\n", fname
));
8206 /* This must be a regular file, not a symlink, directory or
8207 other strange filetype. */
8208 if (!check_usershare_stat(fname
, &sbuf
)) {
8213 lines
= fd_lines_load(fd
, &numlines
, MAX_USERSHARE_FILE_SIZE
);
8216 if (lines
== NULL
) {
8217 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
8218 fname
, (unsigned int)sbuf
.st_uid
));
8225 /* Should we allow printers to be shared... ? */
8226 ctx
= talloc_init("usershare_sd_xctx");
8228 file_lines_free(lines
);
8232 if (parse_usershare_file(ctx
, &sbuf
, service_name
,
8233 iService
, lines
, numlines
, &sharepath
,
8234 &comment
, &psd
, &guest_ok
) != USERSHARE_OK
) {
8235 talloc_destroy(ctx
);
8236 file_lines_free(lines
);
8240 file_lines_free(lines
);
8242 /* Everything ok - add the service possibly using a template. */
8244 const struct service
*sp
= &sDefault
;
8245 if (snum_template
!= -1) {
8246 sp
= ServicePtrs
[snum_template
];
8249 if ((iService
= add_a_service(sp
, service_name
)) < 0) {
8250 DEBUG(0, ("process_usershare_file: Failed to add "
8251 "new service %s\n", service_name
));
8252 talloc_destroy(ctx
);
8256 /* Read only is controlled by usershare ACL below. */
8257 ServicePtrs
[iService
]->bRead_only
= False
;
8260 /* Write the ACL of the new/modified share. */
8261 if (!set_share_security(service_name
, psd
)) {
8262 DEBUG(0, ("process_usershare_file: Failed to set share "
8263 "security for user share %s\n",
8265 lp_remove_service(iService
);
8266 talloc_destroy(ctx
);
8270 /* If from a template it may be marked invalid. */
8271 ServicePtrs
[iService
]->valid
= True
;
8273 /* Set the service as a valid usershare. */
8274 ServicePtrs
[iService
]->usershare
= USERSHARE_VALID
;
8276 /* Set guest access. */
8277 if (lp_usershare_allow_guests()) {
8278 ServicePtrs
[iService
]->bGuest_ok
= guest_ok
;
8281 /* And note when it was loaded. */
8282 ServicePtrs
[iService
]->usershare_last_mod
= sbuf
.st_mtime
;
8283 string_set(&ServicePtrs
[iService
]->szPath
, sharepath
);
8284 string_set(&ServicePtrs
[iService
]->comment
, comment
);
8286 talloc_destroy(ctx
);
8291 /***************************************************************************
8292 Checks if a usershare entry has been modified since last load.
8293 ***************************************************************************/
8295 static bool usershare_exists(int iService
, time_t *last_mod
)
8297 SMB_STRUCT_STAT lsbuf
;
8298 const char *usersharepath
= Globals
.szUsersharePath
;
8301 if (asprintf(&fname
, "%s/%s",
8303 ServicePtrs
[iService
]->szService
) < 0) {
8307 if (sys_lstat(fname
, &lsbuf
) != 0) {
8312 if (!S_ISREG(lsbuf
.st_mode
)) {
8318 *last_mod
= lsbuf
.st_mtime
;
8322 /***************************************************************************
8323 Load a usershare service by name. Returns a valid servicenumber or -1.
8324 ***************************************************************************/
8326 int load_usershare_service(const char *servicename
)
8328 SMB_STRUCT_STAT sbuf
;
8329 const char *usersharepath
= Globals
.szUsersharePath
;
8330 int max_user_shares
= Globals
.iUsershareMaxShares
;
8331 int snum_template
= -1;
8333 if (*usersharepath
== 0 || max_user_shares
== 0) {
8337 if (sys_stat(usersharepath
, &sbuf
) != 0) {
8338 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
8339 usersharepath
, strerror(errno
) ));
8343 if (!S_ISDIR(sbuf
.st_mode
)) {
8344 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
8350 * This directory must be owned by root, and have the 't' bit set.
8351 * It also must not be writable by "other".
8355 if (sbuf
.st_uid
!= 0 || !(sbuf
.st_mode
& S_ISVTX
) || (sbuf
.st_mode
& S_IWOTH
)) {
8357 if (sbuf
.st_uid
!= 0 || (sbuf
.st_mode
& S_IWOTH
)) {
8359 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
8360 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8365 /* Ensure the template share exists if it's set. */
8366 if (Globals
.szUsershareTemplateShare
[0]) {
8367 /* We can't use lp_servicenumber here as we are recommending that
8368 template shares have -valid=False set. */
8369 for (snum_template
= iNumServices
- 1; snum_template
>= 0; snum_template
--) {
8370 if (ServicePtrs
[snum_template
]->szService
&&
8371 strequal(ServicePtrs
[snum_template
]->szService
,
8372 Globals
.szUsershareTemplateShare
)) {
8377 if (snum_template
== -1) {
8378 DEBUG(0,("load_usershare_service: usershare template share %s "
8379 "does not exist.\n",
8380 Globals
.szUsershareTemplateShare
));
8385 return process_usershare_file(usersharepath
, servicename
, snum_template
);
8388 /***************************************************************************
8389 Load all user defined shares from the user share directory.
8390 We only do this if we're enumerating the share list.
8391 This is the function that can delete usershares that have
8393 ***************************************************************************/
8395 int load_usershare_shares(void)
8398 SMB_STRUCT_STAT sbuf
;
8399 SMB_STRUCT_DIRENT
*de
;
8400 int num_usershares
= 0;
8401 int max_user_shares
= Globals
.iUsershareMaxShares
;
8402 unsigned int num_dir_entries
, num_bad_dir_entries
, num_tmp_dir_entries
;
8403 unsigned int allowed_bad_entries
= ((2*max_user_shares
)/10);
8404 unsigned int allowed_tmp_entries
= ((2*max_user_shares
)/10);
8406 int snum_template
= -1;
8407 const char *usersharepath
= Globals
.szUsersharePath
;
8408 int ret
= lp_numservices();
8410 if (max_user_shares
== 0 || *usersharepath
== '\0') {
8411 return lp_numservices();
8414 if (sys_stat(usersharepath
, &sbuf
) != 0) {
8415 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
8416 usersharepath
, strerror(errno
) ));
8421 * This directory must be owned by root, and have the 't' bit set.
8422 * It also must not be writable by "other".
8426 if (sbuf
.st_uid
!= 0 || !(sbuf
.st_mode
& S_ISVTX
) || (sbuf
.st_mode
& S_IWOTH
)) {
8428 if (sbuf
.st_uid
!= 0 || (sbuf
.st_mode
& S_IWOTH
)) {
8430 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
8431 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8436 /* Ensure the template share exists if it's set. */
8437 if (Globals
.szUsershareTemplateShare
[0]) {
8438 /* We can't use lp_servicenumber here as we are recommending that
8439 template shares have -valid=False set. */
8440 for (snum_template
= iNumServices
- 1; snum_template
>= 0; snum_template
--) {
8441 if (ServicePtrs
[snum_template
]->szService
&&
8442 strequal(ServicePtrs
[snum_template
]->szService
,
8443 Globals
.szUsershareTemplateShare
)) {
8448 if (snum_template
== -1) {
8449 DEBUG(0,("load_usershare_shares: usershare template share %s "
8450 "does not exist.\n",
8451 Globals
.szUsershareTemplateShare
));
8456 /* Mark all existing usershares as pending delete. */
8457 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
8458 if (VALID(iService
) && ServicePtrs
[iService
]->usershare
) {
8459 ServicePtrs
[iService
]->usershare
= USERSHARE_PENDING_DELETE
;
8463 dp
= sys_opendir(usersharepath
);
8465 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
8466 usersharepath
, strerror(errno
) ));
8470 for (num_dir_entries
= 0, num_bad_dir_entries
= 0, num_tmp_dir_entries
= 0;
8471 (de
= sys_readdir(dp
));
8472 num_dir_entries
++ ) {
8474 const char *n
= de
->d_name
;
8476 /* Ignore . and .. */
8478 if ((n
[1] == '\0') || (n
[1] == '.' && n
[2] == '\0')) {
8484 /* Temporary file used when creating a share. */
8485 num_tmp_dir_entries
++;
8488 /* Allow 20% tmp entries. */
8489 if (num_tmp_dir_entries
> allowed_tmp_entries
) {
8490 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
8491 "in directory %s\n",
8492 num_tmp_dir_entries
, usersharepath
));
8496 r
= process_usershare_file(usersharepath
, n
, snum_template
);
8498 /* Update the services count. */
8500 if (num_usershares
>= max_user_shares
) {
8501 DEBUG(0,("load_usershare_shares: max user shares reached "
8502 "on file %s in directory %s\n",
8503 n
, usersharepath
));
8506 } else if (r
== -1) {
8507 num_bad_dir_entries
++;
8510 /* Allow 20% bad entries. */
8511 if (num_bad_dir_entries
> allowed_bad_entries
) {
8512 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
8513 "in directory %s\n",
8514 num_bad_dir_entries
, usersharepath
));
8518 /* Allow 20% bad entries. */
8519 if (num_dir_entries
> max_user_shares
+ allowed_bad_entries
) {
8520 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
8521 "in directory %s\n",
8522 num_dir_entries
, usersharepath
));
8529 /* Sweep through and delete any non-refreshed usershares that are
8530 not currently in use. */
8531 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
8532 if (VALID(iService
) && (ServicePtrs
[iService
]->usershare
== USERSHARE_PENDING_DELETE
)) {
8533 if (conn_snum_used(iService
)) {
8536 /* Remove from the share ACL db. */
8537 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
8538 lp_servicename(iService
) ));
8539 delete_share_security(lp_servicename(iService
));
8540 free_service_byindex(iService
);
8544 return lp_numservices();
8547 /********************************************************
8548 Destroy global resources allocated in this file
8549 ********************************************************/
8551 void gfree_loadparm(void)
8553 struct file_lists
*f
;
8554 struct file_lists
*next
;
8557 /* Free the file lists */
8562 SAFE_FREE( f
->name
);
8563 SAFE_FREE( f
->subfname
);
8568 /* Free resources allocated to services */
8570 for ( i
= 0; i
< iNumServices
; i
++ ) {
8572 free_service_byindex(i
);
8576 SAFE_FREE( ServicePtrs
);
8579 /* Now release all resources allocated to global
8580 parameters and the default service */
8582 for (i
= 0; parm_table
[i
].label
; i
++)
8584 if ( parm_table
[i
].type
== P_STRING
8585 || parm_table
[i
].type
== P_USTRING
)
8587 string_free( (char**)parm_table
[i
].ptr
);
8589 else if (parm_table
[i
].type
== P_LIST
) {
8590 TALLOC_FREE( *((char***)parm_table
[i
].ptr
) );
8595 /***************************************************************************
8596 Load the services array from the services file. Return True on success,
8598 ***************************************************************************/
8600 bool lp_load(const char *pszFname
,
8604 bool initialize_globals
)
8608 param_opt_struct
*data
, *pdata
;
8612 DEBUG(3, ("lp_load: refreshing parameters\n"));
8614 bInGlobalSection
= True
;
8615 bGlobalOnly
= global_only
;
8617 init_globals(! initialize_globals
);
8620 if (save_defaults
) {
8625 if (Globals
.param_opt
!= NULL
) {
8626 data
= Globals
.param_opt
;
8628 string_free(&data
->key
);
8629 string_free(&data
->value
);
8630 TALLOC_FREE(data
->list
);
8635 Globals
.param_opt
= NULL
;
8638 if (lp_config_backend() == CONFIG_BACKEND_FILE
) {
8639 n2
= alloc_sub_basic(get_current_username(),
8640 current_user_info
.domain
,
8643 smb_panic("lp_load: out of memory");
8646 add_to_file_list(pszFname
, n2
);
8648 /* We get sections first, so have to start 'behind' to make up */
8650 bRetval
= pm_process(n2
, do_section
, do_parameter
);
8653 /* finish up the last section */
8654 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval
)));
8656 if (iServiceIndex
>= 0) {
8657 bRetval
= service_ok(iServiceIndex
);
8661 if (lp_config_backend() == CONFIG_BACKEND_REGISTRY
) {
8663 * We need to use this extra global variable here to
8664 * survive restart: init_globals usese this as a default
8665 * for ConfigBackend. Otherwise, init_globals would
8666 * send us into an endless loop here.
8668 config_backend
= CONFIG_BACKEND_REGISTRY
;
8670 init_globals(false);
8671 return lp_load(pszFname
, global_only
, save_defaults
,
8672 add_ipc
, initialize_globals
);
8674 } else if (lp_config_backend() == CONFIG_BACKEND_REGISTRY
) {
8675 bRetval
= process_registry_globals(do_parameter
);
8677 DEBUG(0, ("Illegal config backend given: %d\n",
8678 lp_config_backend()));
8682 lp_add_auto_services(lp_auto_services());
8685 /* When 'restrict anonymous = 2' guest connections to ipc$
8687 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
8688 if ( lp_enable_asu_support() ) {
8689 lp_add_ipc("ADMIN$", false);
8694 set_default_server_announce_type();
8695 set_allowed_client_auth();
8699 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
8700 /* if bWINSsupport is true and we are in the client */
8701 if (in_client
&& Globals
.bWINSsupport
) {
8702 lp_do_parameter(GLOBAL_SECTION_SNUM
, "wins server", "127.0.0.1");
8710 /***************************************************************************
8711 Reset the max number of services.
8712 ***************************************************************************/
8714 void lp_resetnumservices(void)
8719 /***************************************************************************
8720 Return the max number of services.
8721 ***************************************************************************/
8723 int lp_numservices(void)
8725 return (iNumServices
);
8728 /***************************************************************************
8729 Display the contents of the services array in human-readable form.
8730 ***************************************************************************/
8732 void lp_dump(FILE *f
, bool show_defaults
, int maxtoprint
)
8737 defaults_saved
= False
;
8741 dump_a_service(&sDefault
, f
);
8743 for (iService
= 0; iService
< maxtoprint
; iService
++) {
8745 lp_dump_one(f
, show_defaults
, iService
);
8749 /***************************************************************************
8750 Display the contents of one service in human-readable form.
8751 ***************************************************************************/
8753 void lp_dump_one(FILE * f
, bool show_defaults
, int snum
)
8756 if (ServicePtrs
[snum
]->szService
[0] == '\0')
8758 dump_a_service(ServicePtrs
[snum
], f
);
8762 /***************************************************************************
8763 Return the number of the service with the given name, or -1 if it doesn't
8764 exist. Note that this is a DIFFERENT ANIMAL from the internal function
8765 getservicebyname()! This works ONLY if all services have been loaded, and
8766 does not copy the found service.
8767 ***************************************************************************/
8769 int lp_servicenumber(const char *pszServiceName
)
8772 fstring serviceName
;
8774 if (!pszServiceName
) {
8775 return GLOBAL_SECTION_SNUM
;
8778 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
8779 if (VALID(iService
) && ServicePtrs
[iService
]->szService
) {
8781 * The substitution here is used to support %U is
8784 fstrcpy(serviceName
, ServicePtrs
[iService
]->szService
);
8785 standard_sub_basic(get_current_username(),
8786 current_user_info
.domain
,
8787 serviceName
,sizeof(serviceName
));
8788 if (strequal(serviceName
, pszServiceName
)) {
8794 if (iService
>= 0 && ServicePtrs
[iService
]->usershare
== USERSHARE_VALID
) {
8797 if (!usershare_exists(iService
, &last_mod
)) {
8798 /* Remove the share security tdb entry for it. */
8799 delete_share_security(lp_servicename(iService
));
8800 /* Remove it from the array. */
8801 free_service_byindex(iService
);
8802 /* Doesn't exist anymore. */
8803 return GLOBAL_SECTION_SNUM
;
8806 /* Has it been modified ? If so delete and reload. */
8807 if (ServicePtrs
[iService
]->usershare_last_mod
< last_mod
) {
8808 /* Remove it from the array. */
8809 free_service_byindex(iService
);
8810 /* and now reload it. */
8811 iService
= load_usershare_service(pszServiceName
);
8816 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName
));
8817 return GLOBAL_SECTION_SNUM
;
8823 bool share_defined(const char *service_name
)
8825 return (lp_servicenumber(service_name
) != -1);
8828 struct share_params
*get_share_params(TALLOC_CTX
*mem_ctx
,
8829 const char *sharename
)
8831 struct share_params
*result
;
8835 if (!(sname
= SMB_STRDUP(sharename
))) {
8839 snum
= find_service(sname
);
8846 if (!(result
= TALLOC_P(mem_ctx
, struct share_params
))) {
8847 DEBUG(0, ("talloc failed\n"));
8851 result
->service
= snum
;
8855 struct share_iterator
*share_list_all(TALLOC_CTX
*mem_ctx
)
8857 struct share_iterator
*result
;
8859 if (!(result
= TALLOC_P(mem_ctx
, struct share_iterator
))) {
8860 DEBUG(0, ("talloc failed\n"));
8864 result
->next_id
= 0;
8868 struct share_params
*next_share(struct share_iterator
*list
)
8870 struct share_params
*result
;
8872 while (!lp_snum_ok(list
->next_id
) &&
8873 (list
->next_id
< lp_numservices())) {
8877 if (list
->next_id
>= lp_numservices()) {
8881 if (!(result
= TALLOC_P(list
, struct share_params
))) {
8882 DEBUG(0, ("talloc failed\n"));
8886 result
->service
= list
->next_id
;
8891 struct share_params
*next_printer(struct share_iterator
*list
)
8893 struct share_params
*result
;
8895 while ((result
= next_share(list
)) != NULL
) {
8896 if (lp_print_ok(result
->service
)) {
8904 * This is a hack for a transition period until we transformed all code from
8905 * service numbers to struct share_params.
8908 struct share_params
*snum2params_static(int snum
)
8910 static struct share_params result
;
8911 result
.service
= snum
;
8915 /*******************************************************************
8916 A useful volume label function.
8917 ********************************************************************/
8919 const char *volume_label(int snum
)
8922 const char *label
= lp_volume(snum
);
8924 label
= lp_servicename(snum
);
8927 /* This returns a 33 byte guarenteed null terminated string. */
8928 ret
= talloc_strndup(talloc_tos(), label
, 32);
8935 /*******************************************************************
8936 Set the server type we will announce as via nmbd.
8937 ********************************************************************/
8939 static void set_default_server_announce_type(void)
8941 default_server_announce
= 0;
8942 default_server_announce
|= SV_TYPE_WORKSTATION
;
8943 default_server_announce
|= SV_TYPE_SERVER
;
8944 default_server_announce
|= SV_TYPE_SERVER_UNIX
;
8946 /* note that the flag should be set only if we have a
8947 printer service but nmbd doesn't actually load the
8948 services so we can't tell --jerry */
8950 default_server_announce
|= SV_TYPE_PRINTQ_SERVER
;
8952 switch (lp_announce_as()) {
8953 case ANNOUNCE_AS_NT_SERVER
:
8954 default_server_announce
|= SV_TYPE_SERVER_NT
;
8955 /* fall through... */
8956 case ANNOUNCE_AS_NT_WORKSTATION
:
8957 default_server_announce
|= SV_TYPE_NT
;
8959 case ANNOUNCE_AS_WIN95
:
8960 default_server_announce
|= SV_TYPE_WIN95_PLUS
;
8962 case ANNOUNCE_AS_WFW
:
8963 default_server_announce
|= SV_TYPE_WFW
;
8969 switch (lp_server_role()) {
8970 case ROLE_DOMAIN_MEMBER
:
8971 default_server_announce
|= SV_TYPE_DOMAIN_MEMBER
;
8973 case ROLE_DOMAIN_PDC
:
8974 default_server_announce
|= SV_TYPE_DOMAIN_CTRL
;
8976 case ROLE_DOMAIN_BDC
:
8977 default_server_announce
|= SV_TYPE_DOMAIN_BAKCTRL
;
8979 case ROLE_STANDALONE
:
8983 if (lp_time_server())
8984 default_server_announce
|= SV_TYPE_TIME_SOURCE
;
8986 if (lp_host_msdfs())
8987 default_server_announce
|= SV_TYPE_DFS_SERVER
;
8990 /***********************************************************
8991 returns role of Samba server
8992 ************************************************************/
8994 int lp_server_role(void)
8999 /***********************************************************
9000 If we are PDC then prefer us as DMB
9001 ************************************************************/
9003 bool lp_domain_master(void)
9005 if (Globals
.iDomainMaster
== Auto
)
9006 return (lp_server_role() == ROLE_DOMAIN_PDC
);
9008 return (bool)Globals
.iDomainMaster
;
9011 /***********************************************************
9012 If we are DMB then prefer us as LMB
9013 ************************************************************/
9015 bool lp_preferred_master(void)
9017 if (Globals
.iPreferredMaster
== Auto
)
9018 return (lp_local_master() && lp_domain_master());
9020 return (bool)Globals
.iPreferredMaster
;
9023 /*******************************************************************
9025 ********************************************************************/
9027 void lp_remove_service(int snum
)
9029 ServicePtrs
[snum
]->valid
= False
;
9030 invalid_services
[num_invalid_services
++] = snum
;
9033 /*******************************************************************
9035 ********************************************************************/
9037 void lp_copy_service(int snum
, const char *new_name
)
9039 do_section(new_name
);
9041 snum
= lp_servicenumber(new_name
);
9043 lp_do_parameter(snum
, "copy", lp_servicename(snum
));
9048 /*******************************************************************
9049 Get the default server type we will announce as via nmbd.
9050 ********************************************************************/
9052 int lp_default_server_announce(void)
9054 return default_server_announce
;
9057 /*******************************************************************
9058 Split the announce version into major and minor numbers.
9059 ********************************************************************/
9061 int lp_major_announce_version(void)
9063 static bool got_major
= False
;
9064 static int major_version
= DEFAULT_MAJOR_VERSION
;
9069 return major_version
;
9072 if ((vers
= lp_announce_version()) == NULL
)
9073 return major_version
;
9075 if ((p
= strchr_m(vers
, '.')) == 0)
9076 return major_version
;
9079 major_version
= atoi(vers
);
9080 return major_version
;
9083 int lp_minor_announce_version(void)
9085 static bool got_minor
= False
;
9086 static int minor_version
= DEFAULT_MINOR_VERSION
;
9091 return minor_version
;
9094 if ((vers
= lp_announce_version()) == NULL
)
9095 return minor_version
;
9097 if ((p
= strchr_m(vers
, '.')) == 0)
9098 return minor_version
;
9101 minor_version
= atoi(p
);
9102 return minor_version
;
9105 /***********************************************************
9106 Set the global name resolution order (used in smbclient).
9107 ************************************************************/
9109 void lp_set_name_resolve_order(const char *new_order
)
9111 string_set(&Globals
.szNameResolveOrder
, new_order
);
9114 const char *lp_printername(int snum
)
9116 const char *ret
= _lp_printername(snum
);
9117 if (ret
== NULL
|| (ret
!= NULL
&& *ret
== '\0'))
9118 ret
= lp_const_servicename(snum
);
9124 /***********************************************************
9125 Allow daemons such as winbindd to fix their logfile name.
9126 ************************************************************/
9128 void lp_set_logfile(const char *name
)
9130 string_set(&Globals
.szLogFile
, name
);
9131 debug_set_logfile(name
);
9134 /*******************************************************************
9135 Return the max print jobs per queue.
9136 ********************************************************************/
9138 int lp_maxprintjobs(int snum
)
9140 int maxjobs
= LP_SNUM_OK(snum
) ? ServicePtrs
[snum
]->iMaxPrintJobs
: sDefault
.iMaxPrintJobs
;
9141 if (maxjobs
<= 0 || maxjobs
>= PRINT_MAX_JOBID
)
9142 maxjobs
= PRINT_MAX_JOBID
- 1;
9147 const char *lp_printcapname(void)
9149 if ((Globals
.szPrintcapname
!= NULL
) &&
9150 (Globals
.szPrintcapname
[0] != '\0'))
9151 return Globals
.szPrintcapname
;
9153 if (sDefault
.iPrinting
== PRINT_CUPS
) {
9161 if (sDefault
.iPrinting
== PRINT_BSD
)
9162 return "/etc/printcap";
9164 return PRINTCAP_NAME
;
9167 /*******************************************************************
9168 Ensure we don't use sendfile if server smb signing is active.
9169 ********************************************************************/
9171 static uint32 spoolss_state
;
9173 bool lp_disable_spoolss( void )
9175 if ( spoolss_state
== SVCCTL_STATE_UNKNOWN
)
9176 spoolss_state
= _lp_disable_spoolss() ? SVCCTL_STOPPED
: SVCCTL_RUNNING
;
9178 return spoolss_state
== SVCCTL_STOPPED
? True
: False
;
9181 void lp_set_spoolss_state( uint32 state
)
9183 SMB_ASSERT( (state
== SVCCTL_STOPPED
) || (state
== SVCCTL_RUNNING
) );
9185 spoolss_state
= state
;
9188 uint32
lp_get_spoolss_state( void )
9190 return lp_disable_spoolss() ? SVCCTL_STOPPED
: SVCCTL_RUNNING
;
9193 /*******************************************************************
9194 Ensure we don't use sendfile if server smb signing is active.
9195 ********************************************************************/
9197 bool lp_use_sendfile(int snum
)
9199 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
9200 if (Protocol
< PROTOCOL_NT1
) {
9203 return (_lp_use_sendfile(snum
) &&
9204 (get_remote_arch() != RA_WIN95
) &&
9205 !srv_is_signing_active());
9208 /*******************************************************************
9209 Turn off sendfile if we find the underlying OS doesn't support it.
9210 ********************************************************************/
9212 void set_use_sendfile(int snum
, bool val
)
9214 if (LP_SNUM_OK(snum
))
9215 ServicePtrs
[snum
]->bUseSendfile
= val
;
9217 sDefault
.bUseSendfile
= val
;
9220 /*******************************************************************
9221 Turn off storing DOS attributes if this share doesn't support it.
9222 ********************************************************************/
9224 void set_store_dos_attributes(int snum
, bool val
)
9226 if (!LP_SNUM_OK(snum
))
9228 ServicePtrs
[(snum
)]->bStoreDosAttributes
= val
;
9231 void lp_set_mangling_method(const char *new_method
)
9233 string_set(&Globals
.szManglingMethod
, new_method
);
9236 /*******************************************************************
9237 Global state for POSIX pathname processing.
9238 ********************************************************************/
9240 static bool posix_pathnames
;
9242 bool lp_posix_pathnames(void)
9244 return posix_pathnames
;
9247 /*******************************************************************
9248 Change everything needed to ensure POSIX pathname processing (currently
9250 ********************************************************************/
9252 void lp_set_posix_pathnames(void)
9254 posix_pathnames
= True
;
9257 /*******************************************************************
9258 Global state for POSIX lock processing - CIFS unix extensions.
9259 ********************************************************************/
9261 bool posix_default_lock_was_set
;
9262 static enum brl_flavour posix_cifsx_locktype
; /* By default 0 == WINDOWS_LOCK */
9264 enum brl_flavour
lp_posix_cifsu_locktype(files_struct
*fsp
)
9266 if (posix_default_lock_was_set
) {
9267 return posix_cifsx_locktype
;
9269 return fsp
->posix_open
? POSIX_LOCK
: WINDOWS_LOCK
;
9273 /*******************************************************************
9274 ********************************************************************/
9276 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val
)
9278 posix_default_lock_was_set
= True
;
9279 posix_cifsx_locktype
= val
;
9282 int lp_min_receive_file_size(void)
9284 if (Globals
.iminreceivefile
< 0) {
9287 return MIN(Globals
.iminreceivefile
, BUFFER_SIZE
);