From: Chris R. <chr...@ma...> - 2002-11-21 17:49:13
|
On 21/11/02 5:38 pm, Edouard FAUCHILLE <edo...@pa...> wrote: > Hi, > > I'm trying to develop a perl server which intercept ldap Outlook requests in > order to translate it in SQL. > The aim is to to retrieve informations from sql databases, with an ldap > client like Outlook. > > I'm using the "Convert" package, but i can't understand how it work. > I have this error msg : > > decode error 30<=>60 at > /usr/lib/perl5/site_perl/5.6.0/Convert/ASN1/_decode.pm line 108, > <SOCK_SERVICE> line 1. > ...propagated at test_serveur_ldap.pl line 99, <SOCK_SERVICE> line > 1. > > with this code : > > ... > 91 $asn = Convert::ASN1->new; > 92 $asn->prepare(q< > 93 [APPLICATION 0] SEQUENCE { > 94 version INTEGER, > 95 name OCTET STRING, > 96 authentication ANY OPTIONAL} > 97 >) or die $!; > 98 > 99 $out = $asn->decode($demande) or die $!; > 100 print "\nversion : ".$out->{version}; > 101 print "\nname : ".$out->{name}; > 102 print "\nautentication : ".$out->{authentication}; > ... > > The $demande var contains "30 84 00 00 00 11 02 02 01 00 60 84 00 00 00 07 > 02 01 03 04 00 80 00 30 84 00 00 00 08 02 20 01 01 50 02 01 00 30 84 00 00 > 00 06 02 02 01 02 42 00" which seems to be OK for the BindRequest. LDAP is a binary protocol, so your $demande variable should be the actual bytes you got from the network, not text. In other words in perl "\x30\x84\x00..." Otherwise the way you're using Convert::ASN1 looks about right. Cheers, Chris |