Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package gnutls for openSUSE:Factory checked 
in at 2026-11-20 14:43:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/gnutls (Old)
 and      /work/SRC/openSUSE:Factory/.gnutls.new.1251 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "gnutls"

Fri Nov 20 14:43:30 2026 rev:173 rq:1398161 version:3.8.13

Changes:
--------
--- /work/SRC/openSUSE:Factory/gnutls/gnutls.changes    2026-11-01 
22:23:27.783107775 +0100
+++ /work/SRC/openSUSE:Factory/.gnutls.new.1251/gnutls.changes  2026-11-20 
14:43:40.907668442 +0100
@@ -1,0 +2,15 @@
+Mon Nov 16 12:42:15 UTC 2026 - Peter Simons <[email protected]>
+
+- Add "gnutls-CVE-2026-95184.patch" to fix a security issue:
+  Permitted directoryName name constraints were not enforced, so a
+  constrained CA could issue certificates for any subject DN, and
+  any excluded directoryName rejected all certificates.
+  [bsc#1284936, CVE-2026-95184]
+
+- Add "gnutls-CVE-2026-88648.patch" to fix a security issue:
+  Excluded (and permitted) msUPN and SRVName otherName name
+  constraints were never checked, so a constrained CA could issue
+  certificates for excluded names. The directoryName defects of this
+  CVE are fixed in CVE-2026-95184. [bsc#1284935, CVE-2026-88648]
+
+-------------------------------------------------------------------

New:
----
  gnutls-CVE-2026-88648.patch
  gnutls-CVE-2026-95184.patch

----------(New B)----------
  New:
- Add "gnutls-CVE-2026-88648.patch" to fix a security issue:
  Excluded (and permitted) msUPN and SRVName otherName name
  New:
- Add "gnutls-CVE-2026-95184.patch" to fix a security issue:
  Permitted directoryName name constraints were not enforced, so a
----------(New E)----------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ gnutls.spec ++++++
--- /var/tmp/diff_new_pack.yTGBS0/_old  2026-11-20 14:43:46.886920441 +0100
+++ /var/tmp/diff_new_pack.yTGBS0/_new  2026-11-20 14:43:46.890920609 +0100
@@ -92,6 +92,10 @@
 Patch16:        gnutls-FIPS-SLI-record-MAC.patch
 # PATCH-FIX-SUSE bsc#1284342 FIPS: Mark internal HMAC-SHA-1 when session 
tickets are enabled as non approved
 Patch17:        gnutls-FIPS-SLI-session-ticket.patch
+# PATCH-FIX-SUSE bsc#1284936 CVE-2026-95184 Enforce permitted and excluded 
directoryName name constraints
+Patch18:        gnutls-CVE-2026-95184.patch
+# PATCH-FIX-SUSE bsc#1284935 CVE-2026-88648 Enforce msUPN and SRVName 
otherName name constraints
+Patch19:        gnutls-CVE-2026-88648.patch
 
 BuildRequires:  autogen
 BuildRequires:  automake


++++++ gnutls-CVE-2026-88648.patch ++++++
++++ 739 lines (skipped)

++++++ gnutls-CVE-2026-95184.patch ++++++
From: Peter Simons <[email protected]>
Subject: x509: enforce directoryName name constraints (CVE-2026-95184)
References: bsc#1284936 CVE-2026-95184

Permitted directoryName subtrees in the NameConstraints extension were
never enforced: check_unsupported_constraint() only looked at the
excluded list, so an end-entity certificate with e.g. O=Evil chained to
a CA restricted to O=Good was accepted. Conversely, the presence of any
excluded directoryName rejected every certificate.

Match the subject DN and all directoryName subject alternative names of
the end-entity certificate against the permitted and excluded subtrees,
using RDN prefix matching as required by RFC 5280 section 4.2.1.10.
Attribute values are compared case-insensitively with whitespace
folded. Directory names are also treated as a supported type when
merging the constraints of a chain, so that a subordinate CA can only
narrow the permitted subtrees of its issuer instead of widening them.

Upstream considers this outside of its threat model; no upstream fix
exists so far (https://gitlab.com/gnutls/gnutls/-/work_items/1965).

diff --git a/lib/x509/name_constraints.c b/lib/x509/name_constraints.c
index 56d6a0d..fb047f3 100644
--- a/lib/x509/name_constraints.c
+++ b/lib/x509/name_constraints.c
@@ -36,6 +36,9 @@
 #include "x509_ext_int.h"
 #include <libtasn1.h>
 #include "c-strcase.h"
+#include "c-ctype.h"
+#include "num.h"
+#include "str.h"
 
 #include "ip.h"
 #include "ip-in-cidr.h"
@@ -310,11 +313,210 @@ static enum name_constraint_relation 
compare_ip_ncs(const gnutls_datum_t *n1,
        return NC_EQUAL;
 }
 
+/* Directory names (GNUTLS_SAN_DN) are kept in the RFC 4514 string form
+ * produced by _gnutls_x509_get_dn(): RDNs are listed last-to-first and
+ * separated by ',', the AVAs of a multi-valued RDN are separated by '+',
+ * and the special characters within values (in particular ',', '+' and
+ * '\') are escaped with a backslash.
+ *
+ * To compare such names, dn_canonicalize() converts them into a
+ * sequence of canonical RDN records. Each record holds the RDN's AVAs as
+ * "type=value", joined by '+', with the attribute type and value folded
+ * to lower case (ASCII only), leading and trailing whitespace of the
+ * value removed and internal whitespace runs collapsed into a single
+ * space (approximating RFC 5280 section 7.1). Within values, the
+ * characters '\' and '+' (and a '#' that does not introduce a
+ * hex-encoded value) are escaped so that the record is unambiguous.
+ * Each record is followed by its length as a 32-bit big-endian
+ * integer, so that the buffer can be walked backwards, i.e., from the
+ * first RDN of the DER encoding (the most significant one) to the last.
+ */
+static int dn_canonicalize_rdn(const gnutls_datum_t *dn, size_t *pos,
+                              gnutls_buffer_st *out)
+{
+       size_t i = *pos;
+       bool in_value = false, value_started = false, first_in_value = false;
+       bool pending_space = false;
+       uint8_t c, esc = '\\';
+       bool escaped;
+       int ret;
+
+       while (i < dn->size) {
+               c = dn->data[i];
+               escaped = false;
+               if (c == '\\') {
+                       if (i + 1 >= dn->size)
+                               return 
gnutls_assert_val(GNUTLS_E_PARSING_ERROR);
+                       c = dn->data[i + 1];
+                       escaped = true;
+                       i += 2;
+               } else {
+                       i++;
+               }
+
+               if (!escaped && c == ',')
+                       break;
+
+               if (!escaped && c == '+') {
+                       /* next AVA of a multi-valued RDN */
+                       if (!in_value)
+                               return 
gnutls_assert_val(GNUTLS_E_PARSING_ERROR);
+                       ret = _gnutls_buffer_append_data(out, &c, 1);
+                       if (ret < 0)
+                               return gnutls_assert_val(ret);
+                       in_value = false;
+                       continue;
+               }
+
+               if (!in_value) {
+                       /* attribute type */
+                       if (!escaped && c == '=') {
+                               in_value = true;
+                               value_started = false;
+                               first_in_value = true;
+                               pending_space = false;
+                       } else if (escaped) {
+                               /* never produced by _gnutls_x509_get_dn() */
+                               return 
gnutls_assert_val(GNUTLS_E_PARSING_ERROR);
+                       } else {
+                               c = c_tolower(c);
+                       }
+                       ret = _gnutls_buffer_append_data(out, &c, 1);
+                       if (ret < 0)
+                               return gnutls_assert_val(ret);
+                       continue;
+               }
+
+               /* attribute value */
+               if (c == ' ' || c == '\t') {
+                       if (value_started)
+                               pending_space = true;
+                       first_in_value = false;
+                       continue;
+               }
+
+               if (pending_space) {
+                       ret = _gnutls_buffer_append_data(out, " ", 1);
+                       if (ret < 0)
+                               return gnutls_assert_val(ret);
+                       pending_space = false;
+               }
+
+               /* A leading unescaped '#' introduces a hex-encoded value;
+                * keep that distinct from a literal '#'. */
+               if (c == '\\' || c == '+' ||
+                   (c == '#' && !value_started && (escaped || 
!first_in_value))) {
+                       ret = _gnutls_buffer_append_data(out, &esc, 1);
+                       if (ret < 0)
+                               return gnutls_assert_val(ret);
+               }
+
+               c = c_tolower(c);
+               ret = _gnutls_buffer_append_data(out, &c, 1);
+               if (ret < 0)
+                       return gnutls_assert_val(ret);
+               value_started = true;
+               first_in_value = false;
+       }
+
+       if (!in_value)
+               return gnutls_assert_val(GNUTLS_E_PARSING_ERROR);
+
+       *pos = i;
+       return 0;
+}
+
+static int dn_canonicalize(const gnutls_datum_t *dn, gnutls_buffer_st *out)
+{
+       size_t pos = 0, start;
+       int ret;
+
+       _gnutls_buffer_reset(out);
+
+       /* an empty name has no RDNs; it is a prefix of any other name */
+       if (dn->size == 0)
+               return 0;
+
+       while (1) {
+               start = out->length;
+               ret = dn_canonicalize_rdn(dn, &pos, out);
+               if (ret < 0)
+                       return gnutls_assert_val(ret);
+
+               ret = _gnutls_buffer_append_prefix(out, 32,
+                                                  out->length - start);
+               if (ret < 0)
+                       return gnutls_assert_val(ret);
+
+               if (pos >= dn->size)
+                       break;
+       }
+
+       return 0;
+}
+
+/* Rich-compare canonical DNs (see dn_canonicalize()). Starting from the
+ * first RDN (in DER order), a DN that is a prefix of another one
+ * INCLUDES the latter; this matches RFC 5280 section 4.2.1.10 for
+ * directoryName constraints. Example order/relationships:
+ * C=X,O=A,OU=B INCLUDED_BY C=X,O=A BEFORE C=X,O=B INCLUDED_BY C=X */
+static enum name_constraint_relation
+compare_canonical_dns(const gnutls_buffer_st *a, const gnutls_buffer_st *b)
+{
+       size_t i = a->length, j = b->length;
+       size_t len_a, len_b;
+       enum name_constraint_relation rel;
+
+       while (1) {
+               if (i == 0 && j == 0)
+                       return NC_EQUAL;
+               if (i == 0) /* a is a prefix of b */
+                       return NC_INCLUDES;
+               if (j == 0) /* b is a prefix of a */
+                       return NC_INCLUDED_BY;
+
+               /* records are well-formed by construction */
+               assert(i >= 4 && j >= 4);
+               len_a = _gnutls_read_uint32(&a->data[i - 4]);
+               len_b = _gnutls_read_uint32(&b->data[j - 4]);
+               assert(len_a <= i - 4 && len_b <= j - 4);
+               i -= 4 + len_a;
+               j -= 4 + len_b;
+
+               rel = compare_strings(&a->data[i], len_a, &b->data[j], len_b);
+               if (rel != NC_EQUAL)
+                       return rel;
+       }
+}
+
+static enum name_constraint_relation compare_dn_names(const gnutls_datum_t *n1,
+                                                     const gnutls_datum_t *n2)
+{
+       gnutls_buffer_st c1, c2;
+       enum name_constraint_relation rel;
+
+       _gnutls_buffer_init(&c1);
+       _gnutls_buffer_init(&c2);
+
+       if (dn_canonicalize(n1, &c1) < 0 || dn_canonicalize(n2, &c2) < 0) {
+               /* Unparsable names (or memory allocation failure): fall
+                * back to a stable lexicographic order, which never
+                * reports an inclusion. */
+               rel = compare_strings(n1->data, n1->size, n2->data, n2->size);
+       } else {
+               rel = compare_canonical_dns(&c1, &c2);
+       }
+
+       _gnutls_buffer_clear(&c1);
+       _gnutls_buffer_clear(&c2);
+       return rel;
+}
+
 static inline bool is_supported_type(gnutls_x509_subject_alt_name_t type)
 {
        /* all of these should be under GNUTLS_SAN_MAX (intersect bitmasks) */
        return type == GNUTLS_SAN_DNSNAME || type == GNUTLS_SAN_RFC822NAME ||
-              type == GNUTLS_SAN_IPADDRESS;
+              type == GNUTLS_SAN_IPADDRESS || type == GNUTLS_SAN_DN;
 }
 
 /* Universal comparison for name constraint nodes.
@@ -356,6 +558,8 @@ compare_name_constraint_nodes(const struct 
name_constraints_node_st *n1,
                return compare_emails(&n1->name, &n2->name);
        case GNUTLS_SAN_IPADDRESS:
                return compare_ip_ncs(&n1->name, &n2->name);
+       case GNUTLS_SAN_DN:
+               return compare_dn_names(&n1->name, &n2->name);
        default:
                /* unsupported types: stable lexicographic order */
                return compare_strings(n1->name.data, n1->name.size,
@@ -977,6 +1181,7 @@ out:
                        break;
                case GNUTLS_SAN_DNSNAME:
                case GNUTLS_SAN_RFC822NAME:
+               case GNUTLS_SAN_DN: /* the empty DN is a prefix of any DN */
                        ret = name_constraints_node_add_new(nc, excluded, type,
                                                            NULL, 0);
                        if (ret < 0) {
@@ -1653,6 +1858,138 @@ static unsigned 
check_ip_constraints(gnutls_x509_name_constraints_t nc,
        return true;
 }
 
+/* Returns true if @name (a DN in the string form of _gnutls_x509_get_dn())
+ * is acceptable with respect to the directoryName constraints in @nc,
+ * and false otherwise.
+ */
+static bool check_dn_constraints(gnutls_x509_name_constraints_t nc,
+                                const gnutls_datum_t *name)
+{
+       unsigned i;
+       int ret;
+       unsigned rtype;
+       bool allowed_found = false, result = false;
+       gnutls_datum_t rname;
+       gnutls_buffer_st cname, crname;
+       enum name_constraint_relation rel;
+
+       if (!name_constraints_contains_type(nc, GNUTLS_SAN_DN))
+               return true; /* shortcut; no constraints to check */
+
+       _gnutls_buffer_init(&cname);
+       _gnutls_buffer_init(&crname);
+
+       _gnutls_hard_log("matching DN %.*s with DN constraints\n", name->size,
+                        name->data);
+
+       if (dn_canonicalize(name, &cname) < 0) {
+               gnutls_assert();
+               goto cleanup;
+       }
+
+       /* check restrictions */
+       i = 0;
+       do {
+               ret = gnutls_x509_name_constraints_get_excluded(nc, i++, &rtype,
+                                                               &rname);
+               if (ret >= 0) {
+                       if (rtype != GNUTLS_SAN_DN)
+                               continue;
+
+                       if (dn_canonicalize(&rname, &crname) < 0) {
+                               gnutls_assert();
+                               goto cleanup;
+                       }
+
+                       rel = compare_canonical_dns(&cname, &crname);
+                       if (rel == NC_EQUAL || rel == NC_INCLUDED_BY) {
+                               gnutls_assert(); /* rejected */
+                               goto cleanup;
+                       }
+               }
+       } while (ret == 0);
+
+       /* check allowed */
+       i = 0;
+       do {
+               ret = gnutls_x509_name_constraints_get_permitted(
+                       nc, i++, &rtype, &rname);
+               if (ret >= 0) {
+                       if (rtype != GNUTLS_SAN_DN)
+                               continue;
+
+                       allowed_found = true;
+
+                       if (dn_canonicalize(&rname, &crname) < 0) {
+                               gnutls_assert();
+                               goto cleanup;
+                       }
+
+                       rel = compare_canonical_dns(&cname, &crname);
+                       if (rel == NC_EQUAL || rel == NC_INCLUDED_BY) {
+                               result = true; /* accepted */
+                               goto cleanup;
+                       }
+               }
+       } while (ret == 0);
+
+       /* there are allowed directives but this name wasn't found */
+       if (allowed_found) {
+               gnutls_assert();
+               goto cleanup;
+       }
+
+       result = true;
+
+cleanup:
+       _gnutls_buffer_clear(&cname);
+       _gnutls_buffer_clear(&crname);
+       return result;
+}
+
+/* Checks the subject DN and all directoryName subject alternative names
+ * of @cert against the directoryName constraints in @nc, as required by
+ * RFC 5280 section 6.1.3 (b) and (c). An empty subject is not checked.
+ *
+ * Returns: true if the certificate is acceptable, and false otherwise.
+ */
+static bool check_dn_constraints_crt(gnutls_x509_name_constraints_t nc,
+                                    gnutls_x509_crt_t cert)
+{
+       gnutls_datum_t dn = { NULL, 0 };
+       gnutls_datum_t san;
+       unsigned idx, san_type;
+       bool ok;
+       int ret;
+
+       ret = gnutls_x509_crt_get_dn3(cert, &dn, 0);
+       if (ret == 0) {
+               ok = check_dn_constraints(nc, &dn);
+               gnutls_free(dn.data);
+               if (!ok)
+                       return gnutls_assert_val(false);
+       } else if (ret != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) {
+               return gnutls_assert_val(false);
+       }
+
+       for (idx = 0;; idx++) {
+               ret = gnutls_subject_alt_names_get(cert->san, idx, &san_type,
+                                                  &san, NULL);
+               if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
+                       break;
+               else if (ret < 0)
+                       return gnutls_assert_val(false);
+
+               if (san_type != GNUTLS_SAN_DN)
+                       continue;
+
+               if (!check_dn_constraints(nc, &san))
+                       return gnutls_assert_val(false);
+       }
+
+       return true;
+}
+
 /**
  * gnutls_x509_name_constraints_check:
  * @nc: the extracted name constraints
@@ -1661,8 +1998,10 @@ static unsigned 
check_ip_constraints(gnutls_x509_name_constraints_t nc,
  *
  * This function will check the provided name against the constraints in
  * @nc using the RFC5280 rules. Currently this function is limited to DNS
- * names, emails and IP addresses (of type %GNUTLS_SAN_DNSNAME,
- * %GNUTLS_SAN_RFC822NAME and %GNUTLS_SAN_IPADDRESS).
+ * names, emails, IP addresses and directory names (of type
+ * %GNUTLS_SAN_DNSNAME, %GNUTLS_SAN_RFC822NAME, %GNUTLS_SAN_IPADDRESS and
+ * %GNUTLS_SAN_DN). A directory name is expected in the RFC 4514 string
+ * format, as returned by gnutls_x509_crt_get_dn3().
  *
  * Returns: zero if the provided name is not acceptable, and non-zero 
otherwise.
  *
@@ -1681,6 +2020,9 @@ unsigned 
gnutls_x509_name_constraints_check(gnutls_x509_name_constraints_t nc,
        if (type == GNUTLS_SAN_IPADDRESS)
                return check_ip_constraints(nc, name);
 
+       if (type == GNUTLS_SAN_DN)
+               return check_dn_constraints(nc, name);
+
        return check_unsupported_constraint(nc, type);
 }
 
@@ -1935,6 +2277,8 @@ 
gnutls_x509_name_constraints_check_crt(gnutls_x509_name_constraints_t nc,
                         */
                        return gnutls_assert_val(1);
                }
+       } else if (type == GNUTLS_SAN_DN) {
+               return check_dn_constraints_crt(nc, cert);
        } else if (type == GNUTLS_SAN_URI) {
                return check_unsupported_constraint2(cert, nc, type);
        } else
diff --git a/tests/name-constraints-merge.c b/tests/name-constraints-merge.c
index 3ff8d6c..f785824 100644
--- a/tests/name-constraints-merge.c
+++ b/tests/name-constraints-merge.c
@@ -586,6 +586,85 @@ void doit(void)
        gnutls_x509_name_constraints_deinit(nc1);
        gnutls_x509_name_constraints_deinit(nc2);
 
+       /* 8: test intersecting directoryName constraints (CVE-2026-95184)
+        * NC1: permitted DN O=Good,C=DE
+        * NC2: permitted DN OU=A,O=Good,C=DE
+        * Expected result: permitted=[OU=A,O=Good,C=DE]
+        */
+       suite = 8;
+
+       ret = gnutls_x509_name_constraints_init(&nc1);
+       check_for_error(ret);
+
+       ret = gnutls_x509_name_constraints_init(&nc2);
+       check_for_error(ret);
+
+       set_name("O=Good,C=DE", &name);
+       ret = gnutls_x509_name_constraints_add_permitted(nc1, GNUTLS_SAN_DN,
+                                                        &name);
+       check_for_error(ret);
+
+       set_name("OU=A,O=Good,C=DE", &name);
+       ret = gnutls_x509_name_constraints_add_permitted(nc2, GNUTLS_SAN_DN,
+                                                        &name);
+       check_for_error(ret);
+
+       ret = _gnutls_x509_name_constraints_merge(nc1, nc2);
+       check_for_error(ret);
+
+       set_name("CN=x,OU=A,O=Good,C=DE", &name);
+       ret = gnutls_x509_name_constraints_check(nc1, GNUTLS_SAN_DN, &name);
+       check_test_result(suite, ret, NAME_ACCEPTED, &name);
+
+       set_name("CN=x,OU=B,O=Good,C=DE", &name);
+       ret = gnutls_x509_name_constraints_check(nc1, GNUTLS_SAN_DN, &name);
+       check_test_result(suite, ret, NAME_REJECTED, &name);
+
+       set_name("CN=x,O=Good,C=DE", &name);
+       ret = gnutls_x509_name_constraints_check(nc1, GNUTLS_SAN_DN, &name);
+       check_test_result(suite, ret, NAME_REJECTED, &name);
+
+       gnutls_x509_name_constraints_deinit(nc1);
+       gnutls_x509_name_constraints_deinit(nc2);
+
+       /* 9: test intersecting disjoint directoryName constraints; a
+        * subordinate CA must not be able to widen the permitted subtrees
+        * NC1: permitted DN O=Good
+        * NC2: permitted DN O=Evil
+        * Expected result: no DN is acceptable
+        */
+       suite = 9;
+
+       ret = gnutls_x509_name_constraints_init(&nc1);
+       check_for_error(ret);
+
+       ret = gnutls_x509_name_constraints_init(&nc2);
+       check_for_error(ret);
+
+       set_name("O=Good", &name);
+       ret = gnutls_x509_name_constraints_add_permitted(nc1, GNUTLS_SAN_DN,
+                                                        &name);
+       check_for_error(ret);
+
+       set_name("O=Evil", &name);
+       ret = gnutls_x509_name_constraints_add_permitted(nc2, GNUTLS_SAN_DN,
+                                                        &name);
+       check_for_error(ret);
+
+       ret = _gnutls_x509_name_constraints_merge(nc1, nc2);
+       check_for_error(ret);
+
+       set_name("CN=x,O=Evil", &name);
+       ret = gnutls_x509_name_constraints_check(nc1, GNUTLS_SAN_DN, &name);
+       check_test_result(suite, ret, NAME_REJECTED, &name);
+
+       set_name("CN=x,O=Good", &name);
+       ret = gnutls_x509_name_constraints_check(nc1, GNUTLS_SAN_DN, &name);
+       check_test_result(suite, ret, NAME_REJECTED, &name);
+
+       gnutls_x509_name_constraints_deinit(nc1);
+       gnutls_x509_name_constraints_deinit(nc2);
+
        /* Test footer */
 
        if (debug)
diff --git a/tests/name-constraints.c b/tests/name-constraints.c
index e85c03a..b67c55d 100644
--- a/tests/name-constraints.c
+++ b/tests/name-constraints.c
@@ -418,6 +418,68 @@ void doit(void)
 
        gnutls_x509_name_constraints_deinit(nc);
 
+       /* 4c: directoryName constraints (CVE-2026-95184). DNs are given in
+        * the RFC 4514 form of gnutls_x509_crt_get_dn3(), i.e., the last
+        * RDN comes first. */
+
+       ret = gnutls_x509_name_constraints_init(&nc);
+       check_for_error(ret);
+
+       set_name("O=Good,C=DE", &name);
+       ret = gnutls_x509_name_constraints_add_permitted(nc, GNUTLS_SAN_DN,
+                                                        &name);
+       check_for_error(ret);
+       set_name("OU=Bad,O=Good,C=DE", &name);
+       ret = gnutls_x509_name_constraints_add_excluded(nc, GNUTLS_SAN_DN,
+                                                       &name);
+       check_for_error(ret);
+
+       set_name("O=Good,C=DE", &name); /* exact match: accepted */
+       ret = gnutls_x509_name_constraints_check(nc, GNUTLS_SAN_DN, &name);
+       check_test_result(ret, NAME_ACCEPTED, &name);
+
+       set_name("CN=x,OU=A,O=Good,C=DE", &name); /* subtree: accepted */
+       ret = gnutls_x509_name_constraints_check(nc, GNUTLS_SAN_DN, &name);
+       check_test_result(ret, NAME_ACCEPTED, &name);
+
+       set_name("CN=x,O=  gOOD ,C=de", &name); /* case, spaces: accepted */
+       ret = gnutls_x509_name_constraints_check(nc, GNUTLS_SAN_DN, &name);
+       check_test_result(ret, NAME_ACCEPTED, &name);
+
+       set_name("CN=x,O=Evil,C=DE", &name); /* outside permitted */
+       ret = gnutls_x509_name_constraints_check(nc, GNUTLS_SAN_DN, &name);
+       check_test_result(ret, NAME_REJECTED, &name);
+
+       set_name("CN=x,O=Good", &name); /* missing leading RDN */
+       ret = gnutls_x509_name_constraints_check(nc, GNUTLS_SAN_DN, &name);
+       check_test_result(ret, NAME_REJECTED, &name);
+
+       set_name("CN=x,C=DE,O=Good", &name); /* RDNs in wrong order */
+       ret = gnutls_x509_name_constraints_check(nc, GNUTLS_SAN_DN, &name);
+       check_test_result(ret, NAME_REJECTED, &name);
+
+       set_name("CN=x,O=Good Inc,C=DE", &name); /* not an RDN prefix */
+       ret = gnutls_x509_name_constraints_check(nc, GNUTLS_SAN_DN, &name);
+       check_test_result(ret, NAME_REJECTED, &name);
+
+       set_name("CN=x,O=Good\\,C=DE", &name); /* escaped separator */
+       ret = gnutls_x509_name_constraints_check(nc, GNUTLS_SAN_DN, &name);
+       check_test_result(ret, NAME_REJECTED, &name);
+
+       set_name("CN=x,O=Good+OU=A,C=DE", &name); /* multi-valued RDN */
+       ret = gnutls_x509_name_constraints_check(nc, GNUTLS_SAN_DN, &name);
+       check_test_result(ret, NAME_REJECTED, &name);
+
+       set_name("CN=x,OU=bad,O=Good,C=DE", &name); /* excluded subtree */
+       ret = gnutls_x509_name_constraints_check(nc, GNUTLS_SAN_DN, &name);
+       check_test_result(ret, NAME_REJECTED, &name);
+
+       set_name("CN=x,OU=Badder,O=Good,C=DE", &name); /* not excluded */
+       ret = gnutls_x509_name_constraints_check(nc, GNUTLS_SAN_DN, &name);
+       check_test_result(ret, NAME_ACCEPTED, &name);
+
+       gnutls_x509_name_constraints_deinit(nc);
+
        // Test suite end.
 
        if (debug)

Reply via email to