File: reconnect.py

package info (click to toggle)
python-ldap 3.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,268 kB
  • sloc: python: 9,625; ansic: 2,828; makefile: 132; sh: 68
file content (24 lines) | stat: -rw-r--r-- 537 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import sys,time,ldap,ldap.ldapobject,ldapurl

from ldap.ldapobject import *

ldap_url = ldapurl.LDAPUrl(sys.argv[1])
ldap_url.applyDefaults({
  'who':'',
  'cred':'',
  'filterstr':'(objectClass=*)',
  'scope':ldap.SCOPE_BASE
})

ldap.trace_level=1

l = ldap.ldapobject.ReconnectLDAPObject(
  ldap_url.initializeUrl(),trace_level=ldap.trace_level
)
l.protocol_version = ldap.VERSION3

l.simple_bind_s(ldap_url.who,ldap_url.cred)

while 1:
  l.search_s(ldap_url.dn,ldap_url.scope,ldap_url.filterstr,ldap_url.attrs)
  sys.stdin.readline()