From: Aki Tuomi Date: Thu, 17 Jul 2014 14:14:00 +0000 (+0300) Subject: Use 0.20 API if present X-Git-Tag: auth-3.4.0-rc1~66^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa8f416fa27c7cd27f39f7ecc3075df1a18b67d6;p=thirdparty%2Fpdns.git Use 0.20 API if present --- diff --git a/pdns/pkcs11signers.cc b/pdns/pkcs11signers.cc index d5c36ded06..847a027459 100644 --- a/pdns/pkcs11signers.cc +++ b/pdns/pkcs11signers.cc @@ -62,6 +62,10 @@ class P11KitSlot; typedef enum { Attribute_Byte, Attribute_Long, Attribute_String } CkaValueType; +#ifdef HAVE_P11KIT1_V2 +static CK_FUNCTION_LIST** p11_modules; +#endif + // Attribute handling class P11KitAttribute { private: @@ -264,7 +268,11 @@ class P11KitModule // basically get the function list bool initialize() { +#ifdef HAVE_P11KIT1_V2 + functions = p11_kit_module_for_name(p11_modules, d_module.c_str()); +#else functions = p11_kit_registered_name_to_module(d_module.c_str()); +#endif if (functions == NULL) return false; return true; }; @@ -839,10 +847,18 @@ struct LoaderStruct { LoaderStruct() { +#ifdef HAVE_P11KIT1_V2 + p11_modules = p11_kit_modules_load(NULL, 0); +#else p11_kit_initialize_registered(); +#endif }; ~LoaderStruct() { +#ifdef HAVE_P11KIT1_V2 + p11_kit_modules_release(p11_modules); +#else p11_kit_finalize_registered(); +#endif }; } loaderPkcs11; }