int subtype;
/** registered with final flag? */
bool final;
+ /** plugin that registered this algorithm */
+ const char *plugin_name;
/** builder function */
builder_function_t constructor;
};
METHOD(credential_factory_t, add_builder, void,
private_credential_factory_t *this, credential_type_t type, int subtype,
- bool final, builder_function_t constructor)
+ bool final, const char *plugin_name, builder_function_t constructor)
{
entry_t *entry = malloc_thing(entry_t);
entry->type = type;
entry->subtype = subtype;
entry->final = final;
+ entry->plugin_name = plugin_name;
entry->constructor = constructor;
this->lock->write_lock(this->lock);
this->constructors->insert_last(this->constructors, entry);
void *construct = NULL;
int failures = 0;
uintptr_t level;
+ enum_name_t *names;
+
+ switch (type)
+ {
+ case CRED_CERTIFICATE:
+ names = certificate_type_names;
+ break;
+ case CRED_CONTAINER:
+ names = container_type_names;
+ break;
+ case CRED_PRIVATE_KEY:
+ case CRED_PUBLIC_KEY:
+ default:
+ names = key_type_names;
+ break;
+ }
level = (uintptr_t)this->recursive->get(this->recursive);
this->recursive->set(this->recursive, (void*)level + 1);
{
if (entry->type == type && entry->subtype == subtype)
{
+ DBG2(DBG_LIB, "builder L%d %N - %N of plugin '%s'",
+ (int)level, credential_type_names, type, names, subtype,
+ entry->plugin_name);
va_start(args, subtype);
construct = entry->constructor(subtype, args);
va_end(args);
if (!construct && !level)
{
- enum_name_t *names;
-
- switch (type)
- {
- case CRED_CERTIFICATE:
- names = certificate_type_names;
- break;
- case CRED_CONTAINER:
- names = container_type_names;
- break;
- case CRED_PRIVATE_KEY:
- case CRED_PUBLIC_KEY:
- default:
- names = key_type_names;
- break;
- }
DBG1(DBG_LIB, "building %N - %N failed, tried %d builders",
credential_type_names, type, names, subtype, failures);
}
* @param type type of credential the builder creates
* @param subtype subtype of the credential, type specific
* @param final TRUE if this build does not invoke other builders
+ * @param plugin_name plugin that registered this builder
* @param constructor builder constructor function to register
*/
void (*add_builder)(credential_factory_t *this,
credential_type_t type, int subtype, bool final,
- builder_function_t constructor);
+ const char *plugin_name, builder_function_t constructor);
/**
* Unregister a credential builder function.
*
}
enumerator->destroy(enumerator);
- lib->creds->add_builder(lib->creds, CRED_CERTIFICATE,
- CERT_X509, FALSE, (void*)pkcs11_creds_load);
+ lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509, FALSE,
+ get_name(this), (void*)pkcs11_creds_load);
}
else
{
case FEATURE_PRIVKEY_GEN:
lib->creds->add_builder(lib->creds, CRED_PRIVATE_KEY,
feature->arg.privkey, reg->arg.reg.final,
- reg->arg.reg.f);
+ name, reg->arg.reg.f);
break;
case FEATURE_PUBKEY:
lib->creds->add_builder(lib->creds, CRED_PUBLIC_KEY,
feature->arg.pubkey, reg->arg.reg.final,
- reg->arg.reg.f);
+ name, reg->arg.reg.f);
break;
case FEATURE_CERT_DECODE:
case FEATURE_CERT_ENCODE:
lib->creds->add_builder(lib->creds, CRED_CERTIFICATE,
feature->arg.cert, reg->arg.reg.final,
- reg->arg.reg.f);
+ name, reg->arg.reg.f);
break;
case FEATURE_CONTAINER_DECODE:
case FEATURE_CONTAINER_ENCODE:
lib->creds->add_builder(lib->creds, CRED_CONTAINER,
feature->arg.container, reg->arg.reg.final,
- reg->arg.reg.f);
+ name, reg->arg.reg.f);
break;
case FEATURE_DATABASE:
lib->db->add_database(lib->db, reg->arg.reg.f);