diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-03 21:25:06 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:47:42 +0100 |
commit | 2f8dc4f48f1802baa3405e7803563f6840e0d1b3 (patch) | |
tree | a479c7df067cb698134616bc6be8fa2fd76c7452 /source4 | |
parent | c9f0011bc57e6536f4ec130784d15609e71aa694 (diff) | |
download | samba-2f8dc4f48f1802baa3405e7803563f6840e0d1b3.tar.gz samba-2f8dc4f48f1802baa3405e7803563f6840e0d1b3.tar.bz2 samba-2f8dc4f48f1802baa3405e7803563f6840e0d1b3.zip |
r26266: Remove more global_loadparm uses.
(This used to be commit 99113075c4a96679bcec4f4d6bba4acb3dee4245)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/client/client.c | 2 | ||||
-rw-r--r-- | source4/ldap_server/ldap_backend.c | 5 | ||||
-rw-r--r-- | source4/ldap_server/ldap_bind.c | 6 | ||||
-rw-r--r-- | source4/ldap_server/ldap_server.c | 5 | ||||
-rw-r--r-- | source4/ldap_server/ldap_server.h | 1 | ||||
-rw-r--r-- | source4/lib/events/events.c | 5 | ||||
-rw-r--r-- | source4/lib/messaging/tests/irpc.c | 4 | ||||
-rw-r--r-- | source4/lib/messaging/tests/messaging.c | 13 | ||||
-rw-r--r-- | source4/lib/util/util_ldb.h | 55 | ||||
-rw-r--r-- | source4/libcli/cliconnect.c | 10 | ||||
-rw-r--r-- | source4/libcli/ldap/ldap_client.c | 3 | ||||
-rw-r--r-- | source4/libcli/raw/clisocket.c | 3 | ||||
-rw-r--r-- | source4/libcli/raw/clitransport.c | 8 | ||||
-rw-r--r-- | source4/libcli/smb2/connect.c | 6 | ||||
-rw-r--r-- | source4/libcli/smb_composite/connect.c | 4 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_connect.c | 4 | ||||
-rw-r--r-- | source4/torture/basic/base.c | 2 |
17 files changed, 46 insertions, 90 deletions
diff --git a/source4/client/client.c b/source4/client/client.c index 0006459084..a2fe29fc60 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -3078,7 +3078,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c server_name = destip ? destip : desthost; - if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name)) { + if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, lp_name_resolve_order(global_loadparm), lp_max_xmit(global_loadparm), lp_maxmux(global_loadparm))) { d_printf("Connection to %s failed\n", server_name); return 1; } diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index a6697dfba8..346aacaa99 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -56,8 +56,9 @@ static int map_ldb_error(struct ldb_context *ldb, int err, const char **errstrin NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn) { conn->ldb = ldb_wrap_connect(conn, - global_loadparm, - lp_sam_url(global_loadparm), conn->session_info, + conn->lp_ctx, + lp_sam_url(conn->lp_ctx), + conn->session_info, NULL, conn->global_catalog ? LDB_FLG_RDONLY : 0, NULL); if (conn->ldb == NULL) { return NT_STATUS_INTERNAL_DB_CORRUPTION; diff --git a/source4/ldap_server/ldap_bind.c b/source4/ldap_server/ldap_bind.c index 874c9bfb49..53cef5b349 100644 --- a/source4/ldap_server/ldap_bind.c +++ b/source4/ldap_server/ldap_bind.c @@ -45,12 +45,12 @@ static NTSTATUS ldapsrv_BindSimple(struct ldapsrv_call *call) DEBUG(10, ("BindSimple dn: %s\n",req->dn)); - status = crack_auto_name_to_nt4_name(call, global_loadparm, req->dn, &nt4_domain, &nt4_account); + status = crack_auto_name_to_nt4_name(call, call->conn->lp_ctx, req->dn, &nt4_domain, &nt4_account); if (NT_STATUS_IS_OK(status)) { status = authenticate_username_pw(call, call->conn->connection->event.ctx, call->conn->connection->msg_ctx, - global_loadparm, + call->conn->lp_ctx, nt4_domain, nt4_account, req->creds.password, &session_info); @@ -143,7 +143,7 @@ static NTSTATUS ldapsrv_BindSASL(struct ldapsrv_call *call) status = gensec_server_start(conn, conn->connection->event.ctx, - global_loadparm, + conn->lp_ctx, conn->connection->msg_ctx, &conn->gensec); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c index 9d6de732cf..2898d131c9 100644 --- a/source4/ldap_server/ldap_server.c +++ b/source4/ldap_server/ldap_server.c @@ -345,6 +345,7 @@ static void ldapsrv_accept(struct stream_connection *c) conn->connection = c; conn->service = ldapsrv_service; conn->sockets.raw = c->socket; + conn->lp_ctx = global_loadparm; c->private = conn; @@ -395,7 +396,7 @@ static void ldapsrv_accept(struct stream_connection *c) return; } - cli_credentials_set_conf(server_credentials, global_loadparm); + cli_credentials_set_conf(server_credentials, conn->lp_ctx); status = cli_credentials_set_machine_account(server_credentials); if (!NT_STATUS_IS_OK(status)) { stream_terminate_connection(c, talloc_asprintf(conn, "Failed to obtain server credentials, perhaps a standalone server?: %s\n", nt_errstr(status))); @@ -404,7 +405,7 @@ static void ldapsrv_accept(struct stream_connection *c) conn->server_credentials = server_credentials; /* Connections start out anonymous */ - if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, global_loadparm, &conn->session_info))) { + if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, conn->lp_ctx, &conn->session_info))) { ldapsrv_terminate_connection(conn, "failed to setup anonymous session info"); return; } diff --git a/source4/ldap_server/ldap_server.h b/source4/ldap_server/ldap_server.h index df0bb92175..88af0fb5fc 100644 --- a/source4/ldap_server/ldap_server.h +++ b/source4/ldap_server/ldap_server.h @@ -23,6 +23,7 @@ #include "lib/stream/packet.h" struct ldapsrv_connection { + struct loadparm_context *lp_ctx; struct stream_connection *connection; struct gensec_security *gensec; struct auth_session_info *session_info; diff --git a/source4/lib/events/events.c b/source4/lib/events/events.c index 2b36c92491..fd736e46d8 100644 --- a/source4/lib/events/events.c +++ b/source4/lib/events/events.c @@ -183,11 +183,6 @@ struct event_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char event_backend_init(); -#if _SAMBA_BUILD_ - if (name == NULL) { - name = lp_parm_string(global_loadparm, NULL, "event", "backend"); - } -#endif if (name == NULL) { name = event_default_backend; } diff --git a/source4/lib/messaging/tests/irpc.c b/source4/lib/messaging/tests/irpc.c index aae6b4882e..28676c21c7 100644 --- a/source4/lib/messaging/tests/irpc.c +++ b/source4/lib/messaging/tests/irpc.c @@ -215,12 +215,12 @@ static bool irpc_setup(struct torture_context *tctx, void **_data) *_data = data = talloc(tctx, struct irpc_test_data); - lp_set_cmdline(global_loadparm, "pid directory", "piddir.tmp"); + lp_set_cmdline(tctx->lp_ctx, "pid directory", "piddir.tmp"); data->ev = tctx->ev; torture_assert(tctx, data->msg_ctx1 = messaging_init(tctx, - lp_messaging_path(tctx, global_loadparm), + lp_messaging_path(tctx, tctx->lp_ctx), cluster_id(MSG_ID1), data->ev), "Failed to init first messaging context"); diff --git a/source4/lib/messaging/tests/messaging.c b/source4/lib/messaging/tests/messaging.c index bf2b83a0e4..ba3d2f91d6 100644 --- a/source4/lib/messaging/tests/messaging.c +++ b/source4/lib/messaging/tests/messaging.c @@ -66,23 +66,22 @@ static bool test_ping_speed(struct torture_context *tctx) struct timeval tv; int timelimit = torture_setting_int(tctx, "timelimit", 10); uint32_t msg_ping, msg_exit; - TALLOC_CTX *mem_ctx = tctx; - lp_set_cmdline(global_loadparm, "pid directory", "piddir.tmp"); + lp_set_cmdline(tctx->lp_ctx, "pid directory", "piddir.tmp"); ev = tctx->ev; - msg_server_ctx = messaging_init(mem_ctx, - lp_messaging_path(tctx, global_loadparm), + msg_server_ctx = messaging_init(tctx, + lp_messaging_path(tctx, tctx->lp_ctx), cluster_id(1), ev); torture_assert(tctx, msg_server_ctx != NULL, "Failed to init ping messaging context"); messaging_register_tmp(msg_server_ctx, NULL, ping_message, &msg_ping); - messaging_register_tmp(msg_server_ctx, mem_ctx, exit_message, &msg_exit); + messaging_register_tmp(msg_server_ctx, tctx, exit_message, &msg_exit); - msg_client_ctx = messaging_init(mem_ctx, - lp_messaging_path(mem_ctx, global_loadparm), + msg_client_ctx = messaging_init(tctx, + lp_messaging_path(tctx, tctx->lp_ctx), cluster_id(2), ev); torture_assert(tctx, msg_client_ctx != NULL, diff --git a/source4/lib/util/util_ldb.h b/source4/lib/util/util_ldb.h deleted file mode 100644 index f4f56d6b18..0000000000 --- a/source4/lib/util/util_ldb.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __LIB_UTIL_UTIL_LDB_H__ -#define __LIB_UTIL_UTIL_LDB_H__ - -#undef _PRINTF_ATTRIBUTE -#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2) -/* This file was automatically generated by mkproto.pl. DO NOT EDIT */ - -#ifndef _PUBLIC_ -#define _PUBLIC_ -#endif - -#ifndef _PURE_ -#define _PURE_ -#endif - -#ifndef _NORETURN_ -#define _NORETURN_ -#endif - -#ifndef _DEPRECATED_ -#define _DEPRECATED_ -#endif - -#ifndef _WARN_UNUSED_RESULT_ -#define _WARN_UNUSED_RESULT_ -#endif - - -/* The following definitions come from lib/util/util_ldb.c */ - -int gendb_search_v(struct ldb_context *ldb, - TALLOC_CTX *mem_ctx, - struct ldb_dn *basedn, - struct ldb_message ***msgs, - const char * const *attrs, - const char *format, - va_list ap) _PRINTF_ATTRIBUTE(6,0); -int gendb_search(struct ldb_context *ldb, - TALLOC_CTX *mem_ctx, - struct ldb_dn *basedn, - struct ldb_message ***res, - const char * const *attrs, - const char *format, ...) _PRINTF_ATTRIBUTE(6,7); -int gendb_search_dn(struct ldb_context *ldb, - TALLOC_CTX *mem_ctx, - struct ldb_dn *dn, - struct ldb_message ***res, - const char * const *attrs); -int gendb_add_ldif(struct ldb_context *ldb, const char *ldif_string); -char *wrap_casefold(void *context, void *mem_ctx, const char *s); -#undef _PRINTF_ATTRIBUTE -#define _PRINTF_ATTRIBUTE(a1, a2) - -#endif /* __LIB_UTIL_UTIL_LDB_H__ */ - diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index 39f97f4d8c..b9fd06db1a 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -30,15 +30,19 @@ /* wrapper around smbcli_sock_connect() */ -bool smbcli_socket_connect(struct smbcli_state *cli, const char *server) +bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, + const char **name_resolve_order, + int max_xmit, int max_mux) { struct smbcli_socket *sock; - sock = smbcli_sock_connect_byname(server, 0, NULL, NULL); + sock = smbcli_sock_connect_byname(server, 0, NULL, name_resolve_order, + NULL); if (sock == NULL) return false; - cli->transport = smbcli_transport_init(sock, cli, true); + cli->transport = smbcli_transport_init(sock, cli, true, max_xmit, + max_mux); if (!cli->transport) { return false; } diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c index f1cfaad18b..2fe0c78555 100644 --- a/source4/libcli/ldap/ldap_client.c +++ b/source4/libcli/ldap/ldap_client.c @@ -377,7 +377,8 @@ struct composite_context *ldap_connect_send(struct ldap_connection *conn, return NULL; } -static void ldap_connect_got_sock(struct composite_context *ctx, struct ldap_connection *conn) +static void ldap_connect_got_sock(struct composite_context *ctx, + struct ldap_connection *conn) { /* setup a handler for events on this socket */ conn->event.fde = event_add_fd(conn->event.event_ctx, conn->sock, diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c index e3420313c5..6e12d8073d 100644 --- a/source4/libcli/raw/clisocket.c +++ b/source4/libcli/raw/clisocket.c @@ -199,6 +199,7 @@ resolve a hostname and connect ****************************************************************************/ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, int port, TALLOC_CTX *mem_ctx, + const char **name_resolve_order, struct event_context *event_ctx) { int name_type = NBT_NAME_SERVER; @@ -239,7 +240,7 @@ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, int port, make_nbt_name(&nbt_name, host, name_type); - status = resolve_name(&nbt_name, tmp_ctx, &address, event_ctx, lp_name_resolve_order(global_loadparm)); + status = resolve_name(&nbt_name, tmp_ctx, &address, event_ctx, name_resolve_order); if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); return NULL; diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index 0bf805910e..11df6c6c96 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -73,7 +73,9 @@ static NTSTATUS smbcli_transport_finish_recv(void *private, DATA_BLOB blob); */ struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock, TALLOC_CTX *parent_ctx, - bool primary) + bool primary, + int max_xmit, + int max_mux) { struct smbcli_transport *transport; @@ -88,8 +90,8 @@ struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock, transport->negotiate.protocol = PROTOCOL_NT1; transport->options.use_spnego = lp_use_spnego(global_loadparm) && lp_nt_status_support(global_loadparm); - transport->options.max_xmit = lp_max_xmit(global_loadparm); - transport->options.max_mux = lp_maxmux(global_loadparm); + transport->options.max_xmit = max_xmit; + transport->options.max_mux = max_mux; transport->options.request_timeout = SMB_REQUEST_TIMEOUT; transport->negotiate.max_xmit = transport->options.max_xmit; diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c index 6f05d56cd4..7cfaf59a65 100644 --- a/source4/libcli/smb2/connect.c +++ b/source4/libcli/smb2/connect.c @@ -163,6 +163,7 @@ static void continue_resolve(struct composite_context *creq) struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx, const char *host, const char *share, + const char **name_resolve_order, struct cli_credentials *credentials, struct event_context *ev) { @@ -187,8 +188,7 @@ struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx, ZERO_STRUCT(name); name.name = host; - creq = resolve_name_send(&name, c->event_ctx, - lp_name_resolve_order(global_loadparm)); + creq = resolve_name_send(&name, c->event_ctx, name_resolve_order); composite_continue(c, creq, continue_resolve, c); return c; } @@ -215,11 +215,13 @@ NTSTATUS smb2_connect_recv(struct composite_context *c, TALLOC_CTX *mem_ctx, */ NTSTATUS smb2_connect(TALLOC_CTX *mem_ctx, const char *host, const char *share, + const char **name_resolve_order, struct cli_credentials *credentials, struct smb2_tree **tree, struct event_context *ev) { struct composite_context *c = smb2_connect_send(mem_ctx, host, share, + name_resolve_order, credentials, ev); return smb2_connect_recv(c, mem_ctx, tree); } diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c index 0238d5c550..9579cd20b5 100644 --- a/source4/libcli/smb_composite/connect.c +++ b/source4/libcli/smb_composite/connect.c @@ -307,7 +307,9 @@ static NTSTATUS connect_socket(struct composite_context *c, NT_STATUS_NOT_OK_RETURN(status); /* the socket is up - we can initialise the smbcli transport layer */ - state->transport = smbcli_transport_init(state->sock, state, true); + state->transport = smbcli_transport_init(state->sock, state, true, + lp_max_xmit(global_loadparm), + lp_maxmux(global_loadparm)); NT_STATUS_HAVE_NO_MEMORY(state->transport); if (is_ipaddress(state->sock->hostname) && diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c index 2d6237634d..21f726c293 100644 --- a/source4/librpc/rpc/dcerpc_connect.c +++ b/source4/librpc/rpc/dcerpc_connect.c @@ -235,7 +235,9 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb2_send(TALLOC_C } /* send smb2 connect request */ - conn_req = smb2_connect_send(mem_ctx, s->io.binding->host, "IPC$", s->io.creds, + conn_req = smb2_connect_send(mem_ctx, s->io.binding->host, "IPC$", + lp_name_resolve_order(global_loadparm), + s->io.creds, c->event_ctx); composite_continue(c, conn_req, continue_smb2_connect, c); return c; diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index 3e6c16f088..24c0d292ac 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -51,7 +51,7 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx) goto failed; } - if (!smbcli_socket_connect(cli, host)) { + if (!smbcli_socket_connect(cli, host, lp_name_resolve_order(tctx->lp_ctx), lp_max_xmit(tctx->lp_ctx), lp_maxmux(tctx->lp_ctx))) { torture_comment(tctx, "Failed to connect with %s\n", host); goto failed; } |