public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys-ldap/gkeyldap/
Date: Sun, 31 May 2015 05:03:19 +0000 (UTC)	[thread overview]
Message-ID: <1433028313.c87ffff6633693275ca5bbb67f81102bd2838123.dolsen@gentoo> (raw)

commit:     c87ffff6633693275ca5bbb67f81102bd2838123
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 20 17:43:45 2015 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> 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,
 }


             reply	other threads:[~2015-05-31  5:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-31  5:03 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-07-07 14:05 [gentoo-commits] proj/gentoo-keys:master commit in: gkeys-ldap/gkeyldap/ Brian Dolbec
2016-12-23 19:55 Brian Dolbec
2015-03-24  3:13 Brian Dolbec
2015-03-17 19:51 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2014-12-26 18:37 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-22 23:11 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433028313.c87ffff6633693275ca5bbb67f81102bd2838123.dolsen@gentoo \
    --to=dolsen@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox