gpg-agent: use correct GNUPGHOME when getting public keys
This commit is contained in:
@@ -208,8 +208,10 @@ def run_agent(device_type):
|
||||
log.debug('sys.argv: %s', sys.argv)
|
||||
log.debug('os.environ: %s', os.environ)
|
||||
try:
|
||||
sock_path = keyring.get_agent_sock_path(env={'GNUPGHOME': args.homedir})
|
||||
handler = agent.Handler(device=device_type())
|
||||
env = {'GNUPGHOME': args.homedir}
|
||||
sock_path = keyring.get_agent_sock_path(env=env)
|
||||
pubkey_bytes = keyring.export_public_keys(env=env)
|
||||
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):
|
||||
with contextlib.closing(conn):
|
||||
|
||||
@@ -68,7 +68,7 @@ class AgentStop(Exception):
|
||||
class Handler(object):
|
||||
"""GPG agent requests' handler."""
|
||||
|
||||
def __init__(self, device):
|
||||
def __init__(self, device, pubkey_bytes):
|
||||
"""C-tor."""
|
||||
self.client = client.Client(device=device)
|
||||
# Cache ASSUAN commands' arguments between commands
|
||||
@@ -76,7 +76,7 @@ class Handler(object):
|
||||
self.digest = None
|
||||
self.algo = None
|
||||
# Cache public keys from GnuPG
|
||||
self.pubkey_bytes = keyring.export_public_keys()
|
||||
self.pubkey_bytes = pubkey_bytes
|
||||
# "Clone" existing GPG version
|
||||
self.version = keyring.gpg_version()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user