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
This commit is contained in:
Ingo Klöcker 2023-08-14 11:39:27 +02:00
parent 8701e98937
commit d72811a2c0
No known key found for this signature in database
GPG Key ID: F5A5D1692277A1E9

View File

@ -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;