2 Unix SMB/Netbios implementation.
4 Parameter loading functions
5 Copyright (C) Karl Auer 1993-1998
7 Largely re-written by Andrew Tridgell, September 1994
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 * This module provides suitable callback functions for the params
28 * module. It builds the internal table of service details which is
29 * then used by the rest of the server.
33 * 1) add it to the global or service structure definition
34 * 2) add it to the parm_table
35 * 3) add it to the list of available functions (eg: using FN_GLOBAL_STRING())
36 * 4) If it's a global then initialise it in init_globals. If a local
37 * (ie. service) parameter then initialise it in the sDefault structure
41 * The configuration file is processed sequentially for speed. It is NOT
42 * accessed randomly as happens in 'real' Windows. For this reason, there
43 * is a fair bit of sequence-dependent code here - ie., code which assumes
44 * that certain things happen before others. In particular, the code which
45 * happens at the boundary between sections is delicately poised, so be
52 /* Set default coding system for KANJI if none specified in Makefile. */
54 * We treat KANJI specially due to historical precedent (it was the
55 * first non-english codepage added to Samba). With the new dynamic
56 * codepage support this is not needed anymore.
58 * The define 'KANJI' is being overloaded to mean 'use kanji codepage
59 * by default' and also 'this is the filename-to-disk conversion
60 * method to use'. This really should be removed and all control
61 * over this left in the smb.conf parameters 'client codepage'
62 * and 'coding system'.
68 BOOL in_client
= False
; /* Not in the client by default */
71 extern int DEBUGLEVEL_CLASS
[DBGC_LAST
];
72 extern pstring user_socket_options
;
73 extern pstring global_myname
;
74 pstring global_scope
= "";
77 #define GLOBAL_NAME "global"
81 #define PRINTERS_NAME "printers"
85 #define HOMES_NAME "homes"
88 /* some helpful bits */
89 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && ServicePtrs[(i)]->valid)
90 #define VALID(i) ServicePtrs[i]->valid
92 int keepalive
= DEFAULT_KEEPALIVE
;
93 BOOL use_getwd_cache
= True
;
95 extern int extra_time_offset
;
97 static BOOL defaults_saved
= False
;
100 * This structure describes global (ie., server-wide) parameters.
104 char *szPrintcapname
;
105 char *szEnumPortsCommand
;
106 char *szAddPrinterCommand
;
107 char *szDeletePrinterCommand
;
108 char *szOs2DriverMap
;
111 char *szDefaultService
;
115 char *szServerString
;
116 char *szAutoServices
;
117 char *szPasswdProgram
;
122 char *szTDBPasswdFile
;
124 char *szSMBPasswdFile
;
126 char *szPasswordServer
;
127 char *szSocketOptions
;
130 char *szDomainAdminGroup
;
131 char *szDomainGuestGroup
;
132 char *szDomainHostsallow
;
133 char *szDomainHostsdeny
;
135 #ifdef USING_GROUPNAME_MAP
136 char *szGroupnameMap
;
137 #endif /* USING_GROUPNAME_MAP */
138 char *szCharacterSet
;
145 char *szCodingSystem
;
147 char *szRemoteAnnounce
;
148 char *szRemoteBrowseSync
;
149 char *szSocketAddress
;
150 char *szNISHomeMapName
;
151 char *szAnnounceVersion
; /* This is initialised in init_globals */
152 char *szNetbiosAliases
;
153 char *szDomainOtherSIDs
;
154 char *szNameResolveOrder
;
156 char *szAddUserScript
;
157 char *szDelUserScript
;
167 char *szTemplateHomedir
;
168 char *szTemplateShell
;
169 char *szWinbindSeparator
;
170 BOOL bWinbindEnumUsers
;
171 BOOL bWinbindEnumGroups
;
172 char *szAddShareCommand
;
173 char *szChangeShareCommand
;
174 char *szDeleteShareCommand
;
189 int iMaxSmbdProcesses
;
190 BOOL bDisableSpoolss
;
194 int enhanced_browsing
;
201 int client_code_page
;
202 int announce_as
; /* This is initialised in init_globals */
203 int machine_password_timeout
;
204 int change_notify_timeout
;
207 int min_passwd_length
;
208 int oplock_break_wait_time
;
209 int winbind_cache_time
;
218 char *szLdapRootPassword
;
219 #endif /* WITH_LDAP */
223 char *sslHostsRequire
;
224 char *sslHostsResign
;
230 char *sslClientPrivKey
;
233 BOOL sslReqClientCert
;
234 BOOL sslReqServerCert
;
235 BOOL sslCompatibility
;
236 #endif /* WITH_SSL */
237 BOOL bMsAddPrinterWizard
;
242 BOOL bPreferredMaster
;
245 BOOL bEncryptPasswords
;
249 BOOL bObeyPamRestrictions
;
252 BOOL bLargeReadwrite
;
255 BOOL bReadPrediction
;
261 BOOL bBindInterfacesOnly
;
262 BOOL bPamPasswordChange
;
263 BOOL bUnixPasswdSync
;
264 BOOL bPasswdChatDebug
;
271 BOOL bAllowTrustedDomains
;
272 BOOL bRestrictAnonymous
;
274 BOOL bDebugHiresTimestamp
;
278 BOOL bHideLocalUsers
;
283 static global Globals
;
288 * This structure describes a single service.
297 char *szGuestaccount
;
298 char *szInvalidUsers
;
306 char *szRootPostExec
;
307 char *szPrintcommand
;
310 char *szLppausecommand
;
311 char *szLpresumecommand
;
312 char *szQueuepausecommand
;
313 char *szQueueresumecommand
;
315 char *szPrinterDriver
;
316 char *szPrinterDriverLocation
;
326 char *szVetoOplockFiles
;
335 char *szVfsObjectFile
;
341 int iCreate_force_mode
;
343 int iSecurity_force_mode
;
346 int iDir_Security_mask
;
347 int iDir_Security_force_mode
;
351 int iOplockContentionLimit
;
354 BOOL bRootpreexecClose
;
357 BOOL bShortCasePreserve
;
361 BOOL bHideUnReadable
;
383 BOOL bStrictAllocate
;
387 BOOL bDeleteReadonly
;
389 BOOL bDeleteVetoFiles
;
392 BOOL bDosFiletimeResolution
;
393 BOOL bFakeDirCreateTimes
;
397 BOOL bUseClientDriver
;
399 char dummy
[3]; /* for alignment */
404 /* This is a default service used to prime a services structure */
405 static service sDefault
= {
407 False
, /* not autoloaded */
408 NULL
, /* szService */
410 NULL
, /* szUsername */
411 NULL
, /* szGuestAccount - this is set in init_globals() */
412 NULL
, /* szInvalidUsers */
413 NULL
, /* szValidUsers */
414 NULL
, /* szAdminUsers */
416 NULL
, /* szInclude */
417 NULL
, /* szPreExec */
418 NULL
, /* szPostExec */
419 NULL
, /* szRootPreExec */
420 NULL
, /* szRootPostExec */
421 NULL
, /* szPrintcommand */
422 NULL
, /* szLpqcommand */
423 NULL
, /* szLprmcommand */
424 NULL
, /* szLppausecommand */
425 NULL
, /* szLpresumecommand */
426 NULL
, /* szQueuepausecommand */
427 NULL
, /* szQueueresumecommand */
428 NULL
, /* szPrintername */
429 NULL
, /* szPrinterDriver - this is set in init_globals() */
430 NULL
, /* szPrinterDriverLocation */
431 NULL
, /* szDriverFile */
432 NULL
, /* szDontdescend */
433 NULL
, /* szHostsallow */
434 NULL
, /* szHostsdeny */
435 NULL
, /* szMagicScript */
436 NULL
, /* szMagicOutput */
437 NULL
, /* szMangledMap */
438 NULL
, /* szVetoFiles */
439 NULL
, /* szHideFiles */
440 NULL
, /* szVetoOplockFiles */
442 NULL
, /* force user */
443 NULL
, /* force group */
445 NULL
, /* writelist */
446 NULL
, /* printer admin */
449 NULL
, /* vfs object */
450 NULL
, /* vfs options */
451 0, /* iMinPrintSpace */
452 1000, /* iMaxPrintJobs */
453 0, /* iWriteCacheSize */
454 0744, /* iCreate_mask */
455 0000, /* iCreate_force_mode */
456 0777, /* iSecurity_mask */
457 0, /* iSecurity_force_mode */
458 0755, /* iDir_mask */
459 0000, /* iDir_force_mode */
460 0777, /* iDir_Security_mask */
461 0, /* iDir_Security_force_mode */
462 0, /* iMaxConnections */
463 CASE_LOWER
, /* iDefaultCase */
464 DEFAULT_PRINTING
, /* iPrinting */
465 2, /* iOplockContentionLimit */
466 False
, /* bAlternatePerm */
467 False
, /* bPreexecClose */
468 False
, /* bRootpreexecClose */
469 False
, /* case sensitive */
470 True
, /* case preserve */
471 True
, /* short case preserve */
472 False
, /* case mangle */
474 True
, /* bHideDotFiles */
475 False
, /* bHideUnReadable */
476 True
, /* bBrowseable */
477 True
, /* bAvailable */
478 True
, /* bRead_only */
479 True
, /* bNo_set_dir */
480 False
, /* bGuest_only */
481 False
, /* bGuest_ok */
482 False
, /* bPrint_ok */
483 False
, /* bPostscript */
484 False
, /* bMap_system */
485 False
, /* bMap_hidden */
486 True
, /* bMap_archive */
488 False
, /* bStrictLocking */
489 True
, /* bPosixLocking */
491 True
, /* bLevel2OpLocks */
492 False
, /* bOnlyUser */
493 True
, /* bMangledNames */
494 True
, /* bWidelinks */
495 True
, /* bSymlinks */
496 False
, /* bSyncAlways */
497 False
, /* bStrictAllocate */
498 False
, /* bStrictSync */
499 '~', /* magic char */
501 False
, /* bDeleteReadonly */
502 False
, /* bFakeOplocks */
503 False
, /* bDeleteVetoFiles */
504 False
, /* bDosFilemode */
505 False
, /* bDosFiletimes */
506 False
, /* bDosFiletimeResolution */
507 False
, /* bFakeDirCreateTimes */
508 True
, /* bBlockingLocks */
509 False
, /* bInheritPerms */
510 False
, /* bMSDfsRoot */
511 False
, /* bUseClientDriver */
518 /* local variables */
519 static service
**ServicePtrs
= NULL
;
520 static int iNumServices
= 0;
521 static int iServiceIndex
= 0;
522 static BOOL bInGlobalSection
= True
;
523 static BOOL bGlobalOnly
= False
;
524 static int server_role
;
525 static int default_server_announce
;
527 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
529 /* prototypes for the special type handlers */
530 static BOOL
handle_valid_chars(char *pszParmValue
, char **ptr
);
531 static BOOL
handle_include(char *pszParmValue
, char **ptr
);
532 static BOOL
handle_copy(char *pszParmValue
, char **ptr
);
533 static BOOL
handle_character_set(char *pszParmValue
, char **ptr
);
534 static BOOL
handle_coding_system(char *pszParmValue
, char **ptr
);
535 static BOOL
handle_client_code_page(char *pszParmValue
, char **ptr
);
536 static BOOL
handle_vfs_object(char *pszParmValue
, char **ptr
);
537 static BOOL
handle_source_env(char *pszParmValue
, char **ptr
);
538 static BOOL
handle_netbios_name(char *pszParmValue
, char **ptr
);
539 static BOOL
handle_winbind_id(char *pszParmValue
, char **ptr
);
540 static BOOL
handle_wins_server_list(char *pszParmValue
, char **ptr
);
541 static BOOL
handle_debug_list( char *pszParmValue
, char **ptr
);
543 static void set_server_role(void);
544 static void set_default_server_announce_type(void);
546 static struct enum_list enum_protocol
[] = {
547 {PROTOCOL_NT1
, "NT1"},
548 {PROTOCOL_LANMAN2
, "LANMAN2"},
549 {PROTOCOL_LANMAN1
, "LANMAN1"},
550 {PROTOCOL_CORE
, "CORE"},
551 {PROTOCOL_COREPLUS
, "COREPLUS"},
552 {PROTOCOL_COREPLUS
, "CORE+"},
556 static struct enum_list enum_security
[] = {
557 {SEC_SHARE
, "SHARE"},
559 {SEC_SERVER
, "SERVER"},
560 {SEC_DOMAIN
, "DOMAIN"},
564 static struct enum_list enum_printing
[] = {
565 {PRINT_SYSV
, "sysv"},
567 {PRINT_HPUX
, "hpux"},
571 {PRINT_LPRNG
, "lprng"},
572 {PRINT_SOFTQ
, "softq"},
573 {PRINT_CUPS
, "cups"},
575 {PRINT_LPROS2
, "os2"},
577 {PRINT_TEST
, "test"},
579 #endif /* DEVELOPER */
583 static struct enum_list enum_ldap_schema
[] = {
584 {SCHEMA_COMPAT
, "compat"},
586 {SCHEMA_AD
, "active directory"},
587 {SCHEMA_SAMBA
, "samba"},
591 static struct enum_list enum_ldap_ssl
[] = {
592 {LDAP_SSL_ON
, "Yes"},
593 {LDAP_SSL_ON
, "yes"},
596 {LDAP_SSL_OFF
, "no"},
597 {LDAP_SSL_OFF
, "No"},
598 {LDAP_SSL_OFF
, "off"},
599 {LDAP_SSL_OFF
, "Off"},
600 {LDAP_SSL_START_TLS
, "start tls"},
604 /* Types of machine we can announce as. */
605 #define ANNOUNCE_AS_NT_SERVER 1
606 #define ANNOUNCE_AS_WIN95 2
607 #define ANNOUNCE_AS_WFW 3
608 #define ANNOUNCE_AS_NT_WORKSTATION 4
610 static struct enum_list enum_announce_as
[] = {
611 {ANNOUNCE_AS_NT_SERVER
, "NT"},
612 {ANNOUNCE_AS_NT_SERVER
, "NT Server"},
613 {ANNOUNCE_AS_NT_WORKSTATION
, "NT Workstation"},
614 {ANNOUNCE_AS_WIN95
, "win95"},
615 {ANNOUNCE_AS_WFW
, "WfW"},
619 static struct enum_list enum_case
[] = {
620 {CASE_LOWER
, "lower"},
621 {CASE_UPPER
, "upper"},
625 static struct enum_list enum_bool_auto
[] = {
637 Do you want session setups at user level security with a invalid
638 password to be rejected or allowed in as guest? WinNT rejects them
639 but it can be a pain as it means "net view" needs to use a password
641 You have 3 choices in the setting of map_to_guest:
643 "Never" means session setups with an invalid password
644 are rejected. This is the default.
646 "Bad User" means session setups with an invalid password
647 are rejected, unless the username does not exist, in which case it
648 is treated as a guest login
650 "Bad Password" means session setups with an invalid password
651 are treated as a guest login
653 Note that map_to_guest only has an effect in user or server
657 static struct enum_list enum_map_to_guest
[] = {
658 {NEVER_MAP_TO_GUEST
, "Never"},
659 {MAP_TO_GUEST_ON_BAD_USER
, "Bad User"},
660 {MAP_TO_GUEST_ON_BAD_PASSWORD
, "Bad Password"},
665 static struct enum_list enum_ssl_version
[] = {
666 {SMB_SSL_V2
, "ssl2"},
667 {SMB_SSL_V3
, "ssl3"},
668 {SMB_SSL_V23
, "ssl2or3"},
669 {SMB_SSL_TLS1
, "tls1"},
674 /* note that we do not initialise the defaults union - it is not allowed in ANSI C */
675 static struct parm_struct parm_table
[] = {
676 {"Base Options", P_SEP
, P_SEPARATOR
},
678 {"coding system", P_STRING
, P_GLOBAL
, &Globals
.szCodingSystem
, handle_coding_system
, NULL
, 0},
679 {"client code page", P_INTEGER
, P_GLOBAL
, &Globals
.client_code_page
, handle_client_code_page
, NULL
, 0},
680 {"code page directory", P_STRING
, P_GLOBAL
, &Globals
.szCodePageDir
, NULL
, NULL
, 0},
681 {"comment", P_STRING
, P_LOCAL
, &sDefault
.comment
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
| FLAG_DOS_STRING
},
682 {"path", P_STRING
, P_LOCAL
, &sDefault
.szPath
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
| FLAG_DOS_STRING
},
683 {"directory", P_STRING
, P_LOCAL
, &sDefault
.szPath
, NULL
, NULL
, FLAG_DOS_STRING
},
684 {"workgroup", P_USTRING
, P_GLOBAL
, &Globals
.szWorkGroup
, NULL
, NULL
, FLAG_BASIC
| FLAG_DOS_STRING
},
685 {"netbios name", P_UGSTRING
, P_GLOBAL
, global_myname
, handle_netbios_name
, NULL
, FLAG_BASIC
| FLAG_DOS_STRING
},
686 {"netbios aliases", P_STRING
, P_GLOBAL
, &Globals
.szNetbiosAliases
, NULL
, NULL
, FLAG_DOS_STRING
},
687 {"netbios scope", P_UGSTRING
, P_GLOBAL
, global_scope
, NULL
, NULL
, FLAG_DOS_STRING
},
688 {"server string", P_STRING
, P_GLOBAL
, &Globals
.szServerString
, NULL
, NULL
, FLAG_BASIC
| FLAG_DOS_STRING
},
689 {"interfaces", P_STRING
, P_GLOBAL
, &Globals
.szInterfaces
, NULL
, NULL
, FLAG_BASIC
},
690 {"bind interfaces only", P_BOOL
, P_GLOBAL
, &Globals
.bBindInterfacesOnly
, NULL
, NULL
, 0},
692 {"Security Options", P_SEP
, P_SEPARATOR
},
694 {"security", P_ENUM
, P_GLOBAL
, &Globals
.security
, NULL
, enum_security
, FLAG_BASIC
},
695 {"encrypt passwords", P_BOOL
, P_GLOBAL
, &Globals
.bEncryptPasswords
, NULL
, NULL
, FLAG_BASIC
},
696 {"update encrypted", P_BOOL
, P_GLOBAL
, &Globals
.bUpdateEncrypt
, NULL
, NULL
, FLAG_BASIC
},
697 {"allow trusted domains", P_BOOL
, P_GLOBAL
, &Globals
.bAllowTrustedDomains
, NULL
, NULL
, 0},
698 {"alternate permissions", P_BOOL
, P_LOCAL
, &sDefault
.bAlternatePerm
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_DEPRECATED
},
699 {"hosts equiv", P_STRING
, P_GLOBAL
, &Globals
.szHostsEquiv
, NULL
, NULL
, 0},
700 {"min passwd length", P_INTEGER
, P_GLOBAL
, &Globals
.min_passwd_length
, NULL
, NULL
, 0},
701 {"min password length", P_INTEGER
, P_GLOBAL
, &Globals
.min_passwd_length
, NULL
, NULL
, 0},
702 {"map to guest", P_ENUM
, P_GLOBAL
, &Globals
.map_to_guest
, NULL
, enum_map_to_guest
, 0},
703 {"null passwords", P_BOOL
, P_GLOBAL
, &Globals
.bNullPasswords
, NULL
, NULL
, 0},
704 {"obey pam restrictions", P_BOOL
, P_GLOBAL
, &Globals
.bObeyPamRestrictions
, NULL
, NULL
, 0},
705 {"password server", P_STRING
, P_GLOBAL
, &Globals
.szPasswordServer
, NULL
, NULL
, 0},
707 {"tdb passwd file", P_STRING
, P_GLOBAL
, &Globals
.szTDBPasswdFile
, NULL
, NULL
, 0},
709 {"smb passwd file", P_STRING
, P_GLOBAL
, &Globals
.szSMBPasswdFile
, NULL
, NULL
, 0},
711 {"root directory", P_STRING
, P_GLOBAL
, &Globals
.szRootdir
, NULL
, NULL
, 0},
712 {"root dir", P_STRING
, P_GLOBAL
, &Globals
.szRootdir
, NULL
, NULL
, 0},
713 {"root", P_STRING
, P_GLOBAL
, &Globals
.szRootdir
, NULL
, NULL
, 0},
715 {"pam password change", P_BOOL
, P_GLOBAL
, &Globals
.bPamPasswordChange
, NULL
, NULL
, 0},
716 {"passwd program", P_STRING
, P_GLOBAL
, &Globals
.szPasswdProgram
, NULL
, NULL
, 0},
717 {"passwd chat", P_STRING
, P_GLOBAL
, &Globals
.szPasswdChat
, NULL
, NULL
, 0},
718 {"passwd chat debug", P_BOOL
, P_GLOBAL
, &Globals
.bPasswdChatDebug
, NULL
, NULL
, 0},
719 {"username map", P_STRING
, P_GLOBAL
, &Globals
.szUsernameMap
, NULL
, NULL
, 0},
720 {"password level", P_INTEGER
, P_GLOBAL
, &Globals
.pwordlevel
, NULL
, NULL
, 0},
721 {"username level", P_INTEGER
, P_GLOBAL
, &Globals
.unamelevel
, NULL
, NULL
, 0},
722 {"unix password sync", P_BOOL
, P_GLOBAL
, &Globals
.bUnixPasswdSync
, NULL
, NULL
, 0},
723 {"restrict anonymous", P_BOOL
, P_GLOBAL
, &Globals
.bRestrictAnonymous
, NULL
, NULL
, 0},
724 {"lanman auth", P_BOOL
, P_GLOBAL
, &Globals
.bLanmanAuth
, NULL
, NULL
, 0},
725 {"use rhosts", P_BOOL
, P_GLOBAL
, &Globals
.bUseRhosts
, NULL
, NULL
, 0},
727 {"username", P_STRING
, P_LOCAL
, &sDefault
.szUsername
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
728 {"user", P_STRING
, P_LOCAL
, &sDefault
.szUsername
, NULL
, NULL
, 0},
729 {"users", P_STRING
, P_LOCAL
, &sDefault
.szUsername
, NULL
, NULL
, 0},
731 {"guest account", P_STRING
, P_LOCAL
, &sDefault
.szGuestaccount
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
| FLAG_GLOBAL
},
732 {"invalid users", P_STRING
, P_LOCAL
, &sDefault
.szInvalidUsers
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
733 {"valid users", P_STRING
, P_LOCAL
, &sDefault
.szValidUsers
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
734 {"admin users", P_STRING
, P_LOCAL
, &sDefault
.szAdminUsers
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
735 {"read list", P_STRING
, P_LOCAL
, &sDefault
.readlist
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
736 {"write list", P_STRING
, P_LOCAL
, &sDefault
.writelist
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
737 {"printer admin", P_STRING
, P_LOCAL
, &sDefault
.printer_admin
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_PRINT
},
738 {"force user", P_STRING
, P_LOCAL
, &sDefault
.force_user
, NULL
, NULL
, FLAG_SHARE
},
739 {"force group", P_STRING
, P_LOCAL
, &sDefault
.force_group
, NULL
, NULL
, FLAG_SHARE
},
740 {"group", P_STRING
, P_LOCAL
, &sDefault
.force_group
, NULL
, NULL
, 0},
742 {"read only", P_BOOL
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
},
743 {"write ok", P_BOOLREV
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, 0},
744 {"writeable", P_BOOLREV
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, 0},
745 {"writable", P_BOOLREV
, P_LOCAL
, &sDefault
.bRead_only
, NULL
, NULL
, 0},
747 {"create mask", P_OCTAL
, P_LOCAL
, &sDefault
.iCreate_mask
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
748 {"create mode", P_OCTAL
, P_LOCAL
, &sDefault
.iCreate_mask
, NULL
, NULL
, FLAG_GLOBAL
},
749 {"force create mode", P_OCTAL
, P_LOCAL
, &sDefault
.iCreate_force_mode
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
750 {"security mask", P_OCTAL
, P_LOCAL
, &sDefault
.iSecurity_mask
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
751 {"force security mode", P_OCTAL
, P_LOCAL
, &sDefault
.iSecurity_force_mode
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
752 {"directory mask", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_mask
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
753 {"directory mode", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_mask
, NULL
, NULL
, FLAG_GLOBAL
},
754 {"force directory mode", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_force_mode
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
755 {"directory security mask", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_Security_mask
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
756 {"force directory security mode", P_OCTAL
, P_LOCAL
, &sDefault
.iDir_Security_force_mode
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
},
757 {"inherit permissions", P_BOOL
, P_LOCAL
, &sDefault
.bInheritPerms
, NULL
, NULL
, FLAG_SHARE
},
758 {"guest only", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_only
, NULL
, NULL
, FLAG_SHARE
},
759 {"only guest", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_only
, NULL
, NULL
, 0},
761 {"guest ok", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_ok
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
762 {"public", P_BOOL
, P_LOCAL
, &sDefault
.bGuest_ok
, NULL
, NULL
, 0},
764 {"only user", P_BOOL
, P_LOCAL
, &sDefault
.bOnlyUser
, NULL
, NULL
, FLAG_SHARE
},
765 {"hosts allow", P_STRING
, P_LOCAL
, &sDefault
.szHostsallow
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
766 {"allow hosts", P_STRING
, P_LOCAL
, &sDefault
.szHostsallow
, NULL
, NULL
, 0},
767 {"hosts deny", P_STRING
, P_LOCAL
, &sDefault
.szHostsdeny
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
768 {"deny hosts", P_STRING
, P_LOCAL
, &sDefault
.szHostsdeny
, NULL
, NULL
, 0},
771 {"Secure Socket Layer Options", P_SEP
, P_SEPARATOR
},
772 {"ssl", P_BOOL
, P_GLOBAL
, &Globals
.sslEnabled
, NULL
, NULL
, 0},
774 {"ssl hosts", P_STRING
, P_GLOBAL
, &Globals
.sslHostsRequire
, NULL
, NULL
, 0},
775 {"ssl hosts resign", P_STRING
, P_GLOBAL
, &Globals
.sslHostsResign
, NULL
, NULL
, 0},
776 {"ssl CA certDir", P_STRING
, P_GLOBAL
, &Globals
.sslCaCertDir
, NULL
, NULL
, 0},
777 {"ssl CA certFile", P_STRING
, P_GLOBAL
, &Globals
.sslCaCertFile
, NULL
, NULL
, 0},
778 {"ssl server cert", P_STRING
, P_GLOBAL
, &Globals
.sslCert
, NULL
, NULL
, 0},
779 {"ssl cert", P_STRING
, P_GLOBAL
, &Globals
.sslCert
, NULL
, NULL
, 0},
780 {"ssl server key", P_STRING
, P_GLOBAL
, &Globals
.sslPrivKey
, NULL
, NULL
, 0},
781 {"ssl key", P_STRING
, P_GLOBAL
, &Globals
.sslPrivKey
, NULL
, NULL
, 0},
782 {"ssl client cert", P_STRING
, P_GLOBAL
, &Globals
.sslClientCert
, NULL
, NULL
, 0},
783 {"ssl client key", P_STRING
, P_GLOBAL
, &Globals
.sslClientPrivKey
, NULL
, NULL
, 0},
784 {"ssl require clientcert", P_BOOL
, P_GLOBAL
, &Globals
.sslReqClientCert
, NULL
, NULL
, 0},
785 {"ssl require servercert", P_BOOL
, P_GLOBAL
, &Globals
.sslReqServerCert
, NULL
, NULL
, 0},
786 {"ssl ciphers", P_STRING
, P_GLOBAL
, &Globals
.sslCiphers
, NULL
, NULL
, 0},
787 {"ssl version", P_ENUM
, P_GLOBAL
, &Globals
.sslVersion
, NULL
, enum_ssl_version
, 0},
788 {"ssl compatibility", P_BOOL
, P_GLOBAL
, &Globals
.sslCompatibility
, NULL
, NULL
, 0},
789 #endif /* WITH_SSL */
791 {"Logging Options", P_SEP
, P_SEPARATOR
},
792 {"log level", P_INTEGER
, P_GLOBAL
, &DEBUGLEVEL_CLASS
[DBGC_ALL
], handle_debug_list
, NULL
, 0},
793 {"debuglevel", P_INTEGER
, P_GLOBAL
, &DEBUGLEVEL_CLASS
[DBGC_ALL
], handle_debug_list
, NULL
, 0},
794 {"syslog", P_INTEGER
, P_GLOBAL
, &Globals
.syslog
, NULL
, NULL
, 0},
795 {"syslog only", P_BOOL
, P_GLOBAL
, &Globals
.bSyslogOnly
, NULL
, NULL
, 0},
796 {"log file", P_STRING
, P_GLOBAL
, &Globals
.szLogFile
, NULL
, NULL
, 0},
798 {"max log size", P_INTEGER
, P_GLOBAL
, &Globals
.max_log_size
, NULL
, NULL
, 0},
799 {"timestamp logs", P_BOOL
, P_GLOBAL
, &Globals
.bTimestampLogs
, NULL
, NULL
, 0},
800 {"debug timestamp", P_BOOL
, P_GLOBAL
, &Globals
.bTimestampLogs
, NULL
, NULL
, 0},
801 {"debug hires timestamp", P_BOOL
, P_GLOBAL
, &Globals
.bDebugHiresTimestamp
, NULL
, NULL
, 0},
802 {"debug pid", P_BOOL
, P_GLOBAL
, &Globals
.bDebugPid
, NULL
, NULL
, 0},
803 {"debug uid", P_BOOL
, P_GLOBAL
, &Globals
.bDebugUid
, NULL
, NULL
, 0},
805 {"status", P_BOOL
, P_LOCAL
, &sDefault
.status
, NULL
, NULL
, FLAG_GLOBAL
| FLAG_SHARE
| FLAG_PRINT
},
807 {"Protocol Options", P_SEP
, P_SEPARATOR
},
809 {"protocol", P_ENUM
, P_GLOBAL
, &Globals
.maxprotocol
, NULL
, enum_protocol
, 0},
810 {"large readwrite", P_BOOL
, P_GLOBAL
, &Globals
.bLargeReadwrite
, NULL
, NULL
, 0},
811 {"max protocol", P_ENUM
, P_GLOBAL
, &Globals
.maxprotocol
, NULL
, enum_protocol
, 0},
812 {"min protocol", P_ENUM
, P_GLOBAL
, &Globals
.minprotocol
, NULL
, enum_protocol
, 0},
813 {"read bmpx", P_BOOL
, P_GLOBAL
, &Globals
.bReadbmpx
, NULL
, NULL
, 0},
814 {"read raw", P_BOOL
, P_GLOBAL
, &Globals
.bReadRaw
, NULL
, NULL
, 0},
815 {"write raw", P_BOOL
, P_GLOBAL
, &Globals
.bWriteRaw
, NULL
, NULL
, 0},
817 {"nt smb support", P_BOOL
, P_GLOBAL
, &Globals
.bNTSmbSupport
, NULL
, NULL
, 0},
818 {"nt pipe support", P_BOOL
, P_GLOBAL
, &Globals
.bNTPipeSupport
, NULL
, NULL
, 0},
819 {"nt acl support", P_BOOL
, P_GLOBAL
, &Globals
.bNTAclSupport
, NULL
, NULL
, 0},
820 {"announce version", P_STRING
, P_GLOBAL
, &Globals
.szAnnounceVersion
, NULL
, NULL
, 0},
821 {"announce as", P_ENUM
, P_GLOBAL
, &Globals
.announce_as
, NULL
, enum_announce_as
, 0},
822 {"max mux", P_INTEGER
, P_GLOBAL
, &Globals
.max_mux
, NULL
, NULL
, 0},
823 {"max xmit", P_INTEGER
, P_GLOBAL
, &Globals
.max_xmit
, NULL
, NULL
, 0},
825 {"name resolve order", P_STRING
, P_GLOBAL
, &Globals
.szNameResolveOrder
, NULL
, NULL
, 0},
826 {"max packet", P_INTEGER
, P_GLOBAL
, &Globals
.max_packet
, NULL
, NULL
, 0},
827 {"packet size", P_INTEGER
, P_GLOBAL
, &Globals
.max_packet
, NULL
, NULL
, 0},
828 {"max ttl", P_INTEGER
, P_GLOBAL
, &Globals
.max_ttl
, NULL
, NULL
, 0},
829 {"max wins ttl", P_INTEGER
, P_GLOBAL
, &Globals
.max_wins_ttl
, NULL
, NULL
, 0},
830 {"min wins ttl", P_INTEGER
, P_GLOBAL
, &Globals
.min_wins_ttl
, NULL
, NULL
, 0},
831 {"time server", P_BOOL
, P_GLOBAL
, &Globals
.bTimeServer
, NULL
, NULL
, 0},
833 {"Tuning Options", P_SEP
, P_SEPARATOR
},
835 {"change notify timeout", P_INTEGER
, P_GLOBAL
, &Globals
.change_notify_timeout
, NULL
, NULL
, 0},
836 {"deadtime", P_INTEGER
, P_GLOBAL
, &Globals
.deadtime
, NULL
, NULL
, 0},
837 {"getwd cache", P_BOOL
, P_GLOBAL
, &use_getwd_cache
, NULL
, NULL
, 0},
838 {"keepalive", P_INTEGER
, P_GLOBAL
, &keepalive
, NULL
, NULL
, 0},
840 {"lpq cache time", P_INTEGER
, P_GLOBAL
, &Globals
.lpqcachetime
, NULL
, NULL
, 0},
841 {"max smbd processes", P_INTEGER
, P_GLOBAL
, &Globals
.iMaxSmbdProcesses
, NULL
, NULL
, 0},
842 {"max connections", P_INTEGER
, P_LOCAL
, &sDefault
.iMaxConnections
, NULL
, NULL
, FLAG_SHARE
},
843 {"max disk size", P_INTEGER
, P_GLOBAL
, &Globals
.maxdisksize
, NULL
, NULL
, 0},
844 {"max open files", P_INTEGER
, P_GLOBAL
, &Globals
.max_open_files
, NULL
, NULL
, 0},
845 {"min print space", P_INTEGER
, P_LOCAL
, &sDefault
.iMinPrintSpace
, NULL
, NULL
, FLAG_PRINT
},
846 {"read size", P_INTEGER
, P_GLOBAL
, &Globals
.ReadSize
, NULL
, NULL
, 0},
848 {"socket options", P_GSTRING
, P_GLOBAL
, user_socket_options
, NULL
, NULL
, 0},
849 {"stat cache size", P_INTEGER
, P_GLOBAL
, &Globals
.stat_cache_size
, NULL
, NULL
, 0},
850 {"strict allocate", P_BOOL
, P_LOCAL
, &sDefault
.bStrictAllocate
, NULL
, NULL
, FLAG_SHARE
},
851 {"strict sync", P_BOOL
, P_LOCAL
, &sDefault
.bStrictSync
, NULL
, NULL
, FLAG_SHARE
},
852 {"sync always", P_BOOL
, P_LOCAL
, &sDefault
.bSyncAlways
, NULL
, NULL
, FLAG_SHARE
},
853 {"use mmap", P_BOOL
, P_GLOBAL
, &Globals
.bUseMmap
, NULL
, NULL
, 0},
854 {"write cache size", P_INTEGER
, P_LOCAL
, &sDefault
.iWriteCacheSize
, NULL
, NULL
, FLAG_SHARE
},
856 {"Printing Options", P_SEP
, P_SEPARATOR
},
858 {"total print jobs", P_INTEGER
, P_GLOBAL
, &Globals
.iTotalPrintJobs
, NULL
, NULL
, FLAG_PRINT
},
859 {"max print jobs", P_INTEGER
, P_LOCAL
, &sDefault
.iMaxPrintJobs
, NULL
, NULL
, FLAG_PRINT
},
860 {"load printers", P_BOOL
, P_GLOBAL
, &Globals
.bLoadPrinters
, NULL
, NULL
, FLAG_PRINT
},
861 {"printcap name", P_STRING
, P_GLOBAL
, &Globals
.szPrintcapname
, NULL
, NULL
, FLAG_PRINT
},
862 {"printcap", P_STRING
, P_GLOBAL
, &Globals
.szPrintcapname
, NULL
, NULL
, 0},
863 {"printable", P_BOOL
, P_LOCAL
, &sDefault
.bPrint_ok
, NULL
, NULL
, FLAG_PRINT
},
864 {"print ok", P_BOOL
, P_LOCAL
, &sDefault
.bPrint_ok
, NULL
, NULL
, 0},
865 {"postscript", P_BOOL
, P_LOCAL
, &sDefault
.bPostscript
, NULL
, NULL
, FLAG_PRINT
},
866 {"printing", P_ENUM
, P_LOCAL
, &sDefault
.iPrinting
, NULL
, enum_printing
, FLAG_PRINT
| FLAG_GLOBAL
},
867 {"print command", P_STRING
, P_LOCAL
, &sDefault
.szPrintcommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
868 {"disable spoolss", P_BOOL
, P_GLOBAL
, &Globals
.bDisableSpoolss
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
869 {"lpq command", P_STRING
, P_LOCAL
, &sDefault
.szLpqcommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
870 {"lprm command", P_STRING
, P_LOCAL
, &sDefault
.szLprmcommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
871 {"lppause command", P_STRING
, P_LOCAL
, &sDefault
.szLppausecommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
872 {"lpresume command", P_STRING
, P_LOCAL
, &sDefault
.szLpresumecommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
873 {"queuepause command", P_STRING
, P_LOCAL
, &sDefault
.szQueuepausecommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
874 {"queueresume command", P_STRING
, P_LOCAL
, &sDefault
.szQueueresumecommand
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
876 {"enumports command", P_STRING
, P_GLOBAL
, &Globals
.szEnumPortsCommand
, NULL
, NULL
, 0},
877 {"addprinter command", P_STRING
, P_GLOBAL
, &Globals
.szAddPrinterCommand
, NULL
, NULL
, 0},
878 {"deleteprinter command", P_STRING
, P_GLOBAL
, &Globals
.szDeletePrinterCommand
, NULL
, NULL
, 0},
879 {"show add printer wizard", P_BOOL
, P_GLOBAL
, &Globals
.bMsAddPrinterWizard
, NULL
, NULL
, 0},
880 {"os2 driver map", P_STRING
, P_GLOBAL
, &Globals
.szOs2DriverMap
, NULL
, NULL
, 0},
882 {"printer name", P_STRING
, P_LOCAL
, &sDefault
.szPrintername
, NULL
, NULL
, FLAG_PRINT
|FLAG_DOS_STRING
},
883 {"printer", P_STRING
, P_LOCAL
, &sDefault
.szPrintername
, NULL
, NULL
, FLAG_DOS_STRING
},
884 {"use client driver", P_BOOL
, P_LOCAL
, &sDefault
.bUseClientDriver
, NULL
, NULL
, FLAG_PRINT
},
885 {"printer driver", P_STRING
, P_LOCAL
, &sDefault
.szPrinterDriver
, NULL
, NULL
, FLAG_PRINT
},
886 {"printer driver file", P_STRING
, P_LOCAL
, &sDefault
.szDriverFile
, NULL
, NULL
, FLAG_PRINT
},
887 {"printer driver location", P_STRING
, P_LOCAL
, &sDefault
.szPrinterDriverLocation
, NULL
, NULL
, FLAG_PRINT
| FLAG_GLOBAL
},
889 {"Filename Handling", P_SEP
, P_SEPARATOR
},
890 {"strip dot", P_BOOL
, P_GLOBAL
, &Globals
.bStripDot
, NULL
, NULL
, 0},
892 {"character set", P_STRING
, P_GLOBAL
, &Globals
.szCharacterSet
, handle_character_set
, NULL
, 0},
893 {"mangled stack", P_INTEGER
, P_GLOBAL
, &Globals
.mangled_stack
, NULL
, NULL
, 0},
894 {"default case", P_ENUM
, P_LOCAL
, &sDefault
.iDefaultCase
, NULL
, enum_case
, FLAG_SHARE
},
895 {"case sensitive", P_BOOL
, P_LOCAL
, &sDefault
.bCaseSensitive
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
896 {"casesignames", P_BOOL
, P_LOCAL
, &sDefault
.bCaseSensitive
, NULL
, NULL
, 0},
897 {"preserve case", P_BOOL
, P_LOCAL
, &sDefault
.bCasePreserve
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
898 {"short preserve case", P_BOOL
, P_LOCAL
, &sDefault
.bShortCasePreserve
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
899 {"mangle case", P_BOOL
, P_LOCAL
, &sDefault
.bCaseMangle
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
900 {"mangling char", P_CHAR
, P_LOCAL
, &sDefault
.magic_char
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
901 {"hide dot files", P_BOOL
, P_LOCAL
, &sDefault
.bHideDotFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
902 {"hide unreadable", P_BOOL
, P_LOCAL
, &sDefault
.bHideUnReadable
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
903 {"delete veto files", P_BOOL
, P_LOCAL
, &sDefault
.bDeleteVetoFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
904 {"veto files", P_STRING
, P_LOCAL
, &sDefault
.szVetoFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DOS_STRING
},
905 {"hide files", P_STRING
, P_LOCAL
, &sDefault
.szHideFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DOS_STRING
},
906 {"veto oplock files", P_STRING
, P_LOCAL
, &sDefault
.szVetoOplockFiles
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
| FLAG_DOS_STRING
},
907 {"map system", P_BOOL
, P_LOCAL
, &sDefault
.bMap_system
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
908 {"map hidden", P_BOOL
, P_LOCAL
, &sDefault
.bMap_hidden
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
909 {"map archive", P_BOOL
, P_LOCAL
, &sDefault
.bMap_archive
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
910 {"mangled names", P_BOOL
, P_LOCAL
, &sDefault
.bMangledNames
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
911 {"mangled map", P_STRING
, P_LOCAL
, &sDefault
.szMangledMap
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
912 {"stat cache", P_BOOL
, P_GLOBAL
, &Globals
.bStatCache
, NULL
, NULL
, 0},
914 {"Domain Options", P_SEP
, P_SEPARATOR
},
916 {"domain admin group", P_STRING
, P_GLOBAL
, &Globals
.szDomainAdminGroup
, NULL
, NULL
, 0},
917 {"domain guest group", P_STRING
, P_GLOBAL
, &Globals
.szDomainGuestGroup
, NULL
, NULL
, 0},
918 #ifdef USING_GROUPNAME_MAP
920 {"groupname map", P_STRING
, P_GLOBAL
, &Globals
.szGroupnameMap
, NULL
, NULL
, 0},
921 #endif /* USING_GROUPNAME_MAP */
923 {"machine password timeout", P_INTEGER
, P_GLOBAL
, &Globals
.machine_password_timeout
, NULL
, NULL
, 0},
925 {"Logon Options", P_SEP
, P_SEPARATOR
},
927 {"add user script", P_STRING
, P_GLOBAL
, &Globals
.szAddUserScript
, NULL
, NULL
, 0},
928 {"delete user script", P_STRING
, P_GLOBAL
, &Globals
.szDelUserScript
, NULL
, NULL
, 0},
929 {"logon script", P_STRING
, P_GLOBAL
, &Globals
.szLogonScript
, NULL
, NULL
, FLAG_DOS_STRING
},
930 {"logon path", P_STRING
, P_GLOBAL
, &Globals
.szLogonPath
, NULL
, NULL
, FLAG_DOS_STRING
},
931 {"logon drive", P_STRING
, P_GLOBAL
, &Globals
.szLogonDrive
, NULL
, NULL
, 0},
932 {"logon home", P_STRING
, P_GLOBAL
, &Globals
.szLogonHome
, NULL
, NULL
, FLAG_DOS_STRING
},
933 {"domain logons", P_BOOL
, P_GLOBAL
, &Globals
.bDomainLogons
, NULL
, NULL
, 0},
935 {"Browse Options", P_SEP
, P_SEPARATOR
},
937 {"os level", P_INTEGER
, P_GLOBAL
, &Globals
.os_level
, NULL
, NULL
, FLAG_BASIC
},
938 {"lm announce", P_ENUM
, P_GLOBAL
, &Globals
.lm_announce
, NULL
, enum_bool_auto
, 0},
939 {"lm interval", P_INTEGER
, P_GLOBAL
, &Globals
.lm_interval
, NULL
, NULL
, 0},
940 {"preferred master", P_ENUM
, P_GLOBAL
, &Globals
.bPreferredMaster
, NULL
, enum_bool_auto
, FLAG_BASIC
},
941 {"prefered master", P_ENUM
, P_GLOBAL
, &Globals
.bPreferredMaster
, NULL
, enum_bool_auto
, FLAG_HIDE
},
942 {"local master", P_BOOL
, P_GLOBAL
, &Globals
.bLocalMaster
, NULL
, NULL
, FLAG_BASIC
},
943 {"domain master", P_ENUM
, P_GLOBAL
, &Globals
.bDomainMaster
, NULL
, enum_bool_auto
, FLAG_BASIC
},
944 {"browse list", P_BOOL
, P_GLOBAL
, &Globals
.bBrowseList
, NULL
, NULL
, 0},
945 {"browseable", P_BOOL
, P_LOCAL
, &sDefault
.bBrowseable
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
946 {"browsable", P_BOOL
, P_LOCAL
, &sDefault
.bBrowseable
, NULL
, NULL
, 0},
947 {"enhanced browsing", P_BOOL
, P_GLOBAL
, &Globals
.enhanced_browsing
, NULL
, NULL
},
949 {"WINS Options", P_SEP
, P_SEPARATOR
},
950 {"dns proxy", P_BOOL
, P_GLOBAL
, &Globals
.bDNSproxy
, NULL
, NULL
, 0},
951 {"wins proxy", P_BOOL
, P_GLOBAL
, &Globals
.bWINSproxy
, NULL
, NULL
, 0},
953 {"wins server", P_STRING
, P_GLOBAL
, &Globals
.szWINSserver
, handle_wins_server_list
, NULL
, FLAG_BASIC
},
954 {"wins support", P_BOOL
, P_GLOBAL
, &Globals
.bWINSsupport
, NULL
, NULL
, FLAG_BASIC
},
955 {"wins hook", P_STRING
, P_GLOBAL
, &Globals
.szWINSHook
, NULL
, NULL
, 0},
957 {"Locking Options", P_SEP
, P_SEPARATOR
},
959 {"blocking locks", P_BOOL
, P_LOCAL
, &sDefault
.bBlockingLocks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
960 {"fake oplocks", P_BOOL
, P_LOCAL
, &sDefault
.bFakeOplocks
, NULL
, NULL
, FLAG_SHARE
},
961 {"kernel oplocks", P_BOOL
, P_GLOBAL
, &Globals
.bKernelOplocks
, NULL
, NULL
, FLAG_GLOBAL
},
962 {"locking", P_BOOL
, P_LOCAL
, &sDefault
.bLocking
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
964 {"oplocks", P_BOOL
, P_LOCAL
, &sDefault
.bOpLocks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
965 {"level2 oplocks", P_BOOL
, P_LOCAL
, &sDefault
.bLevel2OpLocks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
966 {"oplock break wait time", P_INTEGER
, P_GLOBAL
, &Globals
.oplock_break_wait_time
, NULL
, NULL
, FLAG_GLOBAL
},
967 {"oplock contention limit", P_INTEGER
, P_LOCAL
, &sDefault
.iOplockContentionLimit
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
968 {"posix locking", P_BOOL
, P_LOCAL
, &sDefault
.bPosixLocking
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
969 {"strict locking", P_BOOL
, P_LOCAL
, &sDefault
.bStrictLocking
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
972 {"Ldap Options", P_SEP
, P_SEPARATOR
},
974 {"ldap server", P_STRING
, P_GLOBAL
, &Globals
.szLdapServer
, NULL
, NULL
, 0},
975 {"ldap port", P_INTEGER
, P_GLOBAL
, &Globals
.ldap_port
, NULL
, NULL
, 0},
976 {"ldap suffix", P_STRING
, P_GLOBAL
, &Globals
.szLdapSuffix
, NULL
, NULL
, 0},
977 {"ldap filter", P_STRING
, P_GLOBAL
, &Globals
.szLdapFilter
, NULL
, NULL
, 0},
978 {"ldap root", P_STRING
, P_GLOBAL
, &Globals
.szLdapRoot
, NULL
, NULL
, 0},
979 {"ldap root passwd", P_STRING
, P_GLOBAL
, &Globals
.szLdapRootPassword
, NULL
, NULL
, 0},
980 {"ldap schema", P_ENUM
, P_GLOBAL
, &Globals
.ldap_schema
, NULL
, enum_ldap_schema
, 0},
981 {"ldap ssl", P_ENUM
, P_GLOBAL
, &Globals
.ldap_ssl
, NULL
, enum_ldap_ssl
, 0},
982 #endif /* WITH_LDAP */
984 {"Miscellaneous Options", P_SEP
, P_SEPARATOR
},
985 {"add share command", P_STRING
, P_GLOBAL
, &Globals
.szAddShareCommand
, NULL
, NULL
, 0},
986 {"change share command", P_STRING
, P_GLOBAL
, &Globals
.szChangeShareCommand
, NULL
, NULL
, 0},
987 {"delete share command", P_STRING
, P_GLOBAL
, &Globals
.szDeleteShareCommand
, NULL
, NULL
, 0},
989 {"config file", P_STRING
, P_GLOBAL
, &Globals
.szConfigFile
, NULL
, NULL
, FLAG_HIDE
},
990 {"preload", P_STRING
, P_GLOBAL
, &Globals
.szAutoServices
, NULL
, NULL
, FLAG_DOS_STRING
},
991 {"auto services", P_STRING
, P_GLOBAL
, &Globals
.szAutoServices
, NULL
, NULL
, FLAG_DOS_STRING
},
992 {"lock dir", P_STRING
, P_GLOBAL
, &Globals
.szLockDir
, NULL
, NULL
, 0},
993 {"lock directory", P_STRING
, P_GLOBAL
, &Globals
.szLockDir
, NULL
, NULL
, 0},
995 {"utmp directory", P_STRING
, P_GLOBAL
, &Globals
.szUtmpDir
, NULL
, NULL
, 0},
996 {"wtmp directory", P_STRING
, P_GLOBAL
, &Globals
.szWtmpDir
, NULL
, NULL
, 0},
997 {"utmp", P_BOOL
, P_GLOBAL
, &Globals
.bUtmp
, NULL
, NULL
, 0},
1000 {"default service", P_STRING
, P_GLOBAL
, &Globals
.szDefaultService
, NULL
, NULL
, FLAG_DOS_STRING
},
1001 {"default", P_STRING
, P_GLOBAL
, &Globals
.szDefaultService
, NULL
, NULL
, FLAG_DOS_STRING
},
1002 {"message command", P_STRING
, P_GLOBAL
, &Globals
.szMsgCommand
, NULL
, NULL
, 0},
1003 {"dfree command", P_STRING
, P_GLOBAL
, &Globals
.szDfree
, NULL
, NULL
, 0},
1004 {"valid chars", P_STRING
, P_GLOBAL
, &Globals
.szValidChars
, handle_valid_chars
, NULL
, 0},
1005 {"remote announce", P_STRING
, P_GLOBAL
, &Globals
.szRemoteAnnounce
, NULL
, NULL
, 0},
1006 {"remote browse sync", P_STRING
, P_GLOBAL
, &Globals
.szRemoteBrowseSync
, NULL
, NULL
, 0},
1007 {"socket address", P_STRING
, P_GLOBAL
, &Globals
.szSocketAddress
, NULL
, NULL
, 0},
1008 {"homedir map", P_STRING
, P_GLOBAL
, &Globals
.szNISHomeMapName
, NULL
, NULL
, 0},
1009 {"time offset", P_INTEGER
, P_GLOBAL
, &extra_time_offset
, NULL
, NULL
, 0},
1010 {"NIS homedir", P_BOOL
, P_GLOBAL
, &Globals
.bNISHomeMap
, NULL
, NULL
, 0},
1011 {"-valid", P_BOOL
, P_LOCAL
, &sDefault
.valid
, NULL
, NULL
, FLAG_HIDE
},
1013 {"copy", P_STRING
, P_LOCAL
, &sDefault
.szCopy
, handle_copy
, NULL
, FLAG_HIDE
},
1014 {"include", P_STRING
, P_LOCAL
, &sDefault
.szInclude
, handle_include
, NULL
, FLAG_HIDE
},
1015 {"exec", P_STRING
, P_LOCAL
, &sDefault
.szPreExec
, NULL
, NULL
, FLAG_SHARE
| FLAG_PRINT
},
1016 {"preexec", P_STRING
, P_LOCAL
, &sDefault
.szPreExec
, NULL
, NULL
, 0},
1018 {"preexec close", P_BOOL
, P_LOCAL
, &sDefault
.bPreexecClose
, NULL
, NULL
, FLAG_SHARE
},
1019 {"postexec", P_STRING
, P_LOCAL
, &sDefault
.szPostExec
, NULL
, NULL
, FLAG_SHARE
| FLAG_PRINT
},
1020 {"root preexec", P_STRING
, P_LOCAL
, &sDefault
.szRootPreExec
, NULL
, NULL
, FLAG_SHARE
| FLAG_PRINT
},
1021 {"root preexec close", P_BOOL
, P_LOCAL
, &sDefault
.bRootpreexecClose
, NULL
, NULL
, FLAG_SHARE
},
1022 {"root postexec", P_STRING
, P_LOCAL
, &sDefault
.szRootPostExec
, NULL
, NULL
, FLAG_SHARE
| FLAG_PRINT
},
1023 {"available", P_BOOL
, P_LOCAL
, &sDefault
.bAvailable
, NULL
, NULL
, FLAG_BASIC
| FLAG_SHARE
| FLAG_PRINT
},
1024 {"volume", P_STRING
, P_LOCAL
, &sDefault
.volume
, NULL
, NULL
, FLAG_SHARE
| FLAG_DOS_STRING
},
1025 {"fstype", P_STRING
, P_LOCAL
, &sDefault
.fstype
, NULL
, NULL
, FLAG_SHARE
},
1026 {"set directory", P_BOOLREV
, P_LOCAL
, &sDefault
.bNo_set_dir
, NULL
, NULL
, FLAG_SHARE
},
1027 {"source environment", P_STRING
, P_GLOBAL
, &Globals
.szSourceEnv
, handle_source_env
, NULL
, 0},
1028 {"wide links", P_BOOL
, P_LOCAL
, &sDefault
.bWidelinks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1029 {"follow symlinks", P_BOOL
, P_LOCAL
, &sDefault
.bSymlinks
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1030 {"dont descend", P_STRING
, P_LOCAL
, &sDefault
.szDontdescend
, NULL
, NULL
, FLAG_SHARE
},
1031 {"magic script", P_STRING
, P_LOCAL
, &sDefault
.szMagicScript
, NULL
, NULL
, FLAG_SHARE
},
1032 {"magic output", P_STRING
, P_LOCAL
, &sDefault
.szMagicOutput
, NULL
, NULL
, FLAG_SHARE
},
1033 {"delete readonly", P_BOOL
, P_LOCAL
, &sDefault
.bDeleteReadonly
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1034 {"dos filemode", P_BOOL
, P_LOCAL
, &sDefault
.bDosFilemode
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1035 {"dos filetimes", P_BOOL
, P_LOCAL
, &sDefault
.bDosFiletimes
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1036 {"dos filetime resolution", P_BOOL
, P_LOCAL
, &sDefault
.bDosFiletimeResolution
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1038 {"fake directory create times", P_BOOL
, P_LOCAL
, &sDefault
.bFakeDirCreateTimes
, NULL
, NULL
, FLAG_SHARE
| FLAG_GLOBAL
},
1039 {"panic action", P_STRING
, P_GLOBAL
, &Globals
.szPanicAction
, NULL
, NULL
, 0},
1040 {"hide local users", P_BOOL
, P_GLOBAL
, &Globals
.bHideLocalUsers
, NULL
,
1043 {"VFS options", P_SEP
, P_SEPARATOR
},
1045 {"vfs object", P_STRING
, P_LOCAL
, &sDefault
.szVfsObjectFile
, handle_vfs_object
, NULL
, FLAG_SHARE
},
1046 {"vfs options", P_STRING
, P_LOCAL
, &sDefault
.szVfsOptions
, NULL
, NULL
, FLAG_SHARE
},
1049 {"msdfs root", P_BOOL
, P_LOCAL
, &sDefault
.bMSDfsRoot
, NULL
, NULL
, FLAG_SHARE
},
1050 {"host msdfs", P_BOOL
, P_GLOBAL
, &Globals
.bHostMSDfs
, NULL
, NULL
, 0},
1052 {"Winbind options", P_SEP
, P_SEPARATOR
},
1054 {"winbind uid", P_STRING
, P_GLOBAL
, &Globals
.szWinbindUID
, handle_winbind_id
, NULL
, 0},
1055 {"winbind gid", P_STRING
, P_GLOBAL
, &Globals
.szWinbindGID
, handle_winbind_id
, NULL
, 0},
1056 {"template homedir", P_STRING
, P_GLOBAL
, &Globals
.szTemplateHomedir
, NULL
, NULL
, 0},
1057 {"template shell", P_STRING
, P_GLOBAL
, &Globals
.szTemplateShell
, NULL
, NULL
, 0},
1058 {"winbind separator", P_STRING
, P_GLOBAL
, &Globals
.szWinbindSeparator
, NULL
, NULL
, 0},
1059 {"winbind cache time", P_INTEGER
, P_GLOBAL
, &Globals
.winbind_cache_time
, NULL
, NULL
, 0},
1060 {"winbind enum users", P_BOOL
, P_GLOBAL
, &Globals
.bWinbindEnumUsers
, NULL
, NULL
, 0},
1061 {"winbind enum groups", P_BOOL
, P_GLOBAL
, &Globals
.bWinbindEnumGroups
, NULL
, NULL
, 0},
1063 {NULL
, P_BOOL
, P_NONE
, NULL
, NULL
, NULL
, 0}
1067 /***************************************************************************
1068 Initialise the sDefault parameter structure for the printer values.
1069 ***************************************************************************/
1070 static void init_printer_values(void)
1072 string_set(&sDefault
.szPrinterDriver
, "");
1073 string_set(&sDefault
.szDriverFile
, DRIVERFILE
);
1075 /* choose defaults depending on the type of printing */
1076 switch (sDefault
.iPrinting
)
1082 string_set(&sDefault
.szLpqcommand
, "lpq -P%p");
1083 string_set(&sDefault
.szLprmcommand
, "lprm -P%p %j");
1084 string_set(&sDefault
.szPrintcommand
,
1090 string_set(&sDefault
.szLpqcommand
, "lpq -P%p");
1091 string_set(&sDefault
.szLprmcommand
, "lprm -P%p %j");
1092 string_set(&sDefault
.szPrintcommand
,
1094 string_set(&sDefault
.szQueuepausecommand
,
1096 string_set(&sDefault
.szQueueresumecommand
,
1098 string_set(&sDefault
.szLppausecommand
,
1100 string_set(&sDefault
.szLpresumecommand
,
1101 "lpc release %p %j");
1106 string_set(&sDefault
.szLpqcommand
, "");
1107 string_set(&sDefault
.szLprmcommand
, "");
1108 string_set(&sDefault
.szPrintcommand
, "");
1109 string_set(&sDefault
.szLppausecommand
, "");
1110 string_set(&sDefault
.szLpresumecommand
, "");
1111 string_set(&sDefault
.szQueuepausecommand
, "");
1112 string_set(&sDefault
.szQueueresumecommand
, "");
1114 string_set(&Globals
.szPrintcapname
, "cups");
1116 string_set(&sDefault
.szLpqcommand
,
1117 "/usr/bin/lpstat -o %p");
1118 string_set(&sDefault
.szLprmcommand
,
1119 "/usr/bin/cancel %p-%j");
1120 string_set(&sDefault
.szPrintcommand
,
1121 "/usr/bin/lp -d %p %s; rm %s");
1122 string_set(&sDefault
.szLppausecommand
,
1123 "lp -i %p-%j -H hold");
1124 string_set(&sDefault
.szLpresumecommand
,
1125 "lp -i %p-%j -H resume");
1126 string_set(&sDefault
.szQueuepausecommand
,
1127 "/usr/bin/disable %p");
1128 string_set(&sDefault
.szQueueresumecommand
,
1129 "/usr/bin/enable %p");
1130 string_set(&Globals
.szPrintcapname
, "lpstat");
1131 #endif /* HAVE_CUPS */
1136 string_set(&sDefault
.szLpqcommand
, "lpstat -o%p");
1137 string_set(&sDefault
.szLprmcommand
, "cancel %p-%j");
1138 string_set(&sDefault
.szPrintcommand
,
1139 "lp -c -d%p %s; rm %s");
1140 string_set(&sDefault
.szQueuepausecommand
,
1142 string_set(&sDefault
.szQueueresumecommand
,
1145 string_set(&sDefault
.szLppausecommand
,
1146 "lp -i %p-%j -H hold");
1147 string_set(&sDefault
.szLpresumecommand
,
1148 "lp -i %p-%j -H resume");
1153 string_set(&sDefault
.szLpqcommand
, "lpq -P%p");
1154 string_set(&sDefault
.szLprmcommand
, "lprm -P%p %j");
1155 string_set(&sDefault
.szPrintcommand
, "lp -r -P%p %s");
1159 string_set(&sDefault
.szLpqcommand
, "qstat -l -d%p");
1160 string_set(&sDefault
.szLprmcommand
,
1161 "qstat -s -j%j -c");
1162 string_set(&sDefault
.szPrintcommand
,
1163 "lp -d%p -s %s; rm %s");
1164 string_set(&sDefault
.szLppausecommand
,
1165 "qstat -s -j%j -h");
1166 string_set(&sDefault
.szLpresumecommand
,
1167 "qstat -s -j%j -r");
1172 string_set(&sDefault
.szPrintcommand
, "vlp print %p %s");
1173 string_set(&sDefault
.szLpqcommand
, "vlp lpq %p");
1174 string_set(&sDefault
.szLprmcommand
, "vlp lprm %p %j");
1175 string_set(&sDefault
.szLppausecommand
, "vlp lppause %p %j");
1176 string_set(&sDefault
.szLpresumecommand
, "vlp lpresum %p %j");
1177 string_set(&sDefault
.szQueuepausecommand
, "vlp queuepause %p");
1178 string_set(&sDefault
.szQueueresumecommand
, "vlp queueresume %p");
1180 #endif /* DEVELOPER */
1185 /***************************************************************************
1186 Initialise the global parameter structure.
1187 ***************************************************************************/
1188 static void init_globals(void)
1190 static BOOL done_init
= False
;
1196 memset((void *)&Globals
, '\0', sizeof(Globals
));
1198 for (i
= 0; parm_table
[i
].label
; i
++)
1199 if ((parm_table
[i
].type
== P_STRING
||
1200 parm_table
[i
].type
== P_USTRING
) &&
1202 string_set(parm_table
[i
].ptr
, "");
1204 string_set(&sDefault
.szGuestaccount
, GUEST_ACCOUNT
);
1205 string_set(&sDefault
.fstype
, FSTYPE_STRING
);
1207 init_printer_values();
1213 DEBUG(3, ("Initialising global parameters\n"));
1216 string_set(&Globals
.szTDBPasswdFile
, TDB_PASSWD_FILE
);
1218 string_set(&Globals
.szSMBPasswdFile
, SMB_PASSWD_FILE
);
1221 * Allow the default PASSWD_CHAT to be overridden in local.h.
1223 string_set(&Globals
.szPasswdChat
, DEFAULT_PASSWD_CHAT
);
1224 string_set(&Globals
.szWorkGroup
, WORKGROUP
);
1225 string_set(&Globals
.szPasswdProgram
, PASSWD_PROGRAM
);
1226 string_set(&Globals
.szPrintcapname
, PRINTCAP_NAME
);
1227 string_set(&Globals
.szLockDir
, LOCKDIR
);
1229 string_set(&Globals
.szUtmpDir
, "");
1230 string_set(&Globals
.szWtmpDir
, "");
1231 Globals
.bUtmp
= False
;
1233 string_set(&Globals
.szSocketAddress
, "0.0.0.0");
1234 pstrcpy(s
, "Samba ");
1235 pstrcat(s
, VERSION
);
1236 string_set(&Globals
.szServerString
, s
);
1237 slprintf(s
, sizeof(s
) - 1, "%d.%d", DEFAULT_MAJOR_VERSION
,
1238 DEFAULT_MINOR_VERSION
);
1239 string_set(&Globals
.szAnnounceVersion
, s
);
1241 pstrcpy(user_socket_options
, DEFAULT_SOCKET_OPTIONS
);
1243 string_set(&Globals
.szLogonDrive
, "");
1244 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
1245 string_set(&Globals
.szLogonHome
, "\\\\%N\\%U");
1246 string_set(&Globals
.szLogonPath
, "\\\\%N\\%U\\profile");
1248 string_set(&Globals
.szNameResolveOrder
, "lmhosts host wins bcast");
1249 string_set(&Globals
.szCodePageDir
, CODEPAGEDIR
);
1251 Globals
.bLoadPrinters
= True
;
1252 Globals
.bUseRhosts
= False
;
1253 Globals
.max_packet
= 65535;
1254 Globals
.mangled_stack
= 50;
1255 Globals
.max_xmit
= 65535;
1256 Globals
.max_mux
= 50; /* This is *needed* for profile support. */
1257 Globals
.lpqcachetime
= 10;
1258 Globals
.bDisableSpoolss
= False
;
1259 Globals
.iMaxSmbdProcesses
= 0;/* no limit specified */
1260 Globals
.iTotalPrintJobs
= 0; /* no limit specified */
1261 Globals
.pwordlevel
= 0;
1262 Globals
.unamelevel
= 0;
1263 Globals
.deadtime
= 0;
1264 Globals
.bLargeReadwrite
= False
;
1265 Globals
.max_log_size
= 5000;
1266 Globals
.max_open_files
= MAX_OPEN_FILES
;
1267 Globals
.maxprotocol
= PROTOCOL_NT1
;
1268 Globals
.minprotocol
= PROTOCOL_CORE
;
1269 Globals
.security
= SEC_USER
;
1270 Globals
.bEncryptPasswords
= False
;
1271 Globals
.bUpdateEncrypt
= False
;
1272 Globals
.bReadRaw
= True
;
1273 Globals
.bWriteRaw
= True
;
1274 Globals
.bReadPrediction
= False
;
1275 Globals
.bReadbmpx
= False
;
1276 Globals
.bNullPasswords
= False
;
1277 Globals
.bObeyPamRestrictions
= False
;
1278 Globals
.bStripDot
= False
;
1280 Globals
.bSyslogOnly
= False
;
1281 Globals
.bTimestampLogs
= True
;
1282 Globals
.bDebugHiresTimestamp
= False
;
1283 Globals
.bDebugPid
= False
;
1284 Globals
.bDebugUid
= False
;
1285 Globals
.max_ttl
= 60 * 60 * 24 * 3; /* 3 days default. */
1286 Globals
.max_wins_ttl
= 60 * 60 * 24 * 6; /* 6 days default. */
1287 Globals
.min_wins_ttl
= 60 * 60 * 6; /* 6 hours default. */
1288 Globals
.machine_password_timeout
= 60 * 60 * 24 * 7; /* 7 days default. */
1289 Globals
.change_notify_timeout
= 60; /* 1 minute default. */
1290 Globals
.ReadSize
= 16 * 1024;
1291 Globals
.lm_announce
= 2; /* = Auto: send only if LM clients found */
1292 Globals
.lm_interval
= 60;
1293 Globals
.stat_cache_size
= 50; /* Number of stat translations we'll keep */
1294 Globals
.announce_as
= ANNOUNCE_AS_NT_SERVER
;
1295 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
1296 Globals
.bNISHomeMap
= False
;
1297 #ifdef WITH_NISPLUS_HOME
1298 string_set(&Globals
.szNISHomeMapName
, "auto_home.org_dir");
1300 string_set(&Globals
.szNISHomeMapName
, "auto.home");
1303 Globals
.client_code_page
= DEFAULT_CLIENT_CODE_PAGE
;
1304 Globals
.bTimeServer
= False
;
1305 Globals
.bBindInterfacesOnly
= False
;
1306 Globals
.bUnixPasswdSync
= False
;
1307 Globals
.bPamPasswordChange
= False
;
1308 Globals
.bPasswdChatDebug
= False
;
1309 Globals
.bNTSmbSupport
= True
; /* Do NT SMB's by default. */
1310 Globals
.bNTPipeSupport
= True
; /* Do NT pipes by default. */
1311 Globals
.bNTAclSupport
= True
; /* Use NT ACLs by default. */
1312 Globals
.bStatCache
= True
; /* use stat cache by default */
1313 Globals
.bRestrictAnonymous
= False
;
1314 Globals
.bLanmanAuth
= True
; /* Do use the LanMan hash if it is available */
1315 Globals
.map_to_guest
= 0; /* By Default, "Never" */
1316 Globals
.min_passwd_length
= MINPASSWDLENGTH
; /* By Default, 5. */
1317 Globals
.oplock_break_wait_time
= 0; /* By Default, 0 msecs. */
1318 Globals
.enhanced_browsing
= True
;
1319 #ifdef MMAP_BLACKLIST
1320 Globals
.bUseMmap
= False
;
1322 Globals
.bUseMmap
= True
;
1326 Globals
.sslVersion
= SMB_SSL_V23
;
1327 string_set(&Globals
.sslHostsRequire
, "");
1328 string_set(&Globals
.sslHostsResign
, "");
1329 string_set(&Globals
.sslCaCertDir
, "");
1330 string_set(&Globals
.sslCaCertFile
, "");
1331 string_set(&Globals
.sslCert
, "");
1332 string_set(&Globals
.sslPrivKey
, "");
1333 string_set(&Globals
.sslClientCert
, "");
1334 string_set(&Globals
.sslClientPrivKey
, "");
1335 string_set(&Globals
.sslCiphers
, "");
1336 Globals
.sslEnabled
= False
;
1337 Globals
.sslReqClientCert
= False
;
1338 Globals
.sslReqServerCert
= False
;
1339 Globals
.sslCompatibility
= False
;
1340 #endif /* WITH_SSL */
1343 string_set(&Globals
.szLdapServer
, "localhost");
1344 string_set(&Globals
.szLdapSuffix
, "");
1345 string_set(&Globals
.szLdapFilter
, "(&(uid=%u)(objectclass=sambaAccount))");
1346 string_set(&Globals
.szLdapRoot
, "");
1347 string_set(&Globals
.szLdapRootPassword
, "");
1348 Globals
.ldap_port
= 389;
1349 Globals
.ldap_schema
= SCHEMA_COMPAT
;
1350 Globals
.ldap_ssl
= LDAP_SSL_OFF
;
1351 #endif /* WITH_LDAP */
1352 /* these parameters are set to defaults that are more appropriate
1353 for the increasing samba install base:
1355 as a member of the workgroup, that will possibly become a
1356 _local_ master browser (lm = True). this is opposed to a forced
1357 local master browser startup (pm = True).
1359 doesn't provide WINS server service by default (wsupp = False),
1360 and doesn't provide domain master browser services by default, either.
1364 Globals
.bMsAddPrinterWizard
= True
;
1365 Globals
.bPreferredMaster
= Auto
; /* depending on bDomainMaster */
1366 Globals
.os_level
= 20;
1367 Globals
.bLocalMaster
= True
;
1368 Globals
.bDomainMaster
= Auto
; /* depending on bDomainLogons */
1369 Globals
.bDomainLogons
= False
;
1370 Globals
.bBrowseList
= True
;
1371 Globals
.bWINSsupport
= False
;
1372 Globals
.bWINSproxy
= False
;
1374 Globals
.bDNSproxy
= True
;
1376 /* this just means to use them if they exist */
1377 Globals
.bKernelOplocks
= True
;
1379 Globals
.bAllowTrustedDomains
= True
;
1381 string_set(&Globals
.szTemplateShell
, "/bin/false");
1382 string_set(&Globals
.szTemplateHomedir
, "/home/%D/%U");
1383 string_set(&Globals
.szWinbindSeparator
, "\\");
1384 Globals
.winbind_cache_time
= 15;
1386 Globals
.bWinbindEnumUsers
= True
;
1387 Globals
.bWinbindEnumGroups
= True
;
1390 * This must be done last as it checks the value in
1394 interpret_coding_system(KANJI
);
1397 static TALLOC_CTX
*lp_talloc
;
1399 /******************************************************************* a
1400 free up temporary memory - called from the main loop
1401 ********************************************************************/
1402 void lp_talloc_free(void)
1406 talloc_destroy(lp_talloc
);
1410 /*******************************************************************
1411 convenience routine to grab string parameters into temporary memory
1412 and run standard_sub_basic on them. The buffers can be written to by
1413 callers without affecting the source string.
1414 ********************************************************************/
1415 static char *lp_string(const char *s
)
1417 size_t len
= s
? strlen(s
) : 0;
1421 lp_talloc
= talloc_init();
1423 ret
= (char *)talloc(lp_talloc
, len
+ 100); /* leave room for substitution */
1431 StrnCpy(ret
, s
, len
);
1433 trim_string(ret
, "\"", "\"");
1435 standard_sub_basic(ret
);
1441 In this section all the functions that are used to access the
1442 parameters from the rest of the program are defined
1445 #define FN_GLOBAL_STRING(fn_name,ptr) \
1446 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
1447 #define FN_GLOBAL_BOOL(fn_name,ptr) \
1448 BOOL fn_name(void) {return(*(BOOL *)(ptr));}
1449 #define FN_GLOBAL_CHAR(fn_name,ptr) \
1450 char fn_name(void) {return(*(char *)(ptr));}
1451 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
1452 int fn_name(void) {return(*(int *)(ptr));}
1454 #define FN_LOCAL_STRING(fn_name,val) \
1455 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
1456 #define FN_LOCAL_BOOL(fn_name,val) \
1457 BOOL fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1458 #define FN_LOCAL_CHAR(fn_name,val) \
1459 char fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1460 #define FN_LOCAL_INTEGER(fn_name,val) \
1461 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1463 FN_GLOBAL_STRING(lp_logfile
, &Globals
.szLogFile
)
1464 FN_GLOBAL_STRING(lp_configfile
, &Globals
.szConfigFile
)
1466 FN_GLOBAL_STRING(lp_tdb_passwd_file
, &Globals
.szTDBPasswdFile
)
1468 FN_GLOBAL_STRING(lp_smb_passwd_file
, &Globals
.szSMBPasswdFile
)
1470 FN_GLOBAL_STRING(lp_serverstring
, &Globals
.szServerString
)
1471 FN_GLOBAL_STRING(lp_printcapname
, &Globals
.szPrintcapname
)
1472 FN_GLOBAL_STRING(lp_enumports_cmd
, &Globals
.szEnumPortsCommand
)
1473 FN_GLOBAL_STRING(lp_addprinter_cmd
, &Globals
.szAddPrinterCommand
)
1474 FN_GLOBAL_STRING(lp_deleteprinter_cmd
, &Globals
.szDeletePrinterCommand
)
1475 FN_GLOBAL_STRING(lp_os2_driver_map
, &Globals
.szOs2DriverMap
)
1476 FN_GLOBAL_STRING(lp_lockdir
, &Globals
.szLockDir
)
1478 FN_GLOBAL_STRING(lp_utmpdir
, &Globals
.szUtmpDir
)
1479 FN_GLOBAL_STRING(lp_wtmpdir
, &Globals
.szWtmpDir
)
1480 FN_GLOBAL_BOOL(lp_utmp
, &Globals
.bUtmp
)
1482 FN_GLOBAL_STRING(lp_rootdir
, &Globals
.szRootdir
)
1483 FN_GLOBAL_STRING(lp_source_environment
, &Globals
.szSourceEnv
)
1484 FN_GLOBAL_STRING(lp_defaultservice
, &Globals
.szDefaultService
)
1485 FN_GLOBAL_STRING(lp_msg_command
, &Globals
.szMsgCommand
)
1486 FN_GLOBAL_STRING(lp_dfree_command
, &Globals
.szDfree
)
1487 FN_GLOBAL_STRING(lp_hosts_equiv
, &Globals
.szHostsEquiv
)
1488 FN_GLOBAL_STRING(lp_auto_services
, &Globals
.szAutoServices
)
1489 FN_GLOBAL_STRING(lp_passwd_program
, &Globals
.szPasswdProgram
)
1490 FN_GLOBAL_STRING(lp_passwd_chat
, &Globals
.szPasswdChat
)
1491 FN_GLOBAL_STRING(lp_passwordserver
, &Globals
.szPasswordServer
)
1492 FN_GLOBAL_STRING(lp_name_resolve_order
, &Globals
.szNameResolveOrder
)
1493 FN_GLOBAL_STRING(lp_workgroup
, &Globals
.szWorkGroup
)
1494 FN_GLOBAL_STRING(lp_username_map
, &Globals
.szUsernameMap
)
1495 #ifdef USING_GROUPNAME_MAP
1496 FN_GLOBAL_STRING(lp_groupname_map
, &Globals
.szGroupnameMap
)
1497 #endif /* USING_GROUPNAME_MAP */
1498 FN_GLOBAL_STRING(lp_logon_script
, &Globals
.szLogonScript
)
1499 FN_GLOBAL_STRING(lp_logon_path
, &Globals
.szLogonPath
)
1500 FN_GLOBAL_STRING(lp_logon_drive
, &Globals
.szLogonDrive
)
1501 FN_GLOBAL_STRING(lp_logon_home
, &Globals
.szLogonHome
)
1502 FN_GLOBAL_STRING(lp_remote_announce
, &Globals
.szRemoteAnnounce
)
1503 FN_GLOBAL_STRING(lp_remote_browse_sync
, &Globals
.szRemoteBrowseSync
)
1504 FN_GLOBAL_STRING(lp_wins_server
, &Globals
.szWINSserver
)
1505 FN_GLOBAL_STRING(lp_interfaces
, &Globals
.szInterfaces
)
1506 FN_GLOBAL_STRING(lp_socket_address
, &Globals
.szSocketAddress
)
1507 FN_GLOBAL_STRING(lp_nis_home_map_name
, &Globals
.szNISHomeMapName
)
1508 static FN_GLOBAL_STRING(lp_announce_version
, &Globals
.szAnnounceVersion
)
1509 FN_GLOBAL_STRING(lp_netbios_aliases
, &Globals
.szNetbiosAliases
)
1510 FN_GLOBAL_STRING(lp_panic_action
, &Globals
.szPanicAction
)
1511 FN_GLOBAL_STRING(lp_adduser_script
, &Globals
.szAddUserScript
)
1512 FN_GLOBAL_STRING(lp_deluser_script
, &Globals
.szDelUserScript
)
1513 FN_GLOBAL_STRING(lp_wins_hook
, &Globals
.szWINSHook
)
1514 FN_GLOBAL_STRING(lp_domain_admin_group
, &Globals
.szDomainAdminGroup
)
1515 FN_GLOBAL_STRING(lp_domain_guest_group
, &Globals
.szDomainGuestGroup
)
1516 FN_GLOBAL_STRING(lp_winbind_uid
, &Globals
.szWinbindUID
)
1517 FN_GLOBAL_STRING(lp_winbind_gid
, &Globals
.szWinbindGID
)
1518 FN_GLOBAL_STRING(lp_template_homedir
, &Globals
.szTemplateHomedir
)
1519 FN_GLOBAL_STRING(lp_template_shell
, &Globals
.szTemplateShell
)
1520 FN_GLOBAL_STRING(lp_winbind_separator
, &Globals
.szWinbindSeparator
)
1521 FN_GLOBAL_BOOL(lp_winbind_enum_users
, &Globals
.bWinbindEnumUsers
)
1522 FN_GLOBAL_BOOL(lp_winbind_enum_groups
, &Globals
.bWinbindEnumGroups
)
1523 FN_GLOBAL_STRING(lp_codepagedir
,&Globals
.szCodePageDir
)
1525 FN_GLOBAL_STRING(lp_ldap_server
, &Globals
.szLdapServer
)
1526 FN_GLOBAL_STRING(lp_ldap_suffix
, &Globals
.szLdapSuffix
)
1527 FN_GLOBAL_STRING(lp_ldap_filter
, &Globals
.szLdapFilter
)
1528 FN_GLOBAL_STRING(lp_ldap_root
, &Globals
.szLdapRoot
)
1529 FN_GLOBAL_STRING(lp_ldap_rootpasswd
, &Globals
.szLdapRootPassword
)
1530 FN_GLOBAL_INTEGER(lp_ldap_schema
, &Globals
.ldap_schema
)
1531 FN_GLOBAL_INTEGER(lp_ldap_port
, &Globals
.ldap_port
)
1532 FN_GLOBAL_INTEGER(lp_ldap_ssl
, &Globals
.ldap_ssl
)
1533 #endif /* WITH_LDAP */
1534 FN_GLOBAL_STRING(lp_add_share_cmd
, &Globals
.szAddShareCommand
)
1535 FN_GLOBAL_STRING(lp_change_share_cmd
, &Globals
.szChangeShareCommand
)
1536 FN_GLOBAL_STRING(lp_delete_share_cmd
, &Globals
.szDeleteShareCommand
)
1539 FN_GLOBAL_INTEGER(lp_ssl_version
, &Globals
.sslVersion
)
1540 FN_GLOBAL_STRING(lp_ssl_hosts
, &Globals
.sslHostsRequire
)
1541 FN_GLOBAL_STRING(lp_ssl_hosts_resign
, &Globals
.sslHostsResign
)
1542 FN_GLOBAL_STRING(lp_ssl_cacertdir
, &Globals
.sslCaCertDir
)
1543 FN_GLOBAL_STRING(lp_ssl_cacertfile
, &Globals
.sslCaCertFile
)
1544 FN_GLOBAL_STRING(lp_ssl_cert
, &Globals
.sslCert
)
1545 FN_GLOBAL_STRING(lp_ssl_privkey
, &Globals
.sslPrivKey
)
1546 FN_GLOBAL_STRING(lp_ssl_client_cert
, &Globals
.sslClientCert
)
1547 FN_GLOBAL_STRING(lp_ssl_client_privkey
, &Globals
.sslClientPrivKey
)
1548 FN_GLOBAL_STRING(lp_ssl_ciphers
, &Globals
.sslCiphers
)
1549 FN_GLOBAL_BOOL(lp_ssl_enabled
, &Globals
.sslEnabled
)
1550 FN_GLOBAL_BOOL(lp_ssl_reqClientCert
, &Globals
.sslReqClientCert
)
1551 FN_GLOBAL_BOOL(lp_ssl_reqServerCert
, &Globals
.sslReqServerCert
)
1552 FN_GLOBAL_BOOL(lp_ssl_compatibility
, &Globals
.sslCompatibility
)
1553 #endif /* WITH_SSL */
1555 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard
, &Globals
.bMsAddPrinterWizard
)
1556 FN_GLOBAL_BOOL(lp_dns_proxy
, &Globals
.bDNSproxy
)
1557 FN_GLOBAL_BOOL(lp_wins_support
, &Globals
.bWINSsupport
)
1558 FN_GLOBAL_BOOL(lp_we_are_a_wins_server
, &Globals
.bWINSsupport
)
1559 FN_GLOBAL_BOOL(lp_wins_proxy
, &Globals
.bWINSproxy
)
1560 FN_GLOBAL_BOOL(lp_local_master
, &Globals
.bLocalMaster
)
1561 FN_GLOBAL_BOOL(lp_domain_logons
, &Globals
.bDomainLogons
)
1562 FN_GLOBAL_BOOL(lp_load_printers
, &Globals
.bLoadPrinters
)
1563 FN_GLOBAL_BOOL(lp_use_rhosts
, &Globals
.bUseRhosts
)
1564 FN_GLOBAL_BOOL(lp_readprediction
, &Globals
.bReadPrediction
)
1565 FN_GLOBAL_BOOL(lp_readbmpx
, &Globals
.bReadbmpx
)
1566 FN_GLOBAL_BOOL(lp_readraw
, &Globals
.bReadRaw
)
1567 FN_GLOBAL_BOOL(lp_large_readwrite
, &Globals
.bLargeReadwrite
)
1568 FN_GLOBAL_BOOL(lp_writeraw
, &Globals
.bWriteRaw
)
1569 FN_GLOBAL_BOOL(lp_null_passwords
, &Globals
.bNullPasswords
)
1570 FN_GLOBAL_BOOL(lp_obey_pam_restrictions
, &Globals
.bObeyPamRestrictions
)
1571 FN_GLOBAL_BOOL(lp_strip_dot
, &Globals
.bStripDot
)
1572 FN_GLOBAL_BOOL(lp_encrypted_passwords
, &Globals
.bEncryptPasswords
)
1573 FN_GLOBAL_BOOL(lp_update_encrypted
, &Globals
.bUpdateEncrypt
)
1574 FN_GLOBAL_BOOL(lp_syslog_only
, &Globals
.bSyslogOnly
)
1575 FN_GLOBAL_BOOL(lp_timestamp_logs
, &Globals
.bTimestampLogs
)
1576 FN_GLOBAL_BOOL(lp_debug_hires_timestamp
, &Globals
.bDebugHiresTimestamp
)
1577 FN_GLOBAL_BOOL(lp_debug_pid
, &Globals
.bDebugPid
)
1578 FN_GLOBAL_BOOL(lp_debug_uid
, &Globals
.bDebugUid
)
1579 FN_GLOBAL_BOOL(lp_browse_list
, &Globals
.bBrowseList
)
1580 FN_GLOBAL_BOOL(lp_nis_home_map
, &Globals
.bNISHomeMap
)
1581 static FN_GLOBAL_BOOL(lp_time_server
, &Globals
.bTimeServer
)
1582 FN_GLOBAL_BOOL(lp_bind_interfaces_only
, &Globals
.bBindInterfacesOnly
)
1583 FN_GLOBAL_BOOL(lp_pam_password_change
, &Globals
.bPamPasswordChange
)
1584 FN_GLOBAL_BOOL(lp_unix_password_sync
, &Globals
.bUnixPasswdSync
)
1585 FN_GLOBAL_BOOL(lp_passwd_chat_debug
, &Globals
.bPasswdChatDebug
)
1586 FN_GLOBAL_BOOL(lp_nt_smb_support
, &Globals
.bNTSmbSupport
)
1587 FN_GLOBAL_BOOL(lp_nt_pipe_support
, &Globals
.bNTPipeSupport
)
1588 FN_GLOBAL_BOOL(lp_nt_acl_support
, &Globals
.bNTAclSupport
)
1589 FN_GLOBAL_BOOL(lp_stat_cache
, &Globals
.bStatCache
)
1590 FN_GLOBAL_BOOL(lp_allow_trusted_domains
, &Globals
.bAllowTrustedDomains
)
1591 FN_GLOBAL_BOOL(lp_restrict_anonymous
, &Globals
.bRestrictAnonymous
)
1592 FN_GLOBAL_BOOL(lp_lanman_auth
, &Globals
.bLanmanAuth
)
1593 FN_GLOBAL_BOOL(lp_host_msdfs
, &Globals
.bHostMSDfs
)
1594 FN_GLOBAL_BOOL(lp_kernel_oplocks
, &Globals
.bKernelOplocks
)
1595 FN_GLOBAL_BOOL(lp_enhanced_browsing
, &Globals
.enhanced_browsing
)
1596 FN_GLOBAL_BOOL(lp_use_mmap
, &Globals
.bUseMmap
)
1597 FN_GLOBAL_INTEGER(lp_os_level
, &Globals
.os_level
)
1598 FN_GLOBAL_INTEGER(lp_max_ttl
, &Globals
.max_ttl
)
1599 FN_GLOBAL_INTEGER(lp_max_wins_ttl
, &Globals
.max_wins_ttl
)
1600 FN_GLOBAL_INTEGER(lp_min_wins_ttl
, &Globals
.min_wins_ttl
)
1601 FN_GLOBAL_INTEGER(lp_max_log_size
, &Globals
.max_log_size
)
1602 FN_GLOBAL_INTEGER(lp_max_open_files
, &Globals
.max_open_files
)
1603 FN_GLOBAL_INTEGER(lp_maxxmit
, &Globals
.max_xmit
)
1604 FN_GLOBAL_INTEGER(lp_maxmux
, &Globals
.max_mux
)
1605 FN_GLOBAL_INTEGER(lp_passwordlevel
, &Globals
.pwordlevel
)
1606 FN_GLOBAL_INTEGER(lp_usernamelevel
, &Globals
.unamelevel
)
1607 FN_GLOBAL_INTEGER(lp_readsize
, &Globals
.ReadSize
)
1608 FN_GLOBAL_INTEGER(lp_deadtime
, &Globals
.deadtime
)
1609 FN_GLOBAL_INTEGER(lp_maxprotocol
, &Globals
.maxprotocol
)
1610 FN_GLOBAL_INTEGER(lp_minprotocol
, &Globals
.minprotocol
)
1611 FN_GLOBAL_INTEGER(lp_security
, &Globals
.security
)
1612 FN_GLOBAL_INTEGER(lp_maxdisksize
, &Globals
.maxdisksize
)
1613 FN_GLOBAL_INTEGER(lp_lpqcachetime
, &Globals
.lpqcachetime
)
1614 FN_GLOBAL_INTEGER(lp_max_smbd_processes
, &Globals
.iMaxSmbdProcesses
)
1615 FN_GLOBAL_INTEGER(lp_disable_spoolss
, &Globals
.bDisableSpoolss
)
1616 FN_GLOBAL_INTEGER(lp_totalprintjobs
, &Globals
.iTotalPrintJobs
)
1617 FN_GLOBAL_INTEGER(lp_syslog
, &Globals
.syslog
)
1618 FN_GLOBAL_INTEGER(lp_client_code_page
, &Globals
.client_code_page
)
1619 static FN_GLOBAL_INTEGER(lp_announce_as
, &Globals
.announce_as
)
1620 FN_GLOBAL_INTEGER(lp_lm_announce
, &Globals
.lm_announce
)
1621 FN_GLOBAL_INTEGER(lp_lm_interval
, &Globals
.lm_interval
)
1622 FN_GLOBAL_INTEGER(lp_machine_password_timeout
, &Globals
.machine_password_timeout
)
1623 FN_GLOBAL_INTEGER(lp_change_notify_timeout
, &Globals
.change_notify_timeout
)
1624 FN_GLOBAL_INTEGER(lp_stat_cache_size
, &Globals
.stat_cache_size
)
1625 FN_GLOBAL_INTEGER(lp_map_to_guest
, &Globals
.map_to_guest
)
1626 FN_GLOBAL_INTEGER(lp_min_passwd_length
, &Globals
.min_passwd_length
)
1627 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time
, &Globals
.oplock_break_wait_time
)
1628 FN_LOCAL_STRING(lp_preexec
, szPreExec
)
1629 FN_LOCAL_STRING(lp_postexec
, szPostExec
)
1630 FN_LOCAL_STRING(lp_rootpreexec
, szRootPreExec
)
1631 FN_LOCAL_STRING(lp_rootpostexec
, szRootPostExec
)
1632 FN_LOCAL_STRING(lp_servicename
, szService
)
1633 FN_LOCAL_STRING(lp_pathname
, szPath
)
1634 FN_LOCAL_STRING(lp_dontdescend
, szDontdescend
)
1635 FN_LOCAL_STRING(lp_username
, szUsername
)
1636 FN_LOCAL_STRING(lp_guestaccount
, szGuestaccount
)
1637 FN_LOCAL_STRING(lp_invalid_users
, szInvalidUsers
)
1638 FN_LOCAL_STRING(lp_valid_users
, szValidUsers
)
1639 FN_LOCAL_STRING(lp_admin_users
, szAdminUsers
)
1640 FN_LOCAL_STRING(lp_printcommand
, szPrintcommand
)
1641 FN_LOCAL_STRING(lp_lpqcommand
, szLpqcommand
)
1642 FN_LOCAL_STRING(lp_lprmcommand
, szLprmcommand
)
1643 FN_LOCAL_STRING(lp_lppausecommand
, szLppausecommand
)
1644 FN_LOCAL_STRING(lp_lpresumecommand
, szLpresumecommand
)
1645 FN_LOCAL_STRING(lp_queuepausecommand
, szQueuepausecommand
)
1646 FN_LOCAL_STRING(lp_queueresumecommand
, szQueueresumecommand
)
1647 static FN_LOCAL_STRING(_lp_printername
, szPrintername
)
1648 FN_LOCAL_STRING(lp_driverfile
, szDriverFile
)
1649 FN_LOCAL_STRING(lp_printerdriver
, szPrinterDriver
)
1650 FN_LOCAL_STRING(lp_hostsallow
, szHostsallow
)
1651 FN_LOCAL_STRING(lp_hostsdeny
, szHostsdeny
)
1652 FN_LOCAL_STRING(lp_magicscript
, szMagicScript
)
1653 FN_LOCAL_STRING(lp_magicoutput
, szMagicOutput
)
1654 FN_LOCAL_STRING(lp_comment
, comment
)
1655 FN_LOCAL_STRING(lp_force_user
, force_user
)
1656 FN_LOCAL_STRING(lp_force_group
, force_group
)
1657 FN_LOCAL_STRING(lp_readlist
, readlist
)
1658 FN_LOCAL_STRING(lp_writelist
, writelist
)
1659 FN_LOCAL_STRING(lp_printer_admin
, printer_admin
)
1660 FN_LOCAL_STRING(lp_fstype
, fstype
)
1661 FN_LOCAL_STRING(lp_vfsobj
, szVfsObjectFile
)
1662 static FN_LOCAL_STRING(lp_volume
, volume
)
1663 FN_LOCAL_STRING(lp_mangled_map
, szMangledMap
)
1664 FN_LOCAL_STRING(lp_veto_files
, szVetoFiles
)
1665 FN_LOCAL_STRING(lp_hide_files
, szHideFiles
)
1666 FN_LOCAL_STRING(lp_veto_oplocks
, szVetoOplockFiles
)
1667 FN_LOCAL_STRING(lp_driverlocation
, szPrinterDriverLocation
)
1668 FN_LOCAL_BOOL(lp_msdfs_root
, bMSDfsRoot
)
1669 FN_LOCAL_BOOL(lp_autoloaded
, autoloaded
)
1670 FN_LOCAL_BOOL(lp_preexec_close
, bPreexecClose
)
1671 FN_LOCAL_BOOL(lp_rootpreexec_close
, bRootpreexecClose
)
1672 FN_LOCAL_BOOL(lp_casesensitive
, bCaseSensitive
)
1673 FN_LOCAL_BOOL(lp_preservecase
, bCasePreserve
)
1674 FN_LOCAL_BOOL(lp_shortpreservecase
, bShortCasePreserve
)
1675 FN_LOCAL_BOOL(lp_casemangle
, bCaseMangle
)
1676 FN_LOCAL_BOOL(lp_status
, status
)
1677 FN_LOCAL_BOOL(lp_hide_dot_files
, bHideDotFiles
)
1678 FN_LOCAL_BOOL(lp_hideunreadable
, bHideUnReadable
)
1679 FN_LOCAL_BOOL(lp_browseable
, bBrowseable
)
1680 FN_LOCAL_BOOL(lp_readonly
, bRead_only
)
1681 FN_LOCAL_BOOL(lp_no_set_dir
, bNo_set_dir
)
1682 FN_LOCAL_BOOL(lp_guest_ok
, bGuest_ok
)
1683 FN_LOCAL_BOOL(lp_guest_only
, bGuest_only
)
1684 FN_LOCAL_BOOL(lp_print_ok
, bPrint_ok
)
1685 FN_LOCAL_BOOL(lp_postscript
, bPostscript
)
1686 FN_LOCAL_BOOL(lp_map_hidden
, bMap_hidden
)
1687 FN_LOCAL_BOOL(lp_map_archive
, bMap_archive
)
1688 FN_LOCAL_BOOL(lp_locking
, bLocking
)
1689 FN_LOCAL_BOOL(lp_strict_locking
, bStrictLocking
)
1690 FN_LOCAL_BOOL(lp_posix_locking
, bPosixLocking
)
1691 FN_LOCAL_BOOL(lp_oplocks
, bOpLocks
)
1692 FN_LOCAL_BOOL(lp_level2_oplocks
, bLevel2OpLocks
)
1693 FN_LOCAL_BOOL(lp_onlyuser
, bOnlyUser
)
1694 FN_LOCAL_BOOL(lp_manglednames
, bMangledNames
)
1695 FN_LOCAL_BOOL(lp_widelinks
, bWidelinks
)
1696 FN_LOCAL_BOOL(lp_symlinks
, bSymlinks
)
1697 FN_LOCAL_BOOL(lp_syncalways
, bSyncAlways
)
1698 FN_LOCAL_BOOL(lp_strict_allocate
, bStrictAllocate
)
1699 FN_LOCAL_BOOL(lp_strict_sync
, bStrictSync
)
1700 FN_LOCAL_BOOL(lp_map_system
, bMap_system
)
1701 FN_LOCAL_BOOL(lp_delete_readonly
, bDeleteReadonly
)
1702 FN_LOCAL_BOOL(lp_fake_oplocks
, bFakeOplocks
)
1703 FN_LOCAL_BOOL(lp_recursive_veto_delete
, bDeleteVetoFiles
)
1704 FN_LOCAL_BOOL(lp_dos_filemode
, bDosFilemode
)
1705 FN_LOCAL_BOOL(lp_dos_filetimes
, bDosFiletimes
)
1706 FN_LOCAL_BOOL(lp_dos_filetime_resolution
, bDosFiletimeResolution
)
1707 FN_LOCAL_BOOL(lp_fake_dir_create_times
, bFakeDirCreateTimes
)
1708 FN_LOCAL_BOOL(lp_blocking_locks
, bBlockingLocks
)
1709 FN_LOCAL_BOOL(lp_inherit_perms
, bInheritPerms
)
1710 FN_LOCAL_BOOL(lp_use_client_driver
, bUseClientDriver
)
1711 FN_LOCAL_INTEGER(lp_create_mask
, iCreate_mask
)
1712 FN_LOCAL_INTEGER(lp_force_create_mode
, iCreate_force_mode
)
1713 FN_LOCAL_INTEGER(lp_security_mask
, iSecurity_mask
)
1714 FN_LOCAL_INTEGER(lp_force_security_mode
, iSecurity_force_mode
)
1715 FN_LOCAL_INTEGER(lp_dir_mask
, iDir_mask
)
1716 FN_LOCAL_INTEGER(lp_force_dir_mode
, iDir_force_mode
)
1717 FN_LOCAL_INTEGER(lp_dir_security_mask
, iDir_Security_mask
)
1718 FN_LOCAL_INTEGER(lp_force_dir_security_mode
, iDir_Security_force_mode
)
1719 FN_LOCAL_INTEGER(lp_max_connections
, iMaxConnections
)
1720 FN_LOCAL_INTEGER(lp_defaultcase
, iDefaultCase
)
1721 FN_LOCAL_INTEGER(lp_minprintspace
, iMinPrintSpace
)
1722 FN_LOCAL_INTEGER(lp_maxprintjobs
, iMaxPrintJobs
)
1723 FN_LOCAL_INTEGER(lp_printing
, iPrinting
)
1724 FN_LOCAL_INTEGER(lp_oplock_contention_limit
, iOplockContentionLimit
)
1725 FN_LOCAL_INTEGER(lp_write_cache_size
, iWriteCacheSize
)
1726 FN_LOCAL_CHAR(lp_magicchar
, magic_char
)
1727 FN_GLOBAL_INTEGER(lp_winbind_cache_time
, &Globals
.winbind_cache_time
)
1728 FN_GLOBAL_BOOL(lp_hide_local_users
, &Globals
.bHideLocalUsers
)
1730 /* local prototypes */
1732 static int map_parameter(char *pszParmName
);
1733 static BOOL
set_boolean(BOOL
*pb
, char *pszParmValue
);
1734 static int getservicebyname(char *pszServiceName
,
1735 service
* pserviceDest
);
1736 static void copy_service(service
* pserviceDest
,
1737 service
* pserviceSource
, BOOL
*pcopymapDest
);
1738 static BOOL
service_ok(int iService
);
1739 static BOOL
do_parameter(char *pszParmName
, char *pszParmValue
);
1740 static BOOL
do_section(char *pszSectionName
);
1741 static void init_copymap(service
* pservice
);
1744 /***************************************************************************
1745 initialise a service to the defaults
1746 ***************************************************************************/
1747 static void init_service(service
* pservice
)
1749 memset((char *)pservice
, '\0', sizeof(service
));
1750 copy_service(pservice
, &sDefault
, NULL
);
1754 /***************************************************************************
1755 free the dynamically allocated parts of a service struct
1756 ***************************************************************************/
1757 static void free_service(service
* pservice
)
1763 if (pservice
->szService
)
1765 ("free_service: Freeing service %s\n",
1766 pservice
->szService
));
1768 string_free(&pservice
->szService
);
1769 if (pservice
->copymap
)
1771 free(pservice
->copymap
);
1772 pservice
->copymap
= NULL
;
1775 for (i
= 0; parm_table
[i
].label
; i
++)
1776 if ((parm_table
[i
].type
== P_STRING
||
1777 parm_table
[i
].type
== P_USTRING
) &&
1778 parm_table
[i
].class == P_LOCAL
)
1779 string_free((char **)
1780 (((char *)pservice
) +
1781 PTR_DIFF(parm_table
[i
].ptr
, &sDefault
)));
1783 ZERO_STRUCTP(pservice
);
1786 /***************************************************************************
1787 add a new service to the services array initialising it with the given
1788 service. name must be in DOS codepage.
1789 ***************************************************************************/
1790 static int add_a_service(service
* pservice
, char *name
)
1794 int num_to_alloc
= iNumServices
+ 1;
1796 tservice
= *pservice
;
1798 /* it might already exist */
1801 i
= getservicebyname(name
, NULL
);
1806 /* find an invalid one */
1807 for (i
= 0; i
< iNumServices
; i
++)
1808 if (!ServicePtrs
[i
]->valid
)
1811 /* if not, then create one */
1812 if (i
== iNumServices
)
1817 service
**oldservices
= iNumServices
? malloc(sizeof(service
*) * iNumServices
) : NULL
;
1820 memcpy(oldservices
, ServicePtrs
, sizeof(service
*) * iNumServices
);
1823 tsp
= (service
**) Realloc(ServicePtrs
,
1828 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
1832 ServicePtrs
[iNumServices
] =
1833 (service
*) malloc(sizeof(service
));
1837 if (iNumServices
&& (memcmp(oldservices
, ServicePtrs
, sizeof(service
*) * iNumServices
) != 0)) {
1838 smb_panic("add_a_service: Realloc corrupted ptrs...\n");
1840 safe_free(oldservices
);
1843 if (!ServicePtrs
[iNumServices
])
1849 free_service(ServicePtrs
[i
]);
1851 ServicePtrs
[i
]->valid
= True
;
1853 init_service(ServicePtrs
[i
]);
1854 copy_service(ServicePtrs
[i
], &tservice
, NULL
);
1857 string_set(&ServicePtrs
[i
]->szService
, name
);
1862 /***************************************************************************
1863 add a new home service, with the specified home directory, defaults coming
1864 from service ifrom. homename must be in DOS codepage.
1865 ***************************************************************************/
1866 BOOL
lp_add_home(char *pszHomename
, int iDefaultService
, char *pszHomedir
)
1868 int i
= add_a_service(ServicePtrs
[iDefaultService
], pszHomename
);
1873 if (!(*(ServicePtrs
[i
]->szPath
))
1874 || strequal(ServicePtrs
[i
]->szPath
, lp_pathname(-1)))
1875 string_set(&ServicePtrs
[i
]->szPath
, pszHomedir
);
1876 if (!(*(ServicePtrs
[i
]->comment
)))
1879 slprintf(comment
, sizeof(comment
) - 1,
1880 "Home directory of %s", pszHomename
);
1881 string_set(&ServicePtrs
[i
]->comment
, comment
);
1883 ServicePtrs
[i
]->bAvailable
= sDefault
.bAvailable
;
1884 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
1887 ("adding home directory %s at %s\n", pszHomename
, pszHomedir
));
1892 /***************************************************************************
1893 add a new service, based on an old one. pszService must be in DOS codepage.
1894 ***************************************************************************/
1895 int lp_add_service(char *pszService
, int iDefaultService
)
1897 return (add_a_service(ServicePtrs
[iDefaultService
], pszService
));
1901 /***************************************************************************
1903 ***************************************************************************/
1904 static BOOL
lp_add_ipc(char *ipc_name
, BOOL guest_ok
)
1907 int i
= add_a_service(&sDefault
, ipc_name
);
1912 slprintf(comment
, sizeof(comment
) - 1,
1913 "IPC Service (%s)", Globals
.szServerString
);
1915 string_set(&ServicePtrs
[i
]->szPath
, tmpdir());
1916 string_set(&ServicePtrs
[i
]->szUsername
, "");
1917 string_set(&ServicePtrs
[i
]->comment
, comment
);
1918 string_set(&ServicePtrs
[i
]->fstype
, "IPC");
1919 ServicePtrs
[i
]->status
= False
;
1920 ServicePtrs
[i
]->iMaxConnections
= 0;
1921 ServicePtrs
[i
]->bAvailable
= True
;
1922 ServicePtrs
[i
]->bRead_only
= True
;
1923 ServicePtrs
[i
]->bGuest_only
= False
;
1924 ServicePtrs
[i
]->bGuest_ok
= guest_ok
;
1925 ServicePtrs
[i
]->bPrint_ok
= False
;
1926 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
1928 DEBUG(3, ("adding IPC service %s\n", ipc_name
));
1934 /***************************************************************************
1935 add a new printer service, with defaults coming from service iFrom.
1936 printername must be in DOS codepage.
1937 ***************************************************************************/
1938 BOOL
lp_add_printer(char *pszPrintername
, int iDefaultService
)
1940 char *comment
= "From Printcap";
1941 int i
= add_a_service(ServicePtrs
[iDefaultService
], pszPrintername
);
1946 /* note that we do NOT default the availability flag to True - */
1947 /* we take it from the default service passed. This allows all */
1948 /* dynamic printers to be disabled by disabling the [printers] */
1949 /* entry (if/when the 'available' keyword is implemented!). */
1951 /* the printer name is set to the service name. */
1952 string_set(&ServicePtrs
[i
]->szPrintername
, pszPrintername
);
1953 string_set(&ServicePtrs
[i
]->comment
, comment
);
1954 ServicePtrs
[i
]->bBrowseable
= sDefault
.bBrowseable
;
1955 /* Printers cannot be read_only. */
1956 ServicePtrs
[i
]->bRead_only
= False
;
1957 /* No oplocks on printer services. */
1958 ServicePtrs
[i
]->bOpLocks
= False
;
1959 /* Printer services must be printable. */
1960 ServicePtrs
[i
]->bPrint_ok
= True
;
1962 DEBUG(3, ("adding printer service %s\n", pszPrintername
));
1967 /***************************************************************************
1968 Map a parameter's string representation to something we can use.
1969 Returns False if the parameter string is not recognised, else TRUE.
1970 ***************************************************************************/
1971 static int map_parameter(char *pszParmName
)
1975 if (*pszParmName
== '-')
1978 for (iIndex
= 0; parm_table
[iIndex
].label
; iIndex
++)
1979 if (strwicmp(parm_table
[iIndex
].label
, pszParmName
) == 0)
1982 DEBUG(0, ("Unknown parameter encountered: \"%s\"\n", pszParmName
));
1987 /***************************************************************************
1988 Set a boolean variable from the text value stored in the passed string.
1989 Returns True in success, False if the passed string does not correctly
1990 represent a boolean.
1991 ***************************************************************************/
1992 static BOOL
set_boolean(BOOL
*pb
, char *pszParmValue
)
1997 if (strwicmp(pszParmValue
, "yes") == 0 ||
1998 strwicmp(pszParmValue
, "true") == 0 ||
1999 strwicmp(pszParmValue
, "1") == 0)
2002 if (strwicmp(pszParmValue
, "no") == 0 ||
2003 strwicmp(pszParmValue
, "False") == 0 ||
2004 strwicmp(pszParmValue
, "0") == 0)
2009 ("ERROR: Badly formed boolean in configuration file: \"%s\".\n",
2016 /***************************************************************************
2017 Find a service by name. Otherwise works like get_service.
2018 ***************************************************************************/
2019 static int getservicebyname(char *pszServiceName
, service
* pserviceDest
)
2023 for (iService
= iNumServices
- 1; iService
>= 0; iService
--)
2024 if (VALID(iService
) &&
2025 strwicmp(ServicePtrs
[iService
]->szService
, pszServiceName
) == 0)
2027 if (pserviceDest
!= NULL
)
2028 copy_service(pserviceDest
, ServicePtrs
[iService
], NULL
);
2037 /***************************************************************************
2038 Copy a service structure to another
2040 If pcopymapDest is NULL then copy all fields
2041 ***************************************************************************/
2042 static void copy_service(service
* pserviceDest
,
2043 service
* pserviceSource
, BOOL
*pcopymapDest
)
2046 BOOL bcopyall
= (pcopymapDest
== NULL
);
2048 for (i
= 0; parm_table
[i
].label
; i
++)
2049 if (parm_table
[i
].ptr
&& parm_table
[i
].class == P_LOCAL
&&
2050 (bcopyall
|| pcopymapDest
[i
]))
2052 void *def_ptr
= parm_table
[i
].ptr
;
2054 ((char *)pserviceSource
) + PTR_DIFF(def_ptr
,
2057 ((char *)pserviceDest
) + PTR_DIFF(def_ptr
,
2060 switch (parm_table
[i
].type
)
2064 *(BOOL
*)dest_ptr
= *(BOOL
*)src_ptr
;
2070 *(int *)dest_ptr
= *(int *)src_ptr
;
2074 *(char *)dest_ptr
= *(char *)src_ptr
;
2078 string_set(dest_ptr
,
2083 string_set(dest_ptr
,
2085 strupper(*(char **)dest_ptr
);
2094 init_copymap(pserviceDest
);
2095 if (pserviceSource
->copymap
)
2096 memcpy((void *)pserviceDest
->copymap
,
2097 (void *)pserviceSource
->copymap
,
2098 sizeof(BOOL
) * NUMPARAMETERS
);
2102 /***************************************************************************
2103 Check a service for consistency. Return False if the service is in any way
2104 incomplete or faulty, else True.
2105 ***************************************************************************/
2106 static BOOL
service_ok(int iService
)
2111 if (ServicePtrs
[iService
]->szService
[0] == '\0')
2114 ("The following message indicates an internal error:\n"));
2115 DEBUG(0, ("No service name in service entry.\n"));
2119 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
2120 /* I can't see why you'd want a non-printable printer service... */
2121 if (strwicmp(ServicePtrs
[iService
]->szService
, PRINTERS_NAME
) == 0) {
2122 if (!ServicePtrs
[iService
]->bPrint_ok
) {
2124 ("WARNING: [%s] service MUST be printable!\n",
2125 ServicePtrs
[iService
]->szService
));
2126 ServicePtrs
[iService
]->bPrint_ok
= True
;
2128 /* [printers] service must also be non-browsable. */
2129 if (ServicePtrs
[iService
]->bBrowseable
)
2130 ServicePtrs
[iService
]->bBrowseable
= False
;
2133 if (ServicePtrs
[iService
]->szPath
[0] == '\0' &&
2134 strwicmp(ServicePtrs
[iService
]->szService
, HOMES_NAME
) != 0)
2137 ("No path in service %s - using %s\n",
2138 ServicePtrs
[iService
]->szService
, tmpdir()));
2139 string_set(&ServicePtrs
[iService
]->szPath
, tmpdir());
2142 /* If a service is flagged unavailable, log the fact at level 0. */
2143 if (!ServicePtrs
[iService
]->bAvailable
)
2144 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
2145 ServicePtrs
[iService
]->szService
));
2150 static struct file_lists
2152 struct file_lists
*next
;
2158 /*******************************************************************
2159 keep a linked list of all config files so we know when one has changed
2160 it's date and needs to be reloaded
2161 ********************************************************************/
2162 static void add_to_file_list(char *fname
)
2164 struct file_lists
*f
= file_lists
;
2168 if (f
->name
&& !strcmp(f
->name
, fname
))
2175 f
= (struct file_lists
*)malloc(sizeof(file_lists
[0]));
2178 f
->next
= file_lists
;
2179 f
->name
= strdup(fname
);
2191 standard_sub_basic(n2
);
2192 f
->modtime
= file_modtime(n2
);
2197 /*******************************************************************
2198 check if a config file has changed date
2199 ********************************************************************/
2200 BOOL
lp_file_list_changed(void)
2202 struct file_lists
*f
= file_lists
;
2203 DEBUG(6, ("lp_file_list_changed()\n"));
2210 pstrcpy(n2
, f
->name
);
2211 standard_sub_basic(n2
);
2213 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
2214 f
->name
, n2
, ctime(&f
->modtime
)));
2216 mod_time
= file_modtime(n2
);
2218 if (f
->modtime
!= mod_time
)
2221 ("file %s modified: %s\n", n2
,
2223 f
->modtime
= mod_time
;
2231 /***************************************************************************
2232 Run standard_sub_basic on netbios name... needed because global_myname
2233 is not accessed through any lp_ macro.
2234 Note: We must *NOT* use string_set() here as ptr points to global_myname.
2235 ***************************************************************************/
2237 static BOOL
handle_netbios_name(char *pszParmValue
, char **ptr
)
2239 pstring netbios_name
;
2241 pstrcpy(netbios_name
, pszParmValue
);
2243 standard_sub_basic(netbios_name
);
2244 strupper(netbios_name
);
2247 * Convert from UNIX to DOS string - the UNIX to DOS converter
2248 * isn't called on the special handlers.
2250 unix_to_dos(netbios_name
, True
);
2251 pstrcpy(global_myname
, netbios_name
);
2254 ("handle_netbios_name: set global_myname to: %s\n",
2260 /***************************************************************************
2261 Do the work of sourcing in environment variable/value pairs.
2262 ***************************************************************************/
2264 static BOOL
source_env(char **lines
)
2271 for (i
= 0; lines
[i
]; i
++)
2273 char *line
= lines
[i
];
2275 if ((len
= strlen(line
)) == 0)
2278 if (line
[len
- 1] == '\n')
2281 if ((varval
= malloc(len
+ 1)) == NULL
)
2283 DEBUG(0, ("source_env: Not enough memory!\n"));
2287 DEBUG(4, ("source_env: Adding to environment: %s\n", line
));
2288 strncpy(varval
, line
, len
);
2291 p
= strchr(line
, (int)'=');
2294 DEBUG(4, ("source_env: missing '=': %s\n", line
));
2301 ("source_env: Failed to put environment variable %s\n",
2309 ("source_env: getting var %s = %s\n", line
,
2313 DEBUG(4, ("source_env: returning successfully\n"));
2317 /***************************************************************************
2318 Handle the source environment operation
2319 ***************************************************************************/
2321 static BOOL
handle_source_env(char *pszParmValue
, char **ptr
)
2328 pstrcpy(fname
, pszParmValue
);
2330 standard_sub_basic(fname
);
2332 string_set(ptr
, pszParmValue
);
2334 DEBUG(4, ("handle_source_env: checking env type\n"));
2337 * Filename starting with '|' means popen and read from stdin.
2342 lines
= file_lines_pload(p
+ 1, NULL
, True
);
2346 lines
= file_lines_load(fname
, NULL
, True
);
2352 ("handle_source_env: Failed to open file %s, Error was %s\n",
2353 fname
, strerror(errno
)));
2357 result
= source_env(lines
);
2358 file_lines_free(lines
);
2363 /***************************************************************************
2364 handle the interpretation of the vfs object parameter
2365 *************************************************************************/
2366 static BOOL
handle_vfs_object(char *pszParmValue
, char **ptr
)
2368 /* Set string value */
2370 string_set(ptr
, pszParmValue
);
2372 /* Do any other initialisation required for vfs. Note that
2373 anything done here may have linking repercussions in nmbd. */
2378 /***************************************************************************
2379 handle the interpretation of the coding system parameter
2380 *************************************************************************/
2381 static BOOL
handle_coding_system(char *pszParmValue
, char **ptr
)
2383 string_set(ptr
, pszParmValue
);
2384 interpret_coding_system(pszParmValue
);
2388 /***************************************************************************
2389 Handle the interpretation of the character set system parameter.
2390 ***************************************************************************/
2392 static char *saved_character_set
= NULL
;
2394 static BOOL
handle_character_set(char *pszParmValue
, char **ptr
)
2396 /* A dependency here is that the parameter client code page should be
2397 set before this is called.
2399 string_set(ptr
, pszParmValue
);
2401 saved_character_set
= strdup(*ptr
);
2402 interpret_character_set(*ptr
, lp_client_code_page());
2406 /***************************************************************************
2407 Handle the interpretation of the client code page parameter.
2408 We handle this separately so that we can reset the character set
2409 parameter in case this came before 'client code page' in the smb.conf.
2410 ***************************************************************************/
2412 static BOOL
handle_client_code_page(char *pszParmValue
, char **ptr
)
2414 Globals
.client_code_page
= atoi(pszParmValue
);
2415 if (saved_character_set
!= NULL
)
2416 interpret_character_set(saved_character_set
,
2417 lp_client_code_page());
2418 codepage_initialise(lp_client_code_page());
2422 /***************************************************************************
2423 handle the valid chars lines
2424 ***************************************************************************/
2426 static BOOL
handle_valid_chars(char *pszParmValue
, char **ptr
)
2428 string_set(ptr
, pszParmValue
);
2430 /* A dependency here is that the parameter client code page must be
2431 set before this is called - as calling codepage_initialise()
2432 would overwrite the valid char lines.
2434 codepage_initialise(lp_client_code_page());
2436 add_char_string(pszParmValue
);
2440 /***************************************************************************
2441 handle the include operation
2442 ***************************************************************************/
2444 static BOOL
handle_include(char *pszParmValue
, char **ptr
)
2447 pstrcpy(fname
, pszParmValue
);
2449 add_to_file_list(fname
);
2451 standard_sub_basic(fname
);
2453 string_set(ptr
, fname
);
2455 if (file_exist(fname
, NULL
))
2456 return (pm_process(fname
, do_section
, do_parameter
));
2458 DEBUG(2, ("Can't find include file %s\n", fname
));
2464 /***************************************************************************
2465 handle the interpretation of the copy parameter
2466 ***************************************************************************/
2467 static BOOL
handle_copy(char *pszParmValue
, char **ptr
)
2471 service serviceTemp
;
2473 string_set(ptr
, pszParmValue
);
2475 init_service(&serviceTemp
);
2479 DEBUG(3, ("Copying service from service %s\n", pszParmValue
));
2481 if ((iTemp
= getservicebyname(pszParmValue
, &serviceTemp
)) >= 0)
2483 if (iTemp
== iServiceIndex
)
2486 ("Can't copy service %s - unable to copy self!\n",
2491 copy_service(ServicePtrs
[iServiceIndex
],
2493 ServicePtrs
[iServiceIndex
]->copymap
);
2499 DEBUG(0, ("Unable to copy service - source not found: %s\n",
2504 free_service(&serviceTemp
);
2508 /***************************************************************************
2509 Handle winbind uid and gid allocation parameters. The format of these
2514 winbind uid = 1000-1999
2515 winbind gid = 700-899
2517 We only do simple parsing checks here. The strings are parsed into useful
2518 structures in the winbind daemon code.
2520 ***************************************************************************/
2522 /* Do some simple checks on "winbind [ug]id" parameter value */
2524 static BOOL
handle_winbind_id(char *pszParmValue
, char **ptr
)
2528 if (sscanf(pszParmValue
, "%d-%d", &low
, &high
) != 2)
2535 string_set(ptr
, pszParmValue
);
2540 /***************************************************************************
2541 Handle the WINS SERVER list
2542 ***************************************************************************/
2543 static BOOL
handle_wins_server_list( char *pszParmValue
, char **ptr
)
2545 if( !wins_srv_load_list( pszParmValue
) )
2546 return( False
); /* Parse failed. */
2548 string_set( ptr
, pszParmValue
);
2553 /***************************************************************************
2554 Handle the DEBUG level list
2555 ***************************************************************************/
2556 static BOOL
handle_debug_list( char *pszParmValueIn
, char **ptr
)
2558 pstring pszParmValue
;
2560 pstrcpy(pszParmValue
, pszParmValueIn
);
2561 return debug_parse_levels( pszParmValue
);
2565 /***************************************************************************
2566 initialise a copymap
2567 ***************************************************************************/
2568 static void init_copymap(service
* pservice
)
2571 if (pservice
->copymap
)
2572 free(pservice
->copymap
);
2573 pservice
->copymap
= (BOOL
*)malloc(sizeof(BOOL
) * NUMPARAMETERS
);
2574 if (!pservice
->copymap
)
2576 ("Couldn't allocate copymap!! (size %d)\n",
2577 (int)NUMPARAMETERS
));
2579 for (i
= 0; i
< NUMPARAMETERS
; i
++)
2580 pservice
->copymap
[i
] = True
;
2584 /***************************************************************************
2585 return the local pointer to a parameter given the service number and the
2586 pointer into the default structure
2587 ***************************************************************************/
2588 void *lp_local_ptr(int snum
, void *ptr
)
2590 return (void *)(((char *)ServicePtrs
[snum
]) + PTR_DIFF(ptr
, &sDefault
));
2593 /***************************************************************************
2594 Process a parameter for a particular service number. If snum < 0
2595 then assume we are in the globals
2596 ***************************************************************************/
2597 BOOL
lp_do_parameter(int snum
, char *pszParmName
, char *pszParmValue
)
2600 void *parm_ptr
= NULL
; /* where we are going to store the result */
2601 void *def_ptr
= NULL
;
2603 parmnum
= map_parameter(pszParmName
);
2608 ("Ignoring unknown parameter \"%s\"\n", pszParmName
));
2612 if (parm_table
[parmnum
].flags
& FLAG_DEPRECATED
)
2614 DEBUG(1, ("WARNING: The \"%s\"option is deprecated\n",
2618 def_ptr
= parm_table
[parmnum
].ptr
;
2620 /* we might point at a service, the default service or a global */
2627 if (parm_table
[parmnum
].class == P_GLOBAL
)
2630 ("Global parameter %s found in service section!\n",
2635 ((char *)ServicePtrs
[snum
]) + PTR_DIFF(def_ptr
,
2641 if (!ServicePtrs
[snum
]->copymap
)
2642 init_copymap(ServicePtrs
[snum
]);
2644 /* this handles the aliases - set the copymap for other entries with
2645 the same data pointer */
2646 for (i
= 0; parm_table
[i
].label
; i
++)
2647 if (parm_table
[i
].ptr
== parm_table
[parmnum
].ptr
)
2648 ServicePtrs
[snum
]->copymap
[i
] = False
;
2651 /* if it is a special case then go ahead */
2652 if (parm_table
[parmnum
].special
)
2654 parm_table
[parmnum
].special(pszParmValue
, (char **)parm_ptr
);
2658 /* now switch on the type of variable it is */
2659 switch (parm_table
[parmnum
].type
)
2662 set_boolean(parm_ptr
, pszParmValue
);
2666 set_boolean(parm_ptr
, pszParmValue
);
2667 *(BOOL
*)parm_ptr
= !*(BOOL
*)parm_ptr
;
2671 *(int *)parm_ptr
= atoi(pszParmValue
);
2675 *(char *)parm_ptr
= *pszParmValue
;
2679 sscanf(pszParmValue
, "%o", (int *)parm_ptr
);
2683 string_set(parm_ptr
, pszParmValue
);
2684 if (parm_table
[parmnum
].flags
& FLAG_DOS_STRING
)
2685 unix_to_dos(*(char **)parm_ptr
, True
);
2689 string_set(parm_ptr
, pszParmValue
);
2690 if (parm_table
[parmnum
].flags
& FLAG_DOS_STRING
)
2691 unix_to_dos(*(char **)parm_ptr
, True
);
2692 strupper(*(char **)parm_ptr
);
2696 pstrcpy((char *)parm_ptr
, pszParmValue
);
2697 if (parm_table
[parmnum
].flags
& FLAG_DOS_STRING
)
2698 unix_to_dos((char *)parm_ptr
, True
);
2702 pstrcpy((char *)parm_ptr
, pszParmValue
);
2703 if (parm_table
[parmnum
].flags
& FLAG_DOS_STRING
)
2704 unix_to_dos((char *)parm_ptr
, True
);
2705 strupper((char *)parm_ptr
);
2709 for (i
= 0; parm_table
[parmnum
].enum_list
[i
].name
;
2714 parm_table
[parmnum
].enum_list
[i
].name
))
2717 parm_table
[parmnum
].
2730 /***************************************************************************
2731 Process a parameter.
2732 ***************************************************************************/
2733 static BOOL
do_parameter(char *pszParmName
, char *pszParmValue
)
2735 if (!bInGlobalSection
&& bGlobalOnly
)
2738 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName
, pszParmValue
));
2740 return (lp_do_parameter(bInGlobalSection
? -2 : iServiceIndex
,
2741 pszParmName
, pszParmValue
));
2745 /***************************************************************************
2746 print a parameter of the specified type
2747 ***************************************************************************/
2748 static void print_parameter(struct parm_struct
*p
, void *ptr
, FILE * f
, char *(*dos_to_ext
)(char *, BOOL
))
2754 for (i
= 0; p
->enum_list
[i
].name
; i
++)
2756 if (*(int *)ptr
== p
->enum_list
[i
].value
)
2759 p
->enum_list
[i
].name
);
2766 fprintf(f
, "%s", BOOLSTR(*(BOOL
*)ptr
));
2770 fprintf(f
, "%s", BOOLSTR(!*(BOOL
*)ptr
));
2774 fprintf(f
, "%d", *(int *)ptr
);
2778 fprintf(f
, "%c", *(char *)ptr
);
2782 fprintf(f
, "%s", octal_string(*(int *)ptr
));
2788 if (p
->flags
& FLAG_DOS_STRING
)
2789 fprintf(f
, "%s", dos_to_ext((char *)ptr
, False
));
2791 fprintf(f
, "%s", (char *)ptr
);
2797 if (*(char **)ptr
) {
2798 if(p
->flags
& FLAG_DOS_STRING
)
2799 fprintf(f
,"%s",dos_to_ext(*(char **)ptr
, False
));
2801 fprintf(f
, "%s", *(char **)ptr
);
2810 /***************************************************************************
2811 check if two parameters are equal
2812 ***************************************************************************/
2813 static BOOL
equal_parameter(parm_type type
, void *ptr1
, void *ptr2
)
2819 return (*((BOOL
*)ptr1
) == *((BOOL
*)ptr2
));
2824 return (*((int *)ptr1
) == *((int *)ptr2
));
2827 return (*((char *)ptr1
) == *((char *)ptr2
));
2832 char *p1
= (char *)ptr1
, *p2
= (char *)ptr2
;
2837 return (p1
== p2
|| strequal(p1
, p2
));
2842 char *p1
= *(char **)ptr1
, *p2
= *(char **)ptr2
;
2847 return (p1
== p2
|| strequal(p1
, p2
));
2855 /***************************************************************************
2856 Initialize any local varients in the sDefault table.
2857 ***************************************************************************/
2859 void init_locals(void)
2864 /***************************************************************************
2865 Process a new section (service). At this stage all sections are services.
2866 Later we'll have special sections that permit server parameters to be set.
2867 Returns True on success, False on failure. SectionName must be in DOS codepage.
2868 ***************************************************************************/
2869 static BOOL
do_section(char *pszSectionName
)
2872 BOOL isglobal
= ((strwicmp(pszSectionName
, GLOBAL_NAME
) == 0) ||
2873 (strwicmp(pszSectionName
, GLOBAL_NAME2
) == 0));
2876 /* if we were in a global section then do the local inits */
2877 if (bInGlobalSection
&& !isglobal
)
2880 /* if we've just struck a global section, note the fact. */
2881 bInGlobalSection
= isglobal
;
2883 /* check for multiple global sections */
2884 if (bInGlobalSection
)
2886 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName
));
2890 if (!bInGlobalSection
&& bGlobalOnly
)
2893 /* if we have a current service, tidy it up before moving on */
2896 if (iServiceIndex
>= 0)
2897 bRetval
= service_ok(iServiceIndex
);
2899 /* if all is still well, move to the next record in the services array */
2902 /* We put this here to avoid an odd message order if messages are */
2903 /* issued by the post-processing of a previous section. */
2904 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName
));
2906 if ((iServiceIndex
= add_a_service(&sDefault
, pszSectionName
))
2909 DEBUG(0, ("Failed to add a new service\n"));
2918 /***************************************************************************
2919 determine if a partcular base parameter is currently set to the default value.
2920 ***************************************************************************/
2921 static BOOL
is_default(int i
)
2923 if (!defaults_saved
)
2925 switch (parm_table
[i
].type
)
2929 return strequal(parm_table
[i
].def
.svalue
,
2930 *(char **)parm_table
[i
].ptr
);
2933 return strequal(parm_table
[i
].def
.svalue
,
2934 (char *)parm_table
[i
].ptr
);
2937 return parm_table
[i
].def
.bvalue
==
2938 *(BOOL
*)parm_table
[i
].ptr
;
2940 return parm_table
[i
].def
.cvalue
==
2941 *(char *)parm_table
[i
].ptr
;
2945 return parm_table
[i
].def
.ivalue
==
2946 *(int *)parm_table
[i
].ptr
;
2954 /***************************************************************************
2955 Display the contents of the global structure.
2956 ***************************************************************************/
2957 static void dump_globals(FILE *f
, char *(*dos_to_ext
)(char *, BOOL
))
2960 fprintf(f
, "# Global parameters\n[global]\n");
2962 for (i
= 0; parm_table
[i
].label
; i
++)
2963 if (parm_table
[i
].class == P_GLOBAL
&&
2964 parm_table
[i
].ptr
&&
2965 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
2967 if (defaults_saved
&& is_default(i
))
2969 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
2970 print_parameter(&parm_table
[i
], parm_table
[i
].ptr
, f
, dos_to_ext
);
2975 /***************************************************************************
2976 return True if a local parameter is currently set to the global default
2977 ***************************************************************************/
2978 BOOL
lp_is_default(int snum
, struct parm_struct
*parm
)
2980 int pdiff
= PTR_DIFF(parm
->ptr
, &sDefault
);
2982 return equal_parameter(parm
->type
,
2983 ((char *)ServicePtrs
[snum
]) + pdiff
,
2984 ((char *)&sDefault
) + pdiff
);
2988 /***************************************************************************
2989 Display the contents of a single services record.
2990 ***************************************************************************/
2991 static void dump_a_service(service
* pService
, FILE * f
, char *(*dos_to_ext
)(char *, BOOL
))
2994 if (pService
!= &sDefault
)
2995 fprintf(f
, "\n[%s]\n", pService
->szService
);
2997 for (i
= 0; parm_table
[i
].label
; i
++)
2998 if (parm_table
[i
].class == P_LOCAL
&&
2999 parm_table
[i
].ptr
&&
3000 (*parm_table
[i
].label
!= '-') &&
3001 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
3003 int pdiff
= PTR_DIFF(parm_table
[i
].ptr
, &sDefault
);
3005 if (pService
== &sDefault
)
3007 if (defaults_saved
&& is_default(i
))
3012 if (equal_parameter(parm_table
[i
].type
,
3013 ((char *)pService
) +
3015 ((char *)&sDefault
) +
3020 fprintf(f
, "\t%s = ", parm_table
[i
].label
);
3021 print_parameter(&parm_table
[i
],
3022 ((char *)pService
) + pdiff
, f
, dos_to_ext
);
3028 /***************************************************************************
3029 return info about the next service in a service. snum==-1 gives the globals
3031 return NULL when out of parameters
3032 ***************************************************************************/
3033 struct parm_struct
*lp_next_parameter(int snum
, int *i
, int allparameters
)
3037 /* do the globals */
3038 for (; parm_table
[*i
].label
; (*i
)++)
3040 if (parm_table
[*i
].class == P_SEPARATOR
)
3041 return &parm_table
[(*i
)++];
3043 if (!parm_table
[*i
].ptr
3044 || (*parm_table
[*i
].label
== '-'))
3048 && (parm_table
[*i
].ptr
==
3049 parm_table
[(*i
) - 1].ptr
))
3052 return &parm_table
[(*i
)++];
3057 service
*pService
= ServicePtrs
[snum
];
3059 for (; parm_table
[*i
].label
; (*i
)++)
3061 if (parm_table
[*i
].class == P_SEPARATOR
)
3062 return &parm_table
[(*i
)++];
3064 if (parm_table
[*i
].class == P_LOCAL
&&
3065 parm_table
[*i
].ptr
&&
3066 (*parm_table
[*i
].label
!= '-') &&
3068 (parm_table
[*i
].ptr
!=
3069 parm_table
[(*i
) - 1].ptr
)))
3072 PTR_DIFF(parm_table
[*i
].ptr
,
3075 if (allparameters
||
3076 !equal_parameter(parm_table
[*i
].type
,
3077 ((char *)pService
) +
3079 ((char *)&sDefault
) +
3082 return &parm_table
[(*i
)++];
3093 /***************************************************************************
3094 Display the contents of a single copy structure.
3095 ***************************************************************************/
3096 static void dump_copy_map(BOOL
*pcopymap
)
3102 printf("\n\tNon-Copied parameters:\n");
3104 for (i
= 0; parm_table
[i
].label
; i
++)
3105 if (parm_table
[i
].class == P_LOCAL
&&
3106 parm_table
[i
].ptr
&& !pcopymap
[i
] &&
3107 (i
== 0 || (parm_table
[i
].ptr
!= parm_table
[i
- 1].ptr
)))
3109 printf("\t\t%s\n", parm_table
[i
].label
);
3114 /***************************************************************************
3115 Return TRUE if the passed service number is within range.
3116 ***************************************************************************/
3117 BOOL
lp_snum_ok(int iService
)
3119 return (LP_SNUM_OK(iService
) && ServicePtrs
[iService
]->bAvailable
);
3123 /***************************************************************************
3124 auto-load some home services
3125 ***************************************************************************/
3126 static void lp_add_auto_services(char *str
)
3139 homes
= lp_servicenumber(HOMES_NAME
);
3141 for (p
= strtok(s
, LIST_SEP
); p
; p
= strtok(NULL
, LIST_SEP
))
3143 char *home
= get_user_home_dir(p
);
3145 if (lp_servicenumber(p
) >= 0)
3148 if (home
&& homes
>= 0)
3150 lp_add_home(p
, homes
, home
);
3156 /***************************************************************************
3157 auto-load one printer
3158 ***************************************************************************/
3159 void lp_add_one_printer(char *name
, char *comment
)
3161 int printers
= lp_servicenumber(PRINTERS_NAME
);
3164 if (lp_servicenumber(name
) < 0)
3166 lp_add_printer(name
, printers
);
3167 if ((i
= lp_servicenumber(name
)) >= 0)
3169 string_set(&ServicePtrs
[i
]->comment
, comment
);
3170 unix_to_dos(ServicePtrs
[i
]->comment
, True
);
3171 ServicePtrs
[i
]->autoloaded
= True
;
3176 /***************************************************************************
3177 have we loaded a services file yet?
3178 ***************************************************************************/
3179 BOOL
lp_loaded(void)
3184 /***************************************************************************
3185 unload unused services
3186 ***************************************************************************/
3187 void lp_killunused(BOOL (*snumused
) (int))
3190 for (i
= 0; i
< iNumServices
; i
++)
3195 if (!snumused
|| !snumused(i
))
3197 ServicePtrs
[i
]->valid
= False
;
3198 free_service(ServicePtrs
[i
]);
3204 /***************************************************************************
3206 ***************************************************************************/
3207 void lp_killservice(int iServiceIn
)
3209 if (VALID(iServiceIn
))
3211 ServicePtrs
[iServiceIn
]->valid
= False
;
3212 free_service(ServicePtrs
[iServiceIn
]);
3216 /***************************************************************************
3217 save the curent values of all global and sDefault parameters into the
3218 defaults union. This allows swat and testparm to show only the
3219 changed (ie. non-default) parameters.
3220 ***************************************************************************/
3221 static void lp_save_defaults(void)
3224 for (i
= 0; parm_table
[i
].label
; i
++)
3226 if (i
> 0 && parm_table
[i
].ptr
== parm_table
[i
- 1].ptr
)
3228 switch (parm_table
[i
].type
)
3232 parm_table
[i
].def
.svalue
=
3233 strdup(*(char **)parm_table
[i
].ptr
);
3237 parm_table
[i
].def
.svalue
=
3238 strdup((char *)parm_table
[i
].ptr
);
3242 parm_table
[i
].def
.bvalue
=
3243 *(BOOL
*)parm_table
[i
].ptr
;
3246 parm_table
[i
].def
.cvalue
=
3247 *(char *)parm_table
[i
].ptr
;
3252 parm_table
[i
].def
.ivalue
=
3253 *(int *)parm_table
[i
].ptr
;
3259 defaults_saved
= True
;
3262 /*******************************************************************
3263 Set the server type we will announce as via nmbd.
3264 ********************************************************************/
3265 static void set_server_role(void)
3267 server_role
= ROLE_STANDALONE
;
3269 switch (lp_security())
3273 if (lp_domain_logons())
3276 ("Server's Role (logon server) conflicts with share-level security\n"));
3283 if (lp_domain_logons())
3285 server_role
= ROLE_DOMAIN_BDC
;
3288 server_role
= ROLE_DOMAIN_MEMBER
;
3293 if (lp_domain_logons())
3295 server_role
= ROLE_DOMAIN_PDC
;
3303 ("Server's Role undefined due to unknown security mode\n"));
3309 /***************************************************************************
3310 Load the services array from the services file. Return True on success,
3312 ***************************************************************************/
3313 BOOL
lp_load(char *pszFname
, BOOL global_only
, BOOL save_defaults
,
3319 add_to_file_list(pszFname
);
3323 bInGlobalSection
= True
;
3324 bGlobalOnly
= global_only
;
3334 pstrcpy(n2
, pszFname
);
3335 standard_sub_basic(n2
);
3337 /* We get sections first, so have to start 'behind' to make up */
3339 bRetval
= pm_process(n2
, do_section
, do_parameter
);
3341 /* finish up the last section */
3342 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval
)));
3344 if (iServiceIndex
>= 0)
3345 bRetval
= service_ok(iServiceIndex
);
3347 lp_add_auto_services(lp_auto_services());
3350 lp_add_ipc("IPC$", True
);
3351 lp_add_ipc("ADMIN$", False
);
3355 set_default_server_announce_type();
3359 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
3360 /* if bWINSsupport is true and we are in the client */
3362 if (in_client
&& Globals
.bWINSsupport
)
3365 string_set(&Globals
.szWINSserver
, "127.0.0.1");
3373 /***************************************************************************
3374 reset the max number of services
3375 ***************************************************************************/
3376 void lp_resetnumservices(void)
3381 /***************************************************************************
3382 return the max number of services
3383 ***************************************************************************/
3384 int lp_numservices(void)
3386 return (iNumServices
);
3389 /***************************************************************************
3390 Display the contents of the services array in human-readable form.
3391 ***************************************************************************/
3392 void lp_dump(FILE *f
, BOOL show_defaults
, int maxtoprint
, char *(*dos_to_ext
)(char *, BOOL
))
3398 defaults_saved
= False
;
3401 dump_globals(f
, dos_to_ext
);
3403 dump_a_service(&sDefault
, f
, dos_to_ext
);
3405 for (iService
= 0; iService
< maxtoprint
; iService
++)
3406 lp_dump_one(f
, show_defaults
, iService
, dos_to_ext
);
3409 /***************************************************************************
3410 Display the contents of one service in human-readable form.
3411 ***************************************************************************/
3412 void lp_dump_one(FILE * f
, BOOL show_defaults
, int snum
, char *(*dos_to_ext
)(char *, BOOL
))
3416 if (ServicePtrs
[snum
]->szService
[0] == '\0')
3418 dump_a_service(ServicePtrs
[snum
], f
, dos_to_ext
);
3423 /***************************************************************************
3424 Return the number of the service with the given name, or -1 if it doesn't
3425 exist. Note that this is a DIFFERENT ANIMAL from the internal function
3426 getservicebyname()! This works ONLY if all services have been loaded, and
3427 does not copy the found service.
3428 ***************************************************************************/
3429 int lp_servicenumber(char *pszServiceName
)
3433 for (iService
= iNumServices
- 1; iService
>= 0; iService
--)
3434 if (VALID(iService
) &&
3435 strequal(lp_servicename(iService
), pszServiceName
))
3440 ("lp_servicenumber: couldn't find %s\n",
3446 /*******************************************************************
3447 A useful volume label function. Returns a string in DOS codepage.
3448 ********************************************************************/
3450 char *volume_label(int snum
)
3452 char *ret
= lp_volume(snum
);
3454 return lp_servicename(snum
);
3459 /*******************************************************************
3460 Set the server type we will announce as via nmbd.
3461 ********************************************************************/
3462 static void set_default_server_announce_type(void)
3464 default_server_announce
= 0;
3465 default_server_announce
|= SV_TYPE_WORKSTATION
;
3466 default_server_announce
|= SV_TYPE_SERVER
;
3467 default_server_announce
|= SV_TYPE_SERVER_UNIX
;
3468 default_server_announce
|= SV_TYPE_PRINTQ_SERVER
;
3470 switch (lp_announce_as())
3472 case ANNOUNCE_AS_NT_SERVER
:
3474 default_server_announce
|= SV_TYPE_SERVER_NT
;
3475 /* fall through... */
3477 case ANNOUNCE_AS_NT_WORKSTATION
:
3479 default_server_announce
|= SV_TYPE_NT
;
3482 case ANNOUNCE_AS_WIN95
:
3484 default_server_announce
|= SV_TYPE_WIN95_PLUS
;
3487 case ANNOUNCE_AS_WFW
:
3489 default_server_announce
|= SV_TYPE_WFW
;
3498 switch (lp_server_role())
3500 case ROLE_DOMAIN_MEMBER
:
3502 default_server_announce
|= SV_TYPE_DOMAIN_MEMBER
;
3505 case ROLE_DOMAIN_PDC
:
3507 default_server_announce
|= SV_TYPE_DOMAIN_CTRL
;
3510 case ROLE_DOMAIN_BDC
:
3512 default_server_announce
|= SV_TYPE_DOMAIN_BAKCTRL
;
3515 case ROLE_STANDALONE
:
3522 if (lp_time_server())
3524 default_server_announce
|= SV_TYPE_TIME_SOURCE
;
3527 if (lp_host_msdfs())
3529 default_server_announce
|= SV_TYPE_DFS_SERVER
;
3533 /***********************************************************
3534 returns role of Samba server
3535 ************************************************************/
3537 int lp_server_role(void)
3542 /***********************************************************
3543 If we are PDC then prefer us as DMB
3544 ************************************************************/
3546 BOOL
lp_domain_master(void)
3548 if (Globals
.bDomainMaster
== Auto
)
3550 return (lp_server_role() == ROLE_DOMAIN_PDC
);
3553 return Globals
.bDomainMaster
;
3556 /***********************************************************
3557 If we are DMB then prefer us as LMB
3558 ************************************************************/
3560 BOOL
lp_preferred_master(void)
3562 if (Globals
.bPreferredMaster
== Auto
)
3564 return (lp_local_master() && lp_domain_master());
3567 return Globals
.bPreferredMaster
;
3572 /*******************************************************************
3574 ********************************************************************/
3575 void lp_remove_service(int snum
)
3577 ServicePtrs
[snum
]->valid
= False
;
3580 /*******************************************************************
3581 copy a service. new_name must be in dos codepage
3582 ********************************************************************/
3583 void lp_copy_service(int snum
, char *new_name
)
3585 char *oldname
= lp_servicename(snum
);
3586 do_section(new_name
);
3589 snum
= lp_servicenumber(new_name
);
3591 lp_do_parameter(snum
, "copy", oldname
);
3596 /*******************************************************************
3597 Get the default server type we will announce as via nmbd.
3598 ********************************************************************/
3599 int lp_default_server_announce(void)
3601 return default_server_announce
;
3604 /*******************************************************************
3605 Split the announce version into major and minor numbers.
3606 ********************************************************************/
3607 int lp_major_announce_version(void)
3609 static BOOL got_major
= False
;
3610 static int major_version
= DEFAULT_MAJOR_VERSION
;
3615 return major_version
;
3618 if ((vers
= lp_announce_version()) == NULL
)
3619 return major_version
;
3621 if ((p
= strchr(vers
, '.')) == 0)
3622 return major_version
;
3625 major_version
= atoi(vers
);
3626 return major_version
;
3629 int lp_minor_announce_version(void)
3631 static BOOL got_minor
= False
;
3632 static int minor_version
= DEFAULT_MINOR_VERSION
;
3637 return minor_version
;
3640 if ((vers
= lp_announce_version()) == NULL
)
3641 return minor_version
;
3643 if ((p
= strchr(vers
, '.')) == 0)
3644 return minor_version
;
3647 minor_version
= atoi(p
);
3648 return minor_version
;
3651 /***********************************************************
3652 Set the global name resolution order (used in smbclient).
3653 ************************************************************/
3655 void lp_set_name_resolve_order(char *new_order
)
3657 Globals
.szNameResolveOrder
= new_order
;
3660 char *lp_printername(int snum
)
3662 char *ret
= _lp_printername(snum
);
3663 if (ret
== NULL
|| (ret
!= NULL
&& *ret
== '\0'))
3664 ret
= lp_servicename(snum
);