From 5dba12f14475b9be3f6cd39276d9138a83c7c515 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Wed, 14 Mar 2018 13:55:59 +0200 Subject: [PATCH] gpg: don't clear options on RESET assuan command --- libagent/gpg/__init__.py | 3 ++- libagent/gpg/agent.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libagent/gpg/__init__.py b/libagent/gpg/__init__.py index 9e2597e..60fbb9b 100644 --- a/libagent/gpg/__init__.py +++ b/libagent/gpg/__init__.py @@ -228,9 +228,10 @@ def run_agent(device_type): pubkey_bytes = keyring.export_public_keys(env=env) device_type.ui = device.ui.UI(device_type=device_type, config=vars(args)) - handler = agent.Handler(device=device_type(), pubkey_bytes=pubkey_bytes) with server.unix_domain_socket_server(sock_path) as sock: for conn in agent.yield_connections(sock): + handler = agent.Handler(device=device_type(), + pubkey_bytes=pubkey_bytes) with contextlib.closing(conn): try: handler.handle(conn) diff --git a/libagent/gpg/agent.py b/libagent/gpg/agent.py index 1bfad8f..e60b3e9 100644 --- a/libagent/gpg/agent.py +++ b/libagent/gpg/agent.py @@ -79,6 +79,7 @@ class Handler(object): def __init__(self, device, pubkey_bytes): """C-tor.""" self.reset() + self.options = [] device.ui.options_getter = self._get_options self.client = client.Client(device=device) # Cache public keys from GnuPG @@ -108,7 +109,6 @@ class Handler(object): self.keygrip = None self.digest = None self.algo = None - self.options = [] def handle_option(self, opt): """Store GPG agent-related options (e.g. for pinentry)."""