Home > other >  In the ldap client change password error
In the ldap client change password error

Time:10-26

#!/bin/env python
The import sys
The import ldap

The username='adserve \ \' + 'xixi'
127.30.1.241 ldapconn=ldap. Open (" ")
# ldapconn. Simple_bind (' cn=xixi, dc adserve, dc=com ', '123456 zz')

Ldapconn. Protocal_version=ldap. VERSION3
SearchScope=ldap. SCOPE_SUBTREE
RetrieveAttributes=None
SearchFilter="cn=" + 'xixi'
Ldap_result_id=ldapconn. Search (' dc adserve, dc=com, searchScope, searchFilter, retrieveAttributes)
Result_type, result_data=https://bbs.csdn.net/topics/ldapconn.result (ldap_result_id, 0)

If result_type==ldap. RES_SEARCH_ENTRY:
A=result_data [0] [0]

Ldapconn. Simple_bind_s (a, '123456 zz')
Ldapconn. Passwd_s (a, '123456 zz', '123456 zyy)


Traceback (the most recent call last) :
The File "ldap_change_passwd. Py, line 10, the in & lt; module>
Print ldapconn. Simple_bind_s (cn="xixi, ou=Users, dc=adserve, dc=com", '123456 zz')
The File "/usr/local/lib/python2.7/site - packages/python_ldap - 2.4.25 py2.7 - Linux - x86_64. An egg/ldap/ldapobject py", line 230, in simple_bind_s
Msgid=self. Simple_bind (who, cred, serverctrls, clientctrls)
The File "/usr/local/lib/python2.7/site - packages/python_ldap - 2.4.25 py2.7 - Linux - x86_64. An egg/ldap/ldapobject py", line 224, in simple_bind
Return the self. _ldap_call (self. _l. Simple_bind, who, cred, RequestControlTuples (serverctrls), RequestControlTuples (clientctrls))
The File "/usr/local/lib/python2.7/site - packages/python_ldap - 2.4.25 py2.7 - Linux - x86_64. An egg/ldap/ldapobject py", line 114, in _ldap_call
Result=func (* args, * * kwargs)
Ldap. SERVER_DOWN: {' desc: "Can 't contact ldap server"}

Don't understand these operations of ldap, could you tell me how to solve the above problem?
  • Related