Add GnuTLS and secure LDAP information.
[blog.git] / posts / LDAP / mutt-ldap.py
index e27a5e32317f01544c0f8c5fdc8b6efca0db7828..8fac78ecd8eb3c463fb7744c61f9bebab35120a4 100755 (executable)
@@ -55,11 +55,11 @@ def connect():
     protocol = 'ldap'
     if CONFIG.getboolean('connection', 'ssl'):
         protocol = 'ldaps'
-    connection = ldap.initialize(
-        '%s://%s:%s' % (
-            protocol,
-            CONFIG.get('connection', 'server'),
-            CONFIG.get('connection', 'port')))
+    url = '%s://%s:%s' % (
+        protocol,
+        CONFIG.get('connection', 'server'),
+        CONFIG.get('connection', 'port'))
+    connection = ldap.initialize(url)
     connection.bind(
         CONFIG.get('connection', 'user'),
         CONFIG.get('connection', 'password'),