LDAPConnection.abandon does not work (sends incorrect PDU)

RESOLVED FIXED

Status

P3
normal
RESOLVED FIXED
18 years ago
18 years ago

People

(Reporter: karl, Assigned: miodrag)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

18 years ago
LDAPConnection.abandon() does not work. It sends a incorrect PDU to the server.
The following program demonstrates the problem.


import netscape.ldap.*;

public class AbandonTest {
    public static void main(String[] args) {

        try {
            LDAPConnection ldc = new LDAPConnection();
             ldc.setProperty(ldc.TRACE_PROPERTY,
                    new LDAPTraceWriter() {
                        public void write (String msg) {
                            System.err.println(msg);
                        }
                    });

            ldc.connect( 3, "localhost", 389, null, null );

            LDAPSearchListener searchListener = ldc.search(
                        "o=PQR", LDAPv2.SCOPE_ONE,
                        "(objectclass=*)", null,
                        false, (LDAPSearchListener) null );

            ldc.abandon( searchListener );

            try {
                Thread.sleep( 5000 );
            } catch( InterruptedException ex ) {
            }
        } catch( LDAPException ex ) {
            ex.printStackTrace();
        }
    }
}

Running the program produces following output:

22:12:12.067 1 BindRequest {version=3, name=null, authentication=null}
22:12:12.127 1 BindResponse {resultCode=0, matchedDN=null, errorMessage=null}
22:12:12.167 2 SearchRequest {baseObject=o=PQR, scope=1, 
derefAliases=0,sizeLimit=1000, timeLimit=0, attrsOnly=false, filter=
(objectclass=*), attributes=null}
22:12:12.177 3 AbandonRequest {msgid=2}
22:12:12.187 0 ExtendedResponse {resultCode=2, matchedDN=null, 
errorMessage=unknown LDAP request}
22:12:12.427 2 SearchResponse {entry='ou=Accounting, o=PQR', 
attributes='LDAPAttribute {type='ou', values='Accounting'},LDAPAttribute 
{type='objectClass', values='top,organizationalunit'}'}
22:12:12.437 2 SearchResponse {entry='ou=Product Development, o=PQR', 
attributes='LDAPAttribute {type='ou', values='Product 
Development'},LDAPAttribute {type='objectClass', 
values='top,organizationalunit'}'}
22:12:12.678 2 SearchResponse {entry='ou=Product Testing, o=PQR', 
attributes='LDAPAttribute {type='ou', values='Product Testing'},LDAPAttribute 
{type='objectClass', values='top,organizationalunit'}'}
22:12:12.678 2 SearchResponse {entry='ou=Human Resources, o=PQR', 
attributes='LDAPAttribute {type='ou', values='Human Resources'},LDAPAttribute 
{type='objectClass', values='top,organizationalunit'}'}
22:12:12.678 2 SearchResponse {entry='ou=Payroll, o=PQR', 
attributes='LDAPAttribute {type='ou', values='Payroll'},LDAPAttribute 
{type='objectClass', values='top,organizationalunit'}'}
22:12:12.978 2 SearchResponse {entry='ou=Development, o=PQR', 
attributes='LDAPAttribute {type='ou', values='Development'},LDAPAttribute 
{type='objectClass', values='organizationalUnit,top'},LDAPAttribute 
{type='description', values='PQR Development Department'}'}
22:12:12.988 2 SearchResponse {entry='ou=Sales, o=PQR', 
attributes='LDAPAttribute {type='ou', values='Sales'},LDAPAttribute 
{type='objectClass', values='organizationalUnit,top'},LDAPAttribute 
{type='description', values='PQR Sales Department'}'}
22:12:13.299 2 SearchResponse {entry='cn=manadmin, o=PQR', 
attributes='LDAPAttribute {type='sn', values='Smith'},LDAPAttribute {type='cn', 
values='Smith John'},LDAPAttribute {type='objectClass', 
values='manPerson,organizationalPerson,person,top'},LDAPAttribute 
{type='userPassword', values='#'}'}
22:12:13.309 2 SearchResult {resultCode=0, matchedDN=null, errorMessage=null}


As you can see, the abandon request is followed by a extended response
"unknown LDAP request" and the search results are returned completely.

I have tried to locate the problem. Looks like there is a bug in
netscape.ldap.client.opers.JDAPAbandonRequest.getBERElement():

BERTag element = new BERTag(BERTag.APPLICATION|BERTag.CONSTRUCTED|16, i, true);

IMHO, the BER tag CONSTRUCTED cause the problem.
I have removed BERTag.CONSTRUCTED from getBERElement() and now it works.
(Assignee)

Comment 1

18 years ago
Reassigned the bug the myself.
Assignee: mcs → miodrag
(Assignee)

Updated

18 years ago
Status: NEW → ASSIGNED
(Assignee)

Updated

18 years ago
Priority: -- → P3
(Assignee)

Comment 2

18 years ago
Which DS server did you use?
(Reporter)

Comment 3

18 years ago
I used OpenLDAP 2.0.6 on Windows and Siemens DirX 5.5 and 6.0.

I really noticed the problem on Siemens DirX because it seems
to hang after the abandon request.

The DirX people said that my client sends a bad abandon request
(PDU incorrect). Then DirX marks the LDAP connection "corrupted" and
does not process following requests, which causes my client to hang.
(Assignee)

Comment 4

18 years ago
You are right, the coding does not match LDAP protocol, but Netscape Directory 
servers tolerate it for compatibility with umich-ldap-v3.x directory servers 
which use this incorrect encoding.

Thank you for pointing to the problem and the fix.
(Assignee)

Comment 5

18 years ago
The bug has been fixed. Please cvs update and rebuild ldapjdk to pick up the 
fix. 
Status: ASSIGNED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.