summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/ldap/ldap_bind.c2
-rw-r--r--source4/libcli/ldap/ldap_client.c13
-rw-r--r--source4/libcli/ldap/ldap_client.h2
3 files changed, 11 insertions, 6 deletions
diff --git a/source4/libcli/ldap/ldap_bind.c b/source4/libcli/ldap/ldap_bind.c
index ba1ae90ebd..bd548be38e 100644
--- a/source4/libcli/ldap/ldap_bind.c
+++ b/source4/libcli/ldap/ldap_bind.c
@@ -44,7 +44,7 @@ NTSTATUS ldap_rebind(struct ldap_connection *conn)
switch (conn->bind.type) {
case LDAP_BIND_SASL:
status = ldap_bind_sasl(conn, (struct cli_credentials *)conn->bind.creds,
- global_loadparm);
+ conn->lp_ctx);
break;
case LDAP_BIND_SIMPLE:
diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c
index c859b4a4d1..906e9c2574 100644
--- a/source4/libcli/ldap/ldap_client.c
+++ b/source4/libcli/ldap/ldap_client.c
@@ -37,11 +37,12 @@
#include "param/param.h"
-/*
+/**
create a new ldap_connection stucture. The event context is optional
*/
struct ldap_connection *ldap4_new_connection(TALLOC_CTX *mem_ctx,
- struct event_context *ev)
+ struct loadparm_context *lp_ctx,
+ struct event_context *ev)
{
struct ldap_connection *conn;
@@ -61,6 +62,8 @@ struct ldap_connection *ldap4_new_connection(TALLOC_CTX *mem_ctx,
conn->next_messageid = 1;
conn->event.event_ctx = ev;
+ conn->lp_ctx = lp_ctx;
+
/* set a reasonable request timeout */
conn->timeout = 60;
@@ -352,7 +355,7 @@ struct composite_context *ldap_connect_send(struct ldap_connection *conn,
}
ctx = socket_connect_send(conn->sock, NULL, unix_addr,
- 0, lp_name_resolve_order(global_loadparm), conn->event.event_ctx);
+ 0, lp_name_resolve_order(conn->lp_ctx), conn->event.event_ctx);
ctx->async.fn = ldap_connect_recv_unix_conn;
ctx->async.private_data = state;
return result;
@@ -365,7 +368,7 @@ struct composite_context *ldap_connect_send(struct ldap_connection *conn,
}
ctx = socket_connect_multi_send(state, conn->host, 1, &conn->port,
- lp_name_resolve_order(global_loadparm), conn->event.event_ctx);
+ lp_name_resolve_order(conn->lp_ctx), conn->event.event_ctx);
if (ctx == NULL) goto failed;
ctx->async.fn = ldap_connect_recv_tcp_conn;
@@ -394,7 +397,7 @@ static void ldap_connect_got_sock(struct composite_context *ctx,
talloc_steal(conn, conn->sock);
if (conn->ldaps) {
struct socket_context *tls_socket;
- char *cafile = private_path(conn->sock, global_loadparm, lp_tls_cafile(global_loadparm));
+ char *cafile = private_path(conn->sock, conn->lp_ctx, lp_tls_cafile(conn->lp_ctx));
if (!cafile || !*cafile) {
talloc_free(conn->sock);
diff --git a/source4/libcli/ldap/ldap_client.h b/source4/libcli/ldap/ldap_client.h
index d2a12ee8b5..d5ff441aff 100644
--- a/source4/libcli/ldap/ldap_client.h
+++ b/source4/libcli/ldap/ldap_client.h
@@ -51,6 +51,8 @@ struct ldap_request {
/* main context for a ldap client connection */
struct ldap_connection {
struct socket_context *sock;
+ struct loadparm_context *lp_ctx;
+
char *host;
uint16_t port;
bool ldaps;