r18025: Don't try to set a target host if there isn't one (such as with ldapi://).
authorAndrew Bartlett <abartlet@samba.org>
Mon, 4 Sep 2006 03:59:04 +0000 (03:59 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:17:04 +0000 (14:17 -0500)
Andrew Bartlett
(This used to be commit 556a21faeed0b6e3cc6efcfa8e0939b151a802de)

source4/libcli/ldap/ldap_bind.c

index 4fdd87a25b7a3a4b9f359633be5d44c0d9155f0c..f617cbe1020a0cf2dae5dd2d59ad067f98392457 100644 (file)
@@ -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");