1996-05-04 11:50:46 +04:00
/*
Unix SMB / Netbios implementation .
Version 1.9 .
Parameter loading functions
1998-01-22 16:27:43 +03:00
Copyright ( C ) Karl Auer 1993 - 1998
1996-05-04 11:50:46 +04:00
Largely re - written by Andrew Tridgell , September 1994
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 675 Mass Ave , Cambridge , MA 0213 9 , USA .
*/
/*
* Load parameters .
*
* This module provides suitable callback functions for the params
* module . It builds the internal table of service details which is
* then used by the rest of the server .
*
* To add a parameter :
*
* 1 ) add it to the global or service structure definition
* 2 ) add it to the parm_table
* 3 ) add it to the list of available functions ( eg : using FN_GLOBAL_STRING ( ) )
* 4 ) If it ' s a global then initialise it in init_globals . If a local
* ( ie . service ) parameter then initialise it in the sDefault structure
*
*
* Notes :
* The configuration file is processed sequentially for speed . It is NOT
* accessed randomly as happens in ' real ' Windows . For this reason , there
* is a fair bit of sequence - dependent code here - ie . , code which assumes
* that certain things happen before others . In particular , the code which
* happens at the boundary between sections is delicately poised , so be
* careful !
*
*/
# include "includes.h"
1997-09-12 00:17:32 +04:00
/* Set default coding system for KANJI if none specified in Makefile. */
1998-03-03 23:19:14 +03:00
/*
* We treat KANJI specially due to historical precedent ( it was the
* first non - english codepage added to Samba ) . With the new dynamic
* codepage support this is not needed anymore .
*
* The define ' KANJI ' is being overloaded to mean ' use kanji codepage
* by default ' and also ' this is the filename - to - disk conversion
* method to use ' . This really should be removed and all control
* over this left in the smb . conf parameters ' client codepage '
* and ' coding system ' .
*/
1997-09-12 00:17:32 +04:00
# ifndef KANJI
# define KANJI "sjis"
# endif /* KANJI */
1996-05-04 11:50:46 +04:00
BOOL bLoaded = False ;
extern int DEBUGLEVEL ;
extern pstring user_socket_options ;
1996-08-19 15:17:29 +04:00
extern pstring myname ;
1996-05-04 11:50:46 +04:00
# ifndef GLOBAL_NAME
# define GLOBAL_NAME "global"
# endif
# ifndef PRINTERS_NAME
# define PRINTERS_NAME "printers"
# endif
# ifndef HOMES_NAME
# define HOMES_NAME "homes"
# endif
/* some helpful bits */
# define pSERVICE(i) ServicePtrs[i]
# define iSERVICE(i) (*pSERVICE(i))
# define LP_SNUM_OK(iService) (((iService) >= 0) && ((iService) < iNumServices) && iSERVICE(iService).valid)
# define VALID(i) iSERVICE(i).valid
1998-03-16 10:23:51 +03:00
int keepalive = DEFAULT_KEEPALIVE ;
1996-05-04 11:50:46 +04:00
extern BOOL use_getwd_cache ;
extern int extra_time_offset ;
1998-03-14 11:27:41 +03:00
static BOOL defaults_saved = False ;
1996-05-04 11:50:46 +04:00
/*
* This structure describes global ( ie . , server - wide ) parameters .
*/
typedef struct
{
1996-10-02 19:41:30 +04:00
char * szPrintcapname ;
char * szLockDir ;
char * szRootdir ;
1996-06-06 15:43:09 +04:00
char * szDefaultService ;
char * szDfree ;
1996-10-02 18:09:22 +04:00
char * szMsgCommand ;
1996-10-02 19:41:30 +04:00
char * szHostsEquiv ;
1996-10-02 18:09:22 +04:00
char * szServerString ;
1996-10-02 19:41:30 +04:00
char * szAutoServices ;
char * szPasswdProgram ;
char * szPasswdChat ;
char * szLogFile ;
char * szConfigFile ;
1996-10-02 18:09:22 +04:00
char * szSMBPasswdFile ;
1996-10-02 19:41:30 +04:00
char * szPasswordServer ;
1996-06-06 15:43:09 +04:00
char * szSocketOptions ;
1996-10-02 18:09:22 +04:00
char * szValidChars ;
char * szWorkGroup ;
1997-10-21 22:25:14 +04:00
char * szDomainAdminUsers ;
char * szDomainGuestUsers ;
1997-11-02 22:27:26 +03:00
char * szDomainHostsallow ;
char * szDomainHostsdeny ;
1996-10-02 19:41:30 +04:00
char * szUsernameMap ;
char * szCharacterSet ;
char * szLogonScript ;
1997-02-02 21:12:36 +03:00
char * szLogonPath ;
1997-10-20 16:10:58 +04:00
char * szLogonDrive ;
char * szLogonHome ;
1996-10-02 19:41:30 +04:00
char * szSmbrun ;
char * szWINSserver ;
1997-11-22 10:09:12 +03:00
char * szCodingSystem ;
1996-10-02 19:41:30 +04:00
char * szInterfaces ;
char * szRemoteAnnounce ;
1997-11-21 17:01:23 +03:00
char * szRemoteBrowseSync ;
1996-10-02 19:41:30 +04:00
char * szSocketAddress ;
1997-05-07 21:56:46 +04:00
char * szNISHomeMapName ;
1997-07-30 23:17:51 +04:00
char * szAnnounceVersion ; /* This is initialised in init_globals */
1997-07-31 22:47:26 +04:00
char * szNetbiosAliases ;
1997-10-08 21:12:07 +04:00
char * szDomainSID ;
1997-10-22 15:31:37 +04:00
char * szDomainOtherSIDs ;
1997-10-20 20:25:19 +04:00
char * szDomainGroups ;
1997-10-28 22:32:59 +03:00
char * szDriverFile ;
1998-03-16 23:59:47 +03:00
char * szNameResolveOrder ;
1996-06-06 15:43:09 +04:00
int max_log_size ;
int mangled_stack ;
int max_xmit ;
int max_mux ;
int max_packet ;
int pwordlevel ;
1997-09-19 21:12:08 +04:00
int unamelevel ;
1996-06-06 15:43:09 +04:00
int deadtime ;
int maxprotocol ;
int security ;
int maxdisksize ;
int lpqcachetime ;
int syslog ;
int os_level ;
int max_ttl ;
1997-12-13 17:16:07 +03:00
int max_wins_ttl ;
int min_wins_ttl ;
1996-06-07 07:34:22 +04:00
int ReadSize ;
1997-12-16 12:20:34 +03:00
int lm_announce ;
int lm_interval ;
1997-05-20 04:32:51 +04:00
int shmem_size ;
1997-06-11 05:03:06 +04:00
int client_code_page ;
1997-07-30 23:17:51 +04:00
int announce_as ; /* This is initialised in init_globals */
1997-07-06 16:06:23 +04:00
BOOL bDNSproxy ;
1996-06-06 15:43:09 +04:00
BOOL bWINSsupport ;
BOOL bWINSproxy ;
1997-05-20 04:32:51 +04:00
BOOL bLocalMaster ;
1996-06-06 15:43:09 +04:00
BOOL bPreferredMaster ;
following a cvs error, i am rewriting this monster-commit. with bad grace.
Modified Files:
---------------
Makefile:
adding extra files
ipc.c :
send_trans_reply() - alignment issue. this makes the alignment
the same as that in NT. this should be looked at by people who
understand the SMB stuff better than i.
api_fd_commands[] - added samr and wkssvc pipes.
loadparm.c :
lp_domain_controller() changed to mean "samba is a domain controller".
it's a "yes/no" parameter, now. no, it isn't used _anywhere_.
namedbwork.c nameelect.c :
if "domain controller = yes" then add SV_TYPE_DOMAIN_CTRL to the
host _and_ workgroup announcements. yes, you must do both: nt does.
namelogon.c :
important NETLOGON bug in SAMLOGON request parsing, which may be
the source of some people's problems with logging on to the Samba PDC.
password.c :
get_smbpwnam() renamed to get_smbpwd_entry().
pipes.c :
added samr and wkssvc pipes.
proto.h :
usual. can we actually _remove_ proto.h from the cvs tree, and
have it as one of the Makefile dependencies, or something?
reply.c :
get_smbpwnam() renamed to get_smbpwd_entry() - also changed response
error code when logging in from a WORKSTATION$ account. yes, paul
is right: we need to know when to return the right error code, and why.
server.c :
added call to reset_chain_pnum().
#ifdef NTDOMAIN added call to init_lsa_policy_hnd() #endif. jeremy,
you'd be proud: i did a compile without NTDOMAIN, and caught a link
error for this function.
smb.h :
defines and structures for samr and wkssvc pipes.
smbpass.c :
modified get_smbpwnam() to get_smbpwd_entry() and it now takes
two arguments. one for the name; if this is null, it looks up
by smb_userid instead.
oh, by the way, smb_userids are actually domain relative ids
(RIDs). concatenate a RID with the domain SID, and you have
an internet globally unique way of identifying a user.
we're using RIDs in the wrong way....
added mod_smbpwnam() function. this was based on code in smbpasswd.c
rpc_pipes/lsaparse.c :
added enum trusted domain parsing. this is incomplete: i need
a packet trace to write it properly.
rpc_pipes/pipe_hnd.c :
added reset_chain_pnum() function.
rpc_pipes/pipenetlog.c :
get_smbpwnam() function renamed to get_smbpwd_entry().
arcfour() issues.
removed capability of get_md4pw() function to automatically add
workstation accounts. this should either be done using
smbpasswd -add MACHINE$, or by using \PIPE\samr.
rpc_pipes/pipe_util.c :
create_pol_hnd() - creates a unique LSA Policy Handle. overkill
function: uses a 64 bit sequence number; current unix time and
the smbd pid.
rpc_pipes/smbparse.c :
arcfour() issues.
smb_io_unistr2() should advance by uni_str_len not uni_max_len.
smb_io_smb_hdr_rb() - request bind uses uint16 for the context
id, and uint8 for the num_syntaxes. oops, i put these both as
uint32s.
Added Files:
------------
rpc_pipes/lsa_hnd.c :
on the samr pipe, allocate and associate an LSA Policy Handle
with a SID. you receive queries with the LSA Policy Handle,
and have to turn this back into a SID in order to answer the
query...
rpc_pipes/pipesamr.c rpc_pipes/samrparse.c
\PIPE\samr processing. samr i presume is the SAM Replication pipe.
rpc_pipes/pipewkssvc.c rpc_pipes/wksparse.c
\PIPE\wkssvc processing. the Workstation Service pipe?
holy cow.
(This used to be commit 1bd084b3e690eb26a1006d616075e53d711ecd2f)
1997-11-07 02:03:58 +03:00
BOOL bDomainController ;
1996-06-06 15:43:09 +04:00
BOOL bDomainMaster ;
BOOL bDomainLogons ;
BOOL bEncryptPasswords ;
BOOL bStripDot ;
BOOL bNullPasswords ;
BOOL bLoadPrinters ;
BOOL bUseRhosts ;
BOOL bReadRaw ;
BOOL bWriteRaw ;
BOOL bReadPrediction ;
BOOL bReadbmpx ;
BOOL bSyslogOnly ;
BOOL bBrowseList ;
1997-05-07 21:56:46 +04:00
BOOL bUnixRealname ;
BOOL bNISHomeMap ;
1997-06-17 00:49:15 +04:00
BOOL bTimeServer ;
1997-10-20 22:52:04 +04:00
BOOL bBindInterfacesOnly ;
1998-02-07 15:15:20 +03:00
BOOL bNetWkstaUserLogon ;
1998-03-27 22:59:14 +03:00
BOOL bUnixPasswdSync ;
1996-05-04 11:50:46 +04:00
} global ;
static global Globals ;
/*
* This structure describes a single service .
*/
typedef struct
{
BOOL valid ;
char * szService ;
char * szPath ;
char * szUsername ;
char * szGuestaccount ;
char * szInvalidUsers ;
char * szValidUsers ;
char * szAdminUsers ;
char * szCopy ;
char * szInclude ;
char * szPreExec ;
char * szPostExec ;
char * szRootPreExec ;
char * szRootPostExec ;
char * szPrintcommand ;
char * szLpqcommand ;
char * szLprmcommand ;
char * szLppausecommand ;
char * szLpresumecommand ;
char * szPrintername ;
1996-08-13 12:57:55 +04:00
char * szPrinterDriver ;
1997-10-28 22:32:59 +03:00
char * szPrinterDriverLocation ;
1996-05-04 11:50:46 +04:00
char * szDontdescend ;
char * szHostsallow ;
char * szHostsdeny ;
char * szMagicScript ;
char * szMagicOutput ;
char * szMangledMap ;
1997-07-06 17:48:10 +04:00
char * szVetoFiles ;
char * szHideFiles ;
1997-11-17 22:16:38 +03:00
char * szVetoOplockFiles ;
1996-05-04 11:50:46 +04:00
char * comment ;
char * force_user ;
char * force_group ;
char * readlist ;
char * writelist ;
char * volume ;
int iMinPrintSpace ;
1997-07-25 02:42:16 +04:00
int iCreate_mask ;
1997-06-19 04:18:23 +04:00
int iCreate_force_mode ;
1997-07-25 02:42:16 +04:00
int iDir_mask ;
1997-06-19 04:18:23 +04:00
int iDir_force_mode ;
1996-05-04 11:50:46 +04:00
int iMaxConnections ;
int iDefaultCase ;
1997-12-03 06:37:02 +03:00
int iPrinting ;
1996-05-04 11:50:46 +04:00
BOOL bAlternatePerm ;
BOOL bRevalidate ;
BOOL bCaseSensitive ;
BOOL bCasePreserve ;
BOOL bShortCasePreserve ;
BOOL bCaseMangle ;
BOOL status ;
BOOL bHideDotFiles ;
BOOL bBrowseable ;
BOOL bAvailable ;
BOOL bRead_only ;
BOOL bNo_set_dir ;
BOOL bGuest_only ;
BOOL bGuest_ok ;
BOOL bPrint_ok ;
BOOL bPostscript ;
BOOL bMap_system ;
BOOL bMap_hidden ;
BOOL bMap_archive ;
BOOL bLocking ;
BOOL bStrictLocking ;
BOOL bShareModes ;
1997-10-02 07:14:32 +04:00
BOOL bOpLocks ;
1996-05-04 11:50:46 +04:00
BOOL bOnlyUser ;
BOOL bMangledNames ;
BOOL bWidelinks ;
1997-07-19 00:21:32 +04:00
BOOL bSymlinks ;
1996-05-04 11:50:46 +04:00
BOOL bSyncAlways ;
char magic_char ;
BOOL * copymap ;
1996-05-31 19:13:29 +04:00
BOOL bDeleteReadonly ;
1996-10-05 14:41:13 +04:00
BOOL bFakeOplocks ;
1997-09-17 05:29:53 +04:00
BOOL bDeleteVetoFiles ;
1997-10-20 22:52:04 +04:00
BOOL bDosFiletimes ;
1998-02-13 10:11:58 +03:00
BOOL bDosFiletimeResolution ;
1998-03-16 23:59:47 +03:00
BOOL bFakeDirCreateTimes ;
1996-05-04 11:50:46 +04:00
char dummy [ 3 ] ; /* for alignment */
} service ;
/* This is a default service used to prime a services structure */
static service sDefault =
{
True , /* valid */
NULL , /* szService */
NULL , /* szPath */
NULL , /* szUsername */
1997-07-24 21:25:11 +04:00
NULL , /* szGuestAccount - this is set in init_globals() */
1996-05-04 11:50:46 +04:00
NULL , /* szInvalidUsers */
NULL , /* szValidUsers */
NULL , /* szAdminUsers */
NULL , /* szCopy */
NULL , /* szInclude */
NULL , /* szPreExec */
NULL , /* szPostExec */
NULL , /* szRootPreExec */
NULL , /* szRootPostExec */
NULL , /* szPrintcommand */
NULL , /* szLpqcommand */
NULL , /* szLprmcommand */
NULL , /* szLppausecommand */
NULL , /* szLpresumecommand */
NULL , /* szPrintername */
1997-07-24 21:25:11 +04:00
NULL , /* szPrinterDriver - this is set in init_globals() */
1997-10-28 22:32:59 +03:00
NULL , /* szPrinterDriverLocation */
1996-05-04 11:50:46 +04:00
NULL , /* szDontdescend */
NULL , /* szHostsallow */
NULL , /* szHostsdeny */
NULL , /* szMagicScript */
NULL , /* szMagicOutput */
NULL , /* szMangledMap */
1997-07-06 17:48:10 +04:00
NULL , /* szVetoFiles */
1997-07-24 21:25:11 +04:00
NULL , /* szHideFiles */
1997-11-17 22:16:38 +03:00
NULL , /* szVetoOplockFiles */
1996-05-04 11:50:46 +04:00
NULL , /* comment */
NULL , /* force user */
NULL , /* force group */
NULL , /* readlist */
NULL , /* writelist */
NULL , /* volume */
0 , /* iMinPrintSpace */
1997-07-25 02:42:16 +04:00
0744 , /* iCreate_mask */
1997-07-01 05:19:13 +04:00
0000 , /* iCreate_force_mode */
1997-07-25 02:42:16 +04:00
0755 , /* iDir_mask */
1997-06-19 04:18:23 +04:00
0000 , /* iDir_force_mode */
1996-05-04 11:50:46 +04:00
0 , /* iMaxConnections */
CASE_LOWER , /* iDefaultCase */
1997-12-03 06:37:02 +03:00
DEFAULT_PRINTING , /* iPrinting */
1996-05-04 11:50:46 +04:00
False , /* bAlternatePerm */
False , /* revalidate */
False , /* case sensitive */
False , /* case preserve */
False , /* short case preserve */
False , /* case mangle */
True , /* status */
True , /* bHideDotFiles */
True , /* bBrowseable */
True , /* bAvailable */
True , /* bRead_only */
True , /* bNo_set_dir */
False , /* bGuest_only */
False , /* bGuest_ok */
False , /* bPrint_ok */
False , /* bPostscript */
False , /* bMap_system */
False , /* bMap_hidden */
True , /* bMap_archive */
True , /* bLocking */
False , /* bStrictLocking */
True , /* bShareModes */
1997-10-02 07:14:32 +04:00
True , /* bOpLocks */
1996-05-04 11:50:46 +04:00
False , /* bOnlyUser */
True , /* bMangledNames */
True , /* bWidelinks */
1997-07-19 00:21:32 +04:00
True , /* bSymlinks */
1996-05-04 11:50:46 +04:00
False , /* bSyncAlways */
' ~ ' , /* magic char */
NULL , /* copymap */
1996-05-31 19:13:29 +04:00
False , /* bDeleteReadonly */
1996-10-05 14:41:13 +04:00
False , /* bFakeOplocks */
1997-09-17 05:29:53 +04:00
False , /* bDeleteVetoFiles */
1997-10-20 22:52:04 +04:00
False , /* bDosFiletimes */
1998-02-13 10:11:58 +03:00
False , /* bDosFiletimeResolution */
1998-03-16 23:59:47 +03:00
False , /* bFakeDirCreateTimes */
1996-05-04 11:50:46 +04:00
" " /* dummy */
} ;
/* local variables */
static service * * ServicePtrs = NULL ;
static int iNumServices = 0 ;
static int iServiceIndex = 0 ;
static BOOL bInGlobalSection = True ;
static BOOL bGlobalOnly = False ;
1997-07-30 23:17:51 +04:00
static int default_server_announce ;
1996-05-04 11:50:46 +04:00
# define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
/* prototypes for the special type handlers */
static BOOL handle_valid_chars ( char * pszParmValue , char * * ptr ) ;
static BOOL handle_include ( char * pszParmValue , char * * ptr ) ;
static BOOL handle_copy ( char * pszParmValue , char * * ptr ) ;
1997-11-22 10:09:12 +03:00
static BOOL handle_character_set ( char * pszParmValue , char * * ptr ) ;
static BOOL handle_coding_system ( char * pszParmValue , char * * ptr ) ;
1996-05-04 11:50:46 +04:00
1997-08-05 05:31:55 +04:00
static void set_default_server_announce_type ( void ) ;
1997-11-22 10:09:12 +03:00
static struct enum_list enum_protocol [ ] = { { PROTOCOL_NT1 , " NT1 " } , { PROTOCOL_LANMAN2 , " LANMAN2 " } ,
{ PROTOCOL_LANMAN1 , " LANMAN1 " } , { PROTOCOL_CORE , " CORE " } ,
{ PROTOCOL_COREPLUS , " COREPLUS " } ,
{ PROTOCOL_COREPLUS , " CORE+ " } , { - 1 , NULL } } ;
static struct enum_list enum_security [ ] = { { SEC_SHARE , " SHARE " } , { SEC_USER , " USER " } ,
{ SEC_SERVER , " SERVER " } , { - 1 , NULL } } ;
static struct enum_list enum_printing [ ] = { { PRINT_SYSV , " sysv " } , { PRINT_AIX , " aix " } ,
{ PRINT_HPUX , " hpux " } , { PRINT_BSD , " bsd " } ,
{ PRINT_QNX , " qnx " } , { PRINT_PLP , " plp " } ,
1998-04-02 05:01:24 +04:00
{ PRINT_LPRNG , " lprng " } , { PRINT_SOFTQ , " softq " } ,
{ - 1 , NULL } } ;
1997-11-22 10:09:12 +03:00
static struct enum_list enum_announce_as [ ] = { { ANNOUNCE_AS_NT , " NT " } , { ANNOUNCE_AS_WIN95 , " win95 " } ,
{ ANNOUNCE_AS_WFW , " WfW " } , { - 1 , NULL } } ;
static struct enum_list enum_case [ ] = { { CASE_LOWER , " lower " } , { CASE_UPPER , " upper " } , { - 1 , NULL } } ;
1997-12-17 07:56:55 +03:00
static struct enum_list enum_lm_announce [ ] = { { 0 , " False " } , { 1 , " True " } , { 2 , " Auto " } , { - 1 , NULL } } ;
1997-12-16 12:20:34 +03:00
1998-03-14 11:27:41 +03:00
/* note that we do not initialise the defaults union - it is not allowed in ANSI C */
1998-03-08 17:14:49 +03:00
static struct parm_struct parm_table [ ] =
1996-05-04 11:50:46 +04:00
{
1998-03-14 11:27:41 +03:00
{ " Base Options " , P_SEP , P_SEPARATOR } ,
{ " comment " , P_STRING , P_LOCAL , & sDefault . comment , NULL , NULL , FLAG_BASIC | FLAG_PRINT } ,
{ " path " , P_STRING , P_LOCAL , & sDefault . szPath , NULL , NULL , FLAG_BASIC | FLAG_PRINT } ,
{ " directory " , P_STRING , P_LOCAL , & sDefault . szPath , NULL , NULL , 0 } ,
{ " workgroup " , P_USTRING , P_GLOBAL , & Globals . szWorkGroup , NULL , NULL , FLAG_BASIC } ,
{ " netbios name " , P_UGSTRING , P_GLOBAL , myname , NULL , NULL , FLAG_BASIC } ,
{ " netbios aliases " , P_STRING , P_GLOBAL , & Globals . szNetbiosAliases , NULL , NULL , 0 } ,
{ " server string " , P_STRING , P_GLOBAL , & Globals . szServerString , NULL , NULL , FLAG_BASIC } ,
{ " interfaces " , P_STRING , P_GLOBAL , & Globals . szInterfaces , NULL , NULL , FLAG_BASIC } ,
{ " bind interfaces only " , P_BOOL , P_GLOBAL , & Globals . bBindInterfacesOnly , NULL , NULL , 0 } ,
{ " Security Options " , P_SEP , P_SEPARATOR } ,
1998-03-08 17:14:49 +03:00
{ " security " , P_ENUM , P_GLOBAL , & Globals . security , NULL , enum_security , FLAG_BASIC } ,
{ " encrypt passwords " , P_BOOL , P_GLOBAL , & Globals . bEncryptPasswords , NULL , NULL , FLAG_BASIC } ,
{ " use rhosts " , P_BOOL , P_GLOBAL , & Globals . bUseRhosts , NULL , NULL , 0 } ,
{ " null passwords " , P_BOOL , P_GLOBAL , & Globals . bNullPasswords , NULL , NULL , 0 } ,
{ " password server " , P_STRING , P_GLOBAL , & Globals . szPasswordServer , NULL , NULL , 0 } ,
{ " smb passwd file " , P_STRING , P_GLOBAL , & Globals . szSMBPasswdFile , NULL , NULL , 0 } ,
{ " hosts equiv " , P_STRING , P_GLOBAL , & Globals . szHostsEquiv , NULL , NULL , 0 } ,
{ " root directory " , P_STRING , P_GLOBAL , & Globals . szRootdir , NULL , NULL , 0 } ,
{ " root dir " , P_STRING , P_GLOBAL , & Globals . szRootdir , NULL , NULL , 0 } ,
{ " root " , P_STRING , P_GLOBAL , & Globals . szRootdir , NULL , NULL , 0 } ,
{ " passwd program " , P_STRING , P_GLOBAL , & Globals . szPasswdProgram , NULL , NULL , 0 } ,
{ " passwd chat " , P_STRING , P_GLOBAL , & Globals . szPasswdChat , NULL , NULL , 0 } ,
1998-03-14 11:27:41 +03:00
{ " username map " , P_STRING , P_GLOBAL , & Globals . szUsernameMap , NULL , NULL , 0 } ,
{ " password level " , P_INTEGER , P_GLOBAL , & Globals . pwordlevel , NULL , NULL , 0 } ,
{ " username level " , P_INTEGER , P_GLOBAL , & Globals . unamelevel , NULL , NULL , 0 } ,
1998-03-27 22:59:14 +03:00
{ " unix password sync " , P_BOOL , P_GLOBAL , & Globals . bUnixPasswdSync , NULL , NULL , 0 } ,
1998-03-14 11:27:41 +03:00
{ " alternate permissions " , P_BOOL , P_LOCAL , & sDefault . bAlternatePerm , NULL , NULL , FLAG_GLOBAL } ,
{ " revalidate " , P_BOOL , P_LOCAL , & sDefault . bRevalidate , NULL , NULL , FLAG_GLOBAL } ,
{ " username " , P_STRING , P_LOCAL , & sDefault . szUsername , NULL , NULL , FLAG_GLOBAL } ,
{ " user " , P_STRING , P_LOCAL , & sDefault . szUsername , NULL , NULL , 0 } ,
{ " users " , P_STRING , P_LOCAL , & sDefault . szUsername , NULL , NULL , 0 } ,
{ " guest account " , P_STRING , P_LOCAL , & sDefault . szGuestaccount , NULL , NULL , FLAG_BASIC | FLAG_PRINT | FLAG_GLOBAL } ,
{ " invalid users " , P_STRING , P_LOCAL , & sDefault . szInvalidUsers , NULL , NULL , FLAG_GLOBAL } ,
{ " valid users " , P_STRING , P_LOCAL , & sDefault . szValidUsers , NULL , NULL , FLAG_GLOBAL } ,
{ " admin users " , P_STRING , P_LOCAL , & sDefault . szAdminUsers , NULL , NULL , FLAG_GLOBAL } ,
{ " read list " , P_STRING , P_LOCAL , & sDefault . readlist , NULL , NULL , FLAG_GLOBAL } ,
{ " write list " , P_STRING , P_LOCAL , & sDefault . writelist , NULL , NULL , FLAG_GLOBAL } ,
{ " force user " , P_STRING , P_LOCAL , & sDefault . force_user , NULL , NULL , 0 } ,
{ " force group " , P_STRING , P_LOCAL , & sDefault . force_group , NULL , NULL , 0 } ,
{ " group " , P_STRING , P_LOCAL , & sDefault . force_group , NULL , NULL , 0 } ,
{ " read only " , P_BOOL , P_LOCAL , & sDefault . bRead_only , NULL , NULL , FLAG_BASIC } ,
{ " write ok " , P_BOOLREV , P_LOCAL , & sDefault . bRead_only , NULL , NULL , 0 } ,
{ " writeable " , P_BOOLREV , P_LOCAL , & sDefault . bRead_only , NULL , NULL , 0 } ,
{ " writable " , P_BOOLREV , P_LOCAL , & sDefault . bRead_only , NULL , NULL , 0 } ,
{ " create mask " , P_OCTAL , P_LOCAL , & sDefault . iCreate_mask , NULL , NULL , FLAG_GLOBAL } ,
{ " create mode " , P_OCTAL , P_LOCAL , & sDefault . iCreate_mask , NULL , NULL , FLAG_GLOBAL } ,
{ " force create mode " , P_OCTAL , P_LOCAL , & sDefault . iCreate_force_mode , NULL , NULL , FLAG_GLOBAL } ,
{ " directory mask " , P_OCTAL , P_LOCAL , & sDefault . iDir_mask , NULL , NULL , FLAG_GLOBAL } ,
{ " directory mode " , P_OCTAL , P_LOCAL , & sDefault . iDir_mask , NULL , NULL , FLAG_GLOBAL } ,
{ " force directory mode " , P_OCTAL , P_LOCAL , & sDefault . iDir_force_mode , NULL , NULL , FLAG_GLOBAL } ,
{ " guest only " , P_BOOL , P_LOCAL , & sDefault . bGuest_only , NULL , NULL , 0 } ,
{ " only guest " , P_BOOL , P_LOCAL , & sDefault . bGuest_only , NULL , NULL , 0 } ,
{ " guest ok " , P_BOOL , P_LOCAL , & sDefault . bGuest_ok , NULL , NULL , FLAG_BASIC | FLAG_PRINT } ,
{ " public " , P_BOOL , P_LOCAL , & sDefault . bGuest_ok , NULL , NULL , 0 } ,
{ " only user " , P_BOOL , P_LOCAL , & sDefault . bOnlyUser , NULL , NULL , 0 } ,
{ " hosts allow " , P_STRING , P_LOCAL , & sDefault . szHostsallow , NULL , NULL , FLAG_GLOBAL | FLAG_BASIC | FLAG_PRINT } ,
{ " allow hosts " , P_STRING , P_LOCAL , & sDefault . szHostsallow , NULL , NULL , 0 } ,
{ " hosts deny " , P_STRING , P_LOCAL , & sDefault . szHostsdeny , NULL , NULL , FLAG_GLOBAL | FLAG_BASIC | FLAG_PRINT } ,
{ " deny hosts " , P_STRING , P_LOCAL , & sDefault . szHostsdeny , NULL , NULL , 0 } ,
1998-03-12 00:11:04 +03:00
1998-03-14 11:27:41 +03:00
{ " Logging Options " , P_SEP , P_SEPARATOR } ,
{ " log level " , P_INTEGER , P_GLOBAL , & DEBUGLEVEL , NULL , NULL , FLAG_BASIC } ,
{ " debuglevel " , P_INTEGER , P_GLOBAL , & DEBUGLEVEL , NULL , NULL , 0 } ,
{ " syslog " , P_INTEGER , P_GLOBAL , & Globals . syslog , NULL , NULL , 0 } ,
{ " syslog only " , P_BOOL , P_GLOBAL , & Globals . bSyslogOnly , NULL , NULL , 0 } ,
{ " log file " , P_STRING , P_GLOBAL , & Globals . szLogFile , NULL , NULL , 0 } ,
{ " max log size " , P_INTEGER , P_GLOBAL , & Globals . max_log_size , NULL , NULL , 0 } ,
{ " status " , P_BOOL , P_LOCAL , & sDefault . status , NULL , NULL , FLAG_GLOBAL } ,
{ " Protocol Options " , P_SEP , P_SEPARATOR } ,
{ " protocol " , P_ENUM , P_GLOBAL , & Globals . maxprotocol , NULL , enum_protocol , 0 } ,
{ " read bmpx " , P_BOOL , P_GLOBAL , & Globals . bReadbmpx , NULL , NULL , 0 } ,
{ " read raw " , P_BOOL , P_GLOBAL , & Globals . bReadRaw , NULL , NULL , 0 } ,
{ " write raw " , P_BOOL , P_GLOBAL , & Globals . bWriteRaw , NULL , NULL , 0 } ,
{ " networkstation user login " , P_BOOL , P_GLOBAL , & Globals . bNetWkstaUserLogon , NULL , NULL , 0 } ,
{ " announce version " , P_STRING , P_GLOBAL , & Globals . szAnnounceVersion , NULL , NULL , 0 } ,
{ " announce as " , P_ENUM , P_GLOBAL , & Globals . announce_as , NULL , enum_announce_as , 0 } ,
{ " max mux " , P_INTEGER , P_GLOBAL , & Globals . max_mux , NULL , NULL , 0 } ,
{ " max xmit " , P_INTEGER , P_GLOBAL , & Globals . max_xmit , NULL , NULL , 0 } ,
1998-03-16 23:59:47 +03:00
{ " name resolve order " , P_STRING , P_GLOBAL , & Globals . szNameResolveOrder , NULL , NULL , 0 } ,
1998-03-14 11:27:41 +03:00
{ " max packet " , P_INTEGER , P_GLOBAL , & Globals . max_packet , NULL , NULL , 0 } ,
{ " packet size " , P_INTEGER , P_GLOBAL , & Globals . max_packet , NULL , NULL , 0 } ,
{ " max ttl " , P_INTEGER , P_GLOBAL , & Globals . max_ttl , NULL , NULL , 0 } ,
{ " max wins ttl " , P_INTEGER , P_GLOBAL , & Globals . max_wins_ttl , NULL , NULL , 0 } ,
{ " min wins ttl " , P_INTEGER , P_GLOBAL , & Globals . min_wins_ttl , NULL , NULL , 0 } ,
{ " time server " , P_BOOL , P_GLOBAL , & Globals . bTimeServer , NULL , NULL , 0 } ,
{ " Tuning Options " , P_SEP , P_SEPARATOR } ,
{ " max disk size " , P_INTEGER , P_GLOBAL , & Globals . maxdisksize , NULL , NULL , 0 } ,
{ " lpq cache time " , P_INTEGER , P_GLOBAL , & Globals . lpqcachetime , NULL , NULL , 0 } ,
{ " getwd cache " , P_BOOL , P_GLOBAL , & use_getwd_cache , NULL , NULL , 0 } ,
{ " read prediction " , P_BOOL , P_GLOBAL , & Globals . bReadPrediction , NULL , NULL , 0 } ,
{ " socket options " , P_GSTRING , P_GLOBAL , user_socket_options , NULL , NULL , 0 } ,
{ " keepalive " , P_INTEGER , P_GLOBAL , & keepalive , NULL , NULL , 0 } ,
{ " deadtime " , P_INTEGER , P_GLOBAL , & Globals . deadtime , NULL , NULL , 0 } ,
{ " read size " , P_INTEGER , P_GLOBAL , & Globals . ReadSize , NULL , NULL , 0 } ,
{ " shared mem size " , P_INTEGER , P_GLOBAL , & Globals . shmem_size , NULL , NULL , 0 } ,
{ " max connections " , P_INTEGER , P_LOCAL , & sDefault . iMaxConnections , NULL , NULL , 0 } ,
{ " min print space " , P_INTEGER , P_LOCAL , & sDefault . iMinPrintSpace , NULL , NULL , 0 } ,
{ " sync always " , P_BOOL , P_LOCAL , & sDefault . bSyncAlways , NULL , NULL , 0 } ,
{ " Printing Options " , P_SEP , P_SEPARATOR } ,
{ " load printers " , P_BOOL , P_GLOBAL , & Globals . bLoadPrinters , NULL , NULL , 0 } ,
{ " printcap name " , P_STRING , P_GLOBAL , & Globals . szPrintcapname , NULL , NULL , 0 } ,
{ " printcap " , P_STRING , P_GLOBAL , & Globals . szPrintcapname , NULL , NULL , 0 } ,
{ " printer driver file " , P_STRING , P_GLOBAL , & Globals . szDriverFile , NULL , NULL , 0 } ,
{ " print ok " , P_BOOL , P_LOCAL , & sDefault . bPrint_ok , NULL , NULL , 0 } ,
{ " printable " , P_BOOL , P_LOCAL , & sDefault . bPrint_ok , NULL , NULL , 0 } ,
{ " postscript " , P_BOOL , P_LOCAL , & sDefault . bPostscript , NULL , NULL , FLAG_PRINT } ,
{ " printing " , P_ENUM , P_LOCAL , & sDefault . iPrinting , NULL , enum_printing , FLAG_PRINT | FLAG_GLOBAL } ,
{ " print command " , P_STRING , P_LOCAL , & sDefault . szPrintcommand , NULL , NULL , FLAG_PRINT | FLAG_GLOBAL } ,
{ " lpq command " , P_STRING , P_LOCAL , & sDefault . szLpqcommand , NULL , NULL , FLAG_PRINT | FLAG_GLOBAL } ,
{ " lprm command " , P_STRING , P_LOCAL , & sDefault . szLprmcommand , NULL , NULL , FLAG_PRINT | FLAG_GLOBAL } ,
{ " lppause command " , P_STRING , P_LOCAL , & sDefault . szLppausecommand , NULL , NULL , FLAG_GLOBAL } ,
{ " lpresume command " , P_STRING , P_LOCAL , & sDefault . szLpresumecommand , NULL , NULL , FLAG_GLOBAL } ,
{ " printer name " , P_STRING , P_LOCAL , & sDefault . szPrintername , NULL , NULL , FLAG_PRINT } ,
{ " printer " , P_STRING , P_LOCAL , & sDefault . szPrintername , NULL , NULL , 0 } ,
{ " printer driver " , P_STRING , P_LOCAL , & sDefault . szPrinterDriver , NULL , NULL , 0 } ,
{ " printer driver location " , P_STRING , P_LOCAL , & sDefault . szPrinterDriverLocation , NULL , NULL , FLAG_GLOBAL } ,
{ " Filename Handling " , P_SEP , P_SEPARATOR } ,
{ " strip dot " , P_BOOL , P_GLOBAL , & Globals . bStripDot , NULL , NULL , 0 } ,
{ " character set " , P_STRING , P_GLOBAL , & Globals . szCharacterSet , handle_character_set , NULL , 0 } ,
{ " mangled stack " , P_INTEGER , P_GLOBAL , & Globals . mangled_stack , NULL , NULL , 0 } ,
{ " coding system " , P_STRING , P_GLOBAL , & Globals . szCodingSystem , handle_coding_system , NULL , 0 } ,
{ " client code page " , P_INTEGER , P_GLOBAL , & Globals . client_code_page , NULL , NULL , 0 } ,
{ " default case " , P_ENUM , P_LOCAL , & sDefault . iDefaultCase , NULL , enum_case , 0 } ,
{ " case sensitive " , P_BOOL , P_LOCAL , & sDefault . bCaseSensitive , NULL , NULL , FLAG_GLOBAL } ,
{ " casesignames " , P_BOOL , P_LOCAL , & sDefault . bCaseSensitive , NULL , NULL , 0 } ,
{ " preserve case " , P_BOOL , P_LOCAL , & sDefault . bCasePreserve , NULL , NULL , FLAG_GLOBAL } ,
{ " short preserve case " , P_BOOL , P_LOCAL , & sDefault . bShortCasePreserve , NULL , NULL , FLAG_GLOBAL } ,
{ " mangle case " , P_BOOL , P_LOCAL , & sDefault . bCaseMangle , NULL , NULL , FLAG_GLOBAL } ,
{ " mangling char " , P_CHAR , P_LOCAL , & sDefault . magic_char , NULL , NULL , FLAG_GLOBAL } ,
{ " hide dot files " , P_BOOL , P_LOCAL , & sDefault . bHideDotFiles , NULL , NULL , FLAG_GLOBAL } ,
{ " delete veto files " , P_BOOL , P_LOCAL , & sDefault . bDeleteVetoFiles , NULL , NULL , FLAG_GLOBAL } ,
{ " veto files " , P_STRING , P_LOCAL , & sDefault . szVetoFiles , NULL , NULL , FLAG_GLOBAL } ,
{ " hide files " , P_STRING , P_LOCAL , & sDefault . szHideFiles , NULL , NULL , FLAG_GLOBAL } ,
{ " veto oplock files " , P_STRING , P_LOCAL , & sDefault . szVetoOplockFiles , NULL , NULL , FLAG_GLOBAL } ,
{ " map system " , P_BOOL , P_LOCAL , & sDefault . bMap_system , NULL , NULL , FLAG_GLOBAL } ,
{ " map hidden " , P_BOOL , P_LOCAL , & sDefault . bMap_hidden , NULL , NULL , FLAG_GLOBAL } ,
{ " map archive " , P_BOOL , P_LOCAL , & sDefault . bMap_archive , NULL , NULL , FLAG_GLOBAL } ,
{ " mangled names " , P_BOOL , P_LOCAL , & sDefault . bMangledNames , NULL , NULL , FLAG_GLOBAL } ,
{ " mangled map " , P_STRING , P_LOCAL , & sDefault . szMangledMap , NULL , NULL , FLAG_GLOBAL } ,
{ " Domain Options " , P_SEP , P_SEPARATOR } ,
1998-03-08 17:14:49 +03:00
{ " domain sid " , P_USTRING , P_GLOBAL , & Globals . szDomainSID , NULL , NULL , 0 } ,
{ " domain other sids " , P_STRING , P_GLOBAL , & Globals . szDomainOtherSIDs , NULL , NULL , 0 } ,
{ " domain groups " , P_STRING , P_GLOBAL , & Globals . szDomainGroups , NULL , NULL , 0 } ,
{ " domain controller " , P_BOOL , P_GLOBAL , & Globals . bDomainController , NULL , NULL , 0 } ,
{ " domain admin users " , P_STRING , P_GLOBAL , & Globals . szDomainAdminUsers , NULL , NULL , 0 } ,
{ " domain guest users " , P_STRING , P_GLOBAL , & Globals . szDomainGuestUsers , NULL , NULL , 0 } ,
{ " domain hosts allow " , P_STRING , P_GLOBAL , & Globals . szDomainHostsallow , NULL , NULL , 0 } ,
{ " domain allow hosts " , P_STRING , P_GLOBAL , & Globals . szDomainHostsallow , NULL , NULL , 0 } ,
{ " domain hosts deny " , P_STRING , P_GLOBAL , & Globals . szDomainHostsdeny , NULL , NULL , 0 } ,
{ " domain deny hosts " , P_STRING , P_GLOBAL , & Globals . szDomainHostsdeny , NULL , NULL , 0 } ,
1998-03-12 00:11:04 +03:00
1998-03-14 11:27:41 +03:00
{ " Logon Options " , P_SEP , P_SEPARATOR } ,
1998-03-08 17:14:49 +03:00
{ " logon script " , P_STRING , P_GLOBAL , & Globals . szLogonScript , NULL , NULL , 0 } ,
{ " logon path " , P_STRING , P_GLOBAL , & Globals . szLogonPath , NULL , NULL , 0 } ,
{ " logon drive " , P_STRING , P_GLOBAL , & Globals . szLogonDrive , NULL , NULL , 0 } ,
{ " logon home " , P_STRING , P_GLOBAL , & Globals . szLogonHome , NULL , NULL , 0 } ,
1998-03-14 11:27:41 +03:00
{ " domain logons " , P_BOOL , P_GLOBAL , & Globals . bDomainLogons , NULL , NULL , 0 } ,
{ " Browse Options " , P_SEP , P_SEPARATOR } ,
1998-03-08 17:14:49 +03:00
{ " os level " , P_INTEGER , P_GLOBAL , & Globals . os_level , NULL , NULL , 0 } ,
{ " lm announce " , P_ENUM , P_GLOBAL , & Globals . lm_announce , NULL , enum_lm_announce , 0 } ,
{ " lm interval " , P_INTEGER , P_GLOBAL , & Globals . lm_interval , NULL , NULL , 0 } ,
{ " preferred master " , P_BOOL , P_GLOBAL , & Globals . bPreferredMaster , NULL , NULL , 0 } ,
{ " prefered master " , P_BOOL , P_GLOBAL , & Globals . bPreferredMaster , NULL , NULL , 0 } ,
{ " local master " , P_BOOL , P_GLOBAL , & Globals . bLocalMaster , NULL , NULL , 0 } ,
{ " domain master " , P_BOOL , P_GLOBAL , & Globals . bDomainMaster , NULL , NULL , 0 } ,
{ " browse list " , P_BOOL , P_GLOBAL , & Globals . bBrowseList , NULL , NULL , 0 } ,
1998-03-14 11:27:41 +03:00
{ " browseable " , P_BOOL , P_LOCAL , & sDefault . bBrowseable , NULL , NULL , 0 } ,
{ " browsable " , P_BOOL , P_LOCAL , & sDefault . bBrowseable , NULL , NULL , 0 } ,
{ " WINS Options " , P_SEP , P_SEPARATOR } ,
{ " dns proxy " , P_BOOL , P_GLOBAL , & Globals . bDNSproxy , NULL , NULL , 0 } ,
{ " wins support " , P_BOOL , P_GLOBAL , & Globals . bWINSsupport , NULL , NULL , FLAG_BASIC } ,
{ " wins proxy " , P_BOOL , P_GLOBAL , & Globals . bWINSproxy , NULL , NULL , 0 } ,
{ " wins server " , P_STRING , P_GLOBAL , & Globals . szWINSserver , NULL , NULL , FLAG_BASIC } ,
{ " Locking Options " , P_SEP , P_SEPARATOR } ,
{ " locking " , P_BOOL , P_LOCAL , & sDefault . bLocking , NULL , NULL , FLAG_GLOBAL } ,
{ " strict locking " , P_BOOL , P_LOCAL , & sDefault . bStrictLocking , NULL , NULL , FLAG_GLOBAL } ,
{ " share modes " , P_BOOL , P_LOCAL , & sDefault . bShareModes , NULL , NULL , FLAG_GLOBAL } ,
{ " oplocks " , P_BOOL , P_LOCAL , & sDefault . bOpLocks , NULL , NULL , FLAG_GLOBAL } ,
{ " fake oplocks " , P_BOOL , P_LOCAL , & sDefault . bFakeOplocks , NULL , NULL , 0 } ,
{ " Miscellaneous Options " , P_SEP , P_SEPARATOR } ,
{ " smbrun " , P_STRING , P_GLOBAL , & Globals . szSmbrun , NULL , NULL , 0 } ,
{ " config file " , P_STRING , P_GLOBAL , & Globals . szConfigFile , NULL , NULL , FLAG_HIDE } ,
{ " preload " , P_STRING , P_GLOBAL , & Globals . szAutoServices , NULL , NULL , 0 } ,
{ " auto services " , P_STRING , P_GLOBAL , & Globals . szAutoServices , NULL , NULL , 0 } ,
{ " lock dir " , P_STRING , P_GLOBAL , & Globals . szLockDir , NULL , NULL , 0 } ,
{ " lock directory " , P_STRING , P_GLOBAL , & Globals . szLockDir , NULL , NULL , 0 } ,
{ " default service " , P_STRING , P_GLOBAL , & Globals . szDefaultService , NULL , NULL , 0 } ,
{ " default " , P_STRING , P_GLOBAL , & Globals . szDefaultService , NULL , NULL , 0 } ,
{ " message command " , P_STRING , P_GLOBAL , & Globals . szMsgCommand , NULL , NULL , 0 } ,
{ " dfree command " , P_STRING , P_GLOBAL , & Globals . szDfree , NULL , NULL , 0 } ,
{ " valid chars " , P_STRING , P_GLOBAL , & Globals . szValidChars , handle_valid_chars , NULL , 0 } ,
{ " remote announce " , P_STRING , P_GLOBAL , & Globals . szRemoteAnnounce , NULL , NULL , 0 } ,
{ " remote browse sync " , P_STRING , P_GLOBAL , & Globals . szRemoteBrowseSync , NULL , NULL , 0 } ,
{ " socket address " , P_STRING , P_GLOBAL , & Globals . szSocketAddress , NULL , NULL , 0 } ,
{ " homedir map " , P_STRING , P_GLOBAL , & Globals . szNISHomeMapName , NULL , NULL , 0 } ,
{ " time offset " , P_INTEGER , P_GLOBAL , & extra_time_offset , NULL , NULL , 0 } ,
1998-03-08 17:14:49 +03:00
{ " unix realname " , P_BOOL , P_GLOBAL , & Globals . bUnixRealname , NULL , NULL , 0 } ,
{ " NIS homedir " , P_BOOL , P_GLOBAL , & Globals . bNISHomeMap , NULL , NULL , 0 } ,
{ " -valid " , P_BOOL , P_LOCAL , & sDefault . valid , NULL , NULL , FLAG_HIDE } ,
{ " copy " , P_STRING , P_LOCAL , & sDefault . szCopy , handle_copy , NULL , FLAG_HIDE } ,
{ " include " , P_STRING , P_LOCAL , & sDefault . szInclude , handle_include , NULL , FLAG_HIDE } ,
{ " exec " , P_STRING , P_LOCAL , & sDefault . szPreExec , NULL , NULL , 0 } ,
{ " preexec " , P_STRING , P_LOCAL , & sDefault . szPreExec , NULL , NULL , 0 } ,
{ " postexec " , P_STRING , P_LOCAL , & sDefault . szPostExec , NULL , NULL , 0 } ,
{ " root preexec " , P_STRING , P_LOCAL , & sDefault . szRootPreExec , NULL , NULL , 0 } ,
{ " root postexec " , P_STRING , P_LOCAL , & sDefault . szRootPostExec , NULL , NULL , 0 } ,
{ " available " , P_BOOL , P_LOCAL , & sDefault . bAvailable , NULL , NULL , 0 } ,
{ " volume " , P_STRING , P_LOCAL , & sDefault . volume , NULL , NULL , 0 } ,
{ " set directory " , P_BOOLREV , P_LOCAL , & sDefault . bNo_set_dir , NULL , NULL , 0 } ,
1998-03-14 11:27:41 +03:00
{ " wide links " , P_BOOL , P_LOCAL , & sDefault . bWidelinks , NULL , NULL , FLAG_GLOBAL } ,
{ " follow symlinks " , P_BOOL , P_LOCAL , & sDefault . bSymlinks , NULL , NULL , FLAG_GLOBAL } ,
1998-03-08 17:14:49 +03:00
{ " dont descend " , P_STRING , P_LOCAL , & sDefault . szDontdescend , NULL , NULL , 0 } ,
{ " magic script " , P_STRING , P_LOCAL , & sDefault . szMagicScript , NULL , NULL , 0 } ,
{ " magic output " , P_STRING , P_LOCAL , & sDefault . szMagicOutput , NULL , NULL , 0 } ,
1998-03-14 11:27:41 +03:00
{ " delete readonly " , P_BOOL , P_LOCAL , & sDefault . bDeleteReadonly , NULL , NULL , FLAG_GLOBAL } ,
{ " dos filetimes " , P_BOOL , P_LOCAL , & sDefault . bDosFiletimes , NULL , NULL , FLAG_GLOBAL } ,
{ " dos filetime resolution " , P_BOOL , P_LOCAL , & sDefault . bDosFiletimeResolution , NULL , NULL , FLAG_GLOBAL } ,
1998-03-16 23:59:47 +03:00
{ " fake directory create times " , P_BOOL , P_LOCAL , & sDefault . bFakeDirCreateTimes , NULL , NULL , FLAG_GLOBAL } ,
1998-03-08 17:14:49 +03:00
{ NULL , P_BOOL , P_NONE , NULL , NULL , NULL , 0 }
1996-05-04 11:50:46 +04:00
} ;
/***************************************************************************
Initialise the global parameter structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void init_globals ( void )
{
static BOOL done_init = False ;
pstring s ;
if ( ! done_init )
{
int i ;
bzero ( ( void * ) & Globals , sizeof ( Globals ) ) ;
for ( i = 0 ; parm_table [ i ] . label ; i + + )
1996-08-19 15:17:29 +04:00
if ( ( parm_table [ i ] . type = = P_STRING | |
parm_table [ i ] . type = = P_USTRING ) & &
1996-05-04 11:50:46 +04:00
parm_table [ i ] . ptr )
string_init ( parm_table [ i ] . ptr , " " ) ;
string_set ( & sDefault . szGuestaccount , GUEST_ACCOUNT ) ;
1996-10-11 09:49:42 +04:00
string_set ( & sDefault . szPrinterDriver , " NULL " ) ;
1996-05-04 11:50:46 +04:00
done_init = True ;
}
DEBUG ( 3 , ( " Initialising global parameters \n " ) ) ;
string_set ( & Globals . szSMBPasswdFile , SMB_PASSWD_FILE ) ;
string_set ( & Globals . szPasswdChat , " *old*password* %o \\ n *new*password* %n \\ n *new*password* %n \\ n *changed* " ) ;
string_set ( & Globals . szWorkGroup , WORKGROUP ) ;
string_set ( & Globals . szPasswdProgram , SMB_PASSWD ) ;
string_set ( & Globals . szPrintcapname , PRINTCAP_NAME ) ;
1997-10-28 22:32:59 +03:00
string_set ( & Globals . szDriverFile , DRIVERFILE ) ;
1996-05-04 11:50:46 +04:00
string_set ( & Globals . szLockDir , LOCKDIR ) ;
string_set ( & Globals . szRootdir , " / " ) ;
1996-06-01 19:25:30 +04:00
string_set ( & Globals . szSmbrun , SMBRUN ) ;
1996-08-19 15:17:29 +04:00
string_set ( & Globals . szSocketAddress , " 0.0.0.0 " ) ;
1996-05-04 11:50:46 +04:00
sprintf ( s , " Samba %s " , VERSION ) ;
string_set ( & Globals . szServerString , s ) ;
1997-07-30 23:17:51 +04:00
sprintf ( s , " %d.%d " , DEFAULT_MAJOR_VERSION , DEFAULT_MINOR_VERSION ) ;
string_set ( & Globals . szAnnounceVersion , s ) ;
1997-10-20 16:10:58 +04:00
string_set ( & Globals . szLogonDrive , " " ) ;
/* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
string_set ( & Globals . szLogonHome , " \\ \\ %N \\ %U " ) ;
string_set ( & Globals . szLogonPath , " \\ \\ %N \\ %U \\ profile " ) ;
1997-10-22 15:31:37 +04:00
1998-03-16 23:59:47 +03:00
string_set ( & Globals . szNameResolveOrder , " lmhosts host wins bcast " ) ;
1996-05-04 11:50:46 +04:00
Globals . bLoadPrinters = True ;
Globals . bUseRhosts = False ;
Globals . max_packet = 65535 ;
Globals . mangled_stack = 50 ;
1997-06-06 20:14:17 +04:00
Globals . max_xmit = 65535 ;
1997-07-01 05:19:13 +04:00
Globals . max_mux = 50 ; /* This is *needed* for profile support. */
1996-05-04 11:50:46 +04:00
Globals . lpqcachetime = 10 ;
Globals . pwordlevel = 0 ;
1997-09-19 21:12:08 +04:00
Globals . unamelevel = 0 ;
1996-05-04 11:50:46 +04:00
Globals . deadtime = 0 ;
Globals . max_log_size = 5000 ;
Globals . maxprotocol = PROTOCOL_NT1 ;
Globals . security = SEC_SHARE ;
Globals . bEncryptPasswords = False ;
Globals . bReadRaw = True ;
Globals . bWriteRaw = True ;
Globals . bReadPrediction = False ;
Globals . bReadbmpx = True ;
Globals . bNullPasswords = False ;
Globals . bStripDot = False ;
Globals . syslog = 1 ;
Globals . bSyslogOnly = False ;
Globals . os_level = 0 ;
1997-12-13 17:16:07 +03:00
Globals . max_ttl = 60 * 60 * 4 ; /* 4 hours default */
Globals . max_wins_ttl = 60 * 60 * 24 * 3 ; /* 3 days default */
Globals . min_wins_ttl = 60 * 60 * 6 ; /* 6 hours default */
1996-06-07 07:34:22 +04:00
Globals . ReadSize = 16 * 1024 ;
1997-12-16 12:20:34 +03:00
Globals . lm_announce = 2 ; /* = Auto: send only if LM clients found */
Globals . lm_interval = 60 ;
1997-05-20 04:32:51 +04:00
Globals . shmem_size = SHMEM_SIZE ;
1997-07-30 23:17:51 +04:00
Globals . announce_as = ANNOUNCE_AS_NT ;
1997-05-07 21:56:46 +04:00
Globals . bUnixRealname = False ;
1997-05-20 04:32:51 +04:00
# if (defined(NETGROUP) && defined(AUTOMOUNT))
1997-05-07 21:56:46 +04:00
Globals . bNISHomeMap = False ;
string_set ( & Globals . szNISHomeMapName , " auto.home " ) ;
# endif
1997-06-11 05:03:06 +04:00
Globals . client_code_page = DEFAULT_CLIENT_CODE_PAGE ;
1997-06-17 00:49:15 +04:00
Globals . bTimeServer = False ;
1997-10-20 22:52:04 +04:00
Globals . bBindInterfacesOnly = False ;
1998-02-07 15:15:20 +03:00
Globals . bNetWkstaUserLogon = True ;
1998-03-27 22:59:14 +03:00
Globals . bUnixPasswdSync = False ;
1996-05-04 11:50:46 +04:00
1997-05-20 04:32:51 +04:00
/* these parameters are set to defaults that are more appropriate
for the increasing samba install base :
as a member of the workgroup , that will possibly become a
_local_ master browser ( lm = True ) . this is opposed to a forced
local master browser startup ( pm = True ) .
doesn ' t provide WINS server service by default ( wsupp = False ) ,
and doesn ' t provide domain master browser services by default , either .
*/
Globals . bPreferredMaster = False ;
Globals . bLocalMaster = True ;
Globals . bDomainMaster = False ;
Globals . bDomainLogons = False ;
Globals . bBrowseList = True ;
Globals . bWINSsupport = False ;
Globals . bWINSproxy = False ;
1997-07-06 16:06:23 +04:00
Globals . bDNSproxy = True ;
1998-03-03 23:19:14 +03:00
/*
* This must be done last as it checks the value in
* client_code_page .
*/
interpret_coding_system ( KANJI ) ;
1996-05-04 11:50:46 +04:00
}
/***************************************************************************
check if a string is initialised and if not then initialise it
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void string_initial ( char * * s , char * v )
{
if ( ! * s | | ! * * s )
string_init ( s , v ) ;
}
/***************************************************************************
Initialise the sDefault parameter structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void init_locals ( void )
{
/* choose defaults depending on the type of printing */
1997-12-03 06:37:02 +03:00
switch ( sDefault . iPrinting )
1996-05-04 11:50:46 +04:00
{
case PRINT_BSD :
case PRINT_AIX :
1996-08-19 15:17:29 +04:00
case PRINT_LPRNG :
1996-05-31 19:13:29 +04:00
case PRINT_PLP :
1996-05-04 11:50:46 +04:00
string_initial ( & sDefault . szLpqcommand , " lpq -P%p " ) ;
string_initial ( & sDefault . szLprmcommand , " lprm -P%p %j " ) ;
string_initial ( & sDefault . szPrintcommand , " lpr -r -P%p %s " ) ;
break ;
case PRINT_SYSV :
case PRINT_HPUX :
string_initial ( & sDefault . szLpqcommand , " lpstat -o%p " ) ;
string_initial ( & sDefault . szLprmcommand , " cancel %p-%j " ) ;
string_initial ( & sDefault . szPrintcommand , " lp -c -d%p %s; rm %s " ) ;
# ifdef SVR4
string_initial ( & sDefault . szLppausecommand , " lp -i %p-%j -H hold " ) ;
string_initial ( & sDefault . szLpresumecommand , " lp -i %p-%j -H resume " ) ;
# endif
break ;
case PRINT_QNX :
string_initial ( & sDefault . szLpqcommand , " lpq -P%p " ) ;
string_initial ( & sDefault . szLprmcommand , " lprm -P%p %j " ) ;
string_initial ( & sDefault . szPrintcommand , " lp -r -P%p %s " ) ;
break ;
1998-04-02 05:01:24 +04:00
case PRINT_SOFTQ :
string_initial ( & sDefault . szLpqcommand , " qstat -l -d%p " ) ;
string_initial ( & sDefault . szLprmcommand , " qstat -s -j%j -c " ) ;
string_initial ( & sDefault . szPrintcommand , " lp -d%p -s %s; rm %s " ) ;
string_initial ( & sDefault . szLppausecommand , " qstat -s -j%j -h " ) ;
string_initial ( & sDefault . szLpresumecommand , " qstat -s -j%j -r " ) ;
break ;
1996-05-04 11:50:46 +04:00
}
}
1997-11-03 22:24:45 +03:00
/******************************************************************* a
convenience routine to grab string parameters into a rotating buffer ,
and run standard_sub_basic on them . The buffers can be written to by
callers without affecting the source string .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
char * lp_string ( char * s )
1997-11-02 23:35:20 +03:00
{
1997-11-03 22:24:45 +03:00
static char * bufs [ 10 ] ;
static int buflen [ 10 ] ;
static int next = - 1 ;
char * ret ;
int i ;
int len = s ? strlen ( s ) : 0 ;
1997-11-02 23:35:20 +03:00
1997-11-03 22:24:45 +03:00
if ( next = = - 1 ) {
/* initialisation */
for ( i = 0 ; i < 10 ; i + + ) {
bufs [ i ] = NULL ;
buflen [ i ] = 0 ;
}
next = 0 ;
}
1997-11-02 23:35:20 +03:00
1997-11-03 22:24:45 +03:00
len = MAX ( len + 100 , sizeof ( pstring ) ) ; /* the +100 is for some
substitution room */
1997-11-02 23:35:20 +03:00
1997-11-03 22:24:45 +03:00
if ( buflen [ next ] ! = len ) {
buflen [ next ] = len ;
if ( bufs [ next ] ) free ( bufs [ next ] ) ;
bufs [ next ] = ( char * ) malloc ( len ) ;
if ( ! bufs [ next ] ) {
DEBUG ( 0 , ( " out of memory in lp_string() " ) ) ;
exit ( 1 ) ;
}
}
1997-11-02 23:35:20 +03:00
1997-11-03 22:24:45 +03:00
ret = & bufs [ next ] [ 0 ] ;
next = ( next + 1 ) % 10 ;
1997-11-02 23:35:20 +03:00
1997-11-03 22:24:45 +03:00
if ( ! s )
* ret = 0 ;
else
StrCpy ( ret , s ) ;
1997-11-02 23:35:20 +03:00
1997-11-03 22:24:45 +03:00
trim_string ( ret , " \" " , " \" " ) ;
1997-11-02 23:35:20 +03:00
1997-11-03 22:24:45 +03:00
standard_sub_basic ( ret ) ;
return ( ret ) ;
1996-05-04 11:50:46 +04:00
}
/*
In this section all the functions that are used to access the
parameters from the rest of the program are defined
*/
# define FN_GLOBAL_STRING(fn_name,ptr) \
char * fn_name ( void ) { return ( lp_string ( * ( char * * ) ( ptr ) ? * ( char * * ) ( ptr ) : " " ) ) ; }
# define FN_GLOBAL_BOOL(fn_name,ptr) \
BOOL fn_name ( void ) { return ( * ( BOOL * ) ( ptr ) ) ; }
# define FN_GLOBAL_CHAR(fn_name,ptr) \
char fn_name ( void ) { return ( * ( char * ) ( ptr ) ) ; }
# define FN_GLOBAL_INTEGER(fn_name,ptr) \
int fn_name ( void ) { return ( * ( int * ) ( ptr ) ) ; }
# define FN_LOCAL_STRING(fn_name,val) \
char * fn_name ( int i ) { return ( lp_string ( ( LP_SNUM_OK ( i ) & & pSERVICE ( i ) - > val ) ? pSERVICE ( i ) - > val : sDefault . val ) ) ; }
# define FN_LOCAL_BOOL(fn_name,val) \
BOOL fn_name ( int i ) { return ( LP_SNUM_OK ( i ) ? pSERVICE ( i ) - > val : sDefault . val ) ; }
# define FN_LOCAL_CHAR(fn_name,val) \
char fn_name ( int i ) { return ( LP_SNUM_OK ( i ) ? pSERVICE ( i ) - > val : sDefault . val ) ; }
# define FN_LOCAL_INTEGER(fn_name,val) \
int fn_name ( int i ) { return ( LP_SNUM_OK ( i ) ? pSERVICE ( i ) - > val : sDefault . val ) ; }
FN_GLOBAL_STRING ( lp_logfile , & Globals . szLogFile )
1996-06-01 19:25:30 +04:00
FN_GLOBAL_STRING ( lp_smbrun , & Globals . szSmbrun )
1996-05-04 11:50:46 +04:00
FN_GLOBAL_STRING ( lp_configfile , & Globals . szConfigFile )
FN_GLOBAL_STRING ( lp_smb_passwd_file , & Globals . szSMBPasswdFile )
FN_GLOBAL_STRING ( lp_serverstring , & Globals . szServerString )
FN_GLOBAL_STRING ( lp_printcapname , & Globals . szPrintcapname )
FN_GLOBAL_STRING ( lp_lockdir , & Globals . szLockDir )
FN_GLOBAL_STRING ( lp_rootdir , & Globals . szRootdir )
FN_GLOBAL_STRING ( lp_defaultservice , & Globals . szDefaultService )
FN_GLOBAL_STRING ( lp_msg_command , & Globals . szMsgCommand )
FN_GLOBAL_STRING ( lp_dfree_command , & Globals . szDfree )
FN_GLOBAL_STRING ( lp_hosts_equiv , & Globals . szHostsEquiv )
FN_GLOBAL_STRING ( lp_auto_services , & Globals . szAutoServices )
FN_GLOBAL_STRING ( lp_passwd_program , & Globals . szPasswdProgram )
FN_GLOBAL_STRING ( lp_passwd_chat , & Globals . szPasswdChat )
FN_GLOBAL_STRING ( lp_passwordserver , & Globals . szPasswordServer )
1998-03-16 23:59:47 +03:00
FN_GLOBAL_STRING ( lp_name_resolve_order , & Globals . szNameResolveOrder )
1996-05-04 11:50:46 +04:00
FN_GLOBAL_STRING ( lp_workgroup , & Globals . szWorkGroup )
FN_GLOBAL_STRING ( lp_username_map , & Globals . szUsernameMap )
FN_GLOBAL_STRING ( lp_character_set , & Globals . szCharacterSet )
FN_GLOBAL_STRING ( lp_logon_script , & Globals . szLogonScript )
1997-02-02 21:12:36 +03:00
FN_GLOBAL_STRING ( lp_logon_path , & Globals . szLogonPath )
1997-10-20 16:10:58 +04:00
FN_GLOBAL_STRING ( lp_logon_drive , & Globals . szLogonDrive )
FN_GLOBAL_STRING ( lp_logon_home , & Globals . szLogonHome )
1996-08-16 17:03:26 +04:00
FN_GLOBAL_STRING ( lp_remote_announce , & Globals . szRemoteAnnounce )
1997-11-21 17:01:23 +03:00
FN_GLOBAL_STRING ( lp_remote_browse_sync , & Globals . szRemoteBrowseSync )
1996-06-01 19:25:30 +04:00
FN_GLOBAL_STRING ( lp_wins_server , & Globals . szWINSserver )
1996-06-06 15:43:09 +04:00
FN_GLOBAL_STRING ( lp_interfaces , & Globals . szInterfaces )
1996-08-19 15:17:29 +04:00
FN_GLOBAL_STRING ( lp_socket_address , & Globals . szSocketAddress )
1997-05-07 21:56:46 +04:00
FN_GLOBAL_STRING ( lp_nis_home_map_name , & Globals . szNISHomeMapName )
1997-07-30 23:17:51 +04:00
FN_GLOBAL_STRING ( lp_announce_version , & Globals . szAnnounceVersion )
1997-07-31 22:47:26 +04:00
FN_GLOBAL_STRING ( lp_netbios_aliases , & Globals . szNetbiosAliases )
1997-10-28 22:32:59 +03:00
FN_GLOBAL_STRING ( lp_driverfile , & Globals . szDriverFile )
1996-05-04 11:50:46 +04:00
1997-10-22 15:31:37 +04:00
FN_GLOBAL_STRING ( lp_domain_sid , & Globals . szDomainSID )
FN_GLOBAL_STRING ( lp_domain_other_sids , & Globals . szDomainOtherSIDs )
1997-10-20 20:25:19 +04:00
FN_GLOBAL_STRING ( lp_domain_groups , & Globals . szDomainGroups )
1997-10-21 22:25:14 +04:00
FN_GLOBAL_STRING ( lp_domain_admin_users , & Globals . szDomainAdminUsers )
FN_GLOBAL_STRING ( lp_domain_guest_users , & Globals . szDomainGuestUsers )
1997-11-02 22:27:26 +03:00
FN_GLOBAL_STRING ( lp_domain_hostsallow , & Globals . szDomainHostsallow )
FN_GLOBAL_STRING ( lp_domain_hostsdeny , & Globals . szDomainHostsdeny )
1997-10-08 21:12:07 +04:00
1997-07-06 16:06:23 +04:00
FN_GLOBAL_BOOL ( lp_dns_proxy , & Globals . bDNSproxy )
1996-06-04 10:42:03 +04:00
FN_GLOBAL_BOOL ( lp_wins_support , & Globals . bWINSsupport )
1997-12-03 06:50:05 +03:00
FN_GLOBAL_BOOL ( lp_we_are_a_wins_server , & Globals . bWINSsupport )
1996-06-04 19:14:47 +04:00
FN_GLOBAL_BOOL ( lp_wins_proxy , & Globals . bWINSproxy )
1997-05-20 04:32:51 +04:00
FN_GLOBAL_BOOL ( lp_local_master , & Globals . bLocalMaster )
following a cvs error, i am rewriting this monster-commit. with bad grace.
Modified Files:
---------------
Makefile:
adding extra files
ipc.c :
send_trans_reply() - alignment issue. this makes the alignment
the same as that in NT. this should be looked at by people who
understand the SMB stuff better than i.
api_fd_commands[] - added samr and wkssvc pipes.
loadparm.c :
lp_domain_controller() changed to mean "samba is a domain controller".
it's a "yes/no" parameter, now. no, it isn't used _anywhere_.
namedbwork.c nameelect.c :
if "domain controller = yes" then add SV_TYPE_DOMAIN_CTRL to the
host _and_ workgroup announcements. yes, you must do both: nt does.
namelogon.c :
important NETLOGON bug in SAMLOGON request parsing, which may be
the source of some people's problems with logging on to the Samba PDC.
password.c :
get_smbpwnam() renamed to get_smbpwd_entry().
pipes.c :
added samr and wkssvc pipes.
proto.h :
usual. can we actually _remove_ proto.h from the cvs tree, and
have it as one of the Makefile dependencies, or something?
reply.c :
get_smbpwnam() renamed to get_smbpwd_entry() - also changed response
error code when logging in from a WORKSTATION$ account. yes, paul
is right: we need to know when to return the right error code, and why.
server.c :
added call to reset_chain_pnum().
#ifdef NTDOMAIN added call to init_lsa_policy_hnd() #endif. jeremy,
you'd be proud: i did a compile without NTDOMAIN, and caught a link
error for this function.
smb.h :
defines and structures for samr and wkssvc pipes.
smbpass.c :
modified get_smbpwnam() to get_smbpwd_entry() and it now takes
two arguments. one for the name; if this is null, it looks up
by smb_userid instead.
oh, by the way, smb_userids are actually domain relative ids
(RIDs). concatenate a RID with the domain SID, and you have
an internet globally unique way of identifying a user.
we're using RIDs in the wrong way....
added mod_smbpwnam() function. this was based on code in smbpasswd.c
rpc_pipes/lsaparse.c :
added enum trusted domain parsing. this is incomplete: i need
a packet trace to write it properly.
rpc_pipes/pipe_hnd.c :
added reset_chain_pnum() function.
rpc_pipes/pipenetlog.c :
get_smbpwnam() function renamed to get_smbpwd_entry().
arcfour() issues.
removed capability of get_md4pw() function to automatically add
workstation accounts. this should either be done using
smbpasswd -add MACHINE$, or by using \PIPE\samr.
rpc_pipes/pipe_util.c :
create_pol_hnd() - creates a unique LSA Policy Handle. overkill
function: uses a 64 bit sequence number; current unix time and
the smbd pid.
rpc_pipes/smbparse.c :
arcfour() issues.
smb_io_unistr2() should advance by uni_str_len not uni_max_len.
smb_io_smb_hdr_rb() - request bind uses uint16 for the context
id, and uint8 for the num_syntaxes. oops, i put these both as
uint32s.
Added Files:
------------
rpc_pipes/lsa_hnd.c :
on the samr pipe, allocate and associate an LSA Policy Handle
with a SID. you receive queries with the LSA Policy Handle,
and have to turn this back into a SID in order to answer the
query...
rpc_pipes/pipesamr.c rpc_pipes/samrparse.c
\PIPE\samr processing. samr i presume is the SAM Replication pipe.
rpc_pipes/pipewkssvc.c rpc_pipes/wksparse.c
\PIPE\wkssvc processing. the Workstation Service pipe?
holy cow.
(This used to be commit 1bd084b3e690eb26a1006d616075e53d711ecd2f)
1997-11-07 02:03:58 +03:00
FN_GLOBAL_BOOL ( lp_domain_controller , & Globals . bDomainController )
1996-05-04 11:50:46 +04:00
FN_GLOBAL_BOOL ( lp_domain_master , & Globals . bDomainMaster )
FN_GLOBAL_BOOL ( lp_domain_logons , & Globals . bDomainLogons )
FN_GLOBAL_BOOL ( lp_preferred_master , & Globals . bPreferredMaster )
FN_GLOBAL_BOOL ( lp_load_printers , & Globals . bLoadPrinters )
FN_GLOBAL_BOOL ( lp_use_rhosts , & Globals . bUseRhosts )
FN_GLOBAL_BOOL ( lp_getwdcache , & use_getwd_cache )
FN_GLOBAL_BOOL ( lp_readprediction , & Globals . bReadPrediction )
FN_GLOBAL_BOOL ( lp_readbmpx , & Globals . bReadbmpx )
FN_GLOBAL_BOOL ( lp_readraw , & Globals . bReadRaw )
FN_GLOBAL_BOOL ( lp_writeraw , & Globals . bWriteRaw )
FN_GLOBAL_BOOL ( lp_null_passwords , & Globals . bNullPasswords )
FN_GLOBAL_BOOL ( lp_strip_dot , & Globals . bStripDot )
FN_GLOBAL_BOOL ( lp_encrypted_passwords , & Globals . bEncryptPasswords )
FN_GLOBAL_BOOL ( lp_syslog_only , & Globals . bSyslogOnly )
FN_GLOBAL_BOOL ( lp_browse_list , & Globals . bBrowseList )
1997-05-07 21:56:46 +04:00
FN_GLOBAL_BOOL ( lp_unix_realname , & Globals . bUnixRealname )
FN_GLOBAL_BOOL ( lp_nis_home_map , & Globals . bNISHomeMap )
1997-06-17 00:49:15 +04:00
FN_GLOBAL_BOOL ( lp_time_server , & Globals . bTimeServer )
1997-10-20 22:52:04 +04:00
FN_GLOBAL_BOOL ( lp_bind_interfaces_only , & Globals . bBindInterfacesOnly )
1998-02-07 15:15:20 +03:00
FN_GLOBAL_BOOL ( lp_net_wksta_user_logon , & Globals . bNetWkstaUserLogon )
1998-03-27 22:59:14 +03:00
FN_GLOBAL_BOOL ( lp_unix_password_sync , & Globals . bUnixPasswdSync )
1996-05-04 11:50:46 +04:00
FN_GLOBAL_INTEGER ( lp_os_level , & Globals . os_level )
FN_GLOBAL_INTEGER ( lp_max_ttl , & Globals . max_ttl )
1997-12-13 17:16:07 +03:00
FN_GLOBAL_INTEGER ( lp_max_wins_ttl , & Globals . max_wins_ttl )
FN_GLOBAL_INTEGER ( lp_min_wins_ttl , & Globals . max_wins_ttl )
1996-05-04 11:50:46 +04:00
FN_GLOBAL_INTEGER ( lp_max_log_size , & Globals . max_log_size )
FN_GLOBAL_INTEGER ( lp_mangledstack , & Globals . mangled_stack )
FN_GLOBAL_INTEGER ( lp_maxxmit , & Globals . max_xmit )
FN_GLOBAL_INTEGER ( lp_maxmux , & Globals . max_mux )
FN_GLOBAL_INTEGER ( lp_maxpacket , & Globals . max_packet )
FN_GLOBAL_INTEGER ( lp_keepalive , & keepalive )
FN_GLOBAL_INTEGER ( lp_passwordlevel , & Globals . pwordlevel )
1997-09-19 21:12:08 +04:00
FN_GLOBAL_INTEGER ( lp_usernamelevel , & Globals . unamelevel )
1996-06-07 07:34:22 +04:00
FN_GLOBAL_INTEGER ( lp_readsize , & Globals . ReadSize )
1997-05-20 04:32:51 +04:00
FN_GLOBAL_INTEGER ( lp_shmem_size , & Globals . shmem_size )
1996-05-04 11:50:46 +04:00
FN_GLOBAL_INTEGER ( lp_deadtime , & Globals . deadtime )
FN_GLOBAL_INTEGER ( lp_maxprotocol , & Globals . maxprotocol )
FN_GLOBAL_INTEGER ( lp_security , & Globals . security )
FN_GLOBAL_INTEGER ( lp_maxdisksize , & Globals . maxdisksize )
FN_GLOBAL_INTEGER ( lp_lpqcachetime , & Globals . lpqcachetime )
FN_GLOBAL_INTEGER ( lp_syslog , & Globals . syslog )
1997-06-11 05:03:06 +04:00
FN_GLOBAL_INTEGER ( lp_client_code_page , & Globals . client_code_page )
1997-07-30 23:17:51 +04:00
FN_GLOBAL_INTEGER ( lp_announce_as , & Globals . announce_as )
1997-12-16 12:20:34 +03:00
FN_GLOBAL_INTEGER ( lp_lm_announce , & Globals . lm_announce )
FN_GLOBAL_INTEGER ( lp_lm_interval , & Globals . lm_interval )
1996-05-04 11:50:46 +04:00
FN_LOCAL_STRING ( lp_preexec , szPreExec )
FN_LOCAL_STRING ( lp_postexec , szPostExec )
FN_LOCAL_STRING ( lp_rootpreexec , szRootPreExec )
FN_LOCAL_STRING ( lp_rootpostexec , szRootPostExec )
FN_LOCAL_STRING ( lp_servicename , szService )
FN_LOCAL_STRING ( lp_pathname , szPath )
FN_LOCAL_STRING ( lp_dontdescend , szDontdescend )
FN_LOCAL_STRING ( lp_username , szUsername )
FN_LOCAL_STRING ( lp_guestaccount , szGuestaccount )
FN_LOCAL_STRING ( lp_invalid_users , szInvalidUsers )
FN_LOCAL_STRING ( lp_valid_users , szValidUsers )
FN_LOCAL_STRING ( lp_admin_users , szAdminUsers )
FN_LOCAL_STRING ( lp_printcommand , szPrintcommand )
FN_LOCAL_STRING ( lp_lpqcommand , szLpqcommand )
FN_LOCAL_STRING ( lp_lprmcommand , szLprmcommand )
FN_LOCAL_STRING ( lp_lppausecommand , szLppausecommand )
FN_LOCAL_STRING ( lp_lpresumecommand , szLpresumecommand )
FN_LOCAL_STRING ( lp_printername , szPrintername )
1996-08-13 12:57:55 +04:00
FN_LOCAL_STRING ( lp_printerdriver , szPrinterDriver )
1996-05-04 11:50:46 +04:00
FN_LOCAL_STRING ( lp_hostsallow , szHostsallow )
FN_LOCAL_STRING ( lp_hostsdeny , szHostsdeny )
FN_LOCAL_STRING ( lp_magicscript , szMagicScript )
FN_LOCAL_STRING ( lp_magicoutput , szMagicOutput )
FN_LOCAL_STRING ( lp_comment , comment )
FN_LOCAL_STRING ( lp_force_user , force_user )
FN_LOCAL_STRING ( lp_force_group , force_group )
FN_LOCAL_STRING ( lp_readlist , readlist )
FN_LOCAL_STRING ( lp_writelist , writelist )
FN_LOCAL_STRING ( lp_volume , volume )
FN_LOCAL_STRING ( lp_mangled_map , szMangledMap )
1997-07-06 17:48:10 +04:00
FN_LOCAL_STRING ( lp_veto_files , szVetoFiles )
FN_LOCAL_STRING ( lp_hide_files , szHideFiles )
1997-12-20 13:52:00 +03:00
FN_LOCAL_STRING ( lp_veto_oplocks , szVetoOplockFiles )
1997-10-28 22:32:59 +03:00
FN_LOCAL_STRING ( lp_driverlocation , szPrinterDriverLocation )
1996-05-04 11:50:46 +04:00
FN_LOCAL_BOOL ( lp_alternate_permissions , bAlternatePerm )
FN_LOCAL_BOOL ( lp_revalidate , bRevalidate )
FN_LOCAL_BOOL ( lp_casesensitive , bCaseSensitive )
FN_LOCAL_BOOL ( lp_preservecase , bCasePreserve )
FN_LOCAL_BOOL ( lp_shortpreservecase , bShortCasePreserve )
FN_LOCAL_BOOL ( lp_casemangle , bCaseMangle )
FN_LOCAL_BOOL ( lp_status , status )
FN_LOCAL_BOOL ( lp_hide_dot_files , bHideDotFiles )
FN_LOCAL_BOOL ( lp_browseable , bBrowseable )
FN_LOCAL_BOOL ( lp_readonly , bRead_only )
FN_LOCAL_BOOL ( lp_no_set_dir , bNo_set_dir )
FN_LOCAL_BOOL ( lp_guest_ok , bGuest_ok )
FN_LOCAL_BOOL ( lp_guest_only , bGuest_only )
FN_LOCAL_BOOL ( lp_print_ok , bPrint_ok )
FN_LOCAL_BOOL ( lp_postscript , bPostscript )
FN_LOCAL_BOOL ( lp_map_hidden , bMap_hidden )
FN_LOCAL_BOOL ( lp_map_archive , bMap_archive )
FN_LOCAL_BOOL ( lp_locking , bLocking )
FN_LOCAL_BOOL ( lp_strict_locking , bStrictLocking )
FN_LOCAL_BOOL ( lp_share_modes , bShareModes )
1997-10-02 07:14:32 +04:00
FN_LOCAL_BOOL ( lp_oplocks , bOpLocks )
1996-05-04 11:50:46 +04:00
FN_LOCAL_BOOL ( lp_onlyuser , bOnlyUser )
FN_LOCAL_BOOL ( lp_manglednames , bMangledNames )
FN_LOCAL_BOOL ( lp_widelinks , bWidelinks )
1997-07-19 00:21:32 +04:00
FN_LOCAL_BOOL ( lp_symlinks , bSymlinks )
1996-05-04 11:50:46 +04:00
FN_LOCAL_BOOL ( lp_syncalways , bSyncAlways )
FN_LOCAL_BOOL ( lp_map_system , bMap_system )
1996-05-31 19:13:29 +04:00
FN_LOCAL_BOOL ( lp_delete_readonly , bDeleteReadonly )
1996-10-05 14:41:13 +04:00
FN_LOCAL_BOOL ( lp_fake_oplocks , bFakeOplocks )
1997-09-17 05:29:53 +04:00
FN_LOCAL_BOOL ( lp_recursive_veto_delete , bDeleteVetoFiles )
1997-10-20 22:52:04 +04:00
FN_LOCAL_BOOL ( lp_dos_filetimes , bDosFiletimes )
1998-02-13 10:11:58 +03:00
FN_LOCAL_BOOL ( lp_dos_filetime_resolution , bDosFiletimeResolution )
1998-03-16 23:59:47 +03:00
FN_LOCAL_BOOL ( lp_fake_dir_create_times , bFakeDirCreateTimes )
1996-05-04 11:50:46 +04:00
1997-07-25 02:42:16 +04:00
FN_LOCAL_INTEGER ( lp_create_mode , iCreate_mask )
1997-06-19 04:18:23 +04:00
FN_LOCAL_INTEGER ( lp_force_create_mode , iCreate_force_mode )
1997-07-25 02:42:16 +04:00
FN_LOCAL_INTEGER ( lp_dir_mode , iDir_mask )
1997-06-19 04:18:23 +04:00
FN_LOCAL_INTEGER ( lp_force_dir_mode , iDir_force_mode )
1996-05-04 11:50:46 +04:00
FN_LOCAL_INTEGER ( lp_max_connections , iMaxConnections )
FN_LOCAL_INTEGER ( lp_defaultcase , iDefaultCase )
FN_LOCAL_INTEGER ( lp_minprintspace , iMinPrintSpace )
1997-12-03 06:37:02 +03:00
FN_LOCAL_INTEGER ( lp_printing , iPrinting )
1996-05-04 11:50:46 +04:00
FN_LOCAL_CHAR ( lp_magicchar , magic_char )
/* local prototypes */
static int strwicmp ( char * psz1 , char * psz2 ) ;
static int map_parameter ( char * pszParmName ) ;
static BOOL set_boolean ( BOOL * pb , char * pszParmValue ) ;
static int getservicebyname ( char * pszServiceName , service * pserviceDest ) ;
static void copy_service ( service * pserviceDest ,
service * pserviceSource ,
BOOL * pcopymapDest ) ;
static BOOL service_ok ( int iService ) ;
static BOOL do_parameter ( char * pszParmName , char * pszParmValue ) ;
static BOOL do_section ( char * pszSectionName ) ;
static void init_copymap ( service * pservice ) ;
/***************************************************************************
initialise a service to the defaults
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void init_service ( service * pservice )
{
bzero ( ( char * ) pservice , sizeof ( service ) ) ;
copy_service ( pservice , & sDefault , NULL ) ;
}
/***************************************************************************
free the dynamically allocated parts of a service struct
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void free_service ( service * pservice )
{
int i ;
if ( ! pservice )
return ;
1998-01-24 15:34:16 +03:00
if ( pservice - > szService )
DEBUG ( 5 , ( " free_service: Freeing service %s \n " , pservice - > szService ) ) ;
1998-01-24 15:26:17 +03:00
string_free ( & pservice - > szService ) ;
if ( pservice - > copymap )
{
free ( pservice - > copymap ) ;
pservice - > copymap = NULL ;
}
1996-05-04 11:50:46 +04:00
for ( i = 0 ; parm_table [ i ] . label ; i + + )
1996-08-19 15:17:29 +04:00
if ( ( parm_table [ i ] . type = = P_STRING | |
1998-01-24 15:26:17 +03:00
parm_table [ i ] . type = = P_USTRING ) & &
1996-08-19 15:17:29 +04:00
parm_table [ i ] . class = = P_LOCAL )
1996-05-04 11:50:46 +04:00
string_free ( ( char * * ) ( ( ( char * ) pservice ) + PTR_DIFF ( parm_table [ i ] . ptr , & sDefault ) ) ) ;
}
/***************************************************************************
add a new service to the services array initialising it with the given
service
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static int add_a_service ( service * pservice , char * name )
{
int i ;
service tservice ;
int num_to_alloc = iNumServices + 1 ;
tservice = * pservice ;
/* it might already exist */
if ( name )
{
i = getservicebyname ( name , NULL ) ;
if ( i > = 0 )
return ( i ) ;
}
/* find an invalid one */
for ( i = 0 ; i < iNumServices ; i + + )
if ( ! pSERVICE ( i ) - > valid )
break ;
/* if not, then create one */
if ( i = = iNumServices )
{
ServicePtrs = ( service * * ) Realloc ( ServicePtrs , sizeof ( service * ) * num_to_alloc ) ;
if ( ServicePtrs )
pSERVICE ( iNumServices ) = ( service * ) malloc ( sizeof ( service ) ) ;
if ( ! ServicePtrs | | ! pSERVICE ( iNumServices ) )
return ( - 1 ) ;
iNumServices + + ;
}
else
free_service ( pSERVICE ( i ) ) ;
pSERVICE ( i ) - > valid = True ;
init_service ( pSERVICE ( i ) ) ;
copy_service ( pSERVICE ( i ) , & tservice , NULL ) ;
if ( name )
string_set ( & iSERVICE ( i ) . szService , name ) ;
return ( i ) ;
}
/***************************************************************************
add a new home service , with the specified home directory , defaults coming
from service ifrom
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL lp_add_home ( char * pszHomename , int iDefaultService , char * pszHomedir )
{
int i = add_a_service ( pSERVICE ( iDefaultService ) , pszHomename ) ;
if ( i < 0 )
return ( False ) ;
if ( ! ( * ( iSERVICE ( i ) . szPath ) ) | | strequal ( iSERVICE ( i ) . szPath , lp_pathname ( - 1 ) ) )
string_set ( & iSERVICE ( i ) . szPath , pszHomedir ) ;
if ( ! ( * ( iSERVICE ( i ) . comment ) ) )
{
pstring comment ;
sprintf ( comment , " Home directory of %s " , pszHomename ) ;
string_set ( & iSERVICE ( i ) . comment , comment ) ;
}
iSERVICE ( i ) . bAvailable = sDefault . bAvailable ;
iSERVICE ( i ) . bBrowseable = sDefault . bBrowseable ;
DEBUG ( 3 , ( " adding home directory %s at %s \n " , pszHomename , pszHomedir ) ) ;
return ( True ) ;
}
/***************************************************************************
add a new service , based on an old one
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int lp_add_service ( char * pszService , int iDefaultService )
{
return ( add_a_service ( pSERVICE ( iDefaultService ) , pszService ) ) ;
}
/***************************************************************************
add the IPC service
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static BOOL lp_add_ipc ( void )
{
pstring comment ;
int i = add_a_service ( & sDefault , " IPC$ " ) ;
if ( i < 0 )
return ( False ) ;
sprintf ( comment , " IPC Service (%s) " , lp_serverstring ( ) ) ;
1996-10-24 04:09:08 +04:00
string_set ( & iSERVICE ( i ) . szPath , tmpdir ( ) ) ;
1996-05-04 11:50:46 +04:00
string_set ( & iSERVICE ( i ) . szUsername , " " ) ;
string_set ( & iSERVICE ( i ) . comment , comment ) ;
iSERVICE ( i ) . status = False ;
iSERVICE ( i ) . iMaxConnections = 0 ;
iSERVICE ( i ) . bAvailable = True ;
iSERVICE ( i ) . bRead_only = True ;
iSERVICE ( i ) . bGuest_only = False ;
iSERVICE ( i ) . bGuest_ok = True ;
iSERVICE ( i ) . bPrint_ok = False ;
iSERVICE ( i ) . bBrowseable = sDefault . bBrowseable ;
DEBUG ( 3 , ( " adding IPC service \n " ) ) ;
return ( True ) ;
}
/***************************************************************************
add a new printer service , with defaults coming from service iFrom
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL lp_add_printer ( char * pszPrintername , int iDefaultService )
{
char * comment = " From Printcap " ;
int i = add_a_service ( pSERVICE ( iDefaultService ) , pszPrintername ) ;
if ( i < 0 )
return ( False ) ;
/* note that we do NOT default the availability flag to True - */
/* we take it from the default service passed. This allows all */
/* dynamic printers to be disabled by disabling the [printers] */
/* entry (if/when the 'available' keyword is implemented!). */
/* the printer name is set to the service name. */
string_set ( & iSERVICE ( i ) . szPrintername , pszPrintername ) ;
string_set ( & iSERVICE ( i ) . comment , comment ) ;
iSERVICE ( i ) . bBrowseable = sDefault . bBrowseable ;
1997-05-28 00:28:45 +04:00
/* Printers cannot be read_only. */
iSERVICE ( i ) . bRead_only = False ;
/* No share modes on printer services. */
iSERVICE ( i ) . bShareModes = False ;
1997-10-02 07:14:32 +04:00
/* No oplocks on printer services. */
iSERVICE ( i ) . bOpLocks = False ;
1997-07-30 23:17:51 +04:00
/* Printer services must be printable. */
iSERVICE ( i ) . bPrint_ok = True ;
1996-05-04 11:50:46 +04:00
DEBUG ( 3 , ( " adding printer service %s \n " , pszPrintername ) ) ;
return ( True ) ;
}
/***************************************************************************
Do a case - insensitive , whitespace - ignoring string compare .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static int strwicmp ( char * psz1 , char * psz2 )
{
/* if BOTH strings are NULL, return TRUE, if ONE is NULL return */
/* appropriate value. */
if ( psz1 = = psz2 )
return ( 0 ) ;
else
if ( psz1 = = NULL )
return ( - 1 ) ;
else
if ( psz2 = = NULL )
return ( 1 ) ;
/* sync the strings on first non-whitespace */
while ( 1 )
{
while ( isspace ( * psz1 ) )
psz1 + + ;
while ( isspace ( * psz2 ) )
psz2 + + ;
if ( toupper ( * psz1 ) ! = toupper ( * psz2 ) | | * psz1 = = ' \0 ' | | * psz2 = = ' \0 ' )
break ;
psz1 + + ;
psz2 + + ;
}
return ( * psz1 - * psz2 ) ;
}
/***************************************************************************
Map a parameter ' s string representation to something we can use .
Returns False if the parameter string is not recognised , else TRUE .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static int map_parameter ( char * pszParmName )
{
int iIndex ;
if ( * pszParmName = = ' - ' )
return ( - 1 ) ;
for ( iIndex = 0 ; parm_table [ iIndex ] . label ; iIndex + + )
if ( strwicmp ( parm_table [ iIndex ] . label , pszParmName ) = = 0 )
return ( iIndex ) ;
DEBUG ( 0 , ( " Unknown parameter encountered: \" %s \" \n " , pszParmName ) ) ;
return ( - 1 ) ;
}
/***************************************************************************
Set a boolean variable from the text value stored in the passed string .
Returns True in success , False if the passed string does not correctly
represent a boolean .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static BOOL set_boolean ( BOOL * pb , char * pszParmValue )
{
BOOL bRetval ;
bRetval = True ;
if ( strwicmp ( pszParmValue , " yes " ) = = 0 | |
strwicmp ( pszParmValue , " true " ) = = 0 | |
strwicmp ( pszParmValue , " 1 " ) = = 0 )
* pb = True ;
else
if ( strwicmp ( pszParmValue , " no " ) = = 0 | |
strwicmp ( pszParmValue , " False " ) = = 0 | |
strwicmp ( pszParmValue , " 0 " ) = = 0 )
* pb = False ;
else
{
DEBUG ( 0 , ( " Badly formed boolean in configuration file: \" %s \" . \n " ,
pszParmValue ) ) ;
bRetval = False ;
}
return ( bRetval ) ;
}
/***************************************************************************
Find a service by name . Otherwise works like get_service .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static int getservicebyname ( char * pszServiceName , service * pserviceDest )
{
int iService ;
for ( iService = iNumServices - 1 ; iService > = 0 ; iService - - )
if ( VALID ( iService ) & &
strwicmp ( iSERVICE ( iService ) . szService , pszServiceName ) = = 0 )
{
if ( pserviceDest ! = NULL )
copy_service ( pserviceDest , pSERVICE ( iService ) , NULL ) ;
break ;
}
return ( iService ) ;
}
/***************************************************************************
Copy a service structure to another
If pcopymapDest is NULL then copy all fields
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void copy_service ( service * pserviceDest ,
service * pserviceSource ,
BOOL * pcopymapDest )
{
int i ;
BOOL bcopyall = ( pcopymapDest = = NULL ) ;
for ( i = 0 ; parm_table [ i ] . label ; i + + )
if ( parm_table [ i ] . ptr & & parm_table [ i ] . class = = P_LOCAL & &
( bcopyall | | pcopymapDest [ i ] ) )
{
void * def_ptr = parm_table [ i ] . ptr ;
void * src_ptr =
( ( char * ) pserviceSource ) + PTR_DIFF ( def_ptr , & sDefault ) ;
void * dest_ptr =
( ( char * ) pserviceDest ) + PTR_DIFF ( def_ptr , & sDefault ) ;
switch ( parm_table [ i ] . type )
{
case P_BOOL :
case P_BOOLREV :
* ( BOOL * ) dest_ptr = * ( BOOL * ) src_ptr ;
break ;
case P_INTEGER :
1997-11-22 10:09:12 +03:00
case P_ENUM :
1996-05-04 11:50:46 +04:00
case P_OCTAL :
* ( int * ) dest_ptr = * ( int * ) src_ptr ;
break ;
case P_CHAR :
* ( char * ) dest_ptr = * ( char * ) src_ptr ;
break ;
case P_STRING :
string_set ( dest_ptr , * ( char * * ) src_ptr ) ;
break ;
1996-08-19 15:17:29 +04:00
case P_USTRING :
string_set ( dest_ptr , * ( char * * ) src_ptr ) ;
strupper ( * ( char * * ) dest_ptr ) ;
break ;
1996-05-04 11:50:46 +04:00
default :
break ;
}
}
if ( bcopyall )
{
init_copymap ( pserviceDest ) ;
if ( pserviceSource - > copymap )
memcpy ( ( void * ) pserviceDest - > copymap ,
( void * ) pserviceSource - > copymap , sizeof ( BOOL ) * NUMPARAMETERS ) ;
}
}
/***************************************************************************
Check a service for consistency . Return False if the service is in any way
incomplete or faulty , else True .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static BOOL service_ok ( int iService )
{
BOOL bRetval ;
bRetval = True ;
if ( iSERVICE ( iService ) . szService [ 0 ] = = ' \0 ' )
{
DEBUG ( 0 , ( " The following message indicates an internal error: \n " ) ) ;
DEBUG ( 0 , ( " No service name in service entry. \n " ) ) ;
bRetval = False ;
}
/* The [printers] entry MUST be printable. I'm all for flexibility, but */
/* I can't see why you'd want a non-printable printer service... */
if ( strwicmp ( iSERVICE ( iService ) . szService , PRINTERS_NAME ) = = 0 )
if ( ! iSERVICE ( iService ) . bPrint_ok )
{
DEBUG ( 0 , ( " WARNING: [%s] service MUST be printable! \n " ,
iSERVICE ( iService ) . szService ) ) ;
iSERVICE ( iService ) . bPrint_ok = True ;
}
if ( iSERVICE ( iService ) . szPath [ 0 ] = = ' \0 ' & &
strwicmp ( iSERVICE ( iService ) . szService , HOMES_NAME ) ! = 0 )
{
1996-10-24 04:09:08 +04:00
DEBUG ( 0 , ( " No path in service %s - using %s \n " , iSERVICE ( iService ) . szService , tmpdir ( ) ) ) ;
string_set ( & iSERVICE ( iService ) . szPath , tmpdir ( ) ) ;
1996-05-04 11:50:46 +04:00
}
/* If a service is flagged unavailable, log the fact at level 0. */
if ( ! iSERVICE ( iService ) . bAvailable )
DEBUG ( 1 , ( " NOTE: Service %s is flagged unavailable. \n " ,
iSERVICE ( iService ) . szService ) ) ;
return ( bRetval ) ;
}
static struct file_lists {
struct file_lists * next ;
char * name ;
time_t modtime ;
} * file_lists = NULL ;
/*******************************************************************
keep a linked list of all config files so we know when one has changed
it ' s date and needs to be reloaded
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void add_to_file_list ( char * fname )
{
struct file_lists * f = file_lists ;
while ( f ) {
if ( f - > name & & ! strcmp ( f - > name , fname ) ) break ;
f = f - > next ;
}
if ( ! f ) {
f = ( struct file_lists * ) malloc ( sizeof ( file_lists [ 0 ] ) ) ;
if ( ! f ) return ;
f - > next = file_lists ;
f - > name = strdup ( fname ) ;
if ( ! f - > name ) {
free ( f ) ;
return ;
}
file_lists = f ;
}
{
pstring n2 ;
1997-09-26 22:55:29 +04:00
pstrcpy ( n2 , fname ) ;
1996-05-04 11:50:46 +04:00
standard_sub_basic ( n2 ) ;
f - > modtime = file_modtime ( n2 ) ;
}
}
/*******************************************************************
check if a config file has changed date
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL lp_file_list_changed ( void )
{
struct file_lists * f = file_lists ;
1997-09-05 21:16:21 +04:00
DEBUG ( 6 , ( " lp_file_list_changed() \n " ) ) ;
while ( f )
{
1996-05-04 11:50:46 +04:00
pstring n2 ;
1997-09-05 21:16:21 +04:00
time_t mod_time ;
1997-09-26 22:55:29 +04:00
pstrcpy ( n2 , f - > name ) ;
1996-05-04 11:50:46 +04:00
standard_sub_basic ( n2 ) ;
1997-09-05 21:16:21 +04:00
DEBUG ( 6 , ( " file %s -> %s last mod_time: %s \n " ,
f - > name , n2 , ctime ( & f - > modtime ) ) ) ;
mod_time = file_modtime ( n2 ) ;
1997-10-20 03:22:03 +04:00
if ( f - > modtime ! = mod_time ) {
DEBUG ( 6 , ( " file %s modified: %s \n " , n2 , ctime ( & mod_time ) ) ) ;
f - > modtime = mod_time ;
return ( True ) ;
1997-09-05 21:16:21 +04:00
}
1996-05-04 11:50:46 +04:00
f = f - > next ;
}
return ( False ) ;
}
/***************************************************************************
handle the interpretation of the coding system parameter
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1997-11-22 10:09:12 +03:00
static BOOL handle_coding_system ( char * pszParmValue , char * * ptr )
1996-05-04 11:50:46 +04:00
{
1997-11-22 10:09:12 +03:00
string_set ( ptr , pszParmValue ) ;
interpret_coding_system ( pszParmValue ) ;
return ( True ) ;
1996-05-04 11:50:46 +04:00
}
/***************************************************************************
handle the interpretation of the character set system parameter
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1997-11-22 10:09:12 +03:00
static BOOL handle_character_set ( char * pszParmValue , char * * ptr )
1996-05-04 11:50:46 +04:00
{
1997-11-22 10:09:12 +03:00
string_set ( ptr , pszParmValue ) ;
interpret_character_set ( pszParmValue ) ;
return ( True ) ;
1996-05-04 11:50:46 +04:00
}
1997-07-30 23:17:51 +04:00
1996-05-04 11:50:46 +04:00
/***************************************************************************
handle the valid chars lines
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static BOOL handle_valid_chars ( char * pszParmValue , char * * ptr )
{
string_set ( ptr , pszParmValue ) ;
1997-08-13 03:02:45 +04:00
/* A dependency here is that the parameter client code page must be
set before this is called - as calling codepage_initialise ( )
would overwrite the valid char lines .
*/
codepage_initialise ( lp_client_code_page ( ) ) ;
1996-05-04 11:50:46 +04:00
add_char_string ( pszParmValue ) ;
return ( True ) ;
}
/***************************************************************************
handle the include operation
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static BOOL handle_include ( char * pszParmValue , char * * ptr )
{
pstring fname ;
1997-09-26 22:55:29 +04:00
pstrcpy ( fname , pszParmValue ) ;
1996-05-04 11:50:46 +04:00
add_to_file_list ( fname ) ;
standard_sub_basic ( fname ) ;
string_set ( ptr , fname ) ;
if ( file_exist ( fname , NULL ) )
return ( pm_process ( fname , do_section , do_parameter ) ) ;
DEBUG ( 2 , ( " Can't find include file %s \n " , fname ) ) ;
return ( False ) ;
}
/***************************************************************************
handle the interpretation of the copy parameter
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static BOOL handle_copy ( char * pszParmValue , char * * ptr )
{
BOOL bRetval ;
int iTemp ;
service serviceTemp ;
string_set ( ptr , pszParmValue ) ;
init_service ( & serviceTemp ) ;
bRetval = False ;
DEBUG ( 3 , ( " Copying service from service %s \n " , pszParmValue ) ) ;
if ( ( iTemp = getservicebyname ( pszParmValue , & serviceTemp ) ) > = 0 )
{
if ( iTemp = = iServiceIndex )
{
DEBUG ( 0 , ( " Can't copy service %s - unable to copy self! \n " ,
pszParmValue ) ) ;
}
else
{
copy_service ( pSERVICE ( iServiceIndex ) ,
& serviceTemp ,
iSERVICE ( iServiceIndex ) . copymap ) ;
bRetval = True ;
}
}
else
{
DEBUG ( 0 , ( " Unable to copy service - source not found: %s \n " ,
pszParmValue ) ) ;
bRetval = False ;
}
free_service ( & serviceTemp ) ;
return ( bRetval ) ;
}
/***************************************************************************
initialise a copymap
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void init_copymap ( service * pservice )
{
int i ;
if ( pservice - > copymap ) free ( pservice - > copymap ) ;
pservice - > copymap = ( BOOL * ) malloc ( sizeof ( BOOL ) * NUMPARAMETERS ) ;
if ( ! pservice - > copymap )
DEBUG ( 0 , ( " Couldn't allocate copymap!! (size %d) \n " , NUMPARAMETERS ) ) ;
for ( i = 0 ; i < NUMPARAMETERS ; i + + )
pservice - > copymap [ i ] = True ;
}
1998-03-08 17:14:49 +03:00
/***************************************************************************
return the local pointer to a parameter given the service number and the
pointer into the default structure
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void * lp_local_ptr ( int snum , void * ptr )
{
return ( void * ) ( ( ( char * ) pSERVICE ( snum ) ) + PTR_DIFF ( ptr , & sDefault ) ) ;
}
1996-05-04 11:50:46 +04:00
/***************************************************************************
1997-09-11 06:19:04 +04:00
Process a parameter for a particular service number . If snum < 0
then assume we are in the globals
1996-05-04 11:50:46 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1997-09-11 06:19:04 +04:00
BOOL lp_do_parameter ( int snum , char * pszParmName , char * pszParmValue )
1996-05-04 11:50:46 +04:00
{
1997-11-22 10:09:12 +03:00
int parmnum , i ;
1996-05-04 11:50:46 +04:00
void * parm_ptr = NULL ; /* where we are going to store the result */
void * def_ptr = NULL ;
parmnum = map_parameter ( pszParmName ) ;
if ( parmnum < 0 )
{
DEBUG ( 0 , ( " Ignoring unknown parameter \" %s \" \n " , pszParmName ) ) ;
return ( True ) ;
}
def_ptr = parm_table [ parmnum ] . ptr ;
/* we might point at a service, the default service or a global */
1997-09-11 06:19:04 +04:00
if ( snum < 0 ) {
1996-05-04 11:50:46 +04:00
parm_ptr = def_ptr ;
1997-09-11 06:19:04 +04:00
} else {
if ( parm_table [ parmnum ] . class = = P_GLOBAL ) {
1996-05-04 11:50:46 +04:00
DEBUG ( 0 , ( " Global parameter %s found in service section! \n " , pszParmName ) ) ;
return ( True ) ;
}
1997-09-11 06:19:04 +04:00
parm_ptr = ( ( char * ) pSERVICE ( snum ) ) + PTR_DIFF ( def_ptr , & sDefault ) ;
}
1996-05-04 11:50:46 +04:00
1997-09-11 06:19:04 +04:00
if ( snum > = 0 ) {
if ( ! iSERVICE ( snum ) . copymap )
init_copymap ( pSERVICE ( snum ) ) ;
/* this handles the aliases - set the copymap for other entries with
the same data pointer */
for ( i = 0 ; parm_table [ i ] . label ; i + + )
if ( parm_table [ i ] . ptr = = parm_table [ parmnum ] . ptr )
iSERVICE ( snum ) . copymap [ i ] = False ;
}
1996-05-04 11:50:46 +04:00
/* if it is a special case then go ahead */
1997-09-11 06:19:04 +04:00
if ( parm_table [ parmnum ] . special ) {
parm_table [ parmnum ] . special ( pszParmValue , parm_ptr ) ;
return ( True ) ;
}
1996-05-04 11:50:46 +04:00
/* now switch on the type of variable it is */
switch ( parm_table [ parmnum ] . type )
{
case P_BOOL :
set_boolean ( parm_ptr , pszParmValue ) ;
break ;
case P_BOOLREV :
set_boolean ( parm_ptr , pszParmValue ) ;
* ( BOOL * ) parm_ptr = ! * ( BOOL * ) parm_ptr ;
break ;
case P_INTEGER :
* ( int * ) parm_ptr = atoi ( pszParmValue ) ;
break ;
case P_CHAR :
* ( char * ) parm_ptr = * pszParmValue ;
break ;
case P_OCTAL :
sscanf ( pszParmValue , " %o " , ( int * ) parm_ptr ) ;
break ;
case P_STRING :
string_set ( parm_ptr , pszParmValue ) ;
break ;
1996-08-19 15:17:29 +04:00
case P_USTRING :
string_set ( parm_ptr , pszParmValue ) ;
strupper ( * ( char * * ) parm_ptr ) ;
break ;
1996-05-04 11:50:46 +04:00
case P_GSTRING :
strcpy ( ( char * ) parm_ptr , pszParmValue ) ;
break ;
1996-08-19 15:17:29 +04:00
case P_UGSTRING :
strcpy ( ( char * ) parm_ptr , pszParmValue ) ;
strupper ( ( char * ) parm_ptr ) ;
break ;
1997-11-22 10:09:12 +03:00
case P_ENUM :
for ( i = 0 ; parm_table [ parmnum ] . enum_list [ i ] . name ; i + + ) {
if ( strequal ( pszParmValue , parm_table [ parmnum ] . enum_list [ i ] . name ) ) {
* ( int * ) parm_ptr = parm_table [ parmnum ] . enum_list [ i ] . value ;
break ;
}
}
break ;
1998-03-14 11:27:41 +03:00
case P_SEP :
break ;
1996-05-04 11:50:46 +04:00
}
return ( True ) ;
}
1997-09-11 06:19:04 +04:00
/***************************************************************************
Process a parameter .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static BOOL do_parameter ( char * pszParmName , char * pszParmValue )
{
if ( ! bInGlobalSection & & bGlobalOnly ) return ( True ) ;
DEBUG ( 3 , ( " doing parameter %s = %s \n " , pszParmName , pszParmValue ) ) ;
return lp_do_parameter ( bInGlobalSection ? - 2 : iServiceIndex , pszParmName , pszParmValue ) ;
}
1996-05-04 11:50:46 +04:00
/***************************************************************************
print a parameter of the specified type
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1997-11-22 10:09:12 +03:00
static void print_parameter ( struct parm_struct * p , void * ptr , FILE * f )
1996-05-04 11:50:46 +04:00
{
1997-11-22 10:09:12 +03:00
int i ;
switch ( p - > type ) {
case P_ENUM :
for ( i = 0 ; p - > enum_list [ i ] . name ; i + + ) {
if ( * ( int * ) ptr = = p - > enum_list [ i ] . value ) {
fprintf ( f , " %s " , p - > enum_list [ i ] . name ) ;
break ;
}
}
break ;
case P_BOOL :
fprintf ( f , " %s " , BOOLSTR ( * ( BOOL * ) ptr ) ) ;
break ;
1996-05-04 11:50:46 +04:00
1997-11-22 10:09:12 +03:00
case P_BOOLREV :
fprintf ( f , " %s " , BOOLSTR ( ! * ( BOOL * ) ptr ) ) ;
break ;
1996-05-04 11:50:46 +04:00
1997-11-22 10:09:12 +03:00
case P_INTEGER :
fprintf ( f , " %d " , * ( int * ) ptr ) ;
break ;
1996-05-04 11:50:46 +04:00
1997-11-22 10:09:12 +03:00
case P_CHAR :
fprintf ( f , " %c " , * ( char * ) ptr ) ;
break ;
1996-05-04 11:50:46 +04:00
1997-11-22 10:09:12 +03:00
case P_OCTAL :
fprintf ( f , " 0%o " , * ( int * ) ptr ) ;
break ;
1996-05-04 11:50:46 +04:00
1997-11-22 10:09:12 +03:00
case P_GSTRING :
case P_UGSTRING :
if ( ( char * ) ptr )
fprintf ( f , " %s " , ( char * ) ptr ) ;
break ;
case P_STRING :
case P_USTRING :
if ( * ( char * * ) ptr )
fprintf ( f , " %s " , * ( char * * ) ptr ) ;
break ;
1998-03-14 11:27:41 +03:00
case P_SEP :
break ;
1997-11-22 10:09:12 +03:00
}
1996-05-04 11:50:46 +04:00
}
/***************************************************************************
check if two parameters are equal
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static BOOL equal_parameter ( parm_type type , void * ptr1 , void * ptr2 )
{
switch ( type )
{
case P_BOOL :
case P_BOOLREV :
return ( * ( ( BOOL * ) ptr1 ) = = * ( ( BOOL * ) ptr2 ) ) ;
case P_INTEGER :
1997-11-22 10:09:12 +03:00
case P_ENUM :
1996-05-04 11:50:46 +04:00
case P_OCTAL :
return ( * ( ( int * ) ptr1 ) = = * ( ( int * ) ptr2 ) ) ;
case P_CHAR :
return ( * ( ( char * ) ptr1 ) = = * ( ( char * ) ptr2 ) ) ;
case P_GSTRING :
1996-08-19 15:17:29 +04:00
case P_UGSTRING :
1996-05-04 11:50:46 +04:00
{
char * p1 = ( char * ) ptr1 , * p2 = ( char * ) ptr2 ;
if ( p1 & & ! * p1 ) p1 = NULL ;
if ( p2 & & ! * p2 ) p2 = NULL ;
return ( p1 = = p2 | | strequal ( p1 , p2 ) ) ;
}
case P_STRING :
1996-08-19 15:17:29 +04:00
case P_USTRING :
1996-05-04 11:50:46 +04:00
{
char * p1 = * ( char * * ) ptr1 , * p2 = * ( char * * ) ptr2 ;
if ( p1 & & ! * p1 ) p1 = NULL ;
if ( p2 & & ! * p2 ) p2 = NULL ;
return ( p1 = = p2 | | strequal ( p1 , p2 ) ) ;
}
1998-03-14 11:27:41 +03:00
case P_SEP :
break ;
1996-05-04 11:50:46 +04:00
}
return ( False ) ;
}
/***************************************************************************
Process a new section ( service ) . At this stage all sections are services .
Later we ' ll have special sections that permit server parameters to be set .
Returns True on success , False on failure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static BOOL do_section ( char * pszSectionName )
{
BOOL bRetval ;
BOOL isglobal = ( ( strwicmp ( pszSectionName , GLOBAL_NAME ) = = 0 ) | |
( strwicmp ( pszSectionName , GLOBAL_NAME2 ) = = 0 ) ) ;
bRetval = False ;
/* if we were in a global section then do the local inits */
if ( bInGlobalSection & & ! isglobal )
init_locals ( ) ;
/* if we've just struck a global section, note the fact. */
bInGlobalSection = isglobal ;
/* check for multiple global sections */
if ( bInGlobalSection )
{
DEBUG ( 3 , ( " Processing section \" [%s] \" \n " , pszSectionName ) ) ;
return ( True ) ;
}
if ( ! bInGlobalSection & & bGlobalOnly ) return ( True ) ;
/* if we have a current service, tidy it up before moving on */
bRetval = True ;
if ( iServiceIndex > = 0 )
bRetval = service_ok ( iServiceIndex ) ;
/* if all is still well, move to the next record in the services array */
if ( bRetval )
{
/* We put this here to avoid an odd message order if messages are */
/* issued by the post-processing of a previous section. */
DEBUG ( 2 , ( " Processing section \" [%s] \" \n " , pszSectionName ) ) ;
if ( ( iServiceIndex = add_a_service ( & sDefault , pszSectionName ) ) < 0 )
{
DEBUG ( 0 , ( " Failed to add a new service \n " ) ) ;
return ( False ) ;
}
}
return ( bRetval ) ;
}
1998-03-14 11:27:41 +03:00
/***************************************************************************
determine if a partcular base parameter is currently set to the default value .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static BOOL is_default ( int i )
{
if ( ! defaults_saved ) return False ;
switch ( parm_table [ i ] . type ) {
case P_STRING :
case P_USTRING :
return strequal ( parm_table [ i ] . def . svalue , * ( char * * ) parm_table [ i ] . ptr ) ;
case P_GSTRING :
case P_UGSTRING :
return strequal ( parm_table [ i ] . def . svalue , ( char * ) parm_table [ i ] . ptr ) ;
case P_BOOL :
case P_BOOLREV :
return parm_table [ i ] . def . bvalue = = * ( BOOL * ) parm_table [ i ] . ptr ;
case P_CHAR :
return parm_table [ i ] . def . cvalue = = * ( char * ) parm_table [ i ] . ptr ;
case P_INTEGER :
case P_OCTAL :
case P_ENUM :
return parm_table [ i ] . def . ivalue = = * ( int * ) parm_table [ i ] . ptr ;
case P_SEP :
break ;
}
return False ;
}
1996-05-04 11:50:46 +04:00
/***************************************************************************
Display the contents of the global structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1997-09-11 06:19:04 +04:00
static void dump_globals ( FILE * f )
1996-05-04 11:50:46 +04:00
{
1998-03-14 11:27:41 +03:00
int i ;
fprintf ( f , " # Global parameters \n " ) ;
for ( i = 0 ; parm_table [ i ] . label ; i + + )
if ( parm_table [ i ] . class = = P_GLOBAL & &
parm_table [ i ] . ptr & &
( i = = 0 | | ( parm_table [ i ] . ptr ! = parm_table [ i - 1 ] . ptr ) ) ) {
if ( defaults_saved & & is_default ( i ) ) continue ;
fprintf ( f , " \t %s = " , parm_table [ i ] . label ) ;
print_parameter ( & parm_table [ i ] , parm_table [ i ] . ptr , f ) ;
fprintf ( f , " \n " ) ;
}
1996-05-04 11:50:46 +04:00
}
1998-03-14 14:24:01 +03:00
/***************************************************************************
return True if a local parameter is currently set to the global default
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL lp_is_default ( int snum , struct parm_struct * parm )
{
int pdiff = PTR_DIFF ( parm - > ptr , & sDefault ) ;
return equal_parameter ( parm - > type ,
( ( char * ) pSERVICE ( snum ) ) + pdiff ,
( ( char * ) & sDefault ) + pdiff ) ;
}
1996-05-04 11:50:46 +04:00
/***************************************************************************
Display the contents of a single services record .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1997-09-11 06:19:04 +04:00
static void dump_a_service ( service * pService , FILE * f )
1996-05-04 11:50:46 +04:00
{
1998-03-14 11:27:41 +03:00
int i ;
if ( pService ! = & sDefault )
fprintf ( f , " \n [%s] \n " , pService - > szService ) ;
for ( i = 0 ; parm_table [ i ] . label ; i + + )
if ( parm_table [ i ] . class = = P_LOCAL & &
parm_table [ i ] . ptr & &
( * parm_table [ i ] . label ! = ' - ' ) & &
( i = = 0 | | ( parm_table [ i ] . ptr ! = parm_table [ i - 1 ] . ptr ) ) ) {
int pdiff = PTR_DIFF ( parm_table [ i ] . ptr , & sDefault ) ;
if ( pService = = & sDefault ) {
if ( defaults_saved & & is_default ( i ) ) continue ;
} else {
if ( equal_parameter ( parm_table [ i ] . type ,
( ( char * ) pService ) + pdiff ,
( ( char * ) & sDefault ) + pdiff ) )
continue ;
}
1996-05-04 11:50:46 +04:00
1998-03-14 11:27:41 +03:00
fprintf ( f , " \t %s = " , parm_table [ i ] . label ) ;
print_parameter ( & parm_table [ i ] ,
( ( char * ) pService ) + pdiff , f ) ;
fprintf ( f , " \n " ) ;
}
1996-05-04 11:50:46 +04:00
}
1997-09-11 06:19:04 +04:00
/***************************************************************************
1998-03-14 11:27:41 +03:00
return info about the next service in a service . snum = = - 1 gives the globals
1997-09-11 06:19:04 +04:00
1998-03-14 11:27:41 +03:00
return NULL when out of parameters
1997-09-11 06:19:04 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-03-08 17:14:49 +03:00
struct parm_struct * lp_next_parameter ( int snum , int * i , int allparameters )
1997-09-11 06:19:04 +04:00
{
1998-03-14 11:27:41 +03:00
if ( snum = = - 1 ) {
1997-09-11 06:19:04 +04:00
/* do the globals */
1998-03-14 11:27:41 +03:00
for ( ; parm_table [ * i ] . label ; ( * i ) + + ) {
if ( parm_table [ * i ] . class = = P_SEPARATOR )
1998-03-08 17:14:49 +03:00
return & parm_table [ ( * i ) + + ] ;
1998-03-14 11:27:41 +03:00
if ( ! parm_table [ * i ] . ptr | | ( * parm_table [ * i ] . label = = ' - ' ) )
continue ;
if ( ( * i ) > 0 & & ( parm_table [ * i ] . ptr = = parm_table [ ( * i ) - 1 ] . ptr ) )
continue ;
return & parm_table [ ( * i ) + + ] ;
}
1997-09-11 06:19:04 +04:00
} else {
1998-03-14 11:27:41 +03:00
service * pService = pSERVICE ( snum ) ;
for ( ; parm_table [ * i ] . label ; ( * i ) + + ) {
if ( parm_table [ * i ] . class = = P_SEPARATOR )
return & parm_table [ ( * i ) + + ] ;
1997-09-11 06:19:04 +04:00
if ( parm_table [ * i ] . class = = P_LOCAL & &
parm_table [ * i ] . ptr & &
( * parm_table [ * i ] . label ! = ' - ' ) & &
( ( * i ) = = 0 | |
( parm_table [ * i ] . ptr ! = parm_table [ ( * i ) - 1 ] . ptr ) ) ) {
int pdiff = PTR_DIFF ( parm_table [ * i ] . ptr , & sDefault ) ;
1998-03-14 11:27:41 +03:00
if ( allparameters | |
1997-09-11 06:19:04 +04:00
! equal_parameter ( parm_table [ * i ] . type ,
( ( char * ) pService ) + pdiff ,
( ( char * ) & sDefault ) + pdiff ) ) {
1998-03-08 17:14:49 +03:00
return & parm_table [ ( * i ) + + ] ;
1997-09-11 06:19:04 +04:00
}
}
1998-03-14 11:27:41 +03:00
}
1997-09-11 06:19:04 +04:00
}
1998-03-14 11:27:41 +03:00
return NULL ;
1997-09-11 06:19:04 +04:00
}
1996-05-04 11:50:46 +04:00
#if 0
/***************************************************************************
Display the contents of a single copy structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void dump_copy_map ( BOOL * pcopymap )
{
int i ;
if ( ! pcopymap ) return ;
printf ( " \n \t Non-Copied parameters: \n " ) ;
for ( i = 0 ; parm_table [ i ] . label ; i + + )
if ( parm_table [ i ] . class = = P_LOCAL & &
parm_table [ i ] . ptr & & ! pcopymap [ i ] & &
( i = = 0 | | ( parm_table [ i ] . ptr ! = parm_table [ i - 1 ] . ptr ) ) )
{
printf ( " \t \t %s \n " , parm_table [ i ] . label ) ;
}
}
# endif
/***************************************************************************
Return TRUE if the passed service number is within range .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL lp_snum_ok ( int iService )
{
return ( LP_SNUM_OK ( iService ) & & iSERVICE ( iService ) . bAvailable ) ;
}
/***************************************************************************
auto - load some homes and printer services
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void lp_add_auto_services ( char * str )
{
char * s ;
char * p ;
int homes = lp_servicenumber ( HOMES_NAME ) ;
int printers = lp_servicenumber ( PRINTERS_NAME ) ;
if ( ! str )
return ;
s = strdup ( str ) ;
if ( ! s ) return ;
for ( p = strtok ( s , LIST_SEP ) ; p ; p = strtok ( NULL , LIST_SEP ) )
{
char * home = get_home_dir ( p ) ;
if ( lp_servicenumber ( p ) > = 0 ) continue ;
if ( home & & homes > = 0 )
{
lp_add_home ( p , homes , home ) ;
continue ;
}
if ( printers > = 0 & & pcap_printername_ok ( p , NULL ) )
lp_add_printer ( p , printers ) ;
}
free ( s ) ;
}
/***************************************************************************
auto - load one printer
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void lp_add_one_printer ( char * name , char * comment )
{
int printers = lp_servicenumber ( PRINTERS_NAME ) ;
int i ;
if ( lp_servicenumber ( name ) < 0 )
{
lp_add_printer ( name , printers ) ;
if ( ( i = lp_servicenumber ( name ) ) > = 0 )
string_set ( & iSERVICE ( i ) . comment , comment ) ;
}
}
/***************************************************************************
auto - load printer services
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void lp_add_all_printers ( void )
{
int printers = lp_servicenumber ( PRINTERS_NAME ) ;
if ( printers < 0 ) return ;
pcap_printer_fn ( lp_add_one_printer ) ;
}
/***************************************************************************
have we loaded a services file yet ?
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
BOOL lp_loaded ( void )
{
return ( bLoaded ) ;
}
/***************************************************************************
unload unused services
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void lp_killunused ( BOOL ( * snumused ) ( int ) )
{
int i ;
for ( i = 0 ; i < iNumServices ; i + + )
1997-09-11 06:19:04 +04:00
if ( VALID ( i ) & & ( ! snumused | | ! snumused ( i ) ) )
1996-05-04 11:50:46 +04:00
{
iSERVICE ( i ) . valid = False ;
free_service ( pSERVICE ( i ) ) ;
}
}
1998-03-14 11:27:41 +03:00
/***************************************************************************
save the curent values of all global and sDefault parameters into the
defaults union . This allows swat and testparm to show only the
changed ( ie . non - default ) parameters .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void lp_save_defaults ( void )
{
int i ;
for ( i = 0 ; parm_table [ i ] . label ; i + + ) {
if ( i > 0 & & parm_table [ i ] . ptr = = parm_table [ i - 1 ] . ptr ) continue ;
switch ( parm_table [ i ] . type ) {
case P_STRING :
case P_USTRING :
parm_table [ i ] . def . svalue = strdup ( * ( char * * ) parm_table [ i ] . ptr ) ;
break ;
case P_GSTRING :
case P_UGSTRING :
parm_table [ i ] . def . svalue = strdup ( ( char * ) parm_table [ i ] . ptr ) ;
break ;
case P_BOOL :
case P_BOOLREV :
parm_table [ i ] . def . bvalue = * ( BOOL * ) parm_table [ i ] . ptr ;
break ;
case P_CHAR :
parm_table [ i ] . def . cvalue = * ( char * ) parm_table [ i ] . ptr ;
break ;
case P_INTEGER :
case P_OCTAL :
case P_ENUM :
parm_table [ i ] . def . ivalue = * ( int * ) parm_table [ i ] . ptr ;
break ;
case P_SEP :
break ;
}
}
defaults_saved = True ;
}
1996-05-04 11:50:46 +04:00
/***************************************************************************
Load the services array from the services file . Return True on success ,
False on failure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-03-14 11:27:41 +03:00
BOOL lp_load ( char * pszFname , BOOL global_only , BOOL save_defaults , BOOL add_ipc )
1996-05-04 11:50:46 +04:00
{
pstring n2 ;
BOOL bRetval ;
1997-07-30 23:17:51 +04:00
1996-05-04 11:50:46 +04:00
add_to_file_list ( pszFname ) ;
bRetval = False ;
bInGlobalSection = True ;
bGlobalOnly = global_only ;
init_globals ( ) ;
1998-03-14 11:27:41 +03:00
if ( save_defaults ) {
init_locals ( ) ;
lp_save_defaults ( ) ;
}
1996-05-04 11:50:46 +04:00
1997-09-26 22:55:29 +04:00
pstrcpy ( n2 , pszFname ) ;
1996-05-04 11:50:46 +04:00
standard_sub_basic ( n2 ) ;
/* We get sections first, so have to start 'behind' to make up */
iServiceIndex = - 1 ;
bRetval = pm_process ( n2 , do_section , do_parameter ) ;
/* finish up the last section */
DEBUG ( 3 , ( " pm_process() returned %s \n " , BOOLSTR ( bRetval ) ) ) ;
if ( bRetval )
if ( iServiceIndex > = 0 )
bRetval = service_ok ( iServiceIndex ) ;
lp_add_auto_services ( lp_auto_services ( ) ) ;
if ( lp_load_printers ( ) )
lp_add_all_printers ( ) ;
1998-03-14 11:27:41 +03:00
if ( add_ipc )
lp_add_ipc ( ) ;
1996-05-04 11:50:46 +04:00
1997-07-30 23:17:51 +04:00
set_default_server_announce_type ( ) ;
1996-05-04 11:50:46 +04:00
bLoaded = True ;
return ( bRetval ) ;
}
/***************************************************************************
return the max number of services
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int lp_numservices ( void )
{
return ( iNumServices ) ;
}
/***************************************************************************
Display the contents of the services array in human - readable form .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-03-17 14:44:16 +03:00
void lp_dump ( FILE * f , BOOL show_defaults )
1996-05-04 11:50:46 +04:00
{
int iService ;
1998-03-17 17:46:17 +03:00
if ( show_defaults ) {
1998-03-17 14:44:16 +03:00
defaults_saved = False ;
}
1997-09-11 06:19:04 +04:00
dump_globals ( f ) ;
1996-05-04 11:50:46 +04:00
1997-09-11 06:19:04 +04:00
dump_a_service ( & sDefault , f ) ;
1996-05-04 11:50:46 +04:00
for ( iService = 0 ; iService < iNumServices ; iService + + )
{
if ( VALID ( iService ) )
{
if ( iSERVICE ( iService ) . szService [ 0 ] = = ' \0 ' )
break ;
1997-09-11 06:19:04 +04:00
dump_a_service ( pSERVICE ( iService ) , f ) ;
1996-05-04 11:50:46 +04:00
}
}
}
1997-09-11 06:19:04 +04:00
1996-05-04 11:50:46 +04:00
/***************************************************************************
Return the number of the service with the given name , or - 1 if it doesn ' t
exist . Note that this is a DIFFERENT ANIMAL from the internal function
getservicebyname ( ) ! This works ONLY if all services have been loaded , and
does not copy the found service .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int lp_servicenumber ( char * pszServiceName )
{
int iService ;
for ( iService = iNumServices - 1 ; iService > = 0 ; iService - - )
if ( VALID ( iService ) & &
1997-11-27 02:43:06 +03:00
strequal ( lp_servicename ( iService ) , pszServiceName ) )
1996-05-04 11:50:46 +04:00
break ;
if ( iService < 0 )
DEBUG ( 7 , ( " lp_servicenumber: couldn't find %s \n " , pszServiceName ) ) ;
return ( iService ) ;
}
/*******************************************************************
a useful volume label function
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
char * volume_label ( int snum )
{
char * ret = lp_volume ( snum ) ;
1997-11-03 22:24:45 +03:00
if ( ! * ret ) return ( lp_servicename ( snum ) ) ;
return ( ret ) ;
1996-05-04 11:50:46 +04:00
}
1997-07-30 23:17:51 +04:00
#if 0
/*
* nmbd only loads the global section . There seems to be no way to
* determine exactly is a service is printable by only looking at the
* [ global ] section so for now always announce as a print server . This
* will need looking at in the future . Jeremy ( jallison @ whistle . com ) .
*/
/*******************************************************************
Return true if any printer services are defined .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static BOOL lp_printer_services ( void )
{
int iService ;
for ( iService = iNumServices - 1 ; iService > = 0 ; iService - - )
if ( VALID ( iService ) & & iSERVICE ( iService ) . bPrint_ok )
return True ;
return False ;
}
# endif
/*******************************************************************
Set the server type we will announce as via nmbd .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static void set_default_server_announce_type ( )
{
default_server_announce = ( SV_TYPE_WORKSTATION | SV_TYPE_SERVER |
SV_TYPE_SERVER_UNIX | SV_TYPE_PRINTQ_SERVER ) ;
if ( lp_announce_as ( ) = = ANNOUNCE_AS_NT )
default_server_announce | = ( SV_TYPE_SERVER_NT | SV_TYPE_NT ) ;
else if ( lp_announce_as ( ) = = ANNOUNCE_AS_WIN95 )
default_server_announce | = SV_TYPE_WIN95_PLUS ;
else if ( lp_announce_as ( ) = = ANNOUNCE_AS_WFW )
default_server_announce | = SV_TYPE_WFW ;
default_server_announce | = ( lp_time_server ( ) ? SV_TYPE_TIME_SOURCE : 0 ) ;
/*
* nmbd only loads the [ global ] section . There seems to be no way to
* determine exactly if any service is printable by only looking at the
* [ global ] section so for now always announce as a print server . This
* will need looking at in the future . Jeremy ( jallison @ whistle . com ) .
*/
#if 0
default_server_announce | = ( lp_printer_services ( ) ? SV_TYPE_PRINTQ_SERVER : 0 ) ;
# endif
}
1997-09-11 06:19:04 +04:00
/*******************************************************************
rename a service
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void lp_rename_service ( int snum , char * new_name )
{
string_set ( & pSERVICE ( snum ) - > szService , new_name ) ;
}
/*******************************************************************
remove a service
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void lp_remove_service ( int snum )
{
pSERVICE ( snum ) - > valid = False ;
}
/*******************************************************************
copy a service
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void lp_copy_service ( int snum , char * new_name )
{
char * oldname = lp_servicename ( snum ) ;
do_section ( new_name ) ;
if ( snum > = 0 ) {
snum = lp_servicenumber ( new_name ) ;
if ( snum > = 0 )
lp_do_parameter ( snum , " copy " , oldname ) ;
}
}
1997-07-30 23:17:51 +04:00
/*******************************************************************
Get the default server type we will announce as via nmbd .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int lp_default_server_announce ( void )
{
return default_server_announce ;
}
/*******************************************************************
Split the announce version into major and minor numbers .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int lp_major_announce_version ( void )
{
static BOOL got_major = False ;
static int major_version = DEFAULT_MAJOR_VERSION ;
char * vers ;
char * p ;
if ( got_major )
return major_version ;
got_major = True ;
if ( ( vers = lp_announce_version ( ) ) = = NULL )
return major_version ;
if ( ( p = strchr ( vers , ' . ' ) ) = = 0 )
return major_version ;
* p = ' \0 ' ;
major_version = atoi ( vers ) ;
return major_version ;
}
int lp_minor_announce_version ( void )
{
static BOOL got_minor = False ;
static int minor_version = DEFAULT_MINOR_VERSION ;
char * vers ;
char * p ;
if ( got_minor )
return minor_version ;
got_minor = True ;
if ( ( vers = lp_announce_version ( ) ) = = NULL )
return minor_version ;
if ( ( p = strchr ( vers , ' . ' ) ) = = 0 )
return minor_version ;
p + + ;
minor_version = atoi ( p ) ;
return minor_version ;
}
1997-09-11 06:19:04 +04:00
1998-03-16 23:59:47 +03:00
/***********************************************************
Set the global name resolution order ( used in smbclient ) .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void lp_set_name_resolve_order ( char * new_order )
{
Globals . szNameResolveOrder = new_order ;
}