Guest User

Ygor Mutti

a guest
Apr 17th, 2010
180
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- functions.py    2010-04-16 17:35:36.000000000 -0300
  2. +++ functions2.py   2010-04-17 10:39:57.000000000 -0300
  3. @@ -85,7 +85,7 @@
  4.    return LDAPObject(uri,trace_level,trace_file,trace_stack_limit)
  5.  
  6.  
  7. -def open(host,port=389,trace_level=0,trace_file=sys.stdout,trace_stack_limit=None):
  8. +def open(host,port=389,trace_level=0,trace_file=sys.stdout,trace_stack_limit=None,ssl=False):
  9.    """
  10.    Return LDAPObject instance by opening LDAP connection to
  11.    specified LDAP host
  12. @@ -101,7 +101,8 @@
  13.          File object where to write the trace output to.
  14.          Default is to use stdout.
  15.    """
  16. -  return initialize('ldap://%s:%d' % (host,port),trace_level,trace_file,trace_stack_limit)
  17. +  scheme = ssl and 'ldaps://' or 'ldap://'
  18. +  return initialize('%s%s:%d' % (scheme,host,port),trace_level,trace_file,trace_stack_limit)
  19.  
  20.  init = open
RAW Paste Data