get_uid_from_fingerprint
from daklib.policy import PolicyQueueUploadHandler
from daklib.textutils import fix_maintainer
-from daklib.utils import get_login_from_ldap
+from daklib.utils import get_logins_from_ldap
from daklib.dak_exceptions import *
Cnf = None
max_source_len = 0
max_version_len = 0
max_arch_len = 0
+ logins = get_logins_from_ldap()
for i in per_source_items:
maintainer = {}
maint=""
sponsor_name = get_uid_from_fingerprint(fingerprint).name
sponsor_login = get_uid_from_fingerprint(fingerprint).uid
if '@' in sponsor_login:
- sponsor_login = get_login_from_ldap(fingerprint)
+ if fingerprint in logins:
+ sponsor_login = logins[fingerprint]
if (sponsor_name != maintainer["maintainername"] and
sponsor_name != changeby["changedbyname"] and
sponsor_login + '@debian.org' != maintainer["maintaineremail"] and
################################################################################
-def get_login_from_ldap(fingerprint):
+def get_logins_from_ldap(fingerprint='*'):
"""retrieve login from LDAP linked to a given fingerprint"""
LDAPDn = Cnf['Import-LDAP-Fingerprints::LDAPDn']
l = ldap.open(LDAPServer)
l.simple_bind_s('','')
Attrs = l.search_s(LDAPDn, ldap.SCOPE_ONELEVEL,
- '(keyfingerprint=%s)' % fingerprint, ['uid'])
- return Attrs[0][1]['uid'][0]
+ '(keyfingerprint=%s)' % fingerprint,
+ ['uid', 'keyfingerprint'])
+ login = {}
+ for elem in Attrs:
+ login[elem[1]['keyFingerPrint'][0]] = elem[1]['uid'][0]
+ return login
################################################################################