[Date Prev][Date Next] [Chronological] [Thread] [Top]

Problem connecting to LDAP server with TLS when using the LDAP server IP address


I hope I am posting this to the right group.

I have an application that is using OpenLDAP to communicate with a
Novell eDirectory LDAP server over TLS/SSL (Am not very sure of the
difference. I have got the CA certificate from the server. However I see
a problem when my application tries to connect to the LDAP server using
the IP address of the LDAP server. I get a "Could not find LDAP server"
error. I don't see any problem when I use the DNS name of the LDAP
I am using the following code to initialize the connection:

        int SSLmode = LDAP_OPT_X_TLS_HARD;
        LDAP *ld = ldap_init(host, port);
        if(ld == NULL)
                return NULL;

        rc = ldap_set_option(ld, LDAP_OPT_X_TLS, &SSLmode);
        if(rc != LDAP_SUCCESS)
                return NULL;
        rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_CACERTFILE, cert);
        if(rc != LDAP_SUCCESS)
               return NULL;

Does anyone know why this is happening? Is there any way to get around