aboutsummaryrefslogtreecommitdiff
path: root/openssl/trunk/crypto/x509v3/v3_asid.c
diff options
context:
space:
mode:
Diffstat (limited to 'openssl/trunk/crypto/x509v3/v3_asid.c')
-rw-r--r--openssl/trunk/crypto/x509v3/v3_asid.c72
1 files changed, 68 insertions, 4 deletions
diff --git a/openssl/trunk/crypto/x509v3/v3_asid.c b/openssl/trunk/crypto/x509v3/v3_asid.c
index cedd6f66..18a53888 100644
--- a/openssl/trunk/crypto/x509v3/v3_asid.c
+++ b/openssl/trunk/crypto/x509v3/v3_asid.c
@@ -105,24 +105,88 @@ static void *v2i_ASIdentifiers(struct v3_ext_method *method,
STACK_OF(CONF_VALUE) *values)
{
ASIdentifiers *asid = NULL;
+ ASIdentifierChoice *choice;
CONF_VALUE *val;
+ char *p;
int i;
+#error this function does not check anywhere near enough error returns
+#error this function needs to be broken up into several smaller ones
+
if ((asid = ASIdentifiers_new()) == NULL) {
X509V3err(X509V3_F_V2I_ASIdentifiers, ERR_R_MALLOC_FAILURE);
return NULL;
}
+ for (i = 0; i < sk_CONF_VALUE_num(values); i++) {
+ val = sk_CONF_VALUE_value(values, i);
+
+ /* First figure out whether this is an AS or an RDI */
+ if (!strcmp(val->name, "as")) {
+ choice = &asid->asnum;
+ } else if (!strcmp(val->name, "rdi")) {
+ choice = &asid->rdi;
+ } else {
+ X509V3err(blah, blah);
+ X509V3_conf_err(val);
+ goto err;
+ }
+
+ /* Next check for inheritance */
+ if (!strcmp(val->value, "inherit")) {
+ /*
+ * Inheritance can't coexist with an explict list of numbers
+ */
+ if (*choice != NULL) {
+ if ((*choice)->type == ASIdentifierChoice_inherit)
+ continue; /* Duplication is harmless, I guess */
+ X509V3err(blah, blah);
+ X509V3_conf_err(val);
+ goto err;
+ }
+ *choice = ASIdentifierChoice_new();
+ (*choice)->type = ASIdentifierChoice_inherit;
+ (*choice)->u.inherit = ASN1_NULL_new();
+ continue;
+ }
+
+ /*
+ * Number or range. Add it to the list, we'll sort it later.
+ */
+ if (*choice != NULL && (*choice)->type == ASIdentifierChoice_inherit) {
+ X509V3err(blah, blah);
+ X509V3_conf_err(val);
+ goto err;
+ }
+ if (*choice == NULL) {
+ *choice = ASIdentifierChoice_new();
+ (*choice)->type = ASIdentifierChoice_asIdsOrRanges;
+ (*choice)->u.asIdsOrRanges = sk_ASIdOrRange_new();
+ }
+
+ if ((p = strchr(val->value, '-')) != NULL) {
+ /* It's a range */
+#error not written yet
+ } else {
+ /* It's a number */
+ X509V3_get_value_int(val, blah_blah);
#error not written yet
+ }
+
+ }
/*
- * Need to:
- * - Read stuff from config
- * - Sort/merge/canonicalize
- * - Generate and return C structure
+ * Next we sort the stacks, and canonicalize the result.
*/
+#error not written yet
+
return result;
+
+ err:
+#error not complete
+ ASIdentifiers_free(asid);
+ return NULL;
}
X509V3_EXT_METHOD v3_asid = {