[sysadmin-bin] Stop looking for RFC2307's memberUid field but for RC2307bis' member field instead as FreeIPA defaul



commit f8846ce13e18037ef71263608c33fd099872ac61
Author: Andrea Veri <av gnome org>
Date:   Sun Oct 5 23:18:01 2014 +0200

    Stop looking for RFC2307's memberUid field but for RC2307bis' member field instead as FreeIPA defaults to 
that

 mail/export-mail.py |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/mail/export-mail.py b/mail/export-mail.py
index 083f18c..f280579 100755
--- a/mail/export-mail.py
+++ b/mail/export-mail.py
@@ -5,10 +5,9 @@ import ldap.modlist
 import ldap.filter
 import subprocess
 
-LDAP_URL='ldap://ldap.gnome.org/'
-LDAP_BINDDN='cn=Manager,dc=gnome,dc=org'
-LDAP_GROUP_BASE='ou=groups,dc=gnome,dc=org'
-LDAP_USER_BASE='ou=people,dc=gnome,dc=org'
+LDAP_URL='ldap://account.gnome.org/'
+LDAP_GROUP_BASE='cn=groups,cn=accounts,dc=gnome,dc=org'
+LDAP_USER_BASE='cn=users,cn=accounts,dc=gnome,dc=org'
 
 ALIASES = [
     ('/etc/gnome.org/cvs-mail/virtual',    'cvs.gnome.org', ('gnomecvs', 'gnomevcs')),
@@ -44,13 +43,18 @@ def fetch_group_members(group):
     results = l.search_s(LDAP_GROUP_BASE, ldap.SCOPE_SUBTREE, filter, ('memberUid', ))
 
     members = set()
-    for entry in results:
-        id = entry[0]
-        attr = entry[1]
 
-        members.update(attr['memberUid'])
+    for _, attr in results:
+        for userid in attr['member']:
+            splitentry = userid.split(',')
+            singleentry = splitentry[0]
+            splitteduid = singleentry.split('=')
+            uid = splitteduid[1]
+
+            members.add(uid)
 
     _cache_group[group] = members
+
     return members
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]