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

LBER error



Hi,

I'm currently trying to use C ldap functions but after the call to
ldap_first_entry, the first call to a ldap function generates a LBER error.
This error occurs only with my personnal LDAP server (OpenLDAP 2.0.15 w/
personnal schema) : with ldap.openldap.org i don't have this error ! And
with ldapsearch (the standard tool) i can search any entry in the directory
!

Does someone know anything about such issues ?

Thanks,

Sebastien


Debug of the client :
(gdb) exec-file analyseur
(gdb) run
Starting program: /root/analyseur/v1/analyseur
ldap_first_entry: Success
analyseur:
/home/erich/debian/openldap/openldap2-2.0.23/libraries/liblber/decode.c:500:
ber_scanf: Assertion `(( ber )->ber_opts.lbo_valid==0x2)' failed.
Program received signal SIGABRT, Aborted.
0x40076781 in kill () from /lib/libc.so.6
(gdb) bt
#0  0x40076781 in kill () from /lib/libc.so.6
#1  0x40076464 in raise () from /lib/libc.so.6
#2  0x40077be1 in abort () from /lib/libc.so.6
#3  0x40070e42 in __assert_fail () from /lib/libc.so.6
#4  0x40044b2d in ber_scanf () from /usr/lib/liblber.so.2
#5  0x40031880 in ldap_first_attribute () from /usr/lib/libldap.so.2
#6  0x08048f7c in ?? ()
#7  0x08048be1 in ?? ()
#8  0x4006614f in __libc_start_main () from /lib/libc.so.6

The C code :
<snip />
    if((entry = ldap_first_entry(ldapConn, result)) == NULL) {
        ldap_perror(ldapConn, "Unable to get the first entry :");
        return 0;
    }
    ldap_perror(ldapConn, "ldap_first_entry :");

    do {
//        printf("DN : %s\n", ldap_get_dn(ldapConn, entry));
        if((attrName = ldap_first_attribute(ldapConn, entry, &ber)) == NULL)
{
            ldap_perror(ldapConn, "Unable to get the first entry :");
            return 0;
        }
        do {
            printf(" -> Attribute : %s\n", attrName);
            if((values = ldap_get_values(ldapConn, entry, attrName)) !=
NULL) {
                for (i = 0 ; i < ldap_count_values(values) ; i++) {
                    printf("   -> value : %s\n", values[i]);
                }
                ldap_value_free(values);
            }
            free(attrName);
        } while((attrName = ldap_next_attribute(ldapConn, entry, ber)) !=
NULL);
        ber_free(ber,1);
    } while((entry = ldap_next_entry(ldapConn, entry)) != NULL) ;
<snip />


Debug of the server :
----> snip -----> snip ----->
conn=0 op=1 ENTRY dn="cn=30,ou=ACL,dc=upmc,dc=fr"
<= send_search_entry
====> cache_return_entry_r( 4 ): created (0)
send_ldap_search_result 0::
send_ldap_response: msgid=2 tag=101 err=0
ber_flush: 14 bytes to sd 9
  0000:  30 0c 02 01 02 65 07 0a  01 00 04 00 04 00         0....e........
ldap_write: want=14, written=14
  0000:  30 0c 02 01 02 65 07 0a  01 00 04 00 04 00         0....e........
conn=0 op=1 SEARCH RESULT tag=101 err=0 text=
daemon: activity on 1 descriptors
daemon: activity on: 9r
daemon: read activity on 9
connection_get(9)
connection_get(9): got connid=0
connection_read(9): checking for input on id=0
ber_get_next
ldap_read: want=1, got=0

ber_get_next on fd 9 failed errno=0 (Success)
connection_read(9): input error=-2 id=0, closing.
connection_closing: readying conn=0 sd=9 for close
connection_close: conn=0 sd=9
daemon: removing 9
conn=-1 fd=9 closed