]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
name constraints: when no name of the type is found, accept the certificate
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 25 Mar 2015 07:38:47 +0000 (08:38 +0100)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 25 Mar 2015 07:38:49 +0000 (08:38 +0100)
This follows RFC5280 advice closely. Reported by Fotis Loukos.

lib/x509/name_constraints.c

index 07342832169d05c5c85dd49488831cb19cae449b..0090f9dd6a17fa5511c1bcdc77f270d3b2414ef1 100644 (file)
@@ -672,8 +672,12 @@ unsigned found_one;
                /* passed */
                if (found_one != 0)
                        return 1;
-               else /* nothing was found */
-                       return gnutls_assert_val(0);
+               else {
+                       /* no name was found. According to RFC5280: 
+                        * If no name of the type is in the certificate, the certificate is acceptable.
+                        */
+                       return gnutls_assert_val(1);
+               }
        } else if (type == GNUTLS_SAN_DNSNAME) {
                idx = found_one = 0;
                do {
@@ -733,8 +737,12 @@ unsigned found_one;
                /* passed */
                if (found_one != 0)
                        return 1;
-               else /* nothing was found */
-                       return gnutls_assert_val(0);
+               else {
+                       /* no name was found. According to RFC5280: 
+                        * If no name of the type is in the certificate, the certificate is acceptable.
+                        */
+                       return gnutls_assert_val(1);
+               }
        } else
                return check_unsupported_constraint(nc, type);
 }