subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bre...@apache.org
Subject svn commit: r1613546 - /subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c
Date Sat, 26 Jul 2014 00:52:19 GMT
Author: breser
Date: Sat Jul 26 00:52:19 2014
New Revision: 1613546

URL: http://svn.apache.org/r1613546
Log:
On svn-auth-x509 branch, fix the nesting order of a bunch of error messages.

* subversion/libsvn_subr/x509parse.c
  (x509_get_version, x509_get_serial, x509_get_alg, x509_get_name,
   x509_get_dates, x509_get_ext, svn_x509_parse_cert): The X.509 errors
    should be parents of the ASN.1 errors.

Modified:
    subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c

Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c?rev=1613546&r1=1613545&r2=1613546&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/x509parse.c Sat Jul 26 00:52:19
2014
@@ -169,8 +169,8 @@ x509_get_version(const unsigned char **p
 
   if (*p != end)
     {
-      err = svn_error_create(SVN_ERR_X509_CERT_INVALID_VERSION, NULL, NULL);
-      return svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, err, NULL);
+      err = svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, NULL, NULL);
+      return svn_error_create(SVN_ERR_X509_CERT_INVALID_VERSION, err, NULL);
     }
 
   return SVN_NO_ERROR;
@@ -187,15 +187,15 @@ x509_get_serial(const unsigned char **p,
 
   if ((end - *p) < 1)
     {
-      err = svn_error_create(SVN_ERR_X509_CERT_INVALID_SERIAL, NULL, NULL);
-      return svn_error_create(SVN_ERR_ASN1_OUT_OF_DATA, err, NULL);
+      err = svn_error_create(SVN_ERR_ASN1_OUT_OF_DATA, NULL, NULL);
+      return svn_error_create(SVN_ERR_X509_CERT_INVALID_SERIAL, err, NULL);
     }
 
   if (**p != (ASN1_CONTEXT_SPECIFIC | ASN1_PRIMITIVE | 2) &&
       **p != ASN1_INTEGER)
     {
-      err = svn_error_create(SVN_ERR_X509_CERT_INVALID_SERIAL, NULL, NULL);
-      return svn_error_create(SVN_ERR_ASN1_UNEXPECTED_TAG, err, NULL);
+      err = svn_error_create(SVN_ERR_ASN1_UNEXPECTED_TAG, NULL, NULL);
+      return svn_error_create(SVN_ERR_X509_CERT_INVALID_SERIAL, err, NULL);
     }
 
   serial->tag = *(*p)++;
@@ -247,8 +247,8 @@ x509_get_alg(const unsigned char **p, co
 
   if (*p != end)
     {
-      err = svn_error_create(SVN_ERR_X509_CERT_INVALID_ALG, NULL, NULL);
-      return svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, err, NULL);
+      err = svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, NULL, NULL);
+      return svn_error_create(SVN_ERR_X509_CERT_INVALID_ALG, err, NULL);
     }
 
   return SVN_NO_ERROR;
@@ -289,8 +289,8 @@ x509_get_name(const unsigned char **p, c
 
   if (*p + len != end)
     {
-      err = svn_error_create(SVN_ERR_X509_CERT_INVALID_NAME, NULL, NULL);
-      return svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, err, NULL);
+      err = svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, NULL, NULL);
+      return svn_error_create(SVN_ERR_X509_CERT_INVALID_NAME, err, NULL);
     }
 
   oid = &cur->oid;
@@ -305,16 +305,16 @@ x509_get_name(const unsigned char **p, c
 
   if ((end - *p) < 1)
     {
-      err = svn_error_create(SVN_ERR_X509_CERT_INVALID_NAME, NULL, NULL);
-      return svn_error_create(SVN_ERR_ASN1_OUT_OF_DATA, err, NULL);
+      err = svn_error_create(SVN_ERR_ASN1_OUT_OF_DATA, NULL, NULL);
+      return svn_error_create(SVN_ERR_X509_CERT_INVALID_NAME, err, NULL);
     }
 
   if (**p != ASN1_BMP_STRING && **p != ASN1_UTF8_STRING &&
       **p != ASN1_T61_STRING && **p != ASN1_PRINTABLE_STRING &&
       **p != ASN1_IA5_STRING && **p != ASN1_UNIVERSAL_STRING)
     {
-      err = svn_error_create(SVN_ERR_X509_CERT_INVALID_NAME, NULL, NULL);
-      return svn_error_create(SVN_ERR_ASN1_UNEXPECTED_TAG, err, NULL);
+      err = svn_error_create(SVN_ERR_ASN1_UNEXPECTED_TAG, NULL, NULL);
+      return svn_error_create(SVN_ERR_X509_CERT_INVALID_NAME, err, NULL);
     }
 
   val = &cur->val;
@@ -331,8 +331,8 @@ x509_get_name(const unsigned char **p, c
 
   if (*p != end)
     {
-      err = svn_error_create(SVN_ERR_X509_CERT_INVALID_NAME, NULL, NULL);
-      return svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, err, NULL);
+      err = svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, NULL, NULL);
+      return svn_error_create(SVN_ERR_X509_CERT_INVALID_NAME, err, NULL);
     }
 
   /*
@@ -462,8 +462,8 @@ x509_get_dates(apr_time_t *from,
 
   if (*p != end)
     {
-      err = svn_error_create(SVN_ERR_X509_CERT_INVALID_DATE, NULL, NULL);
-      return svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, err, NULL);
+      err = svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, NULL, NULL);
+      return svn_error_create(SVN_ERR_X509_CERT_INVALID_DATE, err, NULL);
     }
 
   return SVN_NO_ERROR;
@@ -559,8 +559,8 @@ x509_get_ext(apr_array_header_t *dnsname
 
   if (end != *p + len)
     {
-      err = svn_error_create(SVN_ERR_X509_CERT_INVALID_EXTENSIONS, NULL, NULL);
-      return svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, err, NULL);
+      err = svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, NULL, NULL);
+      return svn_error_create(SVN_ERR_X509_CERT_INVALID_EXTENSIONS, err, NULL);
     }
 
   while (*p < end)
@@ -615,8 +615,8 @@ x509_get_ext(apr_array_header_t *dnsname
 
       if (sna_end != *p + len)
         {
-          err = svn_error_create(SVN_ERR_X509_CERT_INVALID_EXTENSIONS, NULL, NULL);
-          return svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, err, NULL);
+          err = svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, NULL, NULL);
+          return svn_error_create(SVN_ERR_X509_CERT_INVALID_EXTENSIONS, err, NULL);
         }
 
       while (*p < sna_end)
@@ -970,8 +970,8 @@ svn_x509_parse_cert(apr_hash_t **certinf
 
   if (len != (int)(end - p))
     {
-      err = svn_error_create(SVN_ERR_X509_CERT_INVALID_FORMAT, NULL, NULL);
-      return svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, err, NULL);
+      err = svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, NULL, NULL);
+      return svn_error_create(SVN_ERR_X509_CERT_INVALID_FORMAT, err, NULL);
     }
 
   /*
@@ -1061,8 +1061,8 @@ svn_x509_parse_cert(apr_hash_t **certinf
   }
 
   if (p != end) {
-    err = svn_error_create(SVN_ERR_X509_CERT_INVALID_FORMAT, NULL, NULL);
-    return svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, err, NULL);
+    err = svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, NULL, NULL);
+    return svn_error_create(SVN_ERR_X509_CERT_INVALID_FORMAT, err, NULL);
   }
 
   end = (const unsigned char*) buf + buflen;
@@ -1081,8 +1081,8 @@ svn_x509_parse_cert(apr_hash_t **certinf
 
   if (p != end)
     {
-      err = svn_error_create(SVN_ERR_X509_CERT_INVALID_FORMAT, NULL, NULL);
-      return svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, err, NULL);
+      err = svn_error_create(SVN_ERR_ASN1_LENGTH_MISMATCH, NULL, NULL);
+      return svn_error_create(SVN_ERR_X509_CERT_INVALID_FORMAT, err, NULL);
     }
 
   *certinfo = apr_hash_make(result_pool);



Mime
View raw message