Don't issue certs with subject DN that is NULL and have no SANs
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@19876 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -484,16 +484,25 @@ ca_sign(hx509_context context,
|
|||||||
hx509_set_error_string(context, 0, ret, "No public key set");
|
hx509_set_error_string(context, 0, ret, "No public key set");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
if (tbs->subject == NULL && !tbs->flags.proxy) {
|
/*
|
||||||
ret = EINVAL;
|
* Don't put restrictions on proxy certificate's subject name, it
|
||||||
hx509_set_error_string(context, 0, ret, "No subject name set");
|
* will be generated below.
|
||||||
return ret;
|
*/
|
||||||
|
if (!tbs->flags.proxy) {
|
||||||
|
if (tbs->subject == NULL) {
|
||||||
|
hx509_set_error_string(context, 0, EINVAL, "No subject name set");
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
if (hx509_name_is_null_p(tbs->subject) && tbs->san.len == 0) {
|
||||||
|
hx509_set_error_string(context, 0, EINVAL,
|
||||||
|
"NULL subject and no SubjectAltNames");
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (tbs->flags.ca && tbs->flags.proxy) {
|
if (tbs->flags.ca && tbs->flags.proxy) {
|
||||||
ret = EINVAL;
|
hx509_set_error_string(context, 0, EINVAL, "Can't be proxy and CA "
|
||||||
hx509_set_error_string(context, 0, ret, "Can't be proxy and CA "
|
|
||||||
"at the same time");
|
"at the same time");
|
||||||
return ret;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (tbs->flags.proxy) {
|
if (tbs->flags.proxy) {
|
||||||
if (tbs->san.len > 0) {
|
if (tbs->san.len > 0) {
|
||||||
|
Reference in New Issue
Block a user