1 |
commit: 6a3a033243058a2724bc6c8d8cb2b2bd6cf73109 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jul 4 23:02:12 2018 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jul 7 05:22:12 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gentoo-keys.git/commit/?id=6a3a0332 |
7 |
|
8 |
gkeys actions.py: Add verify() recursion detection and exit |
9 |
|
10 |
Handles the case of incorrect configuration or keyring problems. |
11 |
Reported by irc user "puchu" in #gentoo-keys. |
12 |
|
13 |
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org> |
14 |
|
15 |
gkeys/gkeys/actionbase.py | 1 + |
16 |
gkeys/gkeys/actions.py | 10 +++++++++- |
17 |
2 files changed, 10 insertions(+), 1 deletion(-) |
18 |
|
19 |
diff --git a/gkeys/gkeys/actionbase.py b/gkeys/gkeys/actionbase.py |
20 |
index 3993be4..23b7161 100644 |
21 |
--- a/gkeys/gkeys/actionbase.py |
22 |
+++ b/gkeys/gkeys/actionbase.py |
23 |
@@ -43,6 +43,7 @@ class ActionBase(object): |
24 |
self._keyhandler = None |
25 |
self._gpg = None |
26 |
self.category = None |
27 |
+ self.verify_recursion = False |
28 |
|
29 |
|
30 |
@property |
31 |
|
32 |
diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py |
33 |
index 0f03880..f9bba7a 100644 |
34 |
--- a/gkeys/gkeys/actions.py |
35 |
+++ b/gkeys/gkeys/actions.py |
36 |
@@ -779,7 +779,7 @@ class Actions(ActionBase): |
37 |
if not keys: |
38 |
return (False, ['No installed keys found, try installkey action.']) |
39 |
key = self.seedhandler.seeds.nick_search(args.nick) |
40 |
- if not key: |
41 |
+ if not key and not self.verify_recursion: |
42 |
if args.nick: |
43 |
messages.append(_unicode( |
44 |
"Failed to find.........: %s in category: %s") |
45 |
@@ -788,7 +788,15 @@ class Actions(ActionBase): |
46 |
args.nick = self.config.get_key('verify-nick') |
47 |
messages.append(_unicode("Using config defaults..: %s %s") |
48 |
% (args.category, args.nick)) |
49 |
+ self.verify_recursion = True |
50 |
return self.verify(args, messages) |
51 |
+ elif self.verify_recursion: |
52 |
+ messages.append(_unicode( |
53 |
+ "Failed to find.........: %s in category: %s") |
54 |
+ % (args.category, args.nick)) |
55 |
+ messages.append(" ...giving up") |
56 |
+ self.verify_recursion = False |
57 |
+ return (False, ['No installed verification keys found, try installkey action.']) |
58 |
return self._verify(args, key, messages) |