diff options
author | 2018-07-04 16:02:12 -0700 | |
---|---|---|
committer | 2018-07-06 22:22:12 -0700 | |
commit | 6a3a033243058a2724bc6c8d8cb2b2bd6cf73109 (patch) | |
tree | 7b0a1e6d65984d26b7a9d26caebfb1b9bbd89261 | |
parent | gkeysgen/actions.py: Use gkeys py_input and _unicode declarations (diff) | |
download | gentoo-keys-6a3a033243058a2724bc6c8d8cb2b2bd6cf73109.tar.gz gentoo-keys-6a3a033243058a2724bc6c8d8cb2b2bd6cf73109.tar.bz2 gentoo-keys-6a3a033243058a2724bc6c8d8cb2b2bd6cf73109.zip |
gkeys actions.py: Add verify() recursion detection and exit
Handles the case of incorrect configuration or keyring problems.
Reported by irc user "puchu" in #gentoo-keys.
Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
-rw-r--r-- | gkeys/gkeys/actionbase.py | 1 | ||||
-rw-r--r-- | gkeys/gkeys/actions.py | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/gkeys/gkeys/actionbase.py b/gkeys/gkeys/actionbase.py index 3993be4..23b7161 100644 --- a/gkeys/gkeys/actionbase.py +++ b/gkeys/gkeys/actionbase.py @@ -43,6 +43,7 @@ class ActionBase(object): self._keyhandler = None self._gpg = None self.category = None + self.verify_recursion = False @property diff --git a/gkeys/gkeys/actions.py b/gkeys/gkeys/actions.py index 0f03880..f9bba7a 100644 --- a/gkeys/gkeys/actions.py +++ b/gkeys/gkeys/actions.py @@ -779,7 +779,7 @@ class Actions(ActionBase): if not keys: return (False, ['No installed keys found, try installkey action.']) key = self.seedhandler.seeds.nick_search(args.nick) - if not key: + if not key and not self.verify_recursion: if args.nick: messages.append(_unicode( "Failed to find.........: %s in category: %s") @@ -788,7 +788,15 @@ class Actions(ActionBase): args.nick = self.config.get_key('verify-nick') messages.append(_unicode("Using config defaults..: %s %s") % (args.category, args.nick)) + self.verify_recursion = True return self.verify(args, messages) + elif self.verify_recursion: + messages.append(_unicode( + "Failed to find.........: %s in category: %s") + % (args.category, args.nick)) + messages.append(" ...giving up") + self.verify_recursion = False + return (False, ['No installed verification keys found, try installkey action.']) return self._verify(args, key, messages) |