From f8050a9c69b8a4acc44482bb9561216a04d80f35 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 14 May 2012 09:21:57 -0400 Subject: [PATCH] Add starttls support to mutt-ldap.py and ldap-jpeg.py. Also remove `rdn` from the searched attributes, because I don't have such a field in any of my schemas. --- mutt-ldap.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mutt-ldap.py b/mutt-ldap.py index 8d22ff6..059b25c 100755 --- a/mutt-ldap.py +++ b/mutt-ldap.py @@ -47,6 +47,7 @@ CONFIG.add_section('connection') CONFIG.set('connection', 'server', 'domaincontroller.yourdomain.com') CONFIG.set('connection', 'port', '389') # set to 636 for default over SSL CONFIG.set('connection', 'ssl', 'no') +CONFIG.set('connection', 'starttls', 'no') CONFIG.set('connection', 'basedn', 'ou=x co.,dc=example,dc=net') CONFIG.add_section('auth') CONFIG.set('auth', 'user', '') @@ -63,6 +64,8 @@ def connect(): CONFIG.get('connection', 'server'), CONFIG.get('connection', 'port')) connection = ldap.initialize(url) + if CONFIG.getboolean('connection', 'starttls') and protocol == 'ldap': + connection.start_tls_s() if CONFIG.getboolean('auth', 'gssapi'): sasl = ldap.sasl.gssapi() connection.sasl_interactive_bind_s('', sasl) @@ -84,7 +87,7 @@ def search(query, connection=None): post = '*' filterstr = '(|%s)' % ( u' '.join([u'(%s=*%s%s)' % (field, query, post) - for field in ['cn', 'rdn', 'uid', 'mail']])) + for field in ['cn', 'uid', 'mail']])) r = connection.search_s( CONFIG.get('connection', 'basedn'), ldap.SCOPE_SUBTREE, -- 2.26.2