core: Pass the engine's version string to the engine's new function.
* src/engine-backend.h (engine_ops): Add arg 'version' to NEW. * src/engine-assuan.c (llass_new): Add dummy arg 'version'. * src/engine-g13.c (g13_new): Ditto. * src/engine-gpgconf.c (gpgconf_new): Ditto. * src/engine-gpgsm.c (gpgsm_new): Ditto. * src/engine-spawn.c (engspawn_new): Ditto. * src/engine-uiserver.c (uiserver_new): Ditto. * src/engine.c (_gpgme_engine_new): Pass version string to the new function. * src/engine-gpg.c (struct engine_gpg): Add field 'version'. (gpg_new): Add arg 'version'. (gpg_release): Free VERSION. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
537cb871fd
commit
2095b1573a
@ -212,12 +212,15 @@ llass_release (void *engine)
|
|||||||
/* Create a new instance. If HOME_DIR is NULL standard options for use
|
/* Create a new instance. If HOME_DIR is NULL standard options for use
|
||||||
with gpg-agent are issued. */
|
with gpg-agent are issued. */
|
||||||
static gpgme_error_t
|
static gpgme_error_t
|
||||||
llass_new (void **engine, const char *file_name, const char *home_dir)
|
llass_new (void **engine, const char *file_name, const char *home_dir,
|
||||||
|
const char *version)
|
||||||
{
|
{
|
||||||
gpgme_error_t err = 0;
|
gpgme_error_t err = 0;
|
||||||
engine_llass_t llass;
|
engine_llass_t llass;
|
||||||
char *optstr;
|
char *optstr;
|
||||||
|
|
||||||
|
(void)version; /* Not yet used. */
|
||||||
|
|
||||||
llass = calloc (1, sizeof *llass);
|
llass = calloc (1, sizeof *llass);
|
||||||
if (!llass)
|
if (!llass)
|
||||||
return gpg_error_from_syserror ();
|
return gpg_error_from_syserror ();
|
||||||
|
@ -44,7 +44,8 @@ struct engine_ops
|
|||||||
const char *(*get_req_version) (void);
|
const char *(*get_req_version) (void);
|
||||||
|
|
||||||
gpgme_error_t (*new) (void **r_engine,
|
gpgme_error_t (*new) (void **r_engine,
|
||||||
const char *file_name, const char *home_dir);
|
const char *file_name, const char *home_dir,
|
||||||
|
const char *version);
|
||||||
|
|
||||||
/* Member functions. */
|
/* Member functions. */
|
||||||
void (*release) (void *engine);
|
void (*release) (void *engine);
|
||||||
|
@ -212,7 +212,8 @@ g13_release (void *engine)
|
|||||||
|
|
||||||
|
|
||||||
static gpgme_error_t
|
static gpgme_error_t
|
||||||
g13_new (void **engine, const char *file_name, const char *home_dir)
|
g13_new (void **engine, const char *file_name, const char *home_dir,
|
||||||
|
const char *version)
|
||||||
{
|
{
|
||||||
gpgme_error_t err = 0;
|
gpgme_error_t err = 0;
|
||||||
engine_g13_t g13;
|
engine_g13_t g13;
|
||||||
@ -224,6 +225,8 @@ g13_new (void **engine, const char *file_name, const char *home_dir)
|
|||||||
char *dft_ttytype = NULL;
|
char *dft_ttytype = NULL;
|
||||||
char *optstr;
|
char *optstr;
|
||||||
|
|
||||||
|
(void)version; /* Not yet used. */
|
||||||
|
|
||||||
g13 = calloc (1, sizeof *g13);
|
g13 = calloc (1, sizeof *g13);
|
||||||
if (!g13)
|
if (!g13)
|
||||||
return gpg_error_from_syserror ();
|
return gpg_error_from_syserror ();
|
||||||
|
@ -78,6 +78,7 @@ typedef gpgme_error_t (*colon_preprocessor_t) (char *line, char **rline);
|
|||||||
struct engine_gpg
|
struct engine_gpg
|
||||||
{
|
{
|
||||||
char *file_name;
|
char *file_name;
|
||||||
|
char *version;
|
||||||
|
|
||||||
char *lc_messages;
|
char *lc_messages;
|
||||||
char *lc_ctype;
|
char *lc_ctype;
|
||||||
@ -388,6 +389,8 @@ gpg_release (void *engine)
|
|||||||
|
|
||||||
if (gpg->file_name)
|
if (gpg->file_name)
|
||||||
free (gpg->file_name);
|
free (gpg->file_name);
|
||||||
|
if (gpg->version)
|
||||||
|
free (gpg->version);
|
||||||
|
|
||||||
if (gpg->lc_messages)
|
if (gpg->lc_messages)
|
||||||
free (gpg->lc_messages);
|
free (gpg->lc_messages);
|
||||||
@ -416,7 +419,8 @@ gpg_release (void *engine)
|
|||||||
|
|
||||||
|
|
||||||
static gpgme_error_t
|
static gpgme_error_t
|
||||||
gpg_new (void **engine, const char *file_name, const char *home_dir)
|
gpg_new (void **engine, const char *file_name, const char *home_dir,
|
||||||
|
const char *version)
|
||||||
{
|
{
|
||||||
engine_gpg_t gpg;
|
engine_gpg_t gpg;
|
||||||
gpgme_error_t rc = 0;
|
gpgme_error_t rc = 0;
|
||||||
@ -438,6 +442,16 @@ gpg_new (void **engine, const char *file_name, const char *home_dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (version)
|
||||||
|
{
|
||||||
|
gpg->version = strdup (version);
|
||||||
|
if (!gpg->version)
|
||||||
|
{
|
||||||
|
rc = gpg_error_from_syserror ();
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gpg->argtail = &gpg->arglist;
|
gpg->argtail = &gpg->arglist;
|
||||||
gpg->status.fd[0] = -1;
|
gpg->status.fd[0] = -1;
|
||||||
gpg->status.fd[1] = -1;
|
gpg->status.fd[1] = -1;
|
||||||
|
@ -90,11 +90,14 @@ gpgconf_release (void *engine)
|
|||||||
|
|
||||||
|
|
||||||
static gpgme_error_t
|
static gpgme_error_t
|
||||||
gpgconf_new (void **engine, const char *file_name, const char *home_dir)
|
gpgconf_new (void **engine, const char *file_name, const char *home_dir,
|
||||||
|
const char *version)
|
||||||
{
|
{
|
||||||
gpgme_error_t err = 0;
|
gpgme_error_t err = 0;
|
||||||
engine_gpgconf_t gpgconf;
|
engine_gpgconf_t gpgconf;
|
||||||
|
|
||||||
|
(void)version; /* Not yet used. */
|
||||||
|
|
||||||
gpgconf = calloc (1, sizeof *gpgconf);
|
gpgconf = calloc (1, sizeof *gpgconf);
|
||||||
if (!gpgconf)
|
if (!gpgconf)
|
||||||
return gpg_error_from_syserror ();
|
return gpg_error_from_syserror ();
|
||||||
|
@ -237,7 +237,8 @@ gpgsm_release (void *engine)
|
|||||||
|
|
||||||
|
|
||||||
static gpgme_error_t
|
static gpgme_error_t
|
||||||
gpgsm_new (void **engine, const char *file_name, const char *home_dir)
|
gpgsm_new (void **engine, const char *file_name, const char *home_dir,
|
||||||
|
const char *version)
|
||||||
{
|
{
|
||||||
gpgme_error_t err = 0;
|
gpgme_error_t err = 0;
|
||||||
engine_gpgsm_t gpgsm;
|
engine_gpgsm_t gpgsm;
|
||||||
@ -253,6 +254,8 @@ gpgsm_new (void **engine, const char *file_name, const char *home_dir)
|
|||||||
char *dft_ttytype = NULL;
|
char *dft_ttytype = NULL;
|
||||||
char *optstr;
|
char *optstr;
|
||||||
|
|
||||||
|
(void)version; /* Not yet used. */
|
||||||
|
|
||||||
gpgsm = calloc (1, sizeof *gpgsm);
|
gpgsm = calloc (1, sizeof *gpgsm);
|
||||||
if (!gpgsm)
|
if (!gpgsm)
|
||||||
return gpg_error_from_syserror ();
|
return gpg_error_from_syserror ();
|
||||||
|
@ -324,12 +324,14 @@ engspawn_get_req_version (void)
|
|||||||
|
|
||||||
|
|
||||||
static gpgme_error_t
|
static gpgme_error_t
|
||||||
engspawn_new (void **engine, const char *file_name, const char *home_dir)
|
engspawn_new (void **engine, const char *file_name, const char *home_dir,
|
||||||
|
const char *version)
|
||||||
{
|
{
|
||||||
engine_spawn_t esp;
|
engine_spawn_t esp;
|
||||||
|
|
||||||
(void)file_name;
|
(void)file_name;
|
||||||
(void)home_dir;
|
(void)home_dir;
|
||||||
|
(void)version;
|
||||||
|
|
||||||
esp = calloc (1, sizeof *esp);
|
esp = calloc (1, sizeof *esp);
|
||||||
if (!esp)
|
if (!esp)
|
||||||
|
@ -238,7 +238,8 @@ uiserver_release (void *engine)
|
|||||||
|
|
||||||
|
|
||||||
static gpgme_error_t
|
static gpgme_error_t
|
||||||
uiserver_new (void **engine, const char *file_name, const char *home_dir)
|
uiserver_new (void **engine, const char *file_name, const char *home_dir,
|
||||||
|
const char *version)
|
||||||
{
|
{
|
||||||
gpgme_error_t err = 0;
|
gpgme_error_t err = 0;
|
||||||
engine_uiserver_t uiserver;
|
engine_uiserver_t uiserver;
|
||||||
@ -247,6 +248,8 @@ uiserver_new (void **engine, const char *file_name, const char *home_dir)
|
|||||||
char *dft_ttytype = NULL;
|
char *dft_ttytype = NULL;
|
||||||
char *optstr;
|
char *optstr;
|
||||||
|
|
||||||
|
(void)version; /* Not yet used. */
|
||||||
|
|
||||||
uiserver = calloc (1, sizeof *uiserver);
|
uiserver = calloc (1, sizeof *uiserver);
|
||||||
if (!uiserver)
|
if (!uiserver)
|
||||||
return gpg_error_from_syserror ();
|
return gpg_error_from_syserror ();
|
||||||
|
@ -463,7 +463,8 @@ _gpgme_engine_new (gpgme_engine_info_t info, engine_t *r_engine)
|
|||||||
{
|
{
|
||||||
gpgme_error_t err;
|
gpgme_error_t err;
|
||||||
err = (*engine->ops->new) (&engine->engine,
|
err = (*engine->ops->new) (&engine->engine,
|
||||||
info->file_name, info->home_dir);
|
info->file_name, info->home_dir,
|
||||||
|
info->version);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
free (engine);
|
free (engine);
|
||||||
|
Loading…
Reference in New Issue
Block a user