summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-09-28 01:17:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:07:25 -0500
commit37d53832a4623653f706e77985a79d84bd7c6694 (patch)
tree265e308027d6641bbdb29a4feddbe86ef8b25fd1 /source4/lib
parente09226cb35d627affddc08c4a88527184b8ffcf9 (diff)
downloadsamba-37d53832a4623653f706e77985a79d84bd7c6694.tar.gz
samba-37d53832a4623653f706e77985a79d84bd7c6694.tar.bz2
samba-37d53832a4623653f706e77985a79d84bd7c6694.zip
r25398: Parse loadparm context to all lp_*() functions.
(This used to be commit 3fcc960839c6e5ca4de2c3c042f12f369ac5f238)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/cmdline/popt_common.c22
-rw-r--r--source4/lib/db_wrap.c4
-rw-r--r--source4/lib/registry/samba.c2
-rw-r--r--source4/lib/socket/connect.c2
-rw-r--r--source4/lib/socket/connect_multi.c2
-rw-r--r--source4/lib/socket/interface.c2
-rw-r--r--source4/lib/tls/tls.c14
7 files changed, 22 insertions, 26 deletions
diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c
index 6e0573e7ef..41eb70094e 100644
--- a/source4/lib/cmdline/popt_common.c
+++ b/source4/lib/cmdline/popt_common.c
@@ -23,6 +23,7 @@
#include "version.h"
#include "lib/cmdline/popt_common.h"
#include "param/param.h"
+#include "dynconfig.h"
/* Handle command line options:
* -d,--debuglevel
@@ -40,8 +41,6 @@ enum {OPT_OPTION=1,OPT_LEAK_REPORT,OPT_LEAK_REPORT_FULL,OPT_DEBUG_STDERR};
struct cli_credentials *cmdline_credentials = NULL;
-static bool PrintSambaVersionString;
-
static void popt_common_callback(poptContext con,
enum poptCallbackReason reason,
const struct poptOption *opt,
@@ -50,12 +49,12 @@ static void popt_common_callback(poptContext con,
const char *pname;
if (reason == POPT_CALLBACK_REASON_POST) {
- if (PrintSambaVersionString) {
- printf( "Version %s\n", SAMBA_VERSION_STRING );
- exit(0);
+ if (!lp_loaded()) {
+ if (getenv("SMB_CONF_PATH"))
+ lp_load(getenv("SMB_CONF_PATH"));
+ else
+ lp_load(dyn_CONFIGFILE);
}
-
- lp_load();
/* Hook any 'every Samba program must do this, after
* the smb.conf is setup' functions here */
return;
@@ -77,9 +76,6 @@ static void popt_common_callback(poptContext con,
/* and logging */
setup_logging(pname, DEBUG_STDOUT);
- if (getenv("SMB_CONF_PATH")) {
- lp_set_cmdline(global_loadparm, "config file", getenv("SMB_CONF_PATH"));
- }
return;
}
@@ -93,8 +89,8 @@ static void popt_common_callback(poptContext con,
break;
case 'V':
- PrintSambaVersionString = true;
- break;
+ printf("Version %s\n", SAMBA_VERSION_STRING );
+ exit(0);
case 'O':
if (arg) {
@@ -104,7 +100,7 @@ static void popt_common_callback(poptContext con,
case 's':
if (arg) {
- lp_set_cmdline(global_loadparm, "config file", arg);
+ lp_load(arg);
}
break;
diff --git a/source4/lib/db_wrap.c b/source4/lib/db_wrap.c
index 92e4758f44..82521f2e7e 100644
--- a/source4/lib/db_wrap.c
+++ b/source4/lib/db_wrap.c
@@ -121,7 +121,7 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
}
ldb_set_modules_dir(ldb,
- talloc_asprintf(ldb, "%s/ldb", lp_modulesdir()));
+ talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(global_loadparm)));
/* we want to use the existing event context if possible. This
relies on the fact that in smbd, everything is a child of
@@ -143,7 +143,7 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
return NULL;
}
- if (strcmp(lp_sam_url(), url) == 0) {
+ if (strcmp(lp_sam_url(global_loadparm), url) == 0) {
dsdb_set_global_schema(ldb);
}
diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c
index dfb69abb33..48eb043306 100644
--- a/source4/lib/registry/samba.c
+++ b/source4/lib/registry/samba.c
@@ -35,7 +35,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
struct hive_key *hive;
const char *location;
- location = talloc_asprintf(ctx, "%s/%s.ldb", lp_private_dir(), name);
+ location = talloc_asprintf(ctx, "%s/%s.ldb", lp_private_dir(global_loadparm), name);
error = reg_open_hive(ctx, location, auth_info, creds, &hive);
diff --git a/source4/lib/socket/connect.c b/source4/lib/socket/connect.c
index fe8bc5cf13..eca2067df1 100644
--- a/source4/lib/socket/connect.c
+++ b/source4/lib/socket/connect.c
@@ -127,7 +127,7 @@ struct composite_context *socket_connect_send(struct socket_context *sock,
struct composite_context *creq;
make_nbt_name_client(&name, server_address->addr);
creq = resolve_name_send(&name, result->event_ctx,
- lp_name_resolve_order());
+ lp_name_resolve_order(global_loadparm));
if (composite_nomem(creq, result)) return result;
composite_continue(result, creq, continue_resolve_name, result);
return result;
diff --git a/source4/lib/socket/connect_multi.c b/source4/lib/socket/connect_multi.c
index 445a1da782..6d30141459 100644
--- a/source4/lib/socket/connect_multi.c
+++ b/source4/lib/socket/connect_multi.c
@@ -104,7 +104,7 @@ _PUBLIC_ struct composite_context *socket_connect_multi_send(
struct composite_context *creq;
make_nbt_name_client(&name, server_address);
creq = resolve_name_send(&name, result->event_ctx,
- lp_name_resolve_order());
+ lp_name_resolve_order(global_loadparm));
if (composite_nomem(creq, result)) goto failed;
composite_continue(result, creq, continue_resolve_name, result);
return result;
diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c
index 992476fe22..a30e4b8af7 100644
--- a/source4/lib/socket/interface.c
+++ b/source4/lib/socket/interface.c
@@ -200,7 +200,7 @@ static void load_interfaces(void)
return;
}
- ptr = lp_interfaces();
+ ptr = lp_interfaces(global_loadparm);
loopback_ip = interpret_addr2("127.0.0.1");
/* probe the kernel for interfaces */
diff --git a/source4/lib/tls/tls.c b/source4/lib/tls/tls.c
index 71b120dc3c..8be818433d 100644
--- a/source4/lib/tls/tls.c
+++ b/source4/lib/tls/tls.c
@@ -357,11 +357,11 @@ struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx)
struct tls_params *params;
int ret;
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
- const char *keyfile = private_path(tmp_ctx, lp_tls_keyfile());
- const char *certfile = private_path(tmp_ctx, lp_tls_certfile());
- const char *cafile = private_path(tmp_ctx, lp_tls_cafile());
- const char *crlfile = private_path(tmp_ctx, lp_tls_crlfile());
- const char *dhpfile = private_path(tmp_ctx, lp_tls_dhpfile());
+ const char *keyfile = private_path(tmp_ctx, lp_tls_keyfile(global_loadparm));
+ const char *certfile = private_path(tmp_ctx, lp_tls_certfile(global_loadparm));
+ const char *cafile = private_path(tmp_ctx, lp_tls_cafile(global_loadparm));
+ const char *crlfile = private_path(tmp_ctx, lp_tls_crlfile(global_loadparm));
+ const char *dhpfile = private_path(tmp_ctx, lp_tls_dhpfile(global_loadparm));
void tls_cert_generate(TALLOC_CTX *, const char *, const char *, const char *);
params = talloc(mem_ctx, struct tls_params);
@@ -370,7 +370,7 @@ struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx)
return NULL;
}
- if (!lp_tls_enabled() || keyfile == NULL || *keyfile == 0) {
+ if (!lp_tls_enabled(global_loadparm) || keyfile == NULL || *keyfile == 0) {
params->tls_enabled = False;
talloc_free(tmp_ctx);
return params;
@@ -565,7 +565,7 @@ struct socket_context *tls_init_client(struct socket_context *socket,
}
new_sock->private_data = tls;
- cafile = private_path(tls, lp_tls_cafile());
+ cafile = private_path(tls, lp_tls_cafile(global_loadparm));
if (!cafile || !*cafile) {
goto failed;
}