Re: Can't get LDAP::Message object with modify method

"John W. Sopko Jr." <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.ldap
Message-ID <[email protected]>
Graham Barr wrote:
> On Sep 26, 2008, at 8:11 AM, John W. Sopko Jr. wrote:
>>
>> Here is the section of code that changes the password:
>>
>> # the unicodePwd attribute is write only
>> $mesg = $AD->modify($dn, replace => { "unicodePwd" => $adpw });
>> print "mesg->code = $mesg->code() \n";
> 
> That is not calling the method.
> 
>> print "resultCode = $mesg->{'resultCode'} \n";
>>
>> if($mesg->{'resultCode'} != 0) {
>>        print STDERR "\nFailed to change password for $cn exiting.\n";
>>        print STDERR "error_text:" . $mesg->error_text . "\n";
>>        print STDERR "server_error:" . $mesg->server_error . "\n";
>>        print STDERR "error:" . $mesg->error . "\n";
>>        print
>>        exit 1;
>> }
>>
>>
>> Output from above section:
>>
>> mesg->code = Net::LDAP::Modify=HASH(0x81d1f90)->code()
>> resultCode = 53
> 
> If you change the line above to
> 
> print "mesg->code = ",$mesg->code()," \n";

I plead temporary insanity, improper print statement,
that fixed.

I changed the test I was trying to figure out from this:

if($mesg->{'resultCode'} != 0) {

to this:

if($mesg->code() != 0) {

and it works fine.

> 
> you should also see 53, so I doubt this is you problem.
> 
>> Failed to change password for astroboy exiting.
>> error_text:The server is unwilling to perform the requested operation
>>
>> server_error:0000052D: SvcErr: DSID-031A0FC0, problem 5003 
>> (WILL_NOT_PERFORM), data 0
>>
>> error:0000052D: SvcErr: DSID-031A0FC0, problem 5003 
>> (WILL_NOT_PERFORM), data 0
> 
> Well it certainly looks like the server is refusing to change the 
> password, so I would expect the return message to signal an error

Yes  am testing for error conditions.

Thanks for your help!

> 
> Graham.
> 

-- 
John W. Sopko Jr.               University of North Carolina
email: sopko AT cs.unc.edu      Computer Science Dept., CB 3175
Phone: 919-962-1844             Sitterson Hall; Room 044
Fax:   919-962-1799             Chapel Hill, NC 27599-3175
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.