Copyright (C) Simo Sorce 2001
Copyright (C) Alexander Bokovoy 2002
+ Copyright (C) Stefan (metze) Metzmacher 2002
+ Copyright (C) Anthony Liguori 2003
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
extern userdom_struct current_user_info;
extern pstring user_socket_options;
-extern pstring global_myname;
-pstring global_scope = "";
#ifndef GLOBAL_NAME
#define GLOBAL_NAME "global"
static BOOL defaults_saved = False;
+typedef struct _param_opt_struct param_opt_struct;
+struct _param_opt_struct {
+ param_opt_struct *prev, *next;
+ char *key;
+ char *value;
+ char **list;
+};
+
/*
* This structure describes global (ie., server-wide) parameters.
*/
char *szRootdir;
char *szDefaultService;
char *szDfree;
+ char *szGetQuota;
+ char *szSetQuota;
char *szMsgCommand;
char *szHostsEquiv;
char *szServerString;
char *szSMBPasswdFile;
char *szPrivateDir;
char **szPassdbBackend;
- char **szSamBackend;
+ char **szPreloadModules;
char *szPasswordServer;
char *szSocketOptions;
- char *szWorkGroup;
char *szRealm;
- char *szADSserver;
char *szUsernameMap;
char *szLogonScript;
char *szLogonPath;
char *szSocketAddress;
char *szNISHomeMapName;
char *szAnnounceVersion; /* This is initialised in init_globals */
+ char *szWorkgroup;
+ char *szNetbiosName;
char **szNetbiosAliases;
+ char *szNetbiosScope;
char *szDomainOtherSIDs;
char *szNameResolveOrder;
char *szPanicAction;
char *szAbortShutdownScript;
char *szWINSHook;
char *szWINSPartners;
-#ifdef WITH_UTMP
char *szUtmpDir;
char *szWtmpDir;
BOOL bUtmp;
-#endif
char *szSourceEnv;
- char *szWinbindUID;
- char *szWinbindGID;
- char *szNonUnixAccountRange;
- BOOL bAlgorithmicRidBase;
+ char *szIdmapUID;
+ char *szIdmapGID;
+ BOOL bEnableRidAlgorithm;
+ int AlgorithmicRidBase;
+ char *szTemplatePrimaryGroup;
char *szTemplateHomedir;
char *szTemplateShell;
char *szWinbindSeparator;
+ BOOL bWinbindEnableLocalAccounts;
BOOL bWinbindEnumUsers;
BOOL bWinbindEnumGroups;
BOOL bWinbindUseDefaultDomain;
+ BOOL bWinbindTrustedDomainsOnly;
+ char *szWinbindBackend;
+ char *szIdmapBackend;
char *szAddShareCommand;
char *szChangeShareCommand;
char *szDeleteShareCommand;
int announce_as; /* This is initialised in init_globals */
int machine_password_timeout;
int change_notify_timeout;
- int stat_cache_size;
int map_to_guest;
int min_passwd_length;
int oplock_break_wait_time;
int iLockSpinTime;
char *szLdapMachineSuffix;
char *szLdapUserSuffix;
+ char *szLdapIdmapSuffix;
+ char *szLdapGroupSuffix;
#ifdef WITH_LDAP_SAMCONFIG
int ldap_port;
char *szLdapServer;
char *szLdapSuffix;
char *szLdapFilter;
char *szLdapAdminDn;
+ BOOL ldap_trust_ids;
char *szAclCompat;
int ldap_passwd_sync;
+ BOOL ldap_delete_dn;
BOOL bMsAddPrinterWizard;
BOOL bDNSproxy;
BOOL bWINSsupport;
BOOL bDomainLogons;
BOOL bEncryptPasswords;
BOOL bUpdateEncrypt;
+ int clientSchannel;
+ int serverSchannel;
BOOL bStripDot;
BOOL bNullPasswords;
BOOL bObeyPamRestrictions;
BOOL bAllowTrustedDomains;
BOOL bLanmanAuth;
BOOL bNTLMAuth;
+ BOOL bUseSpnego;
+ BOOL bClientLanManAuth;
+ BOOL bClientNTLMv2Auth;
+ BOOL bClientPlaintextAuth;
+ BOOL bClientUseSpnego;
BOOL bDebugHiresTimestamp;
BOOL bDebugPid;
BOOL bDebugUid;
BOOL bUnicode;
BOOL bUseMmap;
BOOL bHostnameLookups;
- BOOL bUseSpnego;
BOOL bUnixExtensions;
BOOL bDisableNetbios;
+ BOOL bKernelChangeNotify;
int restrict_anonymous;
int name_cache_timeout;
+ int client_signing;
+ param_opt_struct *param_opt;
}
global;
static global Globals;
-
-
/*
* This structure describes a single service.
*/
char **printer_admin;
char *volume;
char *fstype;
- char *szVfsObjectFile;
- char *szVfsOptions;
- char *szVfsPath;
+ char **szVfsObjects;
+ char *szMSDfsProxy;
int iMinPrintSpace;
int iMaxPrintJobs;
+ int iMaxReportedPrintJobs;
int iWriteCacheSize;
int iCreate_mask;
int iCreate_force_mode;
BOOL bNTAclSupport;
BOOL bUseSendfile;
BOOL bProfileAcls;
+ BOOL bMap_acl_inherit;
+ param_opt_struct *param_opt;
char dummy[3]; /* for alignment */
}
NULL, /* printer admin */
NULL, /* volume */
NULL, /* fstype */
- NULL, /* vfs object */
- NULL, /* vfs options */
- NULL, /* vfs path */
+ NULL, /* vfs objects */
+ NULL, /* szMSDfsProxy */
0, /* iMinPrintSpace */
1000, /* iMaxPrintJobs */
+ 0, /* iMaxReportedPrintJobs */
0, /* iWriteCacheSize */
0744, /* iCreate_mask */
0000, /* iCreate_force_mode */
True, /* bNTAclSupport */
False, /* bUseSendfile */
False, /* bProfileAcls */
+ False, /* bMap_acl_inherit */
+
+ NULL, /* Parametric options */
"" /* dummy */
};
#define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
/* prototypes for the special type handlers */
-static BOOL handle_include(char *pszParmValue, char **ptr);
-static BOOL handle_copy(char *pszParmValue, char **ptr);
-static BOOL handle_vfs_object(char *pszParmValue, char **ptr);
-static BOOL handle_source_env(char *pszParmValue, char **ptr);
-static BOOL handle_netbios_name(char *pszParmValue, char **ptr);
-static BOOL handle_winbind_uid(char *pszParmValue, char **ptr);
-static BOOL handle_winbind_gid(char *pszParmValue, char **ptr);
-static BOOL handle_non_unix_account_range(char *pszParmValue, char **ptr);
-static BOOL handle_debug_list( char *pszParmValue, char **ptr );
-
-static BOOL handle_ldap_machine_suffix ( char *pszParmValue, char **ptr );
-static BOOL handle_ldap_user_suffix ( char *pszParmValue, char **ptr );
-static BOOL handle_ldap_suffix ( char *pszParmValue, char **ptr );
-
-static BOOL handle_acl_compatibility(char *pszParmValue, char **ptr);
+static BOOL handle_include(const char *pszParmValue, char **ptr);
+static BOOL handle_copy(const char *pszParmValue, char **ptr);
+static BOOL handle_source_env(const char *pszParmValue, char **ptr);
+static BOOL handle_netbios_name(const char *pszParmValue, char **ptr);
+static BOOL handle_idmap_uid(const char *pszParmValue, char **ptr);
+static BOOL handle_idmap_gid(const char *pszParmValue, char **ptr);
+static BOOL handle_debug_list( const char *pszParmValue, char **ptr );
+static BOOL handle_workgroup( const char *pszParmValue, char **ptr );
+static BOOL handle_netbios_aliases( const char *pszParmValue, char **ptr );
+static BOOL handle_netbios_scope( const char *pszParmValue, char **ptr );
+
+static BOOL handle_ldap_suffix ( const char *pszParmValue, char **ptr );
+static BOOL handle_ldap_sub_suffix ( const char *pszParmValue, char **ptr );
+
+static BOOL handle_acl_compatibility(const char *pszParmValue, char **ptr);
static void set_server_role(void);
static void set_default_server_announce_type(void);
+static void set_allowed_client_auth(void);
-static struct enum_list enum_protocol[] = {
+static const struct enum_list enum_protocol[] = {
{PROTOCOL_NT1, "NT1"},
{PROTOCOL_LANMAN2, "LANMAN2"},
{PROTOCOL_LANMAN1, "LANMAN1"},
{-1, NULL}
};
-static struct enum_list enum_security[] = {
+static const struct enum_list enum_security[] = {
{SEC_SHARE, "SHARE"},
{SEC_USER, "USER"},
{SEC_SERVER, "SERVER"},
{-1, NULL}
};
-static struct enum_list enum_printing[] = {
+static const struct enum_list enum_printing[] = {
{PRINT_SYSV, "sysv"},
{PRINT_AIX, "aix"},
{PRINT_HPUX, "hpux"},
{PRINT_QNX, "qnx"},
{PRINT_PLP, "plp"},
{PRINT_LPRNG, "lprng"},
- {PRINT_SOFTQ, "softq"},
{PRINT_CUPS, "cups"},
{PRINT_LPRNT, "nt"},
{PRINT_LPROS2, "os2"},
{-1, NULL}
};
-static struct enum_list enum_ldap_ssl[] = {
+static const struct enum_list enum_ldap_ssl[] = {
+#ifdef WITH_LDAP_SAMCONFIG
{LDAP_SSL_ON, "Yes"},
{LDAP_SSL_ON, "yes"},
{LDAP_SSL_ON, "on"},
{LDAP_SSL_ON, "On"},
+#endif
{LDAP_SSL_OFF, "no"},
{LDAP_SSL_OFF, "No"},
{LDAP_SSL_OFF, "off"},
{-1, NULL}
};
-static struct enum_list enum_ldap_passwd_sync[] = {
- {LDAP_PASSWD_SYNC_ON, "Yes"},
- {LDAP_PASSWD_SYNC_ON, "yes"},
- {LDAP_PASSWD_SYNC_ON, "on"},
- {LDAP_PASSWD_SYNC_ON, "On"},
+static const struct enum_list enum_ldap_passwd_sync[] = {
{LDAP_PASSWD_SYNC_OFF, "no"},
{LDAP_PASSWD_SYNC_OFF, "No"},
{LDAP_PASSWD_SYNC_OFF, "off"},
{LDAP_PASSWD_SYNC_OFF, "Off"},
-#ifdef LDAP_EXOP_X_MODIFY_PASSWD
+ {LDAP_PASSWD_SYNC_ON, "Yes"},
+ {LDAP_PASSWD_SYNC_ON, "yes"},
+ {LDAP_PASSWD_SYNC_ON, "on"},
+ {LDAP_PASSWD_SYNC_ON, "On"},
{LDAP_PASSWD_SYNC_ONLY, "Only"},
{LDAP_PASSWD_SYNC_ONLY, "only"},
-#endif /* LDAP_EXOP_X_MODIFY_PASSWD */
{-1, NULL}
};
#define ANNOUNCE_AS_WFW 3
#define ANNOUNCE_AS_NT_WORKSTATION 4
-static struct enum_list enum_announce_as[] = {
+static const struct enum_list enum_announce_as[] = {
{ANNOUNCE_AS_NT_SERVER, "NT"},
{ANNOUNCE_AS_NT_SERVER, "NT Server"},
{ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},
{-1, NULL}
};
-static struct enum_list enum_case[] = {
+static const struct enum_list enum_case[] = {
{CASE_LOWER, "lower"},
{CASE_UPPER, "upper"},
{-1, NULL}
};
-static struct enum_list enum_bool_auto[] = {
+static const struct enum_list enum_bool_auto[] = {
{False, "No"},
{False, "False"},
{False, "0"},
#define CSC_POLICY_PROGRAMS 2
#define CSC_POLICY_DISABLE 3
-static struct enum_list enum_csc_policy[] = {
+static const struct enum_list enum_csc_policy[] = {
{CSC_POLICY_MANUAL, "manual"},
{CSC_POLICY_DOCUMENTS, "documents"},
{CSC_POLICY_PROGRAMS, "programs"},
{-1, NULL}
};
+/* SMB signing types. */
+static const struct enum_list enum_smb_signing_vals[] = {
+ {False, "No"},
+ {False, "False"},
+ {False, "0"},
+ {False, "Off"},
+ {True, "Yes"},
+ {True, "True"},
+ {True, "1"},
+ {True, "On"},
+ {Required, "Required"},
+ {Required, "Mandatory"},
+ {Required, "Force"},
+ {Required, "Forced"},
+ {Required, "Enforced"},
+ {-1, NULL}
+};
+
+
/*
Do you want session setups at user level security with a invalid
password to be rejected or allowed in as guest? WinNT rejects them
level security.
*/
-static struct enum_list enum_map_to_guest[] = {
+static const struct enum_list enum_map_to_guest[] = {
{NEVER_MAP_TO_GUEST, "Never"},
{MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
{MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
{"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | FLAG_DEVELOPER},
{"path", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | FLAG_DEVELOPER},
{"directory", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_HIDE},
- {"workgroup", P_USTRING, P_GLOBAL, &Globals.szWorkGroup, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
+ {"workgroup", P_USTRING, P_GLOBAL, &Globals.szWorkgroup, handle_workgroup, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
{"realm", P_USTRING, P_GLOBAL, &Globals.szRealm, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
- {"ADS server", P_STRING, P_GLOBAL, &Globals.szADSserver, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
- {"netbios name", P_UGSTRING, P_GLOBAL, global_myname, handle_netbios_name, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
- {"netbios aliases", P_LIST, P_GLOBAL, &Globals.szNetbiosAliases, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
- {"netbios scope", P_UGSTRING, P_GLOBAL, global_scope, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"netbios name", P_USTRING, P_GLOBAL, &Globals.szNetbiosName, handle_netbios_name, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
+ {"netbios aliases", P_LIST, P_GLOBAL, &Globals.szNetbiosAliases, handle_netbios_aliases, NULL, FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
+ {"netbios scope", P_USTRING, P_GLOBAL, &Globals.szNetbiosScope, handle_netbios_scope, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"server string", P_STRING, P_GLOBAL, &Globals.szServerString, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_DEVELOPER},
{"interfaces", P_LIST, P_GLOBAL, &Globals.szInterfaces, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
{"bind interfaces only", P_BOOL, P_GLOBAL, &Globals.bBindInterfacesOnly, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
{"auth methods", P_LIST, P_GLOBAL, &Globals.AuthMethods, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
{"encrypt passwords", P_BOOL, P_GLOBAL, &Globals.bEncryptPasswords, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
{"update encrypted", P_BOOL, P_GLOBAL, &Globals.bUpdateEncrypt, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"client schannel", P_ENUM, P_GLOBAL, &Globals.clientSchannel, NULL, enum_bool_auto, FLAG_BASIC | FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"server schannel", P_ENUM, P_GLOBAL, &Globals.serverSchannel, NULL, enum_bool_auto, FLAG_BASIC | FLAG_ADVANCED | FLAG_DEVELOPER},
{"allow trusted domains", P_BOOL, P_GLOBAL, &Globals.bAllowTrustedDomains, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"hosts equiv", P_STRING, P_GLOBAL, &Globals.szHostsEquiv, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"min passwd length", P_INTEGER, P_GLOBAL, &Globals.min_passwd_length, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"password server", P_STRING, P_GLOBAL, &Globals.szPasswordServer, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
{"smb passwd file", P_STRING, P_GLOBAL, &Globals.szSMBPasswdFile, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"private dir", P_STRING, P_GLOBAL, &Globals.szPrivateDir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"passdb backend", P_LIST, P_GLOBAL, &Globals.szPassdbBackend, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"sam backend", P_LIST, P_GLOBAL, &Globals.szSamBackend, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"non unix account range", P_STRING, P_GLOBAL, &Globals.szNonUnixAccountRange, handle_non_unix_account_range, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"algorithmic rid base", P_INTEGER, P_GLOBAL, &Globals.bAlgorithmicRidBase, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"passdb backend", P_LIST, P_GLOBAL, &Globals.szPassdbBackend, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD | FLAG_DEVELOPER},
+ {"algorithmic rid base", P_INTEGER, P_GLOBAL, &Globals.AlgorithmicRidBase, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"root directory", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"root dir", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"root", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_HIDE | FLAG_DEVELOPER},
{"passwd program", P_STRING, P_GLOBAL, &Globals.szPasswdProgram, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"passwd chat", P_STRING, P_GLOBAL, &Globals.szPasswdChat, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"passwd chat debug", P_BOOL, P_GLOBAL, &Globals.bPasswdChatDebug, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"username map", P_STRING, P_GLOBAL, &Globals.szUsernameMap, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER | FLAG_DEVELOPER},
+ {"username map", P_STRING, P_GLOBAL, &Globals.szUsernameMap, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"password level", P_INTEGER, P_GLOBAL, &Globals.pwordlevel, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"username level", P_INTEGER, P_GLOBAL, &Globals.unamelevel, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"unix password sync", P_BOOL, P_GLOBAL, &Globals.bUnixPasswdSync, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"restrict anonymous", P_INTEGER, P_GLOBAL, &Globals.restrict_anonymous, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"lanman auth", P_BOOL, P_GLOBAL, &Globals.bLanmanAuth, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"ntlm auth", P_BOOL, P_GLOBAL, &Globals.bNTLMAuth, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"client NTLMv2 auth", P_BOOL, P_GLOBAL, &Globals.bClientNTLMv2Auth, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"client lanman auth", P_BOOL, P_GLOBAL, &Globals.bClientLanManAuth, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"client plaintext auth", P_BOOL, P_GLOBAL, &Globals.bClientPlaintextAuth, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"username", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE},
{"user", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL, FLAG_HIDE},
{"allow hosts", P_LIST, P_LOCAL, &sDefault.szHostsallow, NULL, NULL, FLAG_HIDE},
{"hosts deny", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT | FLAG_DEVELOPER},
{"deny hosts", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_HIDE},
+ {"preload modules", P_LIST, P_GLOBAL, &Globals.szPreloadModules, NULL, NULL, FLAG_BASIC | FLAG_GLOBAL},
{"Logging Options", P_SEP, P_SEPARATOR},
{"write raw", P_BOOL, P_GLOBAL, &Globals.bWriteRaw, NULL, NULL, FLAG_DEVELOPER},
{"disable netbios", P_BOOL, P_GLOBAL, &Globals.bDisableNetbios, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"acl compatibility", P_STRING, P_GLOBAL, &Globals.szAclCompat, handle_acl_compatibility, NULL, FLAG_SHARE | FLAG_GLOBAL | FLAG_ADVANCED},
- {"nt acl support", P_BOOL, P_LOCAL, &sDefault.bNTAclSupport, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE | FLAG_ADVANCED | FLAG_WIZARD},
+ {"acl compatibility", P_STRING, P_GLOBAL, &Globals.szAclCompat, handle_acl_compatibility, NULL, FLAG_SHARE | FLAG_GLOBAL | FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"nt acl support", P_BOOL, P_LOCAL, &sDefault.bNTAclSupport, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE | FLAG_ADVANCED | FLAG_DEVELOPER},
{"nt pipe support", P_BOOL, P_GLOBAL, &Globals.bNTPipeSupport, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"nt status support", P_BOOL, P_GLOBAL, &Globals.bNTStatusSupport, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"profile acls", P_BOOL, P_LOCAL, &sDefault.bProfileAcls, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE | FLAG_ADVANCED | FLAG_WIZARD},
+ {"profile acls", P_BOOL, P_LOCAL, &sDefault.bProfileAcls, NULL, NULL, FLAG_GLOBAL | FLAG_SHARE | FLAG_ADVANCED},
{"announce version", P_STRING, P_GLOBAL, &Globals.szAnnounceVersion, NULL, NULL, FLAG_DEVELOPER},
{"announce as", P_ENUM, P_GLOBAL, &Globals.announce_as, NULL, enum_announce_as, FLAG_DEVELOPER},
+ {"map acl inherit", P_BOOL, P_LOCAL, &sDefault.bMap_acl_inherit, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL},
{"max mux", P_INTEGER, P_GLOBAL, &Globals.max_mux, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"max xmit", P_INTEGER, P_GLOBAL, &Globals.max_xmit, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"time server", P_BOOL, P_GLOBAL, &Globals.bTimeServer, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"unix extensions", P_BOOL, P_GLOBAL, &Globals.bUnixExtensions, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"use spnego", P_BOOL, P_GLOBAL, &Globals.bUseSpnego, NULL, NULL, FLAG_DEVELOPER},
+ {"client signing", P_ENUM, P_GLOBAL, &Globals.client_signing, NULL, enum_smb_signing_vals, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"client use spnego", P_BOOL, P_GLOBAL, &Globals.bClientUseSpnego, NULL, NULL, FLAG_DEVELOPER},
{"Tuning Options", P_SEP, P_SEPARATOR},
{"deadtime", P_INTEGER, P_GLOBAL, &Globals.deadtime, NULL, NULL, FLAG_DEVELOPER},
{"getwd cache", P_BOOL, P_GLOBAL, &use_getwd_cache, NULL, NULL, FLAG_DEVELOPER},
{"keepalive", P_INTEGER, P_GLOBAL, &keepalive, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"kernel change notify", P_BOOL, P_GLOBAL, &Globals.bKernelChangeNotify, NULL, NULL, FLAG_DEVELOPER},
{"lpq cache time", P_INTEGER, P_GLOBAL, &Globals.lpqcachetime, NULL, NULL, FLAG_DEVELOPER},
{"max smbd processes", P_INTEGER, P_GLOBAL, &Globals.iMaxSmbdProcesses, NULL, NULL, FLAG_DEVELOPER},
{"read size", P_INTEGER, P_GLOBAL, &Globals.ReadSize, NULL, NULL, FLAG_DEVELOPER},
{"socket options", P_GSTRING, P_GLOBAL, user_socket_options, NULL, NULL, FLAG_DEVELOPER},
- {"stat cache size", P_INTEGER, P_GLOBAL, &Globals.stat_cache_size, NULL, NULL, FLAG_DEVELOPER},
{"strict allocate", P_BOOL, P_LOCAL, &sDefault.bStrictAllocate, NULL, NULL, FLAG_SHARE},
{"strict sync", P_BOOL, P_LOCAL, &sDefault.bStrictSync, NULL, NULL, FLAG_SHARE},
{"sync always", P_BOOL, P_LOCAL, &sDefault.bSyncAlways, NULL, NULL, FLAG_SHARE},
{"Printing Options", P_SEP, P_SEPARATOR},
- {"total print jobs", P_INTEGER, P_GLOBAL, &Globals.iTotalPrintJobs, NULL, NULL, FLAG_PRINT},
+ {"max reported print jobs", P_INTEGER, P_LOCAL, &sDefault.iMaxReportedPrintJobs, NULL, NULL, FLAG_PRINT},
{"max print jobs", P_INTEGER, P_LOCAL, &sDefault.iMaxPrintJobs, NULL, NULL, FLAG_PRINT},
{"load printers", P_BOOL, P_GLOBAL, &Globals.bLoadPrinters, NULL, NULL, FLAG_PRINT},
{"printcap name", P_STRING, P_GLOBAL, &Globals.szPrintcapname, NULL, NULL, FLAG_PRINT | FLAG_DEVELOPER},
{"enhanced browsing", P_BOOL, P_GLOBAL, &Globals.enhanced_browsing, NULL, NULL, FLAG_DEVELOPER | FLAG_ADVANCED},
{"WINS Options", P_SEP, P_SEPARATOR},
+
{"dns proxy", P_BOOL, P_GLOBAL, &Globals.bDNSproxy, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"wins proxy", P_BOOL, P_GLOBAL, &Globals.bWINSproxy, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"oplock contention limit", P_INTEGER, P_LOCAL, &sDefault.iOplockContentionLimit, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL},
{"posix locking", P_BOOL, P_LOCAL, &sDefault.bPosixLocking, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL},
{"strict locking", P_BOOL, P_LOCAL, &sDefault.bStrictLocking, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL},
- {"share modes", P_BOOL, P_LOCAL, &sDefault.bShareModes, NULL, NULL, FLAG_SHARE|FLAG_GLOBAL},
+ {"share modes", P_BOOL, P_LOCAL, &sDefault.bShareModes, NULL, NULL, FLAG_SHARE | FLAG_GLOBAL},
{"Ldap Options", P_SEP, P_SEPARATOR},
{"ldap port", P_INTEGER, P_GLOBAL, &Globals.ldap_port, NULL, NULL, 0},
#endif
{"ldap suffix", P_STRING, P_GLOBAL, &Globals.szLdapSuffix, handle_ldap_suffix, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"ldap machine suffix", P_STRING, P_GLOBAL, &Globals.szLdapMachineSuffix, handle_ldap_machine_suffix, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"ldap user suffix", P_STRING, P_GLOBAL, &Globals.szLdapUserSuffix, handle_ldap_user_suffix, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"ldap machine suffix", P_STRING, P_GLOBAL, &Globals.szLdapMachineSuffix, handle_ldap_sub_suffix, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"ldap user suffix", P_STRING, P_GLOBAL, &Globals.szLdapUserSuffix, handle_ldap_sub_suffix, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"ldap group suffix", P_STRING, P_GLOBAL, &Globals.szLdapGroupSuffix, handle_ldap_sub_suffix, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"ldap idmap suffix", P_STRING, P_GLOBAL, &Globals.szLdapIdmapSuffix, handle_ldap_sub_suffix, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"ldap filter", P_STRING, P_GLOBAL, &Globals.szLdapFilter, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"ldap admin dn", P_STRING, P_GLOBAL, &Globals.szLdapAdminDn, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"ldap ssl", P_ENUM, P_GLOBAL, &Globals.ldap_ssl, NULL, enum_ldap_ssl, FLAG_ADVANCED | FLAG_DEVELOPER},
{"ldap passwd sync", P_ENUM, P_GLOBAL, &Globals.ldap_passwd_sync, NULL, enum_ldap_passwd_sync, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"ldap trust ids", P_BOOL, P_GLOBAL, &Globals.ldap_trust_ids, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"ldap delete dn", P_BOOL, P_GLOBAL, &Globals.ldap_delete_dn, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"Miscellaneous Options", P_SEP, P_SEPARATOR},
{"add share command", P_STRING, P_GLOBAL, &Globals.szAddShareCommand, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"default", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL, FLAG_DEVELOPER},
{"message command", P_STRING, P_GLOBAL, &Globals.szMsgCommand, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"dfree command", P_STRING, P_GLOBAL, &Globals.szDfree, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"get quota command", P_STRING, P_GLOBAL, &Globals.szGetQuota, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"set quota command", P_STRING, P_GLOBAL, &Globals.szSetQuota, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"remote announce", P_STRING, P_GLOBAL, &Globals.szRemoteAnnounce, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"remote browse sync", P_STRING, P_GLOBAL, &Globals.szRemoteBrowseSync, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"socket address", P_STRING, P_GLOBAL, &Globals.szSocketAddress, NULL, NULL, FLAG_DEVELOPER},
{"hide local users", P_BOOL, P_GLOBAL, &Globals.bHideLocalUsers, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"VFS module options", P_SEP, P_SEPARATOR},
-
- {"vfs object", P_STRING, P_LOCAL, &sDefault.szVfsObjectFile, handle_vfs_object, NULL, FLAG_SHARE},
- {"vfs options", P_STRING, P_LOCAL, &sDefault.szVfsOptions, NULL, NULL, FLAG_SHARE},
- {"vfs path", P_STRING, P_LOCAL, &sDefault.szVfsPath, NULL, NULL, FLAG_SHARE},
+
+ {"vfs objects", P_LIST, P_LOCAL, &sDefault.szVfsObjects, NULL, NULL, FLAG_SHARE},
+ {"vfs object", P_LIST, P_LOCAL, &sDefault.szVfsObjects, NULL, NULL, FLAG_SHARE | FLAG_HIDE},
{"msdfs root", P_BOOL, P_LOCAL, &sDefault.bMSDfsRoot, NULL, NULL, FLAG_SHARE},
+ {"msdfs proxy", P_STRING, P_LOCAL, &sDefault.szMSDfsProxy, NULL, NULL, FLAG_SHARE},
{"host msdfs", P_BOOL, P_GLOBAL, &Globals.bHostMSDfs, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"Winbind options", P_SEP, P_SEPARATOR},
- {"winbind uid", P_STRING, P_GLOBAL, &Globals.szWinbindUID, handle_winbind_uid, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
- {"winbind gid", P_STRING, P_GLOBAL, &Globals.szWinbindGID, handle_winbind_gid, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"enable rid algorithm", P_BOOL, P_GLOBAL, &Globals.bEnableRidAlgorithm, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER | FLAG_DEPRECATED},
+ {"idmap backend", P_STRING, P_GLOBAL, &Globals.szIdmapBackend, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"idmap uid", P_STRING, P_GLOBAL, &Globals.szIdmapUID, handle_idmap_uid, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"winbind uid", P_STRING, P_GLOBAL, &Globals.szIdmapUID, handle_idmap_uid, NULL, FLAG_ADVANCED | FLAG_DEVELOPER },
+ {"idmap gid", P_STRING, P_GLOBAL, &Globals.szIdmapGID, handle_idmap_gid, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"winbind gid", P_STRING, P_GLOBAL, &Globals.szIdmapGID, handle_idmap_gid, NULL, FLAG_ADVANCED | FLAG_DEVELOPER },
+ {"template primary group", P_STRING, P_GLOBAL, &Globals.szTemplatePrimaryGroup, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"template homedir", P_STRING, P_GLOBAL, &Globals.szTemplateHomedir, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"template shell", P_STRING, P_GLOBAL, &Globals.szTemplateShell, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"winbind separator", P_STRING, P_GLOBAL, &Globals.szWinbindSeparator, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"winbind cache time", P_INTEGER, P_GLOBAL, &Globals.winbind_cache_time, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"winbind enable local accounts", P_BOOL, P_GLOBAL, &Globals.bWinbindEnableLocalAccounts, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"winbind enum users", P_BOOL, P_GLOBAL, &Globals.bWinbindEnumUsers, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"winbind enum groups", P_BOOL, P_GLOBAL, &Globals.bWinbindEnumGroups, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{"winbind use default domain", P_BOOL, P_GLOBAL, &Globals.bWinbindUseDefaultDomain, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+ {"winbind trusted domains only", P_BOOL, P_GLOBAL, &Globals.bWinbindTrustedDomainsOnly, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
{NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
};
-
/***************************************************************************
-Initialise the sDefault parameter structure for the printer values.
+ Initialise the sDefault parameter structure for the printer values.
***************************************************************************/
+
static void init_printer_values(void)
{
/* choose defaults depending on the type of printing */
- switch (sDefault.iPrinting)
- {
+ switch (sDefault.iPrinting) {
case PRINT_BSD:
case PRINT_AIX:
case PRINT_LPRNT:
string_set(&sDefault.szPrintcommand, "lp -r -P%p %s");
break;
- case PRINT_SOFTQ:
- string_set(&sDefault.szLpqcommand, "qstat -l -d%p");
- string_set(&sDefault.szLprmcommand,
- "qstat -s -j%j -c");
- string_set(&sDefault.szPrintcommand,
- "lp -d%p -s %s; rm %s");
- string_set(&sDefault.szLppausecommand,
- "qstat -s -j%j -h");
- string_set(&sDefault.szLpresumecommand,
- "qstat -s -j%j -r");
- break;
#ifdef DEVELOPER
case PRINT_TEST:
case PRINT_VLP:
}
/***************************************************************************
-Initialise the global parameter structure.
+ Initialise the global parameter structure.
***************************************************************************/
+
static void init_globals(void)
{
static BOOL done_init = False;
pstring s;
- if (!done_init)
- {
+ if (!done_init) {
int i;
memset((void *)&Globals, '\0', sizeof(Globals));
/* using UTF8 by default allows us to support all chars */
string_set(&Globals.unix_charset, "UTF8");
+#if defined(HAVE_NL_LANGINFO) && defined(CODESET)
+ /* If the system supports nl_langinfo(), try to grab the value
+ from the user's locale */
+ string_set(&Globals.display_charset, "LOCALE");
+#else
+ string_set(&Globals.display_charset, "ASCII");
+#endif
+
/* Use codepage 850 as a default for the dos character set */
string_set(&Globals.dos_charset, "CP850");
* Allow the default PASSWD_CHAT to be overridden in local.h.
*/
string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
- string_set(&Globals.szWorkGroup, WORKGROUP);
+
+ set_global_myname(myhostname());
+ string_set(&Globals.szNetbiosName,global_myname());
+
+ set_global_myworkgroup(WORKGROUP);
+ string_set(&Globals.szWorkgroup, lp_workgroup());
+
string_set(&Globals.szPasswdProgram, "");
string_set(&Globals.szPrintcapname, PRINTCAP_NAME);
string_set(&Globals.szPidDir, dyn_PIDDIR);
string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
string_set(&Globals.szPasswordServer, "*");
- Globals.bAlgorithmicRidBase = BASE_RID;
+ Globals.AlgorithmicRidBase = BASE_RID;
Globals.bLoadPrinters = True;
Globals.mangled_stack = 50;
Globals.paranoid_server_security = True;
Globals.bEncryptPasswords = True;
Globals.bUpdateEncrypt = False;
+ Globals.clientSchannel = Auto;
+ Globals.serverSchannel = Auto;
Globals.bReadRaw = True;
Globals.bWriteRaw = True;
Globals.bReadPrediction = False;
Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
Globals.change_notify_timeout = 60; /* 1 minute default. */
+ Globals.bKernelChangeNotify = True; /* On if we have it. */
Globals.ReadSize = 16 * 1024;
Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
Globals.lm_interval = 60;
- Globals.stat_cache_size = 50; /* Number of stat translations we'll keep */
Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
#if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
Globals.bNISHomeMap = False;
Globals.bNTStatusSupport = True; /* Use NT status by default. */
Globals.bStatCache = True; /* use stat cache by default */
Globals.restrict_anonymous = 0;
+ Globals.bClientLanManAuth = True; /* Do use the LanMan hash if it is available */
+ Globals.bClientPlaintextAuth = True; /* Do use a plaintext password if is requested by the server */
Globals.bLanmanAuth = True; /* Do use the LanMan hash if it is available */
Globals.bNTLMAuth = True; /* Do use NTLMv1 if it is available (otherwise NTLMv2) */
+
Globals.map_to_guest = 0; /* By Default, "Never" */
Globals.min_passwd_length = MINPASSWDLENGTH; /* By Default, 5. */
Globals.oplock_break_wait_time = 0; /* By Default, 0 msecs. */
#ifdef WITH_LDAP_SAMCONFIG
string_set(&Globals.szLdapServer, "localhost");
Globals.ldap_port = 636;
- Globals.szPassdbBackend = str_list_make("ldapsam unixsam", NULL);
+ Globals.szPassdbBackend = str_list_make("ldapsam_compat", NULL);
#else
- Globals.szPassdbBackend = str_list_make("smbpasswd unixsam", NULL);
+ Globals.szPassdbBackend = str_list_make("smbpasswd", NULL);
#endif /* WITH_LDAP_SAMCONFIG */
string_set(&Globals.szLdapSuffix, "");
+ string_set(&Globals.szLdapFilter, "(uid=%u)");
string_set(&Globals.szLdapMachineSuffix, "");
string_set(&Globals.szLdapUserSuffix, "");
+ string_set(&Globals.szLdapGroupSuffix, "");
+ string_set(&Globals.szLdapIdmapSuffix, "");
- string_set(&Globals.szLdapFilter, "(&(uid=%u)(objectclass=sambaAccount))");
string_set(&Globals.szLdapAdminDn, "");
Globals.ldap_ssl = LDAP_SSL_ON;
Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
+ Globals.ldap_delete_dn = False;
/* these parameters are set to defaults that are more appropriate
for the increasing samba install base:
string_set(&Globals.szTemplateShell, "/bin/false");
string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
+ string_set(&Globals.szTemplatePrimaryGroup, "nobody");
string_set(&Globals.szWinbindSeparator, "\\");
string_set(&Globals.szAclCompat, "");
- Globals.winbind_cache_time = 15;
+ Globals.winbind_cache_time = 300; /* 5 minutes */
+ Globals.bWinbindEnableLocalAccounts = True;
Globals.bWinbindEnumUsers = True;
Globals.bWinbindEnumGroups = True;
Globals.bWinbindUseDefaultDomain = False;
+ Globals.bWinbindTrustedDomainsOnly = False;
+
+ Globals.bEnableRidAlgorithm = True;
Globals.name_cache_timeout = 660; /* In seconds */
Globals.bUseSpnego = True;
+ Globals.bClientUseSpnego = True;
string_set(&Globals.smb_ports, SMB_PORTS);
}
static TALLOC_CTX *lp_talloc;
/******************************************************************* a
-free up temporary memory - called from the main loop
+ Free up temporary memory - called from the main loop.
********************************************************************/
+
void lp_talloc_free(void)
{
if (!lp_talloc)
}
/*******************************************************************
-convenience routine to grab string parameters into temporary memory
-and run standard_sub_basic on them. The buffers can be written to by
-callers without affecting the source string.
+ Convenience routine to grab string parameters into temporary memory
+ and run standard_sub_basic on them. The buffers can be written to by
+ callers without affecting the source string.
********************************************************************/
+
static char *lp_string(const char *s)
{
- size_t len = s ? strlen(s) : 0;
- char *ret;
+ char *ret, *tmpstr;
/* The follow debug is useful for tracking down memory problems
especially if you have an inner loop that is calling a lp_*()
#endif
if (!lp_talloc)
- lp_talloc = talloc_init_named("lp_talloc");
-
- ret = (char *)talloc(lp_talloc, len + 100); /* leave room for substitution */
-
- if (!ret)
- return NULL;
+ lp_talloc = talloc_init("lp_talloc");
- if (!s)
- *ret = 0;
- else
- StrnCpy(ret, s, len);
-
- if (trim_string(ret, "\"", "\"")) {
- if (strchr(ret,'"') != NULL)
- StrnCpy(ret, s, len);
+ tmpstr = alloc_sub_basic(current_user_info.smb_name, s);
+ if (trim_string(tmpstr, "\"", "\"")) {
+ if (strchr(tmpstr,'"') != NULL) {
+ SAFE_FREE(tmpstr);
+ tmpstr = alloc_sub_basic(current_user_info.smb_name,s);
+ }
}
-
- standard_sub_basic(current_user_info.smb_name,ret,len+100);
+ ret = talloc_strdup(lp_talloc, tmpstr);
+ SAFE_FREE(tmpstr);
+
return (ret);
}
-
/*
In this section all the functions that are used to access the
parameters from the rest of the program are defined
#define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
#define FN_GLOBAL_LIST(fn_name,ptr) \
- char **fn_name(void) {return(*(char ***)(ptr));}
+ const char **fn_name(void) {return(*(const char ***)(ptr));}
#define FN_GLOBAL_BOOL(fn_name,ptr) \
BOOL fn_name(void) {return(*(BOOL *)(ptr));}
#define FN_GLOBAL_CHAR(fn_name,ptr) \
#define FN_LOCAL_CONST_STRING(fn_name,val) \
const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
#define FN_LOCAL_LIST(fn_name,val) \
- char **fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
+ const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
#define FN_LOCAL_BOOL(fn_name,val) \
BOOL fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
#define FN_LOCAL_CHAR(fn_name,val) \
FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
-#ifdef WITH_UTMP
FN_GLOBAL_STRING(lp_utmpdir, &Globals.szUtmpDir)
FN_GLOBAL_STRING(lp_wtmpdir, &Globals.szWtmpDir)
FN_GLOBAL_BOOL(lp_utmp, &Globals.bUtmp)
-#endif
FN_GLOBAL_STRING(lp_rootdir, &Globals.szRootdir)
FN_GLOBAL_STRING(lp_source_environment, &Globals.szSourceEnv)
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_get_quota_command, &Globals.szGetQuota)
+FN_GLOBAL_STRING(lp_set_quota_command, &Globals.szSetQuota)
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)
FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
-FN_GLOBAL_STRING(lp_workgroup, &Globals.szWorkGroup)
FN_GLOBAL_STRING(lp_realm, &Globals.szRealm)
-FN_GLOBAL_STRING(lp_ads_server, &Globals.szADSserver)
FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap)
FN_GLOBAL_CONST_STRING(lp_logon_script, &Globals.szLogonScript)
FN_GLOBAL_CONST_STRING(lp_logon_path, &Globals.szLogonPath)
static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
FN_GLOBAL_LIST(lp_passdb_backend, &Globals.szPassdbBackend)
-FN_GLOBAL_LIST(lp_sam_backend, &Globals.szSamBackend)
+FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
FN_GLOBAL_STRING(lp_wins_partners, &Globals.szWINSPartners)
+FN_GLOBAL_STRING(lp_template_primary_group, &Globals.szTemplatePrimaryGroup)
FN_GLOBAL_STRING(lp_template_homedir, &Globals.szTemplateHomedir)
FN_GLOBAL_STRING(lp_template_shell, &Globals.szTemplateShell)
-FN_GLOBAL_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
+FN_GLOBAL_CONST_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
FN_GLOBAL_STRING(lp_acl_compatibility, &Globals.szAclCompat)
+FN_GLOBAL_BOOL(lp_winbind_enable_local_accounts, &Globals.bWinbindEnableLocalAccounts)
FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
+FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, &Globals.bWinbindTrustedDomainsOnly)
+
+FN_GLOBAL_STRING(lp_idmap_backend, &Globals.szIdmapBackend)
+FN_GLOBAL_BOOL(lp_enable_rid_algorithm, &Globals.bEnableRidAlgorithm)
#ifdef WITH_LDAP_SAMCONFIG
FN_GLOBAL_STRING(lp_ldap_server, &Globals.szLdapServer)
FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix)
FN_GLOBAL_STRING(lp_ldap_machine_suffix, &Globals.szLdapMachineSuffix)
FN_GLOBAL_STRING(lp_ldap_user_suffix, &Globals.szLdapUserSuffix)
+FN_GLOBAL_STRING(lp_ldap_idmap_suffix, &Globals.szLdapIdmapSuffix)
+FN_GLOBAL_STRING(lp_ldap_group_suffix, &Globals.szLdapGroupSuffix)
FN_GLOBAL_STRING(lp_ldap_filter, &Globals.szLdapFilter)
FN_GLOBAL_STRING(lp_ldap_admin_dn, &Globals.szLdapAdminDn)
FN_GLOBAL_INTEGER(lp_ldap_ssl, &Globals.ldap_ssl)
FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, &Globals.ldap_passwd_sync)
+FN_GLOBAL_BOOL(lp_ldap_trust_ids, &Globals.ldap_trust_ids)
+FN_GLOBAL_BOOL(lp_ldap_delete_dn, &Globals.ldap_delete_dn)
FN_GLOBAL_STRING(lp_add_share_cmd, &Globals.szAddShareCommand)
FN_GLOBAL_STRING(lp_change_share_cmd, &Globals.szChangeShareCommand)
FN_GLOBAL_STRING(lp_delete_share_cmd, &Globals.szDeleteShareCommand)
FN_GLOBAL_BOOL(lp_strip_dot, &Globals.bStripDot)
FN_GLOBAL_BOOL(lp_encrypted_passwords, &Globals.bEncryptPasswords)
FN_GLOBAL_BOOL(lp_update_encrypted, &Globals.bUpdateEncrypt)
+FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
+FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
FN_GLOBAL_INTEGER(lp_restrict_anonymous, &Globals.restrict_anonymous)
FN_GLOBAL_BOOL(lp_lanman_auth, &Globals.bLanmanAuth)
FN_GLOBAL_BOOL(lp_ntlm_auth, &Globals.bNTLMAuth)
+FN_GLOBAL_BOOL(lp_client_plaintext_auth, &Globals.bClientPlaintextAuth)
+FN_GLOBAL_BOOL(lp_client_lanman_auth, &Globals.bClientLanManAuth)
+FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, &Globals.bClientNTLMv2Auth)
FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
FN_GLOBAL_BOOL(lp_unix_extensions, &Globals.bUnixExtensions)
FN_GLOBAL_BOOL(lp_use_spnego, &Globals.bUseSpnego)
+FN_GLOBAL_BOOL(lp_client_use_spnego, &Globals.bClientUseSpnego)
FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups)
+FN_GLOBAL_BOOL(lp_kernel_change_notify, &Globals.bKernelChangeNotify)
FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
FN_GLOBAL_INTEGER(lp_lpqcachetime, &Globals.lpqcachetime)
FN_GLOBAL_INTEGER(lp_max_smbd_processes, &Globals.iMaxSmbdProcesses)
FN_GLOBAL_INTEGER(lp_disable_spoolss, &Globals.bDisableSpoolss)
-FN_GLOBAL_INTEGER(lp_totalprintjobs, &Globals.iTotalPrintJobs)
FN_GLOBAL_INTEGER(lp_syslog, &Globals.syslog)
static FN_GLOBAL_INTEGER(lp_announce_as, &Globals.announce_as)
FN_GLOBAL_INTEGER(lp_lm_announce, &Globals.lm_announce)
FN_GLOBAL_INTEGER(lp_lm_interval, &Globals.lm_interval)
FN_GLOBAL_INTEGER(lp_machine_password_timeout, &Globals.machine_password_timeout)
FN_GLOBAL_INTEGER(lp_change_notify_timeout, &Globals.change_notify_timeout)
-FN_GLOBAL_INTEGER(lp_stat_cache_size, &Globals.stat_cache_size)
FN_GLOBAL_INTEGER(lp_map_to_guest, &Globals.map_to_guest)
FN_GLOBAL_INTEGER(lp_min_passwd_length, &Globals.min_passwd_length)
FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time)
FN_LOCAL_LIST(lp_writelist, writelist)
FN_LOCAL_LIST(lp_printer_admin, printer_admin)
FN_LOCAL_STRING(lp_fstype, fstype)
-FN_LOCAL_STRING(lp_vfsobj, szVfsObjectFile)
-FN_LOCAL_STRING(lp_vfs_options, szVfsOptions)
-FN_LOCAL_STRING(lp_vfs_path, szVfsPath)
+FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects)
+FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
static FN_LOCAL_STRING(lp_volume, volume)
FN_LOCAL_STRING(lp_mangled_map, szMangledMap)
FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport)
FN_LOCAL_BOOL(lp_use_sendfile, bUseSendfile)
FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls)
+FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit)
FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask)
FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode)
FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask)
FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
FN_LOCAL_INTEGER(lp_printing, iPrinting)
+FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
FN_LOCAL_CHAR(lp_magicchar, magic_char)
FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
FN_GLOBAL_BOOL(lp_hide_local_users, &Globals.bHideLocalUsers)
-FN_GLOBAL_BOOL(lp_algorithmic_rid_base, &Globals.bAlgorithmicRidBase)
+FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
-
-typedef struct _param_opt_struct param_opt_struct;
-struct _param_opt_struct {
- char *key;
- char *value;
- param_opt_struct *prev, *next;
-};
-
-static param_opt_struct *param_opt = NULL;
-
-/* Return parametric option from given service. Type is a part of option before ':' */
-/* Parametric option has following syntax: 'Type: option = value' */
-/* Returned value is allocated in 'lp_talloc' context */
-char *lp_parm_string(const char *servicename, const char *type, const char *option)
-{
- param_opt_struct *data;
- pstring vfskey;
-
- if (param_opt != NULL) {
- ZERO_STRUCT(vfskey);
- pstr_sprintf(vfskey, "%s:%s:%s", (servicename==NULL) ? "global" : servicename,
- type, option);
- data = param_opt;
- while (data) {
- if (strcmp(data->key, vfskey) == 0) {
- return lp_string(data->value);
- }
- data = data->next;
- }
- /* Try to fetch the same option but from globals */
- pstr_sprintf(vfskey, "global:%s:%s", type, option);
- data = param_opt;
- while (data) {
- if (strcmp(data->key, vfskey) == 0) {
- return lp_string(data->value);
- }
- data = data->next;
- }
-
- }
- return NULL;
-}
+FN_GLOBAL_BOOL(lp_client_signing, &Globals.client_signing)
/* local prototypes */
-static int map_parameter(char *pszParmName);
-static BOOL set_boolean(BOOL *pb, char *pszParmValue);
+static int map_parameter(const char *pszParmName);
+static BOOL set_boolean(BOOL *pb, const char *pszParmValue);
static int getservicebyname(const 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 BOOL do_parameter(const char *pszParmName, const char *pszParmValue);
+static BOOL do_section(const char *pszSectionName);
static void init_copymap(service * pservice);
+/* This is a helper function for parametrical options support. */
+/* It returns a pointer to parametrical option value if it exists or NULL otherwise */
+/* Actual parametrical functions are quite simple */
+static param_opt_struct *get_parametrics(int snum, const char *type, const char *option)
+{
+ BOOL global_section = False;
+ char* param_key;
+ param_opt_struct *data;
+
+ if (snum >= iNumServices) return NULL;
+
+ if (snum < 0) {
+ data = Globals.param_opt;
+ global_section = True;
+ } else {
+ data = ServicePtrs[snum]->param_opt;
+ }
+
+ asprintf(¶m_key, "%s:%s", type, option);
+ if (!param_key) {
+ DEBUG(0,("asprintf failed!\n"));
+ return NULL;
+ }
+
+ while (data) {
+ if (strcmp(data->key, param_key) == 0) {
+ string_free(¶m_key);
+ return data;
+ }
+ data = data->next;
+ }
+
+ if (!global_section) {
+ /* Try to fetch the same option but from globals */
+ /* but only if we are not already working with Globals */
+ data = Globals.param_opt;
+ while (data) {
+ if (strcmp(data->key, param_key) == 0) {
+ string_free(¶m_key);
+ return data;
+ }
+ data = data->next;
+ }
+ }
+
+ string_free(¶m_key);
+
+ return NULL;
+}
+
+
+/*******************************************************************
+convenience routine to return int parameters.
+********************************************************************/
+static int lp_int(const char *s)
+{
+
+ if (!s) {
+ DEBUG(0,("lp_int(%s): is called with NULL!\n",s));
+ return (-1);
+ }
+
+ return atoi(s);
+}
+
+/*******************************************************************
+convenience routine to return unsigned long parameters.
+********************************************************************/
+static int lp_ulong(const char *s)
+{
+
+ if (!s) {
+ DEBUG(0,("lp_int(%s): is called with NULL!\n",s));
+ return (-1);
+ }
+
+ return strtoul(s, NULL, 10);
+}
+
+/*******************************************************************
+convenience routine to return boolean parameters.
+********************************************************************/
+static BOOL lp_bool(const char *s)
+{
+ BOOL ret = False;
+
+ if (!s) {
+ DEBUG(0,("lp_bool(%s): is called with NULL!\n",s));
+ return False;
+ }
+
+ if (!set_boolean(&ret,s)) {
+ DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
+ return False;
+ }
+
+ return ret;
+}
+
+/*******************************************************************
+convenience routine to return enum parameters.
+********************************************************************/
+static int lp_enum(const char *s,const struct enum_list *_enum)
+{
+ int i;
+
+ if (!s || !_enum) {
+ DEBUG(0,("lp_enum(%s,enum): is called with NULL!\n",s));
+ return (-1);
+ }
+
+ for (i=0; _enum[i].name; i++) {
+ if (strcasecmp(_enum[i].name,s)==0)
+ return _enum[i].value;
+ }
+
+ DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
+ return (-1);
+}
+
+
+/* DO NOT USE lp_parm_string ANYMORE!!!!
+ * use lp_parm_const_string or lp_parm_talloc_string
+ *
+ * lp_parm_string is only used to let old modules find this symbol
+ */
+#undef lp_parm_string
+ char *lp_parm_string(const char *servicename, const char *type, const char *option)
+{
+ return lp_parm_talloc_string(lp_servicenumber(servicename), type, option, NULL);
+}
+
+/* Return parametric option from a given service. Type is a part of option before ':' */
+/* Parametric option has following syntax: 'Type: option = value' */
+/* the returned value is talloced in lp_talloc */
+char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def)
+{
+ param_opt_struct *data = get_parametrics(snum, type, option);
+
+ if (data == NULL||data->value==NULL) {
+ if (def) {
+ return lp_string(def);
+ } else {
+ return NULL;
+ }
+ }
+
+ return lp_string(data->value);
+}
+
+/* Return parametric option from a given service. Type is a part of option before ':' */
+/* Parametric option has following syntax: 'Type: option = value' */
+const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
+{
+ param_opt_struct *data = get_parametrics(snum, type, option);
+
+ if (data == NULL||data->value==NULL)
+ return def;
+
+ return data->value;
+}
+
+/* Return parametric option from a given service. Type is a part of option before ':' */
+/* Parametric option has following syntax: 'Type: option = value' */
+
+const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
+{
+ param_opt_struct *data = get_parametrics(snum, type, option);
+
+ if (data == NULL||data->value==NULL)
+ return (const char **)def;
+
+ if (data->list==NULL) {
+ data->list = str_list_make(data->value, NULL);
+ }
+
+ return (const char **)data->list;
+}
+
+/* Return parametric option from a given service. Type is a part of option before ':' */
+/* Parametric option has following syntax: 'Type: option = value' */
+
+int lp_parm_int(int snum, const char *type, const char *option, int def)
+{
+ param_opt_struct *data = get_parametrics(snum, type, option);
+
+ if (data && data->value && *data->value)
+ return lp_int(data->value);
+
+ return def;
+}
+
+/* Return parametric option from a given service. Type is a part of option before ':' */
+/* Parametric option has following syntax: 'Type: option = value' */
+
+unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
+{
+ param_opt_struct *data = get_parametrics(snum, type, option);
+
+ if (data && data->value && *data->value)
+ return lp_ulong(data->value);
+
+ return def;
+}
+
+/* Return parametric option from a given service. Type is a part of option before ':' */
+/* Parametric option has following syntax: 'Type: option = value' */
+
+BOOL lp_parm_bool(int snum, const char *type, const char *option, BOOL def)
+{
+ param_opt_struct *data = get_parametrics(snum, type, option);
+
+ if (data && data->value && *data->value)
+ return lp_bool(data->value);
+
+ return def;
+}
+
+/* Return parametric option from a given service. Type is a part of option before ':' */
+/* Parametric option has following syntax: 'Type: option = value' */
+
+int lp_parm_enum(int snum, const char *type, const char *option,
+ const struct enum_list *_enum, int def)
+{
+ param_opt_struct *data = get_parametrics(snum, type, option);
+
+ if (data && data->value && *data->value && _enum)
+ return lp_enum(data->value, _enum);
+
+ return def;
+}
+
/***************************************************************************
-initialise a service to the defaults
+ Initialise a service to the defaults.
***************************************************************************/
+
static void init_service(service * pservice)
{
memset((char *)pservice, '\0', sizeof(service));
copy_service(pservice, &sDefault, NULL);
}
-
/***************************************************************************
-free the dynamically allocated parts of a service struct
+ Free the dynamically allocated parts of a service struct.
***************************************************************************/
-static void free_service(service * pservice)
+
+static void free_service(service *pservice)
{
int i;
+ param_opt_struct *data, *pdata;
if (!pservice)
return;
if (pservice->szService)
- DEBUG(5,
- ("free_service: Freeing service %s\n",
+ DEBUG(5, ("free_service: Freeing service %s\n",
pservice->szService));
string_free(&pservice->szService);
SAFE_FREE(pservice->copymap);
- for (i = 0; parm_table[i].label; i++)
- {
+ for (i = 0; parm_table[i].label; i++) {
if ((parm_table[i].type == P_STRING ||
parm_table[i].type == P_USTRING) &&
parm_table[i].class == P_LOCAL)
(((char *)pservice) +
PTR_DIFF(parm_table[i].ptr, &sDefault)));
}
-
+
+ data = pservice->param_opt;
+ if (data)
+ DEBUG(5,("Freeing parametrics:\n"));
+ while (data) {
+ DEBUG(5,("[%s = %s]\n", data->key, data->value));
+ string_free(&data->key);
+ string_free(&data->value);
+ str_list_free(&data->list);
+ pdata = data->next;
+ SAFE_FREE(data);
+ data = pdata;
+ }
ZERO_STRUCTP(pservice);
}
/***************************************************************************
-add a new service to the services array initialising it with the given
-service.
+ Add a new service to the services array initialising it with the given
+ service.
***************************************************************************/
-static int add_a_service(const service * pservice, const char *name)
+
+static int add_a_service(const service *pservice, const char *name)
{
int i;
service tservice;
int num_to_alloc = iNumServices + 1;
+ param_opt_struct *data, *pdata;
tservice = *pservice;
/* it might already exist */
- if (name)
- {
+ if (name) {
i = getservicebyname(name, NULL);
- if (i >= 0)
+ if (i >= 0) {
+ /* Clean all parametric options for service */
+ /* They will be added during parsing again */
+ data = ServicePtrs[i]->param_opt;
+ while (data) {
+ string_free(&data->key);
+ string_free(&data->value);
+ str_list_free(&data->list);
+ pdata = data->next;
+ SAFE_FREE(data);
+ data = pdata;
+ }
+ ServicePtrs[i]->param_opt = NULL;
return (i);
+ }
}
/* find an invalid one */
break;
/* if not, then create one */
- if (i == iNumServices)
- {
+ if (i == iNumServices) {
service **tsp;
tsp = (service **) Realloc(ServicePtrs,
}
iNumServices++;
- }
- else
+ } else
free_service(ServicePtrs[i]);
ServicePtrs[i]->valid = True;
init_service(ServicePtrs[i]);
copy_service(ServicePtrs[i], &tservice, NULL);
if (name)
- {
string_set(&ServicePtrs[i]->szService, name);
- }
return (i);
}
/***************************************************************************
-add a new home service, with the specified home directory, defaults coming
-from service ifrom.
+ Add a new home service, with the specified home directory, defaults coming
+ from service ifrom.
***************************************************************************/
+
BOOL lp_add_home(const char *pszHomename, int iDefaultService,
const char *user, const char *pszHomedir)
{
return (False);
if (!(*(ServicePtrs[iDefaultService]->szPath))
- || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(-1))) {
+ || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
pstrcpy(newHomedir, pszHomedir);
} else {
pstrcpy(newHomedir, lp_pathname(iDefaultService));
string_sub(newHomedir,"%H", pszHomedir, sizeof(newHomedir));
+ string_sub(newHomedir,"%S", pszHomename, sizeof(newHomedir));
}
string_set(&ServicePtrs[i]->szPath, newHomedir);
- if (!(*(ServicePtrs[i]->comment)))
- {
+ if (!(*(ServicePtrs[i]->comment))) {
pstring comment;
slprintf(comment, sizeof(comment) - 1,
"Home directory of %s", user);
ServicePtrs[i]->bAvailable = sDefault.bAvailable;
ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
- DEBUG(3,
- ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
+ DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
user, newHomedir));
return (True);
}
/***************************************************************************
-add a new service, based on an old one.
+ Add a new service, based on an old one.
***************************************************************************/
+
int lp_add_service(const char *pszService, int iDefaultService)
{
return (add_a_service(ServicePtrs[iDefaultService], pszService));
}
-
/***************************************************************************
-add the IPC service
+ Add the IPC service.
***************************************************************************/
-static BOOL lp_add_ipc(char *ipc_name, BOOL guest_ok)
+
+static BOOL lp_add_ipc(const char *ipc_name, BOOL guest_ok)
{
pstring comment;
int i = add_a_service(&sDefault, ipc_name);
}
/***************************************************************************
-add a new printer service, with defaults coming from service iFrom.
+ Add a new printer service, with defaults coming from service iFrom.
***************************************************************************/
+
BOOL lp_add_printer(const char *pszPrintername, int iDefaultService)
{
const char *comment = "From Printcap";
}
/***************************************************************************
-Map a parameter's string representation to something we can use.
-Returns False if the parameter string is not recognised, else TRUE.
+ 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)
+
+static int map_parameter(const char *pszParmName)
{
int iIndex;
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.
+ 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)
+
+static BOOL set_boolean(BOOL *pb, const char *pszParmValue)
{
BOOL bRetval;
strwicmp(pszParmValue, "true") == 0 ||
strwicmp(pszParmValue, "1") == 0)
*pb = True;
- else
- if (strwicmp(pszParmValue, "no") == 0 ||
+ else if (strwicmp(pszParmValue, "no") == 0 ||
strwicmp(pszParmValue, "False") == 0 ||
strwicmp(pszParmValue, "0") == 0)
*pb = False;
- else
- {
+ else {
DEBUG(0,
("ERROR: Badly formed boolean in configuration file: \"%s\".\n",
pszParmValue));
/***************************************************************************
Find a service by name. Otherwise works like get_service.
***************************************************************************/
+
static int getservicebyname(const char *pszServiceName, service * pserviceDest)
{
int iService;
for (iService = iNumServices - 1; iService >= 0; iService--)
if (VALID(iService) &&
- strwicmp(ServicePtrs[iService]->szService, pszServiceName) == 0)
- {
+ strwicmp(ServicePtrs[iService]->szService, pszServiceName) == 0) {
if (pserviceDest != NULL)
copy_service(pserviceDest, ServicePtrs[iService], NULL);
break;
return (iService);
}
-
-
/***************************************************************************
-Copy a service structure to another
-
-If pcopymapDest is NULL then copy all fields
+ Copy a service structure to another.
+ If pcopymapDest is NULL then copy all fields
***************************************************************************/
-static void copy_service(service * pserviceDest,
- service * pserviceSource, BOOL *pcopymapDest)
+
+static void copy_service(service * pserviceDest, service * pserviceSource, BOOL *pcopymapDest)
{
int i;
BOOL bcopyall = (pcopymapDest == NULL);
+ param_opt_struct *data, *pdata, *paramo;
+ BOOL not_added;
for (i = 0; parm_table[i].label; i++)
if (parm_table[i].ptr && parm_table[i].class == P_LOCAL &&
- (bcopyall || pcopymapDest[i]))
- {
+ (bcopyall || pcopymapDest[i])) {
void *def_ptr = parm_table[i].ptr;
void *src_ptr =
((char *)pserviceSource) + PTR_DIFF(def_ptr,
((char *)pserviceDest) + PTR_DIFF(def_ptr,
&sDefault);
- switch (parm_table[i].type)
- {
+ switch (parm_table[i].type) {
case P_BOOL:
case P_BOOLREV:
*(BOOL *)dest_ptr = *(BOOL *)src_ptr;
case P_USTRING:
string_set(dest_ptr,
*(char **)src_ptr);
- strupper(*(char **)dest_ptr);
+ strupper_m(*(char **)dest_ptr);
break;
case P_LIST:
- str_list_copy((char ***)dest_ptr, *(char ***)src_ptr);
+ str_list_copy((char ***)dest_ptr, *(const char ***)src_ptr);
break;
default:
break;
}
}
- if (bcopyall)
- {
+ if (bcopyall) {
init_copymap(pserviceDest);
if (pserviceSource->copymap)
memcpy((void *)pserviceDest->copymap,
(void *)pserviceSource->copymap,
sizeof(BOOL) * NUMPARAMETERS);
}
+
+ data = pserviceSource->param_opt;
+ while (data) {
+ not_added = True;
+ pdata = pserviceDest->param_opt;
+ /* Traverse destination */
+ while (pdata) {
+ /* If we already have same option, override it */
+ if (strcmp(pdata->key, data->key) == 0) {
+ string_free(&pdata->value);
+ str_list_free(&data->list);
+ pdata->value = strdup(data->value);
+ not_added = False;
+ break;
+ }
+ pdata = pdata->next;
+ }
+ if (not_added) {
+ paramo = smb_xmalloc(sizeof(param_opt_struct));
+ paramo->key = strdup(data->key);
+ paramo->value = strdup(data->value);
+ paramo->list = NULL;
+ DLIST_ADD(pserviceDest->param_opt, paramo);
+ }
+ data = data->next;
+ }
}
/***************************************************************************
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 (ServicePtrs[iService]->szService[0] == '\0')
- {
- DEBUG(0,
- ("The following message indicates an internal error:\n"));
+ if (ServicePtrs[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;
}
/* I can't see why you'd want a non-printable printer service... */
if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
if (!ServicePtrs[iService]->bPrint_ok) {
- DEBUG(0,
- ("WARNING: [%s] service MUST be printable!\n",
+ DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
ServicePtrs[iService]->szService));
ServicePtrs[iService]->bPrint_ok = True;
}
}
if (ServicePtrs[iService]->szPath[0] == '\0' &&
- strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0)
- {
- DEBUG(0,
- ("No path in service %s - using %s\n",
+ strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0) {
+ DEBUG(0, ("No path in service %s - using %s\n",
ServicePtrs[iService]->szService, tmpdir()));
string_set(&ServicePtrs[iService]->szPath, tmpdir());
}
return (bRetval);
}
-static struct file_lists
-{
+static struct file_lists {
struct file_lists *next;
char *name;
char *subfname;
time_t modtime;
-}
- *file_lists = NULL;
+} *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
+ 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(const char *fname, const char *subfname)
{
struct file_lists *f = file_lists;
- while (f)
- {
+ while (f) {
if (f->name && !strcmp(f->name, fname))
break;
f = f->next;
}
- if (!f)
- {
+ 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)
- {
+ if (!f->name) {
SAFE_FREE(f);
return;
}
f->subfname = strdup(subfname);
- if (!f->subfname)
- {
+ if (!f->subfname) {
SAFE_FREE(f);
return;
}
}
/*******************************************************************
-check if a config file has changed date
+ Check if a config file has changed date.
********************************************************************/
+
BOOL lp_file_list_changed(void)
{
struct file_lists *f = file_lists;
Note: We must *NOT* use string_set() here as ptr points to global_myname.
***************************************************************************/
-static BOOL handle_netbios_name(char *pszParmValue, char **ptr)
+static BOOL handle_netbios_name(const char *pszParmValue, char **ptr)
{
+ BOOL ret;
pstring netbios_name;
pstrcpy(netbios_name, pszParmValue);
standard_sub_basic(current_user_info.smb_name, netbios_name,sizeof(netbios_name));
- strupper(netbios_name);
- pstrcpy(global_myname, netbios_name);
- DEBUG(4,
- ("handle_netbios_name: set global_myname to: %s\n",
- global_myname));
+ ret = set_global_myname(netbios_name);
+ string_set(&Globals.szNetbiosName,global_myname());
+
+ DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
+ global_myname()));
- return (True);
+ return ret;
+}
+
+static BOOL handle_workgroup(const char *pszParmValue, char **ptr)
+{
+ BOOL ret;
+
+ ret = set_global_myworkgroup(pszParmValue);
+ string_set(&Globals.szWorkgroup,lp_workgroup());
+
+ return ret;
+}
+
+static BOOL handle_netbios_scope(const char *pszParmValue, char **ptr)
+{
+ BOOL ret;
+
+ ret = set_global_scope(pszParmValue);
+ string_set(&Globals.szNetbiosScope,global_scope());
+
+ return ret;
+}
+
+static BOOL handle_netbios_aliases(const char *pszParmValue, char **ptr)
+{
+ Globals.szNetbiosAliases = str_list_make(pszParmValue, NULL);
+ return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
}
/***************************************************************************
int i;
char *p;
- for (i = 0; lines[i]; i++)
- {
+ for (i = 0; lines[i]; i++) {
char *line = lines[i];
if ((len = strlen(line)) == 0)
if (line[len - 1] == '\n')
line[--len] = '\0';
- if ((varval = malloc(len + 1)) == NULL)
- {
+ if ((varval = malloc(len + 1)) == NULL) {
DEBUG(0, ("source_env: Not enough memory!\n"));
return (False);
}
varval[len] = '\0';
p = strchr_m(line, (int)'=');
- if (p == NULL)
- {
+ if (p == NULL) {
DEBUG(4, ("source_env: missing '=': %s\n", line));
continue;
}
- if (putenv(varval))
- {
- DEBUG(0,
- ("source_env: Failed to put environment variable %s\n",
+ if (putenv(varval)) {
+ DEBUG(0, ("source_env: Failed to put environment variable %s\n",
varval));
continue;
}
*p = '\0';
p++;
- DEBUG(4,
- ("source_env: getting var %s = %s\n", line,
- getenv(line)));
+ DEBUG(4, ("source_env: getting var %s = %s\n", line, getenv(line)));
}
DEBUG(4, ("source_env: returning successfully\n"));
}
/***************************************************************************
- Handle the source environment operation
+ Handle the source environment operation.
***************************************************************************/
-static BOOL handle_source_env(char *pszParmValue, char **ptr)
+static BOOL handle_source_env(const char *pszParmValue, char **ptr)
{
pstring fname;
char *p = fname;
*/
if (*p == '|')
- {
lines = file_lines_pload(p + 1, NULL);
- }
else
- {
lines = file_lines_load(fname, NULL);
- }
- if (!lines)
- {
- DEBUG(0,
- ("handle_source_env: Failed to open file %s, Error was %s\n",
+ if (!lines) {
+ DEBUG(0, ("handle_source_env: Failed to open file %s, Error was %s\n",
fname, strerror(errno)));
return (False);
}
}
/***************************************************************************
- handle the interpretation of the vfs object parameter
- *************************************************************************/
-static BOOL handle_vfs_object(char *pszParmValue, char **ptr)
-{
- /* Set string value */
-
- string_set(ptr, pszParmValue);
-
- /* Do any other initialisation required for vfs. Note that
- anything done here may have linking repercussions in nmbd. */
-
- return True;
-}
-
-
-/***************************************************************************
-handle the include operation
+ Handle the include operation.
***************************************************************************/
-static BOOL handle_include(char *pszParmValue, char **ptr)
+static BOOL handle_include(const char *pszParmValue, char **ptr)
{
pstring fname;
pstrcpy(fname, pszParmValue);
return (False);
}
-
/***************************************************************************
-handle the interpretation of the copy parameter
+ Handle the interpretation of the copy parameter.
***************************************************************************/
-static BOOL handle_copy(char *pszParmValue, char **ptr)
+
+static BOOL handle_copy(const char *pszParmValue, char **ptr)
{
BOOL bRetval;
int iTemp;
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
- {
+ 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(ServicePtrs[iServiceIndex],
&serviceTemp,
ServicePtrs[iServiceIndex]->copymap);
bRetval = True;
}
- }
- else
- {
- DEBUG(0, ("Unable to copy service - source not found: %s\n",
- pszParmValue));
+ } else {
+ DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
bRetval = False;
}
}
/***************************************************************************
- Handle winbind/non unix account uid and gid allocation parameters. The format of these
+ Handle idmap/non unix account uid and gid allocation parameters. The format of these
parameters is:
[global]
- winbind uid = 1000-1999
- winbind gid = 700-899
+ idmap uid = 1000-1999
+ idmap gid = 700-899
We only do simple parsing checks here. The strings are parsed into useful
- structures in the winbind daemon code.
+ structures in the idmap daemon code.
***************************************************************************/
-/* Some lp_ routines to return winbind [ug]id information */
-
-static uid_t winbind_uid_low, winbind_uid_high;
-static gid_t winbind_gid_low, winbind_gid_high;
-static uint32 non_unix_account_low, non_unix_account_high;
-
-BOOL lp_winbind_uid(uid_t *low, uid_t *high)
-{
- if (winbind_uid_low == 0 || winbind_uid_high == 0)
- return False;
-
- if (low)
- *low = winbind_uid_low;
+/* Some lp_ routines to return idmap [ug]id information */
- if (high)
- *high = winbind_uid_high;
+static uid_t idmap_uid_low, idmap_uid_high;
+static gid_t idmap_gid_low, idmap_gid_high;
- return True;
-}
-
-BOOL lp_winbind_gid(gid_t *low, gid_t *high)
+BOOL lp_idmap_uid(uid_t *low, uid_t *high)
{
- if (winbind_gid_low == 0 || winbind_gid_high == 0)
+ if (idmap_uid_low == 0 || idmap_uid_high == 0)
return False;
if (low)
- *low = winbind_gid_low;
+ *low = idmap_uid_low;
if (high)
- *high = winbind_gid_high;
+ *high = idmap_uid_high;
return True;
}
-BOOL lp_non_unix_account_range(uint32 *low, uint32 *high)
+BOOL lp_idmap_gid(gid_t *low, gid_t *high)
{
- if (non_unix_account_low == 0 || non_unix_account_high == 0)
+ if (idmap_gid_low == 0 || idmap_gid_high == 0)
return False;
if (low)
- *low = non_unix_account_low;
+ *low = idmap_gid_low;
if (high)
- *high = non_unix_account_high;
+ *high = idmap_gid_high;
return True;
}
-/* Do some simple checks on "winbind [ug]id" parameter values */
-
-static BOOL handle_winbind_uid(char *pszParmValue, char **ptr)
-{
- uint32 low, high;
-
- if (sscanf(pszParmValue, "%u-%u", &low, &high) != 2 || high < low)
- return False;
-
- /* Parse OK */
-
- string_set(ptr, pszParmValue);
-
- winbind_uid_low = low;
- winbind_uid_high = high;
+/* Do some simple checks on "idmap [ug]id" parameter values */
- return True;
-}
-
-static BOOL handle_winbind_gid(char *pszParmValue, char **ptr)
+static BOOL handle_idmap_uid(const char *pszParmValue, char **ptr)
{
uint32 low, high;
string_set(ptr, pszParmValue);
- winbind_gid_low = low;
- winbind_gid_high = high;
+ idmap_uid_low = low;
+ idmap_uid_high = high;
return True;
}
-/* Do some simple checks on "non unix account range" parameter values */
-
-static BOOL handle_non_unix_account_range(char *pszParmValue, char **ptr)
+static BOOL handle_idmap_gid(const char *pszParmValue, char **ptr)
{
uint32 low, high;
string_set(ptr, pszParmValue);
- non_unix_account_low = low;
- non_unix_account_high = high;
+ idmap_gid_low = low;
+ idmap_gid_high = high;
return True;
}
/***************************************************************************
- Handle the DEBUG level list
+ Handle the DEBUG level list.
***************************************************************************/
-static BOOL handle_debug_list( char *pszParmValueIn, char **ptr )
+
+static BOOL handle_debug_list( const char *pszParmValueIn, char **ptr )
{
pstring pszParmValue;
}
/***************************************************************************
- Handle the ldap machine suffix option
+ Handle setting ldap suffix and determines whether ldap machine suffix needs
+ to be set as well.
+
+ Set all of the sub suffix strings to be the 'ldap suffix' by default
***************************************************************************/
-static BOOL handle_ldap_machine_suffix( char *pszParmValue, char **ptr)
-{
- pstring suffix;
-
- pstrcpy(suffix, pszParmValue);
- if (! *Globals.szLdapSuffix ) {
- string_set( ptr, suffix );
- return True;
- }
+static BOOL handle_ldap_suffix( const char *pszParmValue, char **ptr )
+{
+ pstring suffix;
+
+ pstrcpy(suffix, pszParmValue);
- if (! strstr(suffix, Globals.szLdapSuffix) ) {
- if ( *pszParmValue )
- pstrcat(suffix, ",");
- pstrcat(suffix, Globals.szLdapSuffix);
- }
- string_set( ptr, suffix );
- return True;
+ /* set defaults for the the sub-suffixes */
+
+ if (! *Globals.szLdapMachineSuffix )
+ string_set(&Globals.szLdapMachineSuffix, suffix);
+ if (! *Globals.szLdapUserSuffix )
+ string_set(&Globals.szLdapUserSuffix, suffix);
+ if (! *Globals.szLdapGroupSuffix )
+ string_set(&Globals.szLdapGroupSuffix, suffix);
+ if (! *Globals.szLdapIdmapSuffix )
+ string_set(&Globals.szLdapIdmapSuffix, suffix);
+
+ string_set(ptr, suffix);
+ return True;
}
/***************************************************************************
- Handle the ldap user suffix option
+ Handle the ldap sub suffix option.
+ Always append the 'ldap suffix' if it is set
***************************************************************************/
-static BOOL handle_ldap_user_suffix( char *pszParmValue, char **ptr)
+
+static BOOL handle_ldap_sub_suffix( const char *pszParmValue, char **ptr)
{
- pstring suffix;
+ pstring suffix;
- pstrcpy(suffix, pszParmValue);
+ pstrcpy(suffix, pszParmValue);
- if (! *Globals.szLdapSuffix ) {
- string_set( ptr, suffix );
- return True;
- }
-
- if (! strstr(suffix, Globals.szLdapSuffix) ) {
- if ( *pszParmValue )
- pstrcat(suffix, ",");
- pstrcat(suffix, Globals.szLdapSuffix);
- }
- string_set( ptr, suffix );
- return True;
+ if (! *Globals.szLdapSuffix ) {
+ string_set( ptr, suffix );
+ return True;
+ }
+ else {
+ if ( *pszParmValue )
+ pstrcat(suffix, ",");
+ pstrcat(suffix, Globals.szLdapSuffix);
+ }
+
+ string_set( ptr, suffix );
+ return True;
}
/***************************************************************************
- Handle setting ldap suffix and determines whether ldap machine suffix needs
- to be set as well
***************************************************************************/
-static BOOL handle_ldap_suffix( char *pszParmValue, char **ptr)
-{
- pstring suffix;
- pstring user_suffix;
- pstring machine_suffix;
-
- pstrcpy(suffix, pszParmValue);
-
- if (! *Globals.szLdapMachineSuffix )
- string_set(&Globals.szLdapMachineSuffix, suffix);
- if (! *Globals.szLdapUserSuffix )
- string_set(&Globals.szLdapUserSuffix, suffix);
-
- if (! strstr(Globals.szLdapMachineSuffix, suffix)) {
- pstrcpy(machine_suffix, Globals.szLdapMachineSuffix);
- if ( *Globals.szLdapMachineSuffix )
- pstrcat(machine_suffix, ",");
- pstrcat(machine_suffix, suffix);
- string_set(&Globals.szLdapMachineSuffix, machine_suffix);
- }
-
- if (! strstr(Globals.szLdapUserSuffix, suffix)) {
- pstrcpy(user_suffix, Globals.szLdapUserSuffix);
- if ( *Globals.szLdapUserSuffix )
- pstrcat(user_suffix, ",");
- pstrcat(user_suffix, suffix);
- string_set(&Globals.szLdapUserSuffix, user_suffix);
- }
- string_set(ptr, suffix);
- return True;
-}
-
-static BOOL handle_acl_compatibility(char *pszParmValue, char **ptr)
+static BOOL handle_acl_compatibility(const char *pszParmValue, char **ptr)
{
if (strequal(pszParmValue, "auto"))
string_set(ptr, "");
return True;
}
+
/***************************************************************************
-initialise a copymap
+ Initialise a copymap.
***************************************************************************/
+
static void init_copymap(service * pservice)
{
int i;
pservice->copymap[i] = True;
}
-
/***************************************************************************
- return the local pointer to a parameter given the service number and the
- pointer into the default structure
+ 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 *)ServicePtrs[snum]) + PTR_DIFF(ptr, &sDefault));
}
/***************************************************************************
-Process a parameter for a particular service number. If snum < 0
-then assume we are in the globals
+ Process a parameter for a particular service number. If snum < 0
+ then assume we are in the globals.
***************************************************************************/
-BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue)
+
+BOOL lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
{
int parmnum, i, slen;
void *parm_ptr = NULL; /* where we are going to store the result */
void *def_ptr = NULL;
- pstring vfskey;
+ pstring param_key;
char *sep;
- param_opt_struct *paramo;
+ param_opt_struct *paramo, *data;
+ BOOL not_added;
parmnum = map_parameter(pszParmName);
- if (parmnum < 0)
- {
+ if (parmnum < 0) {
if ((sep=strchr(pszParmName, ':')) != NULL) {
- *sep = 0;
- ZERO_STRUCT(vfskey);
- pstr_sprintf(vfskey, "%s:%s:",
- (snum >= 0) ? lp_servicename(snum) : "global", pszParmName);
- slen = strlen(vfskey);
- safe_strcat(vfskey, sep+1, sizeof(pstring));
- trim_string(vfskey+slen, " ", " ");
- paramo = smb_xmalloc(sizeof(param_opt_struct));
- paramo->key = strdup(vfskey);
- paramo->value = strdup(pszParmValue);
- DLIST_ADD(param_opt, paramo);
+ *sep = '\0';
+ ZERO_STRUCT(param_key);
+ pstr_sprintf(param_key, "%s:", pszParmName);
+ slen = strlen(param_key);
+ pstrcat(param_key, sep+1);
+ trim_string(param_key+slen, " ", " ");
+ not_added = True;
+ data = (snum < 0) ? Globals.param_opt :
+ ServicePtrs[snum]->param_opt;
+ /* Traverse destination */
+ while (data) {
+ /* If we already have same option, override it */
+ if (strcmp(data->key, param_key) == 0) {
+ string_free(&data->value);
+ str_list_free(&data->list);
+ data->value = strdup(pszParmValue);
+ not_added = False;
+ break;
+ }
+ data = data->next;
+ }
+ if (not_added) {
+ paramo = smb_xmalloc(sizeof(param_opt_struct));
+ paramo->key = strdup(param_key);
+ paramo->value = strdup(pszParmValue);
+ paramo->list = NULL;
+ if (snum < 0) {
+ DLIST_ADD(Globals.param_opt, paramo);
+ } else {
+ DLIST_ADD(ServicePtrs[snum]->param_opt, paramo);
+ }
+ }
+
*sep = ':';
return (True);
}
- DEBUG(0,
- ("Ignoring unknown parameter \"%s\"\n", pszParmName));
+ DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName));
return (True);
}
- if (parm_table[parmnum].flags & FLAG_DEPRECATED)
- {
+ if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
pszParmName));
}
def_ptr = parm_table[parmnum].ptr;
/* we might point at a service, the default service or a global */
- if (snum < 0)
- {
+ if (snum < 0) {
parm_ptr = def_ptr;
- }
- else
- {
- if (parm_table[parmnum].class == P_GLOBAL)
- {
+ } else {
+ if (parm_table[parmnum].class == P_GLOBAL) {
DEBUG(0,
("Global parameter %s found in service section!\n",
pszParmName));
&sDefault);
}
- if (snum >= 0)
- {
+ if (snum >= 0) {
if (!ServicePtrs[snum]->copymap)
init_copymap(ServicePtrs[snum]);
}
/* if it is a special case then go ahead */
- if (parm_table[parmnum].special)
- {
+ if (parm_table[parmnum].special) {
parm_table[parmnum].special(pszParmValue, (char **)parm_ptr);
return (True);
}
break;
case P_LIST:
+ str_list_free(parm_ptr);
*(char ***)parm_ptr = str_list_make(pszParmValue, NULL);
break;
case P_USTRING:
string_set(parm_ptr, pszParmValue);
- strupper(*(char **)parm_ptr);
+ strupper_m(*(char **)parm_ptr);
break;
case P_GSTRING:
case P_UGSTRING:
pstrcpy((char *)parm_ptr, pszParmValue);
- strupper((char *)parm_ptr);
+ strupper_m((char *)parm_ptr);
break;
case P_ENUM:
- for (i = 0; parm_table[parmnum].enum_list[i].name;
- i++)
- {
+ for (i = 0; parm_table[parmnum].enum_list[i].name; i++) {
if (strequal
(pszParmValue,
- parm_table[parmnum].enum_list[i].name))
- {
+ parm_table[parmnum].enum_list[i].name)) {
*(int *)parm_ptr =
parm_table[parmnum].
enum_list[i].value;
}
/***************************************************************************
-Process a parameter.
+ Process a parameter.
***************************************************************************/
-static BOOL do_parameter(char *pszParmName, char *pszParmValue)
+
+static BOOL do_parameter(const char *pszParmName, const char *pszParmValue)
{
if (!bInGlobalSection && bGlobalOnly)
return (True);
pszParmName, pszParmValue));
}
-
/***************************************************************************
-print a parameter of the specified type
+ Print a parameter of the specified type.
***************************************************************************/
+
static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
{
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)
- {
+ 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;
}
}
-
/***************************************************************************
-check if two parameters are equal
+ Check if two parameters are equal.
***************************************************************************/
+
static BOOL equal_parameter(parm_type type, void *ptr1, void *ptr2)
{
- switch (type)
- {
+ switch (type) {
case P_BOOL:
case P_BOOLREV:
return (*((BOOL *)ptr1) == *((BOOL *)ptr2));
}
/***************************************************************************
-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.
+ 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)
+
+static BOOL do_section(const char *pszSectionName)
{
BOOL bRetval;
BOOL isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
bInGlobalSection = isglobal;
/* check for multiple global sections */
- if (bInGlobalSection)
- {
+ if (bInGlobalSection) {
DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
return (True);
}
bRetval = service_ok(iServiceIndex);
/* if all is still well, move to the next record in the services array */
- if (bRetval)
- {
+ 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)
- {
+ < 0) {
DEBUG(0, ("Failed to add a new service\n"));
return (False);
}
/***************************************************************************
-determine if a partcular base parameter is currentl set to the default value.
+ Determine if a partcular base parameter is currentl set to the default value.
***************************************************************************/
+
static BOOL is_default(int i)
{
if (!defaults_saved)
return False;
- switch (parm_table[i].type)
- {
+ switch (parm_table[i].type) {
case P_LIST:
return str_list_compare (parm_table[i].def.lvalue,
*(char ***)parm_table[i].ptr);
return False;
}
-
/***************************************************************************
Display the contents of the global structure.
***************************************************************************/
+
static void dump_globals(FILE *f)
{
int i;
param_opt_struct *data;
- char *s;
fprintf(f, "# Global parameters\n[global]\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)))
- {
+ (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");
- }
- if (param_opt != NULL) {
- data = param_opt;
+ }
+ if (Globals.param_opt != NULL) {
+ data = Globals.param_opt;
while(data) {
- if (((s=strstr(data->key, "global")) == data->key) &&
- (*(s+strlen("global")) == ':')) {
- fprintf(f, "\t%s = %s\n", s+strlen("global")+1, data->value);
- }
- data = data->next;
+ fprintf(f, "\t%s = %s\n", data->key, data->value);
+ data = data->next;
}
}
}
/***************************************************************************
-return True if a local parameter is currently set to the global default
+ 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);
}
/***************************************************************************
-Display the contents of a single services record.
+ Display the contents of a single services record.
***************************************************************************/
+
static void dump_a_service(service * pService, FILE * f)
{
int i;
param_opt_struct *data;
- char *s, *sn;
if (pService != &sDefault)
fprintf(f, "\n[%s]\n", pService->szService);
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)))
- {
+ (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault);
- if (pService == &sDefault)
- {
+ if (pService == &sDefault) {
if (defaults_saved && is_default(i))
continue;
- }
- else
- {
+ } else {
if (equal_parameter(parm_table[i].type,
((char *)pService) +
pdiff,
print_parameter(&parm_table[i],
((char *)pService) + pdiff, f);
fprintf(f, "\n");
- }
- if (param_opt != NULL) {
- data = param_opt;
- sn = (pService == &sDefault) ? "global" : pService->szService;
+ }
+ if (pService->param_opt != NULL) {
+ data = pService->param_opt;
while(data) {
- if (((s=strstr(data->key, sn)) == data->key) &&
- (*(s+strlen(sn)) == ':')) {
- fprintf(f, "\t%s = %s\n", s+strlen(sn)+1, data->value);
- }
- data = data->next;
+ fprintf(f, "\t%s = %s\n", data->key, data->value);
+ data = data->next;
}
}
}
/***************************************************************************
-return info about the next service in a service. snum==-1 gives the globals
-
-return NULL when out of parameters
+ Return info about the next service in a service. snum==GLOBAL_SECTION_SNUM gives the globals.
+ Return NULL when out of parameters.
***************************************************************************/
+
struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
{
- if (snum == -1)
- {
+ if (snum < 0) {
/* do the globals */
- for (; parm_table[*i].label; (*i)++)
- {
+ for (; parm_table[*i].label; (*i)++) {
if (parm_table[*i].class == P_SEPARATOR)
return &parm_table[(*i)++];
return &parm_table[(*i)++];
}
- }
- else
- {
+ } else {
service *pService = ServicePtrs[snum];
- for (; parm_table[*i].label; (*i)++)
- {
+ for (; parm_table[*i].label; (*i)++) {
if (parm_table[*i].class == P_SEPARATOR)
return &parm_table[(*i)++];
#if 0
/***************************************************************************
-Display the contents of a single copy structure.
+ Display the contents of a single copy structure.
***************************************************************************/
static void dump_copy_map(BOOL *pcopymap)
{
#endif
/***************************************************************************
-Return TRUE if the passed service number is within range.
+ Return TRUE if the passed service number is within range.
***************************************************************************/
BOOL lp_snum_ok(int iService)
}
}
-/* Announce ourselves as a print server */
+/***************************************************************************
+ Announce ourselves as a print server.
+***************************************************************************/
void update_server_announce_as_printserver(void)
{
switch (parm_table[i].type) {
case P_LIST:
str_list_copy(&(parm_table[i].def.lvalue),
- *(char ***)parm_table[i].ptr);
+ *(const char ***)parm_table[i].ptr);
break;
case P_STRING:
case P_USTRING:
DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
break;
case SEC_SERVER:
+ if (lp_domain_logons())
+ DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
+ server_role = ROLE_DOMAIN_MEMBER;
+ break;
case SEC_DOMAIN:
+ if (lp_domain_logons()) {
+ DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
+ server_role = ROLE_DOMAIN_BDC;
+ break;
+ }
+ server_role = ROLE_DOMAIN_MEMBER;
+ break;
case SEC_ADS:
if (lp_domain_logons()) {
server_role = ROLE_DOMAIN_PDC;
}
}
-
+/***********************************************************
+ If we should send plaintext/LANMAN passwords in the clinet
+************************************************************/
+static void set_allowed_client_auth(void)
+{
+ if (Globals.bClientNTLMv2Auth) {
+ Globals.bClientLanManAuth = False;
+ }
+ if (!Globals.bClientLanManAuth) {
+ Globals.bClientPlaintextAuth = False;
+ }
+}
/***************************************************************************
-Load the services array from the services file. Return True on success,
-False on failure.
+ Load the services array from the services file. Return True on success,
+ False on failure.
***************************************************************************/
+
BOOL lp_load(const char *pszFname, BOOL global_only, BOOL save_defaults,
BOOL add_ipc)
{
lp_save_defaults();
}
- if (param_opt != NULL) {
- data = param_opt;
+ if (Globals.param_opt != NULL) {
+ data = Globals.param_opt;
while (data) {
- SAFE_FREE(data->key);
- SAFE_FREE(data->value);
+ string_free(&data->key);
+ string_free(&data->value);
+ str_list_free(&data->list);
pdata = data->next;
SAFE_FREE(data);
data = pdata;
}
- param_opt = NULL;
+ Globals.param_opt = NULL;
}
/* We get sections first, so have to start 'behind' to make up */
lp_add_auto_services(lp_auto_services());
if (add_ipc) {
- lp_add_ipc("IPC$", True);
+ /* When 'restrict anonymous = 2' guest connections to ipc$
+ are denied */
+ lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
lp_add_ipc("ADMIN$", False);
}
set_server_role();
set_default_server_announce_type();
+ set_allowed_client_auth();
bLoaded = True;
/* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
/* if bWINSsupport is true and we are in the client */
if (in_client && Globals.bWINSsupport) {
- lp_do_parameter(-1, "wins server", "127.0.0.1");
+ lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
}
init_iconv();
}
/***************************************************************************
-reset the max number of services
+ Reset the max number of services.
***************************************************************************/
+
void lp_resetnumservices(void)
{
iNumServices = 0;
}
/***************************************************************************
-return the max number of services
+ Return the max number of services.
***************************************************************************/
+
int lp_numservices(void)
{
return (iNumServices);
/***************************************************************************
Display the contents of the services array in human-readable form.
***************************************************************************/
+
void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint)
{
int iService;
if (show_defaults)
- {
defaults_saved = False;
- }
dump_globals(f);
/***************************************************************************
Display the contents of one service in human-readable form.
***************************************************************************/
+
void lp_dump_one(FILE * f, BOOL show_defaults, int snum)
{
- if (VALID(snum))
- {
+ if (VALID(snum)) {
if (ServicePtrs[snum]->szService[0] == '\0')
return;
dump_a_service(ServicePtrs[snum], f);
}
}
-
/***************************************************************************
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(const char *pszServiceName)
{
int iService;
fstring serviceName;
-
-
- for (iService = iNumServices - 1; iService >= 0; iService--)
- {
- if (VALID(iService) && ServicePtrs[iService]->szService)
- {
+
+ if (!pszServiceName)
+ return GLOBAL_SECTION_SNUM;
+
+ for (iService = iNumServices - 1; iService >= 0; iService--) {
+ if (VALID(iService) && ServicePtrs[iService]->szService) {
/*
* The substitution here is used to support %U is
* service names
}
}
- if (iService < 0)
+ if (iService < 0) {
DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
+ return GLOBAL_SECTION_SNUM;
+ }
return (iService);
}
/*******************************************************************
Set the server type we will announce as via nmbd.
********************************************************************/
+
static void set_default_server_announce_type(void)
{
default_server_announce = 0;
default_server_announce |= SV_TYPE_SERVER;
default_server_announce |= SV_TYPE_SERVER_UNIX;
- switch (lp_announce_as())
- {
+ switch (lp_announce_as()) {
case ANNOUNCE_AS_NT_SERVER:
- {
default_server_announce |= SV_TYPE_SERVER_NT;
/* fall through... */
- }
case ANNOUNCE_AS_NT_WORKSTATION:
- {
default_server_announce |= SV_TYPE_NT;
break;
- }
case ANNOUNCE_AS_WIN95:
- {
default_server_announce |= SV_TYPE_WIN95_PLUS;
break;
- }
case ANNOUNCE_AS_WFW:
- {
default_server_announce |= SV_TYPE_WFW;
break;
- }
default:
- {
break;
- }
}
- switch (lp_server_role())
- {
+ switch (lp_server_role()) {
case ROLE_DOMAIN_MEMBER:
- {
default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
break;
- }
case ROLE_DOMAIN_PDC:
- {
default_server_announce |= SV_TYPE_DOMAIN_CTRL;
break;
- }
case ROLE_DOMAIN_BDC:
- {
default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL;
break;
- }
case ROLE_STANDALONE:
default:
- {
break;
- }
}
-
if (lp_time_server())
- {
default_server_announce |= SV_TYPE_TIME_SOURCE;
- }
if (lp_host_msdfs())
- {
default_server_announce |= SV_TYPE_DFS_SERVER;
- }
}
/***********************************************************
BOOL lp_domain_master(void)
{
if (Globals.bDomainMaster == Auto)
- {
return (lp_server_role() == ROLE_DOMAIN_PDC);
- }
return Globals.bDomainMaster;
}
BOOL lp_preferred_master(void)
{
if (Globals.bPreferredMaster == Auto)
- {
return (lp_local_master() && lp_domain_master());
- }
return Globals.bPreferredMaster;
}
-
-
/*******************************************************************
-remove a service
+ Remove a service.
********************************************************************/
+
void lp_remove_service(int snum)
{
ServicePtrs[snum]->valid = False;
}
/*******************************************************************
-copy a service.
+ Copy a service.
********************************************************************/
-void lp_copy_service(int snum, char *new_name)
+
+void lp_copy_service(int snum, const char *new_name)
{
char *oldname = lp_servicename(snum);
do_section(new_name);
- if (snum >= 0)
- {
+ if (snum >= 0) {
snum = lp_servicenumber(new_name);
if (snum >= 0)
lp_do_parameter(snum, "copy", oldname);
/*******************************************************************
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;
pstrcpy (privdir, lp_private_dir());
}
-
-/****************************************************************
- Is netbios alias or name
-*****************************************************************/
-
-BOOL is_netbios_alias_or_name(const char *name)
-{
- char **netbios_aliases = lp_netbios_aliases();
-
- if (StrCaseCmp(name, global_myname) == 0) {
- return True;
- }
-
- for (netbios_aliases = lp_netbios_aliases();
- netbios_aliases && *netbios_aliases;
- netbios_aliases++) {
- if (StrCaseCmp(name, *netbios_aliases) == 0) {
- return True;
- }
- }
-
- return False;
-}
-
/***********************************************************
Allow daemons such as winbindd to fix their logfile name.
************************************************************/
}
/*******************************************************************
- Return the NetBIOS called name.
+ Return the NetBIOS called name, or my IP - but never global_myname().
********************************************************************/
const char *get_called_name(void)
extern fstring local_machine;
static fstring called_name;
- if (! *local_machine)
- return global_myname;
-
- /*
- * Windows NT/2k uses "*SMBSERVER" and XP uses "*SMBSERV"
- * arrggg!!! but we've already rewritten the client's
- * netbios name at this point...
- */
-
- if (*local_machine) {
- if (!StrCaseCmp(local_machine, "_SMBSERVER") || !StrCaseCmp(local_machine, "_SMBSERV")) {
- fstrcpy(called_name, get_my_primary_ip());
- DEBUG(8,("get_called_name: assuming that client used IP address [%s] as called name.\n",
- called_name));
- return called_name;
- }
+ if (!*local_machine) {
+ fstrcpy(called_name, get_my_primary_ip());
+ DEBUG(8,("get_called_name: assuming that client used IP address [%s] as called name.\n",
+ called_name));
+ return called_name;
}
return local_machine;