refactored credential builder
allow enumeration of matching builders try a second builder if the first one fails builder clones resources internally on demand caller frees added resources on failure and success stricter handling of non-supported build parts
This commit is contained in:
@@ -238,27 +238,28 @@ static pubkey_cert_t *build(private_builder_t *this)
|
||||
*/
|
||||
static void add(private_builder_t *this, builder_part_t part, ...)
|
||||
{
|
||||
va_list args;
|
||||
if (!this->key)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
switch (part)
|
||||
{
|
||||
case BUILD_PUBLIC_KEY:
|
||||
{
|
||||
va_start(args, part);
|
||||
this->key = pubkey_cert_create(va_arg(args, public_key_t*));
|
||||
va_end(args);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (this->key)
|
||||
{
|
||||
DBG1("ignoring surplus build part %N", builder_part_names, part);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (part)
|
||||
{
|
||||
case BUILD_PUBLIC_KEY:
|
||||
{
|
||||
va_start(args, part);
|
||||
this->key = pubkey_cert_create(va_arg(args, public_key_t*));
|
||||
va_end(args);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
DBG1("ignoring unsupported build part %N", builder_part_names, part);
|
||||
break;
|
||||
destroy((private_pubkey_cert_t*)this->key);
|
||||
}
|
||||
builder_cancel(&this->public);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user