ldap passwd need help

S

Sells, Fred

I've got the python-ldap version 2.0.11 with python 2.4 under Linux

I've got the ldap stuff working for groups, but now I'm trying to use it to
change a user password. I get a return of 2 and no error messages but it
does not change ldap.

I've tried it with uid = 'joeblow' and with oldpw=whatever it was with the
same result.

Anyone know what I'm missing?

class LdapUser:
def __init__(self, uri=uri, binddn=BINDDN, password=""):
self.ldap = ldap.initialize(uri)
self.ldap.simple_bind(binddn, password)

def chg_pw(self,uid,oldpw,newpw):
print self.ldap.passwd_s(uid,oldpw,newpw)


if __name__=="__main__":
Ldap = LdapUser(password="secret")
Ldap.chg_pw("uid=joeblow,ou=abc,ou=def,dc=ghi,dc=org","", "new.pass")

---------------------------------------------------------------------------
The information contained in this message may be privileged and / or
confidential and protected from disclosure. If the reader of this message is
not the intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please notify the sender
immediately by replying to this message and deleting the material from any
computer.
---------------------------------------------------------------------------
 
?

=?ISO-8859-1?Q?Michael_Str=F6der?=

I've got the ldap stuff working for groups, but now I'm trying to use it to
change a user password. I get a return of 2 and no error messages but it
does not change ldap.

Could you please post a complete Python traceback? If you mean "2" being
the LDAP error code this is ldap.PROTOCOL_ERROR.
def chg_pw(self,uid,oldpw,newpw):
print self.ldap.passwd_s(uid,oldpw,newpw)

Make sure your LDAP server (which one?) supports the
LDAP Password Modify Extended Operation (see RFC 3062) when using method
LDAPObject.passwd_s(). ldap.PROTOCOL_ERROR indicates that the server
does not support it.

Otherwise you have to send a modify request replacing the value of
attribute 'userPassword' in the user's LDAP entry. Make sure you
understand password hashes if needed with your server.

Ciao, Michael.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top