Don't like ads? PRO users don't see any ads ;-)
Guest

Ygor Mutti

By: a guest on Apr 17th, 2010  |  syntax: Diff  |  size: 0.83 KB  |  hits: 151  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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