Hi everyone,

First, I hope it is the right newsgroup to ask my question. If not, I'm
really sorry.

Here's the picture: I've made a DLL which encapsulates common LDAP functions
from iplanet LDAP DLLs. It works fine with plain text, non crypted
transactions.

Now, it got to work with SSL encryption: I use Stunnel to provide
server-side SSL support for OpenLDAP NT Port (from FiveSight).

So, I've changed my binding routine. But now, I'm facing a very strange
problem:
the binding function seems to work fine, but the DLL process itself seems to
be stuck and the caller application stops responding.

Here's a snippet:

LDAP * ld = NULL;

void bind( char * serverport, char * username, char * password, char *
usessl, char * certdbpath, long & error )
{
    error = 0;

    char server[MAXLEN], port[MAXLEN], time_out[MAXLEN];
    ULONG timeout;

    if( !split3( serverport, ":", server, port, time_out) )
    {
        error = CUSTOMERR;
        return;
    }

    if( time_out[0] == NULL )
        timeout = LDAP_NO_LIMIT;
    else timeout = atol(time_out);

    if( usessl != NULL && usessl[0] != NULL && usessl[0] == '1' )
    {
        // SSL
        if( ldapssl_client_init( certdbpath, NULL ) < 0 )
        {
            error = CUSTOMERR;
            return;
        }

     if ( (ld = ldapssl_init( server, atoi(port), 1 )) == NULL )
    {
          return;
     }

        ULONG i = LDAP_VERSION3;
         if ( ldap_set_option( ld, LDAP_OPT_PROTOCOL_VERSION, &i ) < 0 )
        {
              return;
        }
    }
    else
    {
        // no SSL

        ld = ldap_init(server, atoi(port));
        if( ld == NULL )
        {
            error = CUSTOMERR;
            return;
        }
    }

    error = ldap_simple_bind_s( ld, username, password);
    if( error != LDAP_SUCCESS )
        ldap_unbind_s( ld );


Anyone got the same problem ? I'm really stuck.

Thanks in advance.

Jacques.

NB: I'm using Borland C++ Builder 4, so I've got to make my own .lib






Reply via email to