agent: Stop scdaemon after reload when disable_scdaemon.
authorNIIBE Yutaka <gniibe@fsij.org>
Thu, 23 May 2019 01:15:18 +0000 (10:15 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Thu, 23 May 2019 01:15:18 +0000 (10:15 +0900)
* agent/call-scd.c (agent_card_killscd): New.
* agent/gpg-agent.c (agent_sighup_action): Call agent_card_killscd.

--

GnuPG-bug-id: 4326
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
agent/agent.h
agent/call-scd.c
agent/gpg-agent.c

index 77672bd..ec8370c 100644 (file)
@@ -618,6 +618,7 @@ int agent_card_scd (ctrl_t ctrl, const char *cmdline,
 void agent_card_free_keyinfo (struct card_key_info_s *l);
 gpg_error_t agent_card_keyinfo (ctrl_t ctrl, const char *keygrip,
                                 struct card_key_info_s **result);
+void agent_card_killscd (void);
 
 
 /*-- learncard.c --*/
index 5b53b02..a96f5b7 100644 (file)
@@ -1515,3 +1515,12 @@ agent_card_scd (ctrl_t ctrl, const char *cmdline,
 
   return unlock_scd (ctrl, 0);
 }
+
+void
+agent_card_killscd (void)
+{
+  if (primary_scd_ctx == NULL)
+    return;
+  assuan_transact (primary_scd_ctx, "KILLSCD",
+                   NULL, NULL, NULL, NULL, NULL, NULL);
+}
index d3fe7fe..57d5a45 100644 (file)
@@ -2441,6 +2441,9 @@ agent_sighup_action (void)
      "pinentry" binary that one can be used in case the
      "pinentry-basic" fallback was in use.  */
   gnupg_module_name_flush_some ();
+
+  if (opt.disable_scdaemon)
+    agent_card_killscd ();
 }