From 833d30c68f4b72ee52f49d3aa3abc700f7f32329 Mon Sep 17 00:00:00 2001 From: Alexey Berezhok Date: Tue, 4 Apr 2023 19:00:21 +0300 Subject: [PATCH] Fix pesign --- src/password.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/password.c b/src/password.c index 05add9a..7e4d6b6 100644 --- a/src/password.c +++ b/src/password.c @@ -365,17 +365,25 @@ err: } char * -get_password_passthrough(PK11SlotInfo *slot UNUSED, - PRBool retry, void *arg) +get_password_passthrough(PK11SlotInfo *slot UNUSED, PRBool retry, void *arg) { - if (retry || !arg) - return NULL; + cms_context *cms; + secuPWData *pwdata; + + if (retry || !arg) + return NULL; - char *ret = strdup(arg); - if (!ret) - err(1, "Could not allocate memory"); + cms = (cms_context *)arg; + pwdata = &cms->pwdata; - return ret; + if (pwdata->source != PW_PLAINTEXT) + return NULL; + + char *ret = strdup(pwdata->data); + if (!ret) + err(1, "Could not allocate memory"); + + return ret; } char * -- 2.39.1