diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2018-10-25 09:20:20 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2018-10-25 09:20:20 +0200 |
commit | 0240345728a84d8f235ce05889e83963e52742eb (patch) | |
tree | 6981b0b2439a4a4e691849ed390c9b3f454e91cf /g10/card-util.c | |
parent | all: fix spelling and typos (diff) | |
download | gnupg2-0240345728a84d8f235ce05889e83963e52742eb.tar.xz gnupg2-0240345728a84d8f235ce05889e83963e52742eb.zip |
g10,scd: Improve UIF support.
* g10/call-agent.c (learn_status_cb): Parse "bt" flag.
* g10/call-agent.h: New member field "bt".
* g10/card-util.c (uif): Limit its access only when it is supported.
* scd/app-openpgp.c (do_setattr): Allow access to UIF objects only
when there is a button.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'g10/card-util.c')
-rw-r--r-- | g10/card-util.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/g10/card-util.c b/g10/card-util.c index 234abcbab..5205798b6 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -2114,10 +2114,31 @@ kdf_setup (const char *args) static void uif (int arg_number, const char *arg_rest) { + struct agent_card_info_s info; + int feature_available; gpg_error_t err; char name[100]; unsigned char data[2]; + memset (&info, 0, sizeof info); + + err = agent_scd_getattr ("EXTCAP", &info); + if (err) + { + log_error (_("error getting card info: %s\n"), gpg_strerror (err)); + return; + } + + feature_available = info.extcap.bt; + agent_release_card_info (&info); + + if (!feature_available) + { + log_error (_("This command is not supported by this card\n")); + tty_printf ("\n"); + return; + } + snprintf (name, sizeof name, "UIF-%d", arg_number); if ( !strcmp (arg_rest, "off") ) data[0] = 0x00; |