Return GPG_ERR_CARD_NOT_PRESENT when pinentry-mode=loopback.
authorBen Kibbey <bjk@luxsci.net>
Thu, 26 Jan 2012 00:16:33 +0000 (19:16 -0500)
committerBen Kibbey <bjk@luxsci.net>
Thu, 26 Jan 2012 00:41:05 +0000 (19:41 -0500)
Since there isn't a way to prompt the user to insert the smartcard when
pinentry-mode=loopback, return GPG_ERR_CARD_NOT_PRESENT instead of
GPG_ERR_NO_PIN_ENTRY.

* agent/divert-scd.c (ask_for_card): Return GPG_ERR_CARD_NOT_PRESENT
when pinentry-mode=loopback.

agent/divert-scd.c

index f176a6b..5926424 100644 (file)
@@ -99,6 +99,10 @@ ask_for_card (ctrl_t ctrl, const unsigned char *shadow_info, char **r_kid)
           else
             {
               rc = agent_get_confirmation (ctrl, desc, NULL, NULL, 0);
+             if (ctrl->pinentry_mode == PINENTRY_MODE_LOOPBACK &&
+                 gpg_err_code (rc) == GPG_ERR_NO_PIN_ENTRY)
+               rc = gpg_error (GPG_ERR_CARD_NOT_PRESENT);
+
               xfree (desc);
             }
         }