1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-25 17:57:42 +03:00

r26266: Remove more global_loadparm uses.

(This used to be commit 99113075c4a96679bcec4f4d6bba4acb3dee4245)
This commit is contained in:
Jelmer Vernooij 2007-12-03 21:25:06 +01:00 committed by Stefan Metzmacher
parent c9f0011bc5
commit 2f8dc4f48f
17 changed files with 46 additions and 90 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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)) {

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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");

View File

@ -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,

View File

@ -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__ */

View File

@ -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;
}

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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) &&

View File

@ -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;

View File

@ -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;
}