http://qs321.pair.com?node_id=658194

cerror has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I'm working on a portal page which will allow users to change their own password, which is kept in LDAP, however, I'm having trouble getting my sub to actually update the password. I'm using Net::LDAP. Assuming we're connected to LDAP correctly, can you guys/gals spot any problems with this code?

sub updateLDAPpass { my ($user, $pass) = @_; my $mesg = $ldap->bind( "cn=Manager,dc=domain,dc=net", password => 'password' ); my $dn = "cn=$user,dc=domain,dc=net"; my $cryptPword = cryptPass($pass); $cryptPword = "{crypt}". $cryptPword; $mesg = $ldap->modify("$dn", changes => [ replace => [ userPassword => "$cryptPword" +]] ); }

Thanks!

- cerror