aboutsummaryrefslogtreecommitdiffstats
path: root/agent/call-pinentry.c
diff options
context:
space:
mode:
Diffstat (limited to 'agent/call-pinentry.c')
-rw-r--r--agent/call-pinentry.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index 5e9685f61..172a88914 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -32,9 +32,9 @@
# include <signal.h>
#endif
#include <pth.h>
-#include <assuan.h>
#include "agent.h"
+#include <assuan.h>
#include "setenv.h"
#include "i18n.h"
@@ -158,7 +158,7 @@ unlock_pinentry (int rc)
if (!rc)
rc = gpg_error (GPG_ERR_INTERNAL);
}
- assuan_disconnect (ctx);
+ assuan_release (ctx);
return rc;
}
@@ -196,7 +196,7 @@ atfork_cb (void *opaque, int where)
}
-static int
+static gpg_error_t
getinfo_pid_cb (void *opaque, const void *buffer, size_t length)
{
unsigned long *pid = opaque;
@@ -309,16 +309,24 @@ start_pinentry (ctrl_t ctrl)
}
no_close_list[i] = -1;
+ rc = assuan_new (&ctx);
+ if (rc)
+ {
+ log_error ("can't allocate assuan context: %s\n", gpg_strerror (rc));
+ return rc;
+ }
+
/* Connect to the pinentry and perform initial handshaking. Note
that atfork is used to change the environment for pinentry. We
start the server in detached mode to suppress the console window
under Windows. */
- rc = assuan_pipe_connect_ext (&ctx, opt.pinentry_program, argv,
+ rc = assuan_pipe_connect_ext (ctx, opt.pinentry_program, argv,
no_close_list, atfork_cb, ctrl, 128);
if (rc)
{
log_error ("can't connect to the PIN entry module: %s\n",
gpg_strerror (rc));
+ assuan_release (ctx);
return unlock_pinentry (gpg_error (GPG_ERR_NO_PIN_ENTRY));
}
entry_ctx = ctx;
@@ -463,7 +471,7 @@ pinentry_active_p (ctrl_t ctrl, int waitseconds)
}
-static int
+static gpg_error_t
getpin_cb (void *opaque, const void *buffer, size_t length)
{
struct entry_parm_s *parm = opaque;
@@ -553,7 +561,7 @@ estimate_passphrase_quality (const char *pw)
/* Handle the QUALITY inquiry. */
-static int
+static gpg_error_t
inq_quality (void *opaque, const char *line)
{
assuan_context_t ctx = opaque;