Make verify return errors.
authorBen Laurie <ben@openssl.org>
Thu, 13 Dec 2012 15:49:15 +0000 (15:49 +0000)
committerBen Laurie <ben@openssl.org>
Thu, 13 Dec 2012 15:49:15 +0000 (15:49 +0000)
CHANGES
Makefile.org
apps/verify.c
test/Makefile

diff --git a/CHANGES b/CHANGES
index 4d71d95af511fe9e51b8e2171424b7947187e5a8..2a20e2224f55bc777f11660efc572ca0d4050209 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -81,6 +81,9 @@
 
  Changes between 1.0.1c and 1.0.1d [xx XXX xxxx]
 
+  *) Make openssl verify return errors.
+     [Chris Palmer <palmer@google.com> and Ben Laurie]
+
   *) Fix possible deadlock when decoding public keys.
      [Steve Henson]
 
index 55273ea364a3963158bcb7fa486f2460fdd592bd..43d16cbcb1a05d13da8e03a62eab73c9f8fff81a 100644 (file)
@@ -444,7 +444,7 @@ rehash.time: certs apps
                [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
                OPENSSL_DEBUG_MEMORY=on; \
                export OPENSSL OPENSSL_DEBUG_MEMORY; \
-               $(PERL) tools/c_rehash certs) && \
+               $(PERL) tools/c_rehash certs/demo) && \
                touch rehash.time; \
        else :; fi
 
index 0f34b865ad6fe022bcbfc5a8646d42cf9eb51534..893670ff41321317e7a057e0a8c3fd64cb7d048a 100644 (file)
@@ -222,11 +222,19 @@ int MAIN(int argc, char **argv)
                        goto end;
                }
 
-       if (argc < 1) check(cert_ctx, NULL, untrusted, trusted, crls, e);
+       ret = 0;
+       if (argc < 1)
+               { 
+               if (1 != check(cert_ctx, NULL, untrusted, trusted, crls, e))
+                       ret = -1;
+               }
        else
+               {
                for (i=0; i<argc; i++)
-                       check(cert_ctx,argv[i], untrusted, trusted, crls, e);
-       ret=0;
+                       if (1 != check(cert_ctx,argv[i], untrusted, trusted, crls, e))
+                               ret = -1;
+               }
+
 end:
        if (ret == 1) {
                BIO_printf(bio_err,"usage: verify [-verbose] [-CApath path] [-CAfile file] [-purpose purpose] [-crl_check]");
@@ -252,7 +260,7 @@ end:
        sk_X509_pop_free(trusted, X509_free);
        sk_X509_CRL_pop_free(crls, X509_CRL_free);
        apps_shutdown();
-       OPENSSL_EXIT(ret);
+       OPENSSL_EXIT(ret < 0 ? 2 : ret);
        }
 
 static int check(X509_STORE *ctx, char *file,
index df25862de410b6f25970ccc490efe028da7765dd..3bb739001cde0f11c2901eaf6d369c2e1f90ca4d 100644 (file)
@@ -246,7 +246,7 @@ test_ecdh:
 test_verify:
        @echo "The following command should have some OK's and some failures"
        @echo "There are definitly a few expired certificates"
-       ../util/shlib_wrap.sh ../apps/openssl verify -CApath ../certs ../certs/*.pem
+       ../util/shlib_wrap.sh ../apps/openssl verify -CApath ../certs/demo ../certs/demo/*.pem
 
 test_dh:
        @echo "Generate a set of DH parameters"