g10: Return proper error when gpg-agent fails to start during probe.
authorMarcus Brinkmann <marcus.brinkmann@ruhr-uni-bochum.de>
Thu, 20 Jul 2017 15:41:49 +0000 (17:41 +0200)
committerMarcus Brinkmann <marcus.brinkmann@ruhr-uni-bochum.de>
Thu, 20 Jul 2017 15:47:04 +0000 (17:47 +0200)
* g10/getkey.c (lookup): Return immediately on any other error than
GPG_ERR_NO_SECKEY from agent_probe_any_secret_key.

Signed-off-by: Marcus Brinkmann <mb@g10code.com>
GnuPG-bug-id: 2204

g10/getkey.c

index 285ea35..2bec984 100644 (file)
@@ -3741,8 +3741,14 @@ lookup (ctrl_t ctrl, getkey_ctx_t ctx, int want_secret,
          goto skip;
        }
 
-      if (want_secret && agent_probe_any_secret_key (NULL, keyblock))
-        goto skip; /* No secret key available.  */
+      if (want_secret)
+       {
+         rc = agent_probe_any_secret_key (NULL, keyblock);
+         if (gpg_err_code(rc) == GPG_ERR_NO_SECKEY)
+           goto skip; /* No secret key available.  */
+         if (rc)
+           goto found; /* Unexpected error.  */
+       }
 
       /* Warning: node flag bits 0 and 1 should be preserved by
        * merge_selfsigs.  */