(hx509_cert_get_base_subject): reject un-canon proxy certs, not the reverse
(add_to_list): constify and fix argument order to copy_octet_string (hx509_cert_find_subjectAltName_otherName): make work git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17347 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -422,7 +422,7 @@ find_extension_eku(const Certificate *cert, ExtKeyUsage *eku)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
add_to_list(hx509_octet_string_list *list, heim_octet_string *entry)
|
add_to_list(hx509_octet_string_list *list, const heim_octet_string *entry)
|
||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -431,7 +431,7 @@ add_to_list(hx509_octet_string_list *list, heim_octet_string *entry)
|
|||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
list->val = p;
|
list->val = p;
|
||||||
ret = copy_octet_string(&list->val[list->len], entry);
|
ret = copy_octet_string(entry, &list->val[list->len]);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
list->len++;
|
list->len++;
|
||||||
@@ -464,7 +464,10 @@ hx509_cert_find_subjectAltName_otherName(hx509_cert cert,
|
|||||||
while (1) {
|
while (1) {
|
||||||
ret = find_extension_subject_alt_name(_hx509_get_cert(cert), &i, &sa);
|
ret = find_extension_subject_alt_name(_hx509_get_cert(cert), &i, &sa);
|
||||||
i++;
|
i++;
|
||||||
if (ret == HX509_EXTENSION_NOT_FOUND)
|
if (ret == HX509_EXTENSION_NOT_FOUND) {
|
||||||
|
ret = 0;
|
||||||
|
break;
|
||||||
|
} else if (ret != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
@@ -473,14 +476,14 @@ hx509_cert_find_subjectAltName_otherName(hx509_cert cert,
|
|||||||
heim_oid_cmp(&sa.val[j].u.otherName.type_id, oid) == 0)
|
heim_oid_cmp(&sa.val[j].u.otherName.type_id, oid) == 0)
|
||||||
{
|
{
|
||||||
ret = add_to_list(list, &sa.val[j].u.otherName.value);
|
ret = add_to_list(list, &sa.val[j].u.otherName.value);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
free_GeneralNames(&sa);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
free_GeneralNames(&sa);
|
free_GeneralNames(&sa);
|
||||||
}
|
}
|
||||||
if (ret == HX509_EXTENSION_NOT_FOUND)
|
|
||||||
ret = 0;
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -898,7 +901,7 @@ hx509_cert_get_base_subject(hx509_context context, hx509_cert c, hx509_name *nam
|
|||||||
{
|
{
|
||||||
if (c->basename)
|
if (c->basename)
|
||||||
return hx509_name_copy(context, c->basename, name);
|
return hx509_name_copy(context, c->basename, name);
|
||||||
if (is_proxy_cert(c->data, NULL))
|
if (is_proxy_cert(c->data, NULL) == 0)
|
||||||
return EINVAL; /* XXX */
|
return EINVAL; /* XXX */
|
||||||
return _hx509_name_from_Name(&c->data->tbsCertificate.subject, name);
|
return _hx509_name_from_Name(&c->data->tbsCertificate.subject, name);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user