From 556aab78a0ff18505f7c8561586abc977adf8e43 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 4 Sep 2006 03:59:04 +0000 Subject: r18025: Don't try to set a target host if there isn't one (such as with ldapi://). Andrew Bartlett (This used to be commit 556a21faeed0b6e3cc6efcfa8e0939b151a802de) --- source4/libcli/ldap/ldap_bind.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source4/libcli/ldap/ldap_bind.c') diff --git a/source4/libcli/ldap/ldap_bind.c b/source4/libcli/ldap/ldap_bind.c index 4fdd87a25b..f617cbe102 100644 --- a/source4/libcli/ldap/ldap_bind.c +++ b/source4/libcli/ldap/ldap_bind.c @@ -236,11 +236,13 @@ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn, struct cli_credentials *cr goto failed; } - status = gensec_set_target_hostname(conn->gensec, conn->host); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(1, ("Failed to set GENSEC target hostname: %s\n", - nt_errstr(status))); - goto failed; + if (conn->host) { + status = gensec_set_target_hostname(conn->gensec, conn->host); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1, ("Failed to set GENSEC target hostname: %s\n", + nt_errstr(status))); + goto failed; + } } status = gensec_set_target_service(conn->gensec, "ldap"); -- cgit