2 Unix SMB/Netbios implementation.
4 Parameter loading functions
5 Copyright (C) Karl Auer 1993-1998
7 Largely re-written by Andrew Tridgell, September 1994
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 * This module provides suitable callback functions for the params
28 * module. It builds the internal table of service details which is
29 * then used by the rest of the server.
33 * 1) add it to the global or service structure definition
34 * 2) add it to the parm_table
35 * 3) add it to the list of available functions (eg: using FN_GLOBAL_STRING())
36 * 4) If it's a global then initialise it in init_globals. If a local
37 * (ie. service) parameter then initialise it in the sDefault structure
41 * The configuration file is processed sequentially for speed. It is NOT
42 * accessed randomly as happens in 'real' Windows. For this reason, there
43 * is a fair bit of sequence-dependent code here - ie., code which assumes
44 * that certain things happen before others. In particular, the code which
45 * happens at the boundary between sections is delicately poised, so be
52 /* Set default coding system for KANJI if none specified in Makefile. */
54 * We treat KANJI specially due to historical precedent (it was the
55 * first non-english codepage added to Samba). With the new dynamic
56 * codepage support this is not needed anymore.
58 * The define 'KANJI' is being overloaded to mean 'use kanji codepage
59 * by default' and also 'this is the filename-to-disk conversion
60 * method to use'. This really should be removed and all control
61 * over this left in the smb.conf parameters 'client codepage'
62 * and 'coding system'.
68 BOOL in_client
= False
; /* Not in the client by default */
71 extern int DEBUGLEVEL_CLASS
[DBGC_LAST
];
72 extern pstring user_socket_options
;
73 extern pstring global_myname
;
74 pstring global_scope
= "";
78 #define GLOBAL_NAME "global"
82 #define PRINTERS_NAME "printers"
86 #define HOMES_NAME "homes"
89 /* some helpful bits */
90 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && ServicePtrs[(i)]->valid)
91 #define VALID(i) ServicePtrs[i]->valid
93 int keepalive
= DEFAULT_KEEPALIVE
;
94 BOOL use_getwd_cache
= True
;
96 extern int extra_time_offset
;
98 static BOOL defaults_saved
= False
;
101 * This structure describes global (ie., server-wide) parameters.
105 char *szPrintcapname
;
106 char *szEnumPortsCommand
;
107 char *szAddPrinterCommand
;
108 char *szDeletePrinterCommand
;
109 char *szOs2DriverMap
;
113 char *szDefaultService
;
117 char *szServerString
;
118 char *szAutoServices
;
119 char *szPasswdProgram
;
124 char *szTDBPasswdFile
;
126 char *szSMBPasswdFile
;
128 char *szPasswordServer
;
129 char *szSocketOptions
;
132 char *szDomainAdminGroup
;
133 char *szDomainGuestGroup
;
134 char *szDomainHostsallow
;
135 char *szDomainHostsdeny
;
137 #ifdef USING_GROUPNAME_MAP
138 char *szGroupnameMap
;
139 #endif /* USING_GROUPNAME_MAP */
140 char *szCharacterSet
;
147 char *szCodingSystem
;
149 char *szRemoteAnnounce
;
150 char *szRemoteBrowseSync
;
151 char *szSocketAddress
;
152 char *szNISHomeMapName
;
153 char *szAnnounceVersion
; /* This is initialised in init_globals */
154 char *szNetbiosAliases
;
155 char *szDomainOtherSIDs
;
156 char *szNameResolveOrder
;
158 char *szAddUserScript
;
159 char *szDelUserScript
;
169 char *szTemplateHomedir
;
170 char *szTemplateShell
;
171 char *szWinbindSeparator
;
172 BOOL bWinbindEnumUsers
;
173 BOOL bWinbindEnumGroups
;
174 BOOL bWinbindUseDefaultDomain
;
175 char *szAddShareCommand
;
176 char *szChangeShareCommand
;
177 char *szDeleteShareCommand
;
178 char *szManglingMethod
;
192 int iMaxSmbdProcesses
;
193 BOOL bDisableSpoolss
;
197 int enhanced_browsing
;
204 int client_code_page
;
205 int announce_as
; /* This is initialised in init_globals */
206 int machine_password_timeout
;
207 int change_notify_timeout
;
210 int min_passwd_length
;
211 int oplock_break_wait_time
;
212 int winbind_cache_time
;
222 #endif /* WITH_LDAP */
226 char *sslHostsRequire
;
227 char *sslHostsResign
;
231 char *sslServerPrivKey
;
233 char *sslClientPrivKey
;
236 char *sslEntropyFile
;
239 BOOL sslReqClientCert
;
240 BOOL sslReqServerCert
;
241 BOOL sslCompatibility
;
242 #endif /* WITH_SSL */
243 BOOL bMsAddPrinterWizard
;
248 BOOL bPreferredMaster
;
251 BOOL bEncryptPasswords
;
255 BOOL bObeyPamRestrictions
;
258 BOOL bLargeReadwrite
;
261 BOOL bReadPrediction
;
268 BOOL bBindInterfacesOnly
;
269 BOOL bPamPasswordChange
;
270 BOOL bUnixPasswdSync
;
271 BOOL bPasswdChatDebug
;
275 BOOL bNTStatusSupport
;
278 BOOL bAllowTrustedDomains
;
279 BOOL bRestrictAnonymous
;
281 BOOL bDebugHiresTimestamp
;
285 BOOL bHideLocalUsers
;
287 BOOL bUnixExtensions
;
288 int name_cache_timeout
;
292 static global Globals
;
297 * This structure describes a single service.
306 char *szGuestaccount
;
307 char *szInvalidUsers
;
315 char *szRootPostExec
;
316 char *szPrintcommand
;
319 char *szLppausecommand
;
320 char *szLpresumecommand
;
321 char *szQueuepausecommand
;
322 char *szQueueresumecommand
;
324 char *szPrinterDriver
;
325 char *szPrinterDriverLocation
;
335 char *szVetoOplockFiles
;
344 char *szVfsObjectFile
;
350 int iCreate_force_mode
;
352 int iSecurity_force_mode
;
355 int iDir_Security_mask
;
356 int iDir_Security_force_mode
;
360 int iOplockContentionLimit
;
365 BOOL bRootpreexecClose
;
368 BOOL bShortCasePreserve
;
372 BOOL bHideUnReadable
;
395 BOOL bStrictAllocate
;
399 BOOL bDeleteReadonly
;
401 BOOL bDeleteVetoFiles
;
404 BOOL bDosFiletimeResolution
;
405 BOOL bFakeDirCreateTimes
;
410 BOOL bUseClientDriver
;
411 BOOL bDefaultDevmode
;
413 BOOL bForceUnknownAclUser
;
419 char dummy
[3]; /* for alignment */
424 /* This is a default service used to prime a services structure */
425 static service sDefault
= {
427 False
, /* not autoloaded */
428 NULL
, /* szService */
430 NULL
, /* szUsername */
431 NULL
, /* szGuestAccount - this is set in init_globals() */
432 NULL
, /* szInvalidUsers */
433 NULL
, /* szValidUsers */
434 NULL
, /* szAdminUsers */
436 NULL
, /* szInclude */
437 NULL
, /* szPreExec */
438 NULL
, /* szPostExec */
439 NULL
, /* szRootPreExec */
440 NULL
, /* szRootPostExec */
441 NULL
, /* szPrintcommand */
442 NULL
, /* szLpqcommand */
443 NULL
, /* szLprmcommand */
444 NULL
, /* szLppausecommand */
445 NULL
, /* szLpresumecommand */
446 NULL
, /* szQueuepausecommand */
447 NULL
, /* szQueueresumecommand */
448 NULL
, /* szPrintername */
449 NULL
, /* szPrinterDriver - this is set in init_globals() */
450 NULL
, /* szPrinterDriverLocation */
451 NULL
, /* szDriverFile */
452 NULL
, /* szDontdescend */
453 NULL
, /* szHostsallow */
454 NULL
, /* szHostsdeny */
455 NULL
, /* szMagicScript */
456 NULL
, /* szMagicOutput */
457 NULL
, /* szMangledMap */
458 NULL
, /* szVetoFiles */
459 NULL
, /* szHideFiles */
460 NULL
, /* szVetoOplockFiles */
462 NULL
, /* force user */
463 NULL
, /* force group */
465 NULL
, /* writelist */
466 NULL
, /* printer admin */
469 NULL
, /* vfs object */
470 NULL
, /* vfs options */
471 0, /* iMinPrintSpace */
472 1000, /* iMaxPrintJobs */
473 0, /* iWriteCacheSize */
474 0744, /* iCreate_mask */
475 0000, /* iCreate_force_mode */
476 0777, /* iSecurity_mask */
477 0, /* iSecurity_force_mode */
478 0755, /* iDir_mask */
479 0000, /* iDir_force_mode */
480 0777, /* iDir_Security_mask */
481 0, /* iDir_Security_force_mode */
482 0, /* iMaxConnections */
483 CASE_LOWER
, /* iDefaultCase */
484 DEFAULT_PRINTING
, /* iPrinting */
485 2, /* iOplockContentionLimit */
487 1024, /* iBlock_size */
488 False
, /* bAlternatePerm */
489 False
, /* bPreexecClose */
490 False
, /* bRootpreexecClose */
491 False
, /* case sensitive */
492 True
, /* case preserve */
493 True
, /* short case preserve */
494 False
, /* case mangle */
496 True
, /* bHideDotFiles */
497 False
, /* bHideUnReadable */
498 True
, /* bBrowseable */
499 True
, /* bAvailable */
500 True
, /* bRead_only */
501 True
, /* bNo_set_dir */
502 False
, /* bGuest_only */
503 False
, /* bGuest_ok */
504 False
, /* bPrint_ok */
505 False
, /* bPostscript */
506 False
, /* bMap_system */
507 False
, /* bMap_hidden */
508 True
, /* bMap_archive */
510 False
, /* bStrictLocking */
511 True
, /* bPosixLocking */
512 True
, /* bShareModes */
514 True
, /* bLevel2OpLocks */
515 False
, /* bOnlyUser */
516 True
, /* bMangledNames */
517 True
, /* bWidelinks */
518 True
, /* bSymlinks */
519 False
, /* bSyncAlways */
520 False
, /* bStrictAllocate */
521 False
, /* bStrictSync */
522 '~', /* magic char */
524 False
, /* bDeleteReadonly */
525 False
, /* bFakeOplocks */
526 False
, /* bDeleteVetoFiles */
527 False
, /* bDosFilemode */
528 False
, /* bDosFiletimes */
529 False
, /* bDosFiletimeResolution */
530 False
, /* bFakeDirCreateTimes */
531 True
, /* bBlockingLocks */
532 False
, /* bInheritPerms */
533 False
, /* bInheritACLS */
534 False
, /* bMSDfsRoot */
535 False
, /* bUseClientDriver */
536 False
, /* bDefaultDevmode */
537 True
, /* bNTAclSupport */
538 False
, /* bForceUnknownAclUser */
540 False
, /* bUseSendfile */
542 False
, /* bProfileAcls */
547 /* local variables */
548 static service
**ServicePtrs
= NULL
;
549 static int iNumServices
= 0;
550 static int iServiceIndex
= 0;
551 static BOOL bInGlobalSection
= True
;
552 static BOOL bGlobalOnly
= False
;
553 static int server_role
;
554 static int default_server_announce
;
556 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
558 /* prototypes for the special type handlers */
559 static BOOL
handle_valid_chars(char *pszParmValue
, char **ptr
);
560 static BOOL
handle_include(char *pszParmValue
, char **ptr
);
561 static BOOL
handle_copy(char *pszParmValue
, char **ptr
);
562 static BOOL
handle_character_set(char *pszParmValue
, char **ptr
);
563 static BOOL
handle_coding_system(char *pszParmValue
, char **ptr
);
564 static BOOL
handle_client_code_page(char *pszParmValue
, char **ptr
);
565 static BOOL
handle_vfs_object(char *pszParmValue
, char **ptr
);
566 static BOOL
handle_source_env(char *pszParmValue
, char **ptr
);
567 static BOOL
handle_netbios_name(char *pszParmValue
, char **ptr
);
568 static BOOL
handle_winbind_uid(char *pszParmValue
, char **ptr
);
569 static BOOL
handle_winbind_gid(char *pszParmValue
, char **ptr
);
570 static BOOL
handle_wins_server_list(char *pszParmValue
, char **ptr
);
571 static BOOL
handle_debug_list( char *pszParmValue
, char **ptr
);
573 static void set_server_role(void);
574 static void set_default_server_announce_type(void);
576 static 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 struct enum_list enum_security
[] = {
587 {SEC_SHARE
, "SHARE"},
589 {SEC_SERVER
, "SERVER"},
590 {SEC_DOMAIN
, "DOMAIN"},
594 static struct enum_list enum_printing
[] = {
595 {PRINT_SYSV
, "sysv"},
597 {PRINT_HPUX
, "hpux"},
601 {PRINT_LPRNG
, "lprng"},
602 {PRINT_SOFTQ
, "softq"},
603 {PRINT_CUPS
, "cups"},
605 {PRINT_LPROS2
, "os2"},
607 {PRINT_TEST
, "test"},
609 #endif /* DEVELOPER */
614 static struct enum_list enum_ldap_ssl
[] = {
615 {LDAP_SSL_ON
, "Yes"},
616 {LDAP_SSL_ON
, "yes"},
619 {LDAP_SSL_OFF
, "no"},
620 {LDAP_SSL_OFF
, "No"},
621 {LDAP_SSL_OFF
, "off"},
622 {LDAP_SSL_OFF
, "Off"},
623 {LDAP_SSL_START_TLS
, "start tls"},
624 {LDAP_SSL_START_TLS
, "start_tls"},
629 /* Types of machine we can announce as. */
630 #define ANNOUNCE_AS_NT_SERVER 1
631 #define ANNOUNCE_AS_WIN95 2
632 #define ANNOUNCE_AS_WFW 3
633 #define ANNOUNCE_AS_NT_WORKSTATION 4
635 static struct enum_list enum_announce_as
[] = {
636 {ANNOUNCE_AS_NT_SERVER
, "NT"},
637 {ANNOUNCE_AS_NT_SERVER
, "NT Server"},
638 {ANNOUNCE_AS_NT_WORKSTATION
, "NT Workstation"},
639 {ANNOUNCE_AS_WIN95
, "win95"},
640 {ANNOUNCE_AS_WFW
, "WfW"},
644 static struct enum_list enum_case
[] = {
645 {CASE_LOWER
, "lower"},
646 {CASE_UPPER
, "upper"},
650 static struct enum_list enum_bool_auto
[] = {
661 /* Client-side offline caching policy types */
662 #define CSC_POLICY_MANUAL 0
663 #define CSC_POLICY_DOCUMENTS 1
664 #define CSC_POLICY_PROGRAMS 2
665 #define CSC_POLICY_DISABLE 3
667 static struct enum_list enum_csc_policy
[] = {
668 {CSC_POLICY_MANUAL
, "manual"},
669 {CSC_POLICY_DOCUMENTS
, "documents"},
670 {CSC_POLICY_PROGRAMS
, "programs"},
671 {CSC_POLICY_DISABLE
, "disable"},
676 Do you want session setups at user level security with a invalid
677 password to be rejected or allowed in as guest? WinNT rejects them
678 but it can be a pain as it means "net view" needs to use a password
680 You have 3 choices in the setting of map_to_guest:
682 "Never" means session setups with an invalid password
683 are rejected. This is the default.
685 "Bad User" means session setups with an invalid password
686 are rejected, unless the username does not exist, in which case it
687 is treated as a guest login
689 "Bad Password" means session setups with an invalid password
690 are treated as a guest login
692 Note that map_to_guest only has an effect in user or server
696 static struct enum_list enum_map_to_guest
[] = {
697 {NEVER_MAP_TO_GUEST
, "Never"},
698 {MAP_TO_GUEST_ON_BAD_USER
, "Bad User"},
699 {MAP_TO_GUEST_ON_BAD_PASSWORD
, "Bad Password"},
704 static struct enum_list enum_ssl_version
[] = {
705 {SMB_SSL_V2
, "ssl2"},
706 {SMB_SSL_V3
, "ssl3"},
707 {SMB_SSL_V23
, "ssl2or3"},
708 {SMB_SSL_TLS1
, "tls1"},
713 /* note that we do not initialise the defaults union - it is not allowed in ANSI C */
714 static struct parm_struct parm_table
[] = {
715 {"Base Options", P_SEP
, P_SEPARATOR
},
717 {"coding system", P_STRING
, P_GLOBAL
, &Globals
.szCodingSystem
, handle_coding_system
, NULL
, 0},
718 {"client code page", P_INTEGER
, P_GLOBAL
, &Globals
.client_code_page
, handle_client_code_page
, NULL
, 0},
719 {"code page directory", P_STRING
, P_GLOBAL
, &Globals
.szCodePageDir
, NULL
, NULL
, 0},
720 {"comment", P_STRING
, P_LOCAL
, &sDefault
.comment
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
| FLAG_DOS_STRING
},
721 {"path", P_STRING
, P_LOCAL
, &sDefault
.szPath
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
| FLAG_DOS_STRING
},
722 {"directory", P_STRING
, P_LOCAL
, &sDefault
.szPath
, NULL
, NULL
, FLAG_DOS_STRING
},
723 {"workgroup", P_USTRING
, P_GLOBAL
, &Globals
.szWorkGroup
, NULL
, NULL
, FLAG_BASIC
| FLAG_DOS_STRING
| FLAG_WIZARD
},
724 {"netbios name", P_UGSTRING
, P_GLOBAL
, global_myname
, handle_netbios_name
, NULL
, FLAG_BASIC
| FLAG_DOS_STRING
| FLAG_WIZARD
},
725 {"netbios aliases", P_STRING
, P_GLOBAL
, &Globals
.szNetbiosAliases
, NULL
, NULL
, FLAG_DOS_STRING
},
726 {"netbios scope", P_UGSTRING
, P_GLOBAL
, global_scope
, NULL
, NULL
, FLAG_DOS_STRING
},
727 {"server string", P_STRING
, P_GLOBAL
, &Globals
.szServerString
, NULL
, NULL
, FLAG_BASIC
| FLAG_DOS_STRING
},
728 {"interfaces", P_STRING
, P_GLOBAL
, &Globals
.szInterfaces
, NULL
, NULL
, FLAG_BASIC
| FLAG_WIZARD
},
729 {"bind interfaces only", P_BOOL
, P_GLOBAL
, &Globals
.bBindInterfacesOnly
, NULL
, NULL
, FLAG_WIZARD
},
731 {"Security Options", P_SEP
, P_SEPARATOR
},
733 {"security", P_ENUM
, P_GLOBAL
, &Globals
.security
, NULL
, enum_security
, FLAG_BASIC
| FLAG_WIZARD
},
734 {"encrypt passwords", P_BOOL
, P_GLOBAL
, &Globals
.bEncryptPasswords
, NULL
, NULL
, FLAG_BASIC
| FLAG_WIZARD
},
735 {"update encrypted", P_BOOL
, P_GLOBAL
, &Globals
.bUpdateEncrypt
, NULL
, NULL
, FLAG_BASIC
},
736 {"allow trusted domains", P_BOOL
, P_GLOBAL
, &Globals
.bAllowTrustedDomains
, NULL
, NULL
, 0},
737 {"alternate permissions", P_BOOL
, P_LOCAL
, &sDefault
.bAlternatePerm
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_DEPRECATED
},
738 {"hosts equiv", P_STRING
, P_GLOBAL
, &Globals
.szHostsEquiv
, NULL
, NULL
, 0},
739 {"min passwd length", P_INTEGER
, P_GLOBAL
, &Globals
.min_passwd_length
, NULL
, NULL
, 0},
740 {"min password length", P_INTEGER
, P_GLOBAL
, &Globals
.min_passwd_length
, NULL
, NULL
, 0},
741 {"map to guest", P_ENUM
, P_GLOBAL
, &Globals
.map_to_guest
, NULL
, enum_map_to_guest
, 0},
742 {"null passwords", P_BOOL
, P_GLOBAL
, &Globals
.bNullPasswords
, NULL
, NULL
, 0},
743 {"obey pam restrictions", P_BOOL
, P_GLOBAL
, &Globals
.bObeyPamRestrictions
, NULL
, NULL
, 0},
744 {"password server", P_STRING
, P_GLOBAL
, &Globals
.szPasswordServer
, NULL
, NULL
, FLAG_WIZARD
},
746 {"tdb passwd file", P_STRING
, P_GLOBAL
, &Globals
.szTDBPasswdFile
, NULL
, NULL
, 0},
748 {"smb passwd file", P_STRING
, P_GLOBAL
, &Globals
.szSMBPasswdFile
, NULL
, NULL
, 0},
750 {"root directory", P_STRING
, P_GLOBAL
, &Globals
.szRootdir
, NULL
, NULL
, 0},
751 {"root dir", P_STRING
, P_GLOBAL
, &Globals
.szRootdir
, NULL
, NULL
, 0},
752 {"root", P_STRING
, P_GLOBAL
, &Globals
.szRootdir
, NULL
, NULL
, 0},
754 {"pam password change", P_BOOL
, P_GLOBAL
, &Globals
.bPamPasswordChange
, NULL
, NULL
, 0},
755 {"passwd program", P_STRING
, P_GLOBAL
, &Globals
.szPasswdProgram
, NULL
, NULL
, 0},
756 {"passwd chat", P_STRING
, P_GLOBAL
, &Globals
.szPasswdChat
, NULL
, NULL
, 0},
757 {"passwd chat debug", P_BOOL
, P_GLOBAL
, &Globals
.bPasswdChatDebug
, NULL
, NULL
, 0},
758 {"username map", P_STRING
, P_GLOBAL
, &Globals
.szUsernameMap
, NULL
, NULL
, 0},
759 {"password level", P_INTEGER
, P_GLOBAL
, &Globals
.pwordlevel
, NULL
, NULL
, 0},
760 {"username level", P_INTEGER
, P_GLOBAL
, &Globals
.unamelevel
, NULL
, NULL
, 0},
761 {"unix password sync", P_BOOL
, P_GLOBAL
, &Globals
.bUnixPasswdSync
, NULL
, NULL
, 0},
762 {"restrict anonymous", P_BOOL
, P_GLOBAL
, &Globals
.bRestrictAnonymous
, NULL
, NULL
, 0},
763 {"lanman auth", P_BOOL
, P_GLOBAL
, &Globals
.bLanmanAuth
, NULL
, NULL
, 0},
764 {"use rhosts", P_BOOL
, P_GLOBAL
, &Globals
.bUseRhosts
, NULL
, NULL
, 0},
766 {"username", P_STRING
, P_LOCAL
, &sDefault
.szUsername
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
767 {"user", P_STRING
, P_LOCAL
, &sDefault
.szUsername
, NULL
, NULL
, 0},
768 {"users", P_STRING
, P_LOCAL
, &sDefault
.szUsername
, NULL
, NULL
, 0},
770 {"guest account", P_STRING
, P_LOCAL
, &sDefault
.szGuestaccount
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
| FLAG_GLOBAL
},
771 {"invalid users", P_STRING
, P_LOCAL
, &sDefault
.szInvalidUsers
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
772 {"valid users", P_STRING
, P_LOCAL
, &sDefault
.szValidUsers
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
773 {"admin users", P_STRING
, P_LOCAL
, &sDefault
.szAdminUsers
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
774 {"read list", P_STRING
, P_LOCAL
, &sDefault
.readlist
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
775 {"write list", P_STRING
, P_LOCAL
, &sDefault
.writelist
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
776 {"printer admin", P_STRING
, P_LOCAL
, &sDefault
.printer_admin
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_PRINT
},
777 {"force user", P_STRING
, P_LOCAL
, &sDefault
.force_user
, NULL
, NULL
, FLAG_SHARE
},
778 {"force group", P_STRING
, P_LOCAL
, &sDefault
.force_group
, NULL
, NULL
, FLAG_SHARE
},
779 {"group", P_STRING
, P_LOCAL
, &sDefault
.force_group
, NULL
, NULL
, 0},
781 {"read only", P_BOOL
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
},
782 {"write ok", P_BOOLREV
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, 0},
783 {"writeable", P_BOOLREV
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, 0},
784 {"writable", P_BOOLREV
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, 0},
786 {"create mask", P_OCTAL
, P_LOCAL
, &sDefault
.iCreate_mask
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
787 {"create mode", P_OCTAL
, P_LOCAL
, &sDefault
.iCreate_mask
, NULL
, NULL
, FLAG_GLOBAL
},
788 {"force create mode", P_OCTAL
, P_LOCAL
, &sDefault
.iCreate_force_mode
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
789 {"security mask", P_OCTAL
, P_LOCAL
, &sDefault
.iSecurity_mask
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
790 {"force security mode", P_OCTAL
, P_LOCAL
, &sDefault
.iSecurity_force_mode
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
791 {"directory mask", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_mask
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
792 {"directory mode", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_mask
, NULL
, NULL
, FLAG_GLOBAL
},
793 {"force directory mode", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_force_mode
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
794 {"directory security mask", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_Security_mask
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
795 {"force directory security mode", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_Security_force_mode
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
796 {"force unknown acl user", P_OCTAL
, P_LOCAL
, &sDefault
.bForceUnknownAclUser
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
797 {"inherit permissions", P_BOOL
, P_LOCAL
, &sDefault
.bInheritPerms
, NULL
, NULL
, FLAG_SHARE
},
798 {"inherit acls", P_BOOL
, P_LOCAL
, &sDefault
.bInheritACLS
, NULL
, NULL
, FLAG_SHARE
},
799 {"guest only", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_only
, NULL
, NULL
, FLAG_SHARE
},
800 {"only guest", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_only
, NULL
, NULL
, 0},
802 {"guest ok", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_ok
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
803 {"public", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_ok
, NULL
, NULL
, 0},
805 {"only user", P_BOOL
, P_LOCAL
, &sDefault
.bOnlyUser
, NULL
, NULL
, FLAG_SHARE
},
806 {"hosts allow", P_STRING
, P_LOCAL
, &sDefault
.szHostsallow
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
807 {"allow hosts", P_STRING
, P_LOCAL
, &sDefault
.szHostsallow
, NULL
, NULL
, 0},
808 {"hosts deny", P_STRING
, P_LOCAL
, &sDefault
.szHostsdeny
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
809 {"deny hosts", P_STRING
, P_LOCAL
, &sDefault
.szHostsdeny
, NULL
, NULL
, 0},
812 {"Secure Socket Layer Options", P_SEP
, P_SEPARATOR
},
813 {"ssl", P_BOOL
, P_GLOBAL
, &Globals
.sslEnabled
, NULL
, NULL
, 0},
815 {"ssl hosts", P_STRING
, P_GLOBAL
, &Globals
.sslHostsRequire
, NULL
, NULL
, 0},
816 {"ssl hosts resign", P_STRING
, P_GLOBAL
, &Globals
.sslHostsResign
, NULL
, NULL
, 0},
817 {"ssl CA certDir", P_STRING
, P_GLOBAL
, &Globals
.sslCaCertDir
, NULL
, NULL
, 0},
818 {"ssl CA certFile", P_STRING
, P_GLOBAL
, &Globals
.sslCaCertFile
, NULL
, NULL
, 0},
819 {"ssl server cert", P_STRING
, P_GLOBAL
, &Globals
.sslServerCert
, NULL
, NULL
, 0},
820 {"ssl server key", P_STRING
, P_GLOBAL
, &Globals
.sslServerPrivKey
, NULL
, NULL
, 0},
821 {"ssl client cert", P_STRING
, P_GLOBAL
, &Globals
.sslClientCert
, NULL
, NULL
, 0},
822 {"ssl client key", P_STRING
, P_GLOBAL
, &Globals
.sslClientPrivKey
, NULL
, NULL
, 0},
823 {"ssl egd socket", P_STRING
, P_GLOBAL
, &Globals
.sslEgdSocket
, NULL
, NULL
, 0},
824 {"ssl entropy file", P_STRING
, P_GLOBAL
, &Globals
.sslEntropyFile
, NULL
, NULL
, 0},
825 {"ssl entropy bytes", P_INTEGER
, P_GLOBAL
, &Globals
.sslEntropyBytes
, NULL
, NULL
, 0},
826 {"ssl require clientcert", P_BOOL
, P_GLOBAL
, &Globals
.sslReqClientCert
, NULL
, NULL
, 0},
827 {"ssl require servercert", P_BOOL
, P_GLOBAL
, &Globals
.sslReqServerCert
, NULL
, NULL
, 0},
828 {"ssl ciphers", P_STRING
, P_GLOBAL
, &Globals
.sslCiphers
, NULL
, NULL
, 0},
829 {"ssl version", P_ENUM
, P_GLOBAL
, &Globals
.sslVersion
, NULL
, enum_ssl_version
, 0},
830 {"ssl compatibility", P_BOOL
, P_GLOBAL
, &Globals
.sslCompatibility
, NULL
, NULL
, 0},
831 #endif /* WITH_SSL */
833 {"Logging Options", P_SEP
, P_SEPARATOR
},
835 {"admin log", P_BOOL
, P_GLOBAL
, &Globals
.bAdminLog
, NULL
, NULL
, 0},
836 {"log level", P_INTEGER
, P_GLOBAL
, &DEBUGLEVEL_CLASS
[DBGC_ALL
], handle_debug_list
, NULL
, 0},
837 {"debuglevel", P_INTEGER
, P_GLOBAL
, &DEBUGLEVEL_CLASS
[DBGC_ALL
], handle_debug_list
, NULL
, 0},
838 {"syslog", P_INTEGER
, P_GLOBAL
, &Globals
.syslog
, NULL
, NULL
, 0},
839 {"syslog only", P_BOOL
, P_GLOBAL
, &Globals
.bSyslogOnly
, NULL
, NULL
, 0},
840 {"log file", P_STRING
, P_GLOBAL
, &Globals
.szLogFile
, NULL
, NULL
, 0},
842 {"max log size", P_INTEGER
, P_GLOBAL
, &Globals
.max_log_size
, NULL
, NULL
, 0},
843 {"timestamp logs", P_BOOL
, P_GLOBAL
, &Globals
.bTimestampLogs
, NULL
, NULL
, 0},
844 {"debug timestamp", P_BOOL
, P_GLOBAL
, &Globals
.bTimestampLogs
, NULL
, NULL
, 0},
845 {"debug hires timestamp", P_BOOL
, P_GLOBAL
, &Globals
.bDebugHiresTimestamp
, NULL
, NULL
, 0},
846 {"debug pid", P_BOOL
, P_GLOBAL
, &Globals
.bDebugPid
, NULL
, NULL
, 0},
847 {"debug uid", P_BOOL
, P_GLOBAL
, &Globals
.bDebugUid
, NULL
, NULL
, 0},
849 {"status", P_BOOL
, P_LOCAL
, &sDefault
.status
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
| FLAG_PRINT
| FLAG_DEPRECATED
},
851 {"Protocol Options", P_SEP
, P_SEPARATOR
},
853 {"protocol", P_ENUM
, P_GLOBAL
, &Globals
.maxprotocol
, NULL
, enum_protocol
, 0},
854 {"large readwrite", P_BOOL
, P_GLOBAL
, &Globals
.bLargeReadwrite
, NULL
, NULL
, 0},
855 {"max protocol", P_ENUM
, P_GLOBAL
, &Globals
.maxprotocol
, NULL
, enum_protocol
, 0},
856 {"min protocol", P_ENUM
, P_GLOBAL
, &Globals
.minprotocol
, NULL
, enum_protocol
, 0},
857 {"read bmpx", P_BOOL
, P_GLOBAL
, &Globals
.bReadbmpx
, NULL
, NULL
, 0},
858 {"read raw", P_BOOL
, P_GLOBAL
, &Globals
.bReadRaw
, NULL
, NULL
, 0},
859 {"write raw", P_BOOL
, P_GLOBAL
, &Globals
.bWriteRaw
, NULL
, NULL
, 0},
861 {"nt smb support", P_BOOL
, P_GLOBAL
, &Globals
.bNTSmbSupport
, NULL
, NULL
, 0},
862 {"nt pipe support", P_BOOL
, P_GLOBAL
, &Globals
.bNTPipeSupport
, NULL
, NULL
, 0},
863 {"nt acl support", P_BOOL
, P_LOCAL
, &sDefault
.bNTAclSupport
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
864 {"nt status support", P_BOOL
, P_GLOBAL
, &Globals
.bNTStatusSupport
, NULL
, NULL
, 0 },
865 {"profile acls", P_BOOL
, P_LOCAL
, &sDefault
.bProfileAcls
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
866 {"announce version", P_STRING
, P_GLOBAL
, &Globals
.szAnnounceVersion
, NULL
, NULL
, 0},
867 {"announce as", P_ENUM
, P_GLOBAL
, &Globals
.announce_as
, NULL
, enum_announce_as
, 0},
868 {"max mux", P_INTEGER
, P_GLOBAL
, &Globals
.max_mux
, NULL
, NULL
, 0},
869 {"max xmit", P_INTEGER
, P_GLOBAL
, &Globals
.max_xmit
, NULL
, NULL
, 0},
871 {"name resolve order", P_STRING
, P_GLOBAL
, &Globals
.szNameResolveOrder
, NULL
, NULL
, 0},
872 {"max ttl", P_INTEGER
, P_GLOBAL
, &Globals
.max_ttl
, NULL
, NULL
, 0},
873 {"max wins ttl", P_INTEGER
, P_GLOBAL
, &Globals
.max_wins_ttl
, NULL
, NULL
, 0},
874 {"min wins ttl", P_INTEGER
, P_GLOBAL
, &Globals
.min_wins_ttl
, NULL
, NULL
, 0},
875 {"time server", P_BOOL
, P_GLOBAL
, &Globals
.bTimeServer
, NULL
, NULL
, 0},
876 {"unix extensions", P_BOOL
, P_GLOBAL
, &Globals
.bUnixExtensions
, NULL
, NULL
, 0},
878 {"Tuning Options", P_SEP
, P_SEPARATOR
},
880 {"block size", P_INTEGER
, P_LOCAL
, &sDefault
.iBlock_size
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
881 {"change notify timeout", P_INTEGER
, P_GLOBAL
, &Globals
.change_notify_timeout
, NULL
, NULL
, 0},
882 {"deadtime", P_INTEGER
, P_GLOBAL
, &Globals
.deadtime
, NULL
, NULL
, 0},
883 {"getwd cache", P_BOOL
, P_GLOBAL
, &use_getwd_cache
, NULL
, NULL
, 0},
884 {"keepalive", P_INTEGER
, P_GLOBAL
, &keepalive
, NULL
, NULL
, 0},
886 {"lpq cache time", P_INTEGER
, P_GLOBAL
, &Globals
.lpqcachetime
, NULL
, NULL
, 0},
887 {"max smbd processes", P_INTEGER
, P_GLOBAL
, &Globals
.iMaxSmbdProcesses
, NULL
, NULL
, 0},
888 {"max connections", P_INTEGER
, P_LOCAL
, &sDefault
.iMaxConnections
, NULL
, NULL
, FLAG_SHARE
},
889 {"max disk size", P_INTEGER
, P_GLOBAL
, &Globals
.maxdisksize
, NULL
, NULL
, 0},
890 {"max open files", P_INTEGER
, P_GLOBAL
, &Globals
.max_open_files
, NULL
, NULL
, 0},
891 {"min print space", P_INTEGER
, P_LOCAL
, &sDefault
.iMinPrintSpace
, NULL
, NULL
, FLAG_PRINT
},
892 {"name cache timeout", P_INTEGER
, P_GLOBAL
, &Globals
.name_cache_timeout
, NULL
, NULL
, 0},
893 {"read size", P_INTEGER
, P_GLOBAL
, &Globals
.ReadSize
, NULL
, NULL
, 0},
895 {"socket options", P_GSTRING
, P_GLOBAL
, user_socket_options
, NULL
, NULL
, 0},
896 {"stat cache size", P_INTEGER
, P_GLOBAL
, &Globals
.stat_cache_size
, NULL
, NULL
, 0},
897 {"strict allocate", P_BOOL
, P_LOCAL
, &sDefault
.bStrictAllocate
, NULL
, NULL
, FLAG_SHARE
},
898 {"strict sync", P_BOOL
, P_LOCAL
, &sDefault
.bStrictSync
, NULL
, NULL
, FLAG_SHARE
},
899 {"sync always", P_BOOL
, P_LOCAL
, &sDefault
.bSyncAlways
, NULL
, NULL
, FLAG_SHARE
},
900 {"use mmap", P_BOOL
, P_GLOBAL
, &Globals
.bUseMmap
, NULL
, NULL
, 0},
902 {"use sendfile", P_BOOL
, P_LOCAL
, &sDefault
.bUseSendfile
, NULL
, NULL
, FLAG_SHARE
},
904 {"write cache size", P_INTEGER
, P_LOCAL
, &sDefault
.iWriteCacheSize
, NULL
, NULL
, FLAG_SHARE
},
906 {"Printing Options", P_SEP
, P_SEPARATOR
},
908 {"total print jobs", P_INTEGER
, P_GLOBAL
, &Globals
.iTotalPrintJobs
, NULL
, NULL
, FLAG_PRINT
},
909 {"max print jobs", P_INTEGER
, P_LOCAL
, &sDefault
.iMaxPrintJobs
, NULL
, NULL
, FLAG_PRINT
},
910 {"load printers", P_BOOL
, P_GLOBAL
, &Globals
.bLoadPrinters
, NULL
, NULL
, FLAG_PRINT
},
911 {"printcap name", P_STRING
, P_GLOBAL
, &Globals
.szPrintcapname
, NULL
, NULL
, FLAG_PRINT
},
912 {"printcap", P_STRING
, P_GLOBAL
, &Globals
.szPrintcapname
, NULL
, NULL
, 0},
913 {"printable", P_BOOL
, P_LOCAL
, &sDefault
.bPrint_ok
, NULL
, NULL
, FLAG_PRINT
},
914 {"print ok", P_BOOL
, P_LOCAL
, &sDefault
.bPrint_ok
, NULL
, NULL
, 0},
915 {"postscript", P_BOOL
, P_LOCAL
, &sDefault
.bPostscript
, NULL
, NULL
, FLAG_PRINT
| FLAG_DEPRECATED
},
916 {"printing", P_ENUM
, P_LOCAL
, &sDefault
.iPrinting
, NULL
, enum_printing
, FLAG_PRINT
| FLAG_GLOBAL
},
917 {"print command", P_STRING
, P_LOCAL
, &sDefault
.szPrintcommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
918 {"disable spoolss", P_BOOL
, P_GLOBAL
, &Globals
.bDisableSpoolss
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
919 {"lpq command", P_STRING
, P_LOCAL
, &sDefault
.szLpqcommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
920 {"lprm command", P_STRING
, P_LOCAL
, &sDefault
.szLprmcommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
921 {"lppause command", P_STRING
, P_LOCAL
, &sDefault
.szLppausecommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
922 {"lpresume command", P_STRING
, P_LOCAL
, &sDefault
.szLpresumecommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
923 {"queuepause command", P_STRING
, P_LOCAL
, &sDefault
.szQueuepausecommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
924 {"queueresume command", P_STRING
, P_LOCAL
, &sDefault
.szQueueresumecommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
926 {"enumports command", P_STRING
, P_GLOBAL
, &Globals
.szEnumPortsCommand
, NULL
, NULL
, 0},
927 {"addprinter command", P_STRING
, P_GLOBAL
, &Globals
.szAddPrinterCommand
, NULL
, NULL
, 0},
928 {"deleteprinter command", P_STRING
, P_GLOBAL
, &Globals
.szDeletePrinterCommand
, NULL
, NULL
, 0},
929 {"show add printer wizard", P_BOOL
, P_GLOBAL
, &Globals
.bMsAddPrinterWizard
, NULL
, NULL
, 0},
930 {"os2 driver map", P_STRING
, P_GLOBAL
, &Globals
.szOs2DriverMap
, NULL
, NULL
, 0},
932 {"printer name", P_STRING
, P_LOCAL
, &sDefault
.szPrintername
, NULL
, NULL
, FLAG_PRINT
|FLAG_DOS_STRING
},
933 {"printer", P_STRING
, P_LOCAL
, &sDefault
.szPrintername
, NULL
, NULL
, FLAG_DOS_STRING
},
934 {"use client driver", P_BOOL
, P_LOCAL
, &sDefault
.bUseClientDriver
, NULL
, NULL
, FLAG_PRINT
},
935 {"default devmode", P_BOOL
, P_LOCAL
, &sDefault
.bDefaultDevmode
, NULL
, NULL
, FLAG_PRINT
},
936 {"printer driver", P_STRING
, P_LOCAL
, &sDefault
.szPrinterDriver
, NULL
, NULL
, FLAG_PRINT
| FLAG_DEPRECATED
},
937 {"printer driver file", P_STRING
, P_LOCAL
, &sDefault
.szDriverFile
, NULL
, NULL
, FLAG_PRINT
| FLAG_DEPRECATED
},
938 {"printer driver location", P_STRING
, P_LOCAL
, &sDefault
.szPrinterDriverLocation
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
| FLAG_DEPRECATED
},
940 {"Filename Handling", P_SEP
, P_SEPARATOR
},
941 {"strip dot", P_BOOL
, P_GLOBAL
, &Globals
.bStripDot
, NULL
, NULL
, FLAG_DEPRECATED
},
942 {"mangling method", P_STRING
, P_GLOBAL
, &Globals
.szManglingMethod
, NULL
, NULL
, 0},
944 {"character set", P_STRING
, P_GLOBAL
, &Globals
.szCharacterSet
, handle_character_set
, NULL
, 0},
945 {"mangled stack", P_INTEGER
, P_GLOBAL
, &Globals
.mangled_stack
, NULL
, NULL
, 0},
946 {"default case", P_ENUM
, P_LOCAL
, &sDefault
.iDefaultCase
, NULL
, enum_case
, FLAG_SHARE
},
947 {"case sensitive", P_BOOL
, P_LOCAL
, &sDefault
.bCaseSensitive
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
948 {"casesignames", P_BOOL
, P_LOCAL
, &sDefault
.bCaseSensitive
, NULL
, NULL
, 0},
949 {"preserve case", P_BOOL
, P_LOCAL
, &sDefault
.bCasePreserve
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
950 {"short preserve case", P_BOOL
, P_LOCAL
, &sDefault
.bShortCasePreserve
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
951 {"mangle case", P_BOOL
, P_LOCAL
, &sDefault
.bCaseMangle
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
952 {"mangling char", P_CHAR
, P_LOCAL
, &sDefault
.magic_char
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
953 {"hide dot files", P_BOOL
, P_LOCAL
, &sDefault
.bHideDotFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
954 {"hide unreadable", P_BOOL
, P_LOCAL
, &sDefault
.bHideUnReadable
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
955 {"delete veto files", P_BOOL
, P_LOCAL
, &sDefault
.bDeleteVetoFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
956 {"veto files", P_STRING
, P_LOCAL
, &sDefault
.szVetoFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DOS_STRING
},
957 {"hide files", P_STRING
, P_LOCAL
, &sDefault
.szHideFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DOS_STRING
},
958 {"veto oplock files", P_STRING
, P_LOCAL
, &sDefault
.szVetoOplockFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DOS_STRING
},
959 {"map system", P_BOOL
, P_LOCAL
, &sDefault
.bMap_system
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
960 {"map hidden", P_BOOL
, P_LOCAL
, &sDefault
.bMap_hidden
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
961 {"map archive", P_BOOL
, P_LOCAL
, &sDefault
.bMap_archive
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
962 {"mangled names", P_BOOL
, P_LOCAL
, &sDefault
.bMangledNames
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
963 {"mangled map", P_STRING
, P_LOCAL
, &sDefault
.szMangledMap
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
964 {"stat cache", P_BOOL
, P_GLOBAL
, &Globals
.bStatCache
, NULL
, NULL
, 0},
966 {"Domain Options", P_SEP
, P_SEPARATOR
},
968 {"domain admin group", P_STRING
, P_GLOBAL
, &Globals
.szDomainAdminGroup
, NULL
, NULL
, 0},
969 {"domain guest group", P_STRING
, P_GLOBAL
, &Globals
.szDomainGuestGroup
, NULL
, NULL
, 0},
970 #ifdef USING_GROUPNAME_MAP
972 {"groupname map", P_STRING
, P_GLOBAL
, &Globals
.szGroupnameMap
, NULL
, NULL
, 0},
973 #endif /* USING_GROUPNAME_MAP */
975 {"machine password timeout", P_INTEGER
, P_GLOBAL
, &Globals
.machine_password_timeout
, NULL
, NULL
, 0},
977 {"Logon Options", P_SEP
, P_SEPARATOR
},
979 {"add user script", P_STRING
, P_GLOBAL
, &Globals
.szAddUserScript
, NULL
, NULL
, 0},
980 {"delete user script", P_STRING
, P_GLOBAL
, &Globals
.szDelUserScript
, NULL
, NULL
, 0},
981 {"logon script", P_STRING
, P_GLOBAL
, &Globals
.szLogonScript
, NULL
, NULL
, FLAG_DOS_STRING
},
982 {"logon path", P_STRING
, P_GLOBAL
, &Globals
.szLogonPath
, NULL
, NULL
, FLAG_DOS_STRING
},
983 {"logon drive", P_STRING
, P_GLOBAL
, &Globals
.szLogonDrive
, NULL
, NULL
, 0},
984 {"logon home", P_STRING
, P_GLOBAL
, &Globals
.szLogonHome
, NULL
, NULL
, FLAG_DOS_STRING
},
985 {"domain logons", P_BOOL
, P_GLOBAL
, &Globals
.bDomainLogons
, NULL
, NULL
, 0},
987 {"Browse Options", P_SEP
, P_SEPARATOR
},
989 {"os level", P_INTEGER
, P_GLOBAL
, &Globals
.os_level
, NULL
, NULL
, FLAG_BASIC
},
990 {"lm announce", P_ENUM
, P_GLOBAL
, &Globals
.lm_announce
, NULL
, enum_bool_auto
, 0},
991 {"lm interval", P_INTEGER
, P_GLOBAL
, &Globals
.lm_interval
, NULL
, NULL
, 0},
992 {"preferred master", P_ENUM
, P_GLOBAL
, &Globals
.bPreferredMaster
, NULL
, enum_bool_auto
, FLAG_BASIC
},
993 {"prefered master", P_ENUM
, P_GLOBAL
, &Globals
.bPreferredMaster
, NULL
, enum_bool_auto
, FLAG_HIDE
},
994 {"local master", P_BOOL
, P_GLOBAL
, &Globals
.bLocalMaster
, NULL
, NULL
, FLAG_BASIC
},
995 {"domain master", P_ENUM
, P_GLOBAL
, &Globals
.bDomainMaster
, NULL
, enum_bool_auto
, FLAG_BASIC
},
996 {"browse list", P_BOOL
, P_GLOBAL
, &Globals
.bBrowseList
, NULL
, NULL
, 0},
997 {"browseable", P_BOOL
, P_LOCAL
, &sDefault
.bBrowseable
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
998 {"browsable", P_BOOL
, P_LOCAL
, &sDefault
.bBrowseable
, NULL
, NULL
, 0},
999 {"enhanced browsing", P_BOOL
, P_GLOBAL
, &Globals
.enhanced_browsing
, NULL
, NULL
},
1001 {"WINS Options", P_SEP
, P_SEPARATOR
},
1002 {"dns proxy", P_BOOL
, P_GLOBAL
, &Globals
.bDNSproxy
, NULL
, NULL
, 0},
1003 {"wins proxy", P_BOOL
, P_GLOBAL
, &Globals
.bWINSproxy
, NULL
, NULL
, 0},
1005 {"wins server", P_STRING
, P_GLOBAL
, &Globals
.szWINSserver
, handle_wins_server_list
, NULL
, FLAG_BASIC
| FLAG_WIZARD
},
1006 {"wins support", P_BOOL
, P_GLOBAL
, &Globals
.bWINSsupport
, NULL
, NULL
, FLAG_BASIC
| FLAG_WIZARD
},
1007 {"wins hook", P_STRING
, P_GLOBAL
, &Globals
.szWINSHook
, NULL
, NULL
, 0},
1009 {"Locking Options", P_SEP
, P_SEPARATOR
},
1011 {"blocking locks", P_BOOL
, P_LOCAL
, &sDefault
.bBlockingLocks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1012 {"csc policy", P_ENUM
, P_LOCAL
, &sDefault
.iCSCPolicy
, NULL
, enum_csc_policy
, FLAG_SHARE
| FLAG_GLOBAL
},
1013 {"fake oplocks", P_BOOL
, P_LOCAL
, &sDefault
.bFakeOplocks
, NULL
, NULL
, FLAG_SHARE
},
1014 {"kernel oplocks", P_BOOL
, P_GLOBAL
, &Globals
.bKernelOplocks
, NULL
, NULL
, FLAG_GLOBAL
},
1015 {"locking", P_BOOL
, P_LOCAL
, &sDefault
.bLocking
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1016 {"lock spin count", P_INTEGER
, P_GLOBAL
, &Globals
.iLockSpinCount
, NULL
, NULL
, FLAG_GLOBAL
},
1017 {"lock spin time", P_INTEGER
, P_GLOBAL
, &Globals
.iLockSpinTime
, NULL
, NULL
, FLAG_GLOBAL
},
1019 {"oplocks", P_BOOL
, P_LOCAL
, &sDefault
.bOpLocks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1020 {"level2 oplocks", P_BOOL
, P_LOCAL
, &sDefault
.bLevel2OpLocks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1021 {"oplock break wait time", P_INTEGER
, P_GLOBAL
, &Globals
.oplock_break_wait_time
, NULL
, NULL
, FLAG_GLOBAL
},
1022 {"oplock contention limit", P_INTEGER
, P_LOCAL
, &sDefault
.iOplockContentionLimit
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1023 {"posix locking", P_BOOL
, P_LOCAL
, &sDefault
.bPosixLocking
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1024 {"strict locking", P_BOOL
, P_LOCAL
, &sDefault
.bStrictLocking
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1025 {"share modes", P_BOOL
, P_LOCAL
, &sDefault
.bShareModes
, NULL
, NULL
, FLAG_SHARE
|FLAG_GLOBAL
},
1027 #ifdef WITH_LDAP_SAM
1028 {"Ldap Options", P_SEP
, P_SEPARATOR
},
1030 {"ldap server", P_STRING
, P_GLOBAL
, &Globals
.szLdapServer
, NULL
, NULL
, 0},
1031 {"ldap port", P_INTEGER
, P_GLOBAL
, &Globals
.ldap_port
, NULL
, NULL
, 0},
1032 {"ldap suffix", P_STRING
, P_GLOBAL
, &Globals
.szLdapSuffix
, NULL
, NULL
, 0},
1033 {"ldap filter", P_STRING
, P_GLOBAL
, &Globals
.szLdapFilter
, NULL
, NULL
, 0},
1034 {"ldap admin dn", P_STRING
, P_GLOBAL
, &Globals
.szLdapAdminDn
, NULL
, NULL
, 0},
1035 {"ldap ssl", P_ENUM
, P_GLOBAL
, &Globals
.ldap_ssl
, NULL
, enum_ldap_ssl
, 0},
1036 #endif /* WITH_LDAP_SAM */
1038 {"Miscellaneous Options", P_SEP
, P_SEPARATOR
},
1039 {"add share command", P_STRING
, P_GLOBAL
, &Globals
.szAddShareCommand
, NULL
, NULL
, 0},
1040 {"change share command", P_STRING
, P_GLOBAL
, &Globals
.szChangeShareCommand
, NULL
, NULL
, 0},
1041 {"delete share command", P_STRING
, P_GLOBAL
, &Globals
.szDeleteShareCommand
, NULL
, NULL
, 0},
1043 {"config file", P_STRING
, P_GLOBAL
, &Globals
.szConfigFile
, NULL
, NULL
, FLAG_HIDE
},
1044 {"preload", P_STRING
, P_GLOBAL
, &Globals
.szAutoServices
, NULL
, NULL
, FLAG_DOS_STRING
},
1045 {"auto services", P_STRING
, P_GLOBAL
, &Globals
.szAutoServices
, NULL
, NULL
, FLAG_DOS_STRING
},
1046 {"lock dir", P_STRING
, P_GLOBAL
, &Globals
.szLockDir
, NULL
, NULL
, 0},
1047 {"lock directory", P_STRING
, P_GLOBAL
, &Globals
.szLockDir
, NULL
, NULL
, 0},
1048 {"pid directory", P_STRING
, P_GLOBAL
, &Globals
.szPidDir
, NULL
, NULL
, 0},
1050 {"utmp directory", P_STRING
, P_GLOBAL
, &Globals
.szUtmpDir
, NULL
, NULL
, 0},
1051 {"wtmp directory", P_STRING
, P_GLOBAL
, &Globals
.szWtmpDir
, NULL
, NULL
, 0},
1052 {"utmp", P_BOOL
, P_GLOBAL
, &Globals
.bUtmp
, NULL
, NULL
, 0},
1055 {"default service", P_STRING
, P_GLOBAL
, &Globals
.szDefaultService
, NULL
, NULL
, FLAG_DOS_STRING
},
1056 {"default", P_STRING
, P_GLOBAL
, &Globals
.szDefaultService
, NULL
, NULL
, FLAG_DOS_STRING
},
1057 {"message command", P_STRING
, P_GLOBAL
, &Globals
.szMsgCommand
, NULL
, NULL
, 0},
1058 {"dfree command", P_STRING
, P_GLOBAL
, &Globals
.szDfree
, NULL
, NULL
, 0},
1059 {"valid chars", P_STRING
, P_GLOBAL
, &Globals
.szValidChars
, handle_valid_chars
, NULL
, 0},
1060 {"remote announce", P_STRING
, P_GLOBAL
, &Globals
.szRemoteAnnounce
, NULL
, NULL
, 0},
1061 {"remote browse sync", P_STRING
, P_GLOBAL
, &Globals
.szRemoteBrowseSync
, NULL
, NULL
, 0},
1062 {"socket address", P_STRING
, P_GLOBAL
, &Globals
.szSocketAddress
, NULL
, NULL
, 0},
1063 {"homedir map", P_STRING
, P_GLOBAL
, &Globals
.szNISHomeMapName
, NULL
, NULL
, 0},
1064 {"time offset", P_INTEGER
, P_GLOBAL
, &extra_time_offset
, NULL
, NULL
, 0},
1065 {"NIS homedir", P_BOOL
, P_GLOBAL
, &Globals
.bNISHomeMap
, NULL
, NULL
, 0},
1066 {"-valid", P_BOOL
, P_LOCAL
, &sDefault
.valid
, NULL
, NULL
, FLAG_HIDE
},
1068 {"copy", P_STRING
, P_LOCAL
, &sDefault
.szCopy
, handle_copy
, NULL
, FLAG_HIDE
},
1069 {"include", P_STRING
, P_LOCAL
, &sDefault
.szInclude
, handle_include
, NULL
, FLAG_HIDE
},
1070 {"exec", P_STRING
, P_LOCAL
, &sDefault
.szPreExec
, NULL
, NULL
, FLAG_SHARE
| FLAG_PRINT
},
1071 {"preexec", P_STRING
, P_LOCAL
, &sDefault
.szPreExec
, NULL
, NULL
, 0},
1073 {"preexec close", P_BOOL
, P_LOCAL
, &sDefault
.bPreexecClose
, NULL
, NULL
, FLAG_SHARE
},
1074 {"postexec", P_STRING
, P_LOCAL
, &sDefault
.szPostExec
, NULL
, NULL
, FLAG_SHARE
| FLAG_PRINT
},
1075 {"root preexec", P_STRING
, P_LOCAL
, &sDefault
.szRootPreExec
, NULL
, NULL
, FLAG_SHARE
| FLAG_PRINT
},
1076 {"root preexec close", P_BOOL
, P_LOCAL
, &sDefault
.bRootpreexecClose
, NULL
, NULL
, FLAG_SHARE
},
1077 {"root postexec", P_STRING
, P_LOCAL
, &sDefault
.szRootPostExec
, NULL
, NULL
, FLAG_SHARE
| FLAG_PRINT
},
1078 {"available", P_BOOL
, P_LOCAL
, &sDefault
.bAvailable
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
1079 {"volume", P_STRING
, P_LOCAL
, &sDefault
.volume
, NULL
, NULL
, FLAG_SHARE
| FLAG_DOS_STRING
},
1080 {"fstype", P_STRING
, P_LOCAL
, &sDefault
.fstype
, NULL
, NULL
, FLAG_SHARE
},
1081 {"set directory", P_BOOLREV
, P_LOCAL
, &sDefault
.bNo_set_dir
, NULL
, NULL
, FLAG_SHARE
},
1082 {"source environment", P_STRING
, P_GLOBAL
, &Globals
.szSourceEnv
, handle_source_env
, NULL
, 0},
1083 {"wide links", P_BOOL
, P_LOCAL
, &sDefault
.bWidelinks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1084 {"follow symlinks", P_BOOL
, P_LOCAL
, &sDefault
.bSymlinks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1085 {"dont descend", P_STRING
, P_LOCAL
, &sDefault
.szDontdescend
, NULL
, NULL
, FLAG_SHARE
},
1086 {"magic script", P_STRING
, P_LOCAL
, &sDefault
.szMagicScript
, NULL
, NULL
, FLAG_SHARE
},
1087 {"magic output", P_STRING
, P_LOCAL
, &sDefault
.szMagicOutput
, NULL
, NULL
, FLAG_SHARE
},
1088 {"delete readonly", P_BOOL
, P_LOCAL
, &sDefault
.bDeleteReadonly
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1089 {"dos filemode", P_BOOL
, P_LOCAL
, &sDefault
.bDosFilemode
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1090 {"dos filetimes", P_BOOL
, P_LOCAL
, &sDefault
.bDosFiletimes
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1091 {"dos filetime resolution", P_BOOL
, P_LOCAL
, &sDefault
.bDosFiletimeResolution
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1093 {"fake directory create times", P_BOOL
, P_LOCAL
, &sDefault
.bFakeDirCreateTimes
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1094 {"panic action", P_STRING
, P_GLOBAL
, &Globals
.szPanicAction
, NULL
, NULL
, 0},
1095 {"hide local users", P_BOOL
, P_GLOBAL
, &Globals
.bHideLocalUsers
, NULL
,
1098 {"VFS module options", P_SEP
, P_SEPARATOR
},
1100 {"vfs object", P_STRING
, P_LOCAL
, &sDefault
.szVfsObjectFile
, handle_vfs_object
, NULL
, FLAG_SHARE
},
1101 {"vfs options", P_STRING
, P_LOCAL
, &sDefault
.szVfsOptions
, NULL
, NULL
, FLAG_SHARE
},
1104 {"MSDfs options", P_SEP
, P_SEPARATOR
},
1106 {"msdfs root", P_BOOL
, P_LOCAL
, &sDefault
.bMSDfsRoot
, NULL
, NULL
, FLAG_SHARE
},
1107 {"host msdfs", P_BOOL
, P_GLOBAL
, &Globals
.bHostMSDfs
, NULL
, NULL
, 0},
1110 {"Winbind options", P_SEP
, P_SEPARATOR
},
1112 {"winbind uid", P_STRING
, P_GLOBAL
, &Globals
.szWinbindUID
, handle_winbind_uid
, NULL
, 0},
1113 {"winbind gid", P_STRING
, P_GLOBAL
, &Globals
.szWinbindGID
, handle_winbind_gid
, NULL
, 0},
1114 {"template homedir", P_STRING
, P_GLOBAL
, &Globals
.szTemplateHomedir
, NULL
, NULL
, 0},
1115 {"template shell", P_STRING
, P_GLOBAL
, &Globals
.szTemplateShell
, NULL
, NULL
, 0},
1116 {"winbind separator", P_STRING
, P_GLOBAL
, &Globals
.szWinbindSeparator
, NULL
, NULL
, 0},
1117 {"winbind cache time", P_INTEGER
, P_GLOBAL
, &Globals
.winbind_cache_time
, NULL
, NULL
, 0},
1118 {"winbind enum users", P_BOOL
, P_GLOBAL
, &Globals
.bWinbindEnumUsers
, NULL
, NULL
, 0},
1119 {"winbind enum groups", P_BOOL
, P_GLOBAL
, &Globals
.bWinbindEnumGroups
, NULL
, NULL
, 0},
1120 {"winbind use default domain", P_BOOL
, P_GLOBAL
, &Globals
.bWinbindUseDefaultDomain
, NULL
, NULL
, 0},
1122 {NULL
, P_BOOL
, P_NONE
, NULL
, NULL
, NULL
, 0}
1126 /***************************************************************************
1127 Initialise the sDefault parameter structure for the printer values.
1128 ***************************************************************************/
1129 static void init_printer_values(void)
1131 string_set(&sDefault
.szPrinterDriver
, "");
1132 string_set(&sDefault
.szDriverFile
, DRIVERFILE
);
1134 /* choose defaults depending on the type of printing */
1135 switch (sDefault
.iPrinting
)
1141 string_set(&sDefault
.szLpqcommand
, "lpq -P%p");
1142 string_set(&sDefault
.szLprmcommand
, "lprm -P%p %j");
1143 string_set(&sDefault
.szPrintcommand
,
1149 string_set(&sDefault
.szLpqcommand
, "lpq -P%p");
1150 string_set(&sDefault
.szLprmcommand
, "lprm -P%p %j");
1151 string_set(&sDefault
.szPrintcommand
,
1153 string_set(&sDefault
.szQueuepausecommand
,
1155 string_set(&sDefault
.szQueueresumecommand
,
1157 string_set(&sDefault
.szLppausecommand
,
1159 string_set(&sDefault
.szLpresumecommand
,
1160 "lpc release %p %j");
1165 string_set(&sDefault
.szLpqcommand
, "");
1166 string_set(&sDefault
.szLprmcommand
, "");
1167 string_set(&sDefault
.szPrintcommand
, "");
1168 string_set(&sDefault
.szLppausecommand
, "");
1169 string_set(&sDefault
.szLpresumecommand
, "");
1170 string_set(&sDefault
.szQueuepausecommand
, "");
1171 string_set(&sDefault
.szQueueresumecommand
, "");
1173 string_set(&Globals
.szPrintcapname
, "cups");
1175 string_set(&sDefault
.szLpqcommand
,
1176 "/usr/bin/lpstat -o %p");
1177 string_set(&sDefault
.szLprmcommand
,
1178 "/usr/bin/cancel %p-%j");
1179 string_set(&sDefault
.szPrintcommand
,
1180 "/usr/bin/lp -d %p %s; rm %s");
1181 string_set(&sDefault
.szLppausecommand
,
1182 "lp -i %p-%j -H hold");
1183 string_set(&sDefault
.szLpresumecommand
,
1184 "lp -i %p-%j -H resume");
1185 string_set(&sDefault
.szQueuepausecommand
,
1186 "/usr/bin/disable %p");
1187 string_set(&sDefault
.szQueueresumecommand
,
1188 "/usr/bin/enable %p");
1189 string_set(&Globals
.szPrintcapname
, "lpstat");
1190 #endif /* HAVE_CUPS */
1195 string_set(&sDefault
.szLpqcommand
, "lpstat -o%p");
1196 string_set(&sDefault
.szLprmcommand
, "cancel %p-%j");
1197 string_set(&sDefault
.szPrintcommand
,
1198 "lp -c -d%p %s; rm %s");
1199 string_set(&sDefault
.szQueuepausecommand
,
1201 string_set(&sDefault
.szQueueresumecommand
,
1204 string_set(&sDefault
.szLppausecommand
,
1205 "lp -i %p-%j -H hold");
1206 string_set(&sDefault
.szLpresumecommand
,
1207 "lp -i %p-%j -H resume");
1212 string_set(&sDefault
.szLpqcommand
, "lpq -P%p");
1213 string_set(&sDefault
.szLprmcommand
, "lprm -P%p %j");
1214 string_set(&sDefault
.szPrintcommand
, "lp -r -P%p %s");
1218 string_set(&sDefault
.szLpqcommand
, "qstat -l -d%p");
1219 string_set(&sDefault
.szLprmcommand
,
1220 "qstat -s -j%j -c");
1221 string_set(&sDefault
.szPrintcommand
,
1222 "lp -d%p -s %s; rm %s");
1223 string_set(&sDefault
.szLppausecommand
,
1224 "qstat -s -j%j -h");
1225 string_set(&sDefault
.szLpresumecommand
,
1226 "qstat -s -j%j -r");
1231 string_set(&sDefault
.szPrintcommand
, "vlp print %p %s");
1232 string_set(&sDefault
.szLpqcommand
, "vlp lpq %p");
1233 string_set(&sDefault
.szLprmcommand
, "vlp lprm %p %j");
1234 string_set(&sDefault
.szLppausecommand
, "vlp lppause %p %j");
1235 string_set(&sDefault
.szLpresumecommand
, "vlp lpresum %p %j");
1236 string_set(&sDefault
.szQueuepausecommand
, "vlp queuepause %p");
1237 string_set(&sDefault
.szQueueresumecommand
, "vlp queueresume %p");
1239 #endif /* DEVELOPER */
1244 /***************************************************************************
1245 Initialise the global parameter structure.
1246 ***************************************************************************/
1247 static void init_globals(void)
1249 static BOOL done_init
= False
;
1255 memset((void *)&Globals
, '\0', sizeof(Globals
));
1257 for (i
= 0; parm_table
[i
].label
; i
++)
1258 if ((parm_table
[i
].type
== P_STRING
||
1259 parm_table
[i
].type
== P_USTRING
) &&
1261 string_set(parm_table
[i
].ptr
, "");
1263 string_set(&sDefault
.szGuestaccount
, GUEST_ACCOUNT
);
1264 string_set(&sDefault
.fstype
, FSTYPE_STRING
);
1266 init_printer_values();
1272 DEBUG(3, ("Initialising global parameters\n"));
1275 string_set(&Globals
.szTDBPasswdFile
, TDB_PASSWD_FILE
);
1277 string_set(&Globals
.szSMBPasswdFile
, SMB_PASSWD_FILE
);
1280 /* use the old 'hash' method by default */
1281 string_set(&Globals
.szManglingMethod
, "hash");
1284 * Allow the default PASSWD_CHAT to be overridden in local.h.
1286 string_set(&Globals
.szPasswdChat
, DEFAULT_PASSWD_CHAT
);
1287 string_set(&Globals
.szWorkGroup
, WORKGROUP
);
1288 string_set(&Globals
.szPasswdProgram
, PASSWD_PROGRAM
);
1289 string_set(&Globals
.szPrintcapname
, PRINTCAP_NAME
);
1290 string_set(&Globals
.szLockDir
, LOCKDIR
);
1291 string_set(&Globals
.szPidDir
, PIDDIR
);
1293 string_set(&Globals
.szUtmpDir
, "");
1294 string_set(&Globals
.szWtmpDir
, "");
1295 Globals
.bUtmp
= False
;
1297 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
1298 pstrcpy(s
, "Samba ");
1299 pstrcat(s
, VERSION
);
1300 string_set(&Globals
.szServerString
, s
);
1301 slprintf(s
, sizeof(s
) - 1, "%d.%d", DEFAULT_MAJOR_VERSION
,
1302 DEFAULT_MINOR_VERSION
);
1303 string_set(&Globals
.szAnnounceVersion
, s
);
1305 pstrcpy(user_socket_options
, DEFAULT_SOCKET_OPTIONS
);
1307 string_set(&Globals
.szLogonDrive
, "");
1308 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
1309 string_set(&Globals
.szLogonHome
, "\\\\%N\\%U");
1310 string_set(&Globals
.szLogonPath
, "\\\\%N\\%U\\profile");
1312 string_set(&Globals
.szNameResolveOrder
, "lmhosts host wins bcast");
1313 string_set(&Globals
.szCodePageDir
, CODEPAGEDIR
);
1315 Globals
.bLoadPrinters
= True
;
1316 Globals
.bUseRhosts
= False
;
1317 Globals
.mangled_stack
= 50;
1318 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
1319 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
1320 Globals
.max_xmit
= 0x4104;
1321 Globals
.max_mux
= 50; /* This is *needed* for profile support. */
1322 Globals
.lpqcachetime
= 10;
1323 Globals
.bDisableSpoolss
= False
;
1324 Globals
.iMaxSmbdProcesses
= 0;/* no limit specified */
1325 Globals
.iTotalPrintJobs
= 0; /* no limit specified */
1326 Globals
.pwordlevel
= 0;
1327 Globals
.unamelevel
= 0;
1328 Globals
.deadtime
= 0;
1329 Globals
.bLargeReadwrite
= True
;
1330 Globals
.max_log_size
= 5000;
1331 Globals
.max_open_files
= MAX_OPEN_FILES
;
1332 Globals
.maxprotocol
= PROTOCOL_NT1
;
1333 Globals
.minprotocol
= PROTOCOL_CORE
;
1334 Globals
.security
= SEC_USER
;
1335 Globals
.bEncryptPasswords
= False
;
1336 Globals
.bUpdateEncrypt
= False
;
1337 Globals
.bReadRaw
= True
;
1338 Globals
.bWriteRaw
= True
;
1339 Globals
.bReadPrediction
= False
;
1340 Globals
.bReadbmpx
= False
;
1341 Globals
.bNullPasswords
= False
;
1342 Globals
.bObeyPamRestrictions
= False
;
1343 Globals
.bStripDot
= False
;
1345 Globals
.bSyslogOnly
= False
;
1346 Globals
.bAdminLog
= False
;
1347 Globals
.bTimestampLogs
= True
;
1348 Globals
.bDebugHiresTimestamp
= False
;
1349 Globals
.bDebugPid
= False
;
1350 Globals
.bDebugUid
= False
;
1351 Globals
.max_ttl
= 60 * 60 * 24 * 3; /* 3 days default. */
1352 Globals
.max_wins_ttl
= 60 * 60 * 24 * 6; /* 6 days default. */
1353 Globals
.min_wins_ttl
= 60 * 60 * 6; /* 6 hours default. */
1354 Globals
.machine_password_timeout
= 60 * 60 * 24 * 7; /* 7 days default. */
1355 Globals
.change_notify_timeout
= 60; /* 1 minute default. */
1356 Globals
.ReadSize
= 16 * 1024;
1357 Globals
.lm_announce
= 2; /* = Auto: send only if LM clients found */
1358 Globals
.lm_interval
= 60;
1359 Globals
.stat_cache_size
= 50; /* Number of stat translations we'll keep */
1360 Globals
.announce_as
= ANNOUNCE_AS_NT_SERVER
;
1361 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
1362 Globals
.bNISHomeMap
= False
;
1363 #ifdef WITH_NISPLUS_HOME
1364 string_set(&Globals
.szNISHomeMapName
, "auto_home.org_dir");
1366 string_set(&Globals
.szNISHomeMapName
, "auto.home");
1369 Globals
.client_code_page
= DEFAULT_CLIENT_CODE_PAGE
;
1370 Globals
.bTimeServer
= False
;
1371 Globals
.bBindInterfacesOnly
= False
;
1372 Globals
.bUnixPasswdSync
= False
;
1373 Globals
.bPamPasswordChange
= False
;
1374 Globals
.bPasswdChatDebug
= False
;
1375 Globals
.bNTSmbSupport
= True
; /* Do NT SMB's by default. */
1376 Globals
.bNTPipeSupport
= True
; /* Do NT pipes by default. */
1377 Globals
.bStatCache
= True
; /* use stat cache by default */
1378 Globals
.bNTStatusSupport
= True
; /* Use NT status by default. */
1379 Globals
.bRestrictAnonymous
= False
;
1380 Globals
.bLanmanAuth
= True
; /* Do use the LanMan hash if it is available */
1381 Globals
.map_to_guest
= 0; /* By Default, "Never" */
1382 Globals
.min_passwd_length
= MINPASSWDLENGTH
; /* By Default, 5. */
1383 Globals
.oplock_break_wait_time
= 0; /* By Default, 0 msecs. */
1384 Globals
.enhanced_browsing
= True
;
1385 Globals
.iLockSpinCount
= 3; /* Try 2 times. */
1386 Globals
.iLockSpinTime
= 10; /* usec. */
1387 #ifdef MMAP_BLACKLIST
1388 Globals
.bUseMmap
= False
;
1390 Globals
.bUseMmap
= True
;
1392 Globals
.bUnixExtensions
= False
;
1395 Globals
.sslVersion
= SMB_SSL_V23
;
1396 string_set(&Globals
.sslHostsRequire
, "");
1397 string_set(&Globals
.sslHostsResign
, "");
1398 string_set(&Globals
.sslCaCertDir
, "");
1399 string_set(&Globals
.sslCaCertFile
, "");
1400 string_set(&Globals
.sslServerCert
, "");
1401 string_set(&Globals
.sslServerPrivKey
, "");
1402 string_set(&Globals
.sslClientCert
, "");
1403 string_set(&Globals
.sslClientPrivKey
, "");
1404 string_set(&Globals
.sslCiphers
, "");
1405 string_set(&Globals
.sslEgdSocket
, "");
1406 string_set(&Globals
.sslEntropyFile
, "");
1407 Globals
.sslEntropyBytes
= 256;
1408 Globals
.sslEnabled
= False
;
1409 Globals
.sslReqClientCert
= False
;
1410 Globals
.sslReqServerCert
= False
;
1411 Globals
.sslCompatibility
= False
;
1412 #endif /* WITH_SSL */
1414 #ifdef WITH_LDAP_SAM
1415 string_set(&Globals
.szLdapServer
, "localhost");
1416 string_set(&Globals
.szLdapSuffix
, "");
1417 string_set(&Globals
.szLdapFilter
, "(&(uid=%u)(objectclass=sambaAccount))");
1418 string_set(&Globals
.szLdapAdminDn
, "");
1419 Globals
.ldap_port
= 636;
1420 Globals
.ldap_ssl
= LDAP_SSL_ON
;
1421 #endif /* WITH_LDAP_SAM */
1422 /* these parameters are set to defaults that are more appropriate
1423 for the increasing samba install base:
1425 as a member of the workgroup, that will possibly become a
1426 _local_ master browser (lm = True). this is opposed to a forced
1427 local master browser startup (pm = True).
1429 doesn't provide WINS server service by default (wsupp = False),
1430 and doesn't provide domain master browser services by default, either.
1434 Globals
.bMsAddPrinterWizard
= True
;
1435 Globals
.bPreferredMaster
= Auto
; /* depending on bDomainMaster */
1436 Globals
.os_level
= 20;
1437 Globals
.bLocalMaster
= True
;
1438 Globals
.bDomainMaster
= Auto
; /* depending on bDomainLogons */
1439 Globals
.bDomainLogons
= False
;
1440 Globals
.bBrowseList
= True
;
1441 Globals
.bWINSsupport
= False
;
1442 Globals
.bWINSproxy
= False
;
1444 Globals
.bDNSproxy
= True
;
1446 /* this just means to use them if they exist */
1447 Globals
.bKernelOplocks
= True
;
1449 Globals
.bAllowTrustedDomains
= True
;
1451 string_set(&Globals
.szTemplateShell
, "/bin/false");
1452 string_set(&Globals
.szTemplateHomedir
, "/home/%D/%U");
1453 string_set(&Globals
.szWinbindSeparator
, "\\");
1454 Globals
.winbind_cache_time
= 15;
1456 Globals
.bWinbindEnumUsers
= True
;
1457 Globals
.bWinbindEnumGroups
= True
;
1458 Globals
.bWinbindUseDefaultDomain
= False
;
1460 Globals
.bHostMSDfs
= False
;
1462 Globals
.name_cache_timeout
= 660; /* In seconds */
1465 * This must be done last as it checks the value in
1469 interpret_coding_system(KANJI
);
1472 static TALLOC_CTX
*lp_talloc
;
1474 /******************************************************************* a
1475 free up temporary memory - called from the main loop
1476 ********************************************************************/
1477 void lp_talloc_free(void)
1481 talloc_destroy(lp_talloc
);
1485 /*******************************************************************
1486 convenience routine to grab string parameters into temporary memory
1487 and run standard_sub_basic on them. The buffers can be written to by
1488 callers without affecting the source string.
1489 ********************************************************************/
1490 static char *lp_string(const char *s
)
1492 size_t len
= s
? strlen(s
) : 0;
1496 lp_talloc
= talloc_init();
1498 ret
= (char *)talloc(lp_talloc
, len
+ 100); /* leave room for substitution */
1506 StrnCpy(ret
, s
, len
);
1508 trim_string(ret
, "\"", "\"");
1510 standard_sub_basic(ret
, len
+ 100);
1516 In this section all the functions that are used to access the
1517 parameters from the rest of the program are defined
1520 #define FN_GLOBAL_STRING(fn_name,ptr) \
1521 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
1522 #define FN_GLOBAL_BOOL(fn_name,ptr) \
1523 BOOL fn_name(void) {return(*(BOOL *)(ptr));}
1524 #define FN_GLOBAL_CHAR(fn_name,ptr) \
1525 char fn_name(void) {return(*(char *)(ptr));}
1526 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
1527 int fn_name(void) {return(*(int *)(ptr));}
1529 #define FN_LOCAL_STRING(fn_name,val) \
1530 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
1531 #define FN_LOCAL_CONST_STRING(fn_name,val) \
1532 const char *fn_name(int i) {return(const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
1533 #define FN_LOCAL_BOOL(fn_name,val) \
1534 BOOL fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1535 #define FN_LOCAL_CHAR(fn_name,val) \
1536 char fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1537 #define FN_LOCAL_INTEGER(fn_name,val) \
1538 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1540 FN_GLOBAL_STRING(lp_logfile
, &Globals
.szLogFile
)
1541 FN_GLOBAL_STRING(lp_configfile
, &Globals
.szConfigFile
)
1543 FN_GLOBAL_STRING(lp_tdb_passwd_file
, &Globals
.szTDBPasswdFile
)
1545 FN_GLOBAL_STRING(lp_smb_passwd_file
, &Globals
.szSMBPasswdFile
)
1547 FN_GLOBAL_STRING(lp_serverstring
, &Globals
.szServerString
)
1548 FN_GLOBAL_STRING(lp_printcapname
, &Globals
.szPrintcapname
)
1549 FN_GLOBAL_STRING(lp_enumports_cmd
, &Globals
.szEnumPortsCommand
)
1550 FN_GLOBAL_STRING(lp_addprinter_cmd
, &Globals
.szAddPrinterCommand
)
1551 FN_GLOBAL_STRING(lp_deleteprinter_cmd
, &Globals
.szDeletePrinterCommand
)
1552 FN_GLOBAL_STRING(lp_os2_driver_map
, &Globals
.szOs2DriverMap
)
1553 FN_GLOBAL_STRING(lp_lockdir
, &Globals
.szLockDir
)
1554 FN_GLOBAL_STRING(lp_piddir
, &Globals
.szPidDir
)
1556 FN_GLOBAL_STRING(lp_utmpdir
, &Globals
.szUtmpDir
)
1557 FN_GLOBAL_STRING(lp_wtmpdir
, &Globals
.szWtmpDir
)
1558 FN_GLOBAL_BOOL(lp_utmp
, &Globals
.bUtmp
)
1560 FN_GLOBAL_STRING(lp_rootdir
, &Globals
.szRootdir
)
1561 FN_GLOBAL_STRING(lp_source_environment
, &Globals
.szSourceEnv
)
1562 FN_GLOBAL_STRING(lp_defaultservice
, &Globals
.szDefaultService
)
1563 FN_GLOBAL_STRING(lp_msg_command
, &Globals
.szMsgCommand
)
1564 FN_GLOBAL_STRING(lp_dfree_command
, &Globals
.szDfree
)
1565 FN_GLOBAL_STRING(lp_hosts_equiv
, &Globals
.szHostsEquiv
)
1566 FN_GLOBAL_STRING(lp_auto_services
, &Globals
.szAutoServices
)
1567 FN_GLOBAL_STRING(lp_passwd_program
, &Globals
.szPasswdProgram
)
1568 FN_GLOBAL_STRING(lp_passwd_chat
, &Globals
.szPasswdChat
)
1569 FN_GLOBAL_STRING(lp_passwordserver
, &Globals
.szPasswordServer
)
1570 FN_GLOBAL_STRING(lp_name_resolve_order
, &Globals
.szNameResolveOrder
)
1571 FN_GLOBAL_STRING(lp_workgroup
, &Globals
.szWorkGroup
)
1572 FN_GLOBAL_STRING(lp_username_map
, &Globals
.szUsernameMap
)
1573 #ifdef USING_GROUPNAME_MAP
1574 FN_GLOBAL_STRING(lp_groupname_map
, &Globals
.szGroupnameMap
)
1575 #endif /* USING_GROUPNAME_MAP */
1576 FN_GLOBAL_STRING(lp_logon_script
, &Globals
.szLogonScript
)
1577 FN_GLOBAL_STRING(lp_logon_path
, &Globals
.szLogonPath
)
1578 FN_GLOBAL_STRING(lp_logon_drive
, &Globals
.szLogonDrive
)
1579 FN_GLOBAL_STRING(lp_logon_home
, &Globals
.szLogonHome
)
1580 FN_GLOBAL_STRING(lp_remote_announce
, &Globals
.szRemoteAnnounce
)
1581 FN_GLOBAL_STRING(lp_remote_browse_sync
, &Globals
.szRemoteBrowseSync
)
1582 FN_GLOBAL_STRING(lp_wins_server
, &Globals
.szWINSserver
)
1583 FN_GLOBAL_STRING(lp_interfaces
, &Globals
.szInterfaces
)
1584 FN_GLOBAL_STRING(lp_socket_address
, &Globals
.szSocketAddress
)
1585 FN_GLOBAL_STRING(lp_nis_home_map_name
, &Globals
.szNISHomeMapName
)
1586 static FN_GLOBAL_STRING(lp_announce_version
, &Globals
.szAnnounceVersion
)
1587 FN_GLOBAL_STRING(lp_netbios_aliases
, &Globals
.szNetbiosAliases
)
1588 FN_GLOBAL_STRING(lp_panic_action
, &Globals
.szPanicAction
)
1589 FN_GLOBAL_STRING(lp_adduser_script
, &Globals
.szAddUserScript
)
1590 FN_GLOBAL_STRING(lp_deluser_script
, &Globals
.szDelUserScript
)
1591 FN_GLOBAL_STRING(lp_wins_hook
, &Globals
.szWINSHook
)
1592 FN_GLOBAL_STRING(lp_domain_admin_group
, &Globals
.szDomainAdminGroup
)
1593 FN_GLOBAL_STRING(lp_domain_guest_group
, &Globals
.szDomainGuestGroup
)
1594 FN_GLOBAL_STRING(lp_template_homedir
, &Globals
.szTemplateHomedir
)
1595 FN_GLOBAL_STRING(lp_template_shell
, &Globals
.szTemplateShell
)
1596 FN_GLOBAL_STRING(lp_winbind_separator
, &Globals
.szWinbindSeparator
)
1597 FN_GLOBAL_BOOL(lp_winbind_enum_users
, &Globals
.bWinbindEnumUsers
)
1598 FN_GLOBAL_BOOL(lp_winbind_enum_groups
, &Globals
.bWinbindEnumGroups
)
1599 FN_GLOBAL_BOOL(lp_winbind_use_default_domain
, &Globals
.bWinbindUseDefaultDomain
)
1600 FN_GLOBAL_STRING(lp_codepagedir
,&Globals
.szCodePageDir
)
1601 #ifdef WITH_LDAP_SAM
1602 FN_GLOBAL_STRING(lp_ldap_server
, &Globals
.szLdapServer
)
1603 FN_GLOBAL_STRING(lp_ldap_suffix
, &Globals
.szLdapSuffix
)
1604 FN_GLOBAL_STRING(lp_ldap_filter
, &Globals
.szLdapFilter
)
1605 FN_GLOBAL_STRING(lp_ldap_admin_dn
, &Globals
.szLdapAdminDn
)
1606 FN_GLOBAL_INTEGER(lp_ldap_port
, &Globals
.ldap_port
)
1607 FN_GLOBAL_INTEGER(lp_ldap_ssl
, &Globals
.ldap_ssl
)
1608 #endif /* WITH_LDAP_SAM */
1609 FN_GLOBAL_STRING(lp_add_share_cmd
, &Globals
.szAddShareCommand
)
1610 FN_GLOBAL_STRING(lp_change_share_cmd
, &Globals
.szChangeShareCommand
)
1611 FN_GLOBAL_STRING(lp_delete_share_cmd
, &Globals
.szDeleteShareCommand
)
1612 FN_GLOBAL_STRING(lp_mangling_method
, &Globals
.szManglingMethod
)
1615 FN_GLOBAL_INTEGER(lp_ssl_version
, &Globals
.sslVersion
)
1616 FN_GLOBAL_STRING(lp_ssl_hosts
, &Globals
.sslHostsRequire
)
1617 FN_GLOBAL_STRING(lp_ssl_hosts_resign
, &Globals
.sslHostsResign
)
1618 FN_GLOBAL_STRING(lp_ssl_cacertdir
, &Globals
.sslCaCertDir
)
1619 FN_GLOBAL_STRING(lp_ssl_cacertfile
, &Globals
.sslCaCertFile
)
1620 FN_GLOBAL_STRING(lp_ssl_server_cert
, &Globals
.sslServerCert
)
1621 FN_GLOBAL_STRING(lp_ssl_server_privkey
, &Globals
.sslServerPrivKey
)
1622 FN_GLOBAL_STRING(lp_ssl_client_cert
, &Globals
.sslClientCert
)
1623 FN_GLOBAL_STRING(lp_ssl_client_privkey
, &Globals
.sslClientPrivKey
)
1624 FN_GLOBAL_STRING(lp_ssl_ciphers
, &Globals
.sslCiphers
)
1625 FN_GLOBAL_STRING(lp_ssl_egdsocket
, &Globals
.sslEgdSocket
)
1626 FN_GLOBAL_STRING(lp_ssl_entropyfile
, &Globals
.sslEntropyFile
)
1627 FN_GLOBAL_INTEGER(lp_ssl_entropybytes
, &Globals
.sslEntropyBytes
)
1628 FN_GLOBAL_BOOL(lp_ssl_enabled
, &Globals
.sslEnabled
)
1629 FN_GLOBAL_BOOL(lp_ssl_reqClientCert
, &Globals
.sslReqClientCert
)
1630 FN_GLOBAL_BOOL(lp_ssl_reqServerCert
, &Globals
.sslReqServerCert
)
1631 FN_GLOBAL_BOOL(lp_ssl_compatibility
, &Globals
.sslCompatibility
)
1632 #endif /* WITH_SSL */
1634 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard
, &Globals
.bMsAddPrinterWizard
)
1635 FN_GLOBAL_BOOL(lp_dns_proxy
, &Globals
.bDNSproxy
)
1636 FN_GLOBAL_BOOL(lp_wins_support
, &Globals
.bWINSsupport
)
1637 FN_GLOBAL_BOOL(lp_we_are_a_wins_server
, &Globals
.bWINSsupport
)
1638 FN_GLOBAL_BOOL(lp_wins_proxy
, &Globals
.bWINSproxy
)
1639 FN_GLOBAL_BOOL(lp_local_master
, &Globals
.bLocalMaster
)
1640 FN_GLOBAL_BOOL(lp_domain_logons
, &Globals
.bDomainLogons
)
1641 FN_GLOBAL_BOOL(lp_load_printers
, &Globals
.bLoadPrinters
)
1642 FN_GLOBAL_BOOL(lp_use_rhosts
, &Globals
.bUseRhosts
)
1643 FN_GLOBAL_BOOL(lp_readprediction
, &Globals
.bReadPrediction
)
1644 FN_GLOBAL_BOOL(lp_readbmpx
, &Globals
.bReadbmpx
)
1645 FN_GLOBAL_BOOL(lp_readraw
, &Globals
.bReadRaw
)
1646 FN_GLOBAL_BOOL(lp_large_readwrite
, &Globals
.bLargeReadwrite
)
1647 FN_GLOBAL_BOOL(lp_writeraw
, &Globals
.bWriteRaw
)
1648 FN_GLOBAL_BOOL(lp_null_passwords
, &Globals
.bNullPasswords
)
1649 FN_GLOBAL_BOOL(lp_obey_pam_restrictions
, &Globals
.bObeyPamRestrictions
)
1650 FN_GLOBAL_BOOL(lp_strip_dot
, &Globals
.bStripDot
)
1651 FN_GLOBAL_BOOL(lp_encrypted_passwords
, &Globals
.bEncryptPasswords
)
1652 FN_GLOBAL_BOOL(lp_update_encrypted
, &Globals
.bUpdateEncrypt
)
1653 FN_GLOBAL_BOOL(lp_syslog_only
, &Globals
.bSyslogOnly
)
1654 FN_GLOBAL_BOOL(lp_admin_log
, &Globals
.bAdminLog
)
1655 FN_GLOBAL_BOOL(lp_timestamp_logs
, &Globals
.bTimestampLogs
)
1656 FN_GLOBAL_BOOL(lp_debug_hires_timestamp
, &Globals
.bDebugHiresTimestamp
)
1657 FN_GLOBAL_BOOL(lp_debug_pid
, &Globals
.bDebugPid
)
1658 FN_GLOBAL_BOOL(lp_debug_uid
, &Globals
.bDebugUid
)
1659 FN_GLOBAL_BOOL(lp_browse_list
, &Globals
.bBrowseList
)
1660 FN_GLOBAL_BOOL(lp_nis_home_map
, &Globals
.bNISHomeMap
)
1661 static FN_GLOBAL_BOOL(lp_time_server
, &Globals
.bTimeServer
)
1662 FN_GLOBAL_BOOL(lp_bind_interfaces_only
, &Globals
.bBindInterfacesOnly
)
1663 FN_GLOBAL_BOOL(lp_pam_password_change
, &Globals
.bPamPasswordChange
)
1664 FN_GLOBAL_BOOL(lp_unix_password_sync
, &Globals
.bUnixPasswdSync
)
1665 FN_GLOBAL_BOOL(lp_passwd_chat_debug
, &Globals
.bPasswdChatDebug
)
1666 FN_GLOBAL_BOOL(lp_nt_smb_support
, &Globals
.bNTSmbSupport
)
1667 FN_GLOBAL_BOOL(lp_nt_pipe_support
, &Globals
.bNTPipeSupport
)
1668 FN_GLOBAL_BOOL(lp_nt_status_support
, &Globals
.bNTStatusSupport
)
1669 FN_GLOBAL_BOOL(lp_stat_cache
, &Globals
.bStatCache
)
1670 FN_GLOBAL_BOOL(lp_allow_trusted_domains
, &Globals
.bAllowTrustedDomains
)
1671 FN_GLOBAL_BOOL(lp_restrict_anonymous
, &Globals
.bRestrictAnonymous
)
1672 FN_GLOBAL_BOOL(lp_lanman_auth
, &Globals
.bLanmanAuth
)
1673 FN_GLOBAL_BOOL(lp_host_msdfs
, &Globals
.bHostMSDfs
)
1674 FN_GLOBAL_BOOL(lp_kernel_oplocks
, &Globals
.bKernelOplocks
)
1675 FN_GLOBAL_BOOL(lp_enhanced_browsing
, &Globals
.enhanced_browsing
)
1676 FN_GLOBAL_BOOL(lp_use_mmap
, &Globals
.bUseMmap
)
1677 FN_GLOBAL_BOOL(lp_unix_extensions
, &Globals
.bUnixExtensions
)
1678 FN_GLOBAL_INTEGER(lp_os_level
, &Globals
.os_level
)
1679 FN_GLOBAL_INTEGER(lp_max_ttl
, &Globals
.max_ttl
)
1680 FN_GLOBAL_INTEGER(lp_max_wins_ttl
, &Globals
.max_wins_ttl
)
1681 FN_GLOBAL_INTEGER(lp_min_wins_ttl
, &Globals
.min_wins_ttl
)
1682 FN_GLOBAL_INTEGER(lp_max_log_size
, &Globals
.max_log_size
)
1683 FN_GLOBAL_INTEGER(lp_max_open_files
, &Globals
.max_open_files
)
1684 FN_GLOBAL_INTEGER(lp_maxxmit
, &Globals
.max_xmit
)
1685 FN_GLOBAL_INTEGER(lp_maxmux
, &Globals
.max_mux
)
1686 FN_GLOBAL_INTEGER(lp_passwordlevel
, &Globals
.pwordlevel
)
1687 FN_GLOBAL_INTEGER(lp_usernamelevel
, &Globals
.unamelevel
)
1688 FN_GLOBAL_INTEGER(lp_readsize
, &Globals
.ReadSize
)
1689 FN_GLOBAL_INTEGER(lp_deadtime
, &Globals
.deadtime
)
1690 FN_GLOBAL_INTEGER(lp_maxprotocol
, &Globals
.maxprotocol
)
1691 FN_GLOBAL_INTEGER(lp_minprotocol
, &Globals
.minprotocol
)
1692 FN_GLOBAL_INTEGER(lp_security
, &Globals
.security
)
1693 FN_GLOBAL_INTEGER(lp_maxdisksize
, &Globals
.maxdisksize
)
1694 FN_GLOBAL_INTEGER(lp_lpqcachetime
, &Globals
.lpqcachetime
)
1695 FN_GLOBAL_INTEGER(lp_max_smbd_processes
, &Globals
.iMaxSmbdProcesses
)
1696 FN_GLOBAL_INTEGER(lp_disable_spoolss
, &Globals
.bDisableSpoolss
)
1697 FN_GLOBAL_INTEGER(lp_totalprintjobs
, &Globals
.iTotalPrintJobs
)
1698 FN_GLOBAL_INTEGER(lp_syslog
, &Globals
.syslog
)
1699 FN_GLOBAL_INTEGER(lp_client_code_page
, &Globals
.client_code_page
)
1700 static FN_GLOBAL_INTEGER(lp_announce_as
, &Globals
.announce_as
)
1701 FN_GLOBAL_INTEGER(lp_lm_announce
, &Globals
.lm_announce
)
1702 FN_GLOBAL_INTEGER(lp_lm_interval
, &Globals
.lm_interval
)
1703 FN_GLOBAL_INTEGER(lp_machine_password_timeout
, &Globals
.machine_password_timeout
)
1704 FN_GLOBAL_INTEGER(lp_change_notify_timeout
, &Globals
.change_notify_timeout
)
1705 FN_GLOBAL_INTEGER(lp_stat_cache_size
, &Globals
.stat_cache_size
)
1706 FN_GLOBAL_INTEGER(lp_map_to_guest
, &Globals
.map_to_guest
)
1707 FN_GLOBAL_INTEGER(lp_min_passwd_length
, &Globals
.min_passwd_length
)
1708 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time
, &Globals
.oplock_break_wait_time
)
1709 FN_GLOBAL_INTEGER(lp_lock_spin_count
, &Globals
.iLockSpinCount
)
1710 FN_GLOBAL_INTEGER(lp_lock_sleep_time
, &Globals
.iLockSpinTime
)
1711 FN_GLOBAL_INTEGER(lp_name_cache_timeout
, &Globals
.name_cache_timeout
)
1712 FN_LOCAL_STRING(lp_preexec
, szPreExec
)
1713 FN_LOCAL_STRING(lp_postexec
, szPostExec
)
1714 FN_LOCAL_STRING(lp_rootpreexec
, szRootPreExec
)
1715 FN_LOCAL_STRING(lp_rootpostexec
, szRootPostExec
)
1716 FN_LOCAL_STRING(lp_servicename
, szService
)
1717 FN_LOCAL_CONST_STRING(lp_const_servicename
, szService
)
1718 FN_LOCAL_STRING(lp_pathname
, szPath
)
1719 FN_LOCAL_STRING(lp_dontdescend
, szDontdescend
)
1720 FN_LOCAL_STRING(lp_username
, szUsername
)
1721 FN_LOCAL_STRING(lp_guestaccount
, szGuestaccount
)
1722 FN_LOCAL_STRING(lp_invalid_users
, szInvalidUsers
)
1723 FN_LOCAL_STRING(lp_valid_users
, szValidUsers
)
1724 FN_LOCAL_STRING(lp_admin_users
, szAdminUsers
)
1725 FN_LOCAL_STRING(lp_printcommand
, szPrintcommand
)
1726 FN_LOCAL_STRING(lp_lpqcommand
, szLpqcommand
)
1727 FN_LOCAL_STRING(lp_lprmcommand
, szLprmcommand
)
1728 FN_LOCAL_STRING(lp_lppausecommand
, szLppausecommand
)
1729 FN_LOCAL_STRING(lp_lpresumecommand
, szLpresumecommand
)
1730 FN_LOCAL_STRING(lp_queuepausecommand
, szQueuepausecommand
)
1731 FN_LOCAL_STRING(lp_queueresumecommand
, szQueueresumecommand
)
1732 static FN_LOCAL_STRING(_lp_printername
, szPrintername
)
1733 FN_LOCAL_STRING(lp_driverfile
, szDriverFile
)
1734 FN_LOCAL_STRING(lp_printerdriver
, szPrinterDriver
)
1735 FN_LOCAL_STRING(lp_hostsallow
, szHostsallow
)
1736 FN_LOCAL_STRING(lp_hostsdeny
, szHostsdeny
)
1737 FN_LOCAL_STRING(lp_magicscript
, szMagicScript
)
1738 FN_LOCAL_STRING(lp_magicoutput
, szMagicOutput
)
1739 FN_LOCAL_STRING(lp_comment
, comment
)
1740 FN_LOCAL_STRING(lp_force_user
, force_user
)
1741 FN_LOCAL_STRING(lp_force_group
, force_group
)
1742 FN_LOCAL_STRING(lp_readlist
, readlist
)
1743 FN_LOCAL_STRING(lp_writelist
, writelist
)
1744 FN_LOCAL_STRING(lp_printer_admin
, printer_admin
)
1745 FN_LOCAL_STRING(lp_fstype
, fstype
)
1746 FN_LOCAL_STRING(lp_vfsobj
, szVfsObjectFile
)
1747 FN_LOCAL_STRING(lp_vfs_options
, szVfsOptions
)
1748 static FN_LOCAL_STRING(lp_volume
, volume
)
1749 FN_LOCAL_STRING(lp_mangled_map
, szMangledMap
)
1750 FN_LOCAL_STRING(lp_veto_files
, szVetoFiles
)
1751 FN_LOCAL_STRING(lp_hide_files
, szHideFiles
)
1752 FN_LOCAL_STRING(lp_veto_oplocks
, szVetoOplockFiles
)
1753 FN_LOCAL_STRING(lp_driverlocation
, szPrinterDriverLocation
)
1754 FN_LOCAL_BOOL(lp_msdfs_root
, bMSDfsRoot
)
1755 FN_LOCAL_BOOL(lp_autoloaded
, autoloaded
)
1756 FN_LOCAL_BOOL(lp_preexec_close
, bPreexecClose
)
1757 FN_LOCAL_BOOL(lp_rootpreexec_close
, bRootpreexecClose
)
1758 FN_LOCAL_BOOL(lp_casesensitive
, bCaseSensitive
)
1759 FN_LOCAL_BOOL(lp_preservecase
, bCasePreserve
)
1760 FN_LOCAL_BOOL(lp_shortpreservecase
, bShortCasePreserve
)
1761 FN_LOCAL_BOOL(lp_casemangle
, bCaseMangle
)
1762 FN_LOCAL_BOOL(lp_status
, status
)
1763 FN_LOCAL_BOOL(lp_hide_dot_files
, bHideDotFiles
)
1764 FN_LOCAL_BOOL(lp_hideunreadable
, bHideUnReadable
)
1765 FN_LOCAL_BOOL(lp_browseable
, bBrowseable
)
1766 FN_LOCAL_BOOL(lp_readonly
, bRead_only
)
1767 FN_LOCAL_BOOL(lp_no_set_dir
, bNo_set_dir
)
1768 FN_LOCAL_BOOL(lp_guest_ok
, bGuest_ok
)
1769 FN_LOCAL_BOOL(lp_guest_only
, bGuest_only
)
1770 FN_LOCAL_BOOL(lp_print_ok
, bPrint_ok
)
1771 FN_LOCAL_BOOL(lp_postscript
, bPostscript
)
1772 FN_LOCAL_BOOL(lp_map_hidden
, bMap_hidden
)
1773 FN_LOCAL_BOOL(lp_map_archive
, bMap_archive
)
1774 FN_LOCAL_BOOL(lp_locking
, bLocking
)
1775 FN_LOCAL_BOOL(lp_strict_locking
, bStrictLocking
)
1776 FN_LOCAL_BOOL(lp_share_modes
, bShareModes
)
1777 FN_LOCAL_BOOL(lp_posix_locking
, bPosixLocking
)
1778 FN_LOCAL_BOOL(lp_oplocks
, bOpLocks
)
1779 FN_LOCAL_BOOL(lp_level2_oplocks
, bLevel2OpLocks
)
1780 FN_LOCAL_BOOL(lp_onlyuser
, bOnlyUser
)
1781 FN_LOCAL_BOOL(lp_manglednames
, bMangledNames
)
1782 FN_LOCAL_BOOL(lp_widelinks
, bWidelinks
)
1783 FN_LOCAL_BOOL(lp_symlinks
, bSymlinks
)
1784 FN_LOCAL_BOOL(lp_syncalways
, bSyncAlways
)
1785 FN_LOCAL_BOOL(lp_strict_allocate
, bStrictAllocate
)
1786 FN_LOCAL_BOOL(lp_strict_sync
, bStrictSync
)
1787 FN_LOCAL_BOOL(lp_map_system
, bMap_system
)
1788 FN_LOCAL_BOOL(lp_delete_readonly
, bDeleteReadonly
)
1789 FN_LOCAL_BOOL(lp_fake_oplocks
, bFakeOplocks
)
1790 FN_LOCAL_BOOL(lp_recursive_veto_delete
, bDeleteVetoFiles
)
1791 FN_LOCAL_BOOL(lp_dos_filemode
, bDosFilemode
)
1792 FN_LOCAL_BOOL(lp_dos_filetimes
, bDosFiletimes
)
1793 FN_LOCAL_BOOL(lp_dos_filetime_resolution
, bDosFiletimeResolution
)
1794 FN_LOCAL_BOOL(lp_fake_dir_create_times
, bFakeDirCreateTimes
)
1795 FN_LOCAL_BOOL(lp_blocking_locks
, bBlockingLocks
)
1796 FN_LOCAL_BOOL(lp_inherit_perms
, bInheritPerms
)
1797 FN_LOCAL_BOOL(lp_inherit_acls
, bInheritACLS
)
1798 FN_LOCAL_BOOL(lp_use_client_driver
, bUseClientDriver
)
1799 FN_LOCAL_BOOL(lp_default_devmode
, bDefaultDevmode
)
1800 FN_LOCAL_BOOL(lp_nt_acl_support
, bNTAclSupport
)
1801 FN_LOCAL_BOOL(lp_force_unknown_acl_user
, bForceUnknownAclUser
)
1802 #ifdef WITH_SENDFILE
1803 FN_LOCAL_BOOL(lp_use_sendfile
, bUseSendfile
)
1805 FN_LOCAL_BOOL(lp_profile_acls
, bProfileAcls
)
1806 FN_LOCAL_INTEGER(lp_create_mask
, iCreate_mask
)
1807 FN_LOCAL_INTEGER(lp_force_create_mode
, iCreate_force_mode
)
1808 FN_LOCAL_INTEGER(lp_security_mask
, iSecurity_mask
)
1809 FN_LOCAL_INTEGER(lp_force_security_mode
, iSecurity_force_mode
)
1810 FN_LOCAL_INTEGER(lp_dir_mask
, iDir_mask
)
1811 FN_LOCAL_INTEGER(lp_force_dir_mode
, iDir_force_mode
)
1812 FN_LOCAL_INTEGER(lp_dir_security_mask
, iDir_Security_mask
)
1813 FN_LOCAL_INTEGER(lp_force_dir_security_mode
, iDir_Security_force_mode
)
1814 FN_LOCAL_INTEGER(lp_max_connections
, iMaxConnections
)
1815 FN_LOCAL_INTEGER(lp_defaultcase
, iDefaultCase
)
1816 FN_LOCAL_INTEGER(lp_minprintspace
, iMinPrintSpace
)
1817 FN_LOCAL_INTEGER(lp_printing
, iPrinting
)
1818 FN_LOCAL_INTEGER(lp_oplock_contention_limit
, iOplockContentionLimit
)
1819 FN_LOCAL_INTEGER(lp_csc_policy
, iCSCPolicy
)
1820 FN_LOCAL_INTEGER(lp_write_cache_size
, iWriteCacheSize
)
1821 FN_LOCAL_INTEGER(lp_block_size
, iBlock_size
)
1822 FN_LOCAL_CHAR(lp_magicchar
, magic_char
)
1823 FN_GLOBAL_INTEGER(lp_winbind_cache_time
, &Globals
.winbind_cache_time
)
1824 FN_GLOBAL_BOOL(lp_hide_local_users
, &Globals
.bHideLocalUsers
)
1826 /* local prototypes */
1828 static int map_parameter(char *pszParmName
);
1829 static BOOL
set_boolean(BOOL
*pb
, char *pszParmValue
);
1830 static int getservicebyname(char *pszServiceName
,
1831 service
* pserviceDest
);
1832 static void copy_service(service
* pserviceDest
,
1833 service
* pserviceSource
, BOOL
*pcopymapDest
);
1834 static BOOL
service_ok(int iService
);
1835 static BOOL
do_parameter(char *pszParmName
, char *pszParmValue
);
1836 static BOOL
do_section(char *pszSectionName
);
1837 static void init_copymap(service
* pservice
);
1840 /***************************************************************************
1841 initialise a service to the defaults
1842 ***************************************************************************/
1843 static void init_service(service
* pservice
)
1845 memset((char *)pservice
, '\0', sizeof(service
));
1846 copy_service(pservice
, &sDefault
, NULL
);
1850 /***************************************************************************
1851 free the dynamically allocated parts of a service struct
1852 ***************************************************************************/
1853 static void free_service(service
* pservice
)
1859 if (pservice
->szService
)
1861 ("free_service: Freeing service %s\n",
1862 pservice
->szService
));
1864 string_free(&pservice
->szService
);
1865 SAFE_FREE(pservice
->copymap
);
1867 for (i
= 0; parm_table
[i
].label
; i
++)
1868 if ((parm_table
[i
].type
== P_STRING
||
1869 parm_table
[i
].type
== P_USTRING
) &&
1870 parm_table
[i
].class == P_LOCAL
)
1871 string_free((char **)
1872 (((char *)pservice
) +
1873 PTR_DIFF(parm_table
[i
].ptr
, &sDefault
)));
1875 ZERO_STRUCTP(pservice
);
1878 /***************************************************************************
1879 add a new service to the services array initialising it with the given
1880 service. name must be in DOS codepage.
1881 ***************************************************************************/
1882 static int add_a_service(service
* pservice
, char *name
)
1886 int num_to_alloc
= iNumServices
+ 1;
1888 tservice
= *pservice
;
1890 /* it might already exist */
1894 i
= getservicebyname(name
, NULL
);
1899 /* find an invalid one */
1900 for (i
= 0; i
< iNumServices
; i
++)
1901 if (!ServicePtrs
[i
]->valid
)
1904 /* if not, then create one */
1905 if (i
== iNumServices
)
1910 service
**oldservices
= iNumServices
? malloc(sizeof(service
*) * iNumServices
) : NULL
;
1913 memcpy(oldservices
, ServicePtrs
, sizeof(service
*) * iNumServices
);
1916 tsp
= (service
**) Realloc(ServicePtrs
,
1921 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
1925 ServicePtrs
[iNumServices
] =
1926 (service
*) malloc(sizeof(service
));
1930 if (iNumServices
&& (memcmp(oldservices
, ServicePtrs
, sizeof(service
*) * iNumServices
) != 0)) {
1931 smb_panic("add_a_service: Realloc corrupted ptrs...\n");
1933 safe_free(oldservices
);
1936 if (!ServicePtrs
[iNumServices
])
1942 free_service(ServicePtrs
[i
]);
1944 ServicePtrs
[i
]->valid
= True
;
1946 init_service(ServicePtrs
[i
]);
1947 copy_service(ServicePtrs
[i
], &tservice
, NULL
);
1950 string_set(&ServicePtrs
[i
]->szService
, name
);
1955 /***************************************************************************
1956 add a new home service, with the specified home directory, defaults coming
1957 from service ifrom. homename must be in DOS codepage.
1958 ***************************************************************************/
1959 BOOL
lp_add_home(char *pszHomename
, int iDefaultService
, char *pszHomedir
)
1963 i
= add_a_service(ServicePtrs
[iDefaultService
], pszHomename
);
1968 if (!(*(ServicePtrs
[i
]->szPath
))
1969 || strequal(ServicePtrs
[i
]->szPath
, lp_pathname(-1)))
1970 string_set(&ServicePtrs
[i
]->szPath
, pszHomedir
);
1971 if (!(*(ServicePtrs
[i
]->comment
)))
1974 slprintf(comment
, sizeof(comment
) - 1,
1975 "Home directory of %s", pszHomename
);
1976 string_set(&ServicePtrs
[i
]->comment
, comment
);
1978 ServicePtrs
[i
]->bAvailable
= sDefault
.bAvailable
;
1979 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
1982 ("adding home directory %s at %s\n", pszHomename
, pszHomedir
));
1987 /***************************************************************************
1988 add a new service, based on an old one. pszService must be in DOS codepage.
1989 ***************************************************************************/
1990 int lp_add_service(char *pszService
, int iDefaultService
)
1992 return (add_a_service(ServicePtrs
[iDefaultService
], pszService
));
1996 /***************************************************************************
1998 ***************************************************************************/
1999 static BOOL
lp_add_ipc(char *ipc_name
, BOOL guest_ok
)
2002 int i
= add_a_service(&sDefault
, ipc_name
);
2007 slprintf(comment
, sizeof(comment
) - 1,
2008 "IPC Service (%s)", Globals
.szServerString
);
2010 string_set(&ServicePtrs
[i
]->szPath
, tmpdir());
2011 string_set(&ServicePtrs
[i
]->szUsername
, "");
2012 string_set(&ServicePtrs
[i
]->comment
, comment
);
2013 string_set(&ServicePtrs
[i
]->fstype
, "IPC");
2014 ServicePtrs
[i
]->status
= False
;
2015 ServicePtrs
[i
]->iMaxConnections
= 0;
2016 ServicePtrs
[i
]->bAvailable
= True
;
2017 ServicePtrs
[i
]->bRead_only
= True
;
2018 ServicePtrs
[i
]->bGuest_only
= False
;
2019 ServicePtrs
[i
]->bGuest_ok
= guest_ok
;
2020 ServicePtrs
[i
]->bPrint_ok
= False
;
2021 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
2023 DEBUG(3, ("adding IPC service %s\n", ipc_name
));
2029 /***************************************************************************
2030 add a new printer service, with defaults coming from service iFrom.
2031 printername must be in DOS codepage.
2032 ***************************************************************************/
2033 BOOL
lp_add_printer(char *pszPrintername
, int iDefaultService
)
2035 char *comment
= "From Printcap";
2036 int i
= add_a_service(ServicePtrs
[iDefaultService
], pszPrintername
);
2041 /* note that we do NOT default the availability flag to True - */
2042 /* we take it from the default service passed. This allows all */
2043 /* dynamic printers to be disabled by disabling the [printers] */
2044 /* entry (if/when the 'available' keyword is implemented!). */
2046 /* the printer name is set to the service name. */
2047 string_set(&ServicePtrs
[i
]->szPrintername
, pszPrintername
);
2048 string_set(&ServicePtrs
[i
]->comment
, comment
);
2049 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
2050 /* Printers cannot be read_only. */
2051 ServicePtrs
[i
]->bRead_only
= False
;
2052 /* No oplocks on printer services. */
2053 ServicePtrs
[i
]->bOpLocks
= False
;
2054 /* Printer services must be printable. */
2055 ServicePtrs
[i
]->bPrint_ok
= True
;
2057 DEBUG(3, ("adding printer service %s\n", pszPrintername
));
2062 /***************************************************************************
2063 Map a parameter's string representation to something we can use.
2064 Returns False if the parameter string is not recognised, else TRUE.
2065 ***************************************************************************/
2066 static int map_parameter(char *pszParmName
)
2070 if (*pszParmName
== '-')
2073 for (iIndex
= 0; parm_table
[iIndex
].label
; iIndex
++)
2074 if (strwicmp(parm_table
[iIndex
].label
, pszParmName
) == 0)
2077 DEBUG(0, ("Unknown parameter encountered: \"%s\"\n", pszParmName
));
2082 /***************************************************************************
2083 Set a boolean variable from the text value stored in the passed string.
2084 Returns True in success, False if the passed string does not correctly
2085 represent a boolean.
2086 ***************************************************************************/
2087 static BOOL
set_boolean(BOOL
*pb
, char *pszParmValue
)
2092 if (strwicmp(pszParmValue
, "yes") == 0 ||
2093 strwicmp(pszParmValue
, "true") == 0 ||
2094 strwicmp(pszParmValue
, "1") == 0)
2097 if (strwicmp(pszParmValue
, "no") == 0 ||
2098 strwicmp(pszParmValue
, "False") == 0 ||
2099 strwicmp(pszParmValue
, "0") == 0)
2104 ("ERROR: Badly formed boolean in configuration file: \"%s\".\n",
2111 /***************************************************************************
2112 Find a service by name. Otherwise works like get_service.
2113 ***************************************************************************/
2114 static int getservicebyname(char *pszServiceName
, service
* pserviceDest
)
2118 for (iService
= iNumServices
- 1; iService
>= 0; iService
--)
2119 if (VALID(iService
) &&
2120 strwicmp(ServicePtrs
[iService
]->szService
, pszServiceName
) == 0)
2122 if (pserviceDest
!= NULL
)
2123 copy_service(pserviceDest
, ServicePtrs
[iService
], NULL
);
2132 /***************************************************************************
2133 Copy a service structure to another
2135 If pcopymapDest is NULL then copy all fields
2136 ***************************************************************************/
2137 static void copy_service(service
* pserviceDest
,
2138 service
* pserviceSource
, BOOL
*pcopymapDest
)
2141 BOOL bcopyall
= (pcopymapDest
== NULL
);
2143 for (i
= 0; parm_table
[i
].label
; i
++)
2144 if (parm_table
[i
].ptr
&& parm_table
[i
].class == P_LOCAL
&&
2145 (bcopyall
|| pcopymapDest
[i
]))
2147 void *def_ptr
= parm_table
[i
].ptr
;
2149 ((char *)pserviceSource
) + PTR_DIFF(def_ptr
,
2152 ((char *)pserviceDest
) + PTR_DIFF(def_ptr
,
2155 switch (parm_table
[i
].type
)
2159 *(BOOL
*)dest_ptr
= *(BOOL
*)src_ptr
;
2165 *(int *)dest_ptr
= *(int *)src_ptr
;
2169 *(char *)dest_ptr
= *(char *)src_ptr
;
2173 string_set(dest_ptr
,
2178 string_set(dest_ptr
,
2180 strupper(*(char **)dest_ptr
);
2189 init_copymap(pserviceDest
);
2190 if (pserviceSource
->copymap
)
2191 memcpy((void *)pserviceDest
->copymap
,
2192 (void *)pserviceSource
->copymap
,
2193 sizeof(BOOL
) * NUMPARAMETERS
);
2197 /***************************************************************************
2198 Check a service for consistency. Return False if the service is in any way
2199 incomplete or faulty, else True.
2200 ***************************************************************************/
2201 static BOOL
service_ok(int iService
)
2206 if (ServicePtrs
[iService
]->szService
[0] == '\0')
2209 ("The following message indicates an internal error:\n"));
2210 DEBUG(0, ("No service name in service entry.\n"));
2214 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
2215 /* I can't see why you'd want a non-printable printer service... */
2216 if (strwicmp(ServicePtrs
[iService
]->szService
, PRINTERS_NAME
) == 0) {
2217 if (!ServicePtrs
[iService
]->bPrint_ok
) {
2219 ("WARNING: [%s] service MUST be printable!\n",
2220 ServicePtrs
[iService
]->szService
));
2221 ServicePtrs
[iService
]->bPrint_ok
= True
;
2223 /* [printers] service must also be non-browsable. */
2224 if (ServicePtrs
[iService
]->bBrowseable
)
2225 ServicePtrs
[iService
]->bBrowseable
= False
;
2228 if (ServicePtrs
[iService
]->szPath
[0] == '\0' &&
2229 strwicmp(ServicePtrs
[iService
]->szService
, HOMES_NAME
) != 0)
2232 ("No path in service %s - using %s\n",
2233 ServicePtrs
[iService
]->szService
, tmpdir()));
2234 string_set(&ServicePtrs
[iService
]->szPath
, tmpdir());
2237 /* If a service is flagged unavailable, log the fact at level 0. */
2238 if (!ServicePtrs
[iService
]->bAvailable
)
2239 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
2240 ServicePtrs
[iService
]->szService
));
2245 static struct file_lists
2247 struct file_lists
*next
;
2251 } *file_lists
= NULL
;
2253 /*******************************************************************
2254 keep a linked list of all config files so we know when one has changed
2255 it's date and needs to be reloaded
2256 ********************************************************************/
2257 static void add_to_file_list(char *fname
, char *subfname
)
2259 struct file_lists
*f
= file_lists
;
2262 if (f
->name
&& !strcmp(f
->name
, fname
))
2268 f
= (struct file_lists
*)malloc(sizeof(file_lists
[0]));
2271 f
->next
= file_lists
;
2272 f
->name
= strdup(fname
);
2277 f
->subfname
= strdup(subfname
);
2283 f
->modtime
= file_modtime(subfname
);
2285 time_t t
= file_modtime(subfname
);
2291 /*******************************************************************
2292 check if a config file has changed date
2293 ********************************************************************/
2294 BOOL
lp_file_list_changed(void)
2296 struct file_lists
*f
= file_lists
;
2297 DEBUG(6, ("lp_file_list_changed()\n"));
2303 pstrcpy(n2
, f
->name
);
2304 standard_sub_basic(n2
,sizeof(n2
));
2306 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
2307 f
->name
, n2
, ctime(&f
->modtime
)));
2309 mod_time
= file_modtime(n2
);
2311 if (mod_time
&& ((f
->modtime
!= mod_time
) || (f
->subfname
== NULL
) || (strcmp(n2
, f
->subfname
) != 0))) {
2312 DEBUGADD(6, ("file %s modified: %s\n", n2
, ctime(&mod_time
)));
2313 f
->modtime
= mod_time
;
2314 SAFE_FREE(f
->subfname
);
2315 f
->subfname
= strdup(n2
);
2323 /***************************************************************************
2324 Run standard_sub_basic on netbios name... needed because global_myname
2325 is not accessed through any lp_ macro.
2326 Note: We must *NOT* use string_set() here as ptr points to global_myname.
2327 ***************************************************************************/
2329 static BOOL
handle_netbios_name(char *pszParmValue
, char **ptr
)
2331 pstring netbios_name
;
2333 pstrcpy(netbios_name
, pszParmValue
);
2335 standard_sub_basic(netbios_name
,sizeof(netbios_name
));
2336 strupper(netbios_name
);
2339 * Convert from UNIX to DOS string - the UNIX to DOS converter
2340 * isn't called on the special handlers.
2342 unix_to_dos(netbios_name
);
2343 pstrcpy(global_myname
, netbios_name
);
2346 ("handle_netbios_name: set global_myname to: %s\n",
2352 /***************************************************************************
2353 Do the work of sourcing in environment variable/value pairs.
2354 ***************************************************************************/
2356 static BOOL
source_env(char **lines
)
2363 for (i
= 0; lines
[i
]; i
++)
2365 char *line
= lines
[i
];
2367 if ((len
= strlen(line
)) == 0)
2370 if (line
[len
- 1] == '\n')
2373 if ((varval
= malloc(len
+ 1)) == NULL
)
2375 DEBUG(0, ("source_env: Not enough memory!\n"));
2379 DEBUG(4, ("source_env: Adding to environment: %s\n", line
));
2380 strncpy(varval
, line
, len
);
2383 p
= strchr(line
, (int)'=');
2386 DEBUG(4, ("source_env: missing '=': %s\n", line
));
2393 ("source_env: Failed to put environment variable %s\n",
2401 ("source_env: getting var %s = %s\n", line
,
2405 DEBUG(4, ("source_env: returning successfully\n"));
2409 /***************************************************************************
2410 Handle the source environment operation
2411 ***************************************************************************/
2413 static BOOL
handle_source_env(char *pszParmValue
, char **ptr
)
2420 pstrcpy(fname
, pszParmValue
);
2422 standard_sub_basic(fname
,sizeof(fname
));
2424 string_set(ptr
, pszParmValue
);
2426 DEBUG(4, ("handle_source_env: checking env type\n"));
2429 * Filename starting with '|' means popen and read from stdin.
2434 lines
= file_lines_pload(p
+ 1, NULL
, True
);
2438 lines
= file_lines_load(fname
, NULL
, True
);
2444 ("handle_source_env: Failed to open file %s, Error was %s\n",
2445 fname
, strerror(errno
)));
2449 result
= source_env(lines
);
2450 file_lines_free(lines
);
2455 /***************************************************************************
2456 handle the interpretation of the vfs object parameter
2457 *************************************************************************/
2458 static BOOL
handle_vfs_object(char *pszParmValue
, char **ptr
)
2460 /* Set string value */
2462 string_set(ptr
, pszParmValue
);
2464 /* Do any other initialisation required for vfs. Note that
2465 anything done here may have linking repercussions in nmbd. */
2470 /***************************************************************************
2471 handle the interpretation of the coding system parameter
2472 *************************************************************************/
2473 static BOOL
handle_coding_system(char *pszParmValue
, char **ptr
)
2475 string_set(ptr
, pszParmValue
);
2476 interpret_coding_system(pszParmValue
);
2480 /***************************************************************************
2481 Handle the interpretation of the character set system parameter.
2482 ***************************************************************************/
2484 static char *saved_character_set
= NULL
;
2486 static BOOL
handle_character_set(char *pszParmValue
, char **ptr
)
2488 /* A dependency here is that the parameter client code page should be
2489 set before this is called.
2491 string_set(ptr
, pszParmValue
);
2493 saved_character_set
= strdup(*ptr
);
2494 interpret_character_set(*ptr
, lp_client_code_page());
2498 /***************************************************************************
2499 Handle the interpretation of the client code page parameter.
2500 We handle this separately so that we can reset the character set
2501 parameter in case this came before 'client code page' in the smb.conf.
2502 ***************************************************************************/
2504 static BOOL
handle_client_code_page(char *pszParmValue
, char **ptr
)
2506 Globals
.client_code_page
= atoi(pszParmValue
);
2507 if (saved_character_set
!= NULL
)
2508 interpret_character_set(saved_character_set
,
2509 lp_client_code_page());
2510 codepage_initialise(lp_client_code_page());
2514 /***************************************************************************
2515 handle the valid chars lines
2516 ***************************************************************************/
2518 static BOOL
handle_valid_chars(char *pszParmValue
, char **ptr
)
2520 string_set(ptr
, pszParmValue
);
2522 /* A dependency here is that the parameter client code page must be
2523 set before this is called - as calling codepage_initialise()
2524 would overwrite the valid char lines.
2526 codepage_initialise(lp_client_code_page());
2528 add_char_string(pszParmValue
);
2532 /***************************************************************************
2533 handle the include operation
2534 ***************************************************************************/
2536 static BOOL
handle_include(char *pszParmValue
, char **ptr
)
2539 pstrcpy(fname
, pszParmValue
);
2541 standard_sub_basic(fname
,sizeof(fname
));
2543 add_to_file_list(pszParmValue
, fname
);
2545 string_set(ptr
, fname
);
2547 if (file_exist(fname
, NULL
))
2548 return (pm_process(fname
, do_section
, do_parameter
));
2550 DEBUG(2, ("Can't find include file %s\n", fname
));
2556 /***************************************************************************
2557 handle the interpretation of the copy parameter
2558 ***************************************************************************/
2559 static BOOL
handle_copy(char *pszParmValue
, char **ptr
)
2563 service serviceTemp
;
2565 string_set(ptr
, pszParmValue
);
2567 init_service(&serviceTemp
);
2571 DEBUG(3, ("Copying service from service %s\n", pszParmValue
));
2573 if ((iTemp
= getservicebyname(pszParmValue
, &serviceTemp
)) >= 0)
2575 if (iTemp
== iServiceIndex
)
2578 ("Can't copy service %s - unable to copy self!\n",
2583 copy_service(ServicePtrs
[iServiceIndex
],
2585 ServicePtrs
[iServiceIndex
]->copymap
);
2591 DEBUG(0, ("Unable to copy service - source not found: %s\n",
2596 free_service(&serviceTemp
);
2600 /***************************************************************************
2601 Handle winbind uid and gid allocation parameters. The format of these
2606 winbind uid = 1000-1999
2607 winbind gid = 700-899
2609 We only do simple parsing checks here. The strings are parsed into useful
2610 structures in the winbind daemon code.
2612 ***************************************************************************/
2614 /* Some lp_ routines to return winbind [ug]id information */
2616 static uid_t winbind_uid_low
, winbind_uid_high
;
2617 static gid_t winbind_gid_low
, winbind_gid_high
;
2619 BOOL
lp_winbind_uid(uid_t
*low
, uid_t
*high
)
2621 if (winbind_uid_low
== 0 || winbind_uid_high
== 0)
2625 *low
= winbind_uid_low
;
2628 *high
= winbind_uid_high
;
2633 BOOL
lp_winbind_gid(gid_t
*low
, gid_t
*high
)
2635 if (winbind_gid_low
== 0 || winbind_gid_high
== 0)
2639 *low
= winbind_gid_low
;
2642 *high
= winbind_gid_high
;
2647 /* Do some simple checks on "winbind [ug]id" parameter values */
2649 static BOOL
handle_winbind_uid(char *pszParmValue
, char **ptr
)
2651 unsigned int low
, high
;
2653 if (sscanf(pszParmValue
, "%u-%u", &low
, &high
) != 2 || high
< low
)
2658 string_set(ptr
, pszParmValue
);
2660 winbind_uid_low
= (uid_t
)low
;
2661 winbind_uid_high
= (uid_t
)high
;
2666 static BOOL
handle_winbind_gid(char *pszParmValue
, char **ptr
)
2668 unsigned int low
, high
;
2670 if (sscanf(pszParmValue
, "%u-%u", &low
, &high
) != 2 || high
< low
)
2675 string_set(ptr
, pszParmValue
);
2677 winbind_gid_low
= (gid_t
)low
;
2678 winbind_gid_high
= (gid_t
)high
;
2683 /***************************************************************************
2684 Handle the WINS SERVER list.
2685 ***************************************************************************/
2687 static BOOL
handle_wins_server_list( char *pszParmValue
, char **ptr
)
2689 if( !wins_srv_load_list( pszParmValue
) )
2690 return( False
); /* Parse failed. */
2692 string_set( ptr
, pszParmValue
);
2696 /***************************************************************************
2697 Handle the DEBUG level list.
2698 ***************************************************************************/
2700 static BOOL
handle_debug_list( char *pszParmValueIn
, char **ptr
)
2702 pstring pszParmValue
;
2704 pstrcpy(pszParmValue
, pszParmValueIn
);
2705 return debug_parse_levels( pszParmValue
);
2709 /***************************************************************************
2710 Initialise a copymap.
2711 ***************************************************************************/
2713 static void init_copymap(service
* pservice
)
2716 SAFE_FREE(pservice
->copymap
);
2717 pservice
->copymap
= (BOOL
*)malloc(sizeof(BOOL
) * NUMPARAMETERS
);
2718 if (!pservice
->copymap
)
2720 ("Couldn't allocate copymap!! (size %d)\n",
2721 (int)NUMPARAMETERS
));
2723 for (i
= 0; i
< NUMPARAMETERS
; i
++)
2724 pservice
->copymap
[i
] = True
;
2728 /***************************************************************************
2729 return the local pointer to a parameter given the service number and the
2730 pointer into the default structure
2731 ***************************************************************************/
2732 void *lp_local_ptr(int snum
, void *ptr
)
2734 return (void *)(((char *)ServicePtrs
[snum
]) + PTR_DIFF(ptr
, &sDefault
));
2737 /***************************************************************************
2738 Process a parameter for a particular service number. If snum < 0
2739 then assume we are in the globals
2740 ***************************************************************************/
2741 BOOL
lp_do_parameter(int snum
, char *pszParmName
, char *pszParmValue
)
2744 void *parm_ptr
= NULL
; /* where we are going to store the result */
2745 void *def_ptr
= NULL
;
2747 parmnum
= map_parameter(pszParmName
);
2752 ("Ignoring unknown parameter \"%s\"\n", pszParmName
));
2756 if (parm_table
[parmnum
].flags
& FLAG_DEPRECATED
)
2758 DEBUG(0, ("WARNING: The \"%s\"option is deprecated\n",
2762 def_ptr
= parm_table
[parmnum
].ptr
;
2764 /* we might point at a service, the default service or a global */
2771 if (parm_table
[parmnum
].class == P_GLOBAL
)
2774 ("Global parameter %s found in service section!\n",
2779 ((char *)ServicePtrs
[snum
]) + PTR_DIFF(def_ptr
,
2785 if (!ServicePtrs
[snum
]->copymap
)
2786 init_copymap(ServicePtrs
[snum
]);
2788 /* this handles the aliases - set the copymap for other entries with
2789 the same data pointer */
2790 for (i
= 0; parm_table
[i
].label
; i
++)
2791 if (parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
)
2792 ServicePtrs
[snum
]->copymap
[i
] = False
;
2795 /* if it is a special case then go ahead */
2796 if (parm_table
[parmnum
].special
)
2798 parm_table
[parmnum
].special(pszParmValue
, (char **)parm_ptr
);
2802 /* now switch on the type of variable it is */
2803 switch (parm_table
[parmnum
].type
)
2806 set_boolean(parm_ptr
, pszParmValue
);
2810 set_boolean(parm_ptr
, pszParmValue
);
2811 *(BOOL
*)parm_ptr
= !*(BOOL
*)parm_ptr
;
2815 *(int *)parm_ptr
= atoi(pszParmValue
);
2819 *(char *)parm_ptr
= *pszParmValue
;
2823 sscanf(pszParmValue
, "%o", (int *)parm_ptr
);
2827 string_set(parm_ptr
, pszParmValue
);
2828 if (parm_table
[parmnum
].flags
& FLAG_DOS_STRING
)
2829 unix_to_dos(*(char **)parm_ptr
);
2833 string_set(parm_ptr
, pszParmValue
);
2834 if (parm_table
[parmnum
].flags
& FLAG_DOS_STRING
)
2835 unix_to_dos(*(char **)parm_ptr
);
2836 strupper(*(char **)parm_ptr
);
2840 pstrcpy((char *)parm_ptr
, pszParmValue
);
2841 if (parm_table
[parmnum
].flags
& FLAG_DOS_STRING
)
2842 unix_to_dos((char *)parm_ptr
);
2846 pstrcpy((char *)parm_ptr
, pszParmValue
);
2847 if (parm_table
[parmnum
].flags
& FLAG_DOS_STRING
)
2848 unix_to_dos((char *)parm_ptr
);
2849 strupper((char *)parm_ptr
);
2853 for (i
= 0; parm_table
[parmnum
].enum_list
[i
].name
;
2858 parm_table
[parmnum
].enum_list
[i
].name
))
2861 parm_table
[parmnum
].
2875 /***************************************************************************
2876 Process a parameter.
2877 ***************************************************************************/
2878 static BOOL
do_parameter(char *pszParmName
, char *pszParmValue
)
2880 if (!bInGlobalSection
&& bGlobalOnly
)
2883 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName
, pszParmValue
));
2885 return (lp_do_parameter(bInGlobalSection
? -2 : iServiceIndex
,
2886 pszParmName
, pszParmValue
));
2890 /***************************************************************************
2891 print a parameter of the specified type
2892 ***************************************************************************/
2893 static void print_parameter(struct parm_struct
*p
, void *ptr
, FILE * f
, char *(*dos_to_ext
)(const char *))
2899 for (i
= 0; p
->enum_list
[i
].name
; i
++)
2901 if (*(int *)ptr
== p
->enum_list
[i
].value
)
2904 p
->enum_list
[i
].name
);
2911 fprintf(f
, "%s", BOOLSTR(*(BOOL
*)ptr
));
2915 fprintf(f
, "%s", BOOLSTR(!*(BOOL
*)ptr
));
2919 fprintf(f
, "%d", *(int *)ptr
);
2920 if (strequal(p
->label
,"log level")) {
2921 for (i
= 1; i
< DBGC_LAST
; i
++) {
2922 if (((int *)ptr
)[i
])
2923 fprintf(f
, ",%s:%d",debug_classname_from_index(i
),((int *)ptr
)[i
]);
2929 fprintf(f
, "%c", *(char *)ptr
);
2933 fprintf(f
, "%s", octal_string(*(int *)ptr
));
2939 if (p
->flags
& FLAG_DOS_STRING
)
2940 fprintf(f
, "%s", dos_to_ext((const char *)ptr
));
2942 fprintf(f
, "%s", (char *)ptr
);
2948 if (*(char **)ptr
) {
2949 if(p
->flags
& FLAG_DOS_STRING
)
2950 fprintf(f
,"%s",dos_to_ext((const char *)*(const char **)ptr
));
2952 fprintf(f
, "%s", *(char **)ptr
);
2961 /***************************************************************************
2962 check if two parameters are equal
2963 ***************************************************************************/
2964 static BOOL
equal_parameter(parm_type type
, void *ptr1
, void *ptr2
)
2970 return (*((BOOL
*)ptr1
) == *((BOOL
*)ptr2
));
2975 return (*((int *)ptr1
) == *((int *)ptr2
));
2978 return (*((char *)ptr1
) == *((char *)ptr2
));
2983 char *p1
= (char *)ptr1
, *p2
= (char *)ptr2
;
2988 return (p1
== p2
|| strequal(p1
, p2
));
2993 char *p1
= *(char **)ptr1
, *p2
= *(char **)ptr2
;
2998 return (p1
== p2
|| strequal(p1
, p2
));
3006 /***************************************************************************
3007 Initialize any local varients in the sDefault table.
3008 ***************************************************************************/
3010 void init_locals(void)
3015 /***************************************************************************
3016 Process a new section (service). At this stage all sections are services.
3017 Later we'll have special sections that permit server parameters to be set.
3018 Returns True on success, False on failure. SectionName must be in DOS codepage.
3019 ***************************************************************************/
3020 static BOOL
do_section(char *pszSectionName
)
3023 BOOL isglobal
= ((strwicmp(pszSectionName
, GLOBAL_NAME
) == 0) ||
3024 (strwicmp(pszSectionName
, GLOBAL_NAME2
) == 0));
3027 /* if we were in a global section then do the local inits */
3028 if (bInGlobalSection
&& !isglobal
)
3031 /* if we've just struck a global section, note the fact. */
3032 bInGlobalSection
= isglobal
;
3034 /* check for multiple global sections */
3035 if (bInGlobalSection
)
3037 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName
));
3041 if (!bInGlobalSection
&& bGlobalOnly
)
3044 /* if we have a current service, tidy it up before moving on */
3047 if (iServiceIndex
>= 0)
3048 bRetval
= service_ok(iServiceIndex
);
3050 /* if all is still well, move to the next record in the services array */
3053 /* We put this here to avoid an odd message order if messages are */
3054 /* issued by the post-processing of a previous section. */
3055 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName
));
3057 if ((iServiceIndex
= add_a_service(&sDefault
, pszSectionName
))
3060 DEBUG(0, ("Failed to add a new service\n"));
3069 /***************************************************************************
3070 determine if a partcular base parameter is currently set to the default value.
3071 ***************************************************************************/
3072 static BOOL
is_default(int i
)
3074 if (!defaults_saved
)
3076 switch (parm_table
[i
].type
)
3080 return strequal(parm_table
[i
].def
.svalue
,
3081 *(char **)parm_table
[i
].ptr
);
3084 return strequal(parm_table
[i
].def
.svalue
,
3085 (char *)parm_table
[i
].ptr
);
3088 return parm_table
[i
].def
.bvalue
==
3089 *(BOOL
*)parm_table
[i
].ptr
;
3091 return parm_table
[i
].def
.cvalue
==
3092 *(char *)parm_table
[i
].ptr
;
3096 return parm_table
[i
].def
.ivalue
==
3097 *(int *)parm_table
[i
].ptr
;
3105 /***************************************************************************
3106 Display the contents of the global structure.
3107 ***************************************************************************/
3108 static void dump_globals(FILE *f
, char *(*dos_to_ext
)(const char *))
3111 fprintf(f
, "# Global parameters\n[global]\n");
3113 for (i
= 0; parm_table
[i
].label
; i
++)
3114 if (parm_table
[i
].class == P_GLOBAL
&&
3115 parm_table
[i
].ptr
&&
3116 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
3118 if (defaults_saved
&& is_default(i
))
3120 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
3121 print_parameter(&parm_table
[i
], parm_table
[i
].ptr
, f
, dos_to_ext
);
3126 /***************************************************************************
3127 return True if a local parameter is currently set to the global default
3128 ***************************************************************************/
3129 BOOL
lp_is_default(int snum
, struct parm_struct
*parm
)
3131 int pdiff
= PTR_DIFF(parm
->ptr
, &sDefault
);
3133 return equal_parameter(parm
->type
,
3134 ((char *)ServicePtrs
[snum
]) + pdiff
,
3135 ((char *)&sDefault
) + pdiff
);
3139 /***************************************************************************
3140 Display the contents of a single services record.
3141 ***************************************************************************/
3142 static void dump_a_service(service
* pService
, FILE * f
, char *(*dos_to_ext
)(const char *))
3145 if (pService
!= &sDefault
)
3146 fprintf(f
, "\n[%s]\n", pService
->szService
);
3148 for (i
= 0; parm_table
[i
].label
; i
++)
3149 if (parm_table
[i
].class == P_LOCAL
&&
3150 parm_table
[i
].ptr
&&
3151 (*parm_table
[i
].label
!= '-') &&
3152 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
3154 int pdiff
= PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
3156 if (pService
== &sDefault
)
3158 if (defaults_saved
&& is_default(i
))
3163 if (equal_parameter(parm_table
[i
].type
,
3164 ((char *)pService
) +
3166 ((char *)&sDefault
) +
3171 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
3172 print_parameter(&parm_table
[i
],
3173 ((char *)pService
) + pdiff
, f
, dos_to_ext
);
3179 /***************************************************************************
3180 return info about the next service in a service. snum==-1 gives the globals
3182 return NULL when out of parameters
3183 ***************************************************************************/
3184 struct parm_struct
*lp_next_parameter(int snum
, int *i
, int allparameters
)
3188 /* do the globals */
3189 for (; parm_table
[*i
].label
; (*i
)++)
3191 if (parm_table
[*i
].class == P_SEPARATOR
)
3192 return &parm_table
[(*i
)++];
3194 if (!parm_table
[*i
].ptr
3195 || (*parm_table
[*i
].label
== '-'))
3199 && (parm_table
[*i
].ptr
==
3200 parm_table
[(*i
) - 1].ptr
))
3203 return &parm_table
[(*i
)++];
3208 service
*pService
= ServicePtrs
[snum
];
3210 for (; parm_table
[*i
].label
; (*i
)++)
3212 if (parm_table
[*i
].class == P_SEPARATOR
)
3213 return &parm_table
[(*i
)++];
3215 if (parm_table
[*i
].class == P_LOCAL
&&
3216 parm_table
[*i
].ptr
&&
3217 (*parm_table
[*i
].label
!= '-') &&
3219 (parm_table
[*i
].ptr
!=
3220 parm_table
[(*i
) - 1].ptr
)))
3223 PTR_DIFF(parm_table
[*i
].ptr
,
3226 if (allparameters
||
3227 !equal_parameter(parm_table
[*i
].type
,
3228 ((char *)pService
) +
3230 ((char *)&sDefault
) +
3233 return &parm_table
[(*i
)++];
3244 /***************************************************************************
3245 Display the contents of a single copy structure.
3246 ***************************************************************************/
3247 static void dump_copy_map(BOOL
*pcopymap
)
3253 printf("\n\tNon-Copied parameters:\n");
3255 for (i
= 0; parm_table
[i
].label
; i
++)
3256 if (parm_table
[i
].class == P_LOCAL
&&
3257 parm_table
[i
].ptr
&& !pcopymap
[i
] &&
3258 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
3260 printf("\t\t%s\n", parm_table
[i
].label
);
3265 /***************************************************************************
3266 Return TRUE if the passed service number is within range.
3267 ***************************************************************************/
3269 BOOL
lp_snum_ok(int iService
)
3271 return (LP_SNUM_OK(iService
) && ServicePtrs
[iService
]->bAvailable
);
3274 /***************************************************************************
3275 Auto-load some home services.
3276 ***************************************************************************/
3278 static void lp_add_auto_services(char *str
)
3291 homes
= lp_servicenumber(HOMES_NAME
);
3293 for (p
= strtok(s
, LIST_SEP
); p
; p
= strtok(NULL
, LIST_SEP
)) {
3294 char *home
= get_user_service_home_dir(p
);
3296 if (lp_servicenumber(p
) >= 0)
3299 if (home
&& homes
>= 0)
3300 lp_add_home(p
, homes
, home
);
3305 /***************************************************************************
3306 Auto-load one printer.
3307 ***************************************************************************/
3309 void lp_add_one_printer(char *name
, char *comment
)
3311 int printers
= lp_servicenumber(PRINTERS_NAME
);
3314 if (lp_servicenumber(name
) < 0) {
3315 lp_add_printer(name
, printers
);
3316 if ((i
= lp_servicenumber(name
)) >= 0) {
3317 string_set(&ServicePtrs
[i
]->comment
, comment
);
3318 unix_to_dos(ServicePtrs
[i
]->comment
);
3319 ServicePtrs
[i
]->autoloaded
= True
;
3324 /***************************************************************************
3325 have we loaded a services file yet?
3326 ***************************************************************************/
3327 BOOL
lp_loaded(void)
3332 /***************************************************************************
3333 unload unused services
3334 ***************************************************************************/
3335 void lp_killunused(BOOL (*snumused
) (int))
3338 for (i
= 0; i
< iNumServices
; i
++)
3343 if (!snumused
|| !snumused(i
))
3345 ServicePtrs
[i
]->valid
= False
;
3346 free_service(ServicePtrs
[i
]);
3352 /***************************************************************************
3354 ***************************************************************************/
3355 void lp_killservice(int iServiceIn
)
3357 if (VALID(iServiceIn
))
3359 ServicePtrs
[iServiceIn
]->valid
= False
;
3360 free_service(ServicePtrs
[iServiceIn
]);
3364 /***************************************************************************
3365 save the curent values of all global and sDefault parameters into the
3366 defaults union. This allows swat and testparm to show only the
3367 changed (ie. non-default) parameters.
3368 ***************************************************************************/
3369 static void lp_save_defaults(void)
3372 for (i
= 0; parm_table
[i
].label
; i
++)
3374 if (i
> 0 && parm_table
[i
].ptr
== parm_table
[i
- 1].ptr
)
3376 switch (parm_table
[i
].type
)
3380 parm_table
[i
].def
.svalue
=
3381 strdup(*(char **)parm_table
[i
].ptr
);
3385 parm_table
[i
].def
.svalue
=
3386 strdup((char *)parm_table
[i
].ptr
);
3390 parm_table
[i
].def
.bvalue
=
3391 *(BOOL
*)parm_table
[i
].ptr
;
3394 parm_table
[i
].def
.cvalue
=
3395 *(char *)parm_table
[i
].ptr
;
3400 parm_table
[i
].def
.ivalue
=
3401 *(int *)parm_table
[i
].ptr
;
3407 defaults_saved
= True
;
3410 /*******************************************************************
3411 Set the server type we will announce as via nmbd.
3412 ********************************************************************/
3413 static void set_server_role(void)
3415 server_role
= ROLE_STANDALONE
;
3417 switch (lp_security()) {
3419 if (lp_domain_logons())
3420 DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
3421 DEBUG(10,("set_server_role: ROLE_STANDALONE\n"));
3425 if (lp_domain_logons()) {
3426 server_role
= ROLE_DOMAIN_BDC
;
3427 DEBUG(10,("set_server_role: ROLE_DOMAIN_BDC\n"));
3430 server_role
= ROLE_DOMAIN_MEMBER
;
3431 DEBUG(10,("set_server_role: ROLE_DOMAIN_MEMBER\n"));
3434 if (lp_domain_logons()) {
3435 server_role
= ROLE_DOMAIN_PDC
;
3436 DEBUG(10,("set_server_role: ROLE_DOMAIN_PDC\n"));
3439 DEBUG(10,("set_server_role: ROLE_STANDALONE\n"));
3442 DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
3443 DEBUG(10,("set_server_role: ROLE_STANDALONE\n"));
3449 /***************************************************************************
3450 Load the services array from the services file. Return True on success,
3452 ***************************************************************************/
3453 BOOL
lp_load(char *pszFname
, BOOL global_only
, BOOL save_defaults
,
3459 pstrcpy(n2
, pszFname
);
3460 standard_sub_basic(n2
,sizeof(n2
));
3462 add_to_file_list(pszFname
, n2
);
3466 bInGlobalSection
= True
;
3467 bGlobalOnly
= global_only
;
3477 pstrcpy(n2
, pszFname
);
3478 standard_sub_basic(n2
,sizeof(n2
));
3480 /* We get sections first, so have to start 'behind' to make up */
3482 bRetval
= pm_process(n2
, do_section
, do_parameter
);
3484 /* finish up the last section */
3485 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval
)));
3487 if (iServiceIndex
>= 0)
3488 bRetval
= service_ok(iServiceIndex
);
3490 lp_add_auto_services(lp_auto_services());
3493 lp_add_ipc("IPC$", True
);
3494 lp_add_ipc("ADMIN$", False
);
3498 set_default_server_announce_type();
3502 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
3503 /* if bWINSsupport is true and we are in the client */
3505 if (in_client
&& Globals
.bWINSsupport
)
3508 string_set(&Globals
.szWINSserver
, "127.0.0.1");
3516 /***************************************************************************
3517 reset the max number of services
3518 ***************************************************************************/
3519 void lp_resetnumservices(void)
3524 /***************************************************************************
3525 return the max number of services
3526 ***************************************************************************/
3527 int lp_numservices(void)
3529 return (iNumServices
);
3532 /***************************************************************************
3533 Display the contents of the services array in human-readable form.
3534 ***************************************************************************/
3535 void lp_dump(FILE *f
, BOOL show_defaults
, int maxtoprint
, char *(*dos_to_ext
)(const char *))
3541 defaults_saved
= False
;
3544 dump_globals(f
, dos_to_ext
);
3546 dump_a_service(&sDefault
, f
, dos_to_ext
);
3548 for (iService
= 0; iService
< maxtoprint
; iService
++)
3549 lp_dump_one(f
, show_defaults
, iService
, dos_to_ext
);
3552 /***************************************************************************
3553 Display the contents of one service in human-readable form.
3554 ***************************************************************************/
3555 void lp_dump_one(FILE * f
, BOOL show_defaults
, int snum
, char *(*dos_to_ext
)(const char *))
3559 if (ServicePtrs
[snum
]->szService
[0] == '\0')
3561 dump_a_service(ServicePtrs
[snum
], f
, dos_to_ext
);
3566 /***************************************************************************
3567 Return the number of the service with the given name, or -1 if it doesn't
3568 exist. Note that this is a DIFFERENT ANIMAL from the internal function
3569 getservicebyname()! This works ONLY if all services have been loaded, and
3570 does not copy the found service.
3571 ***************************************************************************/
3572 int lp_servicenumber(char *pszServiceName
)
3575 fstring serviceName
;
3578 for (iService
= iNumServices
- 1; iService
>= 0; iService
--)
3580 if (VALID(iService
) && ServicePtrs
[iService
]->szService
)
3583 * The substitution here is used to support %U is
3586 fstrcpy(serviceName
, ServicePtrs
[iService
]->szService
);
3587 standard_sub_basic(serviceName
,sizeof(serviceName
));
3588 if (strequal(serviceName
, pszServiceName
))
3594 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName
));
3599 /*******************************************************************
3600 A useful volume label function. Returns a string in DOS codepage.
3601 ********************************************************************/
3603 char *volume_label(int snum
)
3605 char *ret
= lp_volume(snum
);
3607 return lp_servicename(snum
);
3612 /*******************************************************************
3613 Set the server type we will announce as via nmbd.
3614 ********************************************************************/
3615 static void set_default_server_announce_type(void)
3617 default_server_announce
= 0;
3618 default_server_announce
|= SV_TYPE_WORKSTATION
;
3619 default_server_announce
|= SV_TYPE_SERVER
;
3620 default_server_announce
|= SV_TYPE_SERVER_UNIX
;
3621 default_server_announce
|= SV_TYPE_PRINTQ_SERVER
;
3623 switch (lp_announce_as())
3625 case ANNOUNCE_AS_NT_SERVER
:
3627 default_server_announce
|= SV_TYPE_SERVER_NT
;
3628 /* fall through... */
3630 case ANNOUNCE_AS_NT_WORKSTATION
:
3632 default_server_announce
|= SV_TYPE_NT
;
3635 case ANNOUNCE_AS_WIN95
:
3637 default_server_announce
|= SV_TYPE_WIN95_PLUS
;
3640 case ANNOUNCE_AS_WFW
:
3642 default_server_announce
|= SV_TYPE_WFW
;
3651 switch (lp_server_role())
3653 case ROLE_DOMAIN_MEMBER
:
3655 default_server_announce
|= SV_TYPE_DOMAIN_MEMBER
;
3658 case ROLE_DOMAIN_PDC
:
3660 default_server_announce
|= SV_TYPE_DOMAIN_CTRL
;
3663 case ROLE_DOMAIN_BDC
:
3665 default_server_announce
|= SV_TYPE_DOMAIN_BAKCTRL
;
3668 case ROLE_STANDALONE
:
3675 if (lp_time_server())
3677 default_server_announce
|= SV_TYPE_TIME_SOURCE
;
3680 if (lp_host_msdfs())
3682 default_server_announce
|= SV_TYPE_DFS_SERVER
;
3686 /***********************************************************
3687 returns role of Samba server
3688 ************************************************************/
3690 int lp_server_role(void)
3695 /***********************************************************
3696 If we are PDC then prefer us as DMB
3697 ************************************************************/
3699 BOOL
lp_domain_master(void)
3701 if (Globals
.bDomainMaster
== Auto
)
3703 return (lp_server_role() == ROLE_DOMAIN_PDC
);
3706 return Globals
.bDomainMaster
;
3709 /***********************************************************
3710 If we are DMB then prefer us as LMB
3711 ************************************************************/
3713 BOOL
lp_preferred_master(void)
3715 if (Globals
.bPreferredMaster
== Auto
)
3717 return (lp_local_master() && lp_domain_master());
3720 return Globals
.bPreferredMaster
;
3725 /*******************************************************************
3727 ********************************************************************/
3728 void lp_remove_service(int snum
)
3730 ServicePtrs
[snum
]->valid
= False
;
3733 /*******************************************************************
3734 copy a service. new_name must be in dos codepage
3735 ********************************************************************/
3736 void lp_copy_service(int snum
, char *new_name
)
3738 char *oldname
= lp_servicename(snum
);
3739 do_section(new_name
);
3742 snum
= lp_servicenumber(new_name
);
3744 lp_do_parameter(snum
, "copy", oldname
);
3749 /*******************************************************************
3750 Get the default server type we will announce as via nmbd.
3751 ********************************************************************/
3752 int lp_default_server_announce(void)
3754 return default_server_announce
;
3757 /*******************************************************************
3758 Split the announce version into major and minor numbers.
3759 ********************************************************************/
3760 int lp_major_announce_version(void)
3762 static BOOL got_major
= False
;
3763 static int major_version
= DEFAULT_MAJOR_VERSION
;
3768 return major_version
;
3771 if ((vers
= lp_announce_version()) == NULL
)
3772 return major_version
;
3774 if ((p
= strchr(vers
, '.')) == 0)
3775 return major_version
;
3778 major_version
= atoi(vers
);
3779 return major_version
;
3782 int lp_minor_announce_version(void)
3784 static BOOL got_minor
= False
;
3785 static int minor_version
= DEFAULT_MINOR_VERSION
;
3790 return minor_version
;
3793 if ((vers
= lp_announce_version()) == NULL
)
3794 return minor_version
;
3796 if ((p
= strchr(vers
, '.')) == 0)
3797 return minor_version
;
3800 minor_version
= atoi(p
);
3801 return minor_version
;
3804 /***********************************************************
3805 Set the global name resolution order (used in smbclient).
3806 ************************************************************/
3808 void lp_set_name_resolve_order(char *new_order
)
3810 Globals
.szNameResolveOrder
= new_order
;
3813 char *lp_printername(int snum
)
3815 char *ret
= _lp_printername(snum
);
3816 if (ret
== NULL
|| (ret
!= NULL
&& *ret
== '\0'))
3817 ret
= lp_servicename(snum
);
3822 /***********************************************************
3823 Return a pointer to the private directory (containing
3825 ************************************************************/
3827 void get_private_directory(pstring priv_dir
)
3834 pstrcpy(priv_dir
, lp_tdb_passwd_file());
3836 pstrcpy(priv_dir
, lp_smb_passwd_file());
3839 p
= strrchr(priv_dir
, '/');
3843 /***********************************************************
3844 Allow daemons such as winbindd to fix their logfile name.
3845 ************************************************************/
3847 void lp_set_logfile(const char *name
)
3849 extern pstring debugf
;
3850 string_set(&Globals
.szLogFile
, name
);
3851 pstrcpy(debugf
, name
);
3854 /*******************************************************************
3855 Return the NetBIOS called name.
3856 ********************************************************************/
3858 const char *get_called_name(void)
3860 extern fstring local_machine
;
3861 static fstring called_name
;
3863 if (! *local_machine
)
3864 return global_myname
;
3867 * Windows NT/2k uses "*SMBSERVER" and XP uses "*SMBSERV"
3868 * arrggg!!! but we've already rewritten the client's
3869 * netbios name at this point...
3872 if (*local_machine
) {
3873 if (!StrCaseCmp(local_machine
, "_SMBSERVER") || !StrCaseCmp(local_machine
, "_SMBSERV")) {
3874 fstrcpy(called_name
, get_my_primary_ip());
3875 DEBUG(8,("get_called_name: assuming that client used IP address [%s] as called name.\n",
3881 return local_machine
;
3884 /*******************************************************************
3885 Return the max print jobs per queue.
3886 ********************************************************************/
3888 int lp_maxprintjobs(int snum
)
3890 int maxjobs
= LP_SNUM_OK(snum
) ? ServicePtrs
[snum
]->iMaxPrintJobs
: sDefault
.iMaxPrintJobs
;
3891 if (maxjobs
<= 0 || maxjobs
>= PRINT_MAX_JOBID
)
3892 maxjobs
= PRINT_MAX_JOBID
- 1;