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
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 * This module provides suitable callback functions for the params
32 * module. It builds the internal table of service details which is
33 * then used by the rest of the server.
37 * 1) add it to the global or service structure definition
38 * 2) add it to the parm_table
39 * 3) add it to the list of available functions (eg: using FN_GLOBAL_STRING())
40 * 4) If it's a global then initialise it in init_globals. If a local
41 * (ie. service) parameter then initialise it in the sDefault structure
45 * The configuration file is processed sequentially for speed. It is NOT
46 * accessed randomly as happens in 'real' Windows. For this reason, there
47 * is a fair bit of sequence-dependent code here - ie., code which assumes
48 * that certain things happen before others. In particular, the code which
49 * happens at the boundary between sections is delicately poised, so be
56 BOOL in_client
= False
; /* Not in the client by default */
59 extern userdom_struct current_user_info
;
60 extern pstring user_socket_options
;
63 #define GLOBAL_NAME "global"
67 #define PRINTERS_NAME "printers"
71 #define HOMES_NAME "homes"
74 /* some helpful bits */
75 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && ServicePtrs[(i)]->valid)
76 #define VALID(i) ServicePtrs[i]->valid
78 int keepalive
= DEFAULT_KEEPALIVE
;
79 BOOL use_getwd_cache
= True
;
81 extern int extra_time_offset
;
83 static BOOL defaults_saved
= False
;
85 typedef struct _param_opt_struct param_opt_struct
;
86 struct _param_opt_struct
{
87 param_opt_struct
*prev
, *next
;
94 * This structure describes global (ie., server-wide) parameters.
101 char *display_charset
;
102 char *szPrintcapname
;
103 char *szEnumPortsCommand
;
104 char *szAddPrinterCommand
;
105 char *szDeletePrinterCommand
;
106 char *szOs2DriverMap
;
110 char *szDefaultService
;
116 char *szServerString
;
117 char *szAutoServices
;
118 char *szPasswdProgram
;
122 char *szSMBPasswdFile
;
124 char **szPassdbBackend
;
125 char **szPreloadModules
;
126 char *szPasswordServer
;
127 char *szSocketOptions
;
129 char *szAfsUsernameMap
;
135 char **szWINSservers
;
137 char *szRemoteAnnounce
;
138 char *szRemoteBrowseSync
;
139 char *szSocketAddress
;
140 char *szNISHomeMapName
;
141 char *szAnnounceVersion
; /* This is initialised in init_globals */
144 char **szNetbiosAliases
;
145 char *szNetbiosScope
;
146 char *szDomainOtherSIDs
;
147 char *szNameResolveOrder
;
149 char *szAddUserScript
;
150 char *szDelUserScript
;
151 char *szAddGroupScript
;
152 char *szDelGroupScript
;
153 char *szAddUserToGroupScript
;
154 char *szDelUserFromGroupScript
;
155 char *szSetPrimaryGroupScript
;
156 char *szAddMachineScript
;
157 char *szShutdownScript
;
158 char *szAbortShutdownScript
;
160 char *szWINSPartners
;
167 BOOL bEnableRidAlgorithm
;
168 int AlgorithmicRidBase
;
169 char *szTemplatePrimaryGroup
;
170 char *szTemplateHomedir
;
171 char *szTemplateShell
;
172 char *szWinbindSeparator
;
173 BOOL bWinbindEnableLocalAccounts
;
174 BOOL bWinbindEnumUsers
;
175 BOOL bWinbindEnumGroups
;
176 BOOL bWinbindUseDefaultDomain
;
177 BOOL bWinbindTrustedDomainsOnly
;
178 char *szWinbindBackend
;
179 char *szIdmapBackend
;
180 char *szAddShareCommand
;
181 char *szChangeShareCommand
;
182 char *szDeleteShareCommand
;
183 char *szGuestaccount
;
184 char *szManglingMethod
;
198 BOOL paranoid_server_security
;
201 int iMaxSmbdProcesses
;
202 BOOL bDisableSpoolss
;
206 int enhanced_browsing
;
213 int announce_as
; /* This is initialised in init_globals */
214 int machine_password_timeout
;
215 int change_notify_timeout
;
217 int min_passwd_length
;
219 int oplock_break_wait_time
;
220 int winbind_cache_time
;
223 char *szLdapMachineSuffix
;
224 char *szLdapUserSuffix
;
225 char *szLdapIdmapSuffix
;
226 char *szLdapGroupSuffix
;
227 #ifdef WITH_LDAP_SAMCONFIG
236 int ldap_passwd_sync
;
237 int ldap_replication_sleep
;
239 BOOL bMsAddPrinterWizard
;
244 BOOL bPreferredMaster
;
247 BOOL bEncryptPasswords
;
252 BOOL bObeyPamRestrictions
;
254 BOOL bLargeReadwrite
;
257 BOOL bReadPrediction
;
263 BOOL bBindInterfacesOnly
;
264 BOOL bPamPasswordChange
;
265 BOOL bUnixPasswdSync
;
266 BOOL bPasswdChatDebug
;
267 int iPasswdChatTimeout
;
271 BOOL bNTStatusSupport
;
274 BOOL bAllowTrustedDomains
;
278 BOOL bClientLanManAuth
;
279 BOOL bClientNTLMv2Auth
;
280 BOOL bClientPlaintextAuth
;
281 BOOL bClientUseSpnego
;
282 BOOL bDebugHiresTimestamp
;
288 BOOL bHostnameLookups
;
289 BOOL bUnixExtensions
;
290 BOOL bDisableNetbios
;
291 BOOL bKernelChangeNotify
;
292 int restrict_anonymous
;
293 int name_cache_timeout
;
296 param_opt_struct
*param_opt
;
300 static global Globals
;
303 * This structure describes a single service.
312 char **szInvalidUsers
;
320 char *szRootPostExec
;
321 char *szPrintcommand
;
324 char *szLppausecommand
;
325 char *szLpresumecommand
;
326 char *szQueuepausecommand
;
327 char *szQueueresumecommand
;
337 char *szVetoOplockFiles
;
343 char **printer_admin
;
350 int iMaxReportedPrintJobs
;
353 int iCreate_force_mode
;
355 int iSecurity_force_mode
;
358 int iDir_Security_mask
;
359 int iDir_Security_force_mode
;
363 int iOplockContentionLimit
;
367 BOOL bRootpreexecClose
;
370 BOOL bShortCasePreserve
;
373 BOOL bHideSpecialFiles
;
374 BOOL bHideUnReadable
;
375 BOOL bHideUnWriteableFiles
;
397 BOOL bStrictAllocate
;
401 BOOL bDeleteReadonly
;
403 BOOL bDeleteVetoFiles
;
406 BOOL bDosFiletimeResolution
;
407 BOOL bFakeDirCreateTimes
;
412 BOOL bUseClientDriver
;
413 BOOL bDefaultDevmode
;
417 BOOL bMap_acl_inherit
;
419 param_opt_struct
*param_opt
;
421 char dummy
[3]; /* for alignment */
426 /* This is a default service used to prime a services structure */
427 static service sDefault
= {
429 False
, /* not autoloaded */
430 NULL
, /* szService */
432 NULL
, /* szUsername */
433 NULL
, /* szInvalidUsers */
434 NULL
, /* szValidUsers */
435 NULL
, /* szAdminUsers */
437 NULL
, /* szInclude */
438 NULL
, /* szPreExec */
439 NULL
, /* szPostExec */
440 NULL
, /* szRootPreExec */
441 NULL
, /* szRootPostExec */
442 NULL
, /* szPrintcommand */
443 NULL
, /* szLpqcommand */
444 NULL
, /* szLprmcommand */
445 NULL
, /* szLppausecommand */
446 NULL
, /* szLpresumecommand */
447 NULL
, /* szQueuepausecommand */
448 NULL
, /* szQueueresumecommand */
449 NULL
, /* szPrintername */
450 NULL
, /* szDontdescend */
451 NULL
, /* szHostsallow */
452 NULL
, /* szHostsdeny */
453 NULL
, /* szMagicScript */
454 NULL
, /* szMagicOutput */
455 NULL
, /* szMangledMap */
456 NULL
, /* szVetoFiles */
457 NULL
, /* szHideFiles */
458 NULL
, /* szVetoOplockFiles */
460 NULL
, /* force user */
461 NULL
, /* force group */
463 NULL
, /* writelist */
464 NULL
, /* printer admin */
467 NULL
, /* vfs objects */
468 NULL
, /* szMSDfsProxy */
469 0, /* iMinPrintSpace */
470 1000, /* iMaxPrintJobs */
471 0, /* iMaxReportedPrintJobs */
472 0, /* iWriteCacheSize */
473 0744, /* iCreate_mask */
474 0000, /* iCreate_force_mode */
475 0777, /* iSecurity_mask */
476 0, /* iSecurity_force_mode */
477 0755, /* iDir_mask */
478 0000, /* iDir_force_mode */
479 0777, /* iDir_Security_mask */
480 0, /* iDir_Security_force_mode */
481 0, /* iMaxConnections */
482 CASE_LOWER
, /* iDefaultCase */
483 DEFAULT_PRINTING
, /* iPrinting */
484 2, /* iOplockContentionLimit */
486 1024, /* iBlock_size */
487 False
, /* bPreexecClose */
488 False
, /* bRootpreexecClose */
489 False
, /* case sensitive */
490 True
, /* case preserve */
491 True
, /* short case preserve */
492 False
, /* case mangle */
493 True
, /* bHideDotFiles */
494 False
, /* bHideSpecialFiles */
495 False
, /* bHideUnReadable */
496 False
, /* bHideUnWriteableFiles */
497 True
, /* bBrowseable */
498 True
, /* bAvailable */
499 True
, /* bRead_only */
500 True
, /* bNo_set_dir */
501 False
, /* bGuest_only */
502 False
, /* bGuest_ok */
503 False
, /* bPrint_ok */
504 False
, /* bMap_system */
505 False
, /* bMap_hidden */
506 True
, /* bMap_archive */
508 True
, /* bStrictLocking */
509 True
, /* bPosixLocking */
510 True
, /* bShareModes */
512 True
, /* bLevel2OpLocks */
513 False
, /* bOnlyUser */
514 True
, /* bMangledNames */
515 True
, /* bWidelinks */
516 True
, /* bSymlinks */
517 False
, /* bSyncAlways */
518 False
, /* bStrictAllocate */
519 False
, /* bStrictSync */
520 '~', /* magic char */
522 False
, /* bDeleteReadonly */
523 False
, /* bFakeOplocks */
524 False
, /* bDeleteVetoFiles */
525 False
, /* bDosFilemode */
526 False
, /* bDosFiletimes */
527 False
, /* bDosFiletimeResolution */
528 False
, /* bFakeDirCreateTimes */
529 True
, /* bBlockingLocks */
530 False
, /* bInheritPerms */
531 False
, /* bInheritACLS */
532 False
, /* bMSDfsRoot */
533 False
, /* bUseClientDriver */
534 False
, /* bDefaultDevmode */
535 True
, /* bNTAclSupport */
536 False
, /* bUseSendfile */
537 False
, /* bProfileAcls */
538 False
, /* bMap_acl_inherit */
539 False
, /* bAfs_Share */
541 NULL
, /* Parametric options */
546 /* local variables */
547 static service
**ServicePtrs
= NULL
;
548 static int iNumServices
= 0;
549 static int iServiceIndex
= 0;
550 static BOOL bInGlobalSection
= True
;
551 static BOOL bGlobalOnly
= False
;
552 static int server_role
;
553 static int default_server_announce
;
555 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
557 /* prototypes for the special type handlers */
558 static BOOL
handle_include(const char *pszParmValue
, char **ptr
);
559 static BOOL
handle_copy(const char *pszParmValue
, char **ptr
);
560 static BOOL
handle_source_env(const char *pszParmValue
, char **ptr
);
561 static BOOL
handle_netbios_name(const char *pszParmValue
, char **ptr
);
562 static BOOL
handle_idmap_uid(const char *pszParmValue
, char **ptr
);
563 static BOOL
handle_idmap_gid(const char *pszParmValue
, char **ptr
);
564 static BOOL
handle_debug_list( const char *pszParmValue
, char **ptr
);
565 static BOOL
handle_workgroup( const char *pszParmValue
, char **ptr
);
566 static BOOL
handle_netbios_aliases( const char *pszParmValue
, char **ptr
);
567 static BOOL
handle_netbios_scope( const char *pszParmValue
, char **ptr
);
568 static BOOL
handle_charset( const char *pszParmValue
, char **ptr
);
570 static BOOL
handle_acl_compatibility(const char *pszParmValue
, char **ptr
);
572 static void set_server_role(void);
573 static void set_default_server_announce_type(void);
574 static void set_allowed_client_auth(void);
576 static const struct enum_list enum_protocol
[] = {
577 {PROTOCOL_NT1
, "NT1"},
578 {PROTOCOL_LANMAN2
, "LANMAN2"},
579 {PROTOCOL_LANMAN1
, "LANMAN1"},
580 {PROTOCOL_CORE
, "CORE"},
581 {PROTOCOL_COREPLUS
, "COREPLUS"},
582 {PROTOCOL_COREPLUS
, "CORE+"},
586 static const struct enum_list enum_security
[] = {
587 {SEC_SHARE
, "SHARE"},
589 {SEC_SERVER
, "SERVER"},
590 {SEC_DOMAIN
, "DOMAIN"},
597 static const struct enum_list enum_printing
[] = {
598 {PRINT_SYSV
, "sysv"},
600 {PRINT_HPUX
, "hpux"},
604 {PRINT_LPRNG
, "lprng"},
605 {PRINT_CUPS
, "cups"},
607 {PRINT_LPROS2
, "os2"},
609 {PRINT_TEST
, "test"},
611 #endif /* DEVELOPER */
615 static const struct enum_list enum_ldap_ssl
[] = {
616 #ifdef WITH_LDAP_SAMCONFIG
617 {LDAP_SSL_ON
, "Yes"},
618 {LDAP_SSL_ON
, "yes"},
622 {LDAP_SSL_OFF
, "no"},
623 {LDAP_SSL_OFF
, "No"},
624 {LDAP_SSL_OFF
, "off"},
625 {LDAP_SSL_OFF
, "Off"},
626 {LDAP_SSL_START_TLS
, "start tls"},
627 {LDAP_SSL_START_TLS
, "Start_tls"},
631 static const struct enum_list enum_ldap_passwd_sync
[] = {
632 {LDAP_PASSWD_SYNC_OFF
, "no"},
633 {LDAP_PASSWD_SYNC_OFF
, "No"},
634 {LDAP_PASSWD_SYNC_OFF
, "off"},
635 {LDAP_PASSWD_SYNC_OFF
, "Off"},
636 {LDAP_PASSWD_SYNC_ON
, "Yes"},
637 {LDAP_PASSWD_SYNC_ON
, "yes"},
638 {LDAP_PASSWD_SYNC_ON
, "on"},
639 {LDAP_PASSWD_SYNC_ON
, "On"},
640 {LDAP_PASSWD_SYNC_ONLY
, "Only"},
641 {LDAP_PASSWD_SYNC_ONLY
, "only"},
645 /* Types of machine we can announce as. */
646 #define ANNOUNCE_AS_NT_SERVER 1
647 #define ANNOUNCE_AS_WIN95 2
648 #define ANNOUNCE_AS_WFW 3
649 #define ANNOUNCE_AS_NT_WORKSTATION 4
651 static const struct enum_list enum_announce_as
[] = {
652 {ANNOUNCE_AS_NT_SERVER
, "NT"},
653 {ANNOUNCE_AS_NT_SERVER
, "NT Server"},
654 {ANNOUNCE_AS_NT_WORKSTATION
, "NT Workstation"},
655 {ANNOUNCE_AS_WIN95
, "win95"},
656 {ANNOUNCE_AS_WFW
, "WfW"},
660 static const struct enum_list enum_case
[] = {
661 {CASE_LOWER
, "lower"},
662 {CASE_UPPER
, "upper"},
666 static const struct enum_list enum_bool_auto
[] = {
677 /* Client-side offline caching policy types */
678 #define CSC_POLICY_MANUAL 0
679 #define CSC_POLICY_DOCUMENTS 1
680 #define CSC_POLICY_PROGRAMS 2
681 #define CSC_POLICY_DISABLE 3
683 static const struct enum_list enum_csc_policy
[] = {
684 {CSC_POLICY_MANUAL
, "manual"},
685 {CSC_POLICY_DOCUMENTS
, "documents"},
686 {CSC_POLICY_PROGRAMS
, "programs"},
687 {CSC_POLICY_DISABLE
, "disable"},
691 /* SMB signing types. */
692 static const struct enum_list enum_smb_signing_vals
[] = {
704 {Required
, "required"},
705 {Required
, "mandatory"},
707 {Required
, "forced"},
708 {Required
, "enforced"},
714 Do you want session setups at user level security with a invalid
715 password to be rejected or allowed in as guest? WinNT rejects them
716 but it can be a pain as it means "net view" needs to use a password
718 You have 3 choices in the setting of map_to_guest:
720 "Never" means session setups with an invalid password
721 are rejected. This is the default.
723 "Bad User" means session setups with an invalid password
724 are rejected, unless the username does not exist, in which case it
725 is treated as a guest login
727 "Bad Password" means session setups with an invalid password
728 are treated as a guest login
730 Note that map_to_guest only has an effect in user or server
734 static const struct enum_list enum_map_to_guest
[] = {
735 {NEVER_MAP_TO_GUEST
, "Never"},
736 {MAP_TO_GUEST_ON_BAD_USER
, "Bad User"},
737 {MAP_TO_GUEST_ON_BAD_PASSWORD
, "Bad Password"},
741 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
743 * The FLAG_HIDE is explicit. Paramters set this way do NOT appear in any edit
744 * screen in SWAT. This is used to exclude parameters as well as to squash all
745 * parameters that have been duplicated by pseudonyms.
747 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
748 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
749 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
752 * NOTE2: Handling of duplicated (synonym) paramters:
753 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
754 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
755 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
756 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
759 static struct parm_struct parm_table
[] = {
760 {N_("Base Options"), P_SEP
, P_SEPARATOR
},
762 {"dos charset", P_STRING
, P_GLOBAL
, &Globals
.dos_charset
, handle_charset
, NULL
, FLAG_ADVANCED
},
763 {"unix charset", P_STRING
, P_GLOBAL
, &Globals
.unix_charset
, handle_charset
, NULL
, FLAG_ADVANCED
},
764 {"display charset", P_STRING
, P_GLOBAL
, &Globals
.display_charset
, handle_charset
, NULL
, FLAG_ADVANCED
},
765 {"comment", P_STRING
, P_LOCAL
, &sDefault
.comment
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
},
766 {"path", P_STRING
, P_LOCAL
, &sDefault
.szPath
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
},
767 {"directory", P_STRING
, P_LOCAL
, &sDefault
.szPath
, NULL
, NULL
, FLAG_HIDE
},
768 {"workgroup", P_USTRING
, P_GLOBAL
, &Globals
.szWorkgroup
, handle_workgroup
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
},
770 {"realm", P_USTRING
, P_GLOBAL
, &Globals
.szRealm
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
},
772 {"netbios name", P_USTRING
, P_GLOBAL
, &Globals
.szNetbiosName
, handle_netbios_name
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
},
773 {"netbios aliases", P_LIST
, P_GLOBAL
, &Globals
.szNetbiosAliases
, handle_netbios_aliases
, NULL
, FLAG_ADVANCED
},
774 {"netbios scope", P_USTRING
, P_GLOBAL
, &Globals
.szNetbiosScope
, handle_netbios_scope
, NULL
, FLAG_ADVANCED
},
775 {"server string", P_STRING
, P_GLOBAL
, &Globals
.szServerString
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
},
776 {"interfaces", P_LIST
, P_GLOBAL
, &Globals
.szInterfaces
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
},
777 {"bind interfaces only", P_BOOL
, P_GLOBAL
, &Globals
.bBindInterfacesOnly
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_WIZARD
},
779 {N_("Security Options"), P_SEP
, P_SEPARATOR
},
781 {"security", P_ENUM
, P_GLOBAL
, &Globals
.security
, NULL
, enum_security
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
},
782 {"auth methods", P_LIST
, P_GLOBAL
, &Globals
.AuthMethods
, NULL
, NULL
, FLAG_ADVANCED
},
783 {"encrypt passwords", P_BOOL
, P_GLOBAL
, &Globals
.bEncryptPasswords
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
},
784 {"update encrypted", P_BOOL
, P_GLOBAL
, &Globals
.bUpdateEncrypt
, NULL
, NULL
, FLAG_ADVANCED
},
785 {"client schannel", P_ENUM
, P_GLOBAL
, &Globals
.clientSchannel
, NULL
, enum_bool_auto
, FLAG_BASIC
| FLAG_ADVANCED
},
786 {"server schannel", P_ENUM
, P_GLOBAL
, &Globals
.serverSchannel
, NULL
, enum_bool_auto
, FLAG_BASIC
| FLAG_ADVANCED
},
787 {"allow trusted domains", P_BOOL
, P_GLOBAL
, &Globals
.bAllowTrustedDomains
, NULL
, NULL
, FLAG_ADVANCED
},
788 {"hosts equiv", P_STRING
, P_GLOBAL
, &Globals
.szHostsEquiv
, NULL
, NULL
, FLAG_ADVANCED
},
789 {"min passwd length", P_INTEGER
, P_GLOBAL
, &Globals
.min_passwd_length
, NULL
, NULL
, FLAG_ADVANCED
},
790 {"min password length", P_INTEGER
, P_GLOBAL
, &Globals
.min_passwd_length
, NULL
, NULL
, FLAG_ADVANCED
},
791 {"use cracklib", P_BOOL
, P_GLOBAL
, &Globals
.use_cracklib
, NULL
, NULL
, FLAG_ADVANCED
},
792 {"map to guest", P_ENUM
, P_GLOBAL
, &Globals
.map_to_guest
, NULL
, enum_map_to_guest
, FLAG_ADVANCED
},
793 {"null passwords", P_BOOL
, P_GLOBAL
, &Globals
.bNullPasswords
, NULL
, NULL
, FLAG_ADVANCED
},
794 {"obey pam restrictions", P_BOOL
, P_GLOBAL
, &Globals
.bObeyPamRestrictions
, NULL
, NULL
, FLAG_ADVANCED
},
795 {"password server", P_STRING
, P_GLOBAL
, &Globals
.szPasswordServer
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_WIZARD
},
796 {"smb passwd file", P_STRING
, P_GLOBAL
, &Globals
.szSMBPasswdFile
, NULL
, NULL
, FLAG_ADVANCED
},
797 {"private dir", P_STRING
, P_GLOBAL
, &Globals
.szPrivateDir
, NULL
, NULL
, FLAG_ADVANCED
},
798 {"passdb backend", P_LIST
, P_GLOBAL
, &Globals
.szPassdbBackend
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_WIZARD
},
799 {"algorithmic rid base", P_INTEGER
, P_GLOBAL
, &Globals
.AlgorithmicRidBase
, NULL
, NULL
, FLAG_ADVANCED
},
800 {"root directory", P_STRING
, P_GLOBAL
, &Globals
.szRootdir
, NULL
, NULL
, FLAG_ADVANCED
},
801 {"root dir", P_STRING
, P_GLOBAL
, &Globals
.szRootdir
, NULL
, NULL
, FLAG_HIDE
},
802 {"root", P_STRING
, P_GLOBAL
, &Globals
.szRootdir
, NULL
, NULL
, FLAG_HIDE
},
803 {"guest account", P_STRING
, P_GLOBAL
, &Globals
.szGuestaccount
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
},
805 {"pam password change", P_BOOL
, P_GLOBAL
, &Globals
.bPamPasswordChange
, NULL
, NULL
, FLAG_ADVANCED
},
806 {"passwd program", P_STRING
, P_GLOBAL
, &Globals
.szPasswdProgram
, NULL
, NULL
, FLAG_ADVANCED
},
807 {"passwd chat", P_STRING
, P_GLOBAL
, &Globals
.szPasswdChat
, NULL
, NULL
, FLAG_ADVANCED
},
808 {"passwd chat debug", P_BOOL
, P_GLOBAL
, &Globals
.bPasswdChatDebug
, NULL
, NULL
, FLAG_ADVANCED
},
809 {"passwd chat timeout", P_INTEGER
, P_GLOBAL
, &Globals
.iPasswdChatTimeout
, NULL
, NULL
, FLAG_ADVANCED
},
810 {"username map", P_STRING
, P_GLOBAL
, &Globals
.szUsernameMap
, NULL
, NULL
, FLAG_ADVANCED
},
811 {"password level", P_INTEGER
, P_GLOBAL
, &Globals
.pwordlevel
, NULL
, NULL
, FLAG_ADVANCED
},
812 {"username level", P_INTEGER
, P_GLOBAL
, &Globals
.unamelevel
, NULL
, NULL
, FLAG_ADVANCED
},
813 {"unix password sync", P_BOOL
, P_GLOBAL
, &Globals
.bUnixPasswdSync
, NULL
, NULL
, FLAG_ADVANCED
},
814 {"restrict anonymous", P_INTEGER
, P_GLOBAL
, &Globals
.restrict_anonymous
, NULL
, NULL
, FLAG_ADVANCED
},
815 {"lanman auth", P_BOOL
, P_GLOBAL
, &Globals
.bLanmanAuth
, NULL
, NULL
, FLAG_ADVANCED
},
816 {"ntlm auth", P_BOOL
, P_GLOBAL
, &Globals
.bNTLMAuth
, NULL
, NULL
, FLAG_ADVANCED
},
817 {"client NTLMv2 auth", P_BOOL
, P_GLOBAL
, &Globals
.bClientNTLMv2Auth
, NULL
, NULL
, FLAG_ADVANCED
},
818 {"client lanman auth", P_BOOL
, P_GLOBAL
, &Globals
.bClientLanManAuth
, NULL
, NULL
, FLAG_ADVANCED
},
819 {"client plaintext auth", P_BOOL
, P_GLOBAL
, &Globals
.bClientPlaintextAuth
, NULL
, NULL
, FLAG_ADVANCED
},
821 {"username", P_STRING
, P_LOCAL
, &sDefault
.szUsername
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
822 {"user", P_STRING
, P_LOCAL
, &sDefault
.szUsername
, NULL
, NULL
, FLAG_HIDE
},
823 {"users", P_STRING
, P_LOCAL
, &sDefault
.szUsername
, NULL
, NULL
, FLAG_HIDE
},
825 {"invalid users", P_LIST
, P_LOCAL
, &sDefault
.szInvalidUsers
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
826 {"valid users", P_LIST
, P_LOCAL
, &sDefault
.szValidUsers
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
827 {"admin users", P_LIST
, P_LOCAL
, &sDefault
.szAdminUsers
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
828 {"read list", P_LIST
, P_LOCAL
, &sDefault
.readlist
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
829 {"write list", P_LIST
, P_LOCAL
, &sDefault
.writelist
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
830 {"printer admin", P_LIST
, P_LOCAL
, &sDefault
.printer_admin
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_PRINT
},
831 {"force user", P_STRING
, P_LOCAL
, &sDefault
.force_user
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
832 {"force group", P_STRING
, P_LOCAL
, &sDefault
.force_group
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
833 {"group", P_STRING
, P_LOCAL
, &sDefault
.force_group
, NULL
, NULL
, FLAG_ADVANCED
},
835 {"read only", P_BOOL
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
},
836 {"write ok", P_BOOLREV
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, FLAG_HIDE
},
837 {"writeable", P_BOOLREV
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, FLAG_HIDE
},
838 {"writable", P_BOOLREV
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, FLAG_HIDE
},
840 {"create mask", P_OCTAL
, P_LOCAL
, &sDefault
.iCreate_mask
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
841 {"create mode", P_OCTAL
, P_LOCAL
, &sDefault
.iCreate_mask
, NULL
, NULL
, FLAG_HIDE
},
842 {"force create mode", P_OCTAL
, P_LOCAL
, &sDefault
.iCreate_force_mode
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
843 {"security mask", P_OCTAL
, P_LOCAL
, &sDefault
.iSecurity_mask
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
844 {"force security mode", P_OCTAL
, P_LOCAL
, &sDefault
.iSecurity_force_mode
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
845 {"directory mask", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_mask
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
846 {"directory mode", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_mask
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
},
847 {"force directory mode", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_force_mode
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
848 {"directory security mask", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_Security_mask
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
849 {"force directory security mode", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_Security_force_mode
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
850 {"inherit permissions", P_BOOL
, P_LOCAL
, &sDefault
.bInheritPerms
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
851 {"inherit acls", P_BOOL
, P_LOCAL
, &sDefault
.bInheritACLS
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
852 {"guest only", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_only
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
853 {"only guest", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_only
, NULL
, NULL
, FLAG_HIDE
},
855 {"guest ok", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_ok
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
},
856 {"public", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_ok
, NULL
, NULL
, FLAG_HIDE
},
858 {"only user", P_BOOL
, P_LOCAL
, &sDefault
.bOnlyUser
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
859 {"hosts allow", P_LIST
, P_LOCAL
, &sDefault
.szHostsallow
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
},
860 {"allow hosts", P_LIST
, P_LOCAL
, &sDefault
.szHostsallow
, NULL
, NULL
, FLAG_HIDE
},
861 {"hosts deny", P_LIST
, P_LOCAL
, &sDefault
.szHostsdeny
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
},
862 {"deny hosts", P_LIST
, P_LOCAL
, &sDefault
.szHostsdeny
, NULL
, NULL
, FLAG_HIDE
},
863 {"preload modules", P_LIST
, P_GLOBAL
, &Globals
.szPreloadModules
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
},
865 {N_("Logging Options"), P_SEP
, P_SEPARATOR
},
867 {"log level", P_STRING
, P_GLOBAL
, &Globals
.szLogLevel
, handle_debug_list
, NULL
, FLAG_ADVANCED
},
868 {"debuglevel", P_STRING
, P_GLOBAL
, &Globals
.szLogLevel
, handle_debug_list
, NULL
, FLAG_HIDE
},
869 {"syslog", P_INTEGER
, P_GLOBAL
, &Globals
.syslog
, NULL
, NULL
, FLAG_ADVANCED
},
870 {"syslog only", P_BOOL
, P_GLOBAL
, &Globals
.bSyslogOnly
, NULL
, NULL
, FLAG_ADVANCED
},
871 {"log file", P_STRING
, P_GLOBAL
, &Globals
.szLogFile
, NULL
, NULL
, FLAG_ADVANCED
},
873 {"max log size", P_INTEGER
, P_GLOBAL
, &Globals
.max_log_size
, NULL
, NULL
, FLAG_ADVANCED
},
874 {"timestamp logs", P_BOOL
, P_GLOBAL
, &Globals
.bTimestampLogs
, NULL
, NULL
, FLAG_ADVANCED
},
875 {"debug timestamp", P_BOOL
, P_GLOBAL
, &Globals
.bTimestampLogs
, NULL
, NULL
, FLAG_ADVANCED
},
876 {"debug hires timestamp", P_BOOL
, P_GLOBAL
, &Globals
.bDebugHiresTimestamp
, NULL
, NULL
, FLAG_ADVANCED
},
877 {"debug pid", P_BOOL
, P_GLOBAL
, &Globals
.bDebugPid
, NULL
, NULL
, FLAG_ADVANCED
},
878 {"debug uid", P_BOOL
, P_GLOBAL
, &Globals
.bDebugUid
, NULL
, NULL
, FLAG_ADVANCED
},
880 {N_("Protocol Options"), P_SEP
, P_SEPARATOR
},
882 {"smb ports", P_STRING
, P_GLOBAL
, &Globals
.smb_ports
, NULL
, NULL
, FLAG_ADVANCED
},
883 {"protocol", P_ENUM
, P_GLOBAL
, &Globals
.maxprotocol
, NULL
, enum_protocol
, FLAG_ADVANCED
},
884 {"large readwrite", P_BOOL
, P_GLOBAL
, &Globals
.bLargeReadwrite
, NULL
, NULL
, FLAG_ADVANCED
},
885 {"max protocol", P_ENUM
, P_GLOBAL
, &Globals
.maxprotocol
, NULL
, enum_protocol
, FLAG_ADVANCED
},
886 {"min protocol", P_ENUM
, P_GLOBAL
, &Globals
.minprotocol
, NULL
, enum_protocol
, FLAG_ADVANCED
},
887 {"unicode", P_BOOL
, P_GLOBAL
, &Globals
.bUnicode
, NULL
, NULL
, FLAG_ADVANCED
},
888 {"read bmpx", P_BOOL
, P_GLOBAL
, &Globals
.bReadbmpx
, NULL
, NULL
, FLAG_ADVANCED
},
889 {"read raw", P_BOOL
, P_GLOBAL
, &Globals
.bReadRaw
, NULL
, NULL
, FLAG_ADVANCED
},
890 {"write raw", P_BOOL
, P_GLOBAL
, &Globals
.bWriteRaw
, NULL
, NULL
, FLAG_ADVANCED
},
891 {"disable netbios", P_BOOL
, P_GLOBAL
, &Globals
.bDisableNetbios
, NULL
, NULL
, FLAG_ADVANCED
},
893 {"acl compatibility", P_STRING
, P_GLOBAL
, &Globals
.szAclCompat
, handle_acl_compatibility
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
894 {"nt acl support", P_BOOL
, P_LOCAL
, &sDefault
.bNTAclSupport
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
895 {"nt pipe support", P_BOOL
, P_GLOBAL
, &Globals
.bNTPipeSupport
, NULL
, NULL
, FLAG_ADVANCED
},
896 {"nt status support", P_BOOL
, P_GLOBAL
, &Globals
.bNTStatusSupport
, NULL
, NULL
, FLAG_ADVANCED
},
897 {"profile acls", P_BOOL
, P_LOCAL
, &sDefault
.bProfileAcls
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
| FLAG_SHARE
},
899 {"announce version", P_STRING
, P_GLOBAL
, &Globals
.szAnnounceVersion
, NULL
, NULL
, FLAG_ADVANCED
},
900 {"announce as", P_ENUM
, P_GLOBAL
, &Globals
.announce_as
, NULL
, enum_announce_as
, FLAG_ADVANCED
},
901 {"map acl inherit", P_BOOL
, P_LOCAL
, &sDefault
.bMap_acl_inherit
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
902 {"afs share", P_BOOL
, P_LOCAL
, &sDefault
.bAfs_Share
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
903 {"max mux", P_INTEGER
, P_GLOBAL
, &Globals
.max_mux
, NULL
, NULL
, FLAG_ADVANCED
},
904 {"max xmit", P_INTEGER
, P_GLOBAL
, &Globals
.max_xmit
, NULL
, NULL
, FLAG_ADVANCED
},
906 {"name resolve order", P_STRING
, P_GLOBAL
, &Globals
.szNameResolveOrder
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_WIZARD
},
907 {"max ttl", P_INTEGER
, P_GLOBAL
, &Globals
.max_ttl
, NULL
, NULL
, FLAG_ADVANCED
},
908 {"max wins ttl", P_INTEGER
, P_GLOBAL
, &Globals
.max_wins_ttl
, NULL
, NULL
, FLAG_ADVANCED
},
909 {"min wins ttl", P_INTEGER
, P_GLOBAL
, &Globals
.min_wins_ttl
, NULL
, NULL
, FLAG_ADVANCED
},
910 {"time server", P_BOOL
, P_GLOBAL
, &Globals
.bTimeServer
, NULL
, NULL
, FLAG_ADVANCED
},
911 {"unix extensions", P_BOOL
, P_GLOBAL
, &Globals
.bUnixExtensions
, NULL
, NULL
, FLAG_ADVANCED
},
912 {"use spnego", P_BOOL
, P_GLOBAL
, &Globals
.bUseSpnego
, NULL
, NULL
, FLAG_ADVANCED
},
913 {"client signing", P_ENUM
, P_GLOBAL
, &Globals
.client_signing
, NULL
, enum_smb_signing_vals
, FLAG_ADVANCED
},
914 {"server signing", P_ENUM
, P_GLOBAL
, &Globals
.server_signing
, NULL
, enum_smb_signing_vals
, FLAG_ADVANCED
},
915 {"client use spnego", P_BOOL
, P_GLOBAL
, &Globals
.bClientUseSpnego
, NULL
, NULL
, FLAG_ADVANCED
},
917 {N_("Tuning Options"), P_SEP
, P_SEPARATOR
},
919 {"block size", P_INTEGER
, P_LOCAL
, &sDefault
.iBlock_size
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
920 {"change notify timeout", P_INTEGER
, P_GLOBAL
, &Globals
.change_notify_timeout
, NULL
, NULL
, FLAG_ADVANCED
},
921 {"deadtime", P_INTEGER
, P_GLOBAL
, &Globals
.deadtime
, NULL
, NULL
, FLAG_ADVANCED
},
922 {"getwd cache", P_BOOL
, P_GLOBAL
, &use_getwd_cache
, NULL
, NULL
, FLAG_ADVANCED
},
923 {"keepalive", P_INTEGER
, P_GLOBAL
, &keepalive
, NULL
, NULL
, FLAG_ADVANCED
},
924 {"kernel change notify", P_BOOL
, P_GLOBAL
, &Globals
.bKernelChangeNotify
, NULL
, NULL
, FLAG_ADVANCED
},
926 {"lpq cache time", P_INTEGER
, P_GLOBAL
, &Globals
.lpqcachetime
, NULL
, NULL
, FLAG_ADVANCED
},
927 {"max smbd processes", P_INTEGER
, P_GLOBAL
, &Globals
.iMaxSmbdProcesses
, NULL
, NULL
, FLAG_ADVANCED
},
928 {"max connections", P_INTEGER
, P_LOCAL
, &sDefault
.iMaxConnections
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
929 {"paranoid server security", P_BOOL
, P_GLOBAL
, &Globals
.paranoid_server_security
, NULL
, NULL
, FLAG_ADVANCED
},
930 {"max disk size", P_INTEGER
, P_GLOBAL
, &Globals
.maxdisksize
, NULL
, NULL
, FLAG_ADVANCED
},
931 {"max open files", P_INTEGER
, P_GLOBAL
, &Globals
.max_open_files
, NULL
, NULL
, FLAG_ADVANCED
},
932 {"min print space", P_INTEGER
, P_LOCAL
, &sDefault
.iMinPrintSpace
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
},
933 {"read size", P_INTEGER
, P_GLOBAL
, &Globals
.ReadSize
, NULL
, NULL
, FLAG_ADVANCED
},
935 {"socket options", P_GSTRING
, P_GLOBAL
, user_socket_options
, NULL
, NULL
, FLAG_ADVANCED
},
936 {"strict allocate", P_BOOL
, P_LOCAL
, &sDefault
.bStrictAllocate
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
937 {"strict sync", P_BOOL
, P_LOCAL
, &sDefault
.bStrictSync
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
938 {"sync always", P_BOOL
, P_LOCAL
, &sDefault
.bSyncAlways
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
939 {"use mmap", P_BOOL
, P_GLOBAL
, &Globals
.bUseMmap
, NULL
, NULL
, FLAG_ADVANCED
},
940 {"use sendfile", P_BOOL
, P_LOCAL
, &sDefault
.bUseSendfile
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
941 {"hostname lookups", P_BOOL
, P_GLOBAL
, &Globals
.bHostnameLookups
, NULL
, NULL
, FLAG_ADVANCED
},
942 {"write cache size", P_INTEGER
, P_LOCAL
, &sDefault
.iWriteCacheSize
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
944 {"name cache timeout", P_INTEGER
, P_GLOBAL
, &Globals
.name_cache_timeout
, NULL
, NULL
, FLAG_ADVANCED
},
946 {N_("Printing Options"), P_SEP
, P_SEPARATOR
},
948 {"max reported print jobs", P_INTEGER
, P_LOCAL
, &sDefault
.iMaxReportedPrintJobs
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
},
949 {"max print jobs", P_INTEGER
, P_LOCAL
, &sDefault
.iMaxPrintJobs
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
},
950 {"load printers", P_BOOL
, P_GLOBAL
, &Globals
.bLoadPrinters
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
},
951 {"printcap name", P_STRING
, P_GLOBAL
, &Globals
.szPrintcapname
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
},
952 {"printcap", P_STRING
, P_GLOBAL
, &Globals
.szPrintcapname
, NULL
, NULL
, FLAG_HIDE
},
953 {"printable", P_BOOL
, P_LOCAL
, &sDefault
.bPrint_ok
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
},
954 {"print ok", P_BOOL
, P_LOCAL
, &sDefault
.bPrint_ok
, NULL
, NULL
, FLAG_HIDE
},
955 {"printing", P_ENUM
, P_LOCAL
, &sDefault
.iPrinting
, NULL
, enum_printing
, FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
},
956 {"print command", P_STRING
, P_LOCAL
, &sDefault
.szPrintcommand
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
},
957 {"disable spoolss", P_BOOL
, P_GLOBAL
, &Globals
.bDisableSpoolss
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
},
958 {"lpq command", P_STRING
, P_LOCAL
, &sDefault
.szLpqcommand
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
},
959 {"lprm command", P_STRING
, P_LOCAL
, &sDefault
.szLprmcommand
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
},
960 {"lppause command", P_STRING
, P_LOCAL
, &sDefault
.szLppausecommand
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
},
961 {"lpresume command", P_STRING
, P_LOCAL
, &sDefault
.szLpresumecommand
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
},
962 {"queuepause command", P_STRING
, P_LOCAL
, &sDefault
.szQueuepausecommand
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
},
963 {"queueresume command", P_STRING
, P_LOCAL
, &sDefault
.szQueueresumecommand
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
| FLAG_GLOBAL
},
965 {"enumports command", P_STRING
, P_GLOBAL
, &Globals
.szEnumPortsCommand
, NULL
, NULL
, FLAG_ADVANCED
},
966 {"addprinter command", P_STRING
, P_GLOBAL
, &Globals
.szAddPrinterCommand
, NULL
, NULL
, FLAG_ADVANCED
},
967 {"deleteprinter command", P_STRING
, P_GLOBAL
, &Globals
.szDeletePrinterCommand
, NULL
, NULL
, FLAG_ADVANCED
},
968 {"show add printer wizard", P_BOOL
, P_GLOBAL
, &Globals
.bMsAddPrinterWizard
, NULL
, NULL
, FLAG_ADVANCED
},
969 {"os2 driver map", P_STRING
, P_GLOBAL
, &Globals
.szOs2DriverMap
, NULL
, NULL
, FLAG_ADVANCED
},
971 {"printer name", P_STRING
, P_LOCAL
, &sDefault
.szPrintername
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
},
972 {"printer", P_STRING
, P_LOCAL
, &sDefault
.szPrintername
, NULL
, NULL
, FLAG_HIDE
},
973 {"use client driver", P_BOOL
, P_LOCAL
, &sDefault
.bUseClientDriver
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
},
974 {"default devmode", P_BOOL
, P_LOCAL
, &sDefault
.bDefaultDevmode
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_PRINT
},
976 {N_("Filename Handling"), P_SEP
, P_SEPARATOR
},
977 {"mangling method", P_STRING
, P_GLOBAL
, &Globals
.szManglingMethod
, NULL
, NULL
, FLAG_ADVANCED
},
978 {"mangle prefix", P_INTEGER
, P_GLOBAL
, &Globals
.mangle_prefix
, NULL
, NULL
, FLAG_ADVANCED
},
980 {"default case", P_ENUM
, P_LOCAL
, &sDefault
.iDefaultCase
, NULL
, enum_case
, FLAG_ADVANCED
| FLAG_SHARE
},
981 {"case sensitive", P_BOOL
, P_LOCAL
, &sDefault
.bCaseSensitive
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
982 {"casesignames", P_BOOL
, P_LOCAL
, &sDefault
.bCaseSensitive
, NULL
, NULL
, FLAG_HIDE
},
983 {"preserve case", P_BOOL
, P_LOCAL
, &sDefault
.bCasePreserve
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
984 {"short preserve case", P_BOOL
, P_LOCAL
, &sDefault
.bShortCasePreserve
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
985 {"mangle case", P_BOOL
, P_LOCAL
, &sDefault
.bCaseMangle
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
986 {"mangling char", P_CHAR
, P_LOCAL
, &sDefault
.magic_char
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
987 {"hide dot files", P_BOOL
, P_LOCAL
, &sDefault
.bHideDotFiles
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
988 {"hide special files", P_BOOL
, P_LOCAL
, &sDefault
.bHideSpecialFiles
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
989 {"hide unreadable", P_BOOL
, P_LOCAL
, &sDefault
.bHideUnReadable
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
990 {"hide unwriteable files", P_BOOL
, P_LOCAL
, &sDefault
.bHideUnWriteableFiles
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
991 {"delete veto files", P_BOOL
, P_LOCAL
, &sDefault
.bDeleteVetoFiles
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
992 {"veto files", P_STRING
, P_LOCAL
, &sDefault
.szVetoFiles
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
993 {"hide files", P_STRING
, P_LOCAL
, &sDefault
.szHideFiles
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
994 {"veto oplock files", P_STRING
, P_LOCAL
, &sDefault
.szVetoOplockFiles
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
995 {"map system", P_BOOL
, P_LOCAL
, &sDefault
.bMap_system
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
996 {"map hidden", P_BOOL
, P_LOCAL
, &sDefault
.bMap_hidden
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
997 {"map archive", P_BOOL
, P_LOCAL
, &sDefault
.bMap_archive
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
998 {"mangled names", P_BOOL
, P_LOCAL
, &sDefault
.bMangledNames
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
999 {"mangled map", P_STRING
, P_LOCAL
, &sDefault
.szMangledMap
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DEPRECATED
},
1000 {"stat cache", P_BOOL
, P_GLOBAL
, &Globals
.bStatCache
, NULL
, NULL
, FLAG_ADVANCED
},
1002 {N_("Domain Options"), P_SEP
, P_SEPARATOR
},
1004 {"machine password timeout", P_INTEGER
, P_GLOBAL
, &Globals
.machine_password_timeout
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_WIZARD
},
1006 {N_("Logon Options"), P_SEP
, P_SEPARATOR
},
1008 {"add user script", P_STRING
, P_GLOBAL
, &Globals
.szAddUserScript
, NULL
, NULL
, FLAG_ADVANCED
},
1009 {"delete user script", P_STRING
, P_GLOBAL
, &Globals
.szDelUserScript
, NULL
, NULL
, FLAG_ADVANCED
},
1010 {"add group script", P_STRING
, P_GLOBAL
, &Globals
.szAddGroupScript
, NULL
, NULL
, FLAG_ADVANCED
},
1011 {"delete group script", P_STRING
, P_GLOBAL
, &Globals
.szDelGroupScript
, NULL
, NULL
, FLAG_ADVANCED
},
1012 {"add user to group script", P_STRING
, P_GLOBAL
, &Globals
.szAddUserToGroupScript
, NULL
, NULL
, FLAG_ADVANCED
},
1013 {"delete user from group script", P_STRING
, P_GLOBAL
, &Globals
.szDelUserFromGroupScript
, NULL
, NULL
, FLAG_ADVANCED
},
1014 {"set primary group script", P_STRING
, P_GLOBAL
, &Globals
.szSetPrimaryGroupScript
, NULL
, NULL
, FLAG_ADVANCED
},
1015 {"add machine script", P_STRING
, P_GLOBAL
, &Globals
.szAddMachineScript
, NULL
, NULL
, FLAG_ADVANCED
},
1016 {"shutdown script", P_STRING
, P_GLOBAL
, &Globals
.szShutdownScript
, NULL
, NULL
, FLAG_ADVANCED
},
1017 {"abort shutdown script", P_STRING
, P_GLOBAL
, &Globals
.szAbortShutdownScript
, NULL
, NULL
, FLAG_ADVANCED
},
1019 {"logon script", P_STRING
, P_GLOBAL
, &Globals
.szLogonScript
, NULL
, NULL
, FLAG_ADVANCED
},
1020 {"logon path", P_STRING
, P_GLOBAL
, &Globals
.szLogonPath
, NULL
, NULL
, FLAG_ADVANCED
},
1021 {"logon drive", P_STRING
, P_GLOBAL
, &Globals
.szLogonDrive
, NULL
, NULL
, FLAG_ADVANCED
},
1022 {"logon home", P_STRING
, P_GLOBAL
, &Globals
.szLogonHome
, NULL
, NULL
, FLAG_ADVANCED
},
1023 {"domain logons", P_BOOL
, P_GLOBAL
, &Globals
.bDomainLogons
, NULL
, NULL
, FLAG_ADVANCED
},
1025 {N_("Browse Options"), P_SEP
, P_SEPARATOR
},
1027 {"os level", P_INTEGER
, P_GLOBAL
, &Globals
.os_level
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
},
1028 {"lm announce", P_ENUM
, P_GLOBAL
, &Globals
.lm_announce
, NULL
, enum_bool_auto
, FLAG_ADVANCED
},
1029 {"lm interval", P_INTEGER
, P_GLOBAL
, &Globals
.lm_interval
, NULL
, NULL
, FLAG_ADVANCED
},
1030 {"preferred master", P_ENUM
, P_GLOBAL
, &Globals
.bPreferredMaster
, NULL
, enum_bool_auto
, FLAG_BASIC
| FLAG_ADVANCED
},
1031 {"prefered master", P_ENUM
, P_GLOBAL
, &Globals
.bPreferredMaster
, NULL
, enum_bool_auto
, FLAG_HIDE
},
1032 {"local master", P_BOOL
, P_GLOBAL
, &Globals
.bLocalMaster
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
},
1033 {"domain master", P_ENUM
, P_GLOBAL
, &Globals
.bDomainMaster
, NULL
, enum_bool_auto
, FLAG_BASIC
| FLAG_ADVANCED
},
1034 {"browse list", P_BOOL
, P_GLOBAL
, &Globals
.bBrowseList
, NULL
, NULL
, FLAG_ADVANCED
},
1035 {"browseable", P_BOOL
, P_LOCAL
, &sDefault
.bBrowseable
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
},
1036 {"browsable", P_BOOL
, P_LOCAL
, &sDefault
.bBrowseable
, NULL
, NULL
, FLAG_HIDE
},
1037 {"enhanced browsing", P_BOOL
, P_GLOBAL
, &Globals
.enhanced_browsing
, NULL
, NULL
, FLAG_ADVANCED
},
1039 {N_("WINS Options"), P_SEP
, P_SEPARATOR
},
1041 {"dns proxy", P_BOOL
, P_GLOBAL
, &Globals
.bDNSproxy
, NULL
, NULL
, FLAG_ADVANCED
},
1042 {"wins proxy", P_BOOL
, P_GLOBAL
, &Globals
.bWINSproxy
, NULL
, NULL
, FLAG_ADVANCED
},
1044 {"wins server", P_LIST
, P_GLOBAL
, &Globals
.szWINSservers
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
},
1045 {"wins support", P_BOOL
, P_GLOBAL
, &Globals
.bWINSsupport
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_WIZARD
},
1046 {"wins hook", P_STRING
, P_GLOBAL
, &Globals
.szWINSHook
, NULL
, NULL
, FLAG_ADVANCED
},
1047 {"wins partners", P_STRING
, P_GLOBAL
, &Globals
.szWINSPartners
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_WIZARD
},
1049 {N_("Locking Options"), P_SEP
, P_SEPARATOR
},
1051 {"blocking locks", P_BOOL
, P_LOCAL
, &sDefault
.bBlockingLocks
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1052 {"csc policy", P_ENUM
, P_LOCAL
, &sDefault
.iCSCPolicy
, NULL
, enum_csc_policy
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1053 {"fake oplocks", P_BOOL
, P_LOCAL
, &sDefault
.bFakeOplocks
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
1054 {"kernel oplocks", P_BOOL
, P_GLOBAL
, &Globals
.bKernelOplocks
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
},
1055 {"locking", P_BOOL
, P_LOCAL
, &sDefault
.bLocking
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1056 {"lock spin count", P_INTEGER
, P_GLOBAL
, &Globals
.iLockSpinCount
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
},
1057 {"lock spin time", P_INTEGER
, P_GLOBAL
, &Globals
.iLockSpinTime
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
},
1059 {"oplocks", P_BOOL
, P_LOCAL
, &sDefault
.bOpLocks
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1060 {"level2 oplocks", P_BOOL
, P_LOCAL
, &sDefault
.bLevel2OpLocks
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1061 {"oplock break wait time", P_INTEGER
, P_GLOBAL
, &Globals
.oplock_break_wait_time
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_GLOBAL
},
1062 {"oplock contention limit", P_INTEGER
, P_LOCAL
, &sDefault
.iOplockContentionLimit
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1063 {"posix locking", P_BOOL
, P_LOCAL
, &sDefault
.bPosixLocking
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1064 {"strict locking", P_BOOL
, P_LOCAL
, &sDefault
.bStrictLocking
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1065 {"share modes", P_BOOL
, P_LOCAL
, &sDefault
.bShareModes
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1067 {N_("Ldap Options"), P_SEP
, P_SEPARATOR
},
1069 #ifdef WITH_LDAP_SAMCONFIG
1070 {"ldap server", P_STRING
, P_GLOBAL
, &Globals
.szLdapServer
, NULL
, NULL
, FLAG_ADVANCED
},
1071 {"ldap port", P_INTEGER
, P_GLOBAL
, &Globals
.ldap_port
, NULL
, NULL
, FLAG_ADVANCED
},
1073 {"ldap suffix", P_STRING
, P_GLOBAL
, &Globals
.szLdapSuffix
, NULL
, NULL
, FLAG_ADVANCED
},
1074 {"ldap machine suffix", P_STRING
, P_GLOBAL
, &Globals
.szLdapMachineSuffix
, NULL
, NULL
, FLAG_ADVANCED
},
1075 {"ldap user suffix", P_STRING
, P_GLOBAL
, &Globals
.szLdapUserSuffix
, NULL
, NULL
, FLAG_ADVANCED
},
1076 {"ldap group suffix", P_STRING
, P_GLOBAL
, &Globals
.szLdapGroupSuffix
, NULL
, NULL
, FLAG_ADVANCED
},
1077 {"ldap idmap suffix", P_STRING
, P_GLOBAL
, &Globals
.szLdapIdmapSuffix
, NULL
, NULL
, FLAG_ADVANCED
},
1078 {"ldap filter", P_STRING
, P_GLOBAL
, &Globals
.szLdapFilter
, NULL
, NULL
, FLAG_ADVANCED
},
1079 {"ldap admin dn", P_STRING
, P_GLOBAL
, &Globals
.szLdapAdminDn
, NULL
, NULL
, FLAG_ADVANCED
},
1080 {"ldap ssl", P_ENUM
, P_GLOBAL
, &Globals
.ldap_ssl
, NULL
, enum_ldap_ssl
, FLAG_ADVANCED
},
1081 {"ldap passwd sync", P_ENUM
, P_GLOBAL
, &Globals
.ldap_passwd_sync
, NULL
, enum_ldap_passwd_sync
, FLAG_ADVANCED
},
1082 {"ldap delete dn", P_BOOL
, P_GLOBAL
, &Globals
.ldap_delete_dn
, NULL
, NULL
, FLAG_ADVANCED
},
1083 {"ldap replication sleep", P_INTEGER
, P_GLOBAL
, &Globals
.ldap_replication_sleep
, NULL
, NULL
, FLAG_ADVANCED
},
1085 {N_("Miscellaneous Options"), P_SEP
, P_SEPARATOR
},
1086 {"add share command", P_STRING
, P_GLOBAL
, &Globals
.szAddShareCommand
, NULL
, NULL
, FLAG_ADVANCED
},
1087 {"change share command", P_STRING
, P_GLOBAL
, &Globals
.szChangeShareCommand
, NULL
, NULL
, FLAG_ADVANCED
},
1088 {"delete share command", P_STRING
, P_GLOBAL
, &Globals
.szDeleteShareCommand
, NULL
, NULL
, FLAG_ADVANCED
},
1090 {"config file", P_STRING
, P_GLOBAL
, &Globals
.szConfigFile
, NULL
, NULL
, FLAG_HIDE
},
1091 {"preload", P_STRING
, P_GLOBAL
, &Globals
.szAutoServices
, NULL
, NULL
, FLAG_ADVANCED
},
1092 {"auto services", P_STRING
, P_GLOBAL
, &Globals
.szAutoServices
, NULL
, NULL
, FLAG_ADVANCED
},
1093 {"lock directory", P_STRING
, P_GLOBAL
, &Globals
.szLockDir
, NULL
, NULL
, FLAG_ADVANCED
},
1094 {"lock dir", P_STRING
, P_GLOBAL
, &Globals
.szLockDir
, NULL
, NULL
, FLAG_HIDE
},
1095 {"pid directory", P_STRING
, P_GLOBAL
, &Globals
.szPidDir
, NULL
, NULL
, FLAG_ADVANCED
},
1097 {"utmp directory", P_STRING
, P_GLOBAL
, &Globals
.szUtmpDir
, NULL
, NULL
, FLAG_ADVANCED
},
1098 {"wtmp directory", P_STRING
, P_GLOBAL
, &Globals
.szWtmpDir
, NULL
, NULL
, FLAG_ADVANCED
},
1099 {"utmp", P_BOOL
, P_GLOBAL
, &Globals
.bUtmp
, NULL
, NULL
, FLAG_ADVANCED
},
1102 {"default service", P_STRING
, P_GLOBAL
, &Globals
.szDefaultService
, NULL
, NULL
, FLAG_ADVANCED
},
1103 {"default", P_STRING
, P_GLOBAL
, &Globals
.szDefaultService
, NULL
, NULL
, FLAG_ADVANCED
},
1104 {"message command", P_STRING
, P_GLOBAL
, &Globals
.szMsgCommand
, NULL
, NULL
, FLAG_ADVANCED
},
1105 {"dfree command", P_STRING
, P_GLOBAL
, &Globals
.szDfree
, NULL
, NULL
, FLAG_ADVANCED
},
1106 {"get quota command", P_STRING
, P_GLOBAL
, &Globals
.szGetQuota
, NULL
, NULL
, FLAG_ADVANCED
},
1107 {"set quota command", P_STRING
, P_GLOBAL
, &Globals
.szSetQuota
, NULL
, NULL
, FLAG_ADVANCED
},
1108 {"remote announce", P_STRING
, P_GLOBAL
, &Globals
.szRemoteAnnounce
, NULL
, NULL
, FLAG_ADVANCED
},
1109 {"remote browse sync", P_STRING
, P_GLOBAL
, &Globals
.szRemoteBrowseSync
, NULL
, NULL
, FLAG_ADVANCED
},
1110 {"socket address", P_STRING
, P_GLOBAL
, &Globals
.szSocketAddress
, NULL
, NULL
, FLAG_ADVANCED
},
1111 {"homedir map", P_STRING
, P_GLOBAL
, &Globals
.szNISHomeMapName
, NULL
, NULL
, FLAG_ADVANCED
},
1112 {"afs username map", P_USTRING
, P_GLOBAL
, &Globals
.szAfsUsernameMap
, NULL
, NULL
, FLAG_ADVANCED
},
1113 {"time offset", P_INTEGER
, P_GLOBAL
, &extra_time_offset
, NULL
, NULL
, FLAG_ADVANCED
},
1114 {"NIS homedir", P_BOOL
, P_GLOBAL
, &Globals
.bNISHomeMap
, NULL
, NULL
, FLAG_ADVANCED
},
1115 {"-valid", P_BOOL
, P_LOCAL
, &sDefault
.valid
, NULL
, NULL
, FLAG_HIDE
},
1117 {"copy", P_STRING
, P_LOCAL
, &sDefault
.szCopy
, handle_copy
, NULL
, FLAG_HIDE
},
1118 {"include", P_STRING
, P_LOCAL
, &sDefault
.szInclude
, handle_include
, NULL
, FLAG_HIDE
},
1119 {"exec", P_STRING
, P_LOCAL
, &sDefault
.szPreExec
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
},
1120 {"preexec", P_STRING
, P_LOCAL
, &sDefault
.szPreExec
, NULL
, NULL
, FLAG_ADVANCED
},
1122 {"preexec close", P_BOOL
, P_LOCAL
, &sDefault
.bPreexecClose
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
1123 {"postexec", P_STRING
, P_LOCAL
, &sDefault
.szPostExec
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
},
1124 {"root preexec", P_STRING
, P_LOCAL
, &sDefault
.szRootPreExec
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
},
1125 {"root preexec close", P_BOOL
, P_LOCAL
, &sDefault
.bRootpreexecClose
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
1126 {"root postexec", P_STRING
, P_LOCAL
, &sDefault
.szRootPostExec
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
},
1127 {"available", P_BOOL
, P_LOCAL
, &sDefault
.bAvailable
, NULL
, NULL
, FLAG_BASIC
| FLAG_ADVANCED
| FLAG_SHARE
| FLAG_PRINT
},
1128 {"volume", P_STRING
, P_LOCAL
, &sDefault
.volume
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
1129 {"fstype", P_STRING
, P_LOCAL
, &sDefault
.fstype
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
1130 {"set directory", P_BOOLREV
, P_LOCAL
, &sDefault
.bNo_set_dir
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
1131 {"source environment", P_STRING
, P_GLOBAL
, &Globals
.szSourceEnv
, handle_source_env
, NULL
, FLAG_ADVANCED
},
1132 {"wide links", P_BOOL
, P_LOCAL
, &sDefault
.bWidelinks
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1133 {"follow symlinks", P_BOOL
, P_LOCAL
, &sDefault
.bSymlinks
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1134 {"dont descend", P_STRING
, P_LOCAL
, &sDefault
.szDontdescend
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
1135 {"magic script", P_STRING
, P_LOCAL
, &sDefault
.szMagicScript
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
1136 {"magic output", P_STRING
, P_LOCAL
, &sDefault
.szMagicOutput
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
1137 {"delete readonly", P_BOOL
, P_LOCAL
, &sDefault
.bDeleteReadonly
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1138 {"dos filemode", P_BOOL
, P_LOCAL
, &sDefault
.bDosFilemode
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1139 {"dos filetimes", P_BOOL
, P_LOCAL
, &sDefault
.bDosFiletimes
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1140 {"dos filetime resolution", P_BOOL
, P_LOCAL
, &sDefault
.bDosFiletimeResolution
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1142 {"fake directory create times", P_BOOL
, P_LOCAL
, &sDefault
.bFakeDirCreateTimes
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
| FLAG_GLOBAL
},
1143 {"panic action", P_STRING
, P_GLOBAL
, &Globals
.szPanicAction
, NULL
, NULL
, FLAG_ADVANCED
},
1145 {N_("VFS module options"), P_SEP
, P_SEPARATOR
},
1147 {"vfs objects", P_LIST
, P_LOCAL
, &sDefault
.szVfsObjects
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
1148 {"vfs object", P_LIST
, P_LOCAL
, &sDefault
.szVfsObjects
, NULL
, NULL
, FLAG_HIDE
},
1151 {"msdfs root", P_BOOL
, P_LOCAL
, &sDefault
.bMSDfsRoot
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
1152 {"msdfs proxy", P_STRING
, P_LOCAL
, &sDefault
.szMSDfsProxy
, NULL
, NULL
, FLAG_ADVANCED
| FLAG_SHARE
},
1153 {"host msdfs", P_BOOL
, P_GLOBAL
, &Globals
.bHostMSDfs
, NULL
, NULL
, FLAG_ADVANCED
},
1155 {N_("Winbind options"), P_SEP
, P_SEPARATOR
},
1157 {"enable rid algorithm", P_BOOL
, P_GLOBAL
, &Globals
.bEnableRidAlgorithm
, NULL
, NULL
, FLAG_DEPRECATED
},
1158 {"idmap backend", P_STRING
, P_GLOBAL
, &Globals
.szIdmapBackend
, NULL
, NULL
, FLAG_ADVANCED
},
1159 {"idmap uid", P_STRING
, P_GLOBAL
, &Globals
.szIdmapUID
, handle_idmap_uid
, NULL
, FLAG_ADVANCED
},
1160 {"winbind uid", P_STRING
, P_GLOBAL
, &Globals
.szIdmapUID
, handle_idmap_uid
, NULL
, FLAG_HIDE
},
1161 {"idmap gid", P_STRING
, P_GLOBAL
, &Globals
.szIdmapGID
, handle_idmap_gid
, NULL
, FLAG_ADVANCED
},
1162 {"winbind gid", P_STRING
, P_GLOBAL
, &Globals
.szIdmapGID
, handle_idmap_gid
, NULL
, FLAG_HIDE
},
1163 {"template primary group", P_STRING
, P_GLOBAL
, &Globals
.szTemplatePrimaryGroup
, NULL
, NULL
, FLAG_ADVANCED
},
1164 {"template homedir", P_STRING
, P_GLOBAL
, &Globals
.szTemplateHomedir
, NULL
, NULL
, FLAG_ADVANCED
},
1165 {"template shell", P_STRING
, P_GLOBAL
, &Globals
.szTemplateShell
, NULL
, NULL
, FLAG_ADVANCED
},
1166 {"winbind separator", P_STRING
, P_GLOBAL
, &Globals
.szWinbindSeparator
, NULL
, NULL
, FLAG_ADVANCED
},
1167 {"winbind cache time", P_INTEGER
, P_GLOBAL
, &Globals
.winbind_cache_time
, NULL
, NULL
, FLAG_ADVANCED
},
1168 {"winbind enable local accounts", P_BOOL
, P_GLOBAL
, &Globals
.bWinbindEnableLocalAccounts
, NULL
, NULL
, FLAG_ADVANCED
},
1169 {"winbind enum users", P_BOOL
, P_GLOBAL
, &Globals
.bWinbindEnumUsers
, NULL
, NULL
, FLAG_ADVANCED
},
1170 {"winbind enum groups", P_BOOL
, P_GLOBAL
, &Globals
.bWinbindEnumGroups
, NULL
, NULL
, FLAG_ADVANCED
},
1171 {"winbind use default domain", P_BOOL
, P_GLOBAL
, &Globals
.bWinbindUseDefaultDomain
, NULL
, NULL
, FLAG_ADVANCED
},
1172 {"winbind trusted domains only", P_BOOL
, P_GLOBAL
, &Globals
.bWinbindTrustedDomainsOnly
, NULL
, NULL
, FLAG_ADVANCED
},
1174 {NULL
, P_BOOL
, P_NONE
, NULL
, NULL
, NULL
, 0}
1177 /***************************************************************************
1178 Initialise the sDefault parameter structure for the printer values.
1179 ***************************************************************************/
1181 static void init_printer_values(void)
1183 /* choose defaults depending on the type of printing */
1184 switch (sDefault
.iPrinting
) {
1189 string_set(&sDefault
.szLpqcommand
, "lpq -P'%p'");
1190 string_set(&sDefault
.szLprmcommand
, "lprm -P'%p' %j");
1191 string_set(&sDefault
.szPrintcommand
,
1192 "lpr -r -P'%p' %s");
1197 string_set(&sDefault
.szLpqcommand
, "lpq -P'%p'");
1198 string_set(&sDefault
.szLprmcommand
, "lprm -P'%p' %j");
1199 string_set(&sDefault
.szPrintcommand
,
1200 "lpr -r -P'%p' %s");
1201 string_set(&sDefault
.szQueuepausecommand
,
1203 string_set(&sDefault
.szQueueresumecommand
,
1205 string_set(&sDefault
.szLppausecommand
,
1206 "lpc hold '%p' %j");
1207 string_set(&sDefault
.szLpresumecommand
,
1208 "lpc release '%p' %j");
1213 string_set(&sDefault
.szLpqcommand
, "");
1214 string_set(&sDefault
.szLprmcommand
, "");
1215 string_set(&sDefault
.szPrintcommand
, "");
1216 string_set(&sDefault
.szLppausecommand
, "");
1217 string_set(&sDefault
.szLpresumecommand
, "");
1218 string_set(&sDefault
.szQueuepausecommand
, "");
1219 string_set(&sDefault
.szQueueresumecommand
, "");
1221 string_set(&Globals
.szPrintcapname
, "cups");
1223 string_set(&sDefault
.szLpqcommand
,
1224 "/usr/bin/lpstat -o '%p'");
1225 string_set(&sDefault
.szLprmcommand
,
1226 "/usr/bin/cancel '%p-%j'");
1227 string_set(&sDefault
.szPrintcommand
,
1228 "/usr/bin/lp -d '%p' %s; rm %s");
1229 string_set(&sDefault
.szLppausecommand
,
1230 "lp -i '%p-%j' -H hold");
1231 string_set(&sDefault
.szLpresumecommand
,
1232 "lp -i '%p-%j' -H resume");
1233 string_set(&sDefault
.szQueuepausecommand
,
1234 "/usr/bin/disable '%p'");
1235 string_set(&sDefault
.szQueueresumecommand
,
1236 "/usr/bin/enable '%p'");
1237 string_set(&Globals
.szPrintcapname
, "lpstat");
1238 #endif /* HAVE_CUPS */
1243 string_set(&sDefault
.szLpqcommand
, "lpstat -o%p");
1244 string_set(&sDefault
.szLprmcommand
, "cancel %p-%j");
1245 string_set(&sDefault
.szPrintcommand
,
1246 "lp -c -d%p %s; rm %s");
1247 string_set(&sDefault
.szQueuepausecommand
,
1249 string_set(&sDefault
.szQueueresumecommand
,
1252 string_set(&sDefault
.szLppausecommand
,
1253 "lp -i %p-%j -H hold");
1254 string_set(&sDefault
.szLpresumecommand
,
1255 "lp -i %p-%j -H resume");
1260 string_set(&sDefault
.szLpqcommand
, "lpq -P%p");
1261 string_set(&sDefault
.szLprmcommand
, "lprm -P%p %j");
1262 string_set(&sDefault
.szPrintcommand
, "lp -r -P%p %s");
1268 string_set(&sDefault
.szPrintcommand
, "vlp print %p %s");
1269 string_set(&sDefault
.szLpqcommand
, "vlp lpq %p");
1270 string_set(&sDefault
.szLprmcommand
, "vlp lprm %p %j");
1271 string_set(&sDefault
.szLppausecommand
, "vlp lppause %p %j");
1272 string_set(&sDefault
.szLpresumecommand
, "vlp lpresum %p %j");
1273 string_set(&sDefault
.szQueuepausecommand
, "vlp queuepause %p");
1274 string_set(&sDefault
.szQueueresumecommand
, "vlp queueresume %p");
1276 #endif /* DEVELOPER */
1281 /***************************************************************************
1282 Initialise the global parameter structure.
1283 ***************************************************************************/
1285 static void init_globals(void)
1287 static BOOL done_init
= False
;
1292 memset((void *)&Globals
, '\0', sizeof(Globals
));
1294 for (i
= 0; parm_table
[i
].label
; i
++)
1295 if ((parm_table
[i
].type
== P_STRING
||
1296 parm_table
[i
].type
== P_USTRING
) &&
1298 string_set(parm_table
[i
].ptr
, "");
1300 string_set(&sDefault
.fstype
, FSTYPE_STRING
);
1302 init_printer_values();
1308 DEBUG(3, ("Initialising global parameters\n"));
1310 string_set(&Globals
.szSMBPasswdFile
, dyn_SMB_PASSWD_FILE
);
1311 string_set(&Globals
.szPrivateDir
, dyn_PRIVATE_DIR
);
1313 /* use the new 'hash2' method by default, with a prefix of 1 */
1314 string_set(&Globals
.szManglingMethod
, "hash2");
1315 Globals
.mangle_prefix
= 1;
1317 string_set(&Globals
.szGuestaccount
, GUEST_ACCOUNT
);
1319 /* using UTF8 by default allows us to support all chars */
1320 string_set(&Globals
.unix_charset
, DEFAULT_UNIX_CHARSET
);
1322 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
1323 /* If the system supports nl_langinfo(), try to grab the value
1324 from the user's locale */
1325 string_set(&Globals
.display_charset
, "LOCALE");
1327 string_set(&Globals
.display_charset
, DEFAULT_DISPLAY_CHARSET
);
1330 /* Use codepage 850 as a default for the dos character set */
1331 string_set(&Globals
.dos_charset
, DEFAULT_DOS_CHARSET
);
1334 * Allow the default PASSWD_CHAT to be overridden in local.h.
1336 string_set(&Globals
.szPasswdChat
, DEFAULT_PASSWD_CHAT
);
1338 set_global_myname(myhostname());
1339 string_set(&Globals
.szNetbiosName
,global_myname());
1341 set_global_myworkgroup(WORKGROUP
);
1342 string_set(&Globals
.szWorkgroup
, lp_workgroup());
1344 string_set(&Globals
.szPasswdProgram
, "");
1345 string_set(&Globals
.szPrintcapname
, PRINTCAP_NAME
);
1346 string_set(&Globals
.szPidDir
, dyn_PIDDIR
);
1347 string_set(&Globals
.szLockDir
, dyn_LOCKDIR
);
1348 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
1349 pstrcpy(s
, "Samba ");
1350 pstrcat(s
, SAMBA_VERSION_STRING
);
1351 string_set(&Globals
.szServerString
, s
);
1352 slprintf(s
, sizeof(s
) - 1, "%d.%d", DEFAULT_MAJOR_VERSION
,
1353 DEFAULT_MINOR_VERSION
);
1354 string_set(&Globals
.szAnnounceVersion
, s
);
1356 pstrcpy(user_socket_options
, DEFAULT_SOCKET_OPTIONS
);
1358 string_set(&Globals
.szLogonDrive
, "");
1359 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
1360 string_set(&Globals
.szLogonHome
, "\\\\%N\\%U");
1361 string_set(&Globals
.szLogonPath
, "\\\\%N\\%U\\profile");
1363 string_set(&Globals
.szNameResolveOrder
, "lmhosts wins host bcast");
1364 string_set(&Globals
.szPasswordServer
, "*");
1366 Globals
.AlgorithmicRidBase
= BASE_RID
;
1368 Globals
.bLoadPrinters
= True
;
1369 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
1370 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
1371 Globals
.max_xmit
= 0x4104;
1372 Globals
.max_mux
= 50; /* This is *needed* for profile support. */
1373 Globals
.lpqcachetime
= 10;
1374 Globals
.bDisableSpoolss
= False
;
1375 Globals
.iMaxSmbdProcesses
= 0;/* no limit specified */
1376 Globals
.iTotalPrintJobs
= 0; /* no limit specified */
1377 Globals
.pwordlevel
= 0;
1378 Globals
.unamelevel
= 0;
1379 Globals
.deadtime
= 0;
1380 Globals
.bLargeReadwrite
= True
;
1381 Globals
.max_log_size
= 5000;
1382 Globals
.max_open_files
= MAX_OPEN_FILES
;
1383 Globals
.maxprotocol
= PROTOCOL_NT1
;
1384 Globals
.minprotocol
= PROTOCOL_CORE
;
1385 Globals
.security
= SEC_USER
;
1386 Globals
.paranoid_server_security
= True
;
1387 Globals
.bEncryptPasswords
= True
;
1388 Globals
.bUpdateEncrypt
= False
;
1389 Globals
.clientSchannel
= Auto
;
1390 Globals
.serverSchannel
= Auto
;
1391 Globals
.bReadRaw
= True
;
1392 Globals
.bWriteRaw
= True
;
1393 Globals
.bReadPrediction
= False
;
1394 Globals
.bReadbmpx
= False
;
1395 Globals
.bNullPasswords
= False
;
1396 Globals
.bObeyPamRestrictions
= False
;
1398 Globals
.bSyslogOnly
= False
;
1399 Globals
.bTimestampLogs
= True
;
1400 string_set(&Globals
.szLogLevel
, "0");
1401 Globals
.bDebugHiresTimestamp
= False
;
1402 Globals
.bDebugPid
= False
;
1403 Globals
.bDebugUid
= False
;
1404 Globals
.max_ttl
= 60 * 60 * 24 * 3; /* 3 days default. */
1405 Globals
.max_wins_ttl
= 60 * 60 * 24 * 6; /* 6 days default. */
1406 Globals
.min_wins_ttl
= 60 * 60 * 6; /* 6 hours default. */
1407 Globals
.machine_password_timeout
= 60 * 60 * 24 * 7; /* 7 days default. */
1408 Globals
.change_notify_timeout
= 60; /* 1 minute default. */
1409 Globals
.bKernelChangeNotify
= True
; /* On if we have it. */
1410 Globals
.ReadSize
= 16 * 1024;
1411 Globals
.lm_announce
= 2; /* = Auto: send only if LM clients found */
1412 Globals
.lm_interval
= 60;
1413 Globals
.announce_as
= ANNOUNCE_AS_NT_SERVER
;
1414 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
1415 Globals
.bNISHomeMap
= False
;
1416 #ifdef WITH_NISPLUS_HOME
1417 string_set(&Globals
.szNISHomeMapName
, "auto_home.org_dir");
1419 string_set(&Globals
.szNISHomeMapName
, "auto.home");
1422 Globals
.bTimeServer
= False
;
1423 Globals
.bBindInterfacesOnly
= False
;
1424 Globals
.bUnixPasswdSync
= False
;
1425 Globals
.bPamPasswordChange
= False
;
1426 Globals
.bPasswdChatDebug
= False
;
1427 Globals
.iPasswdChatTimeout
= 2; /* 2 second default. */
1428 Globals
.bUnicode
= True
; /* Do unicode on the wire by default */
1429 Globals
.bNTPipeSupport
= True
; /* Do NT pipes by default. */
1430 Globals
.bNTStatusSupport
= True
; /* Use NT status by default. */
1431 Globals
.bStatCache
= True
; /* use stat cache by default */
1432 Globals
.restrict_anonymous
= 0;
1433 Globals
.bClientLanManAuth
= True
; /* Do use the LanMan hash if it is available */
1434 Globals
.bClientPlaintextAuth
= True
; /* Do use a plaintext password if is requested by the server */
1435 Globals
.bLanmanAuth
= True
; /* Do use the LanMan hash if it is available */
1436 Globals
.bNTLMAuth
= True
; /* Do use NTLMv1 if it is available (otherwise NTLMv2) */
1437 Globals
.bClientNTLMv2Auth
= False
; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
1438 /* Note, that we will use NTLM2 session security (which is different), if it is available */
1440 Globals
.map_to_guest
= 0; /* By Default, "Never" */
1441 Globals
.min_passwd_length
= MINPASSWDLENGTH
; /* By Default, 5. */
1442 Globals
.use_cracklib
= False
;
1443 Globals
.oplock_break_wait_time
= 0; /* By Default, 0 msecs. */
1444 Globals
.enhanced_browsing
= True
;
1445 Globals
.iLockSpinCount
= 3; /* Try 3 times. */
1446 Globals
.iLockSpinTime
= 10; /* usec. */
1447 #ifdef MMAP_BLACKLIST
1448 Globals
.bUseMmap
= False
;
1450 Globals
.bUseMmap
= True
;
1452 Globals
.bUnixExtensions
= True
;
1454 /* hostname lookups can be very expensive and are broken on
1455 a large number of sites (tridge) */
1456 Globals
.bHostnameLookups
= False
;
1458 #ifdef WITH_LDAP_SAMCONFIG
1459 string_set(&Globals
.szLdapServer
, "localhost");
1460 Globals
.ldap_port
= 636;
1461 Globals
.szPassdbBackend
= str_list_make("ldapsam_compat", NULL
);
1463 Globals
.szPassdbBackend
= str_list_make("smbpasswd", NULL
);
1464 #endif /* WITH_LDAP_SAMCONFIG */
1466 string_set(&Globals
.szLdapSuffix
, "");
1467 string_set(&Globals
.szLdapFilter
, "(uid=%u)");
1468 string_set(&Globals
.szLdapMachineSuffix
, "");
1469 string_set(&Globals
.szLdapUserSuffix
, "");
1470 string_set(&Globals
.szLdapGroupSuffix
, "");
1471 string_set(&Globals
.szLdapIdmapSuffix
, "");
1473 string_set(&Globals
.szLdapAdminDn
, "");
1474 Globals
.ldap_ssl
= LDAP_SSL_ON
;
1475 Globals
.ldap_passwd_sync
= LDAP_PASSWD_SYNC_OFF
;
1476 Globals
.ldap_delete_dn
= False
;
1477 Globals
.ldap_replication_sleep
= 1000; /* wait 1 sec for replication */
1479 /* these parameters are set to defaults that are more appropriate
1480 for the increasing samba install base:
1482 as a member of the workgroup, that will possibly become a
1483 _local_ master browser (lm = True). this is opposed to a forced
1484 local master browser startup (pm = True).
1486 doesn't provide WINS server service by default (wsupp = False),
1487 and doesn't provide domain master browser services by default, either.
1491 Globals
.bMsAddPrinterWizard
= True
;
1492 Globals
.bPreferredMaster
= Auto
; /* depending on bDomainMaster */
1493 Globals
.os_level
= 20;
1494 Globals
.bLocalMaster
= True
;
1495 Globals
.bDomainMaster
= Auto
; /* depending on bDomainLogons */
1496 Globals
.bDomainLogons
= False
;
1497 Globals
.bBrowseList
= True
;
1498 Globals
.bWINSsupport
= False
;
1499 Globals
.bWINSproxy
= False
;
1501 Globals
.bDNSproxy
= True
;
1503 /* this just means to use them if they exist */
1504 Globals
.bKernelOplocks
= True
;
1506 Globals
.bAllowTrustedDomains
= True
;
1508 string_set(&Globals
.szTemplateShell
, "/bin/false");
1509 string_set(&Globals
.szTemplateHomedir
, "/home/%D/%U");
1510 string_set(&Globals
.szTemplatePrimaryGroup
, "nobody");
1511 string_set(&Globals
.szWinbindSeparator
, "\\");
1512 string_set(&Globals
.szAclCompat
, "");
1514 Globals
.winbind_cache_time
= 300; /* 5 minutes */
1515 Globals
.bWinbindEnableLocalAccounts
= True
;
1516 Globals
.bWinbindEnumUsers
= True
;
1517 Globals
.bWinbindEnumGroups
= True
;
1518 Globals
.bWinbindUseDefaultDomain
= False
;
1519 Globals
.bWinbindTrustedDomainsOnly
= False
;
1521 Globals
.bEnableRidAlgorithm
= True
;
1523 Globals
.name_cache_timeout
= 660; /* In seconds */
1525 Globals
.bUseSpnego
= True
;
1526 Globals
.bClientUseSpnego
= True
;
1528 Globals
.client_signing
= Auto
;
1529 Globals
.server_signing
= False
;
1531 string_set(&Globals
.smb_ports
, SMB_PORTS
);
1534 static TALLOC_CTX
*lp_talloc
;
1536 /******************************************************************* a
1537 Free up temporary memory - called from the main loop.
1538 ********************************************************************/
1540 void lp_talloc_free(void)
1544 talloc_destroy(lp_talloc
);
1548 /*******************************************************************
1549 Convenience routine to grab string parameters into temporary memory
1550 and run standard_sub_basic on them. The buffers can be written to by
1551 callers without affecting the source string.
1552 ********************************************************************/
1554 static char *lp_string(const char *s
)
1558 /* The follow debug is useful for tracking down memory problems
1559 especially if you have an inner loop that is calling a lp_*()
1560 function that returns a string. Perhaps this debug should be
1561 present all the time? */
1564 DEBUG(10, ("lp_string(%s)\n", s
));
1568 lp_talloc
= talloc_init("lp_talloc");
1570 tmpstr
= alloc_sub_basic(current_user_info
.smb_name
, s
);
1571 if (trim_char(tmpstr
, '\"', '\"')) {
1572 if (strchr(tmpstr
,'\"') != NULL
) {
1574 tmpstr
= alloc_sub_basic(current_user_info
.smb_name
,s
);
1577 ret
= talloc_strdup(lp_talloc
, tmpstr
);
1584 In this section all the functions that are used to access the
1585 parameters from the rest of the program are defined
1588 #define FN_GLOBAL_STRING(fn_name,ptr) \
1589 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
1590 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
1591 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
1592 #define FN_GLOBAL_LIST(fn_name,ptr) \
1593 const char **fn_name(void) {return(*(const char ***)(ptr));}
1594 #define FN_GLOBAL_BOOL(fn_name,ptr) \
1595 BOOL fn_name(void) {return(*(BOOL *)(ptr));}
1596 #define FN_GLOBAL_CHAR(fn_name,ptr) \
1597 char fn_name(void) {return(*(char *)(ptr));}
1598 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
1599 int fn_name(void) {return(*(int *)(ptr));}
1601 #define FN_LOCAL_STRING(fn_name,val) \
1602 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
1603 #define FN_LOCAL_CONST_STRING(fn_name,val) \
1604 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
1605 #define FN_LOCAL_LIST(fn_name,val) \
1606 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1607 #define FN_LOCAL_BOOL(fn_name,val) \
1608 BOOL fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1609 #define FN_LOCAL_CHAR(fn_name,val) \
1610 char fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1611 #define FN_LOCAL_INTEGER(fn_name,val) \
1612 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1614 FN_GLOBAL_STRING(lp_smb_ports
, &Globals
.smb_ports
)
1615 FN_GLOBAL_STRING(lp_dos_charset
, &Globals
.dos_charset
)
1616 FN_GLOBAL_STRING(lp_unix_charset
, &Globals
.unix_charset
)
1617 FN_GLOBAL_STRING(lp_display_charset
, &Globals
.display_charset
)
1618 FN_GLOBAL_STRING(lp_logfile
, &Globals
.szLogFile
)
1619 FN_GLOBAL_STRING(lp_configfile
, &Globals
.szConfigFile
)
1620 FN_GLOBAL_STRING(lp_smb_passwd_file
, &Globals
.szSMBPasswdFile
)
1621 FN_GLOBAL_STRING(lp_private_dir
, &Globals
.szPrivateDir
)
1622 FN_GLOBAL_STRING(lp_serverstring
, &Globals
.szServerString
)
1623 FN_GLOBAL_STRING(lp_printcapname
, &Globals
.szPrintcapname
)
1624 FN_GLOBAL_STRING(lp_enumports_cmd
, &Globals
.szEnumPortsCommand
)
1625 FN_GLOBAL_STRING(lp_addprinter_cmd
, &Globals
.szAddPrinterCommand
)
1626 FN_GLOBAL_STRING(lp_deleteprinter_cmd
, &Globals
.szDeletePrinterCommand
)
1627 FN_GLOBAL_STRING(lp_os2_driver_map
, &Globals
.szOs2DriverMap
)
1628 FN_GLOBAL_STRING(lp_lockdir
, &Globals
.szLockDir
)
1629 FN_GLOBAL_STRING(lp_piddir
, &Globals
.szPidDir
)
1630 FN_GLOBAL_STRING(lp_mangling_method
, &Globals
.szManglingMethod
)
1631 FN_GLOBAL_INTEGER(lp_mangle_prefix
, &Globals
.mangle_prefix
)
1632 FN_GLOBAL_STRING(lp_utmpdir
, &Globals
.szUtmpDir
)
1633 FN_GLOBAL_STRING(lp_wtmpdir
, &Globals
.szWtmpDir
)
1634 FN_GLOBAL_BOOL(lp_utmp
, &Globals
.bUtmp
)
1635 FN_GLOBAL_STRING(lp_rootdir
, &Globals
.szRootdir
)
1636 FN_GLOBAL_STRING(lp_source_environment
, &Globals
.szSourceEnv
)
1637 FN_GLOBAL_STRING(lp_defaultservice
, &Globals
.szDefaultService
)
1638 FN_GLOBAL_STRING(lp_msg_command
, &Globals
.szMsgCommand
)
1639 FN_GLOBAL_STRING(lp_dfree_command
, &Globals
.szDfree
)
1640 FN_GLOBAL_STRING(lp_get_quota_command
, &Globals
.szGetQuota
)
1641 FN_GLOBAL_STRING(lp_set_quota_command
, &Globals
.szSetQuota
)
1642 FN_GLOBAL_STRING(lp_hosts_equiv
, &Globals
.szHostsEquiv
)
1643 FN_GLOBAL_STRING(lp_auto_services
, &Globals
.szAutoServices
)
1644 FN_GLOBAL_STRING(lp_passwd_program
, &Globals
.szPasswdProgram
)
1645 FN_GLOBAL_STRING(lp_passwd_chat
, &Globals
.szPasswdChat
)
1646 FN_GLOBAL_STRING(lp_passwordserver
, &Globals
.szPasswordServer
)
1647 FN_GLOBAL_STRING(lp_name_resolve_order
, &Globals
.szNameResolveOrder
)
1648 FN_GLOBAL_STRING(lp_realm
, &Globals
.szRealm
)
1649 FN_GLOBAL_STRING(lp_afs_username_map
, &Globals
.szAfsUsernameMap
)
1650 FN_GLOBAL_STRING(lp_username_map
, &Globals
.szUsernameMap
)
1651 FN_GLOBAL_CONST_STRING(lp_logon_script
, &Globals
.szLogonScript
)
1652 FN_GLOBAL_CONST_STRING(lp_logon_path
, &Globals
.szLogonPath
)
1653 FN_GLOBAL_CONST_STRING(lp_logon_drive
, &Globals
.szLogonDrive
)
1654 FN_GLOBAL_CONST_STRING(lp_logon_home
, &Globals
.szLogonHome
)
1655 FN_GLOBAL_STRING(lp_remote_announce
, &Globals
.szRemoteAnnounce
)
1656 FN_GLOBAL_STRING(lp_remote_browse_sync
, &Globals
.szRemoteBrowseSync
)
1657 FN_GLOBAL_LIST(lp_wins_server_list
, &Globals
.szWINSservers
)
1658 FN_GLOBAL_LIST(lp_interfaces
, &Globals
.szInterfaces
)
1659 FN_GLOBAL_STRING(lp_socket_address
, &Globals
.szSocketAddress
)
1660 FN_GLOBAL_STRING(lp_nis_home_map_name
, &Globals
.szNISHomeMapName
)
1661 static FN_GLOBAL_STRING(lp_announce_version
, &Globals
.szAnnounceVersion
)
1662 FN_GLOBAL_LIST(lp_netbios_aliases
, &Globals
.szNetbiosAliases
)
1663 FN_GLOBAL_LIST(lp_passdb_backend
, &Globals
.szPassdbBackend
)
1664 FN_GLOBAL_LIST(lp_preload_modules
, &Globals
.szPreloadModules
)
1665 FN_GLOBAL_STRING(lp_panic_action
, &Globals
.szPanicAction
)
1666 FN_GLOBAL_STRING(lp_adduser_script
, &Globals
.szAddUserScript
)
1667 FN_GLOBAL_STRING(lp_deluser_script
, &Globals
.szDelUserScript
)
1669 FN_GLOBAL_CONST_STRING(lp_guestaccount
, &Globals
.szGuestaccount
)
1670 FN_GLOBAL_STRING(lp_addgroup_script
, &Globals
.szAddGroupScript
)
1671 FN_GLOBAL_STRING(lp_delgroup_script
, &Globals
.szDelGroupScript
)
1672 FN_GLOBAL_STRING(lp_addusertogroup_script
, &Globals
.szAddUserToGroupScript
)
1673 FN_GLOBAL_STRING(lp_deluserfromgroup_script
, &Globals
.szDelUserFromGroupScript
)
1674 FN_GLOBAL_STRING(lp_setprimarygroup_script
, &Globals
.szSetPrimaryGroupScript
)
1676 FN_GLOBAL_STRING(lp_addmachine_script
, &Globals
.szAddMachineScript
)
1678 FN_GLOBAL_STRING(lp_shutdown_script
, &Globals
.szShutdownScript
)
1679 FN_GLOBAL_STRING(lp_abort_shutdown_script
, &Globals
.szAbortShutdownScript
)
1681 FN_GLOBAL_STRING(lp_wins_hook
, &Globals
.szWINSHook
)
1682 FN_GLOBAL_STRING(lp_wins_partners
, &Globals
.szWINSPartners
)
1683 FN_GLOBAL_STRING(lp_template_primary_group
, &Globals
.szTemplatePrimaryGroup
)
1684 FN_GLOBAL_CONST_STRING(lp_template_homedir
, &Globals
.szTemplateHomedir
)
1685 FN_GLOBAL_CONST_STRING(lp_template_shell
, &Globals
.szTemplateShell
)
1686 FN_GLOBAL_CONST_STRING(lp_winbind_separator
, &Globals
.szWinbindSeparator
)
1687 FN_GLOBAL_STRING(lp_acl_compatibility
, &Globals
.szAclCompat
)
1688 FN_GLOBAL_BOOL(lp_winbind_enable_local_accounts
, &Globals
.bWinbindEnableLocalAccounts
)
1689 FN_GLOBAL_BOOL(lp_winbind_enum_users
, &Globals
.bWinbindEnumUsers
)
1690 FN_GLOBAL_BOOL(lp_winbind_enum_groups
, &Globals
.bWinbindEnumGroups
)
1691 FN_GLOBAL_BOOL(lp_winbind_use_default_domain
, &Globals
.bWinbindUseDefaultDomain
)
1692 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only
, &Globals
.bWinbindTrustedDomainsOnly
)
1694 FN_GLOBAL_STRING(lp_idmap_backend
, &Globals
.szIdmapBackend
)
1695 FN_GLOBAL_BOOL(lp_enable_rid_algorithm
, &Globals
.bEnableRidAlgorithm
)
1697 #ifdef WITH_LDAP_SAMCONFIG
1698 FN_GLOBAL_STRING(lp_ldap_server
, &Globals
.szLdapServer
)
1699 FN_GLOBAL_INTEGER(lp_ldap_port
, &Globals
.ldap_port
)
1701 FN_GLOBAL_STRING(lp_ldap_suffix
, &Globals
.szLdapSuffix
)
1702 FN_GLOBAL_STRING(lp_ldap_filter
, &Globals
.szLdapFilter
)
1703 FN_GLOBAL_STRING(lp_ldap_admin_dn
, &Globals
.szLdapAdminDn
)
1704 FN_GLOBAL_INTEGER(lp_ldap_ssl
, &Globals
.ldap_ssl
)
1705 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync
, &Globals
.ldap_passwd_sync
)
1706 FN_GLOBAL_BOOL(lp_ldap_delete_dn
, &Globals
.ldap_delete_dn
)
1707 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep
, &Globals
.ldap_replication_sleep
)
1708 FN_GLOBAL_STRING(lp_add_share_cmd
, &Globals
.szAddShareCommand
)
1709 FN_GLOBAL_STRING(lp_change_share_cmd
, &Globals
.szChangeShareCommand
)
1710 FN_GLOBAL_STRING(lp_delete_share_cmd
, &Globals
.szDeleteShareCommand
)
1712 FN_GLOBAL_BOOL(lp_disable_netbios
, &Globals
.bDisableNetbios
)
1713 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard
, &Globals
.bMsAddPrinterWizard
)
1714 FN_GLOBAL_BOOL(lp_dns_proxy
, &Globals
.bDNSproxy
)
1715 FN_GLOBAL_BOOL(lp_wins_support
, &Globals
.bWINSsupport
)
1716 FN_GLOBAL_BOOL(lp_we_are_a_wins_server
, &Globals
.bWINSsupport
)
1717 FN_GLOBAL_BOOL(lp_wins_proxy
, &Globals
.bWINSproxy
)
1718 FN_GLOBAL_BOOL(lp_local_master
, &Globals
.bLocalMaster
)
1719 FN_GLOBAL_BOOL(lp_domain_logons
, &Globals
.bDomainLogons
)
1720 FN_GLOBAL_BOOL(lp_load_printers
, &Globals
.bLoadPrinters
)
1721 FN_GLOBAL_BOOL(lp_readprediction
, &Globals
.bReadPrediction
)
1722 FN_GLOBAL_BOOL(lp_readbmpx
, &Globals
.bReadbmpx
)
1723 FN_GLOBAL_BOOL(lp_readraw
, &Globals
.bReadRaw
)
1724 FN_GLOBAL_BOOL(lp_large_readwrite
, &Globals
.bLargeReadwrite
)
1725 FN_GLOBAL_BOOL(lp_writeraw
, &Globals
.bWriteRaw
)
1726 FN_GLOBAL_BOOL(lp_null_passwords
, &Globals
.bNullPasswords
)
1727 FN_GLOBAL_BOOL(lp_obey_pam_restrictions
, &Globals
.bObeyPamRestrictions
)
1728 FN_GLOBAL_BOOL(lp_encrypted_passwords
, &Globals
.bEncryptPasswords
)
1729 FN_GLOBAL_BOOL(lp_update_encrypted
, &Globals
.bUpdateEncrypt
)
1730 FN_GLOBAL_INTEGER(lp_client_schannel
, &Globals
.clientSchannel
)
1731 FN_GLOBAL_INTEGER(lp_server_schannel
, &Globals
.serverSchannel
)
1732 FN_GLOBAL_BOOL(lp_syslog_only
, &Globals
.bSyslogOnly
)
1733 FN_GLOBAL_BOOL(lp_timestamp_logs
, &Globals
.bTimestampLogs
)
1734 FN_GLOBAL_BOOL(lp_debug_hires_timestamp
, &Globals
.bDebugHiresTimestamp
)
1735 FN_GLOBAL_BOOL(lp_debug_pid
, &Globals
.bDebugPid
)
1736 FN_GLOBAL_BOOL(lp_debug_uid
, &Globals
.bDebugUid
)
1737 FN_GLOBAL_BOOL(lp_browse_list
, &Globals
.bBrowseList
)
1738 FN_GLOBAL_BOOL(lp_nis_home_map
, &Globals
.bNISHomeMap
)
1739 static FN_GLOBAL_BOOL(lp_time_server
, &Globals
.bTimeServer
)
1740 FN_GLOBAL_BOOL(lp_bind_interfaces_only
, &Globals
.bBindInterfacesOnly
)
1741 FN_GLOBAL_BOOL(lp_pam_password_change
, &Globals
.bPamPasswordChange
)
1742 FN_GLOBAL_BOOL(lp_unix_password_sync
, &Globals
.bUnixPasswdSync
)
1743 FN_GLOBAL_BOOL(lp_passwd_chat_debug
, &Globals
.bPasswdChatDebug
)
1744 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout
, &Globals
.iPasswdChatTimeout
)
1745 FN_GLOBAL_BOOL(lp_unicode
, &Globals
.bUnicode
)
1746 FN_GLOBAL_BOOL(lp_nt_pipe_support
, &Globals
.bNTPipeSupport
)
1747 FN_GLOBAL_BOOL(lp_nt_status_support
, &Globals
.bNTStatusSupport
)
1748 FN_GLOBAL_BOOL(lp_stat_cache
, &Globals
.bStatCache
)
1749 FN_GLOBAL_BOOL(lp_allow_trusted_domains
, &Globals
.bAllowTrustedDomains
)
1750 FN_GLOBAL_INTEGER(lp_restrict_anonymous
, &Globals
.restrict_anonymous
)
1751 FN_GLOBAL_BOOL(lp_lanman_auth
, &Globals
.bLanmanAuth
)
1752 FN_GLOBAL_BOOL(lp_ntlm_auth
, &Globals
.bNTLMAuth
)
1753 FN_GLOBAL_BOOL(lp_client_plaintext_auth
, &Globals
.bClientPlaintextAuth
)
1754 FN_GLOBAL_BOOL(lp_client_lanman_auth
, &Globals
.bClientLanManAuth
)
1755 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth
, &Globals
.bClientNTLMv2Auth
)
1756 FN_GLOBAL_BOOL(lp_host_msdfs
, &Globals
.bHostMSDfs
)
1757 FN_GLOBAL_BOOL(lp_kernel_oplocks
, &Globals
.bKernelOplocks
)
1758 FN_GLOBAL_BOOL(lp_enhanced_browsing
, &Globals
.enhanced_browsing
)
1759 FN_GLOBAL_BOOL(lp_use_mmap
, &Globals
.bUseMmap
)
1760 FN_GLOBAL_BOOL(lp_unix_extensions
, &Globals
.bUnixExtensions
)
1761 FN_GLOBAL_BOOL(lp_use_spnego
, &Globals
.bUseSpnego
)
1762 FN_GLOBAL_BOOL(lp_client_use_spnego
, &Globals
.bClientUseSpnego
)
1763 FN_GLOBAL_BOOL(lp_hostname_lookups
, &Globals
.bHostnameLookups
)
1764 FN_GLOBAL_BOOL(lp_kernel_change_notify
, &Globals
.bKernelChangeNotify
)
1765 FN_GLOBAL_INTEGER(lp_os_level
, &Globals
.os_level
)
1766 FN_GLOBAL_INTEGER(lp_max_ttl
, &Globals
.max_ttl
)
1767 FN_GLOBAL_INTEGER(lp_max_wins_ttl
, &Globals
.max_wins_ttl
)
1768 FN_GLOBAL_INTEGER(lp_min_wins_ttl
, &Globals
.min_wins_ttl
)
1769 FN_GLOBAL_INTEGER(lp_max_log_size
, &Globals
.max_log_size
)
1770 FN_GLOBAL_INTEGER(lp_max_open_files
, &Globals
.max_open_files
)
1771 FN_GLOBAL_INTEGER(lp_maxxmit
, &Globals
.max_xmit
)
1772 FN_GLOBAL_INTEGER(lp_maxmux
, &Globals
.max_mux
)
1773 FN_GLOBAL_INTEGER(lp_passwordlevel
, &Globals
.pwordlevel
)
1774 FN_GLOBAL_INTEGER(lp_usernamelevel
, &Globals
.unamelevel
)
1775 FN_GLOBAL_INTEGER(lp_readsize
, &Globals
.ReadSize
)
1776 FN_GLOBAL_INTEGER(lp_deadtime
, &Globals
.deadtime
)
1777 FN_GLOBAL_INTEGER(lp_maxprotocol
, &Globals
.maxprotocol
)
1778 FN_GLOBAL_INTEGER(lp_minprotocol
, &Globals
.minprotocol
)
1779 FN_GLOBAL_INTEGER(lp_security
, &Globals
.security
)
1780 FN_GLOBAL_LIST(lp_auth_methods
, &Globals
.AuthMethods
)
1781 FN_GLOBAL_BOOL(lp_paranoid_server_security
, &Globals
.paranoid_server_security
)
1782 FN_GLOBAL_INTEGER(lp_maxdisksize
, &Globals
.maxdisksize
)
1783 FN_GLOBAL_INTEGER(lp_lpqcachetime
, &Globals
.lpqcachetime
)
1784 FN_GLOBAL_INTEGER(lp_max_smbd_processes
, &Globals
.iMaxSmbdProcesses
)
1785 FN_GLOBAL_INTEGER(lp_disable_spoolss
, &Globals
.bDisableSpoolss
)
1786 FN_GLOBAL_INTEGER(lp_syslog
, &Globals
.syslog
)
1787 static FN_GLOBAL_INTEGER(lp_announce_as
, &Globals
.announce_as
)
1788 FN_GLOBAL_INTEGER(lp_lm_announce
, &Globals
.lm_announce
)
1789 FN_GLOBAL_INTEGER(lp_lm_interval
, &Globals
.lm_interval
)
1790 FN_GLOBAL_INTEGER(lp_machine_password_timeout
, &Globals
.machine_password_timeout
)
1791 FN_GLOBAL_INTEGER(lp_change_notify_timeout
, &Globals
.change_notify_timeout
)
1792 FN_GLOBAL_INTEGER(lp_map_to_guest
, &Globals
.map_to_guest
)
1793 FN_GLOBAL_INTEGER(lp_min_passwd_length
, &Globals
.min_passwd_length
)
1794 FN_GLOBAL_BOOL(lp_use_cracklib
, &Globals
.use_cracklib
)
1795 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time
, &Globals
.oplock_break_wait_time
)
1796 FN_GLOBAL_INTEGER(lp_lock_spin_count
, &Globals
.iLockSpinCount
)
1797 FN_GLOBAL_INTEGER(lp_lock_sleep_time
, &Globals
.iLockSpinTime
)
1798 FN_LOCAL_STRING(lp_preexec
, szPreExec
)
1799 FN_LOCAL_STRING(lp_postexec
, szPostExec
)
1800 FN_LOCAL_STRING(lp_rootpreexec
, szRootPreExec
)
1801 FN_LOCAL_STRING(lp_rootpostexec
, szRootPostExec
)
1802 FN_LOCAL_STRING(lp_servicename
, szService
)
1803 FN_LOCAL_CONST_STRING(lp_const_servicename
, szService
)
1804 FN_LOCAL_STRING(lp_pathname
, szPath
)
1805 FN_LOCAL_STRING(lp_dontdescend
, szDontdescend
)
1806 FN_LOCAL_STRING(lp_username
, szUsername
)
1807 FN_LOCAL_LIST(lp_invalid_users
, szInvalidUsers
)
1808 FN_LOCAL_LIST(lp_valid_users
, szValidUsers
)
1809 FN_LOCAL_LIST(lp_admin_users
, szAdminUsers
)
1810 FN_LOCAL_STRING(lp_printcommand
, szPrintcommand
)
1811 FN_LOCAL_STRING(lp_lpqcommand
, szLpqcommand
)
1812 FN_LOCAL_STRING(lp_lprmcommand
, szLprmcommand
)
1813 FN_LOCAL_STRING(lp_lppausecommand
, szLppausecommand
)
1814 FN_LOCAL_STRING(lp_lpresumecommand
, szLpresumecommand
)
1815 FN_LOCAL_STRING(lp_queuepausecommand
, szQueuepausecommand
)
1816 FN_LOCAL_STRING(lp_queueresumecommand
, szQueueresumecommand
)
1817 static FN_LOCAL_STRING(_lp_printername
, szPrintername
)
1818 FN_LOCAL_LIST(lp_hostsallow
, szHostsallow
)
1819 FN_LOCAL_LIST(lp_hostsdeny
, szHostsdeny
)
1820 FN_LOCAL_STRING(lp_magicscript
, szMagicScript
)
1821 FN_LOCAL_STRING(lp_magicoutput
, szMagicOutput
)
1822 FN_LOCAL_STRING(lp_comment
, comment
)
1823 FN_LOCAL_STRING(lp_force_user
, force_user
)
1824 FN_LOCAL_STRING(lp_force_group
, force_group
)
1825 FN_LOCAL_LIST(lp_readlist
, readlist
)
1826 FN_LOCAL_LIST(lp_writelist
, writelist
)
1827 FN_LOCAL_LIST(lp_printer_admin
, printer_admin
)
1828 FN_LOCAL_STRING(lp_fstype
, fstype
)
1829 FN_LOCAL_LIST(lp_vfs_objects
, szVfsObjects
)
1830 FN_LOCAL_STRING(lp_msdfs_proxy
, szMSDfsProxy
)
1831 static FN_LOCAL_STRING(lp_volume
, volume
)
1832 FN_LOCAL_STRING(lp_mangled_map
, szMangledMap
)
1833 FN_LOCAL_STRING(lp_veto_files
, szVetoFiles
)
1834 FN_LOCAL_STRING(lp_hide_files
, szHideFiles
)
1835 FN_LOCAL_STRING(lp_veto_oplocks
, szVetoOplockFiles
)
1836 FN_LOCAL_BOOL(lp_msdfs_root
, bMSDfsRoot
)
1837 FN_LOCAL_BOOL(lp_autoloaded
, autoloaded
)
1838 FN_LOCAL_BOOL(lp_preexec_close
, bPreexecClose
)
1839 FN_LOCAL_BOOL(lp_rootpreexec_close
, bRootpreexecClose
)
1840 FN_LOCAL_BOOL(lp_casesensitive
, bCaseSensitive
)
1841 FN_LOCAL_BOOL(lp_preservecase
, bCasePreserve
)
1842 FN_LOCAL_BOOL(lp_shortpreservecase
, bShortCasePreserve
)
1843 FN_LOCAL_BOOL(lp_casemangle
, bCaseMangle
)
1844 FN_LOCAL_BOOL(lp_hide_dot_files
, bHideDotFiles
)
1845 FN_LOCAL_BOOL(lp_hide_special_files
, bHideSpecialFiles
)
1846 FN_LOCAL_BOOL(lp_hideunreadable
, bHideUnReadable
)
1847 FN_LOCAL_BOOL(lp_hideunwriteable_files
, bHideUnWriteableFiles
)
1848 FN_LOCAL_BOOL(lp_browseable
, bBrowseable
)
1849 FN_LOCAL_BOOL(lp_readonly
, bRead_only
)
1850 FN_LOCAL_BOOL(lp_no_set_dir
, bNo_set_dir
)
1851 FN_LOCAL_BOOL(lp_guest_ok
, bGuest_ok
)
1852 FN_LOCAL_BOOL(lp_guest_only
, bGuest_only
)
1853 FN_LOCAL_BOOL(lp_print_ok
, bPrint_ok
)
1854 FN_LOCAL_BOOL(lp_map_hidden
, bMap_hidden
)
1855 FN_LOCAL_BOOL(lp_map_archive
, bMap_archive
)
1856 FN_LOCAL_BOOL(lp_locking
, bLocking
)
1857 FN_LOCAL_BOOL(lp_strict_locking
, bStrictLocking
)
1858 FN_LOCAL_BOOL(lp_posix_locking
, bPosixLocking
)
1859 FN_LOCAL_BOOL(lp_share_modes
, bShareModes
)
1860 FN_LOCAL_BOOL(lp_oplocks
, bOpLocks
)
1861 FN_LOCAL_BOOL(lp_level2_oplocks
, bLevel2OpLocks
)
1862 FN_LOCAL_BOOL(lp_onlyuser
, bOnlyUser
)
1863 FN_LOCAL_BOOL(lp_manglednames
, bMangledNames
)
1864 FN_LOCAL_BOOL(lp_widelinks
, bWidelinks
)
1865 FN_LOCAL_BOOL(lp_symlinks
, bSymlinks
)
1866 FN_LOCAL_BOOL(lp_syncalways
, bSyncAlways
)
1867 FN_LOCAL_BOOL(lp_strict_allocate
, bStrictAllocate
)
1868 FN_LOCAL_BOOL(lp_strict_sync
, bStrictSync
)
1869 FN_LOCAL_BOOL(lp_map_system
, bMap_system
)
1870 FN_LOCAL_BOOL(lp_delete_readonly
, bDeleteReadonly
)
1871 FN_LOCAL_BOOL(lp_fake_oplocks
, bFakeOplocks
)
1872 FN_LOCAL_BOOL(lp_recursive_veto_delete
, bDeleteVetoFiles
)
1873 FN_LOCAL_BOOL(lp_dos_filemode
, bDosFilemode
)
1874 FN_LOCAL_BOOL(lp_dos_filetimes
, bDosFiletimes
)
1875 FN_LOCAL_BOOL(lp_dos_filetime_resolution
, bDosFiletimeResolution
)
1876 FN_LOCAL_BOOL(lp_fake_dir_create_times
, bFakeDirCreateTimes
)
1877 FN_LOCAL_BOOL(lp_blocking_locks
, bBlockingLocks
)
1878 FN_LOCAL_BOOL(lp_inherit_perms
, bInheritPerms
)
1879 FN_LOCAL_BOOL(lp_inherit_acls
, bInheritACLS
)
1880 FN_LOCAL_BOOL(lp_use_client_driver
, bUseClientDriver
)
1881 FN_LOCAL_BOOL(lp_default_devmode
, bDefaultDevmode
)
1882 FN_LOCAL_BOOL(lp_nt_acl_support
, bNTAclSupport
)
1883 FN_LOCAL_BOOL(_lp_use_sendfile
, bUseSendfile
)
1884 FN_LOCAL_BOOL(lp_profile_acls
, bProfileAcls
)
1885 FN_LOCAL_BOOL(lp_map_acl_inherit
, bMap_acl_inherit
)
1886 FN_LOCAL_BOOL(lp_afs_share
, bAfs_Share
)
1887 FN_LOCAL_INTEGER(lp_create_mask
, iCreate_mask
)
1888 FN_LOCAL_INTEGER(lp_force_create_mode
, iCreate_force_mode
)
1889 FN_LOCAL_INTEGER(lp_security_mask
, iSecurity_mask
)
1890 FN_LOCAL_INTEGER(lp_force_security_mode
, iSecurity_force_mode
)
1891 FN_LOCAL_INTEGER(lp_dir_mask
, iDir_mask
)
1892 FN_LOCAL_INTEGER(lp_force_dir_mode
, iDir_force_mode
)
1893 FN_LOCAL_INTEGER(lp_dir_security_mask
, iDir_Security_mask
)
1894 FN_LOCAL_INTEGER(lp_force_dir_security_mode
, iDir_Security_force_mode
)
1895 FN_LOCAL_INTEGER(lp_max_connections
, iMaxConnections
)
1896 FN_LOCAL_INTEGER(lp_defaultcase
, iDefaultCase
)
1897 FN_LOCAL_INTEGER(lp_minprintspace
, iMinPrintSpace
)
1898 FN_LOCAL_INTEGER(lp_printing
, iPrinting
)
1899 FN_LOCAL_INTEGER(lp_max_reported_jobs
, iMaxReportedPrintJobs
)
1900 FN_LOCAL_INTEGER(lp_oplock_contention_limit
, iOplockContentionLimit
)
1901 FN_LOCAL_INTEGER(lp_csc_policy
, iCSCPolicy
)
1902 FN_LOCAL_INTEGER(lp_write_cache_size
, iWriteCacheSize
)
1903 FN_LOCAL_INTEGER(lp_block_size
, iBlock_size
)
1904 FN_LOCAL_CHAR(lp_magicchar
, magic_char
)
1905 FN_GLOBAL_INTEGER(lp_winbind_cache_time
, &Globals
.winbind_cache_time
)
1906 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base
, &Globals
.AlgorithmicRidBase
)
1907 FN_GLOBAL_INTEGER(lp_name_cache_timeout
, &Globals
.name_cache_timeout
)
1908 FN_GLOBAL_INTEGER(lp_client_signing
, &Globals
.client_signing
)
1909 FN_GLOBAL_INTEGER(lp_server_signing
, &Globals
.server_signing
)
1911 /* local prototypes */
1913 static int map_parameter(const char *pszParmName
);
1914 static BOOL
set_boolean(BOOL
*pb
, const char *pszParmValue
);
1915 static int getservicebyname(const char *pszServiceName
,
1916 service
* pserviceDest
);
1917 static void copy_service(service
* pserviceDest
,
1918 service
* pserviceSource
, BOOL
*pcopymapDest
);
1919 static BOOL
service_ok(int iService
);
1920 static BOOL
do_parameter(const char *pszParmName
, const char *pszParmValue
);
1921 static BOOL
do_section(const char *pszSectionName
);
1922 static void init_copymap(service
* pservice
);
1924 /* This is a helper function for parametrical options support. */
1925 /* It returns a pointer to parametrical option value if it exists or NULL otherwise */
1926 /* Actual parametrical functions are quite simple */
1927 static param_opt_struct
*get_parametrics(int snum
, const char *type
, const char *option
)
1929 BOOL global_section
= False
;
1931 param_opt_struct
*data
;
1933 if (snum
>= iNumServices
) return NULL
;
1936 data
= Globals
.param_opt
;
1937 global_section
= True
;
1939 data
= ServicePtrs
[snum
]->param_opt
;
1942 asprintf(¶m_key
, "%s:%s", type
, option
);
1944 DEBUG(0,("asprintf failed!\n"));
1949 if (strcmp(data
->key
, param_key
) == 0) {
1950 string_free(¶m_key
);
1956 if (!global_section
) {
1957 /* Try to fetch the same option but from globals */
1958 /* but only if we are not already working with Globals */
1959 data
= Globals
.param_opt
;
1961 if (strcmp(data
->key
, param_key
) == 0) {
1962 string_free(¶m_key
);
1969 string_free(¶m_key
);
1975 /*******************************************************************
1976 convenience routine to return int parameters.
1977 ********************************************************************/
1978 static int lp_int(const char *s
)
1982 DEBUG(0,("lp_int(%s): is called with NULL!\n",s
));
1989 /*******************************************************************
1990 convenience routine to return unsigned long parameters.
1991 ********************************************************************/
1992 static int lp_ulong(const char *s
)
1996 DEBUG(0,("lp_int(%s): is called with NULL!\n",s
));
2000 return strtoul(s
, NULL
, 10);
2003 /*******************************************************************
2004 convenience routine to return boolean parameters.
2005 ********************************************************************/
2006 static BOOL
lp_bool(const char *s
)
2011 DEBUG(0,("lp_bool(%s): is called with NULL!\n",s
));
2015 if (!set_boolean(&ret
,s
)) {
2016 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s
));
2023 /*******************************************************************
2024 convenience routine to return enum parameters.
2025 ********************************************************************/
2026 static int lp_enum(const char *s
,const struct enum_list
*_enum
)
2031 DEBUG(0,("lp_enum(%s,enum): is called with NULL!\n",s
));
2035 for (i
=0; _enum
[i
].name
; i
++) {
2036 if (strequal(_enum
[i
].name
,s
))
2037 return _enum
[i
].value
;
2040 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s
));
2045 /* DO NOT USE lp_parm_string ANYMORE!!!!
2046 * use lp_parm_const_string or lp_parm_talloc_string
2048 * lp_parm_string is only used to let old modules find this symbol
2050 #undef lp_parm_string
2051 char *lp_parm_string(const char *servicename
, const char *type
, const char *option
)
2053 return lp_parm_talloc_string(lp_servicenumber(servicename
), type
, option
, NULL
);
2056 /* Return parametric option from a given service. Type is a part of option before ':' */
2057 /* Parametric option has following syntax: 'Type: option = value' */
2058 /* the returned value is talloced in lp_talloc */
2059 char *lp_parm_talloc_string(int snum
, const char *type
, const char *option
, const char *def
)
2061 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
2063 if (data
== NULL
||data
->value
==NULL
) {
2065 return lp_string(def
);
2071 return lp_string(data
->value
);
2074 /* Return parametric option from a given service. Type is a part of option before ':' */
2075 /* Parametric option has following syntax: 'Type: option = value' */
2076 const char *lp_parm_const_string(int snum
, const char *type
, const char *option
, const char *def
)
2078 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
2080 if (data
== NULL
||data
->value
==NULL
)
2086 /* Return parametric option from a given service. Type is a part of option before ':' */
2087 /* Parametric option has following syntax: 'Type: option = value' */
2089 const char **lp_parm_string_list(int snum
, const char *type
, const char *option
, const char **def
)
2091 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
2093 if (data
== NULL
||data
->value
==NULL
)
2094 return (const char **)def
;
2096 if (data
->list
==NULL
) {
2097 data
->list
= str_list_make(data
->value
, NULL
);
2100 return (const char **)data
->list
;
2103 /* Return parametric option from a given service. Type is a part of option before ':' */
2104 /* Parametric option has following syntax: 'Type: option = value' */
2106 int lp_parm_int(int snum
, const char *type
, const char *option
, int def
)
2108 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
2110 if (data
&& data
->value
&& *data
->value
)
2111 return lp_int(data
->value
);
2116 /* Return parametric option from a given service. Type is a part of option before ':' */
2117 /* Parametric option has following syntax: 'Type: option = value' */
2119 unsigned long lp_parm_ulong(int snum
, const char *type
, const char *option
, unsigned long def
)
2121 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
2123 if (data
&& data
->value
&& *data
->value
)
2124 return lp_ulong(data
->value
);
2129 /* Return parametric option from a given service. Type is a part of option before ':' */
2130 /* Parametric option has following syntax: 'Type: option = value' */
2132 BOOL
lp_parm_bool(int snum
, const char *type
, const char *option
, BOOL def
)
2134 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
2136 if (data
&& data
->value
&& *data
->value
)
2137 return lp_bool(data
->value
);
2142 /* Return parametric option from a given service. Type is a part of option before ':' */
2143 /* Parametric option has following syntax: 'Type: option = value' */
2145 int lp_parm_enum(int snum
, const char *type
, const char *option
,
2146 const struct enum_list
*_enum
, int def
)
2148 param_opt_struct
*data
= get_parametrics(snum
, type
, option
);
2150 if (data
&& data
->value
&& *data
->value
&& _enum
)
2151 return lp_enum(data
->value
, _enum
);
2157 /***************************************************************************
2158 Initialise a service to the defaults.
2159 ***************************************************************************/
2161 static void init_service(service
* pservice
)
2163 memset((char *)pservice
, '\0', sizeof(service
));
2164 copy_service(pservice
, &sDefault
, NULL
);
2167 /***************************************************************************
2168 Free the dynamically allocated parts of a service struct.
2169 ***************************************************************************/
2171 static void free_service(service
*pservice
)
2174 param_opt_struct
*data
, *pdata
;
2178 if (pservice
->szService
)
2179 DEBUG(5, ("free_service: Freeing service %s\n",
2180 pservice
->szService
));
2182 string_free(&pservice
->szService
);
2183 SAFE_FREE(pservice
->copymap
);
2185 for (i
= 0; parm_table
[i
].label
; i
++) {
2186 if ((parm_table
[i
].type
== P_STRING
||
2187 parm_table
[i
].type
== P_USTRING
) &&
2188 parm_table
[i
].class == P_LOCAL
)
2189 string_free((char **)
2190 (((char *)pservice
) +
2191 PTR_DIFF(parm_table
[i
].ptr
, &sDefault
)));
2192 else if (parm_table
[i
].type
== P_LIST
&&
2193 parm_table
[i
].class == P_LOCAL
)
2194 str_list_free((char ***)
2195 (((char *)pservice
) +
2196 PTR_DIFF(parm_table
[i
].ptr
, &sDefault
)));
2199 data
= pservice
->param_opt
;
2201 DEBUG(5,("Freeing parametrics:\n"));
2203 DEBUG(5,("[%s = %s]\n", data
->key
, data
->value
));
2204 string_free(&data
->key
);
2205 string_free(&data
->value
);
2206 str_list_free(&data
->list
);
2212 ZERO_STRUCTP(pservice
);
2215 /***************************************************************************
2216 Add a new service to the services array initialising it with the given
2218 ***************************************************************************/
2220 static int add_a_service(const service
*pservice
, const char *name
)
2224 int num_to_alloc
= iNumServices
+ 1;
2225 param_opt_struct
*data
, *pdata
;
2227 tservice
= *pservice
;
2229 /* it might already exist */
2231 i
= getservicebyname(name
, NULL
);
2233 /* Clean all parametric options for service */
2234 /* They will be added during parsing again */
2235 data
= ServicePtrs
[i
]->param_opt
;
2237 string_free(&data
->key
);
2238 string_free(&data
->value
);
2239 str_list_free(&data
->list
);
2244 ServicePtrs
[i
]->param_opt
= NULL
;
2249 /* find an invalid one */
2250 for (i
= 0; i
< iNumServices
; i
++)
2251 if (!ServicePtrs
[i
]->valid
)
2254 /* if not, then create one */
2255 if (i
== iNumServices
) {
2258 tsp
= (service
**) Realloc(ServicePtrs
,
2263 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
2268 ServicePtrs
[iNumServices
] =
2269 (service
*) malloc(sizeof(service
));
2271 if (!ServicePtrs
[iNumServices
]) {
2272 DEBUG(0,("add_a_service: out of memory!\n"));
2278 free_service(ServicePtrs
[i
]);
2280 ServicePtrs
[i
]->valid
= True
;
2282 init_service(ServicePtrs
[i
]);
2283 copy_service(ServicePtrs
[i
], &tservice
, NULL
);
2285 string_set(&ServicePtrs
[i
]->szService
, name
);
2289 /***************************************************************************
2290 Add a new home service, with the specified home directory, defaults coming
2292 ***************************************************************************/
2294 BOOL
lp_add_home(const char *pszHomename
, int iDefaultService
,
2295 const char *user
, const char *pszHomedir
)
2300 i
= add_a_service(ServicePtrs
[iDefaultService
], pszHomename
);
2305 if (!(*(ServicePtrs
[iDefaultService
]->szPath
))
2306 || strequal(ServicePtrs
[iDefaultService
]->szPath
, lp_pathname(GLOBAL_SECTION_SNUM
))) {
2307 pstrcpy(newHomedir
, pszHomedir
);
2308 string_set(&ServicePtrs
[i
]->szPath
, newHomedir
);
2311 if (!(*(ServicePtrs
[i
]->comment
))) {
2313 slprintf(comment
, sizeof(comment
) - 1,
2314 "Home directory of %s", user
);
2315 string_set(&ServicePtrs
[i
]->comment
, comment
);
2318 /* set the browseable flag from the gloabl default */
2320 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
2322 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename
,
2328 /***************************************************************************
2329 Add a new service, based on an old one.
2330 ***************************************************************************/
2332 int lp_add_service(const char *pszService
, int iDefaultService
)
2334 return (add_a_service(ServicePtrs
[iDefaultService
], pszService
));
2337 /***************************************************************************
2338 Add the IPC service.
2339 ***************************************************************************/
2341 static BOOL
lp_add_ipc(const char *ipc_name
, BOOL guest_ok
)
2344 int i
= add_a_service(&sDefault
, ipc_name
);
2349 slprintf(comment
, sizeof(comment
) - 1,
2350 "IPC Service (%s)", Globals
.szServerString
);
2352 string_set(&ServicePtrs
[i
]->szPath
, tmpdir());
2353 string_set(&ServicePtrs
[i
]->szUsername
, "");
2354 string_set(&ServicePtrs
[i
]->comment
, comment
);
2355 string_set(&ServicePtrs
[i
]->fstype
, "IPC");
2356 ServicePtrs
[i
]->iMaxConnections
= 0;
2357 ServicePtrs
[i
]->bAvailable
= True
;
2358 ServicePtrs
[i
]->bRead_only
= True
;
2359 ServicePtrs
[i
]->bGuest_only
= False
;
2360 ServicePtrs
[i
]->bGuest_ok
= guest_ok
;
2361 ServicePtrs
[i
]->bPrint_ok
= False
;
2362 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
2364 DEBUG(3, ("adding IPC service\n"));
2369 /***************************************************************************
2370 Add a new printer service, with defaults coming from service iFrom.
2371 ***************************************************************************/
2373 BOOL
lp_add_printer(const char *pszPrintername
, int iDefaultService
)
2375 const char *comment
= "From Printcap";
2376 int i
= add_a_service(ServicePtrs
[iDefaultService
], pszPrintername
);
2381 /* note that we do NOT default the availability flag to True - */
2382 /* we take it from the default service passed. This allows all */
2383 /* dynamic printers to be disabled by disabling the [printers] */
2384 /* entry (if/when the 'available' keyword is implemented!). */
2386 /* the printer name is set to the service name. */
2387 string_set(&ServicePtrs
[i
]->szPrintername
, pszPrintername
);
2388 string_set(&ServicePtrs
[i
]->comment
, comment
);
2390 /* set the browseable flag from the gloabl default */
2391 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
2393 /* Printers cannot be read_only. */
2394 ServicePtrs
[i
]->bRead_only
= False
;
2395 /* No share modes on printer services. */
2396 ServicePtrs
[i
]->bShareModes
= False
;
2397 /* No oplocks on printer services. */
2398 ServicePtrs
[i
]->bOpLocks
= False
;
2399 /* Printer services must be printable. */
2400 ServicePtrs
[i
]->bPrint_ok
= True
;
2402 DEBUG(3, ("adding printer service %s\n", pszPrintername
));
2404 update_server_announce_as_printserver();
2409 /***************************************************************************
2410 Map a parameter's string representation to something we can use.
2411 Returns False if the parameter string is not recognised, else TRUE.
2412 ***************************************************************************/
2414 static int map_parameter(const char *pszParmName
)
2418 if (*pszParmName
== '-')
2421 for (iIndex
= 0; parm_table
[iIndex
].label
; iIndex
++)
2422 if (strwicmp(parm_table
[iIndex
].label
, pszParmName
) == 0)
2425 /* Warn only if it isn't parametric option */
2426 if (strchr(pszParmName
, ':') == NULL
)
2427 DEBUG(0, ("Unknown parameter encountered: \"%s\"\n", pszParmName
));
2428 /* We do return 'fail' for parametric options as well because they are
2429 stored in different storage
2434 /***************************************************************************
2435 Set a boolean variable from the text value stored in the passed string.
2436 Returns True in success, False if the passed string does not correctly
2437 represent a boolean.
2438 ***************************************************************************/
2440 static BOOL
set_boolean(BOOL
*pb
, const char *pszParmValue
)
2445 if (strwicmp(pszParmValue
, "yes") == 0 ||
2446 strwicmp(pszParmValue
, "true") == 0 ||
2447 strwicmp(pszParmValue
, "1") == 0)
2449 else if (strwicmp(pszParmValue
, "no") == 0 ||
2450 strwicmp(pszParmValue
, "False") == 0 ||
2451 strwicmp(pszParmValue
, "0") == 0)
2455 ("ERROR: Badly formed boolean in configuration file: \"%s\".\n",
2462 /***************************************************************************
2463 Find a service by name. Otherwise works like get_service.
2464 ***************************************************************************/
2466 static int getservicebyname(const char *pszServiceName
, service
* pserviceDest
)
2470 for (iService
= iNumServices
- 1; iService
>= 0; iService
--)
2471 if (VALID(iService
) &&
2472 strwicmp(ServicePtrs
[iService
]->szService
, pszServiceName
) == 0) {
2473 if (pserviceDest
!= NULL
)
2474 copy_service(pserviceDest
, ServicePtrs
[iService
], NULL
);
2481 /***************************************************************************
2482 Copy a service structure to another.
2483 If pcopymapDest is NULL then copy all fields
2484 ***************************************************************************/
2486 static void copy_service(service
* pserviceDest
, service
* pserviceSource
, BOOL
*pcopymapDest
)
2489 BOOL bcopyall
= (pcopymapDest
== NULL
);
2490 param_opt_struct
*data
, *pdata
, *paramo
;
2493 for (i
= 0; parm_table
[i
].label
; i
++)
2494 if (parm_table
[i
].ptr
&& parm_table
[i
].class == P_LOCAL
&&
2495 (bcopyall
|| pcopymapDest
[i
])) {
2496 void *def_ptr
= parm_table
[i
].ptr
;
2498 ((char *)pserviceSource
) + PTR_DIFF(def_ptr
,
2501 ((char *)pserviceDest
) + PTR_DIFF(def_ptr
,
2504 switch (parm_table
[i
].type
) {
2507 *(BOOL
*)dest_ptr
= *(BOOL
*)src_ptr
;
2513 *(int *)dest_ptr
= *(int *)src_ptr
;
2517 *(char *)dest_ptr
= *(char *)src_ptr
;
2521 string_set(dest_ptr
,
2526 string_set(dest_ptr
,
2528 strupper_m(*(char **)dest_ptr
);
2531 str_list_copy((char ***)dest_ptr
, *(const char ***)src_ptr
);
2539 init_copymap(pserviceDest
);
2540 if (pserviceSource
->copymap
)
2541 memcpy((void *)pserviceDest
->copymap
,
2542 (void *)pserviceSource
->copymap
,
2543 sizeof(BOOL
) * NUMPARAMETERS
);
2546 data
= pserviceSource
->param_opt
;
2549 pdata
= pserviceDest
->param_opt
;
2550 /* Traverse destination */
2552 /* If we already have same option, override it */
2553 if (strcmp(pdata
->key
, data
->key
) == 0) {
2554 string_free(&pdata
->value
);
2555 str_list_free(&data
->list
);
2556 pdata
->value
= strdup(data
->value
);
2560 pdata
= pdata
->next
;
2563 paramo
= smb_xmalloc(sizeof(param_opt_struct
));
2564 paramo
->key
= strdup(data
->key
);
2565 paramo
->value
= strdup(data
->value
);
2566 paramo
->list
= NULL
;
2567 DLIST_ADD(pserviceDest
->param_opt
, paramo
);
2573 /***************************************************************************
2574 Check a service for consistency. Return False if the service is in any way
2575 incomplete or faulty, else True.
2576 ***************************************************************************/
2578 static BOOL
service_ok(int iService
)
2583 if (ServicePtrs
[iService
]->szService
[0] == '\0') {
2584 DEBUG(0, ("The following message indicates an internal error:\n"));
2585 DEBUG(0, ("No service name in service entry.\n"));
2589 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
2590 /* I can't see why you'd want a non-printable printer service... */
2591 if (strwicmp(ServicePtrs
[iService
]->szService
, PRINTERS_NAME
) == 0) {
2592 if (!ServicePtrs
[iService
]->bPrint_ok
) {
2593 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
2594 ServicePtrs
[iService
]->szService
));
2595 ServicePtrs
[iService
]->bPrint_ok
= True
;
2597 /* [printers] service must also be non-browsable. */
2598 if (ServicePtrs
[iService
]->bBrowseable
)
2599 ServicePtrs
[iService
]->bBrowseable
= False
;
2602 if (ServicePtrs
[iService
]->szPath
[0] == '\0' &&
2603 strwicmp(ServicePtrs
[iService
]->szService
, HOMES_NAME
) != 0) {
2604 DEBUG(0, ("No path in service %s - using %s\n",
2605 ServicePtrs
[iService
]->szService
, tmpdir()));
2606 string_set(&ServicePtrs
[iService
]->szPath
, tmpdir());
2609 /* If a service is flagged unavailable, log the fact at level 0. */
2610 if (!ServicePtrs
[iService
]->bAvailable
)
2611 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
2612 ServicePtrs
[iService
]->szService
));
2617 static struct file_lists
{
2618 struct file_lists
*next
;
2622 } *file_lists
= NULL
;
2624 /*******************************************************************
2625 Keep a linked list of all config files so we know when one has changed
2626 it's date and needs to be reloaded.
2627 ********************************************************************/
2629 static void add_to_file_list(const char *fname
, const char *subfname
)
2631 struct file_lists
*f
= file_lists
;
2634 if (f
->name
&& !strcmp(f
->name
, fname
))
2640 f
= (struct file_lists
*)malloc(sizeof(file_lists
[0]));
2643 f
->next
= file_lists
;
2644 f
->name
= strdup(fname
);
2649 f
->subfname
= strdup(subfname
);
2655 f
->modtime
= file_modtime(subfname
);
2657 time_t t
= file_modtime(subfname
);
2663 /*******************************************************************
2664 Check if a config file has changed date.
2665 ********************************************************************/
2667 BOOL
lp_file_list_changed(void)
2669 struct file_lists
*f
= file_lists
;
2670 DEBUG(6, ("lp_file_list_changed()\n"));
2676 pstrcpy(n2
, f
->name
);
2677 standard_sub_basic(current_user_info
.smb_name
, n2
,sizeof(n2
));
2679 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
2680 f
->name
, n2
, ctime(&f
->modtime
)));
2682 mod_time
= file_modtime(n2
);
2684 if (mod_time
&& ((f
->modtime
!= mod_time
) || (f
->subfname
== NULL
) || (strcmp(n2
, f
->subfname
) != 0))) {
2686 ("file %s modified: %s\n", n2
,
2688 f
->modtime
= mod_time
;
2689 SAFE_FREE(f
->subfname
);
2690 f
->subfname
= strdup(n2
);
2698 /***************************************************************************
2699 Run standard_sub_basic on netbios name... needed because global_myname
2700 is not accessed through any lp_ macro.
2701 Note: We must *NOT* use string_set() here as ptr points to global_myname.
2702 ***************************************************************************/
2704 static BOOL
handle_netbios_name(const char *pszParmValue
, char **ptr
)
2707 pstring netbios_name
;
2709 pstrcpy(netbios_name
, pszParmValue
);
2711 standard_sub_basic(current_user_info
.smb_name
, netbios_name
,sizeof(netbios_name
));
2713 ret
= set_global_myname(netbios_name
);
2714 string_set(&Globals
.szNetbiosName
,global_myname());
2716 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
2722 static BOOL
handle_charset(const char *pszParmValue
, char **ptr
)
2724 if (strcmp(*ptr
, pszParmValue
) != 0) {
2725 string_set(ptr
, pszParmValue
);
2731 static BOOL
handle_workgroup(const char *pszParmValue
, char **ptr
)
2735 ret
= set_global_myworkgroup(pszParmValue
);
2736 string_set(&Globals
.szWorkgroup
,lp_workgroup());
2741 static BOOL
handle_netbios_scope(const char *pszParmValue
, char **ptr
)
2745 ret
= set_global_scope(pszParmValue
);
2746 string_set(&Globals
.szNetbiosScope
,global_scope());
2751 static BOOL
handle_netbios_aliases(const char *pszParmValue
, char **ptr
)
2753 Globals
.szNetbiosAliases
= str_list_make(pszParmValue
, NULL
);
2754 return set_netbios_aliases((const char **)Globals
.szNetbiosAliases
);
2757 /***************************************************************************
2758 Do the work of sourcing in environment variable/value pairs.
2759 ***************************************************************************/
2761 static BOOL
source_env(char **lines
)
2768 for (i
= 0; lines
[i
]; i
++) {
2769 char *line
= lines
[i
];
2771 if ((len
= strlen(line
)) == 0)
2774 if (line
[len
- 1] == '\n')
2777 if ((varval
= malloc(len
+ 1)) == NULL
) {
2778 DEBUG(0, ("source_env: Not enough memory!\n"));
2782 DEBUG(4, ("source_env: Adding to environment: %s\n", line
));
2783 strncpy(varval
, line
, len
);
2786 p
= strchr_m(line
, (int)'=');
2788 DEBUG(4, ("source_env: missing '=': %s\n", line
));
2792 if (putenv(varval
)) {
2793 DEBUG(0, ("source_env: Failed to put environment variable %s\n",
2800 DEBUG(4, ("source_env: getting var %s = %s\n", line
, getenv(line
)));
2803 DEBUG(4, ("source_env: returning successfully\n"));
2807 /***************************************************************************
2808 Handle the source environment operation.
2809 ***************************************************************************/
2811 static BOOL
handle_source_env(const char *pszParmValue
, char **ptr
)
2818 pstrcpy(fname
, pszParmValue
);
2820 standard_sub_basic(current_user_info
.smb_name
, fname
,sizeof(fname
));
2822 string_set(ptr
, pszParmValue
);
2824 DEBUG(4, ("handle_source_env: checking env type\n"));
2827 * Filename starting with '|' means popen and read from stdin.
2831 lines
= file_lines_pload(p
+ 1, NULL
);
2833 lines
= file_lines_load(fname
, NULL
);
2836 DEBUG(0, ("handle_source_env: Failed to open file %s, Error was %s\n",
2837 fname
, strerror(errno
)));
2841 result
= source_env(lines
);
2842 file_lines_free(lines
);
2847 /***************************************************************************
2848 Handle the include operation.
2849 ***************************************************************************/
2851 static BOOL
handle_include(const char *pszParmValue
, char **ptr
)
2854 pstrcpy(fname
, pszParmValue
);
2856 standard_sub_basic(current_user_info
.smb_name
, fname
,sizeof(fname
));
2858 add_to_file_list(pszParmValue
, fname
);
2860 string_set(ptr
, fname
);
2862 if (file_exist(fname
, NULL
))
2863 return (pm_process(fname
, do_section
, do_parameter
));
2865 DEBUG(2, ("Can't find include file %s\n", fname
));
2870 /***************************************************************************
2871 Handle the interpretation of the copy parameter.
2872 ***************************************************************************/
2874 static BOOL
handle_copy(const char *pszParmValue
, char **ptr
)
2878 service serviceTemp
;
2880 string_set(ptr
, pszParmValue
);
2882 init_service(&serviceTemp
);
2886 DEBUG(3, ("Copying service from service %s\n", pszParmValue
));
2888 if ((iTemp
= getservicebyname(pszParmValue
, &serviceTemp
)) >= 0) {
2889 if (iTemp
== iServiceIndex
) {
2890 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue
));
2892 copy_service(ServicePtrs
[iServiceIndex
],
2894 ServicePtrs
[iServiceIndex
]->copymap
);
2898 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue
));
2902 free_service(&serviceTemp
);
2906 /***************************************************************************
2907 Handle idmap/non unix account uid and gid allocation parameters. The format of these
2912 idmap uid = 1000-1999
2915 We only do simple parsing checks here. The strings are parsed into useful
2916 structures in the idmap daemon code.
2918 ***************************************************************************/
2920 /* Some lp_ routines to return idmap [ug]id information */
2922 static uid_t idmap_uid_low
, idmap_uid_high
;
2923 static gid_t idmap_gid_low
, idmap_gid_high
;
2925 BOOL
lp_idmap_uid(uid_t
*low
, uid_t
*high
)
2927 if (idmap_uid_low
== 0 || idmap_uid_high
== 0)
2931 *low
= idmap_uid_low
;
2934 *high
= idmap_uid_high
;
2939 BOOL
lp_idmap_gid(gid_t
*low
, gid_t
*high
)
2941 if (idmap_gid_low
== 0 || idmap_gid_high
== 0)
2945 *low
= idmap_gid_low
;
2948 *high
= idmap_gid_high
;
2953 /* Do some simple checks on "idmap [ug]id" parameter values */
2955 static BOOL
handle_idmap_uid(const char *pszParmValue
, char **ptr
)
2959 if (sscanf(pszParmValue
, "%u-%u", &low
, &high
) != 2 || high
< low
)
2964 string_set(ptr
, pszParmValue
);
2966 idmap_uid_low
= low
;
2967 idmap_uid_high
= high
;
2972 static BOOL
handle_idmap_gid(const char *pszParmValue
, char **ptr
)
2976 if (sscanf(pszParmValue
, "%u-%u", &low
, &high
) != 2 || high
< low
)
2981 string_set(ptr
, pszParmValue
);
2983 idmap_gid_low
= low
;
2984 idmap_gid_high
= high
;
2989 /***************************************************************************
2990 Handle the DEBUG level list.
2991 ***************************************************************************/
2993 static BOOL
handle_debug_list( const char *pszParmValueIn
, char **ptr
)
2995 pstring pszParmValue
;
2997 pstrcpy(pszParmValue
, pszParmValueIn
);
2998 string_set(ptr
, pszParmValueIn
);
2999 return debug_parse_levels( pszParmValue
);
3002 /***************************************************************************
3003 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
3004 ***************************************************************************/
3006 static char* append_ldap_suffix( const char *str
)
3008 char *suffix_string
;
3012 lp_talloc
= talloc_init("lp_talloc");
3014 suffix_string
= talloc_asprintf( lp_talloc
, "%s,%s", str
, Globals
.szLdapSuffix
);
3015 if ( !suffix_string
) {
3016 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
3020 return suffix_string
;
3023 char *lp_ldap_machine_suffix(void)
3025 if (Globals
.szLdapMachineSuffix
[0])
3026 return append_ldap_suffix(Globals
.szLdapMachineSuffix
);
3028 return lp_string(Globals
.szLdapSuffix
);
3031 char *lp_ldap_user_suffix(void)
3033 if (Globals
.szLdapUserSuffix
[0])
3034 return append_ldap_suffix(Globals
.szLdapUserSuffix
);
3036 return lp_string(Globals
.szLdapSuffix
);
3039 char *lp_ldap_group_suffix(void)
3041 if (Globals
.szLdapGroupSuffix
[0])
3042 return append_ldap_suffix(Globals
.szLdapGroupSuffix
);
3044 return lp_string(Globals
.szLdapSuffix
);
3047 char *lp_ldap_idmap_suffix(void)
3049 if (Globals
.szLdapIdmapSuffix
[0])
3050 return append_ldap_suffix(Globals
.szLdapIdmapSuffix
);
3052 return lp_string(Globals
.szLdapSuffix
);
3055 /***************************************************************************
3056 ***************************************************************************/
3058 static BOOL
handle_acl_compatibility(const char *pszParmValue
, char **ptr
)
3060 if (strequal(pszParmValue
, "auto"))
3061 string_set(ptr
, "");
3062 else if (strequal(pszParmValue
, "winnt"))
3063 string_set(ptr
, "winnt");
3064 else if (strequal(pszParmValue
, "win2k"))
3065 string_set(ptr
, "win2k");
3072 /***************************************************************************
3073 Initialise a copymap.
3074 ***************************************************************************/
3076 static void init_copymap(service
* pservice
)
3079 SAFE_FREE(pservice
->copymap
);
3080 pservice
->copymap
= (BOOL
*)malloc(sizeof(BOOL
) * NUMPARAMETERS
);
3081 if (!pservice
->copymap
)
3083 ("Couldn't allocate copymap!! (size %d)\n",
3084 (int)NUMPARAMETERS
));
3086 for (i
= 0; i
< NUMPARAMETERS
; i
++)
3087 pservice
->copymap
[i
] = True
;
3090 /***************************************************************************
3091 Return the local pointer to a parameter given the service number and the
3092 pointer into the default structure.
3093 ***************************************************************************/
3095 void *lp_local_ptr(int snum
, void *ptr
)
3097 return (void *)(((char *)ServicePtrs
[snum
]) + PTR_DIFF(ptr
, &sDefault
));
3100 /***************************************************************************
3101 Process a parameter for a particular service number. If snum < 0
3102 then assume we are in the globals.
3103 ***************************************************************************/
3105 BOOL
lp_do_parameter(int snum
, const char *pszParmName
, const char *pszParmValue
)
3107 int parmnum
, i
, slen
;
3108 void *parm_ptr
= NULL
; /* where we are going to store the result */
3109 void *def_ptr
= NULL
;
3112 param_opt_struct
*paramo
, *data
;
3115 parmnum
= map_parameter(pszParmName
);
3118 if ((sep
=strchr(pszParmName
, ':')) != NULL
) {
3120 ZERO_STRUCT(param_key
);
3121 pstr_sprintf(param_key
, "%s:", pszParmName
);
3122 slen
= strlen(param_key
);
3123 pstrcat(param_key
, sep
+1);
3124 trim_char(param_key
+slen
, ' ', ' ');
3126 data
= (snum
< 0) ? Globals
.param_opt
:
3127 ServicePtrs
[snum
]->param_opt
;
3128 /* Traverse destination */
3130 /* If we already have same option, override it */
3131 if (strcmp(data
->key
, param_key
) == 0) {
3132 string_free(&data
->value
);
3133 str_list_free(&data
->list
);
3134 data
->value
= strdup(pszParmValue
);
3141 paramo
= smb_xmalloc(sizeof(param_opt_struct
));
3142 paramo
->key
= strdup(param_key
);
3143 paramo
->value
= strdup(pszParmValue
);
3144 paramo
->list
= NULL
;
3146 DLIST_ADD(Globals
.param_opt
, paramo
);
3148 DLIST_ADD(ServicePtrs
[snum
]->param_opt
, paramo
);
3155 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName
));
3159 if (parm_table
[parmnum
].flags
& FLAG_DEPRECATED
) {
3160 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
3164 def_ptr
= parm_table
[parmnum
].ptr
;
3166 /* we might point at a service, the default service or a global */
3170 if (parm_table
[parmnum
].class == P_GLOBAL
) {
3172 ("Global parameter %s found in service section!\n",
3177 ((char *)ServicePtrs
[snum
]) + PTR_DIFF(def_ptr
,
3182 if (!ServicePtrs
[snum
]->copymap
)
3183 init_copymap(ServicePtrs
[snum
]);
3185 /* this handles the aliases - set the copymap for other entries with
3186 the same data pointer */
3187 for (i
= 0; parm_table
[i
].label
; i
++)
3188 if (parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
)
3189 ServicePtrs
[snum
]->copymap
[i
] = False
;
3192 /* if it is a special case then go ahead */
3193 if (parm_table
[parmnum
].special
) {
3194 parm_table
[parmnum
].special(pszParmValue
, (char **)parm_ptr
);
3198 /* now switch on the type of variable it is */
3199 switch (parm_table
[parmnum
].type
)
3202 set_boolean(parm_ptr
, pszParmValue
);
3206 set_boolean(parm_ptr
, pszParmValue
);
3207 *(BOOL
*)parm_ptr
= !*(BOOL
*)parm_ptr
;
3211 *(int *)parm_ptr
= atoi(pszParmValue
);
3215 *(char *)parm_ptr
= *pszParmValue
;
3219 sscanf(pszParmValue
, "%o", (int *)parm_ptr
);
3223 str_list_free(parm_ptr
);
3224 *(char ***)parm_ptr
= str_list_make(pszParmValue
, NULL
);
3228 string_set(parm_ptr
, pszParmValue
);
3232 string_set(parm_ptr
, pszParmValue
);
3233 strupper_m(*(char **)parm_ptr
);
3237 pstrcpy((char *)parm_ptr
, pszParmValue
);
3241 pstrcpy((char *)parm_ptr
, pszParmValue
);
3242 strupper_m((char *)parm_ptr
);
3246 for (i
= 0; parm_table
[parmnum
].enum_list
[i
].name
; i
++) {
3249 parm_table
[parmnum
].enum_list
[i
].name
)) {
3251 parm_table
[parmnum
].
3264 /***************************************************************************
3265 Process a parameter.
3266 ***************************************************************************/
3268 static BOOL
do_parameter(const char *pszParmName
, const char *pszParmValue
)
3270 if (!bInGlobalSection
&& bGlobalOnly
)
3273 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName
, pszParmValue
));
3275 return (lp_do_parameter(bInGlobalSection
? -2 : iServiceIndex
,
3276 pszParmName
, pszParmValue
));
3279 /***************************************************************************
3280 Print a parameter of the specified type.
3281 ***************************************************************************/
3283 static void print_parameter(struct parm_struct
*p
, void *ptr
, FILE * f
)
3289 for (i
= 0; p
->enum_list
[i
].name
; i
++) {
3290 if (*(int *)ptr
== p
->enum_list
[i
].value
) {
3292 p
->enum_list
[i
].name
);
3299 fprintf(f
, "%s", BOOLSTR(*(BOOL
*)ptr
));
3303 fprintf(f
, "%s", BOOLSTR(!*(BOOL
*)ptr
));
3307 fprintf(f
, "%d", *(int *)ptr
);
3311 fprintf(f
, "%c", *(char *)ptr
);
3315 fprintf(f
, "%s", octal_string(*(int *)ptr
));
3319 if ((char ***)ptr
&& *(char ***)ptr
) {
3320 char **list
= *(char ***)ptr
;
3322 for (; *list
; list
++) {
3323 /* surround strings with whitespace in single quotes */
3324 if ( strchr_m( *list
, ' ' ) )
3325 fprintf(f
, "\'%s\'%s", *list
, ((*(list
+1))?", ":""));
3327 fprintf(f
, "%s%s", *list
, ((*(list
+1))?", ":""));
3335 fprintf(f
, "%s", (char *)ptr
);
3341 if (*(char **)ptr
) {
3342 fprintf(f
, "%s", *(char **)ptr
);
3350 /***************************************************************************
3351 Check if two parameters are equal.
3352 ***************************************************************************/
3354 static BOOL
equal_parameter(parm_type type
, void *ptr1
, void *ptr2
)
3359 return (*((BOOL
*)ptr1
) == *((BOOL
*)ptr2
));
3364 return (*((int *)ptr1
) == *((int *)ptr2
));
3367 return (*((char *)ptr1
) == *((char *)ptr2
));
3370 return str_list_compare(*(char ***)ptr1
, *(char ***)ptr2
);
3375 char *p1
= (char *)ptr1
, *p2
= (char *)ptr2
;
3380 return (p1
== p2
|| strequal(p1
, p2
));
3385 char *p1
= *(char **)ptr1
, *p2
= *(char **)ptr2
;
3390 return (p1
== p2
|| strequal(p1
, p2
));
3398 /***************************************************************************
3399 Initialize any local varients in the sDefault table.
3400 ***************************************************************************/
3402 void init_locals(void)
3407 /***************************************************************************
3408 Process a new section (service). At this stage all sections are services.
3409 Later we'll have special sections that permit server parameters to be set.
3410 Returns True on success, False on failure.
3411 ***************************************************************************/
3413 static BOOL
do_section(const char *pszSectionName
)
3416 BOOL isglobal
= ((strwicmp(pszSectionName
, GLOBAL_NAME
) == 0) ||
3417 (strwicmp(pszSectionName
, GLOBAL_NAME2
) == 0));
3420 /* if we were in a global section then do the local inits */
3421 if (bInGlobalSection
&& !isglobal
)
3424 /* if we've just struck a global section, note the fact. */
3425 bInGlobalSection
= isglobal
;
3427 /* check for multiple global sections */
3428 if (bInGlobalSection
) {
3429 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName
));
3433 if (!bInGlobalSection
&& bGlobalOnly
)
3436 /* if we have a current service, tidy it up before moving on */
3439 if (iServiceIndex
>= 0)
3440 bRetval
= service_ok(iServiceIndex
);
3442 /* if all is still well, move to the next record in the services array */
3444 /* We put this here to avoid an odd message order if messages are */
3445 /* issued by the post-processing of a previous section. */
3446 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName
));
3448 if ((iServiceIndex
= add_a_service(&sDefault
, pszSectionName
))
3450 DEBUG(0, ("Failed to add a new service\n"));
3459 /***************************************************************************
3460 Determine if a partcular base parameter is currentl set to the default value.
3461 ***************************************************************************/
3463 static BOOL
is_default(int i
)
3465 if (!defaults_saved
)
3467 switch (parm_table
[i
].type
) {
3469 return str_list_compare (parm_table
[i
].def
.lvalue
,
3470 *(char ***)parm_table
[i
].ptr
);
3473 return strequal(parm_table
[i
].def
.svalue
,
3474 *(char **)parm_table
[i
].ptr
);
3477 return strequal(parm_table
[i
].def
.svalue
,
3478 (char *)parm_table
[i
].ptr
);
3481 return parm_table
[i
].def
.bvalue
==
3482 *(BOOL
*)parm_table
[i
].ptr
;
3484 return parm_table
[i
].def
.cvalue
==
3485 *(char *)parm_table
[i
].ptr
;
3489 return parm_table
[i
].def
.ivalue
==
3490 *(int *)parm_table
[i
].ptr
;
3497 /***************************************************************************
3498 Display the contents of the global structure.
3499 ***************************************************************************/
3501 static void dump_globals(FILE *f
)
3504 param_opt_struct
*data
;
3506 fprintf(f
, "# Global parameters\n[global]\n");
3508 for (i
= 0; parm_table
[i
].label
; i
++)
3509 if (parm_table
[i
].class == P_GLOBAL
&&
3510 parm_table
[i
].ptr
&&
3511 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
))) {
3512 if (defaults_saved
&& is_default(i
))
3514 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
3515 print_parameter(&parm_table
[i
], parm_table
[i
].ptr
, f
);
3518 if (Globals
.param_opt
!= NULL
) {
3519 data
= Globals
.param_opt
;
3521 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
3528 /***************************************************************************
3529 Return True if a local parameter is currently set to the global default.
3530 ***************************************************************************/
3532 BOOL
lp_is_default(int snum
, struct parm_struct
*parm
)
3534 int pdiff
= PTR_DIFF(parm
->ptr
, &sDefault
);
3536 return equal_parameter(parm
->type
,
3537 ((char *)ServicePtrs
[snum
]) + pdiff
,
3538 ((char *)&sDefault
) + pdiff
);
3541 /***************************************************************************
3542 Display the contents of a single services record.
3543 ***************************************************************************/
3545 static void dump_a_service(service
* pService
, FILE * f
)
3548 param_opt_struct
*data
;
3550 if (pService
!= &sDefault
)
3551 fprintf(f
, "\n[%s]\n", pService
->szService
);
3553 for (i
= 0; parm_table
[i
].label
; i
++)
3554 if (parm_table
[i
].class == P_LOCAL
&&
3555 parm_table
[i
].ptr
&&
3556 (*parm_table
[i
].label
!= '-') &&
3557 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
))) {
3558 int pdiff
= PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
3560 if (pService
== &sDefault
) {
3561 if (defaults_saved
&& is_default(i
))
3564 if (equal_parameter(parm_table
[i
].type
,
3565 ((char *)pService
) +
3567 ((char *)&sDefault
) +
3572 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
3573 print_parameter(&parm_table
[i
],
3574 ((char *)pService
) + pdiff
, f
);
3577 if (pService
->param_opt
!= NULL
) {
3578 data
= pService
->param_opt
;
3580 fprintf(f
, "\t%s = %s\n", data
->key
, data
->value
);
3587 /***************************************************************************
3588 Return info about the next service in a service. snum==GLOBAL_SECTION_SNUM gives the globals.
3589 Return NULL when out of parameters.
3590 ***************************************************************************/
3592 struct parm_struct
*lp_next_parameter(int snum
, int *i
, int allparameters
)
3595 /* do the globals */
3596 for (; parm_table
[*i
].label
; (*i
)++) {
3597 if (parm_table
[*i
].class == P_SEPARATOR
)
3598 return &parm_table
[(*i
)++];
3600 if (!parm_table
[*i
].ptr
3601 || (*parm_table
[*i
].label
== '-'))
3605 && (parm_table
[*i
].ptr
==
3606 parm_table
[(*i
) - 1].ptr
))
3609 return &parm_table
[(*i
)++];
3612 service
*pService
= ServicePtrs
[snum
];
3614 for (; parm_table
[*i
].label
; (*i
)++) {
3615 if (parm_table
[*i
].class == P_SEPARATOR
)
3616 return &parm_table
[(*i
)++];
3618 if (parm_table
[*i
].class == P_LOCAL
&&
3619 parm_table
[*i
].ptr
&&
3620 (*parm_table
[*i
].label
!= '-') &&
3622 (parm_table
[*i
].ptr
!=
3623 parm_table
[(*i
) - 1].ptr
)))
3626 PTR_DIFF(parm_table
[*i
].ptr
,
3629 if (allparameters
||
3630 !equal_parameter(parm_table
[*i
].type
,
3631 ((char *)pService
) +
3633 ((char *)&sDefault
) +
3636 return &parm_table
[(*i
)++];
3647 /***************************************************************************
3648 Display the contents of a single copy structure.
3649 ***************************************************************************/
3650 static void dump_copy_map(BOOL
*pcopymap
)
3656 printf("\n\tNon-Copied parameters:\n");
3658 for (i
= 0; parm_table
[i
].label
; i
++)
3659 if (parm_table
[i
].class == P_LOCAL
&&
3660 parm_table
[i
].ptr
&& !pcopymap
[i
] &&
3661 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
3663 printf("\t\t%s\n", parm_table
[i
].label
);
3668 /***************************************************************************
3669 Return TRUE if the passed service number is within range.
3670 ***************************************************************************/
3672 BOOL
lp_snum_ok(int iService
)
3674 return (LP_SNUM_OK(iService
) && ServicePtrs
[iService
]->bAvailable
);
3677 /***************************************************************************
3678 Auto-load some home services.
3679 ***************************************************************************/
3681 static void lp_add_auto_services(char *str
)
3694 homes
= lp_servicenumber(HOMES_NAME
);
3696 for (p
= strtok(s
, LIST_SEP
); p
; p
= strtok(NULL
, LIST_SEP
)) {
3697 char *home
= get_user_home_dir(p
);
3699 if (lp_servicenumber(p
) >= 0)
3702 if (home
&& homes
>= 0)
3703 lp_add_home(p
, homes
, p
, home
);
3708 /***************************************************************************
3709 Auto-load one printer.
3710 ***************************************************************************/
3712 void lp_add_one_printer(char *name
, char *comment
)
3714 int printers
= lp_servicenumber(PRINTERS_NAME
);
3717 if (lp_servicenumber(name
) < 0) {
3718 lp_add_printer(name
, printers
);
3719 if ((i
= lp_servicenumber(name
)) >= 0) {
3720 string_set(&ServicePtrs
[i
]->comment
, comment
);
3721 ServicePtrs
[i
]->autoloaded
= True
;
3726 /***************************************************************************
3727 Announce ourselves as a print server.
3728 ***************************************************************************/
3730 void update_server_announce_as_printserver(void)
3732 default_server_announce
|= SV_TYPE_PRINTQ_SERVER
;
3735 /***************************************************************************
3736 Have we loaded a services file yet?
3737 ***************************************************************************/
3739 BOOL
lp_loaded(void)
3744 /***************************************************************************
3745 Unload unused services.
3746 ***************************************************************************/
3748 void lp_killunused(BOOL (*snumused
) (int))
3751 for (i
= 0; i
< iNumServices
; i
++) {
3755 if (!snumused
|| !snumused(i
)) {
3756 ServicePtrs
[i
]->valid
= False
;
3757 free_service(ServicePtrs
[i
]);
3762 /***************************************************************************
3764 ***************************************************************************/
3766 void lp_killservice(int iServiceIn
)
3768 if (VALID(iServiceIn
)) {
3769 ServicePtrs
[iServiceIn
]->valid
= False
;
3770 free_service(ServicePtrs
[iServiceIn
]);
3774 /***************************************************************************
3775 Save the curent values of all global and sDefault parameters into the
3776 defaults union. This allows swat and testparm to show only the
3777 changed (ie. non-default) parameters.
3778 ***************************************************************************/
3780 static void lp_save_defaults(void)
3783 for (i
= 0; parm_table
[i
].label
; i
++) {
3784 if (i
> 0 && parm_table
[i
].ptr
== parm_table
[i
- 1].ptr
)
3786 switch (parm_table
[i
].type
) {
3788 str_list_copy(&(parm_table
[i
].def
.lvalue
),
3789 *(const char ***)parm_table
[i
].ptr
);
3793 if (parm_table
[i
].ptr
) {
3794 parm_table
[i
].def
.svalue
= strdup(*(char **)parm_table
[i
].ptr
);
3796 parm_table
[i
].def
.svalue
= NULL
;
3801 if (parm_table
[i
].ptr
) {
3802 parm_table
[i
].def
.svalue
= strdup((char *)parm_table
[i
].ptr
);
3804 parm_table
[i
].def
.svalue
= NULL
;
3809 parm_table
[i
].def
.bvalue
=
3810 *(BOOL
*)parm_table
[i
].ptr
;
3813 parm_table
[i
].def
.cvalue
=
3814 *(char *)parm_table
[i
].ptr
;
3819 parm_table
[i
].def
.ivalue
=
3820 *(int *)parm_table
[i
].ptr
;
3826 defaults_saved
= True
;
3829 /*******************************************************************
3830 Set the server type we will announce as via nmbd.
3831 ********************************************************************/
3833 static void set_server_role(void)
3835 server_role
= ROLE_STANDALONE
;
3837 switch (lp_security()) {
3839 if (lp_domain_logons())
3840 DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
3843 if (lp_domain_logons())
3844 DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
3845 server_role
= ROLE_DOMAIN_MEMBER
;
3848 if (lp_domain_logons()) {
3849 DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
3850 server_role
= ROLE_DOMAIN_BDC
;
3853 server_role
= ROLE_DOMAIN_MEMBER
;
3856 if (lp_domain_logons()) {
3857 server_role
= ROLE_DOMAIN_PDC
;
3860 server_role
= ROLE_DOMAIN_MEMBER
;
3863 if (lp_domain_logons()) {
3865 if (Globals
.bDomainMaster
) /* auto or yes */
3866 server_role
= ROLE_DOMAIN_PDC
;
3868 server_role
= ROLE_DOMAIN_BDC
;
3872 DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
3876 DEBUG(10, ("set_server_role: role = "));
3878 switch(server_role
) {
3879 case ROLE_STANDALONE
:
3880 DEBUGADD(10, ("ROLE_STANDALONE\n"));
3882 case ROLE_DOMAIN_MEMBER
:
3883 DEBUGADD(10, ("ROLE_DOMAIN_MEMBER\n"));
3885 case ROLE_DOMAIN_BDC
:
3886 DEBUGADD(10, ("ROLE_DOMAIN_BDC\n"));
3888 case ROLE_DOMAIN_PDC
:
3889 DEBUGADD(10, ("ROLE_DOMAIN_PDC\n"));
3894 /***********************************************************
3895 If we should send plaintext/LANMAN passwords in the clinet
3896 ************************************************************/
3897 static void set_allowed_client_auth(void)
3899 if (Globals
.bClientNTLMv2Auth
) {
3900 Globals
.bClientLanManAuth
= False
;
3902 if (!Globals
.bClientLanManAuth
) {
3903 Globals
.bClientPlaintextAuth
= False
;
3907 /***************************************************************************
3908 Load the services array from the services file. Return True on success,
3910 ***************************************************************************/
3912 BOOL
lp_load(const char *pszFname
, BOOL global_only
, BOOL save_defaults
,
3917 param_opt_struct
*data
, *pdata
;
3919 pstrcpy(n2
, pszFname
);
3920 standard_sub_basic(current_user_info
.smb_name
, n2
,sizeof(n2
));
3922 add_to_file_list(pszFname
, n2
);
3926 DEBUG(3, ("lp_load: refreshing parameters\n"));
3928 bInGlobalSection
= True
;
3929 bGlobalOnly
= global_only
;
3940 if (Globals
.param_opt
!= NULL
) {
3941 data
= Globals
.param_opt
;
3943 string_free(&data
->key
);
3944 string_free(&data
->value
);
3945 str_list_free(&data
->list
);
3950 Globals
.param_opt
= NULL
;
3953 /* We get sections first, so have to start 'behind' to make up */
3955 bRetval
= pm_process(n2
, do_section
, do_parameter
);
3957 /* finish up the last section */
3958 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval
)));
3960 if (iServiceIndex
>= 0)
3961 bRetval
= service_ok(iServiceIndex
);
3963 lp_add_auto_services(lp_auto_services());
3966 /* When 'restrict anonymous = 2' guest connections to ipc$
3968 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
3969 lp_add_ipc("ADMIN$", False
);
3973 set_default_server_announce_type();
3974 set_allowed_client_auth();
3978 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
3979 /* if bWINSsupport is true and we are in the client */
3980 if (in_client
&& Globals
.bWINSsupport
) {
3981 lp_do_parameter(GLOBAL_SECTION_SNUM
, "wins server", "127.0.0.1");
3989 /***************************************************************************
3990 Reset the max number of services.
3991 ***************************************************************************/
3993 void lp_resetnumservices(void)
3998 /***************************************************************************
3999 Return the max number of services.
4000 ***************************************************************************/
4002 int lp_numservices(void)
4004 return (iNumServices
);
4007 /***************************************************************************
4008 Display the contents of the services array in human-readable form.
4009 ***************************************************************************/
4011 void lp_dump(FILE *f
, BOOL show_defaults
, int maxtoprint
)
4016 defaults_saved
= False
;
4020 dump_a_service(&sDefault
, f
);
4022 for (iService
= 0; iService
< maxtoprint
; iService
++)
4023 lp_dump_one(f
, show_defaults
, iService
);
4026 /***************************************************************************
4027 Display the contents of one service in human-readable form.
4028 ***************************************************************************/
4030 void lp_dump_one(FILE * f
, BOOL show_defaults
, int snum
)
4033 if (ServicePtrs
[snum
]->szService
[0] == '\0')
4035 dump_a_service(ServicePtrs
[snum
], f
);
4039 /***************************************************************************
4040 Return the number of the service with the given name, or -1 if it doesn't
4041 exist. Note that this is a DIFFERENT ANIMAL from the internal function
4042 getservicebyname()! This works ONLY if all services have been loaded, and
4043 does not copy the found service.
4044 ***************************************************************************/
4046 int lp_servicenumber(const char *pszServiceName
)
4049 fstring serviceName
;
4051 if (!pszServiceName
)
4052 return GLOBAL_SECTION_SNUM
;
4054 for (iService
= iNumServices
- 1; iService
>= 0; iService
--) {
4055 if (VALID(iService
) && ServicePtrs
[iService
]->szService
) {
4057 * The substitution here is used to support %U is
4060 fstrcpy(serviceName
, ServicePtrs
[iService
]->szService
);
4061 standard_sub_basic(current_user_info
.smb_name
, serviceName
,sizeof(serviceName
));
4062 if (strequal(serviceName
, pszServiceName
))
4068 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName
));
4069 return GLOBAL_SECTION_SNUM
;
4075 /*******************************************************************
4076 A useful volume label function.
4077 ********************************************************************/
4079 char *volume_label(int snum
)
4081 char *ret
= lp_volume(snum
);
4083 return lp_servicename(snum
);
4088 /*******************************************************************
4089 Set the server type we will announce as via nmbd.
4090 ********************************************************************/
4092 static void set_default_server_announce_type(void)
4094 default_server_announce
= 0;
4095 default_server_announce
|= SV_TYPE_WORKSTATION
;
4096 default_server_announce
|= SV_TYPE_SERVER
;
4097 default_server_announce
|= SV_TYPE_SERVER_UNIX
;
4099 switch (lp_announce_as()) {
4100 case ANNOUNCE_AS_NT_SERVER
:
4101 default_server_announce
|= SV_TYPE_SERVER_NT
;
4102 /* fall through... */
4103 case ANNOUNCE_AS_NT_WORKSTATION
:
4104 default_server_announce
|= SV_TYPE_NT
;
4106 case ANNOUNCE_AS_WIN95
:
4107 default_server_announce
|= SV_TYPE_WIN95_PLUS
;
4109 case ANNOUNCE_AS_WFW
:
4110 default_server_announce
|= SV_TYPE_WFW
;
4116 switch (lp_server_role()) {
4117 case ROLE_DOMAIN_MEMBER
:
4118 default_server_announce
|= SV_TYPE_DOMAIN_MEMBER
;
4120 case ROLE_DOMAIN_PDC
:
4121 default_server_announce
|= SV_TYPE_DOMAIN_CTRL
;
4123 case ROLE_DOMAIN_BDC
:
4124 default_server_announce
|= SV_TYPE_DOMAIN_BAKCTRL
;
4126 case ROLE_STANDALONE
:
4130 if (lp_time_server())
4131 default_server_announce
|= SV_TYPE_TIME_SOURCE
;
4133 if (lp_host_msdfs())
4134 default_server_announce
|= SV_TYPE_DFS_SERVER
;
4137 /***********************************************************
4138 returns role of Samba server
4139 ************************************************************/
4141 int lp_server_role(void)
4146 /***********************************************************
4147 If we are PDC then prefer us as DMB
4148 ************************************************************/
4150 BOOL
lp_domain_master(void)
4152 if (Globals
.bDomainMaster
== Auto
)
4153 return (lp_server_role() == ROLE_DOMAIN_PDC
);
4155 return Globals
.bDomainMaster
;
4158 /***********************************************************
4159 If we are DMB then prefer us as LMB
4160 ************************************************************/
4162 BOOL
lp_preferred_master(void)
4164 if (Globals
.bPreferredMaster
== Auto
)
4165 return (lp_local_master() && lp_domain_master());
4167 return Globals
.bPreferredMaster
;
4170 /*******************************************************************
4172 ********************************************************************/
4174 void lp_remove_service(int snum
)
4176 ServicePtrs
[snum
]->valid
= False
;
4179 /*******************************************************************
4181 ********************************************************************/
4183 void lp_copy_service(int snum
, const char *new_name
)
4185 do_section(new_name
);
4187 snum
= lp_servicenumber(new_name
);
4189 lp_do_parameter(snum
, "copy", lp_servicename(snum
));
4194 /*******************************************************************
4195 Get the default server type we will announce as via nmbd.
4196 ********************************************************************/
4198 int lp_default_server_announce(void)
4200 return default_server_announce
;
4203 /*******************************************************************
4204 Split the announce version into major and minor numbers.
4205 ********************************************************************/
4207 int lp_major_announce_version(void)
4209 static BOOL got_major
= False
;
4210 static int major_version
= DEFAULT_MAJOR_VERSION
;
4215 return major_version
;
4218 if ((vers
= lp_announce_version()) == NULL
)
4219 return major_version
;
4221 if ((p
= strchr_m(vers
, '.')) == 0)
4222 return major_version
;
4225 major_version
= atoi(vers
);
4226 return major_version
;
4229 int lp_minor_announce_version(void)
4231 static BOOL got_minor
= False
;
4232 static int minor_version
= DEFAULT_MINOR_VERSION
;
4237 return minor_version
;
4240 if ((vers
= lp_announce_version()) == NULL
)
4241 return minor_version
;
4243 if ((p
= strchr_m(vers
, '.')) == 0)
4244 return minor_version
;
4247 minor_version
= atoi(p
);
4248 return minor_version
;
4251 /***********************************************************
4252 Set the global name resolution order (used in smbclient).
4253 ************************************************************/
4255 void lp_set_name_resolve_order(const char *new_order
)
4257 string_set(&Globals
.szNameResolveOrder
, new_order
);
4260 const char *lp_printername(int snum
)
4262 const char *ret
= _lp_printername(snum
);
4263 if (ret
== NULL
|| (ret
!= NULL
&& *ret
== '\0'))
4264 ret
= lp_const_servicename(snum
);
4270 /****************************************************************
4271 Compatibility fn. for 2.2.2 code.....
4272 *****************************************************************/
4274 void get_private_directory(pstring privdir
)
4276 pstrcpy (privdir
, lp_private_dir());
4279 /***********************************************************
4280 Allow daemons such as winbindd to fix their logfile name.
4281 ************************************************************/
4283 void lp_set_logfile(const char *name
)
4285 extern pstring debugf
;
4286 string_set(&Globals
.szLogFile
, name
);
4287 pstrcpy(debugf
, name
);
4290 /*******************************************************************
4291 Return the NetBIOS called name, or my IP - but never global_myname().
4292 ********************************************************************/
4294 const char *get_called_name(void)
4296 extern fstring local_machine
;
4297 static fstring called_name
;
4299 if (!*local_machine
) {
4300 fstrcpy(called_name
, get_my_primary_ip());
4301 DEBUG(8,("get_called_name: assuming that client used IP address [%s] as called name.\n",
4306 return local_machine
;
4309 /*******************************************************************
4310 Return the max print jobs per queue.
4311 ********************************************************************/
4313 int lp_maxprintjobs(int snum
)
4315 int maxjobs
= LP_SNUM_OK(snum
) ? ServicePtrs
[snum
]->iMaxPrintJobs
: sDefault
.iMaxPrintJobs
;
4316 if (maxjobs
<= 0 || maxjobs
>= PRINT_MAX_JOBID
)
4317 maxjobs
= PRINT_MAX_JOBID
- 1;
4322 /*******************************************************************
4323 Ensure we don't use sendfile if server smb signing is active.
4324 ********************************************************************/
4326 BOOL
lp_use_sendfile(int snum
)
4328 return (_lp_use_sendfile(snum
) && !srv_is_signing_active());