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
;
72 extern pstring user_socket_options
;
73 extern pstring global_myname
;
74 pstring global_scope
= "";
77 #define GLOBAL_NAME "global"
81 #define PRINTERS_NAME "printers"
85 #define HOMES_NAME "homes"
88 /* some helpful bits */
89 #define pSERVICE(i) ServicePtrs[i]
90 #define iSERVICE(i) (*pSERVICE(i))
91 #define LP_SNUM_OK(iService) (((iService) >= 0) && ((iService) < iNumServices) && iSERVICE(iService).valid)
92 #define VALID(i) iSERVICE(i).valid
94 int keepalive
= DEFAULT_KEEPALIVE
;
95 BOOL use_getwd_cache
= True
;
97 extern int extra_time_offset
;
99 static BOOL defaults_saved
= False
;
102 * This structure describes global (ie., server-wide) parameters.
106 char *szPrintcapname
;
107 char *szEnumPortsCommand
;
108 char *szAddPrinterCommand
;
109 char *szDeletePrinterCommand
;
112 char *szDefaultService
;
116 char *szServerString
;
117 char *szAutoServices
;
118 char *szPasswdProgram
;
122 char *szSMBPasswdFile
;
124 char *szPassdbModulePath
;
125 char *szPasswordServer
;
126 char *szSocketOptions
;
129 char *szDomainAdminGroup
;
130 char *szDomainGuestGroup
;
131 char *szDomainAdminUsers
;
132 char *szDomainGuestUsers
;
133 char *szDomainHostsallow
;
134 char *szDomainHostsdeny
;
136 #ifdef USING_GROUPNAME_MAP
137 char *szGroupnameMap
;
138 #endif /* USING_GROUPNAME_MAP */
139 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 *szDomainGroups
;
157 char *szNameResolveOrder
;
162 char *szLdapRootPassword
;
164 char *szAddUserScript
;
165 char *szDelUserScript
;
170 char *szUtmpHostname
;
171 BOOL bUtmpConsolidate
;
172 #endif /* WITH_UTMP */
176 char *szTemplateHomedir
;
177 char *szTemplateShell
;
178 char *szWinbindSeparator
;
200 int client_code_page
;
201 int announce_as
; /* This is initialised in init_globals */
202 int machine_password_timeout
;
203 int change_notify_timeout
;
206 int min_passwd_length
;
207 int oplock_break_wait_time
;
208 int winbind_cache_time
;
211 #endif /* WITH_LDAP */
214 char *sslHostsRequire
;
215 char *sslHostsResign
;
221 char *sslClientPrivKey
;
224 BOOL sslReqClientCert
;
225 BOOL sslReqServerCert
;
226 BOOL sslCompatibility
;
227 #endif /* WITH_SSL */
228 BOOL bMsAddPrinterWizard
;
233 BOOL bPreferredMaster
;
236 BOOL bEncryptPasswords
;
244 BOOL bReadPrediction
;
251 BOOL bBindInterfacesOnly
;
252 BOOL bUnixPasswdSync
;
253 BOOL bPasswdChatDebug
;
260 BOOL bAllowTrustedDomains
;
261 BOOL bRestrictAnonymous
;
262 BOOL bDebugHiresTimestamp
;
269 static global Globals
;
274 * This structure describes a single service.
283 char *szGuestaccount
;
284 char *szInvalidUsers
;
292 char *szRootPostExec
;
293 char *szPrintcommand
;
296 char *szLppausecommand
;
297 char *szLpresumecommand
;
298 char *szQueuepausecommand
;
299 char *szQueueresumecommand
;
301 char *szPrinterDriver
;
302 char *szPrinterDriverLocation
;
312 char *szVetoOplockFiles
;
321 char *szVfsObjectFile
;
327 int iCreate_force_mode
;
329 int iSecurity_force_mode
;
332 int iDir_Security_mask
;
333 int iDir_Security_force_mode
;
337 int iOplockContentionLimit
;
340 BOOL bRootpreexecClose
;
343 BOOL bShortCasePreserve
;
375 BOOL bDeleteReadonly
;
377 BOOL bDeleteVetoFiles
;
379 BOOL bDosFiletimeResolution
;
380 BOOL bFakeDirCreateTimes
;
385 char dummy
[3]; /* for alignment */
390 /* This is a default service used to prime a services structure */
391 static service sDefault
= {
393 False
, /* not autoloaded */
394 NULL
, /* szService */
396 NULL
, /* szUsername */
397 NULL
, /* szGuestAccount - this is set in init_globals() */
398 NULL
, /* szInvalidUsers */
399 NULL
, /* szValidUsers */
400 NULL
, /* szAdminUsers */
402 NULL
, /* szInclude */
403 NULL
, /* szPreExec */
404 NULL
, /* szPostExec */
405 NULL
, /* szRootPreExec */
406 NULL
, /* szRootPostExec */
407 NULL
, /* szPrintcommand */
408 NULL
, /* szLpqcommand */
409 NULL
, /* szLprmcommand */
410 NULL
, /* szLppausecommand */
411 NULL
, /* szLpresumecommand */
412 NULL
, /* szQueuepausecommand */
413 NULL
, /* szQueueresumecommand */
414 NULL
, /* szPrintername */
415 NULL
, /* szPrinterDriver - this is set in init_globals() */
416 NULL
, /* szPrinterDriverLocation */
417 NULL
, /* szDriverFile */
418 NULL
, /* szDontdescend */
419 NULL
, /* szHostsallow */
420 NULL
, /* szHostsdeny */
421 NULL
, /* szMagicScript */
422 NULL
, /* szMagicOutput */
423 NULL
, /* szMangledMap */
424 NULL
, /* szVetoFiles */
425 NULL
, /* szHideFiles */
426 NULL
, /* szVetoOplockFiles */
428 NULL
, /* force user */
429 NULL
, /* force group */
431 NULL
, /* writelist */
432 NULL
, /* printer admin */
435 NULL
, /* vfs object */
436 NULL
, /* vfs options */
437 0, /* iMinPrintSpace */
438 1000, /* iMaxPrintJobs */
439 0, /* iWriteCacheSize */
440 0744, /* iCreate_mask */
441 0000, /* iCreate_force_mode */
442 -1, /* iSecurity_mask */
443 -1, /* iSecurity_force_mode */
444 0755, /* iDir_mask */
445 0000, /* iDir_force_mode */
446 -1, /* iDir_Security_mask */
447 -1, /* iDir_Security_force_mode */
448 0, /* iMaxConnections */
449 CASE_LOWER
, /* iDefaultCase */
450 DEFAULT_PRINTING
, /* iPrinting */
451 2, /* iOplockContentionLimit */
452 False
, /* bAlternatePerm */
453 False
, /* bPreexecClose */
454 False
, /* bRootpreexecClose */
455 False
, /* case sensitive */
456 True
, /* case preserve */
457 True
, /* short case preserve */
458 False
, /* case mangle */
460 True
, /* bHideDotFiles */
461 True
, /* bBrowseable */
462 True
, /* bAvailable */
463 True
, /* bRead_only */
464 True
, /* bNo_set_dir */
465 False
, /* bGuest_only */
466 False
, /* bGuest_ok */
467 False
, /* bPrint_ok */
468 False
, /* bPostscript */
469 False
, /* bMap_system */
470 False
, /* bMap_hidden */
471 True
, /* bMap_archive */
473 False
, /* bStrictLocking */
474 True
, /* bPosixLocking */
478 True
, /* bShareModes */
480 True
, /* bLevel2OpLocks */
481 False
, /* bOnlyUser */
482 True
, /* bMangledNames */
483 True
, /* bWidelinks */
484 True
, /* bSymlinks */
485 False
, /* bSyncAlways */
486 False
, /* bStrictSync */
487 '~', /* magic char */
489 False
, /* bDeleteReadonly */
490 False
, /* bFakeOplocks */
491 False
, /* bDeleteVetoFiles */
492 False
, /* bDosFiletimes */
493 False
, /* bDosFiletimeResolution */
494 False
, /* bFakeDirCreateTimes */
495 True
, /* bBlockingLocks */
496 False
, /* bInheritPerms */
497 False
, /* bMSDfsRoot */
504 /* local variables */
505 static service
**ServicePtrs
= NULL
;
506 static int iNumServices
= 0;
507 static int iServiceIndex
= 0;
508 static BOOL bInGlobalSection
= True
;
509 static BOOL bGlobalOnly
= False
;
510 static int server_role
;
511 static int default_server_announce
;
513 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
515 /* prototypes for the special type handlers */
516 static BOOL
handle_valid_chars(char *pszParmValue
, char **ptr
);
517 static BOOL
handle_include(char *pszParmValue
, char **ptr
);
518 static BOOL
handle_copy(char *pszParmValue
, char **ptr
);
519 static BOOL
handle_character_set(char *pszParmValue
, char **ptr
);
520 static BOOL
handle_coding_system(char *pszParmValue
, char **ptr
);
521 static BOOL
handle_client_code_page(char *pszParmValue
, char **ptr
);
522 static BOOL
handle_vfs_object(char *pszParmValue
, char **ptr
);
523 static BOOL
handle_source_env(char *pszParmValue
, char **ptr
);
524 static BOOL
handle_netbios_name(char *pszParmValue
, char **ptr
);
525 static BOOL
handle_winbind_id(char *pszParmValue
, char **ptr
);
526 static BOOL
handle_wins_server_list(char *pszParmValue
, char **ptr
);
528 static void set_server_role(void);
529 static void set_default_server_announce_type(void);
531 static struct enum_list enum_protocol
[] = {
532 {PROTOCOL_NT1
, "NT1"},
533 {PROTOCOL_LANMAN2
, "LANMAN2"},
534 {PROTOCOL_LANMAN1
, "LANMAN1"},
535 {PROTOCOL_CORE
, "CORE"},
536 {PROTOCOL_COREPLUS
, "COREPLUS"},
537 {PROTOCOL_COREPLUS
, "CORE+"},
541 static struct enum_list enum_security
[] = {
542 {SEC_SHARE
, "SHARE"},
544 {SEC_SERVER
, "SERVER"},
545 {SEC_DOMAIN
, "DOMAIN"},
549 static struct enum_list enum_printing
[] = {
550 {PRINT_SYSV
, "sysv"},
552 {PRINT_HPUX
, "hpux"},
556 {PRINT_LPRNG
, "lprng"},
557 {PRINT_SOFTQ
, "softq"},
558 {PRINT_CUPS
, "cups"},
560 {PRINT_LPROS2
, "os2"},
562 {PRINT_TEST
, "test"},
564 #endif /* DEVELOPER */
568 /* Types of machine we can announce as. */
569 #define ANNOUNCE_AS_NT_SERVER 1
570 #define ANNOUNCE_AS_WIN95 2
571 #define ANNOUNCE_AS_WFW 3
572 #define ANNOUNCE_AS_NT_WORKSTATION 4
574 static struct enum_list enum_announce_as
[] = {
575 {ANNOUNCE_AS_NT_SERVER
, "NT"},
576 {ANNOUNCE_AS_NT_SERVER
, "NT Server"},
577 {ANNOUNCE_AS_NT_WORKSTATION
, "NT Workstation"},
578 {ANNOUNCE_AS_WIN95
, "win95"},
579 {ANNOUNCE_AS_WFW
, "WfW"},
583 static struct enum_list enum_case
[] = {
584 {CASE_LOWER
, "lower"},
585 {CASE_UPPER
, "upper"},
589 static struct enum_list enum_bool_auto
[] = {
601 Do you want session setups at user level security with a invalid
602 password to be rejected or allowed in as guest? WinNT rejects them
603 but it can be a pain as it means "net view" needs to use a password
605 You have 3 choices in the setting of map_to_guest:
607 "Never" means session setups with an invalid password
608 are rejected. This is the default.
610 "Bad User" means session setups with an invalid password
611 are rejected, unless the username does not exist, in which case it
612 is treated as a guest login
614 "Bad Password" means session setups with an invalid password
615 are treated as a guest login
617 Note that map_to_guest only has an effect in user or server
621 static struct enum_list enum_map_to_guest
[] = {
622 {NEVER_MAP_TO_GUEST
, "Never"},
623 {MAP_TO_GUEST_ON_BAD_USER
, "Bad User"},
624 {MAP_TO_GUEST_ON_BAD_PASSWORD
, "Bad Password"},
629 static struct enum_list enum_ssl_version
[] = {
630 {SMB_SSL_V2
, "ssl2"},
631 {SMB_SSL_V3
, "ssl3"},
632 {SMB_SSL_V23
, "ssl2or3"},
633 {SMB_SSL_TLS1
, "tls1"},
638 /* note that we do not initialise the defaults union - it is not allowed in ANSI C */
639 static struct parm_struct parm_table
[] = {
640 {"Base Options", P_SEP
, P_SEPARATOR
},
642 {"coding system", P_STRING
, P_GLOBAL
, &Globals
.szCodingSystem
, handle_coding_system
, NULL
, 0},
643 {"client code page", P_INTEGER
, P_GLOBAL
, &Globals
.client_code_page
, handle_client_code_page
, NULL
, 0},
644 {"code page directory", P_STRING
, P_GLOBAL
, &Globals
.szCodePageDir
, NULL
, NULL
, 0},
645 {"comment", P_STRING
, P_LOCAL
, &sDefault
.comment
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
| FLAG_DOS_STRING
},
646 {"path", P_STRING
, P_LOCAL
, &sDefault
.szPath
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
| FLAG_DOS_STRING
},
647 {"directory", P_STRING
, P_LOCAL
, &sDefault
.szPath
, NULL
, NULL
, FLAG_DOS_STRING
},
648 {"workgroup", P_USTRING
, P_GLOBAL
, &Globals
.szWorkGroup
, NULL
, NULL
, FLAG_BASIC
| FLAG_DOS_STRING
},
649 {"netbios name", P_UGSTRING
, P_GLOBAL
, global_myname
, handle_netbios_name
, NULL
, FLAG_BASIC
| FLAG_DOS_STRING
},
650 {"netbios aliases", P_STRING
, P_GLOBAL
, &Globals
.szNetbiosAliases
, NULL
, NULL
, FLAG_DOS_STRING
},
651 {"netbios scope", P_UGSTRING
, P_GLOBAL
, global_scope
, NULL
, NULL
, FLAG_DOS_STRING
},
652 {"server string", P_STRING
, P_GLOBAL
, &Globals
.szServerString
, NULL
, NULL
, FLAG_BASIC
| FLAG_DOS_STRING
},
653 {"interfaces", P_STRING
, P_GLOBAL
, &Globals
.szInterfaces
, NULL
, NULL
, FLAG_BASIC
},
654 {"bind interfaces only", P_BOOL
, P_GLOBAL
, &Globals
.bBindInterfacesOnly
, NULL
, NULL
, 0},
656 {"Security Options", P_SEP
, P_SEPARATOR
},
658 {"security", P_ENUM
, P_GLOBAL
, &Globals
.security
, NULL
, enum_security
, FLAG_BASIC
},
659 {"encrypt passwords", P_BOOL
, P_GLOBAL
, &Globals
.bEncryptPasswords
, NULL
, NULL
, FLAG_BASIC
},
660 {"update encrypted", P_BOOL
, P_GLOBAL
, &Globals
.bUpdateEncrypt
, NULL
, NULL
, FLAG_BASIC
},
661 {"allow trusted domains", P_BOOL
, P_GLOBAL
, &Globals
.bAllowTrustedDomains
, NULL
, NULL
, 0},
662 {"alternate permissions", P_BOOL
, P_LOCAL
, &sDefault
.bAlternatePerm
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_DEPRECATED
},
663 {"hosts equiv", P_STRING
, P_GLOBAL
, &Globals
.szHostsEquiv
, NULL
, NULL
, 0},
664 {"min passwd length", P_INTEGER
, P_GLOBAL
, &Globals
.min_passwd_length
, NULL
, NULL
, 0},
665 {"min password length", P_INTEGER
, P_GLOBAL
, &Globals
.min_passwd_length
, NULL
, NULL
, 0},
666 {"map to guest", P_ENUM
, P_GLOBAL
, &Globals
.map_to_guest
, NULL
, enum_map_to_guest
, 0},
667 {"null passwords", P_BOOL
, P_GLOBAL
, &Globals
.bNullPasswords
, NULL
, NULL
, 0},
668 {"password server", P_STRING
, P_GLOBAL
, &Globals
.szPasswordServer
, NULL
, NULL
, 0},
669 {"smb passwd file", P_STRING
, P_GLOBAL
, &Globals
.szSMBPasswdFile
, NULL
, NULL
, 0},
670 {"private dir", P_STRING
, P_GLOBAL
, &Globals
.szPrivateDir
, NULL
, NULL
, 0},
671 {"passdb module path", P_STRING
, P_GLOBAL
, &Globals
.szPassdbModulePath
, NULL
, NULL
, 0},
672 {"root directory", P_STRING
, P_GLOBAL
, &Globals
.szRootdir
, NULL
, NULL
, 0},
673 {"root dir", P_STRING
, P_GLOBAL
, &Globals
.szRootdir
, NULL
, NULL
, 0},
674 {"root", P_STRING
, P_GLOBAL
, &Globals
.szRootdir
, NULL
, NULL
, 0},
676 {"passwd program", P_STRING
, P_GLOBAL
, &Globals
.szPasswdProgram
, NULL
, NULL
, 0},
677 {"passwd chat", P_STRING
, P_GLOBAL
, &Globals
.szPasswdChat
, NULL
, NULL
, 0},
678 {"passwd chat debug", P_BOOL
, P_GLOBAL
, &Globals
.bPasswdChatDebug
, NULL
, NULL
, 0},
679 {"username map", P_STRING
, P_GLOBAL
, &Globals
.szUsernameMap
, NULL
, NULL
, 0},
680 {"password level", P_INTEGER
, P_GLOBAL
, &Globals
.pwordlevel
, NULL
, NULL
, 0},
681 {"username level", P_INTEGER
, P_GLOBAL
, &Globals
.unamelevel
, NULL
, NULL
, 0},
682 {"unix password sync", P_BOOL
, P_GLOBAL
, &Globals
.bUnixPasswdSync
, NULL
, NULL
, 0},
683 {"restrict anonymous", P_BOOL
, P_GLOBAL
, &Globals
.bRestrictAnonymous
, NULL
, NULL
, 0},
684 {"use rhosts", P_BOOL
, P_GLOBAL
, &Globals
.bUseRhosts
, NULL
, NULL
, 0},
686 {"username", P_STRING
, P_LOCAL
, &sDefault
.szUsername
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
687 {"user", P_STRING
, P_LOCAL
, &sDefault
.szUsername
, NULL
, NULL
, 0},
688 {"users", P_STRING
, P_LOCAL
, &sDefault
.szUsername
, NULL
, NULL
, 0},
690 {"guest account", P_STRING
, P_LOCAL
, &sDefault
.szGuestaccount
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
| FLAG_GLOBAL
},
691 {"invalid users", P_STRING
, P_LOCAL
, &sDefault
.szInvalidUsers
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
692 {"valid users", P_STRING
, P_LOCAL
, &sDefault
.szValidUsers
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
693 {"admin users", P_STRING
, P_LOCAL
, &sDefault
.szAdminUsers
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
694 {"read list", P_STRING
, P_LOCAL
, &sDefault
.readlist
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
695 {"write list", P_STRING
, P_LOCAL
, &sDefault
.writelist
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
696 {"printer admin", P_STRING
, P_LOCAL
, &sDefault
.printer_admin
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
697 {"force user", P_STRING
, P_LOCAL
, &sDefault
.force_user
, NULL
, NULL
, FLAG_SHARE
},
698 {"force group", P_STRING
, P_LOCAL
, &sDefault
.force_group
, NULL
, NULL
, FLAG_SHARE
},
699 {"group", P_STRING
, P_LOCAL
, &sDefault
.force_group
, NULL
, NULL
, 0},
701 {"read only", P_BOOL
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
},
702 {"write ok", P_BOOLREV
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, 0},
703 {"writeable", P_BOOLREV
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, 0},
704 {"writable", P_BOOLREV
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, 0},
706 {"create mask", P_OCTAL
, P_LOCAL
, &sDefault
.iCreate_mask
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
707 {"create mode", P_OCTAL
, P_LOCAL
, &sDefault
.iCreate_mask
, NULL
, NULL
, FLAG_GLOBAL
},
708 {"force create mode", P_OCTAL
, P_LOCAL
, &sDefault
.iCreate_force_mode
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
709 {"security mask", P_OCTAL
, P_LOCAL
, &sDefault
.iSecurity_mask
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
710 {"force security mode", P_OCTAL
, P_LOCAL
, &sDefault
.iSecurity_force_mode
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
711 {"directory mask", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_mask
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
712 {"directory mode", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_mask
, NULL
, NULL
, FLAG_GLOBAL
},
713 {"force directory mode", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_force_mode
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
714 {"directory security mask", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_Security_mask
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
715 {"force directory security mode", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_Security_force_mode
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
716 {"inherit permissions", P_BOOL
, P_LOCAL
, &sDefault
.bInheritPerms
, NULL
, NULL
, FLAG_SHARE
},
717 {"guest only", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_only
, NULL
, NULL
, FLAG_SHARE
},
718 {"only guest", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_only
, NULL
, NULL
, 0},
720 {"guest ok", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_ok
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
721 {"public", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_ok
, NULL
, NULL
, 0},
723 {"only user", P_BOOL
, P_LOCAL
, &sDefault
.bOnlyUser
, NULL
, NULL
, FLAG_SHARE
},
724 {"hosts allow", P_STRING
, P_LOCAL
, &sDefault
.szHostsallow
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
725 {"allow hosts", P_STRING
, P_LOCAL
, &sDefault
.szHostsallow
, NULL
, NULL
, 0},
726 {"hosts deny", P_STRING
, P_LOCAL
, &sDefault
.szHostsdeny
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
727 {"deny hosts", P_STRING
, P_LOCAL
, &sDefault
.szHostsdeny
, NULL
, NULL
, 0},
730 {"Secure Socket Layer Options", P_SEP
, P_SEPARATOR
},
731 {"ssl", P_BOOL
, P_GLOBAL
, &Globals
.sslEnabled
, NULL
, NULL
, 0},
733 {"ssl hosts", P_STRING
, P_GLOBAL
, &Globals
.sslHostsRequire
, NULL
, NULL
, 0},
734 {"ssl hosts resign", P_STRING
, P_GLOBAL
, &Globals
.sslHostsResign
, NULL
, NULL
, 0},
735 {"ssl CA certDir", P_STRING
, P_GLOBAL
, &Globals
.sslCaCertDir
, NULL
, NULL
, 0},
736 {"ssl CA certFile", P_STRING
, P_GLOBAL
, &Globals
.sslCaCertFile
, NULL
, NULL
, 0},
737 {"ssl server cert", P_STRING
, P_GLOBAL
, &Globals
.sslCert
, NULL
, NULL
, 0},
738 {"ssl server key", P_STRING
, P_GLOBAL
, &Globals
.sslPrivKey
, NULL
, NULL
, 0},
739 {"ssl client cert", P_STRING
, P_GLOBAL
, &Globals
.sslClientCert
, NULL
, NULL
, 0},
740 {"ssl client key", P_STRING
, P_GLOBAL
, &Globals
.sslClientPrivKey
, NULL
, NULL
, 0},
741 {"ssl require clientcert", P_BOOL
, P_GLOBAL
, &Globals
.sslReqClientCert
, NULL
, NULL
, 0},
742 {"ssl require servercert", P_BOOL
, P_GLOBAL
, &Globals
.sslReqServerCert
, NULL
, NULL
, 0},
743 {"ssl ciphers", P_STRING
, P_GLOBAL
, &Globals
.sslCiphers
, NULL
, NULL
, 0},
744 {"ssl version", P_ENUM
, P_GLOBAL
, &Globals
.sslVersion
, NULL
, enum_ssl_version
, 0},
745 {"ssl compatibility", P_BOOL
, P_GLOBAL
, &Globals
.sslCompatibility
, NULL
, NULL
, 0},
746 #endif /* WITH_SSL */
748 {"Logging Options", P_SEP
, P_SEPARATOR
},
749 {"log level", P_INTEGER
, P_GLOBAL
, &DEBUGLEVEL
, NULL
, NULL
, FLAG_BASIC
},
750 {"debuglevel", P_INTEGER
, P_GLOBAL
, &DEBUGLEVEL
, NULL
, NULL
, 0},
751 {"syslog", P_INTEGER
, P_GLOBAL
, &Globals
.syslog
, NULL
, NULL
, 0},
752 {"syslog only", P_BOOL
, P_GLOBAL
, &Globals
.bSyslogOnly
, NULL
, NULL
, 0},
753 {"log file", P_STRING
, P_GLOBAL
, &Globals
.szLogFile
, NULL
, NULL
, 0},
755 {"max log size", P_INTEGER
, P_GLOBAL
, &Globals
.max_log_size
, NULL
, NULL
, 0},
756 {"timestamp logs", P_BOOL
, P_GLOBAL
, &Globals
.bTimestampLogs
, NULL
, NULL
, 0},
757 {"debug timestamp", P_BOOL
, P_GLOBAL
, &Globals
.bTimestampLogs
, NULL
, NULL
, 0},
758 {"debug hires timestamp", P_BOOL
, P_GLOBAL
, &Globals
.bDebugHiresTimestamp
, NULL
, NULL
, 0},
759 {"debug pid", P_BOOL
, P_GLOBAL
, &Globals
.bDebugPid
, NULL
, NULL
, 0},
760 {"debug uid", P_BOOL
, P_GLOBAL
, &Globals
.bDebugUid
, NULL
, NULL
, 0},
762 {"status", P_BOOL
, P_LOCAL
, &sDefault
.status
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
| FLAG_PRINT
},
764 {"Protocol Options", P_SEP
, P_SEPARATOR
},
766 {"protocol", P_ENUM
, P_GLOBAL
, &Globals
.maxprotocol
, NULL
, enum_protocol
, 0},
767 {"read bmpx", P_BOOL
, P_GLOBAL
, &Globals
.bReadbmpx
, NULL
, NULL
, 0},
768 {"read raw", P_BOOL
, P_GLOBAL
, &Globals
.bReadRaw
, NULL
, NULL
, 0},
769 {"write raw", P_BOOL
, P_GLOBAL
, &Globals
.bWriteRaw
, NULL
, NULL
, 0},
771 {"nt smb support", P_BOOL
, P_GLOBAL
, &Globals
.bNTSmbSupport
, NULL
, NULL
, 0},
772 {"nt pipe support", P_BOOL
, P_GLOBAL
, &Globals
.bNTPipeSupport
, NULL
, NULL
, 0},
773 {"nt acl support", P_BOOL
, P_GLOBAL
, &Globals
.bNTAclSupport
, NULL
, NULL
, 0},
774 {"announce version", P_STRING
, P_GLOBAL
, &Globals
.szAnnounceVersion
, NULL
, NULL
, 0},
775 {"announce as", P_ENUM
, P_GLOBAL
, &Globals
.announce_as
, NULL
, enum_announce_as
, 0},
776 {"max mux", P_INTEGER
, P_GLOBAL
, &Globals
.max_mux
, NULL
, NULL
, 0},
777 {"max xmit", P_INTEGER
, P_GLOBAL
, &Globals
.max_xmit
, NULL
, NULL
, 0},
779 {"name resolve order", P_STRING
, P_GLOBAL
, &Globals
.szNameResolveOrder
, NULL
, NULL
, 0},
780 {"max packet", P_INTEGER
, P_GLOBAL
, &Globals
.max_packet
, NULL
, NULL
, 0},
781 {"packet size", P_INTEGER
, P_GLOBAL
, &Globals
.max_packet
, NULL
, NULL
, 0},
782 {"max ttl", P_INTEGER
, P_GLOBAL
, &Globals
.max_ttl
, NULL
, NULL
, 0},
783 {"max wins ttl", P_INTEGER
, P_GLOBAL
, &Globals
.max_wins_ttl
, NULL
, NULL
, 0},
784 {"min wins ttl", P_INTEGER
, P_GLOBAL
, &Globals
.min_wins_ttl
, NULL
, NULL
, 0},
785 {"time server", P_BOOL
, P_GLOBAL
, &Globals
.bTimeServer
, NULL
, NULL
, 0},
787 {"Tuning Options", P_SEP
, P_SEPARATOR
},
789 {"change notify timeout", P_INTEGER
, P_GLOBAL
, &Globals
.change_notify_timeout
, NULL
, NULL
, 0},
790 {"deadtime", P_INTEGER
, P_GLOBAL
, &Globals
.deadtime
, NULL
, NULL
, 0},
791 {"getwd cache", P_BOOL
, P_GLOBAL
, &use_getwd_cache
, NULL
, NULL
, 0},
792 {"keepalive", P_INTEGER
, P_GLOBAL
, &keepalive
, NULL
, NULL
, 0},
794 {"lpq cache time", P_INTEGER
, P_GLOBAL
, &Globals
.lpqcachetime
, NULL
, NULL
, 0},
795 {"max connections", P_INTEGER
, P_LOCAL
, &sDefault
.iMaxConnections
, NULL
, NULL
, FLAG_SHARE
},
796 {"max disk size", P_INTEGER
, P_GLOBAL
, &Globals
.maxdisksize
, NULL
, NULL
, 0},
797 {"max open files", P_INTEGER
, P_GLOBAL
, &Globals
.max_open_files
, NULL
, NULL
, 0},
798 {"min print space", P_INTEGER
, P_LOCAL
, &sDefault
.iMinPrintSpace
, NULL
, NULL
, FLAG_PRINT
},
799 {"read size", P_INTEGER
, P_GLOBAL
, &Globals
.ReadSize
, NULL
, NULL
, 0},
801 {"socket options", P_GSTRING
, P_GLOBAL
, user_socket_options
, NULL
, NULL
, 0},
802 {"stat cache size", P_INTEGER
, P_GLOBAL
, &Globals
.stat_cache_size
, NULL
, NULL
, 0},
803 {"strict sync", P_BOOL
, P_LOCAL
, &sDefault
.bStrictSync
, NULL
, NULL
, FLAG_SHARE
},
804 {"sync always", P_BOOL
, P_LOCAL
, &sDefault
.bSyncAlways
, NULL
, NULL
, FLAG_SHARE
},
805 {"write cache size", P_INTEGER
, P_LOCAL
, &sDefault
.iWriteCacheSize
, NULL
, NULL
, FLAG_SHARE
},
807 {"Printing Options", P_SEP
, P_SEPARATOR
},
809 {"max print jobs", P_INTEGER
, P_LOCAL
, &sDefault
.iMaxPrintJobs
, NULL
, NULL
, FLAG_PRINT
},
810 {"load printers", P_BOOL
, P_GLOBAL
, &Globals
.bLoadPrinters
, NULL
, NULL
, FLAG_PRINT
},
811 {"printcap name", P_STRING
, P_GLOBAL
, &Globals
.szPrintcapname
, NULL
, NULL
, FLAG_PRINT
},
812 {"printcap", P_STRING
, P_GLOBAL
, &Globals
.szPrintcapname
, NULL
, NULL
, 0},
813 {"printable", P_BOOL
, P_LOCAL
, &sDefault
.bPrint_ok
, NULL
, NULL
, FLAG_PRINT
},
814 {"print ok", P_BOOL
, P_LOCAL
, &sDefault
.bPrint_ok
, NULL
, NULL
, 0},
815 {"postscript", P_BOOL
, P_LOCAL
, &sDefault
.bPostscript
, NULL
, NULL
, FLAG_PRINT
},
816 {"printing", P_ENUM
, P_LOCAL
, &sDefault
.iPrinting
, NULL
, enum_printing
, FLAG_PRINT
| FLAG_GLOBAL
},
817 {"print command", P_STRING
, P_LOCAL
, &sDefault
.szPrintcommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
818 {"lpq command", P_STRING
, P_LOCAL
, &sDefault
.szLpqcommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
819 {"lprm command", P_STRING
, P_LOCAL
, &sDefault
.szLprmcommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
820 {"lppause command", P_STRING
, P_LOCAL
, &sDefault
.szLppausecommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
821 {"lpresume command", P_STRING
, P_LOCAL
, &sDefault
.szLpresumecommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
822 {"queuepause command", P_STRING
, P_LOCAL
, &sDefault
.szQueuepausecommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
823 {"queueresume command", P_STRING
, P_LOCAL
, &sDefault
.szQueueresumecommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
825 {"enumports command", P_STRING
, P_GLOBAL
, &Globals
.szEnumPortsCommand
, NULL
, NULL
, 0},
826 {"addprinter command", P_STRING
, P_GLOBAL
, &Globals
.szAddPrinterCommand
, NULL
, NULL
, 0},
827 {"deleteprinter command", P_STRING
, P_GLOBAL
, &Globals
.szDeletePrinterCommand
, NULL
, NULL
, 0},
828 {"show add printer wizard", P_BOOL
, P_GLOBAL
, &Globals
.bMsAddPrinterWizard
, NULL
, NULL
, 0},
830 {"printer name", P_STRING
, P_LOCAL
, &sDefault
.szPrintername
, NULL
, NULL
, FLAG_PRINT
},
831 {"printer", P_STRING
, P_LOCAL
, &sDefault
.szPrintername
, NULL
, NULL
, 0},
832 {"printer driver", P_STRING
, P_LOCAL
, &sDefault
.szPrinterDriver
, NULL
, NULL
, FLAG_PRINT
},
833 {"printer driver file", P_STRING
, P_LOCAL
, &sDefault
.szDriverFile
, NULL
, NULL
, FLAG_PRINT
},
834 {"printer driver location", P_STRING
, P_LOCAL
, &sDefault
.szPrinterDriverLocation
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
836 {"Filename Handling", P_SEP
, P_SEPARATOR
},
837 {"strip dot", P_BOOL
, P_GLOBAL
, &Globals
.bStripDot
, NULL
, NULL
, 0},
839 {"character set", P_STRING
, P_GLOBAL
, &Globals
.szCharacterSet
, handle_character_set
, NULL
, 0},
840 {"mangled stack", P_INTEGER
, P_GLOBAL
, &Globals
.mangled_stack
, NULL
, NULL
, 0},
841 {"default case", P_ENUM
, P_LOCAL
, &sDefault
.iDefaultCase
, NULL
, enum_case
, FLAG_SHARE
},
842 {"case sensitive", P_BOOL
, P_LOCAL
, &sDefault
.bCaseSensitive
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
843 {"casesignames", P_BOOL
, P_LOCAL
, &sDefault
.bCaseSensitive
, NULL
, NULL
, 0},
844 {"preserve case", P_BOOL
, P_LOCAL
, &sDefault
.bCasePreserve
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
845 {"short preserve case", P_BOOL
, P_LOCAL
, &sDefault
.bShortCasePreserve
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
846 {"mangle case", P_BOOL
, P_LOCAL
, &sDefault
.bCaseMangle
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
847 {"mangling char", P_CHAR
, P_LOCAL
, &sDefault
.magic_char
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
848 {"hide dot files", P_BOOL
, P_LOCAL
, &sDefault
.bHideDotFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
849 {"delete veto files", P_BOOL
, P_LOCAL
, &sDefault
.bDeleteVetoFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
850 {"veto files", P_STRING
, P_LOCAL
, &sDefault
.szVetoFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DOS_STRING
},
851 {"hide files", P_STRING
, P_LOCAL
, &sDefault
.szHideFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DOS_STRING
},
852 {"veto oplock files", P_STRING
, P_LOCAL
, &sDefault
.szVetoOplockFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DOS_STRING
},
853 {"map system", P_BOOL
, P_LOCAL
, &sDefault
.bMap_system
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
854 {"map hidden", P_BOOL
, P_LOCAL
, &sDefault
.bMap_hidden
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
855 {"map archive", P_BOOL
, P_LOCAL
, &sDefault
.bMap_archive
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
856 {"mangled names", P_BOOL
, P_LOCAL
, &sDefault
.bMangledNames
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
857 {"mangled map", P_STRING
, P_LOCAL
, &sDefault
.szMangledMap
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
858 {"stat cache", P_BOOL
, P_GLOBAL
, &Globals
.bStatCache
, NULL
, NULL
, 0},
860 {"Domain Options", P_SEP
, P_SEPARATOR
},
862 {"domain groups", P_STRING
, P_GLOBAL
, &Globals
.szDomainGroups
, NULL
, NULL
, 0},
863 {"domain admin group", P_STRING
, P_GLOBAL
, &Globals
.szDomainAdminGroup
, NULL
, NULL
, 0},
864 {"domain guest group", P_STRING
, P_GLOBAL
, &Globals
.szDomainGuestGroup
, NULL
, NULL
, 0},
865 {"domain admin users", P_STRING
, P_GLOBAL
, &Globals
.szDomainAdminUsers
, NULL
, NULL
, 0},
866 {"domain guest users", P_STRING
, P_GLOBAL
, &Globals
.szDomainGuestUsers
, NULL
, NULL
, 0},
867 #ifdef USING_GROUPNAME_MAP
869 {"groupname map", P_STRING
, P_GLOBAL
, &Globals
.szGroupnameMap
, NULL
, NULL
, 0},
870 #endif /* USING_GROUPNAME_MAP */
872 {"machine password timeout", P_INTEGER
, P_GLOBAL
, &Globals
.machine_password_timeout
, NULL
, NULL
, 0},
874 {"Logon Options", P_SEP
, P_SEPARATOR
},
876 {"add user script", P_STRING
, P_GLOBAL
, &Globals
.szAddUserScript
, NULL
, NULL
, 0},
877 {"delete user script", P_STRING
, P_GLOBAL
, &Globals
.szDelUserScript
, NULL
, NULL
, 0},
878 {"logon script", P_STRING
, P_GLOBAL
, &Globals
.szLogonScript
, NULL
, NULL
, FLAG_DOS_STRING
},
879 {"logon path", P_STRING
, P_GLOBAL
, &Globals
.szLogonPath
, NULL
, NULL
, FLAG_DOS_STRING
},
880 {"logon drive", P_STRING
, P_GLOBAL
, &Globals
.szLogonDrive
, NULL
, NULL
, 0},
881 {"logon home", P_STRING
, P_GLOBAL
, &Globals
.szLogonHome
, NULL
, NULL
, FLAG_DOS_STRING
},
882 {"domain logons", P_BOOL
, P_GLOBAL
, &Globals
.bDomainLogons
, NULL
, NULL
, 0},
884 {"Browse Options", P_SEP
, P_SEPARATOR
},
886 {"os level", P_INTEGER
, P_GLOBAL
, &Globals
.os_level
, NULL
, NULL
, FLAG_BASIC
},
887 {"lm announce", P_ENUM
, P_GLOBAL
, &Globals
.lm_announce
, NULL
, enum_bool_auto
, 0},
888 {"lm interval", P_INTEGER
, P_GLOBAL
, &Globals
.lm_interval
, NULL
, NULL
, 0},
889 {"preferred master", P_ENUM
, P_GLOBAL
, &Globals
.bPreferredMaster
, NULL
, enum_bool_auto
, FLAG_BASIC
},
890 {"prefered master", P_ENUM
, P_GLOBAL
, &Globals
.bPreferredMaster
, NULL
, enum_bool_auto
, FLAG_HIDE
},
891 {"local master", P_BOOL
, P_GLOBAL
, &Globals
.bLocalMaster
, NULL
, NULL
, FLAG_BASIC
},
892 {"domain master", P_ENUM
, P_GLOBAL
, &Globals
.bDomainMaster
, NULL
, enum_bool_auto
, FLAG_BASIC
},
893 {"browse list", P_BOOL
, P_GLOBAL
, &Globals
.bBrowseList
, NULL
, NULL
, 0},
894 {"browseable", P_BOOL
, P_LOCAL
, &sDefault
.bBrowseable
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
895 {"browsable", P_BOOL
, P_LOCAL
, &sDefault
.bBrowseable
, NULL
, NULL
, 0},
897 {"WINS Options", P_SEP
, P_SEPARATOR
},
898 {"dns proxy", P_BOOL
, P_GLOBAL
, &Globals
.bDNSproxy
, NULL
, NULL
, 0},
899 {"wins proxy", P_BOOL
, P_GLOBAL
, &Globals
.bWINSproxy
, NULL
, NULL
, 0},
901 {"wins server", P_STRING
, P_GLOBAL
, &Globals
.szWINSserver
, handle_wins_server_list
, NULL
, FLAG_BASIC
},
902 {"wins support", P_BOOL
, P_GLOBAL
, &Globals
.bWINSsupport
, NULL
, NULL
, FLAG_BASIC
},
903 {"wins hook", P_STRING
, P_GLOBAL
, &Globals
.szWINSHook
, NULL
, NULL
, 0},
905 {"Locking Options", P_SEP
, P_SEPARATOR
},
907 {"blocking locks", P_BOOL
, P_LOCAL
, &sDefault
.bBlockingLocks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
908 {"fake oplocks", P_BOOL
, P_LOCAL
, &sDefault
.bFakeOplocks
, NULL
, NULL
, FLAG_SHARE
},
909 {"kernel oplocks", P_BOOL
, P_GLOBAL
, &Globals
.bKernelOplocks
, NULL
, NULL
, FLAG_GLOBAL
},
910 {"locking", P_BOOL
, P_LOCAL
, &sDefault
.bLocking
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
912 {"utmp", P_BOOL
, P_LOCAL
, &sDefault
.bUtmp
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
915 {"oplocks", P_BOOL
, P_LOCAL
, &sDefault
.bOpLocks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
916 {"level2 oplocks", P_BOOL
, P_LOCAL
, &sDefault
.bLevel2OpLocks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
917 {"oplock break wait time", P_INTEGER
, P_GLOBAL
, &Globals
.oplock_break_wait_time
, NULL
, NULL
, FLAG_GLOBAL
},
918 {"oplock contention limit", P_INTEGER
, P_LOCAL
, &sDefault
.iOplockContentionLimit
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
919 {"posix locking", P_BOOL
, P_LOCAL
, &sDefault
.bPosixLocking
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
920 {"strict locking", P_BOOL
, P_LOCAL
, &sDefault
.bStrictLocking
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
921 {"share modes", P_BOOL
, P_LOCAL
, &sDefault
.bShareModes
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
924 {"Ldap Options", P_SEP
, P_SEPARATOR
},
926 {"ldap server", P_STRING
, P_GLOBAL
, &Globals
.szLdapServer
, NULL
, NULL
, 0},
927 {"ldap port", P_INTEGER
, P_GLOBAL
, &Globals
.ldap_port
, NULL
, NULL
, 0},
928 {"ldap suffix", P_STRING
, P_GLOBAL
, &Globals
.szLdapSuffix
, NULL
, NULL
, 0},
929 {"ldap filter", P_STRING
, P_GLOBAL
, &Globals
.szLdapFilter
, NULL
, NULL
, 0},
930 {"ldap root", P_STRING
, P_GLOBAL
, &Globals
.szLdapRoot
, NULL
, NULL
, 0},
931 {"ldap root passwd", P_STRING
, P_GLOBAL
, &Globals
.szLdapRootPassword
, NULL
, NULL
, 0},
932 #endif /* WITH_LDAP */
934 {"Miscellaneous Options", P_SEP
, P_SEPARATOR
},
935 {"smbrun", P_STRING
, P_GLOBAL
, &Globals
.szSmbrun
, NULL
, NULL
, 0},
937 {"config file", P_STRING
, P_GLOBAL
, &Globals
.szConfigFile
, NULL
, NULL
, FLAG_HIDE
},
938 {"preload", P_STRING
, P_GLOBAL
, &Globals
.szAutoServices
, NULL
, NULL
, 0},
939 {"auto services", P_STRING
, P_GLOBAL
, &Globals
.szAutoServices
, NULL
, NULL
, 0},
940 {"lock dir", P_STRING
, P_GLOBAL
, &Globals
.szLockDir
, NULL
, NULL
, 0},
941 {"lock directory", P_STRING
, P_GLOBAL
, &Globals
.szLockDir
, NULL
, NULL
, 0},
943 {"utmp dir", P_STRING
, P_GLOBAL
, &Globals
.szUtmpDir
, NULL
, NULL
, 0},
944 {"utmp directory", P_STRING
, P_GLOBAL
, &Globals
.szUtmpDir
, NULL
, NULL
, 0},
945 {"wtmp dir", P_STRING
, P_GLOBAL
, &Globals
.szWtmpDir
, NULL
, NULL
, 0},
946 {"wtmp directory", P_STRING
, P_GLOBAL
, &Globals
.szWtmpDir
, NULL
, NULL
, 0},
947 {"utmp hostname", P_STRING
, P_GLOBAL
, &Globals
.szUtmpHostname
, NULL
, NULL
, 0},
948 {"utmp consolidate", P_BOOL
, P_GLOBAL
, &Globals
.bUtmpConsolidate
, NULL
, NULL
, 0},
949 #endif /* WITH_UTMP */
951 {"default service", P_STRING
, P_GLOBAL
,
952 &Globals
.szDefaultService
, NULL
, NULL
, 0},
953 {"default", P_STRING
, P_GLOBAL
, &Globals
.szDefaultService
, NULL
, NULL
, 0},
954 {"message command", P_STRING
, P_GLOBAL
, &Globals
.szMsgCommand
, NULL
, NULL
, 0},
955 {"dfree command", P_STRING
, P_GLOBAL
, &Globals
.szDfree
, NULL
, NULL
, 0},
956 {"valid chars", P_STRING
, P_GLOBAL
, &Globals
.szValidChars
, handle_valid_chars
, NULL
, 0},
957 {"remote announce", P_STRING
, P_GLOBAL
, &Globals
.szRemoteAnnounce
, NULL
, NULL
, 0},
958 {"remote browse sync", P_STRING
, P_GLOBAL
, &Globals
.szRemoteBrowseSync
, NULL
, NULL
, 0},
959 {"socket address", P_STRING
, P_GLOBAL
, &Globals
.szSocketAddress
, NULL
, NULL
, 0},
960 {"homedir map", P_STRING
, P_GLOBAL
, &Globals
.szNISHomeMapName
, NULL
, NULL
, 0},
961 {"time offset", P_INTEGER
, P_GLOBAL
, &extra_time_offset
, NULL
, NULL
, 0},
962 {"unix realname", P_BOOL
, P_GLOBAL
, &Globals
.bUnixRealname
, NULL
, NULL
, 0},
963 {"NIS homedir", P_BOOL
, P_GLOBAL
, &Globals
.bNISHomeMap
, NULL
, NULL
, 0},
964 {"-valid", P_BOOL
, P_LOCAL
, &sDefault
.valid
, NULL
, NULL
, FLAG_HIDE
},
966 {"copy", P_STRING
, P_LOCAL
, &sDefault
.szCopy
, handle_copy
, NULL
, FLAG_HIDE
},
967 {"include", P_STRING
, P_LOCAL
, &sDefault
.szInclude
, handle_include
, NULL
, FLAG_HIDE
},
968 {"exec", P_STRING
, P_LOCAL
, &sDefault
.szPreExec
, NULL
, NULL
, FLAG_SHARE
| FLAG_PRINT
},
969 {"preexec", P_STRING
, P_LOCAL
, &sDefault
.szPreExec
, NULL
, NULL
, 0},
971 {"preexec close", P_BOOL
, P_LOCAL
, &sDefault
.bPreexecClose
, NULL
, NULL
, FLAG_SHARE
},
972 {"postexec", P_STRING
, P_LOCAL
, &sDefault
.szPostExec
, NULL
, NULL
, FLAG_SHARE
| FLAG_PRINT
},
973 {"root preexec", P_STRING
, P_LOCAL
, &sDefault
.szRootPreExec
, NULL
, NULL
, FLAG_SHARE
| FLAG_PRINT
},
974 {"root preexec close", P_BOOL
, P_LOCAL
, &sDefault
.bRootpreexecClose
, NULL
, NULL
, FLAG_SHARE
},
975 {"root postexec", P_STRING
, P_LOCAL
, &sDefault
.szRootPostExec
, NULL
, NULL
, FLAG_SHARE
| FLAG_PRINT
},
976 {"available", P_BOOL
, P_LOCAL
, &sDefault
.bAvailable
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
977 {"volume", P_STRING
, P_LOCAL
, &sDefault
.volume
, NULL
, NULL
, FLAG_SHARE
},
978 {"fstype", P_STRING
, P_LOCAL
, &sDefault
.fstype
, NULL
, NULL
, FLAG_SHARE
},
979 {"set directory", P_BOOLREV
, P_LOCAL
, &sDefault
.bNo_set_dir
, NULL
, NULL
, FLAG_SHARE
},
980 {"source environment", P_STRING
, P_GLOBAL
, &Globals
.szSourceEnv
, handle_source_env
, NULL
, 0},
981 {"wide links", P_BOOL
, P_LOCAL
, &sDefault
.bWidelinks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
982 {"follow symlinks", P_BOOL
, P_LOCAL
, &sDefault
.bSymlinks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
983 {"dont descend", P_STRING
, P_LOCAL
, &sDefault
.szDontdescend
, NULL
, NULL
, FLAG_SHARE
},
984 {"magic script", P_STRING
, P_LOCAL
, &sDefault
.szMagicScript
, NULL
, NULL
, FLAG_SHARE
},
985 {"magic output", P_STRING
, P_LOCAL
, &sDefault
.szMagicOutput
, NULL
, NULL
, FLAG_SHARE
},
986 {"delete readonly", P_BOOL
, P_LOCAL
, &sDefault
.bDeleteReadonly
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
987 {"dos filetimes", P_BOOL
, P_LOCAL
, &sDefault
.bDosFiletimes
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
988 {"dos filetime resolution", P_BOOL
, P_LOCAL
, &sDefault
.bDosFiletimeResolution
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
990 {"fake directory create times", P_BOOL
, P_LOCAL
, &sDefault
.bFakeDirCreateTimes
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
991 {"panic action", P_STRING
, P_GLOBAL
, &Globals
.szPanicAction
, NULL
, NULL
, 0},
993 {"VFS options", P_SEP
, P_SEPARATOR
},
995 {"vfs object", P_STRING
, P_LOCAL
, &sDefault
.szVfsObjectFile
, handle_vfs_object
, NULL
, 0},
996 {"vfs options", P_STRING
, P_LOCAL
, &sDefault
.szVfsOptions
, NULL
, NULL
, 0},
999 {"msdfs root", P_BOOL
, P_LOCAL
, &sDefault
.bMSDfsRoot
, NULL
, NULL
, FLAG_SHARE
},
1000 {"host msdfs", P_BOOL
, P_GLOBAL
, &Globals
.bHostMSDfs
, NULL
, NULL
, FLAG_GLOBAL
},
1002 {"Winbind options", P_SEP
, P_SEPARATOR
},
1004 {"winbind uid", P_STRING
, P_GLOBAL
, &Globals
.szWinbindUID
, handle_winbind_id
, NULL
, 0},
1005 {"winbind gid", P_STRING
, P_GLOBAL
, &Globals
.szWinbindGID
, handle_winbind_id
, NULL
, 0},
1006 {"template homedir", P_STRING
, P_GLOBAL
, &Globals
.szTemplateHomedir
, NULL
, NULL
, 0},
1007 {"template shell", P_STRING
, P_GLOBAL
, &Globals
.szTemplateShell
, NULL
, NULL
, 0},
1008 {"winbind separator", P_STRING
, P_GLOBAL
, &Globals
.szWinbindSeparator
, NULL
, NULL
, 0},
1009 {"winbind cache time", P_INTEGER
, P_GLOBAL
, &Globals
.winbind_cache_time
, NULL
, NULL
, 0},
1011 {NULL
, P_BOOL
, P_NONE
, NULL
, NULL
, NULL
, 0}
1015 /***************************************************************************
1016 Initialise the sDefault parameter structure for the printer values.
1017 ***************************************************************************/
1018 static void init_printer_values(void)
1020 string_set(&sDefault
.szPrinterDriver
, "");
1021 string_set(&sDefault
.szDriverFile
, DRIVERFILE
);
1023 /* choose defaults depending on the type of printing */
1024 switch (sDefault
.iPrinting
)
1030 string_set(&sDefault
.szLpqcommand
, "lpq -P%p");
1031 string_set(&sDefault
.szLprmcommand
, "lprm -P%p %j");
1032 string_set(&sDefault
.szPrintcommand
,
1038 string_set(&sDefault
.szLpqcommand
, "lpq -P%p");
1039 string_set(&sDefault
.szLprmcommand
, "lprm -P%p %j");
1040 string_set(&sDefault
.szPrintcommand
,
1042 string_set(&sDefault
.szQueuepausecommand
,
1044 string_set(&sDefault
.szQueueresumecommand
,
1046 string_set(&sDefault
.szLppausecommand
,
1048 string_set(&sDefault
.szLpresumecommand
,
1049 "lpc release %p %j");
1053 string_set(&sDefault
.szLpqcommand
,
1054 "/usr/bin/lpstat -o%p");
1055 string_set(&sDefault
.szLprmcommand
,
1056 "/usr/bin/cancel %p-%j");
1057 string_set(&sDefault
.szPrintcommand
,
1058 "/usr/bin/lp -d%p -oraw %s; rm %s");
1059 string_set(&sDefault
.szQueuepausecommand
,
1060 "/usr/bin/disable %p");
1061 string_set(&sDefault
.szQueueresumecommand
,
1062 "/usr/bin/enable %p");
1067 string_set(&sDefault
.szLpqcommand
, "lpstat -o%p");
1068 string_set(&sDefault
.szLprmcommand
, "cancel %p-%j");
1069 string_set(&sDefault
.szPrintcommand
,
1070 "lp -c -d%p %s; rm %s");
1071 string_set(&sDefault
.szQueuepausecommand
,
1073 string_set(&sDefault
.szQueueresumecommand
,
1076 string_set(&sDefault
.szLppausecommand
,
1077 "lp -i %p-%j -H hold");
1078 string_set(&sDefault
.szLpresumecommand
,
1079 "lp -i %p-%j -H resume");
1084 string_set(&sDefault
.szLpqcommand
, "lpq -P%p");
1085 string_set(&sDefault
.szLprmcommand
, "lprm -P%p %j");
1086 string_set(&sDefault
.szPrintcommand
, "lp -r -P%p %s");
1090 string_set(&sDefault
.szLpqcommand
, "qstat -l -d%p");
1091 string_set(&sDefault
.szLprmcommand
,
1092 "qstat -s -j%j -c");
1093 string_set(&sDefault
.szPrintcommand
,
1094 "lp -d%p -s %s; rm %s");
1095 string_set(&sDefault
.szLppausecommand
,
1096 "qstat -s -j%j -h");
1097 string_set(&sDefault
.szLpresumecommand
,
1098 "qstat -s -j%j -r");
1103 string_set(&sDefault
.szPrintcommand
, "vlp print %p %s");
1104 string_set(&sDefault
.szLpqcommand
, "vlp lpq %p");
1105 string_set(&sDefault
.szLprmcommand
, "vlp lprm %p %j");
1106 string_set(&sDefault
.szLppausecommand
, "vlp lppause %p %j");
1107 string_set(&sDefault
.szLpresumecommand
, "vlp lpresum %p %j");
1108 string_set(&sDefault
.szQueuepausecommand
, "vlp queuepause %p");
1109 string_set(&sDefault
.szQueueresumecommand
, "vlp queueresume %p");
1111 #endif /* DEVELOPER */
1116 /***************************************************************************
1117 Initialise the global parameter structure.
1118 ***************************************************************************/
1119 static void init_globals(void)
1121 static BOOL done_init
= False
;
1127 memset((void *)&Globals
, '\0', sizeof(Globals
));
1129 for (i
= 0; parm_table
[i
].label
; i
++)
1130 if ((parm_table
[i
].type
== P_STRING
||
1131 parm_table
[i
].type
== P_USTRING
) &&
1133 string_set(parm_table
[i
].ptr
, "");
1135 string_set(&sDefault
.szGuestaccount
, GUEST_ACCOUNT
);
1136 string_set(&sDefault
.fstype
, FSTYPE_STRING
);
1138 init_printer_values();
1144 DEBUG(3, ("Initialising global parameters\n"));
1146 string_set(&Globals
.szSMBPasswdFile
, SMB_PASSWD_FILE
);
1147 string_set(&Globals
.szPrivateDir
, PRIVATE_DIR
);
1148 string_set(&Globals
.szPassdbModulePath
, "");
1151 * Allow the default PASSWD_CHAT to be overridden in local.h.
1153 string_set(&Globals
.szPasswdChat
, DEFAULT_PASSWD_CHAT
);
1154 string_set(&Globals
.szWorkGroup
, WORKGROUP
);
1155 string_set(&Globals
.szPasswdProgram
, PASSWD_PROGRAM
);
1156 string_set(&Globals
.szPrintcapname
, PRINTCAP_NAME
);
1157 string_set(&Globals
.szLockDir
, LOCKDIR
);
1159 string_set(&Globals
.szUtmpDir
, "");
1160 string_set(&Globals
.szWtmpDir
, "");
1161 string_set(&Globals
.szUtmpHostname
, "%m");
1162 Globals
.bUtmpConsolidate
= False
;
1163 #endif /* WITH_UTMP */
1164 string_set(&Globals
.szSmbrun
, SMBRUN
);
1165 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
1166 pstrcpy(s
, "Samba ");
1167 pstrcat(s
, VERSION
);
1168 string_set(&Globals
.szServerString
, s
);
1169 slprintf(s
, sizeof(s
) - 1, "%d.%d", DEFAULT_MAJOR_VERSION
,
1170 DEFAULT_MINOR_VERSION
);
1171 string_set(&Globals
.szAnnounceVersion
, s
);
1173 pstrcpy(user_socket_options
, DEFAULT_SOCKET_OPTIONS
);
1175 string_set(&Globals
.szLogonDrive
, "");
1176 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
1177 string_set(&Globals
.szLogonHome
, "\\\\%N\\%U");
1178 string_set(&Globals
.szLogonPath
, "\\\\%N\\%U\\profile");
1180 string_set(&Globals
.szNameResolveOrder
, "lmhosts host wins bcast");
1181 string_set(&Globals
.szCodePageDir
, CODEPAGEDIR
);
1183 Globals
.bLoadPrinters
= True
;
1184 Globals
.bUseRhosts
= False
;
1185 Globals
.max_packet
= 65535;
1186 Globals
.mangled_stack
= 50;
1187 Globals
.max_xmit
= 65535;
1188 Globals
.max_mux
= 50; /* This is *needed* for profile support. */
1189 Globals
.lpqcachetime
= 10;
1190 Globals
.pwordlevel
= 0;
1191 Globals
.unamelevel
= 0;
1192 Globals
.deadtime
= 0;
1193 Globals
.max_log_size
= 5000;
1194 Globals
.max_open_files
= MAX_OPEN_FILES
;
1195 Globals
.maxprotocol
= PROTOCOL_NT1
;
1196 Globals
.security
= SEC_USER
;
1197 Globals
.bEncryptPasswords
= False
;
1198 Globals
.bUpdateEncrypt
= False
;
1199 Globals
.bReadRaw
= True
;
1200 Globals
.bWriteRaw
= True
;
1201 Globals
.bReadPrediction
= False
;
1202 Globals
.bReadbmpx
= False
;
1203 Globals
.bNullPasswords
= False
;
1204 Globals
.bStripDot
= False
;
1206 Globals
.bSyslogOnly
= False
;
1207 Globals
.bTimestampLogs
= True
;
1208 Globals
.bDebugHiresTimestamp
= False
;
1209 Globals
.bDebugPid
= False
;
1210 Globals
.bDebugUid
= False
;
1211 Globals
.max_ttl
= 60 * 60 * 24 * 3; /* 3 days default. */
1212 Globals
.max_wins_ttl
= 60 * 60 * 24 * 6; /* 6 days default. */
1213 Globals
.min_wins_ttl
= 60 * 60 * 6; /* 6 hours default. */
1214 Globals
.machine_password_timeout
= 60 * 60 * 24 * 7; /* 7 days default. */
1215 Globals
.change_notify_timeout
= 60; /* 1 minute default. */
1216 Globals
.ReadSize
= 16 * 1024;
1217 Globals
.lm_announce
= 2; /* = Auto: send only if LM clients found */
1218 Globals
.lm_interval
= 60;
1219 Globals
.stat_cache_size
= 50; /* Number of stat translations we'll keep */
1220 Globals
.announce_as
= ANNOUNCE_AS_NT_SERVER
;
1221 Globals
.bUnixRealname
= True
;
1222 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
1223 Globals
.bNISHomeMap
= False
;
1224 #ifdef WITH_NISPLUS_HOME
1225 string_set(&Globals
.szNISHomeMapName
, "auto_home.org_dir");
1227 string_set(&Globals
.szNISHomeMapName
, "auto.home");
1230 Globals
.client_code_page
= DEFAULT_CLIENT_CODE_PAGE
;
1231 Globals
.bTimeServer
= False
;
1232 Globals
.bBindInterfacesOnly
= False
;
1233 Globals
.bUnixPasswdSync
= False
;
1234 Globals
.bPasswdChatDebug
= False
;
1235 Globals
.bNTSmbSupport
= True
; /* Do NT SMB's by default. */
1236 Globals
.bNTPipeSupport
= True
; /* Do NT pipes by default. */
1237 Globals
.bNTAclSupport
= True
; /* Use NT ACLs by default. */
1238 Globals
.bStatCache
= True
; /* use stat cache by default */
1239 Globals
.bRestrictAnonymous
= False
;
1240 Globals
.map_to_guest
= 0; /* By Default, "Never" */
1241 Globals
.min_passwd_length
= MINPASSWDLENGTH
; /* By Default, 5. */
1242 Globals
.oplock_break_wait_time
= 10; /* By Default, 10 msecs. */
1245 /* default values for ldap */
1246 string_set(&Globals
.szLdapServer
, "localhost");
1247 Globals
.ldap_port
= 389;
1248 #endif /* WITH_LDAP */
1251 Globals
.sslVersion
= SMB_SSL_V23
;
1252 string_set(&Globals
.sslHostsRequire
, "");
1253 string_set(&Globals
.sslHostsResign
, "");
1254 string_set(&Globals
.sslCaCertDir
, "");
1255 string_set(&Globals
.sslCaCertFile
, "");
1256 string_set(&Globals
.sslCert
, "");
1257 string_set(&Globals
.sslPrivKey
, "");
1258 string_set(&Globals
.sslClientCert
, "");
1259 string_set(&Globals
.sslClientPrivKey
, "");
1260 string_set(&Globals
.sslCiphers
, "");
1261 Globals
.sslEnabled
= False
;
1262 Globals
.sslReqClientCert
= False
;
1263 Globals
.sslReqServerCert
= False
;
1264 Globals
.sslCompatibility
= False
;
1265 #endif /* WITH_SSL */
1268 these parameters are set to defaults that are more appropriate
1269 for the increasing samba install base:
1271 as a member of the workgroup, that will possibly become a
1272 _local_ master browser (lm = True). this is opposed to a forced
1273 local master browser startup (pm = True).
1275 doesn't provide WINS server service by default (wsupp = False),
1276 and doesn't provide domain master browser services by default, either.
1279 Globals
.bMsAddPrinterWizard
= True
;
1280 Globals
.bPreferredMaster
= Auto
; /* depending on bDomainMaster */
1281 Globals
.os_level
= 20;
1282 Globals
.bLocalMaster
= True
;
1283 Globals
.bDomainMaster
= Auto
; /* depending on bDomainLogons */
1284 Globals
.bDomainLogons
= False
;
1285 Globals
.bBrowseList
= True
;
1286 Globals
.bWINSsupport
= False
;
1287 Globals
.bWINSproxy
= False
;
1289 Globals
.bDNSproxy
= True
;
1291 /* this just means to use them if they exist */
1292 Globals
.bKernelOplocks
= True
;
1294 Globals
.bAllowTrustedDomains
= True
;
1296 string_set(&Globals
.szTemplateShell
, "/bin/false");
1297 string_set(&Globals
.szTemplateHomedir
, "/home/%D/%U");
1298 string_set(&Globals
.szWinbindSeparator
, "\\");
1299 Globals
.winbind_cache_time
= 15;
1302 * This must be done last as it checks the value in
1306 interpret_coding_system(KANJI
);
1309 static TALLOC_CTX
*lp_talloc
;
1311 /******************************************************************* a
1312 free up temporary memory - called from the main loop
1313 ********************************************************************/
1314 void lp_talloc_free(void)
1318 talloc_destroy(lp_talloc
);
1322 /*******************************************************************
1323 convenience routine to grab string parameters into temporary memory
1324 and run standard_sub_basic on them. The buffers can be written to by
1325 callers without affecting the source string.
1326 ********************************************************************/
1327 static char *lp_string(const char *s
)
1329 size_t len
= s
? strlen(s
) : 0;
1333 lp_talloc
= talloc_init();
1335 ret
= (char *)talloc(lp_talloc
, len
+ 100); /* leave room for substitution */
1343 StrnCpy(ret
, s
, len
);
1345 trim_string(ret
, "\"", "\"");
1347 standard_sub_basic(ret
);
1353 In this section all the functions that are used to access the
1354 parameters from the rest of the program are defined
1357 #define FN_GLOBAL_STRING(fn_name,ptr) \
1358 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
1359 #define FN_GLOBAL_BOOL(fn_name,ptr) \
1360 BOOL fn_name(void) {return(*(BOOL *)(ptr));}
1361 #define FN_GLOBAL_CHAR(fn_name,ptr) \
1362 char fn_name(void) {return(*(char *)(ptr));}
1363 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
1364 int fn_name(void) {return(*(int *)(ptr));}
1366 #define FN_LOCAL_STRING(fn_name,val) \
1367 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i)&&pSERVICE(i)->val)?pSERVICE(i)->val : sDefault.val));}
1368 #define FN_LOCAL_BOOL(fn_name,val) \
1369 BOOL fn_name(int i) {return(LP_SNUM_OK(i)? pSERVICE(i)->val : sDefault.val);}
1370 #define FN_LOCAL_CHAR(fn_name,val) \
1371 char fn_name(int i) {return(LP_SNUM_OK(i)? pSERVICE(i)->val : sDefault.val);}
1372 #define FN_LOCAL_INTEGER(fn_name,val) \
1373 int fn_name(int i) {return(LP_SNUM_OK(i)? pSERVICE(i)->val : sDefault.val);}
1375 FN_GLOBAL_STRING(lp_logfile
, &Globals
.szLogFile
)
1376 FN_GLOBAL_STRING(lp_smbrun
, &Globals
.szSmbrun
)
1377 FN_GLOBAL_STRING(lp_configfile
, &Globals
.szConfigFile
)
1378 FN_GLOBAL_STRING(lp_smb_passwd_file
, &Globals
.szSMBPasswdFile
)
1379 FN_GLOBAL_STRING(lp_private_dir
, &Globals
.szPrivateDir
)
1380 FN_GLOBAL_STRING(lp_passdb_module_path
, &Globals
.szPassdbModulePath
)
1381 FN_GLOBAL_STRING(lp_serverstring
, &Globals
.szServerString
)
1382 FN_GLOBAL_STRING(lp_printcapname
, &Globals
.szPrintcapname
)
1383 FN_GLOBAL_STRING(lp_enumports_cmd
, &Globals
.szEnumPortsCommand
)
1384 FN_GLOBAL_STRING(lp_addprinter_cmd
, &Globals
.szAddPrinterCommand
)
1385 FN_GLOBAL_STRING(lp_deleteprinter_cmd
, &Globals
.szDeletePrinterCommand
)
1386 FN_GLOBAL_STRING(lp_lockdir
, &Globals
.szLockDir
)
1388 FN_GLOBAL_STRING(lp_utmpdir
, &Globals
.szUtmpDir
)
1389 FN_GLOBAL_STRING(lp_wtmpdir
, &Globals
.szWtmpDir
)
1390 FN_GLOBAL_STRING(lp_utmp_hostname
, &Globals
.szUtmpHostname
)
1391 FN_GLOBAL_BOOL(lp_utmp_consolidate
, &Globals
.bUtmpConsolidate
)
1392 #endif /* WITH_UTMP */
1393 FN_GLOBAL_STRING(lp_rootdir
, &Globals
.szRootdir
)
1394 FN_GLOBAL_STRING(lp_source_environment
, &Globals
.szSourceEnv
)
1395 FN_GLOBAL_STRING(lp_defaultservice
, &Globals
.szDefaultService
)
1396 FN_GLOBAL_STRING(lp_msg_command
, &Globals
.szMsgCommand
)
1397 FN_GLOBAL_STRING(lp_dfree_command
, &Globals
.szDfree
)
1398 FN_GLOBAL_STRING(lp_hosts_equiv
, &Globals
.szHostsEquiv
)
1399 FN_GLOBAL_STRING(lp_auto_services
, &Globals
.szAutoServices
)
1400 FN_GLOBAL_STRING(lp_passwd_program
, &Globals
.szPasswdProgram
)
1401 FN_GLOBAL_STRING(lp_passwd_chat
, &Globals
.szPasswdChat
)
1402 FN_GLOBAL_STRING(lp_passwordserver
, &Globals
.szPasswordServer
)
1403 FN_GLOBAL_STRING(lp_name_resolve_order
, &Globals
.szNameResolveOrder
)
1404 FN_GLOBAL_STRING(lp_workgroup
, &Globals
.szWorkGroup
)
1405 FN_GLOBAL_STRING(lp_username_map
, &Globals
.szUsernameMap
)
1406 #ifdef USING_GROUPNAME_MAP
1407 FN_GLOBAL_STRING(lp_groupname_map
, &Globals
.szGroupnameMap
)
1408 #endif /* USING_GROUPNAME_MAP */
1409 FN_GLOBAL_STRING(lp_logon_script
, &Globals
.szLogonScript
)
1410 FN_GLOBAL_STRING(lp_logon_path
, &Globals
.szLogonPath
)
1411 FN_GLOBAL_STRING(lp_logon_drive
, &Globals
.szLogonDrive
)
1412 FN_GLOBAL_STRING(lp_logon_home
, &Globals
.szLogonHome
)
1413 FN_GLOBAL_STRING(lp_remote_announce
, &Globals
.szRemoteAnnounce
)
1414 FN_GLOBAL_STRING(lp_remote_browse_sync
, &Globals
.szRemoteBrowseSync
)
1415 FN_GLOBAL_STRING(lp_wins_server
, &Globals
.szWINSserver
)
1416 FN_GLOBAL_STRING(lp_interfaces
, &Globals
.szInterfaces
)
1417 FN_GLOBAL_STRING(lp_socket_address
, &Globals
.szSocketAddress
)
1418 FN_GLOBAL_STRING(lp_nis_home_map_name
, &Globals
.szNISHomeMapName
)
1419 static FN_GLOBAL_STRING(lp_announce_version
, &Globals
.szAnnounceVersion
)
1420 FN_GLOBAL_STRING(lp_netbios_aliases
, &Globals
.szNetbiosAliases
)
1421 FN_GLOBAL_STRING(lp_panic_action
, &Globals
.szPanicAction
)
1422 FN_GLOBAL_STRING(lp_adduser_script
, &Globals
.szAddUserScript
)
1423 FN_GLOBAL_STRING(lp_deluser_script
, &Globals
.szDelUserScript
)
1424 FN_GLOBAL_STRING(lp_wins_hook
, &Globals
.szWINSHook
)
1425 FN_GLOBAL_STRING(lp_domain_groups
, &Globals
.szDomainGroups
)
1426 FN_GLOBAL_STRING(lp_domain_admin_group
, &Globals
.szDomainAdminGroup
)
1427 FN_GLOBAL_STRING(lp_domain_guest_group
, &Globals
.szDomainGuestGroup
)
1428 FN_GLOBAL_STRING(lp_domain_admin_users
, &Globals
.szDomainAdminUsers
)
1429 FN_GLOBAL_STRING(lp_domain_guest_users
, &Globals
.szDomainGuestUsers
)
1430 FN_GLOBAL_STRING(lp_winbind_uid
, &Globals
.szWinbindUID
)
1431 FN_GLOBAL_STRING(lp_winbind_gid
, &Globals
.szWinbindGID
)
1432 FN_GLOBAL_STRING(lp_template_homedir
, &Globals
.szTemplateHomedir
)
1433 FN_GLOBAL_STRING(lp_template_shell
, &Globals
.szTemplateShell
)
1434 FN_GLOBAL_STRING(lp_winbind_separator
, &Globals
.szWinbindSeparator
)
1435 FN_GLOBAL_STRING(lp_codepagedir
,&Globals
.szCodePageDir
)
1437 FN_GLOBAL_STRING(lp_ldap_server
, &Globals
.szLdapServer
);
1438 FN_GLOBAL_STRING(lp_ldap_suffix
, &Globals
.szLdapSuffix
);
1439 FN_GLOBAL_STRING(lp_ldap_filter
, &Globals
.szLdapFilter
);
1440 FN_GLOBAL_STRING(lp_ldap_root
, &Globals
.szLdapRoot
);
1441 FN_GLOBAL_STRING(lp_ldap_rootpasswd
, &Globals
.szLdapRootPassword
);
1442 #endif /* WITH_LDAP */
1445 FN_GLOBAL_INTEGER(lp_ssl_version
, &Globals
.sslVersion
);
1446 FN_GLOBAL_STRING(lp_ssl_hosts
, &Globals
.sslHostsRequire
);
1447 FN_GLOBAL_STRING(lp_ssl_hosts_resign
, &Globals
.sslHostsResign
);
1448 FN_GLOBAL_STRING(lp_ssl_cacertdir
, &Globals
.sslCaCertDir
);
1449 FN_GLOBAL_STRING(lp_ssl_cacertfile
, &Globals
.sslCaCertFile
);
1450 FN_GLOBAL_STRING(lp_ssl_cert
, &Globals
.sslCert
);
1451 FN_GLOBAL_STRING(lp_ssl_privkey
, &Globals
.sslPrivKey
);
1452 FN_GLOBAL_STRING(lp_ssl_client_cert
, &Globals
.sslClientCert
);
1453 FN_GLOBAL_STRING(lp_ssl_client_privkey
, &Globals
.sslClientPrivKey
);
1454 FN_GLOBAL_STRING(lp_ssl_ciphers
, &Globals
.sslCiphers
);
1455 FN_GLOBAL_BOOL(lp_ssl_enabled
, &Globals
.sslEnabled
);
1456 FN_GLOBAL_BOOL(lp_ssl_reqClientCert
, &Globals
.sslReqClientCert
);
1457 FN_GLOBAL_BOOL(lp_ssl_reqServerCert
, &Globals
.sslReqServerCert
);
1458 FN_GLOBAL_BOOL(lp_ssl_compatibility
, &Globals
.sslCompatibility
);
1459 #endif /* WITH_SSL */
1461 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard
, &Globals
.bMsAddPrinterWizard
)
1462 FN_GLOBAL_BOOL(lp_dns_proxy
, &Globals
.bDNSproxy
)
1463 FN_GLOBAL_BOOL(lp_wins_support
, &Globals
.bWINSsupport
)
1464 FN_GLOBAL_BOOL(lp_we_are_a_wins_server
, &Globals
.bWINSsupport
)
1465 FN_GLOBAL_BOOL(lp_wins_proxy
, &Globals
.bWINSproxy
)
1466 FN_GLOBAL_BOOL(lp_local_master
, &Globals
.bLocalMaster
)
1467 FN_GLOBAL_BOOL(lp_domain_logons
, &Globals
.bDomainLogons
)
1468 FN_GLOBAL_BOOL(lp_load_printers
, &Globals
.bLoadPrinters
)
1469 FN_GLOBAL_BOOL(lp_use_rhosts
, &Globals
.bUseRhosts
)
1470 FN_GLOBAL_BOOL(lp_readprediction
, &Globals
.bReadPrediction
)
1471 FN_GLOBAL_BOOL(lp_readbmpx
, &Globals
.bReadbmpx
)
1472 FN_GLOBAL_BOOL(lp_readraw
, &Globals
.bReadRaw
)
1473 FN_GLOBAL_BOOL(lp_writeraw
, &Globals
.bWriteRaw
)
1474 FN_GLOBAL_BOOL(lp_null_passwords
, &Globals
.bNullPasswords
)
1475 FN_GLOBAL_BOOL(lp_strip_dot
, &Globals
.bStripDot
)
1476 FN_GLOBAL_BOOL(lp_encrypted_passwords
, &Globals
.bEncryptPasswords
)
1477 FN_GLOBAL_BOOL(lp_update_encrypted
, &Globals
.bUpdateEncrypt
)
1478 FN_GLOBAL_BOOL(lp_syslog_only
, &Globals
.bSyslogOnly
)
1479 FN_GLOBAL_BOOL(lp_timestamp_logs
, &Globals
.bTimestampLogs
)
1480 FN_GLOBAL_BOOL(lp_debug_hires_timestamp
, &Globals
.bDebugHiresTimestamp
)
1481 FN_GLOBAL_BOOL(lp_debug_pid
, &Globals
.bDebugPid
)
1482 FN_GLOBAL_BOOL(lp_debug_uid
, &Globals
.bDebugUid
)
1483 FN_GLOBAL_BOOL(lp_browse_list
, &Globals
.bBrowseList
)
1484 FN_GLOBAL_BOOL(lp_unix_realname
, &Globals
.bUnixRealname
)
1485 FN_GLOBAL_BOOL(lp_nis_home_map
, &Globals
.bNISHomeMap
)
1486 static FN_GLOBAL_BOOL(lp_time_server
, &Globals
.bTimeServer
)
1487 FN_GLOBAL_BOOL(lp_bind_interfaces_only
, &Globals
.bBindInterfacesOnly
)
1488 FN_GLOBAL_BOOL(lp_unix_password_sync
, &Globals
.bUnixPasswdSync
)
1489 FN_GLOBAL_BOOL(lp_passwd_chat_debug
, &Globals
.bPasswdChatDebug
)
1490 FN_GLOBAL_BOOL(lp_nt_smb_support
, &Globals
.bNTSmbSupport
)
1491 FN_GLOBAL_BOOL(lp_nt_pipe_support
, &Globals
.bNTPipeSupport
)
1492 FN_GLOBAL_BOOL(lp_nt_acl_support
, &Globals
.bNTAclSupport
)
1493 FN_GLOBAL_BOOL(lp_stat_cache
, &Globals
.bStatCache
)
1494 FN_GLOBAL_BOOL(lp_allow_trusted_domains
, &Globals
.bAllowTrustedDomains
)
1495 FN_GLOBAL_BOOL(lp_restrict_anonymous
, &Globals
.bRestrictAnonymous
)
1496 FN_GLOBAL_BOOL(lp_host_msdfs
, &Globals
.bHostMSDfs
)
1497 FN_GLOBAL_BOOL(lp_kernel_oplocks
, &Globals
.bKernelOplocks
)
1498 FN_GLOBAL_INTEGER(lp_os_level
, &Globals
.os_level
)
1499 FN_GLOBAL_INTEGER(lp_max_ttl
, &Globals
.max_ttl
)
1500 FN_GLOBAL_INTEGER(lp_max_wins_ttl
, &Globals
.max_wins_ttl
)
1501 FN_GLOBAL_INTEGER(lp_min_wins_ttl
, &Globals
.max_wins_ttl
)
1502 FN_GLOBAL_INTEGER(lp_max_log_size
, &Globals
.max_log_size
)
1503 FN_GLOBAL_INTEGER(lp_max_open_files
, &Globals
.max_open_files
)
1504 FN_GLOBAL_INTEGER(lp_maxxmit
, &Globals
.max_xmit
)
1505 FN_GLOBAL_INTEGER(lp_maxmux
, &Globals
.max_mux
)
1506 FN_GLOBAL_INTEGER(lp_passwordlevel
, &Globals
.pwordlevel
)
1507 FN_GLOBAL_INTEGER(lp_usernamelevel
, &Globals
.unamelevel
)
1508 FN_GLOBAL_INTEGER(lp_readsize
, &Globals
.ReadSize
)
1509 FN_GLOBAL_INTEGER(lp_deadtime
, &Globals
.deadtime
)
1510 FN_GLOBAL_INTEGER(lp_maxprotocol
, &Globals
.maxprotocol
)
1511 FN_GLOBAL_INTEGER(lp_security
, &Globals
.security
)
1512 FN_GLOBAL_INTEGER(lp_maxdisksize
, &Globals
.maxdisksize
)
1513 FN_GLOBAL_INTEGER(lp_lpqcachetime
, &Globals
.lpqcachetime
)
1514 FN_GLOBAL_INTEGER(lp_syslog
, &Globals
.syslog
)
1515 FN_GLOBAL_INTEGER(lp_client_code_page
, &Globals
.client_code_page
)
1516 static FN_GLOBAL_INTEGER(lp_announce_as
, &Globals
.announce_as
)
1517 FN_GLOBAL_INTEGER(lp_lm_announce
, &Globals
.lm_announce
)
1518 FN_GLOBAL_INTEGER(lp_lm_interval
, &Globals
.lm_interval
)
1519 FN_GLOBAL_INTEGER(lp_machine_password_timeout
, &Globals
.machine_password_timeout
)
1520 FN_GLOBAL_INTEGER(lp_change_notify_timeout
, &Globals
.change_notify_timeout
)
1521 FN_GLOBAL_INTEGER(lp_stat_cache_size
, &Globals
.stat_cache_size
)
1522 FN_GLOBAL_INTEGER(lp_map_to_guest
, &Globals
.map_to_guest
)
1523 FN_GLOBAL_INTEGER(lp_min_passwd_length
, &Globals
.min_passwd_length
)
1524 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time
, &Globals
.oplock_break_wait_time
)
1526 FN_GLOBAL_INTEGER(lp_ldap_port
, &Globals
.ldap_port
)
1527 #endif /* WITH_LDAP */
1528 FN_LOCAL_STRING(lp_preexec
, szPreExec
)
1529 FN_LOCAL_STRING(lp_postexec
, szPostExec
)
1530 FN_LOCAL_STRING(lp_rootpreexec
, szRootPreExec
)
1531 FN_LOCAL_STRING(lp_rootpostexec
, szRootPostExec
)
1532 FN_LOCAL_STRING(lp_servicename
, szService
)
1533 FN_LOCAL_STRING(lp_pathname
, szPath
)
1534 FN_LOCAL_STRING(lp_dontdescend
, szDontdescend
)
1535 FN_LOCAL_STRING(lp_username
, szUsername
)
1536 FN_LOCAL_STRING(lp_guestaccount
, szGuestaccount
)
1537 FN_LOCAL_STRING(lp_invalid_users
, szInvalidUsers
)
1538 FN_LOCAL_STRING(lp_valid_users
, szValidUsers
)
1539 FN_LOCAL_STRING(lp_admin_users
, szAdminUsers
)
1540 FN_LOCAL_STRING(lp_printcommand
, szPrintcommand
)
1541 FN_LOCAL_STRING(lp_lpqcommand
, szLpqcommand
)
1542 FN_LOCAL_STRING(lp_lprmcommand
, szLprmcommand
)
1543 FN_LOCAL_STRING(lp_lppausecommand
, szLppausecommand
)
1544 FN_LOCAL_STRING(lp_lpresumecommand
, szLpresumecommand
)
1545 FN_LOCAL_STRING(lp_queuepausecommand
, szQueuepausecommand
)
1546 FN_LOCAL_STRING(lp_queueresumecommand
, szQueueresumecommand
)
1547 static FN_LOCAL_STRING(_lp_printername
, szPrintername
)
1548 FN_LOCAL_STRING(lp_driverfile
, szDriverFile
)
1549 FN_LOCAL_STRING(lp_printerdriver
, szPrinterDriver
)
1550 FN_LOCAL_STRING(lp_hostsallow
, szHostsallow
)
1551 FN_LOCAL_STRING(lp_hostsdeny
, szHostsdeny
)
1552 FN_LOCAL_STRING(lp_magicscript
, szMagicScript
)
1553 FN_LOCAL_STRING(lp_magicoutput
, szMagicOutput
)
1554 FN_LOCAL_STRING(lp_comment
, comment
)
1555 FN_LOCAL_STRING(lp_force_user
, force_user
)
1556 FN_LOCAL_STRING(lp_force_group
, force_group
)
1557 FN_LOCAL_STRING(lp_readlist
, readlist
)
1558 FN_LOCAL_STRING(lp_writelist
, writelist
)
1559 FN_LOCAL_STRING(lp_printer_admin
, printer_admin
)
1560 FN_LOCAL_STRING(lp_fstype
, fstype
)
1561 FN_LOCAL_STRING(lp_vfsobj
, szVfsObjectFile
)
1562 static FN_LOCAL_STRING(lp_volume
, volume
)
1563 FN_LOCAL_STRING(lp_mangled_map
, szMangledMap
)
1564 FN_LOCAL_STRING(lp_veto_files
, szVetoFiles
)
1565 FN_LOCAL_STRING(lp_hide_files
, szHideFiles
)
1566 FN_LOCAL_STRING(lp_veto_oplocks
, szVetoOplockFiles
)
1567 FN_LOCAL_STRING(lp_driverlocation
, szPrinterDriverLocation
)
1568 FN_LOCAL_BOOL(lp_msdfs_root
, bMSDfsRoot
)
1569 FN_LOCAL_BOOL(lp_autoloaded
, autoloaded
)
1570 FN_LOCAL_BOOL(lp_preexec_close
, bPreexecClose
)
1571 FN_LOCAL_BOOL(lp_rootpreexec_close
, bRootpreexecClose
)
1572 FN_LOCAL_BOOL(lp_casesensitive
, bCaseSensitive
)
1573 FN_LOCAL_BOOL(lp_preservecase
, bCasePreserve
)
1574 FN_LOCAL_BOOL(lp_shortpreservecase
, bShortCasePreserve
)
1575 FN_LOCAL_BOOL(lp_casemangle
, bCaseMangle
)
1576 FN_LOCAL_BOOL(lp_status
, status
)
1577 FN_LOCAL_BOOL(lp_hide_dot_files
, bHideDotFiles
)
1578 FN_LOCAL_BOOL(lp_browseable
, bBrowseable
)
1579 FN_LOCAL_BOOL(lp_readonly
, bRead_only
)
1580 FN_LOCAL_BOOL(lp_no_set_dir
, bNo_set_dir
)
1581 FN_LOCAL_BOOL(lp_guest_ok
, bGuest_ok
)
1582 FN_LOCAL_BOOL(lp_guest_only
, bGuest_only
)
1583 FN_LOCAL_BOOL(lp_print_ok
, bPrint_ok
)
1584 FN_LOCAL_BOOL(lp_postscript
, bPostscript
)
1585 FN_LOCAL_BOOL(lp_map_hidden
, bMap_hidden
)
1586 FN_LOCAL_BOOL(lp_map_archive
, bMap_archive
)
1587 FN_LOCAL_BOOL(lp_locking
, bLocking
)
1588 FN_LOCAL_BOOL(lp_strict_locking
, bStrictLocking
)
1589 FN_LOCAL_BOOL(lp_posix_locking
, bPosixLocking
)
1591 FN_LOCAL_BOOL(lp_utmp
, bUtmp
)
1593 FN_LOCAL_BOOL(lp_share_modes
, bShareModes
)
1594 FN_LOCAL_BOOL(lp_oplocks
, bOpLocks
)
1595 FN_LOCAL_BOOL(lp_level2_oplocks
, bLevel2OpLocks
)
1596 FN_LOCAL_BOOL(lp_onlyuser
, bOnlyUser
)
1597 FN_LOCAL_BOOL(lp_manglednames
, bMangledNames
)
1598 FN_LOCAL_BOOL(lp_widelinks
, bWidelinks
)
1599 FN_LOCAL_BOOL(lp_symlinks
, bSymlinks
)
1600 FN_LOCAL_BOOL(lp_syncalways
, bSyncAlways
)
1601 FN_LOCAL_BOOL(lp_strict_sync
, bStrictSync
)
1602 FN_LOCAL_BOOL(lp_map_system
, bMap_system
)
1603 FN_LOCAL_BOOL(lp_delete_readonly
, bDeleteReadonly
)
1604 FN_LOCAL_BOOL(lp_fake_oplocks
, bFakeOplocks
)
1605 FN_LOCAL_BOOL(lp_recursive_veto_delete
, bDeleteVetoFiles
)
1606 FN_LOCAL_BOOL(lp_dos_filetimes
, bDosFiletimes
)
1607 FN_LOCAL_BOOL(lp_dos_filetime_resolution
, bDosFiletimeResolution
)
1608 FN_LOCAL_BOOL(lp_fake_dir_create_times
, bFakeDirCreateTimes
)
1609 FN_LOCAL_BOOL(lp_blocking_locks
, bBlockingLocks
)
1610 FN_LOCAL_BOOL(lp_inherit_perms
, bInheritPerms
)
1611 FN_LOCAL_INTEGER(lp_create_mask
, iCreate_mask
)
1612 FN_LOCAL_INTEGER(lp_force_create_mode
, iCreate_force_mode
)
1613 FN_LOCAL_INTEGER(_lp_security_mask
, iSecurity_mask
)
1614 FN_LOCAL_INTEGER(_lp_force_security_mode
, iSecurity_force_mode
)
1615 FN_LOCAL_INTEGER(lp_dir_mask
, iDir_mask
)
1616 FN_LOCAL_INTEGER(lp_force_dir_mode
, iDir_force_mode
)
1617 FN_LOCAL_INTEGER(_lp_dir_security_mask
, iDir_Security_mask
)
1618 FN_LOCAL_INTEGER(_lp_force_dir_security_mode
, iDir_Security_force_mode
)
1619 FN_LOCAL_INTEGER(lp_max_connections
, iMaxConnections
)
1620 FN_LOCAL_INTEGER(lp_defaultcase
, iDefaultCase
)
1621 FN_LOCAL_INTEGER(lp_minprintspace
, iMinPrintSpace
)
1622 FN_LOCAL_INTEGER(lp_maxprintjobs
, iMaxPrintJobs
)
1623 FN_LOCAL_INTEGER(lp_printing
, iPrinting
)
1624 FN_LOCAL_INTEGER(lp_oplock_contention_limit
, iOplockContentionLimit
)
1625 FN_LOCAL_INTEGER(lp_write_cache_size
, iWriteCacheSize
)
1626 FN_LOCAL_CHAR(lp_magicchar
, magic_char
)
1627 FN_GLOBAL_INTEGER(lp_winbind_cache_time
, &Globals
.winbind_cache_time
)
1628 /* local prototypes */
1629 static int map_parameter(char *pszParmName
);
1630 static BOOL
set_boolean(BOOL
*pb
, char *pszParmValue
);
1631 static int getservicebyname(char *pszServiceName
,
1632 service
* pserviceDest
);
1633 static void copy_service(service
* pserviceDest
,
1634 service
* pserviceSource
, BOOL
*pcopymapDest
);
1635 static BOOL
service_ok(int iService
);
1636 static BOOL
do_parameter(char *pszParmName
, char *pszParmValue
);
1637 static BOOL
do_section(char *pszSectionName
);
1638 static void init_copymap(service
* pservice
);
1641 /***************************************************************************
1642 initialise a service to the defaults
1643 ***************************************************************************/
1644 static void init_service(service
* pservice
)
1646 memset((char *)pservice
, '\0', sizeof(service
));
1647 copy_service(pservice
, &sDefault
, NULL
);
1651 /***************************************************************************
1652 free the dynamically allocated parts of a service struct
1653 ***************************************************************************/
1654 static void free_service(service
* pservice
)
1660 if (pservice
->szService
)
1662 ("free_service: Freeing service %s\n",
1663 pservice
->szService
));
1665 string_free(&pservice
->szService
);
1666 if (pservice
->copymap
)
1668 free(pservice
->copymap
);
1669 pservice
->copymap
= NULL
;
1672 for (i
= 0; parm_table
[i
].label
; i
++)
1673 if ((parm_table
[i
].type
== P_STRING
||
1674 parm_table
[i
].type
== P_USTRING
) &&
1675 parm_table
[i
].class == P_LOCAL
)
1676 string_free((char **)
1677 (((char *)pservice
) +
1678 PTR_DIFF(parm_table
[i
].ptr
, &sDefault
)));
1681 /***************************************************************************
1682 add a new service to the services array initialising it with the given
1684 ***************************************************************************/
1685 static int add_a_service(service
* pservice
, char *name
)
1689 int num_to_alloc
= iNumServices
+ 1;
1691 tservice
= *pservice
;
1693 /* it might already exist */
1696 i
= getservicebyname(name
, NULL
);
1701 /* find an invalid one */
1702 for (i
= 0; i
< iNumServices
; i
++)
1703 if (!pSERVICE(i
)->valid
)
1706 /* if not, then create one */
1707 if (i
== iNumServices
)
1710 (service
**) Realloc(ServicePtrs
,
1714 pSERVICE(iNumServices
) =
1715 (service
*) malloc(sizeof(service
));
1717 if (!ServicePtrs
|| !pSERVICE(iNumServices
))
1723 free_service(pSERVICE(i
));
1725 pSERVICE(i
)->valid
= True
;
1727 init_service(pSERVICE(i
));
1728 copy_service(pSERVICE(i
), &tservice
, NULL
);
1731 string_set(&iSERVICE(i
).szService
, name
);
1732 unix_to_dos(iSERVICE(i
).szService
, True
);
1737 /***************************************************************************
1738 add a new home service, with the specified home directory, defaults coming
1740 ***************************************************************************/
1741 BOOL
lp_add_home(char *pszHomename
, int iDefaultService
, char *pszHomedir
)
1743 int i
= add_a_service(pSERVICE(iDefaultService
), pszHomename
);
1748 if (!(*(iSERVICE(i
).szPath
))
1749 || strequal(iSERVICE(i
).szPath
, lp_pathname(-1)))
1750 string_set(&iSERVICE(i
).szPath
, pszHomedir
);
1751 if (!(*(iSERVICE(i
).comment
)))
1754 slprintf(comment
, sizeof(comment
) - 1,
1755 "Home directory of %s", pszHomename
);
1756 string_set(&iSERVICE(i
).comment
, comment
);
1758 iSERVICE(i
).bAvailable
= sDefault
.bAvailable
;
1759 iSERVICE(i
).bBrowseable
= sDefault
.bBrowseable
;
1762 ("adding home directory %s at %s\n", pszHomename
, pszHomedir
));
1767 /***************************************************************************
1768 add a new service, based on an old one
1769 ***************************************************************************/
1770 int lp_add_service(char *pszService
, int iDefaultService
)
1772 return (add_a_service(pSERVICE(iDefaultService
), pszService
));
1776 /***************************************************************************
1778 ***************************************************************************/
1779 static BOOL
lp_add_ipc(void)
1782 int i
= add_a_service(&sDefault
, "IPC$");
1787 slprintf(comment
, sizeof(comment
) - 1,
1788 "IPC Service (%s)", Globals
.szServerString
);
1790 string_set(&iSERVICE(i
).szPath
, tmpdir());
1791 string_set(&iSERVICE(i
).szUsername
, "");
1792 string_set(&iSERVICE(i
).comment
, comment
);
1793 string_set(&iSERVICE(i
).fstype
, "IPC");
1794 iSERVICE(i
).status
= False
;
1795 iSERVICE(i
).iMaxConnections
= 0;
1796 iSERVICE(i
).bAvailable
= True
;
1797 iSERVICE(i
).bRead_only
= True
;
1798 iSERVICE(i
).bGuest_only
= False
;
1799 iSERVICE(i
).bGuest_ok
= True
;
1800 iSERVICE(i
).bPrint_ok
= False
;
1801 iSERVICE(i
).bBrowseable
= sDefault
.bBrowseable
;
1803 DEBUG(3, ("adding IPC service\n"));
1809 /***************************************************************************
1810 add a new printer service, with defaults coming from service iFrom
1811 ***************************************************************************/
1812 BOOL
lp_add_printer(char *pszPrintername
, int iDefaultService
)
1814 char *comment
= "From Printcap";
1815 int i
= add_a_service(pSERVICE(iDefaultService
), pszPrintername
);
1820 /* note that we do NOT default the availability flag to True - */
1821 /* we take it from the default service passed. This allows all */
1822 /* dynamic printers to be disabled by disabling the [printers] */
1823 /* entry (if/when the 'available' keyword is implemented!). */
1825 /* the printer name is set to the service name. */
1826 string_set(&iSERVICE(i
).szPrintername
, pszPrintername
);
1827 string_set(&iSERVICE(i
).comment
, comment
);
1828 iSERVICE(i
).bBrowseable
= sDefault
.bBrowseable
;
1829 /* Printers cannot be read_only. */
1830 iSERVICE(i
).bRead_only
= False
;
1831 /* No share modes on printer services. */
1832 iSERVICE(i
).bShareModes
= False
;
1833 /* No oplocks on printer services. */
1834 iSERVICE(i
).bOpLocks
= False
;
1835 /* Printer services must be printable. */
1836 iSERVICE(i
).bPrint_ok
= True
;
1838 DEBUG(3, ("adding printer service %s\n", pszPrintername
));
1843 /***************************************************************************
1844 Map a parameter's string representation to something we can use.
1845 Returns False if the parameter string is not recognised, else TRUE.
1846 ***************************************************************************/
1847 static int map_parameter(char *pszParmName
)
1851 if (*pszParmName
== '-')
1854 for (iIndex
= 0; parm_table
[iIndex
].label
; iIndex
++)
1855 if (strwicmp(parm_table
[iIndex
].label
, pszParmName
) == 0)
1858 DEBUG(0, ("Unknown parameter encountered: \"%s\"\n", pszParmName
));
1863 /***************************************************************************
1864 Set a boolean variable from the text value stored in the passed string.
1865 Returns True in success, False if the passed string does not correctly
1866 represent a boolean.
1867 ***************************************************************************/
1868 static BOOL
set_boolean(BOOL
*pb
, char *pszParmValue
)
1873 if (strwicmp(pszParmValue
, "yes") == 0 ||
1874 strwicmp(pszParmValue
, "true") == 0 ||
1875 strwicmp(pszParmValue
, "1") == 0)
1878 if (strwicmp(pszParmValue
, "no") == 0 ||
1879 strwicmp(pszParmValue
, "False") == 0 ||
1880 strwicmp(pszParmValue
, "0") == 0)
1885 ("ERROR: Badly formed boolean in configuration file: \"%s\".\n",
1892 /***************************************************************************
1893 Find a service by name. Otherwise works like get_service.
1894 ***************************************************************************/
1895 static int getservicebyname(char *pszServiceName
, service
* pserviceDest
)
1899 for (iService
= iNumServices
- 1; iService
>= 0; iService
--)
1900 if (VALID(iService
) &&
1901 strwicmp(iSERVICE(iService
).szService
,
1902 pszServiceName
) == 0)
1904 if (pserviceDest
!= NULL
)
1905 copy_service(pserviceDest
, pSERVICE(iService
),
1915 /***************************************************************************
1916 Copy a service structure to another
1918 If pcopymapDest is NULL then copy all fields
1919 ***************************************************************************/
1920 static void copy_service(service
* pserviceDest
,
1921 service
* pserviceSource
, BOOL
*pcopymapDest
)
1924 BOOL bcopyall
= (pcopymapDest
== NULL
);
1926 for (i
= 0; parm_table
[i
].label
; i
++)
1927 if (parm_table
[i
].ptr
&& parm_table
[i
].class == P_LOCAL
&&
1928 (bcopyall
|| pcopymapDest
[i
]))
1930 void *def_ptr
= parm_table
[i
].ptr
;
1932 ((char *)pserviceSource
) + PTR_DIFF(def_ptr
,
1935 ((char *)pserviceDest
) + PTR_DIFF(def_ptr
,
1938 switch (parm_table
[i
].type
)
1942 *(BOOL
*)dest_ptr
= *(BOOL
*)src_ptr
;
1948 *(int *)dest_ptr
= *(int *)src_ptr
;
1952 *(char *)dest_ptr
= *(char *)src_ptr
;
1956 string_set(dest_ptr
,
1961 string_set(dest_ptr
,
1963 strupper(*(char **)dest_ptr
);
1972 init_copymap(pserviceDest
);
1973 if (pserviceSource
->copymap
)
1974 memcpy((void *)pserviceDest
->copymap
,
1975 (void *)pserviceSource
->copymap
,
1976 sizeof(BOOL
) * NUMPARAMETERS
);
1980 /***************************************************************************
1981 Check a service for consistency. Return False if the service is in any way
1982 incomplete or faulty, else True.
1983 ***************************************************************************/
1984 static BOOL
service_ok(int iService
)
1989 if (iSERVICE(iService
).szService
[0] == '\0')
1992 ("The following message indicates an internal error:\n"));
1993 DEBUG(0, ("No service name in service entry.\n"));
1997 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
1998 /* I can't see why you'd want a non-printable printer service... */
1999 if (strwicmp(iSERVICE(iService
).szService
, PRINTERS_NAME
) == 0) {
2000 if (!iSERVICE(iService
).bPrint_ok
) {
2002 ("WARNING: [%s] service MUST be printable!\n",
2003 iSERVICE(iService
).szService
));
2004 iSERVICE(iService
).bPrint_ok
= True
;
2006 /* [printers] service must also be non-browsable. */
2007 if (iSERVICE(iService
).bBrowseable
)
2008 iSERVICE(iService
).bBrowseable
= False
;
2011 if (iSERVICE(iService
).szPath
[0] == '\0' &&
2012 strwicmp(iSERVICE(iService
).szService
, HOMES_NAME
) != 0)
2015 ("No path in service %s - using %s\n",
2016 iSERVICE(iService
).szService
, tmpdir()));
2017 string_set(&iSERVICE(iService
).szPath
, tmpdir());
2020 /* If a service is flagged unavailable, log the fact at level 0. */
2021 if (!iSERVICE(iService
).bAvailable
)
2022 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
2023 iSERVICE(iService
).szService
));
2028 static struct file_lists
2030 struct file_lists
*next
;
2036 /*******************************************************************
2037 keep a linked list of all config files so we know when one has changed
2038 it's date and needs to be reloaded
2039 ********************************************************************/
2040 static void add_to_file_list(char *fname
)
2042 struct file_lists
*f
= file_lists
;
2046 if (f
->name
&& !strcmp(f
->name
, fname
))
2053 f
= (struct file_lists
*)malloc(sizeof(file_lists
[0]));
2056 f
->next
= file_lists
;
2057 f
->name
= strdup(fname
);
2069 standard_sub_basic(n2
);
2070 f
->modtime
= file_modtime(n2
);
2075 /*******************************************************************
2076 check if a config file has changed date
2077 ********************************************************************/
2078 BOOL
lp_file_list_changed(void)
2080 struct file_lists
*f
= file_lists
;
2081 DEBUG(6, ("lp_file_list_changed()\n"));
2088 pstrcpy(n2
, f
->name
);
2089 standard_sub_basic(n2
);
2091 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
2092 f
->name
, n2
, ctime(&f
->modtime
)));
2094 mod_time
= file_modtime(n2
);
2096 if (f
->modtime
!= mod_time
)
2099 ("file %s modified: %s\n", n2
,
2101 f
->modtime
= mod_time
;
2109 /***************************************************************************
2110 Run standard_sub_basic on netbios name... needed because global_myname
2111 is not accessed through any lp_ macro.
2112 Note: We must *NOT* use string_set() here as ptr points to global_myname.
2113 ***************************************************************************/
2115 static BOOL
handle_netbios_name(char *pszParmValue
, char **ptr
)
2117 pstring netbios_name
;
2119 pstrcpy(netbios_name
, pszParmValue
);
2121 standard_sub_basic(netbios_name
);
2122 strupper(netbios_name
);
2125 * Convert from UNIX to DOS string - the UNIX to DOS converter
2126 * isn't called on the special handlers.
2128 unix_to_dos(netbios_name
, True
);
2129 pstrcpy(global_myname
, netbios_name
);
2132 ("handle_netbios_name: set global_myname to: %s\n",
2138 /***************************************************************************
2139 Do the work of sourcing in environment variable/value pairs.
2140 ***************************************************************************/
2142 static BOOL
source_env(char **lines
)
2149 for (i
= 0; lines
[i
]; i
++)
2151 char *line
= lines
[i
];
2153 if ((len
= strlen(line
)) == 0)
2156 if (line
[len
- 1] == '\n')
2159 if ((varval
= malloc(len
+ 1)) == NULL
)
2161 DEBUG(0, ("source_env: Not enough memory!\n"));
2165 DEBUG(4, ("source_env: Adding to environment: %s\n", line
));
2166 strncpy(varval
, line
, len
);
2169 p
= strchr(line
, (int)'=');
2172 DEBUG(4, ("source_env: missing '=': %s\n", line
));
2179 ("source_env: Failed to put environment variable %s\n",
2187 ("source_env: getting var %s = %s\n", line
,
2191 DEBUG(4, ("source_env: returning successfully\n"));
2195 /***************************************************************************
2196 Handle the source environment operation
2197 ***************************************************************************/
2199 static BOOL
handle_source_env(char *pszParmValue
, char **ptr
)
2206 pstrcpy(fname
, pszParmValue
);
2208 standard_sub_basic(fname
);
2210 string_set(ptr
, pszParmValue
);
2212 DEBUG(4, ("handle_source_env: checking env type\n"));
2215 * Filename starting with '|' means popen and read from stdin.
2220 lines
= file_lines_pload(p
+ 1, NULL
);
2224 lines
= file_lines_load(fname
, NULL
);
2230 ("handle_source_env: Failed to open file %s, Error was %s\n",
2231 fname
, strerror(errno
)));
2235 result
= source_env(lines
);
2236 file_lines_free(lines
);
2241 /***************************************************************************
2242 handle the interpretation of the vfs object parameter
2243 *************************************************************************/
2244 static BOOL
handle_vfs_object(char *pszParmValue
, char **ptr
)
2246 /* Set string value */
2248 string_set(ptr
, pszParmValue
);
2250 /* Do any other initialisation required for vfs. Note that
2251 anything done here may have linking repercussions in nmbd. */
2256 /***************************************************************************
2257 handle the interpretation of the coding system parameter
2258 *************************************************************************/
2259 static BOOL
handle_coding_system(char *pszParmValue
, char **ptr
)
2261 string_set(ptr
, pszParmValue
);
2262 interpret_coding_system(pszParmValue
);
2266 /***************************************************************************
2267 Handle the interpretation of the character set system parameter.
2268 ***************************************************************************/
2270 static char *saved_character_set
= NULL
;
2272 static BOOL
handle_character_set(char *pszParmValue
, char **ptr
)
2274 /* A dependency here is that the parameter client code page should be
2275 set before this is called.
2277 string_set(ptr
, pszParmValue
);
2279 saved_character_set
= strdup(*ptr
);
2280 interpret_character_set(*ptr
, lp_client_code_page());
2284 /***************************************************************************
2285 Handle the interpretation of the client code page parameter.
2286 We handle this separately so that we can reset the character set
2287 parameter in case this came before 'client code page' in the smb.conf.
2288 ***************************************************************************/
2290 static BOOL
handle_client_code_page(char *pszParmValue
, char **ptr
)
2292 Globals
.client_code_page
= atoi(pszParmValue
);
2293 if (saved_character_set
!= NULL
)
2294 interpret_character_set(saved_character_set
,
2295 lp_client_code_page());
2296 codepage_initialise(lp_client_code_page());
2300 /***************************************************************************
2301 handle the valid chars lines
2302 ***************************************************************************/
2304 static BOOL
handle_valid_chars(char *pszParmValue
, char **ptr
)
2306 string_set(ptr
, pszParmValue
);
2308 /* A dependency here is that the parameter client code page must be
2309 set before this is called - as calling codepage_initialise()
2310 would overwrite the valid char lines.
2312 codepage_initialise(lp_client_code_page());
2314 add_char_string(pszParmValue
);
2318 /***************************************************************************
2319 handle the include operation
2320 ***************************************************************************/
2322 static BOOL
handle_include(char *pszParmValue
, char **ptr
)
2325 pstrcpy(fname
, pszParmValue
);
2327 add_to_file_list(fname
);
2329 standard_sub_basic(fname
);
2331 string_set(ptr
, fname
);
2333 if (file_exist(fname
, NULL
))
2334 return (pm_process(fname
, do_section
, do_parameter
));
2336 DEBUG(2, ("Can't find include file %s\n", fname
));
2342 /***************************************************************************
2343 handle the interpretation of the copy parameter
2344 ***************************************************************************/
2345 static BOOL
handle_copy(char *pszParmValue
, char **ptr
)
2349 service serviceTemp
;
2351 string_set(ptr
, pszParmValue
);
2353 init_service(&serviceTemp
);
2357 DEBUG(3, ("Copying service from service %s\n", pszParmValue
));
2359 if ((iTemp
= getservicebyname(pszParmValue
, &serviceTemp
)) >= 0)
2361 if (iTemp
== iServiceIndex
)
2364 ("Can't copy service %s - unable to copy self!\n",
2369 copy_service(pSERVICE(iServiceIndex
),
2371 iSERVICE(iServiceIndex
).copymap
);
2377 DEBUG(0, ("Unable to copy service - source not found: %s\n",
2382 free_service(&serviceTemp
);
2386 /***************************************************************************
2387 Handle winbind uid and gid allocation parameters. The format of these
2392 winbind uid = 1000-1999
2393 winbind gid = 700-899
2395 We only do simple parsing checks here. The strings are parsed into useful
2396 structures in the winbind daemon code.
2398 ***************************************************************************/
2400 /* Do some simple checks on "winbind [ug]id" parameter value */
2402 static BOOL
handle_winbind_id(char *pszParmValue
, char **ptr
)
2406 if (sscanf(pszParmValue
, "%d-%d", &low
, &high
) != 2)
2413 string_set(ptr
, pszParmValue
);
2418 /***************************************************************************
2419 Handle the WINS SERVER list
2420 ***************************************************************************/
2421 static BOOL
handle_wins_server_list( char *pszParmValue
, char **ptr
)
2423 if( !wins_srv_load_list( pszParmValue
) )
2424 return( False
); /* Parse failed. */
2426 string_set( ptr
, pszParmValue
);
2431 /***************************************************************************
2432 initialise a copymap
2433 ***************************************************************************/
2434 static void init_copymap(service
* pservice
)
2437 if (pservice
->copymap
)
2438 free(pservice
->copymap
);
2439 pservice
->copymap
= (BOOL
*)malloc(sizeof(BOOL
) * NUMPARAMETERS
);
2440 if (!pservice
->copymap
)
2442 ("Couldn't allocate copymap!! (size %d)\n",
2443 (int)NUMPARAMETERS
));
2445 for (i
= 0; i
< NUMPARAMETERS
; i
++)
2446 pservice
->copymap
[i
] = True
;
2450 /***************************************************************************
2451 return the local pointer to a parameter given the service number and the
2452 pointer into the default structure
2453 ***************************************************************************/
2454 void *lp_local_ptr(int snum
, void *ptr
)
2456 return (void *)(((char *)pSERVICE(snum
)) + PTR_DIFF(ptr
, &sDefault
));
2459 /***************************************************************************
2460 Process a parameter for a particular service number. If snum < 0
2461 then assume we are in the globals
2462 ***************************************************************************/
2463 BOOL
lp_do_parameter(int snum
, char *pszParmName
, char *pszParmValue
)
2466 void *parm_ptr
= NULL
; /* where we are going to store the result */
2467 void *def_ptr
= NULL
;
2469 parmnum
= map_parameter(pszParmName
);
2474 ("Ignoring unknown parameter \"%s\"\n", pszParmName
));
2478 if (parm_table
[parmnum
].flags
& FLAG_DEPRECATED
)
2480 DEBUG(1, ("WARNING: The \"%s\"option is deprecated\n",
2484 def_ptr
= parm_table
[parmnum
].ptr
;
2486 /* we might point at a service, the default service or a global */
2493 if (parm_table
[parmnum
].class == P_GLOBAL
)
2496 ("Global parameter %s found in service section!\n",
2501 ((char *)pSERVICE(snum
)) + PTR_DIFF(def_ptr
,
2507 if (!iSERVICE(snum
).copymap
)
2508 init_copymap(pSERVICE(snum
));
2510 /* this handles the aliases - set the copymap for other entries with
2511 the same data pointer */
2512 for (i
= 0; parm_table
[i
].label
; i
++)
2513 if (parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
)
2514 iSERVICE(snum
).copymap
[i
] = False
;
2517 /* if it is a special case then go ahead */
2518 if (parm_table
[parmnum
].special
)
2520 parm_table
[parmnum
].special(pszParmValue
, (char **)parm_ptr
);
2524 /* now switch on the type of variable it is */
2525 switch (parm_table
[parmnum
].type
)
2528 set_boolean(parm_ptr
, pszParmValue
);
2532 set_boolean(parm_ptr
, pszParmValue
);
2533 *(BOOL
*)parm_ptr
= !*(BOOL
*)parm_ptr
;
2537 *(int *)parm_ptr
= atoi(pszParmValue
);
2541 *(char *)parm_ptr
= *pszParmValue
;
2545 sscanf(pszParmValue
, "%o", (int *)parm_ptr
);
2549 string_set(parm_ptr
, pszParmValue
);
2550 if (parm_table
[parmnum
].flags
& FLAG_DOS_STRING
)
2551 unix_to_dos(*(char **)parm_ptr
, True
);
2555 string_set(parm_ptr
, pszParmValue
);
2556 if (parm_table
[parmnum
].flags
& FLAG_DOS_STRING
)
2557 unix_to_dos(*(char **)parm_ptr
, True
);
2558 strupper(*(char **)parm_ptr
);
2562 pstrcpy((char *)parm_ptr
, pszParmValue
);
2563 if (parm_table
[parmnum
].flags
& FLAG_DOS_STRING
)
2564 unix_to_dos((char *)parm_ptr
, True
);
2568 pstrcpy((char *)parm_ptr
, pszParmValue
);
2569 if (parm_table
[parmnum
].flags
& FLAG_DOS_STRING
)
2570 unix_to_dos((char *)parm_ptr
, True
);
2571 strupper((char *)parm_ptr
);
2575 for (i
= 0; parm_table
[parmnum
].enum_list
[i
].name
;
2580 parm_table
[parmnum
].enum_list
[i
].name
))
2583 parm_table
[parmnum
].
2596 /***************************************************************************
2597 Process a parameter.
2598 ***************************************************************************/
2599 static BOOL
do_parameter(char *pszParmName
, char *pszParmValue
)
2601 if (!bInGlobalSection
&& bGlobalOnly
)
2604 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName
, pszParmValue
));
2606 return (lp_do_parameter(bInGlobalSection
? -2 : iServiceIndex
,
2607 pszParmName
, pszParmValue
));
2611 /***************************************************************************
2612 print a parameter of the specified type
2613 ***************************************************************************/
2614 static void print_parameter(struct parm_struct
*p
, void *ptr
, FILE * f
)
2620 for (i
= 0; p
->enum_list
[i
].name
; i
++)
2622 if (*(int *)ptr
== p
->enum_list
[i
].value
)
2625 p
->enum_list
[i
].name
);
2632 fprintf(f
, "%s", BOOLSTR(*(BOOL
*)ptr
));
2636 fprintf(f
, "%s", BOOLSTR(!*(BOOL
*)ptr
));
2640 fprintf(f
, "%d", *(int *)ptr
);
2644 fprintf(f
, "%c", *(char *)ptr
);
2648 fprintf(f
, "%s", octal_string(*(int *)ptr
));
2654 fprintf(f
, "%s", (char *)ptr
);
2660 fprintf(f
, "%s", *(char **)ptr
);
2668 /***************************************************************************
2669 check if two parameters are equal
2670 ***************************************************************************/
2671 static BOOL
equal_parameter(parm_type type
, void *ptr1
, void *ptr2
)
2677 return (*((BOOL
*)ptr1
) == *((BOOL
*)ptr2
));
2682 return (*((int *)ptr1
) == *((int *)ptr2
));
2685 return (*((char *)ptr1
) == *((char *)ptr2
));
2690 char *p1
= (char *)ptr1
, *p2
= (char *)ptr2
;
2695 return (p1
== p2
|| strequal(p1
, p2
));
2700 char *p1
= *(char **)ptr1
, *p2
= *(char **)ptr2
;
2705 return (p1
== p2
|| strequal(p1
, p2
));
2713 /***************************************************************************
2714 Initialize any local varients in the sDefault table.
2715 ***************************************************************************/
2717 void init_locals(void)
2722 /***************************************************************************
2723 Process a new section (service). At this stage all sections are services.
2724 Later we'll have special sections that permit server parameters to be set.
2725 Returns True on success, False on failure.
2726 ***************************************************************************/
2727 static BOOL
do_section(char *pszSectionName
)
2730 BOOL isglobal
= ((strwicmp(pszSectionName
, GLOBAL_NAME
) == 0) ||
2731 (strwicmp(pszSectionName
, GLOBAL_NAME2
) == 0));
2734 /* if we were in a global section then do the local inits */
2735 if (bInGlobalSection
&& !isglobal
)
2738 /* if we've just struck a global section, note the fact. */
2739 bInGlobalSection
= isglobal
;
2741 /* check for multiple global sections */
2742 if (bInGlobalSection
)
2744 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName
));
2748 if (!bInGlobalSection
&& bGlobalOnly
)
2751 /* if we have a current service, tidy it up before moving on */
2754 if (iServiceIndex
>= 0)
2755 bRetval
= service_ok(iServiceIndex
);
2757 /* if all is still well, move to the next record in the services array */
2760 /* We put this here to avoid an odd message order if messages are */
2761 /* issued by the post-processing of a previous section. */
2762 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName
));
2764 if ((iServiceIndex
= add_a_service(&sDefault
, pszSectionName
))
2767 DEBUG(0, ("Failed to add a new service\n"));
2776 /***************************************************************************
2777 determine if a partcular base parameter is currently set to the default value.
2778 ***************************************************************************/
2779 static BOOL
is_default(int i
)
2781 if (!defaults_saved
)
2783 switch (parm_table
[i
].type
)
2787 return strequal(parm_table
[i
].def
.svalue
,
2788 *(char **)parm_table
[i
].ptr
);
2791 return strequal(parm_table
[i
].def
.svalue
,
2792 (char *)parm_table
[i
].ptr
);
2795 return parm_table
[i
].def
.bvalue
==
2796 *(BOOL
*)parm_table
[i
].ptr
;
2798 return parm_table
[i
].def
.cvalue
==
2799 *(char *)parm_table
[i
].ptr
;
2803 return parm_table
[i
].def
.ivalue
==
2804 *(int *)parm_table
[i
].ptr
;
2812 /***************************************************************************
2813 Display the contents of the global structure.
2814 ***************************************************************************/
2815 static void dump_globals(FILE * f
)
2818 fprintf(f
, "# Global parameters\n[global]\n");
2820 for (i
= 0; parm_table
[i
].label
; i
++)
2821 if (parm_table
[i
].class == P_GLOBAL
&&
2822 parm_table
[i
].ptr
&&
2823 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
2825 if (defaults_saved
&& is_default(i
))
2827 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
2828 print_parameter(&parm_table
[i
], parm_table
[i
].ptr
, f
);
2833 /***************************************************************************
2834 return True if a local parameter is currently set to the global default
2835 ***************************************************************************/
2836 BOOL
lp_is_default(int snum
, struct parm_struct
*parm
)
2838 int pdiff
= PTR_DIFF(parm
->ptr
, &sDefault
);
2840 return equal_parameter(parm
->type
,
2841 ((char *)pSERVICE(snum
)) + pdiff
,
2842 ((char *)&sDefault
) + pdiff
);
2846 /***************************************************************************
2847 Display the contents of a single services record.
2848 ***************************************************************************/
2849 static void dump_a_service(service
* pService
, FILE * f
)
2852 if (pService
!= &sDefault
)
2853 fprintf(f
, "\n[%s]\n", pService
->szService
);
2855 for (i
= 0; parm_table
[i
].label
; i
++)
2856 if (parm_table
[i
].class == P_LOCAL
&&
2857 parm_table
[i
].ptr
&&
2858 (*parm_table
[i
].label
!= '-') &&
2859 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
2861 int pdiff
= PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
2863 if (pService
== &sDefault
)
2865 if (defaults_saved
&& is_default(i
))
2870 if (equal_parameter(parm_table
[i
].type
,
2871 ((char *)pService
) +
2873 ((char *)&sDefault
) +
2878 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
2879 print_parameter(&parm_table
[i
],
2880 ((char *)pService
) + pdiff
, f
);
2886 /***************************************************************************
2887 return info about the next service in a service. snum==-1 gives the globals
2889 return NULL when out of parameters
2890 ***************************************************************************/
2891 struct parm_struct
*lp_next_parameter(int snum
, int *i
, int allparameters
)
2895 /* do the globals */
2896 for (; parm_table
[*i
].label
; (*i
)++)
2898 if (parm_table
[*i
].class == P_SEPARATOR
)
2899 return &parm_table
[(*i
)++];
2901 if (!parm_table
[*i
].ptr
2902 || (*parm_table
[*i
].label
== '-'))
2906 && (parm_table
[*i
].ptr
==
2907 parm_table
[(*i
) - 1].ptr
))
2910 return &parm_table
[(*i
)++];
2915 service
*pService
= pSERVICE(snum
);
2917 for (; parm_table
[*i
].label
; (*i
)++)
2919 if (parm_table
[*i
].class == P_SEPARATOR
)
2920 return &parm_table
[(*i
)++];
2922 if (parm_table
[*i
].class == P_LOCAL
&&
2923 parm_table
[*i
].ptr
&&
2924 (*parm_table
[*i
].label
!= '-') &&
2926 (parm_table
[*i
].ptr
!=
2927 parm_table
[(*i
) - 1].ptr
)))
2930 PTR_DIFF(parm_table
[*i
].ptr
,
2933 if (allparameters
||
2934 !equal_parameter(parm_table
[*i
].type
,
2935 ((char *)pService
) +
2937 ((char *)&sDefault
) +
2940 return &parm_table
[(*i
)++];
2951 /***************************************************************************
2952 Display the contents of a single copy structure.
2953 ***************************************************************************/
2954 static void dump_copy_map(BOOL
*pcopymap
)
2960 printf("\n\tNon-Copied parameters:\n");
2962 for (i
= 0; parm_table
[i
].label
; i
++)
2963 if (parm_table
[i
].class == P_LOCAL
&&
2964 parm_table
[i
].ptr
&& !pcopymap
[i
] &&
2965 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
2967 printf("\t\t%s\n", parm_table
[i
].label
);
2972 /***************************************************************************
2973 Return TRUE if the passed service number is within range.
2974 ***************************************************************************/
2975 BOOL
lp_snum_ok(int iService
)
2977 return (LP_SNUM_OK(iService
) && iSERVICE(iService
).bAvailable
);
2981 /***************************************************************************
2982 auto-load some home services
2983 ***************************************************************************/
2984 static void lp_add_auto_services(char *str
)
2997 homes
= lp_servicenumber(HOMES_NAME
);
2999 for (p
= strtok(s
, LIST_SEP
); p
; p
= strtok(NULL
, LIST_SEP
))
3001 char *home
= get_user_home_dir(p
);
3003 if (lp_servicenumber(p
) >= 0)
3006 if (home
&& homes
>= 0)
3008 lp_add_home(p
, homes
, home
);
3014 /***************************************************************************
3015 auto-load one printer
3016 ***************************************************************************/
3017 void lp_add_one_printer(char *name
, char *comment
)
3019 int printers
= lp_servicenumber(PRINTERS_NAME
);
3022 if (lp_servicenumber(name
) < 0)
3024 lp_add_printer(name
, printers
);
3025 if ((i
= lp_servicenumber(name
)) >= 0)
3027 string_set(&iSERVICE(i
).comment
, comment
);
3028 iSERVICE(i
).autoloaded
= True
;
3033 /***************************************************************************
3034 have we loaded a services file yet?
3035 ***************************************************************************/
3036 BOOL
lp_loaded(void)
3041 /***************************************************************************
3042 unload unused services
3043 ***************************************************************************/
3044 void lp_killunused(BOOL (*snumused
) (int))
3047 for (i
= 0; i
< iNumServices
; i
++)
3052 if (!snumused
|| !snumused(i
))
3054 iSERVICE(i
).valid
= False
;
3055 free_service(pSERVICE(i
));
3061 /***************************************************************************
3063 ***************************************************************************/
3064 void lp_killservice(int iServiceIn
)
3066 if (VALID(iServiceIn
))
3068 iSERVICE(iServiceIn
).valid
= False
;
3069 free_service(pSERVICE(iServiceIn
));
3073 /***************************************************************************
3074 save the curent values of all global and sDefault parameters into the
3075 defaults union. This allows swat and testparm to show only the
3076 changed (ie. non-default) parameters.
3077 ***************************************************************************/
3078 static void lp_save_defaults(void)
3081 for (i
= 0; parm_table
[i
].label
; i
++)
3083 if (i
> 0 && parm_table
[i
].ptr
== parm_table
[i
- 1].ptr
)
3085 switch (parm_table
[i
].type
)
3089 parm_table
[i
].def
.svalue
=
3090 strdup(*(char **)parm_table
[i
].ptr
);
3094 parm_table
[i
].def
.svalue
=
3095 strdup((char *)parm_table
[i
].ptr
);
3099 parm_table
[i
].def
.bvalue
=
3100 *(BOOL
*)parm_table
[i
].ptr
;
3103 parm_table
[i
].def
.cvalue
=
3104 *(char *)parm_table
[i
].ptr
;
3109 parm_table
[i
].def
.ivalue
=
3110 *(int *)parm_table
[i
].ptr
;
3116 defaults_saved
= True
;
3119 /*******************************************************************
3120 Set the server type we will announce as via nmbd.
3121 ********************************************************************/
3122 static void set_server_role(void)
3124 server_role
= ROLE_STANDALONE
;
3126 switch (lp_security())
3130 if (lp_domain_logons())
3133 ("Server's Role (logon server) conflicts with share-level security\n"));
3140 if (lp_domain_logons())
3142 server_role
= ROLE_DOMAIN_BDC
;
3145 server_role
= ROLE_DOMAIN_MEMBER
;
3150 if (lp_domain_logons())
3152 server_role
= ROLE_DOMAIN_PDC
;
3160 ("Server's Role undefined due to unknown security mode\n"));
3166 /***************************************************************************
3167 Load the services array from the services file. Return True on success,
3169 ***************************************************************************/
3170 BOOL
lp_load(char *pszFname
, BOOL global_only
, BOOL save_defaults
,
3176 add_to_file_list(pszFname
);
3180 bInGlobalSection
= True
;
3181 bGlobalOnly
= global_only
;
3191 pstrcpy(n2
, pszFname
);
3192 standard_sub_basic(n2
);
3194 /* We get sections first, so have to start 'behind' to make up */
3196 bRetval
= pm_process(n2
, do_section
, do_parameter
);
3198 /* finish up the last section */
3199 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval
)));
3201 if (iServiceIndex
>= 0)
3202 bRetval
= service_ok(iServiceIndex
);
3204 lp_add_auto_services(lp_auto_services());
3210 set_default_server_announce_type();
3214 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
3215 /* if bWINSsupport is true and we are in the client */
3217 if (in_client
&& Globals
.bWINSsupport
)
3220 string_set(&Globals
.szWINSserver
, "127.0.0.1");
3228 /***************************************************************************
3229 reset the max number of services
3230 ***************************************************************************/
3231 void lp_resetnumservices(void)
3236 /***************************************************************************
3237 return the max number of services
3238 ***************************************************************************/
3239 int lp_numservices(void)
3241 return (iNumServices
);
3244 /***************************************************************************
3245 Display the contents of the services array in human-readable form.
3246 ***************************************************************************/
3247 void lp_dump(FILE * f
, BOOL show_defaults
, int maxtoprint
)
3253 defaults_saved
= False
;
3258 dump_a_service(&sDefault
, f
);
3260 for (iService
= 0; iService
< maxtoprint
; iService
++)
3261 lp_dump_one(f
, show_defaults
, iService
);
3264 /***************************************************************************
3265 Display the contents of one service in human-readable form.
3266 ***************************************************************************/
3267 void lp_dump_one(FILE * f
, BOOL show_defaults
, int snum
)
3271 if (iSERVICE(snum
).szService
[0] == '\0')
3273 dump_a_service(pSERVICE(snum
), f
);
3278 /***************************************************************************
3279 Return the number of the service with the given name, or -1 if it doesn't
3280 exist. Note that this is a DIFFERENT ANIMAL from the internal function
3281 getservicebyname()! This works ONLY if all services have been loaded, and
3282 does not copy the found service.
3283 ***************************************************************************/
3284 int lp_servicenumber(char *pszServiceName
)
3288 for (iService
= iNumServices
- 1; iService
>= 0; iService
--)
3289 if (VALID(iService
) &&
3290 strequal(lp_servicename(iService
), pszServiceName
))
3295 ("lp_servicenumber: couldn't find %s\n",
3301 /*******************************************************************
3302 a useful volume label function
3303 ******************************************************************/
3304 char *volume_label(int snum
)
3306 char *ret
= lp_volume(snum
);
3308 /* lp_volume returns a unix charset - lp_servicename returns a
3309 dos codepage - convert so volume_label() always returns UNIX.
3311 return (dos_to_unix(lp_servicename(snum
), False
));
3317 /*******************************************************************
3318 Set the server type we will announce as via nmbd.
3319 ********************************************************************/
3320 static void set_default_server_announce_type(void)
3322 default_server_announce
= 0;
3323 default_server_announce
|= SV_TYPE_WORKSTATION
;
3324 default_server_announce
|= SV_TYPE_SERVER
;
3325 default_server_announce
|= SV_TYPE_SERVER_UNIX
;
3326 default_server_announce
|= SV_TYPE_PRINTQ_SERVER
;
3328 switch (lp_announce_as())
3330 case ANNOUNCE_AS_NT_SERVER
:
3332 default_server_announce
|= SV_TYPE_SERVER_NT
;
3333 /* fall through... */
3335 case ANNOUNCE_AS_NT_WORKSTATION
:
3337 default_server_announce
|= SV_TYPE_NT
;
3340 case ANNOUNCE_AS_WIN95
:
3342 default_server_announce
|= SV_TYPE_WIN95_PLUS
;
3345 case ANNOUNCE_AS_WFW
:
3347 default_server_announce
|= SV_TYPE_WFW
;
3356 switch (lp_server_role())
3358 case ROLE_DOMAIN_MEMBER
:
3360 default_server_announce
|= SV_TYPE_DOMAIN_MEMBER
;
3363 case ROLE_DOMAIN_PDC
:
3365 default_server_announce
|= SV_TYPE_DOMAIN_CTRL
;
3368 case ROLE_DOMAIN_BDC
:
3370 default_server_announce
|= SV_TYPE_DOMAIN_BAKCTRL
;
3373 case ROLE_STANDALONE
:
3380 if (lp_time_server())
3382 default_server_announce
|= SV_TYPE_TIME_SOURCE
;
3385 if (lp_host_msdfs())
3387 default_server_announce
|= SV_TYPE_DFS_SERVER
;
3391 /***********************************************************
3392 returns role of Samba server
3393 ************************************************************/
3395 int lp_server_role(void)
3400 /***********************************************************
3401 If we are PDC then prefer us as DMB
3402 ************************************************************/
3404 BOOL
lp_domain_master(void)
3406 if (Globals
.bDomainMaster
== Auto
)
3408 return (lp_server_role() == ROLE_DOMAIN_PDC
);
3411 return Globals
.bDomainMaster
;
3414 /***********************************************************
3415 If we are DMB then prefer us as LMB
3416 ************************************************************/
3418 BOOL
lp_preferred_master(void)
3420 if (Globals
.bPreferredMaster
== Auto
)
3422 return (lp_local_master() && lp_domain_master());
3425 return Globals
.bPreferredMaster
;
3430 /*******************************************************************
3432 ********************************************************************/
3433 void lp_remove_service(int snum
)
3435 pSERVICE(snum
)->valid
= False
;
3438 /*******************************************************************
3440 ********************************************************************/
3441 void lp_copy_service(int snum
, char *new_name
)
3443 char *oldname
= lp_servicename(snum
);
3444 do_section(new_name
);
3447 snum
= lp_servicenumber(new_name
);
3449 lp_do_parameter(snum
, "copy", oldname
);
3454 /*******************************************************************
3455 Get the default server type we will announce as via nmbd.
3456 ********************************************************************/
3457 int lp_default_server_announce(void)
3459 return default_server_announce
;
3462 /*******************************************************************
3463 Split the announce version into major and minor numbers.
3464 ********************************************************************/
3465 int lp_major_announce_version(void)
3467 static BOOL got_major
= False
;
3468 static int major_version
= DEFAULT_MAJOR_VERSION
;
3473 return major_version
;
3476 if ((vers
= lp_announce_version()) == NULL
)
3477 return major_version
;
3479 if ((p
= strchr(vers
, '.')) == 0)
3480 return major_version
;
3483 major_version
= atoi(vers
);
3484 return major_version
;
3487 int lp_minor_announce_version(void)
3489 static BOOL got_minor
= False
;
3490 static int minor_version
= DEFAULT_MINOR_VERSION
;
3495 return minor_version
;
3498 if ((vers
= lp_announce_version()) == NULL
)
3499 return minor_version
;
3501 if ((p
= strchr(vers
, '.')) == 0)
3502 return minor_version
;
3505 minor_version
= atoi(p
);
3506 return minor_version
;
3509 /***********************************************************
3510 Set the global name resolution order (used in smbclient).
3511 ************************************************************/
3513 void lp_set_name_resolve_order(char *new_order
)
3515 Globals
.szNameResolveOrder
= new_order
;
3518 /***********************************************************
3519 Functions to return the current security masks/modes. If
3520 set to -1 then return the create mask/mode instead.
3521 ************************************************************/
3523 int lp_security_mask(int snum
)
3525 int val
= _lp_security_mask(snum
);
3527 return lp_create_mask(snum
);
3531 int lp_force_security_mode(int snum
)
3533 int val
= _lp_force_security_mode(snum
);
3535 return lp_force_create_mode(snum
);
3539 int lp_dir_security_mask(int snum
)
3541 int val
= _lp_dir_security_mask(snum
);
3543 return lp_dir_mask(snum
);
3547 int lp_force_dir_security_mode(int snum
)
3549 int val
= _lp_force_dir_security_mode(snum
);
3551 return lp_force_dir_mode(snum
);
3555 char *lp_printername(int snum
)
3557 char *ret
= _lp_printername(snum
);
3558 if (ret
== NULL
|| (ret
!= NULL
&& *ret
== '\0'))
3559 ret
= lp_servicename(snum
);