#include "dbwrap/dbwrap.h"
#include "dbwrap/dbwrap_rbt.h"
#include "../lib/util/bitmap.h"
+#include "librpc/gen_ndr/nbt.h"
#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
.aio_write_behind = NULL,
.dfree_command = NULL,
.min_print_space = 0,
- .iMaxPrintJobs = 1000,
+ .max_print_jobs = 1000,
.max_reported_print_jobs = 0,
.write_cache_size = 0,
.create_mask = 0744,
.access_based_share_enum = false,
.bAvailable = true,
.read_only = true,
+ .spotlight = false,
.guest_only = false,
.administrative_share = false,
.guest_ok = false,
.follow_symlinks = true,
.sync_always = false,
.strict_allocate = false,
+ .strict_rename = false,
.strict_sync = false,
.mangling_char = '~',
.copymap = NULL,
.inherit_acls = false,
.inherit_owner = false,
.msdfs_root = false,
+ .msdfs_shuffle_referrals = false,
.use_client_driver = false,
.default_devmode = true,
.force_printername = false,
.acl_map_full_control = true,
.acl_group_control = false,
.acl_allow_execute_always = false,
- .change_notify = true,
- .kernel_change_notify = true,
.allocation_roundup_size = SMB_ROUNDUP_ALLOCATION_SIZE,
.aio_read_size = 0,
.aio_write_size = 0,
return true;
}
-bool lp_string_set(char **dest, const char *src) {
- return string_set(Globals.ctx, dest, src);
-}
-
-/***************************************************************************
- Initialise the sDefault parameter structure for the printer values.
-***************************************************************************/
-
-void init_printer_values(struct loadparm_context *lp_ctx, TALLOC_CTX *ctx,
- struct loadparm_service *pService)
-{
- /* choose defaults depending on the type of printing */
- switch (pService->printing) {
- case PRINT_BSD:
- case PRINT_AIX:
- case PRINT_LPRNT:
- case PRINT_LPROS2:
- lpcfg_string_set(ctx, &pService->lpq_command, "lpq -P'%p'");
- lpcfg_string_set(ctx, &pService->lprm_command, "lprm -P'%p' %j");
- lpcfg_string_set(ctx, &pService->print_command, "lpr -r -P'%p' %s");
- break;
-
- case PRINT_LPRNG:
- case PRINT_PLP:
- lpcfg_string_set(ctx, &pService->lpq_command, "lpq -P'%p'");
- lpcfg_string_set(ctx, &pService->lprm_command, "lprm -P'%p' %j");
- lpcfg_string_set(ctx, &pService->print_command, "lpr -r -P'%p' %s");
- lpcfg_string_set(ctx, &pService->queuepause_command, "lpc stop '%p'");
- lpcfg_string_set(ctx, &pService->queueresume_command, "lpc start '%p'");
- lpcfg_string_set(ctx, &pService->lppause_command, "lpc hold '%p' %j");
- lpcfg_string_set(ctx, &pService->lpresume_command, "lpc release '%p' %j");
- break;
-
- case PRINT_CUPS:
- case PRINT_IPRINT:
- /* set the lpq command to contain the destination printer
- name only. This is used by cups_queue_get() */
- lpcfg_string_set(ctx, &pService->lpq_command, "%p");
- lpcfg_string_set(ctx, &pService->lprm_command, "");
- lpcfg_string_set(ctx, &pService->print_command, "");
- lpcfg_string_set(ctx, &pService->lppause_command, "");
- lpcfg_string_set(ctx, &pService->lpresume_command, "");
- lpcfg_string_set(ctx, &pService->queuepause_command, "");
- lpcfg_string_set(ctx, &pService->queueresume_command, "");
- break;
-
- case PRINT_SYSV:
- case PRINT_HPUX:
- lpcfg_string_set(ctx, &pService->lpq_command, "lpstat -o%p");
- lpcfg_string_set(ctx, &pService->lprm_command, "cancel %p-%j");
- lpcfg_string_set(ctx, &pService->print_command, "lp -c -d%p %s; rm %s");
- lpcfg_string_set(ctx, &pService->queuepause_command, "disable %p");
- lpcfg_string_set(ctx, &pService->queueresume_command, "enable %p");
-#ifndef HPUX
- lpcfg_string_set(ctx, &pService->lppause_command, "lp -i %p-%j -H hold");
- lpcfg_string_set(ctx, &pService->lpresume_command, "lp -i %p-%j -H resume");
-#endif /* HPUX */
- break;
-
- case PRINT_QNX:
- lpcfg_string_set(ctx, &pService->lpq_command, "lpq -P%p");
- lpcfg_string_set(ctx, &pService->lprm_command, "lprm -P%p %j");
- lpcfg_string_set(ctx, &pService->print_command, "lp -r -P%p %s");
- break;
-
-#if defined(DEVELOPER) || defined(ENABLE_SELFTEST)
-
- case PRINT_TEST:
- case PRINT_VLP: {
- const char *tdbfile;
- TALLOC_CTX *tmp_ctx = talloc_new(ctx);
- const char *tmp;
-
- tmp = lpcfg_parm_string(lp_ctx, NULL, "vlp", "tdbfile");
- if (tmp == NULL) {
- tmp = "/tmp/vlp.tdb";
- }
-
- tdbfile = talloc_asprintf(tmp_ctx, "tdbfile=%s", tmp);
- if (tdbfile == NULL) {
- tdbfile="tdbfile=/tmp/vlp.tdb";
- }
-
- tmp = talloc_asprintf(tmp_ctx, "vlp %s print %%p %%s",
- tdbfile);
- lpcfg_string_set(ctx, &pService->print_command,
- tmp ? tmp : "vlp print %p %s");
-
- tmp = talloc_asprintf(tmp_ctx, "vlp %s lpq %%p",
- tdbfile);
- lpcfg_string_set(ctx, &pService->lpq_command,
- tmp ? tmp : "vlp lpq %p");
-
- tmp = talloc_asprintf(tmp_ctx, "vlp %s lprm %%p %%j",
- tdbfile);
- lpcfg_string_set(ctx, &pService->lprm_command,
- tmp ? tmp : "vlp lprm %p %j");
-
- tmp = talloc_asprintf(tmp_ctx, "vlp %s lppause %%p %%j",
- tdbfile);
- lpcfg_string_set(ctx, &pService->lppause_command,
- tmp ? tmp : "vlp lppause %p %j");
-
- tmp = talloc_asprintf(tmp_ctx, "vlp %s lpresume %%p %%j",
- tdbfile);
- lpcfg_string_set(ctx, &pService->lpresume_command,
- tmp ? tmp : "vlp lpresume %p %j");
-
- tmp = talloc_asprintf(tmp_ctx, "vlp %s queuepause %%p",
- tdbfile);
- lpcfg_string_set(ctx, &pService->queuepause_command,
- tmp ? tmp : "vlp queuepause %p");
-
- tmp = talloc_asprintf(tmp_ctx, "vlp %s queueresume %%p",
- tdbfile);
- lpcfg_string_set(ctx, &pService->queueresume_command,
- tmp ? tmp : "vlp queueresume %p");
- TALLOC_FREE(tmp_ctx);
-
- break;
- }
-#endif /* DEVELOPER */
-
- }
-}
/**
* Function to return the default value for the maximum number of open
* file descriptors permitted. This function tries to consult the
init_printer_values(lp_ctx, Globals.ctx, &sDefault);
- sDefault.ntvfs_handler = (const char **)str_list_make_v3(NULL, "unixuid default", NULL);
+ sDefault.ntvfs_handler = str_list_make_v3_const(NULL, "unixuid default", NULL);
DEBUG(3, ("Initialising global parameters\n"));
string_set(Globals.ctx, &Globals.logon_home, "\\\\%N\\%U");
string_set(Globals.ctx, &Globals.logon_path, "\\\\%N\\%U\\profile");
- Globals.name_resolve_order = (const char **)str_list_make_v3(NULL, "lmhosts wins host bcast", NULL);
+ Globals.name_resolve_order = str_list_make_v3_const(NULL, "lmhosts wins host bcast", NULL);
string_set(Globals.ctx, &Globals.password_server, "*");
Globals.algorithmic_rid_base = BASE_RID;
Globals.large_readwrite = true;
Globals.max_log_size = 5000;
Globals.max_open_files = max_open_files();
- Globals.server_max_protocol = PROTOCOL_SMB3_00;
+ Globals.server_max_protocol = PROTOCOL_SMB3_11;
Globals.server_min_protocol = PROTOCOL_LANMAN1;
- Globals.client_max_protocol = PROTOCOL_NT1;
+ Globals._client_max_protocol = PROTOCOL_DEFAULT;
Globals.client_min_protocol = PROTOCOL_CORE;
Globals._security = SEC_AUTO;
Globals.encrypt_passwords = true;
Globals.passwd_chat_timeout = 2; /* 2 second default. */
Globals.nt_pipe_support = true; /* Do NT pipes by default. */
Globals.nt_status_support = true; /* Use NT status by default. */
+ Globals.smbd_profiling_level = 0;
Globals.stat_cache = true; /* use stat cache by default */
Globals.max_stat_cache_size = 256; /* 256k by default */
Globals.restrict_anonymous = 0;
a large number of sites (tridge) */
Globals.hostname_lookups = false;
+ Globals.change_notify = true,
+ Globals.kernel_change_notify = true,
+
string_set(Globals.ctx, &Globals.passdb_backend, "tdbsam");
string_set(Globals.ctx, &Globals.ldap_suffix, "");
- string_set(Globals.ctx, &Globals.szLdapMachineSuffix, "");
- string_set(Globals.ctx, &Globals.szLdapUserSuffix, "");
- string_set(Globals.ctx, &Globals.szLdapGroupSuffix, "");
- string_set(Globals.ctx, &Globals.szLdapIdmapSuffix, "");
+ string_set(Globals.ctx, &Globals._ldap_machine_suffix, "");
+ string_set(Globals.ctx, &Globals._ldap_user_suffix, "");
+ string_set(Globals.ctx, &Globals._ldap_group_suffix, "");
+ string_set(Globals.ctx, &Globals._ldap_idmap_suffix, "");
string_set(Globals.ctx, &Globals.ldap_admin_dn, "");
Globals.ldap_ssl = LDAP_SSL_START_TLS;
Globals.ldap_debug_level = 0;
Globals.ldap_debug_threshold = 10;
+ Globals.client_ldap_sasl_wrapping = ADS_AUTH_SASL_SIGN;
+
/* This is what we tell the afs client. in reality we set the token
* to never expire, though, when this runs out the afs client will
* forget the token. Set to 0 to get NEVERDATE.*/
Globals.winbind_use_default_domain = false;
Globals.winbind_trusted_domains_only = false;
Globals.winbind_nested_groups = true;
- Globals.winbind_expand_groups = 1;
- Globals.winbind_nss_info = (const char **)str_list_make_v3(NULL, "template", NULL);
+ Globals.winbind_expand_groups = 0;
+ Globals.winbind_nss_info = str_list_make_v3_const(NULL, "template", NULL);
Globals.winbind_refresh_tickets = false;
Globals.winbind_offline_logon = false;
Globals.server_signing = SMB_SIGNING_DEFAULT;
Globals.defer_sharing_violations = true;
- Globals.smb_ports = (const char **)str_list_make_v3(NULL, SMB_PORTS, NULL);
+ Globals.smb_ports = str_list_make_v3_const(NULL, SMB_PORTS, NULL);
Globals.enable_privileges = true;
Globals.host_msdfs = true;
/* By default no shares out of the registry */
Globals.registry_shares = false;
- Globals.iminreceivefile = 0;
+ Globals.min_receivefile_size = 0;
Globals.map_untrusted_to_domain = false;
Globals.multicast_dns_register = true;
Globals.smb2_max_write = DEFAULT_SMB2_MAX_WRITE;
Globals.smb2_max_trans = DEFAULT_SMB2_MAX_TRANSACT;
Globals.ismb2_max_credits = DEFAULT_SMB2_MAX_CREDITS;
+ Globals.smb2_leases = false;
string_set(Globals.ctx, &Globals.ncalrpc_dir, get_dyn_NCALRPCDIR());
- Globals.server_services = (const char **)str_list_make_v3(NULL, "s3fs rpc nbt wrepl ldap cldap kdc drepl winbindd ntp_signd kcc dnsupdate dns", NULL);
+ Globals.server_services = str_list_make_v3_const(NULL, "s3fs rpc nbt wrepl ldap cldap kdc drepl winbindd ntp_signd kcc dnsupdate dns", NULL);
- Globals.dcerpc_endpoint_servers = (const char **)str_list_make_v3(NULL, "epmapper wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi dssetup unixinfo browser eventlog6 backupkey dnsserver", NULL);
+ Globals.dcerpc_endpoint_servers = str_list_make_v3_const(NULL, "epmapper wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi dssetup unixinfo browser eventlog6 backupkey dnsserver", NULL);
Globals.tls_enabled = true;
string_set(Globals.ctx, &Globals._tls_keyfile, "tls/key.pem");
string_set(Globals.ctx, &Globals._tls_certfile, "tls/cert.pem");
string_set(Globals.ctx, &Globals._tls_cafile, "tls/ca.pem");
+ string_set(Globals.ctx, &Globals.tls_priority, "NORMAL:-VERS-SSL3.0");
string_set(Globals.ctx, &Globals.share_backend, "classic");
- Globals.iPreferredMaster = Auto;
+ Globals._preferred_master = Auto;
Globals.allow_dns_updates = DNS_UPDATE_SIGNED;
if (s == NULL) {
smb_panic("init_globals: ENOMEM");
}
- Globals.samba_kcc_command = (const char **)str_list_make_v3(NULL, s, NULL);
+ Globals.samba_kcc_command = str_list_make_v3_const(NULL, s, NULL);
TALLOC_FREE(s);
s = talloc_asprintf(talloc_tos(), "%s/samba_dnsupdate", get_dyn_SCRIPTSBINDIR());
if (s == NULL) {
smb_panic("init_globals: ENOMEM");
}
- Globals.dns_update_command = (const char **)str_list_make_v3(NULL, s, NULL);
+ Globals.dns_update_command = str_list_make_v3_const(NULL, s, NULL);
TALLOC_FREE(s);
s = talloc_asprintf(talloc_tos(), "%s/samba_spnupdate", get_dyn_SCRIPTSBINDIR());
if (s == NULL) {
smb_panic("init_globals: ENOMEM");
}
- Globals.spn_update_command = (const char **)str_list_make_v3(NULL, s, NULL);
+ Globals.spn_update_command = str_list_make_v3_const(NULL, s, NULL);
TALLOC_FREE(s);
- Globals.nsupdate_command = (const char **)str_list_make_v3(NULL, "/usr/bin/nsupdate -g", NULL);
+ Globals.nsupdate_command = str_list_make_v3_const(NULL, "/usr/bin/nsupdate -g", NULL);
- Globals.rndc_command = (const char **)str_list_make_v3(NULL, "/usr/sbin/rndc", NULL);
+ Globals.rndc_command = str_list_make_v3_const(NULL, "/usr/sbin/rndc", NULL);
Globals.cldap_port = 389;
- Globals.dgram_port = 138;
+ Globals.dgram_port = NBT_DGRAM_SERVICE_PORT;
- Globals.nbt_port = 137;
+ Globals.nbt_port = NBT_NAME_SERVICE_PORT;
Globals.krb5_port = 88;
apply_lp_set_cmdline();
}
+/* Convenience routine to setup an lp_context with additional s3 variables */
+static struct loadparm_context *setup_lp_context(TALLOC_CTX *mem_ctx)
+{
+ struct loadparm_context *lp_ctx;
+
+ lp_ctx = loadparm_init_s3(mem_ctx,
+ loadparm_s3_helpers());
+ if (lp_ctx == NULL) {
+ DEBUG(0, ("loadparm_init_s3 failed\n"));
+ return NULL;
+ }
+
+ lp_ctx->sDefault = &sDefault;
+ lp_ctx->services = NULL; /* We do not want to access this directly */
+ lp_ctx->bInGlobalSection = bInGlobalSection;
+ lp_ctx->flags = flags_list;
+
+ return lp_ctx;
+}
+
/*******************************************************************
Convenience routine to grab string parameters into talloced memory
and run standard_sub_basic on them. The buffers can be written to by
data->list = str_list_make_v3(NULL, data->value, NULL);
}
- return (const char **)data->list;
+ return discard_const_p(const char *, data->list);
}
/* Return parametric option from a given service. Type is a part of option before ':' */
canon_name = canonicalize_servicename(talloc_tos(), name );
dbwrap_store_bystring(ServiceHash, canon_name,
- make_tdb_data((uint8 *)&idx, sizeof(idx)),
+ make_tdb_data((uint8_t *)&idx, sizeof(idx)),
TDB_REPLACE);
TALLOC_FREE(canon_name);
return false;
}
-/**************************************************************************
- Check whether the given name is the canonical name of a parameter.
- Returns false if it is not a valid parameter Name.
- For parametric options, true is returned.
-**************************************************************************/
-
-bool lp_parameter_is_canonical(const char *parm_name)
-{
- if (!lp_parameter_is_valid(parm_name)) {
- return false;
- }
-
- return (lpcfg_map_parameter(parm_name) ==
- map_parameter_canonical(parm_name, NULL));
-}
-
/**************************************************************************
Determine the canonical name for a parameter.
Indicate when it is an inverse (boolean) synonym instead of a
bool loc_inverse = false;
parm_num = lpcfg_map_parameter(pszParmName);
- if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_HIDE)) {
+ if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_SYNONYM)) {
/* invalid, parametric or no canidate for synonyms ... */
goto done;
}
{
if ((parm_table[parm1].offset == parm_table[parm2].offset) &&
(parm_table[parm1].p_class == parm_table[parm2].p_class) &&
- (parm_table[parm1].flags & FLAG_HIDE) &&
- !(parm_table[parm2].flags & FLAG_HIDE))
+ (parm_table[parm1].flags & FLAG_SYNONYM) &&
+ !(parm_table[parm2].flags & FLAG_SYNONYM))
{
if (inverse != NULL) {
if ((parm_table[parm1].type == P_BOOLREV) &&
bool inverse;
const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
"P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
- "P_ENUM", "P_SEP"};
- unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
- FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
- FLAG_HIDE};
- const char *flag_names[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
- "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
- "FLAG_DEPRECATED", "FLAG_HIDE", NULL};
+ "P_ENUM", "P_BYTES", "P_CMDLIST" };
+ unsigned flags[] = { FLAG_DEPRECATED, FLAG_SYNONYM };
+ const char *flag_names[] = { "FLAG_DEPRECATED", "FLAG_SYNONYM", NULL};
printf("%s=%s", parm_table[parmIndex].label,
type[parm_table[parmIndex].type]);
const char *lp_ldap_machine_suffix(TALLOC_CTX *ctx)
{
- if (Globals.szLdapMachineSuffix[0])
- return append_ldap_suffix(ctx, Globals.szLdapMachineSuffix);
+ if (Globals._ldap_machine_suffix[0])
+ return append_ldap_suffix(ctx, Globals._ldap_machine_suffix);
return lp_string(ctx, Globals.ldap_suffix);
}
const char *lp_ldap_user_suffix(TALLOC_CTX *ctx)
{
- if (Globals.szLdapUserSuffix[0])
- return append_ldap_suffix(ctx, Globals.szLdapUserSuffix);
+ if (Globals._ldap_user_suffix[0])
+ return append_ldap_suffix(ctx, Globals._ldap_user_suffix);
return lp_string(ctx, Globals.ldap_suffix);
}
const char *lp_ldap_group_suffix(TALLOC_CTX *ctx)
{
- if (Globals.szLdapGroupSuffix[0])
- return append_ldap_suffix(ctx, Globals.szLdapGroupSuffix);
+ if (Globals._ldap_group_suffix[0])
+ return append_ldap_suffix(ctx, Globals._ldap_group_suffix);
return lp_string(ctx, Globals.ldap_suffix);
}
const char *lp_ldap_idmap_suffix(TALLOC_CTX *ctx)
{
- if (Globals.szLdapIdmapSuffix[0])
- return append_ldap_suffix(ctx, Globals.szLdapIdmapSuffix);
+ if (Globals._ldap_idmap_suffix[0])
+ return append_ldap_suffix(ctx, Globals._ldap_idmap_suffix);
return lp_string(ctx, Globals.ldap_suffix);
}
struct loadparm_context *lp_ctx;
bool ok;
- lp_ctx = loadparm_init_s3(frame,
- loadparm_s3_helpers());
+ lp_ctx = setup_lp_context(frame);
if (lp_ctx == NULL) {
- DEBUG(0, ("loadparm_init_s3 failed\n"));
TALLOC_FREE(frame);
return false;
}
- lp_ctx->sDefault = &sDefault;
- lp_ctx->services = ServicePtrs;
- lp_ctx->bInGlobalSection = bInGlobalSection;
- lp_ctx->flags = flags_list;
-
if (snum < 0) {
ok = lpcfg_do_global_parameter(lp_ctx, pszParmName, pszParmValue);
} else {
TALLOC_CTX *frame = talloc_stackframe();
struct loadparm_context *lp_ctx;
- lp_ctx = loadparm_init_s3(talloc_tos(), loadparm_s3_helpers());
+ lp_ctx = setup_lp_context(frame);
if (lp_ctx == NULL) {
- DEBUG(0, ("loadparm_init_s3 failed\n"));
+ TALLOC_FREE(frame);
return false;
}
/* if we've just struck a global section, note the fact. */
bInGlobalSection = isglobal;
- lp_ctx->bInGlobalSection = isglobal;
+ if (lp_ctx != NULL) {
+ lp_ctx->bInGlobalSection = isglobal;
+ }
/* check for multiple global sections */
if (bInGlobalSection) {
bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
{
bool result = false;
-
struct loadparm_context *lp_ctx;
- lp_ctx = loadparm_init_s3(talloc_tos(), loadparm_s3_helpers());
+ lp_ctx = setup_lp_context(talloc_tos());
if (lp_ctx == NULL) {
return false;
}
return result;
}
-/***************************************************************************
- Return info about the requested parameter (given as a string).
- Return NULL when the string is not a valid parameter name.
-***************************************************************************/
-
-struct parm_struct *lp_get_parameter(const char *param_name)
-{
- int num = lpcfg_map_parameter(param_name);
-
- if (num < 0) {
- return NULL;
- }
-
- return &parm_table[num];
-}
-
#if 0
/***************************************************************************
Display the contents of a single copy structure.
parm_table[i].def.ivalue =
*(int *)lp_parm_ptr(NULL, &parm_table[i]);
break;
- case P_SEP:
- break;
}
}
return in_client;
}
+static void lp_enforce_ad_dc_settings(void)
+{
+ lp_do_parameter(GLOBAL_SECTION_SNUM, "passdb backend", "samba_dsdb");
+ lp_do_parameter(GLOBAL_SECTION_SNUM,
+ "winbindd:use external pipes", "true");
+ lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:default", "external");
+ lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:svcctl", "embedded");
+ lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:srvsvc", "embedded");
+ lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:eventlog", "embedded");
+ lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:ntsvcs", "embedded");
+ lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:winreg", "embedded");
+ lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:spoolss", "embedded");
+ lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_daemon:spoolssd", "embedded");
+ lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:tcpip", "no");
+}
+
/***************************************************************************
Load the services array from the services file. Return true on success,
false on failure.
bool global_only,
bool save_defaults,
bool add_ipc,
- bool initialize_globals,
+ bool reinit_globals,
bool allow_include_registry,
bool load_all_shares)
{
bGlobalOnly = global_only;
bAllowIncludeRegistry = allow_include_registry;
- lp_ctx = loadparm_init_s3(talloc_tos(),
- loadparm_s3_helpers());
-
- lp_ctx->sDefault = &sDefault;
- lp_ctx->bInGlobalSection = bInGlobalSection;
+ lp_ctx = setup_lp_context(talloc_tos());
- init_globals(lp_ctx, initialize_globals);
+ init_globals(lp_ctx, reinit_globals);
free_file_list();
lp_save_defaults();
}
- if (!initialize_globals) {
+ if (!reinit_globals) {
free_param_opts(&Globals.param_opt);
apply_lp_set_cmdline();
}
lp_kill_all_services();
ok = lp_load_ex(pszFname, global_only, save_defaults,
- add_ipc, initialize_globals,
+ add_ipc, reinit_globals,
allow_include_registry,
load_all_shares);
TALLOC_FREE(frame);
/*
* We run this check once the whole smb.conf is parsed, to
* force some settings for the standard way a AD DC is
- * operated. We may changed these as our code evolves, which
+ * operated. We may change these as our code evolves, which
* is why we force these settings.
*/
if (lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC) {
- lp_do_parameter(-1, "passdb backend", "samba_dsdb");
-
- lp_do_parameter(-1, "winbindd:use external pipes", "true");
-
- lp_do_parameter(-1, "rpc_server:default", "external");
- lp_do_parameter(-1, "rpc_server:svcctl", "embedded");
- lp_do_parameter(-1, "rpc_server:srvsvc", "embedded");
- lp_do_parameter(-1, "rpc_server:eventlog", "embedded");
- lp_do_parameter(-1, "rpc_server:ntsvcs", "embedded");
- lp_do_parameter(-1, "rpc_server:winreg", "embedded");
- lp_do_parameter(-1, "rpc_server:spoolss", "embedded");
- lp_do_parameter(-1, "rpc_daemon:spoolssd", "embedded");
- lp_do_parameter(-1, "rpc_server:tcpip", "no");
+ lp_enforce_ad_dc_settings();
}
bAllowIncludeRegistry = true;
return (bRetval);
}
-bool lp_load(const char *pszFname,
- bool global_only,
- bool save_defaults,
- bool add_ipc,
- bool initialize_globals)
+static bool lp_load(const char *pszFname,
+ bool global_only,
+ bool save_defaults,
+ bool add_ipc,
+ bool reinit_globals)
{
return lp_load_ex(pszFname,
global_only,
save_defaults,
add_ipc,
- initialize_globals,
+ reinit_globals,
true, /* allow_include_registry */
false); /* load_all_shares*/
}
{
return lp_load_ex(pszFname,
true, /* global only */
- false, /* save_defaults */
+ true, /* save_defaults */
false, /* add_ipc */
- true, /* initialize_globals */
+ true, /* reinit_globals */
false, /* allow_include_registry */
false); /* load_all_shares*/
}
*/
bool lp_load_global(const char *file_name)
{
- return lp_load_ex(file_name,
- true, /* global_only */
- false, /* save_defaults */
- false, /* add_ipc */
- true, /* initialize_globals */
- true, /* allow_include_registry */
- false); /* load_all_shares*/
+ return lp_load(file_name,
+ true, /* global_only */
+ false, /* save_defaults */
+ false, /* add_ipc */
+ true); /* reinit_globals */
+}
+
+/**
+ * The typical lp_load wrapper with shares, loads global and
+ * shares, including IPC, but does not force immediate
+ * loading of all shares from registry.
+ */
+bool lp_load_with_shares(const char *file_name)
+{
+ return lp_load(file_name,
+ false, /* global_only */
+ false, /* save_defaults */
+ true, /* add_ipc */
+ true); /* reinit_globals */
}
/**
*/
bool lp_load_global_no_reinit(const char *file_name)
{
- return lp_load_ex(file_name,
- true, /* global_only */
- false, /* save_defaults */
- false, /* add_ipc */
- false, /* initialize_globals */
- true, /* allow_include_registry */
- false); /* load_all_shares*/
+ return lp_load(file_name,
+ true, /* global_only */
+ false, /* save_defaults */
+ false, /* add_ipc */
+ false); /* reinit_globals */
+}
+
+/**
+ * lp_load wrapper, loading globals and shares,
+ * intended for subsequent calls, i.e. not reinitializing
+ * the globals to default values.
+ */
+bool lp_load_no_reinit(const char *file_name)
+{
+ return lp_load(file_name,
+ false, /* global_only */
+ false, /* save_defaults */
+ false, /* add_ipc */
+ false); /* reinit_globals */
}
+
/**
* lp_load wrapper, especially for clients, no reinitialization
*/
return lp_load_global_no_reinit(file_name);
}
-bool lp_load_with_registry_shares(const char *pszFname,
- bool global_only,
- bool save_defaults,
- bool add_ipc,
- bool initialize_globals)
+bool lp_load_with_registry_shares(const char *pszFname)
{
return lp_load_ex(pszFname,
- global_only,
- save_defaults,
- add_ipc,
- initialize_globals,
+ false, /* global_only */
+ true, /* save_defaults */
+ false, /* add_ipc */
+ false, /* reinit_globals */
true, /* allow_include_registry */
true); /* load_all_shares*/
}
if (show_defaults)
defaults_saved = false;
- lp_ctx = loadparm_init_s3(talloc_tos(),
- loadparm_s3_helpers());
+ lp_ctx = setup_lp_context(talloc_tos());
if (lp_ctx == NULL) {
- DEBUG(0, ("loadparm_init_s3 failed\n"));
return;
}
- lp_ctx->sDefault = &sDefault;
- lp_ctx->services = ServicePtrs;
-
lpcfg_dump_globals(lp_ctx, f, !defaults_saved);
lpcfg_dump_a_service(&sDefault, &sDefault, f, flags_list, show_defaults);
for (iService = iNumServices - 1; iService >= 0; iService--) {
if (VALID(iService) && ServicePtrs[iService]->szService) {
/*
- * The substitution here is used to support %U is
+ * The substitution here is used to support %U in
* service names
*/
fstrcpy(serviceName, ServicePtrs[iService]->szService);
bool lp_preferred_master(void)
{
- if (Globals.iPreferredMaster == Auto)
+ int preferred_master = lp__preferred_master();
+
+ if (preferred_master == Auto)
return (lp_local_master() && lp_domain_master());
- return (bool)Globals.iPreferredMaster;
+ return (bool)preferred_master;
}
/*******************************************************************
int lp_maxprintjobs(int snum)
{
- int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
+ int maxjobs = lp_max_print_jobs(snum);
+
if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
maxjobs = PRINT_MAX_JOBID - 1;
const char *lp_printcapname(void)
{
- if ((Globals.szPrintcapname != NULL) &&
- (Globals.szPrintcapname[0] != '\0'))
- return Globals.szPrintcapname;
+ const char *printcap_name = lp_printcap_name();
+
+ if ((printcap_name != NULL) &&
+ (printcap_name[0] != '\0'))
+ return printcap_name;
if (sDefault.printing == PRINT_CUPS) {
return "cups";
return PRINTCAP_NAME;
}
-static uint32 spoolss_state;
+static uint32_t spoolss_state;
bool lp_disable_spoolss( void )
{
return spoolss_state == SVCCTL_STOPPED ? true : false;
}
-void lp_set_spoolss_state( uint32 state )
+void lp_set_spoolss_state( uint32_t state )
{
SMB_ASSERT( (state == SVCCTL_STOPPED) || (state == SVCCTL_RUNNING) );
spoolss_state = state;
}
-uint32 lp_get_spoolss_state( void )
+uint32_t lp_get_spoolss_state( void )
{
return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
}
int lp_min_receive_file_size(void)
{
- if (Globals.iminreceivefile < 0) {
+ int min_receivefile_size = lp_min_receivefile_size();
+
+ if (min_receivefile_size < 0) {
return 0;
}
- return Globals.iminreceivefile;
+ return min_receivefile_size;
}
/*******************************************************************
lp__security());
}
+int lp_client_max_protocol(void)
+{
+ int client_max_protocol = lp__client_max_protocol();
+ if (client_max_protocol == PROTOCOL_DEFAULT) {
+ return PROTOCOL_NT1;
+ }
+ return client_max_protocol;
+}
+
+int lp_winbindd_max_protocol(void)
+{
+ int client_max_protocol = lp__client_max_protocol();
+ if (client_max_protocol == PROTOCOL_DEFAULT) {
+ return PROTOCOL_LATEST;
+ }
+ return client_max_protocol;
+}
+
struct loadparm_global * get_globals(void)
{
return &Globals;