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

assertion failure in liblber sockbuf.c

Hello all,

I am new to this list and rather new to LDAP. So I am hoping I am
sending this to the right list, doubted between openldap-dev and

I am writing a (corba) server that needs to do authentication
against an OpenLDAP server.

I wrote a C++ class to encapsulate binding and unbinding. The code
goes like this:

Connection::Connection(const char* hostname, int port,
			const char* dn, const char* pwd)
	throw (Exception &)
	:	dn_(dn)

	ACE_DEBUG((LM_DEBUG, "Initializing LDAP with dn=[%s] at [%s]:[%d]\n",
						dn_.c_str(), hostname, port));
	ACE_DEBUG((LM_DEBUG, "Password: [%s]\n", pwd));

	ld = ldap_init(hostname, port);
	if (!ld) {
		cerr << "Failed initializing LDAP\n";
		throw Exception(strerror(errno));

	ACE_DEBUG((LM_DEBUG, "LDAP Initialized\n"));

	// We are an LDAP V3 client.
	int version = LDAP_VERSION3;
	ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version);

	ACE_DEBUG((LM_DEBUG, "LDAP Options set\n"));

	// Bind to the LDAP server.

	int rc;
	if (strcmp(pwd, "") == 0)
		rc = ldap_simple_bind_s(ld, dn_.c_str(), NULL);
		rc = ldap_simple_bind_s(ld, dn_.c_str(), pwd);

	if (rc != LDAP_SUCCESS) {
		cerr << "Failed binding to LDAP\n";
		throw Exception(ldap_err2string(rc));

	ACE_DEBUG((LM_DEBUG, "LDAP bind succeeded\n"));

	ACE_DEBUG((LM_DEBUG, "LDAP Destructor\n"));

The first time I connect everything goes fine. The destructor is
called ( I can see the log msg) so the ld strucure gets free'd.

The second time I connect with the same dn, I get when calling
ldap_simple_bind_s (I can see the "LDAP Options set" message, pwd is
also *not* NULL):

useragent: sockbuf.c:76: ber_sockbuf_ctrl: Assertion `( ( sb
)->sb_opts.lbo_valid == 0x3 )' failed.
./run: line 37:  9701 Aborted                 ./useragent/useragent

I only found one reference in the archives to a similar msg, but it
was about the assertion in line 75.

Does anybody have a clue as to what may be the problem? I am using
OpenLDAP package from debian woody(testing) distribution, this is:
OpenLDAP 2.0.14.

Thanks for any input.