Re: BUG? add() fails with resultCode=>32, errorMessage=>''

Graham Barr <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.ldap
Message-ID <[email protected]>
On Oct 17, 2008, at 12:49 PM, Jason Vas Dias wrote:
>
> So it seems the Net::LDAP issue (very minor bug) is that in case 1  
> above,

No, it is not a bug.

> Net::LDAP gets this response:
>
> "
> LDAP::process
> Net::LDAP=HASH(0xca22c0) received:23 bytes
>
> 30 15 02 01 02 69 10 0A 01 20 04 09 6F 3D 61 74 0....i... ..o=at
> 74 2E 63 6F 6D 04 00 __ __ __ __ __ __ __ __ __ t.com..
>
> 0000   21: SEQUENCE {
> 0002    1:   INTEGER = 2
> 0005   16:   [APPLICATION 9] {
> 0007    1:     ENUM = 32
> 000A    9:     STRING = 'o=att.com'
> 0015    0:     STRING = ''
> 0017     :   }
> 0017     : }

That is what your server returned.

> And Net::LDAP returns an error status mesg with "resultCode=>32" for  
> the case #1 add() ;
> $VAR1 = bless( {
>                 'parent' => bless( {
>                                      'net_ldap_version' => 3,
>                                      'net_ldap_scheme' => 'ldap',
>                                      'net_ldap_debug' => 1,
>                                      'net_ldap_socket' =>  
> bless( \*Symbol::GEN1, 'IO::Socket::INET' ),
>                                      'net_ldap_onerror' => sub  
> { "DUMMY" },
>                                      'net_ldap_host' => 'localhost',
>                                      'net_ldap_uri' => 'localhost',
>                                      'net_ldap_resp' => {},
>                                      'net_ldap_mesg' => {},
>                                      'net_ldap_async' => 0,
>                                      'net_ldap_port' => '389',
>                                      'net_ldap_refcnt' => 1
>                                    }, 'Net::LDAP' ),
>                 'errorMessage' => '',
>                 'ctrl_hash' => undef,
>                 'resultCode' => 32,
>                 'callback' => undef,
>                 'mesgid' => 2,
>                 'matchedDN' => 'o=att.com',
>                 'controls' => undef,
>                 'raw' => undef
>               }, 'Net::LDAP::Add' );
>
> but I think it should also be returning an "errorMessage=>'no such  
> object'" in this case,

Why are you looking inside the object ??

Use the methods as defined in the documentation and you will get the  
error message you want.

> whereas it returned an empty string in errorMessage - an error  
> string would have greatly
> helped in diagnosing the problem and correcting my mistake.

Tell you LDAP server vendor as that is the source of that attribute.  
Net::LDAP works around this issue if you call the methods as defined  
in the documentation

Graham.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.