From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id DC770138CD0 for ; Sun, 31 May 2015 05:03:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7DA01E0908; Sun, 31 May 2015 05:03:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 18AFFE0908 for ; Sun, 31 May 2015 05:03:24 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 414CA340C87 for ; Sun, 31 May 2015 05:03:23 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A5B5EA2D for ; Sun, 31 May 2015 05:03:19 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1433028313.c87ffff6633693275ca5bbb67f81102bd2838123.dolsen@gentoo> Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys-ldap/gkeyldap/ X-VCS-Repository: proj/gentoo-keys X-VCS-Files: gkeys-ldap/gkeyldap/actions.py gkeys-ldap/gkeyldap/config.py X-VCS-Directories: gkeys-ldap/gkeyldap/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: c87ffff6633693275ca5bbb67f81102bd2838123 X-VCS-Branch: master Date: Sun, 31 May 2015 05:03:19 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: a576471b-7c92-4b37-a4e5-c87c9e23ea15 X-Archives-Hash: 951d19110c52ea27f2e27faa2df0ff5e commit: c87ffff6633693275ca5bbb67f81102bd2838123 Author: Brian Dolbec gentoo org> AuthorDate: Mon Apr 20 17:43:45 2015 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Sat May 30 23:25:13 2015 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=c87ffff6 gkeys-ldap: Remove keyid/longkeyid from ldap search info gkeys-ldap/gkeyldap/actions.py | 42 ++++-------------------------------------- gkeys-ldap/gkeyldap/config.py | 5 +---- 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/gkeys-ldap/gkeyldap/actions.py b/gkeys-ldap/gkeyldap/actions.py index 9558ed0..9d7a231 100644 --- a/gkeys-ldap/gkeyldap/actions.py +++ b/gkeys-ldap/gkeyldap/actions.py @@ -142,7 +142,7 @@ class Actions(object): @staticmethod def get_args(args): - for attr in ['nick', 'name', 'gpgkey', 'fingerprint', 'status']: + for attr in ['nick', 'name', 'fingerprint', 'status']: if attr: target = getattr(args, attr) search_field = gkey2SEARCH[attr] @@ -162,7 +162,7 @@ class Actions(object): % (info['uid'][0], info['cn'][0])) self.logger.debug(' MISSING or EMPTY LDAP field ' + '[%s] GPGKey field [%s]' % (field, attr)) - if attr in ['fingerprint', 'keyid', 'longkeyid']: + if attr in ['fingerprint']: keyid_missing = True else: is_good = False @@ -172,15 +172,11 @@ class Actions(object): if is_good: if keyinfo['fingerprint']: # fingerprints exist check is_ok = self._check_fingerprint_integrity(info, keyinfo) - is_match = self._check_id_fingerprint_match(info, keyinfo) - if not is_ok or not is_match: + if not is_ok: is_good = False if is_good: # some developers add lowercase fingerprints keyinfo['fingerprint'] = [key.upper() for key in keyinfo['fingerprint']] - # drop keyid and longkeyid - keyinfo.pop('keyid', None) - keyinfo.pop('longkeyid', None) keyinfo['keys'] = keyinfo['fingerprint'] keyinfo['uid'] = ["%s <%s@gentoo.org>" % (info['cn'][0], info['uid'][0])] return keyinfo @@ -200,11 +196,7 @@ class Actions(object): values = info[field] # strip errant line feeds values = [y.strip('\n') for y in values] - # separate out short/long key id's - if values and attr in ['keyid', 'longkeyid']: - if len(get_key_ids(attr, values)): - keyid_found = True - elif values and attr in ['fingerprint']: + if values and attr in ['fingerprint']: values = [v.replace(' ', '') for v in values] if 'undefined' in values and attr not in ['keyid', 'longkeyid']: self.logger.error('ERROR in LDAP info for: %s, %s' @@ -242,35 +234,9 @@ class Actions(object): else: gpgkey = 'Missing or Bad fingerprint from LDAP info' is_good = False - #if not keyinfo['longkeyid']: - #self.logger.error('ERROR in ldap info for: %s, %s' - #% (info['uid'][0], info['cn'][0])) - #self.logger.error(' A valid keyid, longkeyid or fingerprint ' - #'was not found for %s : gpgkey = %s' % (info['cn'][0], gpgkey)) - #is_good = False return (keyinfo, is_good) - def _check_id_fingerprint_match(self, info, keyinfo): - # assume it's good until found an error is found - is_good = True - for attr in ['keyid', 'longkeyid']: - # skip blank id field - if not keyinfo[attr]: - continue - for y in keyinfo[attr]: - index = len(y.lstrip('0x')) - if y.lstrip('0x').upper() not in \ - [x[-index:].upper() for x in keyinfo['fingerprint']]: - self.logger.error('ERROR in LDAP info for: %s, %s' - %(info['uid'][0], info['cn'][0])) - self.logger.error(' ' + str(keyinfo)) - self.logger.error(' GPGKey id %s not found in the ' - % y.lstrip('0x') + 'listed fingerprint(s)') - is_good = False - return is_good - - def _check_fingerprint_integrity(self, info, keyinfo): # assume it's good until found an error is found is_good = True diff --git a/gkeys-ldap/gkeyldap/config.py b/gkeys-ldap/gkeyldap/config.py index f7fb837..fe56e78 100644 --- a/gkeys-ldap/gkeyldap/config.py +++ b/gkeys-ldap/gkeyldap/config.py @@ -5,15 +5,13 @@ default_server = ['ldap://ldap%d.gentoo.org' % i for i in xrange(1,5)] # add uid to the results so you don't have to # separate it out of the results tuple[0] value -default_fields = ['uid', 'cn', 'mail', 'gentooStatus', 'gpgkey', 'gpgfingerprint'] +default_fields = ['uid', 'cn', 'mail', 'gentooStatus', 'gpgfingerprint'] default_criteria = 'ou=devs,dc=gentoo,dc=org' # establish a ldap fields to GKEY._fields map gkey2ldap = { 'nick': 'uid', 'name': 'cn', - 'keyid': 'gpgkey', - 'longkeyid': 'gpgkey', # map the uid to keydir, since we want # dev keydir to be separate from each other 'keydir': 'uid', @@ -33,7 +31,6 @@ gkey2SEARCH = { 'nick': UID, 'name': CN, 'status': STATUS, - 'keyid': GPGKEY, 'mail': MAIL, 'fingerprint': GPGFINGERPRINT, }