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

[JLDAP] Implementing the password reset extension



Hello All,

I'm trying to implement the modify password request extended operation
using JLDAP against OpenLDAP.  Here is the code I'm using:

LDAPConnection con = new LDAPConnection();
con.connect("localhost",389);
con.bind(3,"cn=admin,dc=domain,dc=com","manager".getBytes());
		
ByteArrayOutputStream encodedData = new ByteArrayOutputStream();
LBEREncoder encoder  = new LBEREncoder();
ASN1OctetString[] seq = new ASN1OctetString[3];
seq[0] = new ASN1OctetString("cn=Test Users,ou=internal,dc=domain,dc=com");
seq[1] = new ASN1OctetString("secret");
seq[2] = new ASN1OctetString("mysecret");

ASN1Sequence opSeq = new ASN1Sequence(seq,3);
        
ASN1SequenceOf opSeqOf = new ASN1SequenceOf(opSeq);
opSeqOf.encode(encoder,encodedData);
        
LDAPExtendedOperation op = new
LDAPExtendedOperation("1.3.6.1.4.1.4203.1.11.1",encodedData.toByteArray());
con.extendedOperation(op,new LDAPConstraints());

The DN and the password are both correct.  

OpenLDAP returns "Protocol Error (2) Protocol Error
LDAPException: Server Message: data decoding error"

Here is what etherreal shows:

30 60 02 01 02 77 5b 80 17 31 2e 33 2e 36                      ..0`...w[..1.3.6
0050  2e 31 2e 34 2e 31 2e 34 32 30 33 2e 31 2e 31 31   .1.4.1.4203.1.11
0060  2e 31 81 40 30 3e 04 2a 63 6e 3d 54 65 73 74 20   .1.@0>.*cn=Test 
0070  55 73 65 72 73 2c 6f 75 3d 69 6e 74 65 72 6e 61   Users,ou=interna
0080  6c 2c 64 63 3d 64 6f 6d 61 69 6e 2c 64 63 3d 63   l,dc=domain,dc=c
0090  6f 6d 04 06 73 65 63 72 65 74 04 08 6d 79 73 65   om..secret..myse
00a0  63 72 65 74                                                         cret

So I put in a sequence of octetstrings, but openldap doesn't want to
parse it.  Am I missing something here?

Thanks

Marc