Add exceptions for null (empty) subjectNames
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16762 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -966,6 +966,15 @@ match_general_name(const GeneralName *c, const GeneralName *n, int *match)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The subjectName is "null" when its empty set of relative DBs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int
|
||||||
|
subject_null_p(const Certificate *c)
|
||||||
|
{
|
||||||
|
return c->tbsCertificate.subject.u.rdnSequence.len == 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
match_alt_name(const GeneralName *n, const Certificate *c,
|
match_alt_name(const GeneralName *n, const Certificate *c,
|
||||||
@@ -1010,12 +1019,16 @@ match_tree(const GeneralSubtrees *t, const Certificate *c, int *match)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If the constraint apply to directoryNames, test is with
|
* If the constraint apply to directoryNames, test is with
|
||||||
* subjectName of the certificate.
|
* subjectName of the certificate if the certificate have a
|
||||||
|
* non-null (empty) subjectName.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (t->val[i].base.element == choice_GeneralName_directoryName) {
|
if (t->val[i].base.element == choice_GeneralName_directoryName
|
||||||
|
&& !subject_null_p(c))
|
||||||
|
{
|
||||||
GeneralName certname;
|
GeneralName certname;
|
||||||
|
|
||||||
|
|
||||||
certname.element = choice_GeneralName_directoryName;
|
certname.element = choice_GeneralName_directoryName;
|
||||||
certname.u.directoryName.element =
|
certname.u.directoryName.element =
|
||||||
c->tbsCertificate.subject.element;
|
c->tbsCertificate.subject.element;
|
||||||
@@ -1052,7 +1065,8 @@ check_name_constraints(const hx509_name_constraints *nc,
|
|||||||
ret = match_tree(&gs, c, &match);
|
ret = match_tree(&gs, c, &match);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
if (match == 0)
|
/* allow null subjectNames, they wont matches anything */
|
||||||
|
if (match == 0 && !subject_null_p(c))
|
||||||
return HX509_VERIFY_CONSTRAINTS;
|
return HX509_VERIFY_CONSTRAINTS;
|
||||||
}
|
}
|
||||||
if (nc->val[i].excludedSubtrees) {
|
if (nc->val[i].excludedSubtrees) {
|
||||||
|
Reference in New Issue
Block a user