By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,009 Members | 1,260 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,009 IT Pros & Developers. It's quick & easy.

ldap passwd need help

P: n/a
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=o rg","", "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.
---------------------------------------------------------------------------
Jan 18 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Sells, Fred wrote:

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.
Jan 19 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.