
Ygor Mutti
By: a guest on
Apr 17th, 2010 | syntax:
Diff | size: 0.83 KB | hits: 151 | expires: Never
--- functions.py 2010-04-16 17:35:36.000000000 -0300
+++ functions2.py 2010-04-17 10:39:57.000000000 -0300
@@ -85,7 +85,7 @@
return LDAPObject(uri,trace_level,trace_file,trace_stack_limit)
-def open(host,port=389,trace_level=0,trace_file=sys.stdout,trace_stack_limit=None):
+def open(host,port=389,trace_level=0,trace_file=sys.stdout,trace_stack_limit=None,ssl=False):
"""
Return LDAPObject instance by opening LDAP connection to
specified LDAP host
@@ -101,7 +101,8 @@
File object where to write the trace output to.
Default is to use stdout.
"""
- return initialize('ldap://%s:%d' % (host,port),trace_level,trace_file,trace_stack_limit)
+ scheme = ssl and 'ldaps://' or 'ldap://'
+ return initialize('%s%s:%d' % (scheme,host,port),trace_level,trace_file,trace_stack_limit)
init = open