From 31a40b6b56b6ef7d88d6ad2cb2f27bf3fee48e77 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Tue, 26 Oct 2010 18:13:55 -0400 Subject: [PATCH 072/150] - nickname a pkcs11 module with a namespace --- src/plugins/preauth/pkinit/pkinit_crypto_nss.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_nss.c b/src/plugins/preauth/pkinit/pkinit_crypto_nss.c index cef28ee..69bf762 100644 --- a/src/plugins/preauth/pkinit/pkinit_crypto_nss.c +++ b/src/plugins/preauth/pkinit/pkinit_crypto_nss.c @@ -1708,11 +1708,19 @@ crypto_load_pkcs11(krb5_context context, CERTCertListNode *node; CERTCertTrust trust; SECStatus status; + char *name; int i, j; if (spec == NULL) { return SECFailure; } + + name = PORT_Alloc(strlen(spec) + strlen("pkinit:") + 1); + if (name == NULL) { + return SECFailure; + } + sprintf(name, "pkinit:%s", spec); + certdb = CERT_GetDefaultCertDB(); /* Count the number of modules we've already loaded. */ if (id_cryptoctx->id_modules != NULL) { @@ -1729,7 +1737,8 @@ crypto_load_pkcs11(krb5_context context, id_modules[j] = id_cryptoctx->id_modules[i]; } /* Actually load the module. */ - module = SECMOD_CreateModule(spec, spec, NULL, NULL); + module = SECMOD_CreateModule(spec, name, NULL, NULL); + PORT_Free(name); if (module == NULL) { pkiDebug("%s: error loading PKCS11 module \"%s\"", __FUNCTION__, spec); @@ -1820,7 +1829,8 @@ crypto_load_dir(krb5_context context, pkiDebug("%s: scanning directory \"%s\"\n", __FUNCTION__, dirname); i = strlen(ent->d_name); - /* Skip over anything that isn't named ".crt". */ + /* Skip over anything that isn't named ".crt" or + * ".crl", whichever we want. */ if ((i < 5) || (strcmp(ent->d_name + i - 4, suffix) != 0)) { pkiDebug("%s: skipping candidate \"%s/%s\"\n", __FUNCTION__, dirname, ent->d_name); -- 1.7.6.4