From d72811a2c09411f8fdc821eb78d16ce8fbd5a184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Mon, 14 Aug 2023 11:39:27 +0200 Subject: [PATCH] core: Store engine's version string in gpgsm engine * src/engine-gpgsm.c (struct engine_gpgsm): Add field 'version'. (gpgsm_new): Copy version string. (gpgsm_release): Free VERSION. -- GnuPG-bug-id: 6648 --- src/engine-gpgsm.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c index 07c76e9b..cfbef315 100644 --- a/src/engine-gpgsm.c +++ b/src/engine-gpgsm.c @@ -68,6 +68,7 @@ typedef struct struct engine_gpgsm { assuan_context_t assuan_ctx; + char *version; int lc_ctype_set; int lc_messages_set; @@ -254,6 +255,9 @@ gpgsm_release (void *engine) gpgsm_cancel (engine); + if (gpgsm->version) + free (gpgsm->version); + gpgme_data_release (gpgsm->diagnostics); free (gpgsm->colon.attic.line); @@ -281,12 +285,20 @@ gpgsm_new (void **engine, const char *file_name, const char *home_dir, char *optstr; unsigned int connect_flags; - (void)version; /* Not yet used. */ - gpgsm = calloc (1, sizeof *gpgsm); if (!gpgsm) return gpg_error_from_syserror (); + if (version) + { + gpgsm->version = strdup (version); + if (!gpgsm->version) + { + err = gpg_error_from_syserror (); + goto leave; + } + } + gpgsm->status_cb.fd = -1; gpgsm->status_cb.dir = 1; gpgsm->status_cb.tag = 0;