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

Re: ldap_delete_s() & referral (ITS#471)



I downloaded your change to request.c -- version 1.41
And added it to the version we're running.  But when I 
tried a delete operation I had a problem in that ber_printf was
being called, and ber_put_seqorset to seg fault ( see stack trace below).  

So I added a couple of parentheses and now it works ok.

I'm using gcc version 2.8.1.  

832,833c888,889
<       if ( tag != LDAP_REQ_DELETE &&
<               ber_write(ber, tmpber.ber_ptr, ( tmpber.ber_end - tmpber.ber_ptr ), 0)
---
>       if ( tag != LDAP_REQ_DELETE && 
>               (ber_write(ber, tmpber.ber_ptr, ( tmpber.ber_end - tmpber.ber_ptr ), 0 ) 
835c891
<           ber_printf( ber, /*{{*/ "}}" ) == -1 )
---
>           ber_printf( ber, /*{{*/ "}}" ) == -1 ) )


ldapmodify -h batmanandrobin -k -D "cn=Manager,o=University of Michigan,c=US" 
dn: cn=Barbara Turgyan 1, ou=School of Nursing, ou=Faculty and Staff, ou=People, o=University of Michigan, c=US
changetype:delete

deleting entry cn=Barbara Turgyan 1, ou=School of Nursing, ou=Faculty and Staff, ou=People, o=University of Michigan, c=US

Program received signal SIGSEGV, Segmentation fault.
0x234d4 in ber_put_seqorset (ber=0x49ba0) at encode.c:397
397             len = (*sos)->sos_clen;
(gdb) bt
#0  0x234d4 in ber_put_seqorset (ber=0x49ba0) at encode.c:397
#1  0x240b4 in ber_printf (ber=0x49ba0, fmt=0x30310 "}}") at encode.c:604
#2  0x1c1f0 in re_encode_request (ld=0x47c00, origber=0x49ab8, msgid=4, 
    dnp=0xefffea78) at request.c:888
#3  0x1bd68 in ldap_chase_referrals (ld=0x47c00, lr=0x49af0, errstrp=0x49b0c, 
    hadrefp=0xefffeafc) at request.c:725
#4  0x1e168 in read1msg (ld=0x47c00, msgid=3, all=1, sb=0x47c00, lc=0x49c40, 
    result=0xefffed18) at result.c:338
#5  0x1dce0 in wait4msg (ld=0x47c00, msgid=3, all=1, timeout=0x0, 
    result=0xefffed18) at result.c:232
#6  0x1d82c in ldap_result (ld=0x47c00, msgid=3, all=1, timeout=0x0, 
    result=0xefffed18) at result.c:117
#7  0x195cc in ldap_delete_s (ld=0x47c00, 
    dn=0x49a40 "cn=Barbara Turgyan 1, ou=School of Nursing, ou=Faculty and Staff, ou=People, o=University of Michigan, c=US") at delete.c:71
#8  0x16e30 in dodelete (
    dn=0x49a40 "cn=Barbara Turgyan 1, ou=School of Nursing, ou=Faculty and Staff, ou=People, o=University of Michigan, c=US") at ldapmodify.c:685
#9  0x15d60 in process_ldif_rec (rbuf=0x48aba "") at ldapmodify.c:400
#10 0x15550 in main (argc=6, argv=0xefffef84) at ldapmodify.c:237


> At 03:10 PM 3/8/00 GMT, pturgyan@quince.ifs.umich.edu wrote:
> >>From looking at re_encode_request in libldap/request.c,
> >it doesn't interpret the ber encoded request correctly 
> >for a delete request.  It assumes that all requests are formatted
> >as: message_id, request identifier, Sequence, ...
> >The delete request does not have a sequence in it. It just has the
> >dn to be deleted.
> >
> >Looking at the protocol, most requests have a sequence with the
> >exception of Delete, Unbind, and Abandon.
> 
> I believe your analysis is correct.  I have a fix in the works.
> 
>