x509: Replace the comma separated string AC group builder with a list based one
This commit is contained in:
@@ -38,7 +38,7 @@ ENUM(builder_part_names, BUILD_FROM_FILE, BUILD_END,
|
||||
"BUILD_SERIAL",
|
||||
"BUILD_DIGEST_ALG",
|
||||
"BUILD_ENCRYPTION_ALG",
|
||||
"BUILD_IETF_GROUP_ATTR",
|
||||
"BUILD_AC_GROUP_STRINGS",
|
||||
"BUILD_CA_CERT",
|
||||
"BUILD_CERT",
|
||||
"BUILD_CRL_DISTRIBUTION_POINTS",
|
||||
@@ -72,4 +72,3 @@ ENUM(builder_part_names, BUILD_FROM_FILE, BUILD_END,
|
||||
"BUILD_THRESHOLD",
|
||||
"BUILD_END",
|
||||
);
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ enum builder_part_t {
|
||||
BUILD_DIGEST_ALG,
|
||||
/** encryption algorithm to use, encryption_algorithm_t */
|
||||
BUILD_ENCRYPTION_ALG,
|
||||
/** a comma-separated list of ietf group attributes, char* */
|
||||
BUILD_IETF_GROUP_ATTR,
|
||||
/** list of AC group memberships, linked_list_t* with char* */
|
||||
BUILD_AC_GROUP_STRINGS,
|
||||
/** a ca certificate, certificate_t* */
|
||||
BUILD_CA_CERT,
|
||||
/** a certificate, certificate_t* */
|
||||
|
||||
@@ -1065,15 +1065,15 @@ x509_ac_t *x509_ac_load(certificate_type_t type, va_list args)
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a comma separated group list into AC group memberships
|
||||
* Add groups from a list into AC group memberships
|
||||
*/
|
||||
static void add_groups_from_string(private_x509_ac_t *this, char *str)
|
||||
static void add_groups_from_list(private_x509_ac_t *this, linked_list_t *list)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
group_t *group;
|
||||
char *name;
|
||||
|
||||
enumerator = enumerator_create_token(str, ",", " ");
|
||||
enumerator = list->create_enumerator(list);
|
||||
while (enumerator->enumerate(enumerator, &name))
|
||||
{
|
||||
INIT(group,
|
||||
@@ -1106,8 +1106,8 @@ x509_ac_t *x509_ac_gen(certificate_type_t type, va_list args)
|
||||
case BUILD_SERIAL:
|
||||
ac->serialNumber = chunk_clone(va_arg(args, chunk_t));
|
||||
continue;
|
||||
case BUILD_IETF_GROUP_ATTR:
|
||||
add_groups_from_string(ac, va_arg(args, char*));
|
||||
case BUILD_AC_GROUP_STRINGS:
|
||||
add_groups_from_list(ac, va_arg(args, linked_list_t*));
|
||||
continue;
|
||||
case BUILD_CERT:
|
||||
ac->holderCert = va_arg(args, certificate_t*);
|
||||
|
||||
Reference in New Issue
Block a user