gids: fix invalid get-gids-driver
When compiled without zlib 'get-gids-driver' returns invalid pointer.
This commit is contained in:
parent
07493c11d8
commit
77898e6175
|
@ -2039,7 +2039,7 @@ struct sc_card_driver *sc_get_gids_driver(void)
|
||||||
|
|
||||||
struct sc_card_driver *sc_get_gids_driver(void)
|
struct sc_card_driver *sc_get_gids_driver(void)
|
||||||
{
|
{
|
||||||
return SC_ERROR_WRONG_CARD;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -112,7 +112,9 @@ static const struct _sc_driver_entry internal_card_drivers[] = {
|
||||||
{ "PIV-II", (void *(*)(void)) sc_get_piv_driver },
|
{ "PIV-II", (void *(*)(void)) sc_get_piv_driver },
|
||||||
{ "itacns", (void *(*)(void)) sc_get_itacns_driver },
|
{ "itacns", (void *(*)(void)) sc_get_itacns_driver },
|
||||||
{ "isoApplet", (void *(*)(void)) sc_get_isoApplet_driver },
|
{ "isoApplet", (void *(*)(void)) sc_get_isoApplet_driver },
|
||||||
|
#ifdef ENABLE_ZLIB
|
||||||
{ "gids", (void *(*)(void)) sc_get_gids_driver },
|
{ "gids", (void *(*)(void)) sc_get_gids_driver },
|
||||||
|
#endif
|
||||||
{ "openpgp", (void *(*)(void)) sc_get_openpgp_driver },
|
{ "openpgp", (void *(*)(void)) sc_get_openpgp_driver },
|
||||||
/* The default driver should be last, as it handles all the
|
/* The default driver should be last, as it handles all the
|
||||||
* unrecognized cards. */
|
* unrecognized cards. */
|
||||||
|
@ -422,8 +424,7 @@ static int load_card_driver_options(sc_context_t *ctx,
|
||||||
return SC_SUCCESS;
|
return SC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int load_card_drivers(sc_context_t *ctx,
|
static int load_card_drivers(sc_context_t *ctx, struct _sc_ctx_options *opts)
|
||||||
struct _sc_ctx_options *opts)
|
|
||||||
{
|
{
|
||||||
const struct _sc_driver_entry *ent;
|
const struct _sc_driver_entry *ent;
|
||||||
int drv_count;
|
int drv_count;
|
||||||
|
@ -461,8 +462,14 @@ static int load_card_drivers(sc_context_t *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->card_drivers[drv_count] = func();
|
ctx->card_drivers[drv_count] = func();
|
||||||
ctx->card_drivers[drv_count]->dll = dll;
|
if (ctx->card_drivers[drv_count] == NULL) {
|
||||||
|
sc_log(ctx, "Driver '%s' not available.", ent->name);
|
||||||
|
if (dll)
|
||||||
|
sc_dlclose(dll);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->card_drivers[drv_count]->dll = dll;
|
||||||
ctx->card_drivers[drv_count]->atr_map = NULL;
|
ctx->card_drivers[drv_count]->atr_map = NULL;
|
||||||
ctx->card_drivers[drv_count]->natrs = 0;
|
ctx->card_drivers[drv_count]->natrs = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue