/*
* This structure describes global (ie., server-wide) parameters.
*/
-struct global {
+struct loadparm_global {
int ConfigBackend;
char *smb_ports;
char *dos_charset;
char *szSocketAddress;
bool bNmbdBindExplicitBroadcast;
char *szNISHomeMapName;
- char *szAnnounceVersion; /* This is initialised in init_globals */
char *szWorkgroup;
char *szNetbiosName;
char **szNetbiosAliases;
int min_wins_ttl;
int lm_announce;
int lm_interval;
- int announce_as; /* This is initialised in init_globals */
int machine_password_timeout;
int map_to_guest;
int oplock_break_wait_time;
char *ncalrpc_dir;
};
-static struct global Globals;
+static struct loadparm_global Globals;
/*
* This structure describes a single service.
*/
-struct service {
+struct loadparm_service {
bool valid;
bool autoloaded;
int usershare;
/* This is a default service used to prime a services structure */
-static struct service sDefault = {
+static struct loadparm_service sDefault = {
True, /* valid */
False, /* not autoloaded */
0, /* not a usershare */
};
/* local variables */
-static struct service **ServicePtrs = NULL;
+static struct loadparm_service **ServicePtrs = NULL;
static int iNumServices = 0;
static int iServiceIndex = 0;
static struct db_context *ServiceHash;
static void set_default_server_announce_type(void);
static void set_allowed_client_auth(void);
-static void *lp_local_ptr(struct service *service, void *ptr);
+static void *lp_local_ptr(struct loadparm_service *service, void *ptr);
static void add_to_file_list(const char *fname, const char *subfname);
static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values);
{-1, NULL}
};
-/* Types of machine we can announce as. */
-#define ANNOUNCE_AS_NT_SERVER 1
-#define ANNOUNCE_AS_WIN95 2
-#define ANNOUNCE_AS_WFW 3
-#define ANNOUNCE_AS_NT_WORKSTATION 4
-
-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"},
- {ANNOUNCE_AS_WIN95, "win95"},
- {ANNOUNCE_AS_WFW, "WfW"},
- {-1, NULL}
-};
-
static const struct enum_list enum_map_readonly[] = {
{MAP_READONLY_NO, "no"},
{MAP_READONLY_NO, "false"},
.enum_list = NULL,
.flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
},
- {
- .label = "announce version",
- .type = P_STRING,
- .p_class = P_GLOBAL,
- .ptr = &Globals.szAnnounceVersion,
- .special = NULL,
- .enum_list = NULL,
- .flags = FLAG_ADVANCED,
- },
- {
- .label = "announce as",
- .type = P_ENUM,
- .p_class = P_GLOBAL,
- .ptr = &Globals.announce_as,
- .special = NULL,
- .enum_list = enum_announce_as,
- .flags = FLAG_ADVANCED,
- },
{
.label = "map acl inherit",
.type = P_BOOL,
Initialise the sDefault parameter structure for the printer values.
***************************************************************************/
-static void init_printer_values(struct service *pService)
+static void init_printer_values(struct loadparm_service *pService)
{
/* choose defaults depending on the type of printing */
switch (pService->iPrinting) {
* Free the allocated data for one parameter for a share
* given as a service struct.
*/
-static void free_one_parameter(struct service *service,
+static void free_one_parameter(struct loadparm_service *service,
struct parm_struct parm)
{
void *parm_ptr;
* Free the allocated parameter data of a share given
* as a service struct.
*/
-static void free_parameters(struct service *service)
+static void free_parameters(struct loadparm_service *service)
{
uint32_t i;
}
string_set(&Globals.szServerString, s);
SAFE_FREE(s);
- if (asprintf(&s, "%d.%d", DEFAULT_MAJOR_VERSION,
- DEFAULT_MINOR_VERSION) < 0) {
- smb_panic("init_globals: ENOMEM");
- }
- string_set(&Globals.szAnnounceVersion, s);
- SAFE_FREE(s);
#ifdef DEVELOPER
string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
#endif
Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
Globals.lm_interval = 60;
- Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
#if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
Globals.bNISHomeMap = False;
#ifdef WITH_NISPLUS_HOME
FN_GLOBAL_LIST(lp_wins_server_list, szWINSservers)
FN_GLOBAL_LIST(lp_interfaces, szInterfaces)
FN_GLOBAL_STRING(lp_nis_home_map_name, szNISHomeMapName)
-static FN_GLOBAL_STRING(lp_announce_version, szAnnounceVersion)
FN_GLOBAL_LIST(lp_netbios_aliases, szNetbiosAliases)
-/* FN_GLOBAL_STRING(lp_passdb_backend, szPassdbBackend)
- * lp_passdb_backend() should be replace by the this macro again after
- * some releases.
- * */
-const char *lp_passdb_backend(void)
-{
- char *delim, *quote;
-
- delim = strchr( Globals.szPassdbBackend, ' ');
- /* no space at all */
- if (delim == NULL) {
- goto out;
- }
-
- quote = strchr(Globals.szPassdbBackend, '"');
- /* no quote char or non in the first part */
- if (quote == NULL || quote > delim) {
- *delim = '\0';
- goto warn;
- }
-
- quote = strchr(quote+1, '"');
- if (quote == NULL) {
- DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
- goto out;
- } else if (*(quote+1) == '\0') {
- /* space, fitting quote char, and one backend only */
- goto out;
- } else {
- /* terminate string after the fitting quote char */
- *(quote+1) = '\0';
- }
-
-warn:
- DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
- "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
- "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
- "backend (%s) is used. The rest is ignored.\n", Globals.szPassdbBackend));
-
-out:
- return Globals.szPassdbBackend;
-}
+FN_GLOBAL_CONST_STRING(lp_passdb_backend, szPassdbBackend)
FN_GLOBAL_LIST(lp_preload_modules, szPreloadModules)
FN_GLOBAL_STRING(lp_panic_action, szPanicAction)
FN_GLOBAL_STRING(lp_adduser_script, szAddUserScript)
FN_GLOBAL_INTEGER(lp_max_smbd_processes, iMaxSmbdProcesses)
FN_GLOBAL_BOOL(_lp_disable_spoolss, bDisableSpoolss)
FN_GLOBAL_INTEGER(lp_syslog, syslog)
-static FN_GLOBAL_INTEGER(lp_announce_as, announce_as)
FN_GLOBAL_INTEGER(lp_lm_announce, lm_announce)
FN_GLOBAL_INTEGER(lp_lm_interval, lm_interval)
FN_GLOBAL_INTEGER(lp_machine_password_timeout, machine_password_timeout)
static int map_parameter_canonical(const char *pszParmName, bool *inverse);
static const char *get_boolean(bool bool_value);
static int getservicebyname(const char *pszServiceName,
- struct service *pserviceDest);
-static void copy_service(struct service *pserviceDest,
- struct service *pserviceSource,
+ struct loadparm_service *pserviceDest);
+static void copy_service(struct loadparm_service *pserviceDest,
+ struct loadparm_service *pserviceSource,
struct bitmap *pcopymapDest);
static bool do_parameter(const char *pszParmName, const char *pszParmValue,
void *userdata);
static bool do_section(const char *pszSectionName, void *userdata);
-static void init_copymap(struct service *pservice);
+static void init_copymap(struct loadparm_service *pservice);
static bool hash_a_service(const char *name, int number);
static void free_service_byindex(int iService);
static void free_param_opts(struct param_opt_struct **popts);
#undef MISSING_PARAMETER
-/* 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);
- 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 on the talloc_tos() */
Initialise a service to the defaults.
***************************************************************************/
-static void init_service(struct service *pservice)
+static void init_service(struct loadparm_service *pservice)
{
- memset((char *)pservice, '\0', sizeof(struct service));
+ memset((char *)pservice, '\0', sizeof(struct loadparm_service));
copy_service(pservice, &sDefault, NULL);
}
Free the dynamically allocated parts of a service struct.
***************************************************************************/
-static void free_service(struct service *pservice)
+static void free_service(struct loadparm_service *pservice)
{
if (!pservice)
return;
service.
***************************************************************************/
-static int add_a_service(const struct service *pservice, const char *name)
+static int add_a_service(const struct loadparm_service *pservice, const char *name)
{
int i;
- struct service tservice;
+ struct loadparm_service tservice;
int num_to_alloc = iNumServices + 1;
tservice = *pservice;
/* if not, then create one */
if (i == iNumServices) {
- struct service **tsp;
+ struct loadparm_service **tsp;
int *tinvalid;
- tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct service *, num_to_alloc);
+ tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct loadparm_service *, num_to_alloc);
if (tsp == NULL) {
DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
return (-1);
}
ServicePtrs = tsp;
- ServicePtrs[iNumServices] = SMB_MALLOC_P(struct service);
+ ServicePtrs[iNumServices] = SMB_MALLOC_P(struct loadparm_service);
if (!ServicePtrs[iNumServices]) {
DEBUG(0,("add_a_service: out of memory!\n"));
return (-1);
Find a service by name. Otherwise works like get_service.
***************************************************************************/
-static int getservicebyname(const char *pszServiceName, struct service *pserviceDest)
+static int getservicebyname(const char *pszServiceName, struct loadparm_service *pserviceDest)
{
int iService = -1;
char *canon_name;
}
}
-static void copy_service(struct service *pserviceDest, struct service *pserviceSource,
+static void copy_service(struct loadparm_service *pserviceDest, struct loadparm_service *pserviceSource,
struct bitmap *pcopymapDest)
{
int i;
{
bool bRetval;
int iTemp;
- struct service serviceTemp;
+ struct loadparm_service serviceTemp;
string_set(ptr, pszParmValue);
static bool handle_printing(int snum, const char *pszParmValue, char **ptr)
{
static int parm_num = -1;
- struct service *s;
+ struct loadparm_service *s;
if ( parm_num == -1 )
parm_num = map_parameter( "printing" );
Initialise a copymap.
***************************************************************************/
-static void init_copymap(struct service *pservice)
+static void init_copymap(struct loadparm_service *pservice)
{
int i;
pointer into the default structure.
***************************************************************************/
-static void *lp_local_ptr(struct service *service, void *ptr)
+static void *lp_local_ptr(struct loadparm_service *service, void *ptr)
{
return (void *)(((char *)service) + PTR_DIFF(ptr, &sDefault));
}
Display the contents of a single services record.
***************************************************************************/
-static void dump_a_service(struct service *pService, FILE * f)
+static void dump_a_service(struct loadparm_service *pService, FILE * f)
{
int i;
struct param_opt_struct *data;
if (isGlobal) {
ptr = parm_table[i].ptr;
} else {
- struct service *pService = ServicePtrs[snum];
+ struct loadparm_service *pService = ServicePtrs[snum];
ptr = ((char *)pService) +
PTR_DIFF(parm_table[i].ptr, &sDefault);
}
return &parm_table[(*i)++];
}
} else {
- struct service *pService = ServicePtrs[snum];
+ struct loadparm_service *pService = ServicePtrs[snum];
for (; parm_table[*i].label; (*i)++) {
if (parm_table[*i].p_class == P_SEPARATOR)
/* Everything ok - add the service possibly using a template. */
if (iService < 0) {
- const struct service *sp = &sDefault;
+ const struct loadparm_service *sp = &sDefault;
if (snum_template != -1) {
sp = ServicePtrs[snum_template];
}
default_server_announce |= SV_TYPE_PRINTQ_SERVER;
- 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;
- }
+ default_server_announce |= SV_TYPE_SERVER_NT;
+ default_server_announce |= SV_TYPE_NT;
switch (lp_server_role()) {
case ROLE_DOMAIN_MEMBER:
return default_server_announce;
}
-/*******************************************************************
- Split the announce version into major and minor numbers.
-********************************************************************/
-
-int lp_major_announce_version(void)
-{
- static bool got_major = False;
- static int major_version = DEFAULT_MAJOR_VERSION;
- char *vers;
- char *p;
-
- if (got_major)
- return major_version;
-
- got_major = True;
- if ((vers = lp_announce_version()) == NULL)
- return major_version;
-
- if ((p = strchr_m(vers, '.')) == 0)
- return major_version;
-
- *p = '\0';
- major_version = atoi(vers);
- return major_version;
-}
-
-int lp_minor_announce_version(void)
-{
- static bool got_minor = False;
- static int minor_version = DEFAULT_MINOR_VERSION;
- char *vers;
- char *p;
-
- if (got_minor)
- return minor_version;
-
- got_minor = True;
- if ((vers = lp_announce_version()) == NULL)
- return minor_version;
-
- if ((p = strchr_m(vers, '.')) == 0)
- return minor_version;
-
- p++;
- minor_version = atoi(p);
- return minor_version;
-}
-
/***********************************************************
Set the global name resolution order (used in smbclient).
************************************************************/