]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Allow multiple flags in gnutls_x509_crt_get_name_constraints()
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 18 Feb 2014 06:49:45 +0000 (07:49 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 18 Feb 2014 06:49:45 +0000 (07:49 +0100)
lib/includes/gnutls/x509.h
lib/x509/name_constraints.c

index 8cd4e62a96f3e7a65ee0ba1d13b0b60bd104cb2e..4cf109a7adb45c0f2f8b10d5b18286ffe10ff8ec 100644 (file)
@@ -241,9 +241,11 @@ unsigned gnutls_x509_name_constraints_check(gnutls_x509_name_constraints_t nc,
 
 int gnutls_x509_name_constraints_init(gnutls_x509_name_constraints_t *nc);
 void gnutls_x509_name_constraints_deinit(gnutls_x509_name_constraints_t nc);
+
+#define GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND 1
 int gnutls_x509_crt_get_name_constraints(gnutls_x509_crt_t crt,
                                         gnutls_x509_name_constraints_t nc,
-                                        unsigned int append,
+                                        unsigned int flags,
                                         unsigned int *critical);
 int gnutls_x509_name_constraints_add_permitted(gnutls_x509_name_constraints_t nc,
                                               gnutls_x509_subject_alt_name_t type,
index dbec5e03e8628d82efba0085350cbac60adca403..0b7e6d1cd16fe902ae4af5f2e8f01f8e7d117eb8 100644 (file)
@@ -109,7 +109,7 @@ static int extract_name_constraints(ASN1_TYPE c2, const char *vstr,
  * gnutls_x509_crt_get_name_constraints:
  * @crt: should contain a #gnutls_x509_crt_t structure
  * @nc: The nameconstraints intermediate structure
- * @append: whether the constraints from the certificate will be set or appended
+ * @flags: zero or %GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND
  * @critical: the extension status
  *
  * This function will return an intermediate structure containing
@@ -117,7 +117,8 @@ static int extract_name_constraints(ASN1_TYPE c2, const char *vstr,
  * structure can be used in combination with gnutls_x509_name_constraints_check()
  * to verify whether a server's name is in accordance with the constraints.
  *
- * When the @append flag is set to 1, then if the @nc structure is empty
+ * When the @flags is set to %GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND, then if 
+ * the @nc structure is empty
  * this function will behave identically as if the flag was not set.
  * Otherwise if there are elements in the @nc structure then only the
  * excluded constraints will be appended to the constraints.
@@ -131,7 +132,7 @@ static int extract_name_constraints(ASN1_TYPE c2, const char *vstr,
  **/
 int gnutls_x509_crt_get_name_constraints(gnutls_x509_crt_t crt,
                                         gnutls_x509_name_constraints_t nc,
-                                        unsigned int append,
+                                        unsigned int flags,
                                         unsigned int *critical)
 {
        int result, ret;
@@ -167,7 +168,7 @@ int gnutls_x509_crt_get_name_constraints(gnutls_x509_crt_t crt,
                goto cleanup;
        }
 
-       if (append == 0 || (nc->permitted == NULL && nc->excluded == NULL)) {
+       if (!(flags & GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND) || (nc->permitted == NULL && nc->excluded == NULL)) {
                ret = extract_name_constraints(c2, "permittedSubtrees", &nc->permitted);
                if (ret < 0) {
                        gnutls_assert();