From c07c79a1d795ac8f50981637fe32383abb3e969d Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Thu, 26 May 2022 14:08:27 +0900 Subject: [PATCH] agent: Fix get_keyinfo_on_cards. * agent/command.c (get_keyinfo_on_cards): Make it static. Don't return bogus value on error. Return NULL when scdaemon is disabled. -- Signed-off-by: NIIBE Yutaka --- agent/command.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/agent/command.c b/agent/command.c index 2058c2a59..6faca6219 100644 --- a/agent/command.c +++ b/agent/command.c @@ -445,10 +445,13 @@ leave_cmd (assuan_context_t ctx, gpg_error_t err) /* Take the keyinfo for cards from our local cache. Actually this * cache could be a global one but then we would need to employ * reference counting. */ -struct card_key_info_s * +static struct card_key_info_s * get_keyinfo_on_cards (ctrl_t ctrl) { - struct card_key_info_s *keyinfo_on_cards; + struct card_key_info_s *keyinfo_on_cards = NULL; + + if (opt.disable_daemon[DAEMON_SCD]) + return NULL; if (ctrl->server_local->last_card_keyinfo.ki && ctrl->server_local->last_card_keyinfo.eventno == eventcounter.card