Skip Menu |

This queue is for tickets about the perl-ldap CPAN distribution.

Report information
The Basics
Id: 91177
Status: resolved
Priority: 0/
Queue: perl-ldap

People
Owner: Nobody in particular
Requestors: steve.vanderburg [...] lhsc.on.ca
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.58



Subject: Bug in Net::LDAP::Extra::AD
Date: Wed, 04 Dec 2013 11:54:08 -0500
To: <bug-perl-ldap [...] rt.cpan.org>
From: "Steve van der Burg" <steve.vanderburg [...] lhsc.on.ca>
I think I've found a bug in change_ADpassword. It does this: $self->modify($dn, changes => [ delete => { unicodePwd => $oldpw }, add => { unicodePwd => $newpw } ]); to make the change, and using it errored out with Not an ARRAY reference at /usr/share/perl5/Net/LDAP.pm line 562 on my system. To complicate things a bit, my system is Debian 7 with libnet-ldap-perl, which is packaging Net::LDAP v0.44 at the moment, which comes before Net::LDAP::Extra::AD's existence. So I'm doing this for my test code, after grabbing AD.pm and installing it locally: - - - - - - use lib qw(/usr/local/lib/perl/lib); use Net::LDAP::Extra qw(AD); my $oldPW = shift; my $newPW = shift; print "old password: $oldPW\n"; print "new password: $newPW\n"; my $server = "ldaps://my.ad.ldap.server:636"; my $user = "cn=auser,OU=theusers,DC=my,DC=company"; my $ldap = Net::LDAP->new($server) or die "$@"; my $mesg = $ldap->bind($user, password => $oldPW); if ($mesg->code) { print "bind error: ",$mesg->error,"\n"; $ldap->unbind; exit; } my $cmesg = $ldap->change_ADpassword($user, $oldPW, $newPW); if ($cmesg->code) { print "password change error: ",$cmesg->error,"\n"; } $ldap->unbind; - - - - - - Running that gets me the error mentioned above. Once I unwound the Net::LDAP code for 'modify' (which looks unchanged between v0.44 and v0.57), I can see that it expects one of two argument styles (well, one of three, but we'll ignore one): modify($thing, changes => [ op1 => [ attr => value ], op2 => [ ... ] ]) or modify($thing, op1 => { attr => value }, op2 => { ... }) The code for change_ADpassword is doing neither of these. It needs to be changed to this $self->modify($dn, changes => [ delete => [ unicodePwd => $oldpw ], add => [ unicodePwd => $newpw ] ]); and then it works. Thanks for this awesome set of modules, by the way. They get a good workout at my (Canadian, not-for-profit) hospital! ...Steve -- Steve van der Burg Information Technology Services London Health Sciences Centre & St. Joseph's Health Care London (519) 685-8500 ext 35559 steve.vanderburg@lhsc.on.ca -------------------------------------------------------------------------------- This information is directed in confidence solely to the person named above and may contain confidential and/or privileged material. This information may not otherwise be distributed, copied or disclosed. If you have received this e-mail in error, please notify the sender immediately via a return e-mail and destroy original message. Thank you for your cooperation.
Hi Steve, Oops, this shouldn't have happened. You're absolutely right. It should be fixed in the next version, which I hope to release in December. Best Peter
Hi, please have a look at https://github.com/perl-ldap/perl-ldap/commits/next It contains the changes intended for the next release of perl-ldap, and I think the bug you reported is patched there. Please test Peter