Graham Barr <gb...@pobox.com> writes:

> On Jan 17, 2009, at 10:01 AM, Dieter Kluenter wrote:
>> Hi,
>> I'am using
>> perl-5.10.0
>> Net::LDAP version 0.39
>> Authen::SASL version 2.12

>
> You do not say how far your script gets, but if bind fails that is not
> going to tell you. did you mean $msg->code && die $msg->error;
[...]
> perl debug is not very useful in this case. Try adding $ldap->debug(1);

OK, this is my complete script,

,----[ searchList.pl ]
| $ldap = Net::LDAP->new("$host",
|                        async => 1,
|                        version => 3
|                       ) or die "$@";
| $debug=$ldap->debug(1);
| 
| $sasl = Authen::SASL->new(
|         mechanism => 'DIGEST-MD5',
|         debug => 4,
|         callback => {
|                  user => 'dieter',
|                  pass => 'secret'
|  }
| ) or die "$@";
| $msg = $ldap->bind(sasl => $sasl);
| $msg->code && $msg->error_text;
| 
| $result = $ldap->search(
|         base => $basedn,
|         scope => $scope,
|         filter => $filter,
|         attrs => ["$attrs[0]","$attrs[1]","$attrs[2]","$attrs[3]" ]
|         );
| if ( $result->code ){
| LDAPerror ( "Searching",$result );
| }
| sub LDAPerror
|         {
|         my ($from,$result) =...@_;
| print "Fehlermeldung: ",$result->code;
| print ":",$result->error_text;
| }
| foreach $entry ($result->entries){
|         $entry->dump;
|       }
| $msg = $ldap->unbind;
`----

And this is the output of ldap debug

,----[ debug code ]
| die...@rubin: perlscripts% perl searchList.pl
| Net::LDAP=HASH(0xc86a08) sending:
| 
| 30 81 86 02 01 02 63 81 80 04 3A 63 6E 3D 4D 61 0.....c...:cn=Ma
| 69 6C 69 6E 67 6C 69 73 74 65 6E 2C 63 6E 3D 44 ilinglisten,cn=D
| 69 65 74 65 72 20 4B 6C 75 65 6E 74 65 72 2C 6F ieter Kluenter,o
| 75 3D 50 61 72 74 6E 65 72 2C 6F 3D 61 76 63 69 u=Partner,o=avci
| 2C 63 3D 64 65 0A 01 01 0A 01 02 02 01 00 02 01 ,c=de...........
| 00 01 01 00 A3 09 04 02 63 6E 04 03 69 62 6D 30 ........cn..ibm0
| 28 04 02 63 6E 04 0A 4C 69 73 74 65 6E 4E 61 6D (..cn..ListenNam
| 65 04 0A 6D 79 4C 69 73 74 4E 61 6D 65 04 0A 61 e..myListName..a
| 75 74 68 50 68 72 61 73 65 __ __ __ __ __ __ __ uthPhrase
| 
| Net::LDAP=HASH(0x7bf980) received:
| Fehlermeldung: 32:The server cannot find an object specified in the request
| Net::LDAP=HASH(0xc86a08) sending:
| 
| 30 05 02 01 03 42 00 __ __ __ __ __ __ __ __ __ 0....B.
`----

This is a search request and the result code 32 indicates that there
is no sufficient access to the database (at least with regard to
openldap). 

-Dieter
-- 
Dieter Klünter | Systemberatung
http://www.dpunkt.de/buecher/2104.html
sip: +49.180.1555.7770535
GPG Key ID:8EF7B6C6
53°08'09,95"N
10°08'02,42"E

Reply via email to