From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeyldap/
Date: Sun, 23 Jun 2013 07:13:57 +0000 (UTC) [thread overview]
Message-ID: <1371961859.488a4f389606423451dc36af3920803b2a14de7c.dol-sen@gentoo> (raw)
commit: 488a4f389606423451dc36af3920803b2a14de7c
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 22 21:01:48 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sun Jun 23 04:30:59 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=488a4f38
Add keyid/longkeyid separation and assignment
---
gkeyldap/cli.py | 37 +++++++++++++++++++++++++++++--------
gkeyldap/search.py | 2 +-
2 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/gkeyldap/cli.py b/gkeyldap/cli.py
index b506f64..dae772a 100644
--- a/gkeyldap/cli.py
+++ b/gkeyldap/cli.py
@@ -20,6 +20,32 @@ from gkeyldap.search import (LdapSearch, UID, gkey2ldap_map, gkey2SEARCH)
logger.setLevel(0)
+# set some defaults
+KEY_LEN = {
+ 'keyid': 8,
+ 'longkeyid': 16,
+}
+
+
+def get_key_ids(key, info):
+ '''Small utility function to return only keyid (short)
+ or longkeyid's
+
+ @param key: string, the key lenght desired
+ @param info: list of keysid's to process
+ @return list of the desired key lengh id's
+ '''
+ result = []
+ for x in info:
+ if x.startswith('0x'):
+ mylen = KEY_LEN[key] + 2
+ else:
+ mylen = KEY_LEN[key]
+ if len(x) == mylen:
+ result.append(x)
+ return result
+
+
class Main(object):
'''Main command line interface class'''
@@ -188,7 +214,6 @@ class Main(object):
return (x, target, search_field)
-
@staticmethod
def build_gkeydict(info):
keyinfo = {}
@@ -222,6 +247,9 @@ class Main(object):
values = info[field]
if values and field in ['uid', 'cn' ]:
value = values[0]
+ # separate out short/long key id's
+ elif values and x in ['keyid', 'longkeyid']:
+ value = get_key_ids(x, values)
else:
value = values
if 'undefined' in values:
@@ -234,10 +262,3 @@ class Main(object):
keyinfo.append(None)
return keyinfo
-
-if __name__ == '__main__':
-
- Main()
-
-
-
diff --git a/gkeyldap/search.py b/gkeyldap/search.py
index 66721f1..8d323f4 100644
--- a/gkeyldap/search.py
+++ b/gkeyldap/search.py
@@ -19,7 +19,7 @@ gkey2ldap_map = {
'nick': 'uid',
'name': 'cn',
'keyid': 'gpgkey',
- 'longkeyid': '',
+ 'longkeyid': 'gpgkey',
'keyring': '',
'fingerprint': 'gpgfingerprint'
}
next reply other threads:[~2013-06-23 7:14 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-23 7:13 Brian Dolbec [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-08-20 3:55 [gentoo-commits] proj/gentoo-keys:master commit in: gkeyldap/ Brian Dolbec
2014-05-27 20:56 Brian Dolbec
2014-05-15 17:20 Brian Dolbec
2013-11-15 9:16 Brian Dolbec
2013-11-10 1:01 Brian Dolbec
2013-11-10 1:01 Brian Dolbec
2013-11-10 1:01 Brian Dolbec
2013-07-16 0:50 Brian Dolbec
2013-07-06 19:02 Brian Dolbec
2013-07-06 19:02 Brian Dolbec
2013-07-06 19:02 Brian Dolbec
2013-06-23 7:13 Brian Dolbec
2013-06-23 7:13 Brian Dolbec
2013-06-23 7:13 Brian Dolbec
2013-06-23 7:13 Brian Dolbec
2013-06-23 7:13 Brian Dolbec
2013-06-23 7:13 Brian Dolbec
2013-06-23 7:13 Brian Dolbec
2013-06-23 7:13 Brian Dolbec
2013-06-23 7:13 Brian Dolbec
2013-06-23 7:13 Brian Dolbec
2013-06-23 7:13 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=1371961859.488a4f389606423451dc36af3920803b2a14de7c.dol-sen@gentoo \
--to=brian.dolbec@gmail.com \
--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