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

ldap_unbind 2.0.11



Folks,

just wondering whether somebody is fixing ldap_unbind in 2.0.11.

Following just happened at my site here:
void clean_up(void)
{
	/* Snippets */
	ldap_memfree(user_dn);
	ldap_unbind(ldap_connection);
}

$ make
$ src/login
SIGSEGV caught. Program Terminated.
$ gdb src/login
(gdb) run
Starting program: .../src/login
...
Program received signal SIGSEGV, Segmentation fault.
ldap_ld_free (ld=0x0, close=1, sctrls=0x0, cctrls=0x0) at unbind.c:70
70      unbind.c: No such file or directory.

Obviously, my ldap_connection was a (LDAP *) 0.
BUT, user_dn has been (LDAPMessage *) 0 as well, and that one doesn't
break...

Snippet from ber_memfree (which is the function called in the end by
ldap_memfree:
if(p == NULL ) {
	return;
}

in any case, here is diff -u unbind.c.2.0.11 unbind.c:
--- unbind.c.2.0.11     Tue Jul 24 15:10:26 2001
+++ unbind.c    Tue Jul 24 15:18:47 2001
@@ -66,6 +66,10 @@
        int             err = LDAP_SUCCESS;
        LDAPRequest     *lr, *nextlr;

+       if(ld == NULL ) {
+               return LDAP_SUCCESS;
+       }
+
                /* free LDAP structure and outstanding requests/responses */
                for ( lr = ld->ld_requests; lr != NULL; lr = nextlr ) {
                        nextlr = lr->lr_next;

BTW, unbind.c is in libraries/libldap/ (Just for reference :)

I believe a consistent interface is better than an inconsistent interface,
and I'ld be glad if this patch can be worked into the release, unless, of
course,
there is a reason for not checking ld == NULL in ldap_ld_free.

Cheers,
Guus