Re: Password modify

Chris Ridd <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.ldap
Message-ID <[email protected]>
On 17 Feb 2011, at 17:10, Robert Threet wrote:

> I have a working Net::LDAP::Entry program for adding users so I decided
> to gut it to create a userPassword changer.
> 
> I keep getting "Error changing password: no objectClass attribute".
> 
> I cannot find examples doing simple one-at-a-time adds like this.  All I
> can find are examples using arrays and hashes and cannot seem to
> translate it to this.  Any tips?

There's a simple example right at the top of the Net::LDAP man page :-)

Or at <http://search.cpan.org/~gbarr/perl-ldap/lib/Net/LDAP.pod> if you prefer:

---
 $result = $ldap->add( 'cn=Barbara Jensen, o=University of Michigan, c=US',
                       attr => [
                         'cn'   => ['Barbara Jensen', 'Barbs Jensen'],
                         'sn'   => 'Jensen',
                         'mail' => '[email protected]',
                         'objectclass' => ['top', 'person',
                                           'organizationalPerson',
                                           'inetOrgPerson' ],
                       ]
                     );

 $result->code && warn "failed to add entry: ", $result->error ;
---

Chris
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.