File: reconnect.py

package info (click to toggle)
python-ldap-doc 2.3-2.1
  • links: PTS
  • area: contrib
  • in suites: squeeze
  • size: 200 kB
  • ctags: 121
  • sloc: python: 661; makefile: 44
file content (24 lines) | stat: -rw-r--r-- 537 bytes parent folder | download | duplicates (13)
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()