Skip to content

passwd_s documentation incorrect, it can return a tuple #295

Open
@quanah

Description

@quanah

If you found a bug in python-ldap, or would request a new feature,
this is the place to let us know.

Please describe the issue and your environment here.


Issue description:

The documentation for the passwd_s method shows that there is no return value set. This is incorrect in some situations. For example, if one is using passwd_s in such a fashion as to have the LDAP server generate a new password for you, a 2 member tuple is returned. For example with this code, we use an administrative account to set the password for another account. No passwords (old or new) are necessary in this situation:

import ldap
l = ldap.initialize('ldap://localhost')
l.simple_bind_s("dc=example,dc=com", "secret")
msgid = l.passwd_s("cn=Marice McCaugherty,ou=Product Testing,dc=example,dc=com", None, None)
print(type(msgid))
tup1=msgid[0]
tup2=msgid[1]
print(type(tup1))
print(type(tup2))
print(tup2)

For our output, we have:

<class 'tuple'>
<class 'NoneType'>
<class 'bytes'>
b'0\n\x80\x088qoGXHxN'

So the password was set to: 8qoGXHxN

Steps to reproduce:

See above

Operating system:

N/A

Python version:
3.6.8

python-ldap version:
3.2.0

This is related to #246

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions