mirror of
https://github.com/romanz/amodem.git
synced 2026-04-21 05:36:42 +08:00
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('sys.argv: %s', sys.argv)
|
||||||
log.debug('os.environ: %s', os.environ)
|
log.debug('os.environ: %s', os.environ)
|
||||||
try:
|
try:
|
||||||
sock_path = keyring.get_agent_sock_path(env={'GNUPGHOME': args.homedir})
|
env = {'GNUPGHOME': args.homedir}
|
||||||
handler = agent.Handler(device=device_type())
|
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:
|
with server.unix_domain_socket_server(sock_path) as sock:
|
||||||
for conn in agent.yield_connections(sock):
|
for conn in agent.yield_connections(sock):
|
||||||
with contextlib.closing(conn):
|
with contextlib.closing(conn):
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class AgentStop(Exception):
|
|||||||
class Handler(object):
|
class Handler(object):
|
||||||
"""GPG agent requests' handler."""
|
"""GPG agent requests' handler."""
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device, pubkey_bytes):
|
||||||
"""C-tor."""
|
"""C-tor."""
|
||||||
self.client = client.Client(device=device)
|
self.client = client.Client(device=device)
|
||||||
# Cache ASSUAN commands' arguments between commands
|
# Cache ASSUAN commands' arguments between commands
|
||||||
@@ -76,7 +76,7 @@ class Handler(object):
|
|||||||
self.digest = None
|
self.digest = None
|
||||||
self.algo = None
|
self.algo = None
|
||||||
# Cache public keys from GnuPG
|
# Cache public keys from GnuPG
|
||||||
self.pubkey_bytes = keyring.export_public_keys()
|
self.pubkey_bytes = pubkey_bytes
|
||||||
# "Clone" existing GPG version
|
# "Clone" existing GPG version
|
||||||
self.version = keyring.gpg_version()
|
self.version = keyring.gpg_version()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user