summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-10 18:41:55 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:49:17 +0100
commitf055893ca571fbeac3675c02344c7cc53106bea1 (patch)
tree1dfa4dc151018102d18a219b9a6e20c1c78ae913
parent274d07ddff5c5920b9a2f3674e9104d8aab9e90c (diff)
downloadsamba-f055893ca571fbeac3675c02344c7cc53106bea1.tar.gz
samba-f055893ca571fbeac3675c02344c7cc53106bea1.tar.bz2
samba-f055893ca571fbeac3675c02344c7cc53106bea1.zip
r26382: Remove more uses of global_loadparm.
(This used to be commit 6d4c59853481855c232e7cf97264a391f40af2b5)
-rw-r--r--source4/auth/credentials/credentials.c2
-rw-r--r--source4/libcli/wrepl/winsrepl.c8
-rw-r--r--source4/libcli/wrepl/winsrepl.h2
-rw-r--r--source4/librpc/rpc/dcerpc_util.c1
-rw-r--r--source4/ntvfs/ipc/rap_server.c3
-rw-r--r--source4/param/share.c10
-rw-r--r--source4/rpc_server/srvsvc/dcesrv_srvsvc.c16
-rw-r--r--source4/rpc_server/srvsvc/srvsvc_ntvfs.c3
-rw-r--r--source4/smb_server/smb_server.c3
-rw-r--r--source4/torture/masktest.c2
-rw-r--r--source4/torture/nbt/winsreplication.c12
-rw-r--r--source4/wrepl_server/wrepl_out_helpers.c8
12 files changed, 34 insertions, 36 deletions
diff --git a/source4/auth/credentials/credentials.c b/source4/auth/credentials/credentials.c
index f4530f4b3c..089af8f0f5 100644
--- a/source4/auth/credentials/credentials.c
+++ b/source4/auth/credentials/credentials.c
@@ -82,7 +82,6 @@ struct cli_credentials *cli_credentials_init_anon(TALLOC_CTX *mem_ctx)
struct cli_credentials *anon_credentials;
anon_credentials = cli_credentials_init(mem_ctx);
- cli_credentials_set_conf(anon_credentials, global_loadparm);
cli_credentials_set_anonymous(anon_credentials);
return anon_credentials;
@@ -720,6 +719,7 @@ void cli_credentials_set_anonymous(struct cli_credentials *cred)
cli_credentials_set_username(cred, "", CRED_SPECIFIED);
cli_credentials_set_domain(cred, "", CRED_SPECIFIED);
cli_credentials_set_password(cred, NULL, CRED_SPECIFIED);
+ cli_credentials_set_realm(cred, NULL, CRED_SPECIFIED);
}
/**
diff --git a/source4/libcli/wrepl/winsrepl.c b/source4/libcli/wrepl/winsrepl.c
index 00346c45a4..92543be487 100644
--- a/source4/libcli/wrepl/winsrepl.c
+++ b/source4/libcli/wrepl/winsrepl.c
@@ -313,6 +313,7 @@ static void wrepl_connect_handler(struct composite_context *creq)
connect a wrepl_socket to a WINS server
*/
struct composite_context *wrepl_connect_send(struct wrepl_socket *wrepl_socket,
+ struct resolve_context *resolve_ctx,
const char *our_ip, const char *peer_ip)
{
struct composite_context *result;
@@ -344,7 +345,7 @@ struct composite_context *wrepl_connect_send(struct wrepl_socket *wrepl_socket,
if (composite_nomem(peer, result)) return result;
state->creq = socket_connect_send(wrepl_socket->sock, us, peer,
- 0, lp_resolve_context(global_loadparm),
+ 0, resolve_ctx,
wrepl_socket->event.ctx);
composite_continue(result, state->creq, wrepl_connect_handler, state);
return result;
@@ -371,9 +372,10 @@ NTSTATUS wrepl_connect_recv(struct composite_context *result)
/*
connect a wrepl_socket to a WINS server - sync API
*/
-NTSTATUS wrepl_connect(struct wrepl_socket *wrepl_socket, const char *our_ip, const char *peer_ip)
+NTSTATUS wrepl_connect(struct wrepl_socket *wrepl_socket, struct resolve_context *resolve_ctx,
+ const char *our_ip, const char *peer_ip)
{
- struct composite_context *c_req = wrepl_connect_send(wrepl_socket, our_ip, peer_ip);
+ struct composite_context *c_req = wrepl_connect_send(wrepl_socket, resolve_ctx, our_ip, peer_ip);
return wrepl_connect_recv(c_req);
}
diff --git a/source4/libcli/wrepl/winsrepl.h b/source4/libcli/wrepl/winsrepl.h
index 8ce8b418a2..52b0bee69e 100644
--- a/source4/libcli/wrepl/winsrepl.h
+++ b/source4/libcli/wrepl/winsrepl.h
@@ -154,4 +154,6 @@ struct wrepl_pull_names {
} out;
};
+struct resolve_context;
+
#include "libcli/wrepl/winsrepl_proto.h"
diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c
index 32cee4308e..2fa34140f6 100644
--- a/source4/librpc/rpc/dcerpc_util.c
+++ b/source4/librpc/rpc/dcerpc_util.c
@@ -939,7 +939,6 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
/* anonymous credentials for rpc connection used to get endpoint mapping */
anon_creds = cli_credentials_init(mem_ctx);
cli_credentials_set_event_context(anon_creds, ev);
- cli_credentials_set_conf(anon_creds, global_loadparm);
cli_credentials_set_anonymous(anon_creds);
/*
diff --git a/source4/ntvfs/ipc/rap_server.c b/source4/ntvfs/ipc/rap_server.c
index d1a4dd9edc..9113bef894 100644
--- a/source4/ntvfs/ipc/rap_server.c
+++ b/source4/ntvfs/ipc/rap_server.c
@@ -23,6 +23,7 @@
#include "libcli/rap/rap.h"
#include "librpc/gen_ndr/srvsvc.h"
#include "rpc_server/common/common.h"
+#include "param/param.h"
/* At this moment these are just dummy functions, but you might get the
* idea. */
@@ -40,7 +41,7 @@ NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx,
r->out.available = 0;
r->out.info = NULL;
- nterr = share_get_context(mem_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(global_loadparm), &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return nterr;
}
diff --git a/source4/param/share.c b/source4/param/share.c
index 7ee1d8037a..4b747f85ae 100644
--- a/source4/param/share.c
+++ b/source4/param/share.c
@@ -126,9 +126,8 @@ NTSTATUS share_register(const struct share_ops *ops)
return NT_STATUS_OK;
}
-NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx,
- const char *backend_name,
- struct share_context **ctx)
+NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name,
+ struct share_context **ctx)
{
const struct share_ops *ops;
@@ -141,11 +140,6 @@ NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx,
return ops->init(mem_ctx, ops, ctx);
}
-NTSTATUS share_get_context(TALLOC_CTX *mem_ctx, struct share_context **ctx)
-{
- return share_get_context_by_name(mem_ctx, lp_share_backend(global_loadparm), ctx);
-}
-
/*
initialise the SHARE subsystem
*/
diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
index 55a647b7ef..b9e097356a 100644
--- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
+++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
@@ -444,7 +444,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
int count = 8;
int i;
- nterr = share_get_context(mem_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -542,7 +542,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
int count = 10;
int i;
- nterr = share_get_context(mem_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -734,7 +734,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call,
/* TODO: - paging of results
*/
- nterr = share_get_context(mem_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -983,7 +983,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call,
return WERR_INVALID_PARAM;
}
- nterr = share_get_context(mem_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -1237,7 +1237,7 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call,
return WERR_INVALID_PARAM;
}
- nterr = share_get_context(mem_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -1414,7 +1414,7 @@ static WERROR dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TA
}
all_string_sub(device, "\\", "/", 0);
- nterr = share_get_context(mem_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -1828,7 +1828,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL
/* TODO: - paging of results
*/
- nterr = share_get_context(mem_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
@@ -2291,7 +2291,7 @@ static WERROR dcesrv_srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALL
NTSTATUS nterr;
struct share_context *sctx;
- nterr = share_get_context(mem_ctx, &sctx);
+ nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
if (!NT_STATUS_IS_OK(nterr)) {
return ntstatus_to_werror(nterr);
}
diff --git a/source4/rpc_server/srvsvc/srvsvc_ntvfs.c b/source4/rpc_server/srvsvc/srvsvc_ntvfs.c
index 21fbc53f2c..c9c8e2e820 100644
--- a/source4/rpc_server/srvsvc/srvsvc_ntvfs.c
+++ b/source4/rpc_server/srvsvc/srvsvc_ntvfs.c
@@ -25,6 +25,7 @@
#include "rpc_server/common/common.h"
#include "rpc_server/srvsvc/proto.h"
#include "lib/socket/socket.h"
+#include "param/param.h"
struct socket_address *srvsvc_get_my_addr(void *p, TALLOC_CTX *mem_ctx)
{
@@ -61,7 +62,7 @@ NTSTATUS srvsvc_create_ntvfs_context(struct dcesrv_call_state *dce_call,
struct share_config *scfg;
const char *sharetype;
- status = share_get_context(mem_ctx, &sctx);
+ status = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), &sctx);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c
index c91566e244..c1581f8842 100644
--- a/source4/smb_server/smb_server.c
+++ b/source4/smb_server/smb_server.c
@@ -156,7 +156,8 @@ static void smbsrv_accept(struct stream_connection *conn)
smbsrv_management_init(smb_conn);
- if (!NT_STATUS_IS_OK(share_get_context(smb_conn, &(smb_conn->share_context)))) {
+ if (!NT_STATUS_IS_OK(share_get_context_by_name(smb_conn, lp_share_backend(smb_conn->lp_ctx),
+ &(smb_conn->share_context)))) {
smbsrv_terminate_connection(smb_conn, "share_init failed!");
return;
}
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index dab8193753..63ad6027a1 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -287,8 +287,6 @@ static void usage(void)
setup_logging("masktest", DEBUG_STDOUT);
- lp_set_cmdline(global_loadparm, "log level", "0");
-
if (argc < 2 || argv[1][0] == '-') {
usage();
exit(1);
diff --git a/source4/torture/nbt/winsreplication.c b/source4/torture/nbt/winsreplication.c
index f67b6050f2..fc88d7fce1 100644
--- a/source4/torture/nbt/winsreplication.c
+++ b/source4/torture/nbt/winsreplication.c
@@ -107,10 +107,10 @@ static bool test_assoc_ctx1(struct torture_context *tctx)
wrepl_socket2 = wrepl_socket_init(tctx, NULL);
torture_comment(tctx, "Setup 2 wrepl connections\n");
- status = wrepl_connect(wrepl_socket1, NULL, address);
+ status = wrepl_connect(wrepl_socket1, lp_resolve_context(tctx->lp_ctx), NULL, address);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
- status = wrepl_connect(wrepl_socket2, NULL, address);
+ status = wrepl_connect(wrepl_socket2, lp_resolve_context(tctx->lp_ctx), NULL, address);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
torture_comment(tctx, "Send a start association request (conn1)\n");
@@ -189,7 +189,7 @@ static bool test_assoc_ctx2(struct torture_context *tctx)
wrepl_socket = wrepl_socket_init(tctx, NULL);
torture_comment(tctx, "Setup wrepl connections\n");
- status = wrepl_connect(wrepl_socket, NULL, address);
+ status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), NULL, address);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
torture_comment(tctx, "Send 1st start association request\n");
@@ -258,7 +258,7 @@ static bool test_wins_replication(struct torture_context *tctx)
wrepl_socket = wrepl_socket_init(tctx, NULL);
torture_comment(tctx, "Setup wrepl connections\n");
- status = wrepl_connect(wrepl_socket, NULL, address);
+ status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), NULL, address);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
torture_comment(tctx, "Send a start association request\n");
@@ -556,7 +556,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
if (!ctx->pull) return NULL;
torture_comment(tctx, "Setup wrepl conflict pull connection\n");
- status = wrepl_connect(ctx->pull, NULL, ctx->address);
+ status = wrepl_connect(ctx->pull, lp_resolve_context(tctx->lp_ctx), NULL, ctx->address);
if (!NT_STATUS_IS_OK(status)) return NULL;
status = wrepl_associate(ctx->pull, &associate);
@@ -721,7 +721,7 @@ static bool test_wrepl_update_one(struct torture_context *tctx,
wrepl_socket = wrepl_socket_init(ctx, NULL);
- status = wrepl_connect(wrepl_socket, NULL, ctx->address);
+ status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), NULL, ctx->address);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
status = wrepl_associate(wrepl_socket, &associate);
diff --git a/source4/wrepl_server/wrepl_out_helpers.c b/source4/wrepl_server/wrepl_out_helpers.c
index 2599ef4d09..f809095f22 100644
--- a/source4/wrepl_server/wrepl_out_helpers.c
+++ b/source4/wrepl_server/wrepl_out_helpers.c
@@ -29,6 +29,7 @@
#include "nbt_server/wins/winsdb.h"
#include "libcli/composite/composite.h"
#include "libcli/wrepl/winsrepl.h"
+#include "libcli/resolve/resolve.h"
enum wreplsrv_out_connect_stage {
WREPLSRV_OUT_CONNECT_STAGE_WAIT_SOCKET,
@@ -191,6 +192,7 @@ static struct composite_context *wreplsrv_out_connect_send(struct wreplsrv_partn
state->stage = WREPLSRV_OUT_CONNECT_STAGE_WAIT_SOCKET;
state->wreplconn= wreplconn;
state->c_req = wrepl_connect_send(wreplconn->sock,
+ lp_resolve_context(service->task->lp_ctx),
partner->our_address,
partner->address);
if (!state->c_req) goto failed;
@@ -379,8 +381,7 @@ static NTSTATUS wreplsrv_pull_table_recv(struct composite_context *c, TALLOC_CTX
struct wreplsrv_pull_table_state *state = talloc_get_type(c->private_data,
struct wreplsrv_pull_table_state);
io->out.num_owners = state->table_io.out.num_partners;
- io->out.owners = state->table_io.out.partners;
- talloc_reference(mem_ctx, state->table_io.out.partners);
+ io->out.owners = talloc_reference(mem_ctx, state->table_io.out.partners);
}
talloc_free(c);
@@ -535,8 +536,7 @@ static NTSTATUS wreplsrv_pull_names_recv(struct composite_context *c, TALLOC_CTX
struct wreplsrv_pull_names_state *state = talloc_get_type(c->private_data,
struct wreplsrv_pull_names_state);
io->out.num_names = state->pull_io.out.num_names;
- io->out.names = state->pull_io.out.names;
- talloc_reference(mem_ctx, state->pull_io.out.names);
+ io->out.names = talloc_reference(mem_ctx, state->pull_io.out.names);
}
talloc_free(c);