|
7 | 7 | ldaps://localhost:1391 (LDAP over SSL) |
8 | 8 | ldapi://%2ftmp%2fopenldap2 (domain socket /tmp/openldap2) |
9 | 9 | """ |
| 10 | +from __future__ import print_function |
10 | 11 |
|
11 | 12 | import sys,os,ldap |
12 | 13 |
|
|
23 | 24 | # Complete path name of the file containing all trusted CA certs |
24 | 25 | CACERTFILE='/etc/ssl/ca-bundle.pem' |
25 | 26 |
|
26 | | -print """################################################################## |
| 27 | +print("""################################################################## |
27 | 28 | # LDAPv3 connection with StartTLS ext. op. |
28 | 29 | ################################################################## |
29 | | -""" |
| 30 | +""") |
30 | 31 |
|
31 | 32 | # Create LDAPObject instance |
32 | 33 | l = ldap.initialize('ldap://localhost:1390',trace_level=ldapmodule_trace_level,trace_file=ldapmodule_trace_file) |
|
44 | 45 | # Now try StartTLS extended operation |
45 | 46 | l.start_tls_s() |
46 | 47 |
|
47 | | -print '***ldap.OPT_X_TLS_VERSION',l.get_option(ldap.OPT_X_TLS_VERSION) |
48 | | -print '***ldap.OPT_X_TLS_CIPHER',l.get_option(ldap.OPT_X_TLS_CIPHER) |
| 48 | +print('***ldap.OPT_X_TLS_VERSION',l.get_option(ldap.OPT_X_TLS_VERSION)) |
| 49 | +print('***ldap.OPT_X_TLS_CIPHER',l.get_option(ldap.OPT_X_TLS_CIPHER)) |
49 | 50 |
|
50 | 51 | # Try an explicit anon bind to provoke failure |
51 | 52 | l.simple_bind_s('','') |
52 | 53 |
|
53 | 54 | # Close connection |
54 | 55 | l.unbind_s() |
55 | 56 |
|
56 | | -print """################################################################## |
| 57 | +print("""################################################################## |
57 | 58 | # LDAPv3 connection over SSL |
58 | 59 | ################################################################## |
59 | | -""" |
| 60 | +""") |
60 | 61 |
|
61 | 62 | # Create LDAPObject instance |
62 | 63 | l = ldap.initialize('ldaps://localhost:1391',trace_level=ldapmodule_trace_level,trace_file=ldapmodule_trace_file) |
|
74 | 75 | # Try an explicit anon bind to provoke failure |
75 | 76 | l.simple_bind_s('','') |
76 | 77 |
|
77 | | -print '***ldap.OPT_X_TLS_VERSION',l.get_option(ldap.OPT_X_TLS_VERSION) |
78 | | -print '***ldap.OPT_X_TLS_CIPHER',l.get_option(ldap.OPT_X_TLS_CIPHER) |
| 78 | +print('***ldap.OPT_X_TLS_VERSION',l.get_option(ldap.OPT_X_TLS_VERSION)) |
| 79 | +print('***ldap.OPT_X_TLS_CIPHER',l.get_option(ldap.OPT_X_TLS_CIPHER)) |
79 | 80 |
|
80 | 81 | # Close connection |
81 | 82 | l.unbind_s() |
82 | 83 |
|
83 | | -print """################################################################## |
| 84 | +print("""################################################################## |
84 | 85 | # LDAPv3 connection over Unix domain socket |
85 | 86 | ################################################################## |
86 | | -""" |
| 87 | +""") |
87 | 88 |
|
88 | 89 | # Create LDAPObject instance |
89 | 90 | l = ldap.initialize('ldapi://%2ftmp%2fopenldap-socket',trace_level=ldapmodule_trace_level,trace_file=ldapmodule_trace_file) |
|
0 commit comments