Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # import class and constants
- from ldap3 import Server, Connection, ALL, MODIFY_REPLACE
- # define the server
- s = Server('servername', get_info=ALL) # define an unsecure LDAP server, requesting info on DSE and schema
- # define the connection
- c = Connection(s, user='user_dn', password='user_password')
- c.bind()
- # perform the Modify operation
- c.modify('cn=user1,ou=users,o=company',
- {'givenName': [(MODIFY_REPLACE, ['givenname-1-replaced'])],
- 'sn': [(MODIFY_REPLACE, ['sn-replaced'])]})
- print(c.result)
- # close the connection
- c.unbind()
Add Comment
Please, Sign In to add comment