File: options.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 (29 lines) | stat: -rw-r--r-- 929 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

import ldap

host="localhost:1390"

print "API info:",ldap.get_option(ldap.OPT_API_INFO)
print "debug level:",ldap.get_option(ldap.OPT_DEBUG_LEVEL)
#print "Setting debug level to 255..."
#ldap.set_option(ldap.OPT_DEBUG_LEVEL,255)
#print "debug level:",ldap.get_option(ldap.OPT_DEBUG_LEVEL)
print "default size limit:",ldap.get_option(ldap.OPT_SIZELIMIT)
print "Setting default size limit to 10..."
ldap.set_option(ldap.OPT_SIZELIMIT,10)
print "default size limit:",ldap.get_option(ldap.OPT_SIZELIMIT)
print "Creating connection to",host,"..."
l=ldap.init(host)
print "size limit:",l.get_option(ldap.OPT_SIZELIMIT)
print "Setting connection size limit to 20..."
l.set_option(ldap.OPT_SIZELIMIT,20)
print "size limit:",l.get_option(ldap.OPT_SIZELIMIT)
#print "Setting time limit to 60 secs..."
l.set_option(ldap.OPT_TIMELIMIT,60)
#print "time limit:",l.get_option(ldap.OPT_TIMELIMIT)
print "Binding..."
l.simple_bind_s("","")