From f541e1d95a91d4764c7ed0df10c293bfd493dd41 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Wed, 24 Jun 2020 12:44:02 +0200 Subject: agent: separate out daemon handling infrastructure for reuse * agent/call-scd.c: Factor re-usable code out to ... * agent/call-daemon.c: new. Store infos in an array to allow for other backend daemons. * agent/Makefile.am (gpg_agent_SOURCES): Add new file. * agent/agent.h: Include assuan.h. (enum daemon_type): New. (opt): Replace scdaemon_program by daemon_program array. Replace scd_local by a array d_local. Change users accordingly. -- The model I'm using for a TPM daemon is the current scdaemon. That includes start and stop handlers plus liveness checks and an assuan socket generator. To avoid massive code duplication (and save me a lot of effort), I've elected to strip this code out of call-scd.c into a generic framework which can then be reused as is by the TPM handling daemon. Signed-off-by: James Bottomley Co-authored-by: Werner Koch Modified original patch for 2.2 heavily to fit the new framework used in master (gnupg 2.3) Signed-off-by: Werner Koch --- agent/command-ssh.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'agent/command-ssh.c') diff --git a/agent/command-ssh.c b/agent/command-ssh.c index 2f8712b5c..5e3ce4c39 100644 --- a/agent/command-ssh.c +++ b/agent/command-ssh.c @@ -2476,7 +2476,7 @@ ssh_handler_request_identities (ctrl_t ctrl, reader - this should be allowed even without being listed in sshcontrol. */ - if (!opt.disable_scdaemon) + if (!opt.disable_daemon[DAEMON_SCD]) { char *serialno; struct card_key_info_s *keyinfo_list; @@ -3610,8 +3610,8 @@ start_command_handler_ssh (ctrl_t ctrl, gnupg_fd_t sock_client) es_ungetc (c, stream_sock); } - /* Reset the SCD in case it has been used. */ - agent_reset_scd (ctrl); + /* Reset the daemon in case it has been used. */ + agent_reset_daemon (ctrl); out: @@ -3758,8 +3758,8 @@ serve_mmapped_ssh_request (ctrl_t ctrl, valid_response = 1; } - /* Reset the SCD in case it has been used. */ - agent_reset_scd (ctrl); + /* Reset the daemon in case it has been used. */ + agent_reset_daemon (ctrl); return valid_response? 0 : -1; } -- cgit v1.2.3