Skip to content

Commit

Permalink
Simple example for extended passwort operation.
Browse files Browse the repository at this point in the history
  • Loading branch information
stroeder committed Oct 26, 2004
1 parent f8ac88e commit 037f470
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Demo/passwd_ext_op.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""
Example showing the use of the password extended operation.
"""

import sys,ldap,ldapurl,getpass

# Set debugging level
ldap.set_option(ldap.OPT_DEBUG_LEVEL,255)
ldapmodule_trace_level = 2
ldapmodule_trace_file = sys.stderr

lu = ldapurl.LDAPUrl(sys.argv[1])

print 'Old password'
oldpw = getpass.getpass()
print 'New password'
newpw = getpass.getpass()

# Set path name of file containing all CA certificates
# needed to validate server certificates
ldap.set_option(ldap.OPT_X_TLS_CACERTFILE,'/etc/httpd/ssl.crt/myCA-cacerts.pem')

# Create LDAPObject instance
l = ldap.initialize(lu.initializeUrl(),trace_level=ldapmodule_trace_level,trace_file=ldapmodule_trace_file)

l.protocol_version=ldap.VERSION3

l.simple_bind_s(lu.dn,oldpw)

l.passwd(lu.dn,oldpw,newpw)

l.unbind_s()

0 comments on commit 037f470

Please sign in to comment.