Explorar el Código

New semantic for exit status codes.

Well, actually the failure happens if the ssl certificare is vulnerable.
Michele Orrù hace 11 años
padre
commit
0cd2d0b42d
Se han modificado 3 ficheros con 7 adiciones y 7 borrados
  1. 4 4
      src/qa.c
  2. 1 1
      src/questions/metadata.c
  3. 2 2
      src/questions/tests/test_fermat.test

+ 4 - 4
src/qa.c

@@ -140,7 +140,7 @@ qa_init(const struct qa_conf* conf)
   else
     error(EXIT_FAILURE, 0, "iternal error: unable to determine source type.");
   if (!crt && !rsa)
-    error(EXIT_FAILURE, errno, "Unable to open source.");
+    error(EXIT_FAILURE, errno, "Unable to open source \"%s\" :", conf->src);
 
   exitcode = qa_dispose(crt, rsa);
   X509_free(crt);
@@ -187,7 +187,7 @@ qa_dispose(X509 *crt, RSA *rsa)
         (priv = q->ask_rsa(pub))) {
       fprintf(stderr, "[\\] Key Broken using %s.\n", q->pretty_name);
       print_rsa_private(priv);
-      return EXIT_SUCCESS;
+      return 1;
     }
 
     /*
@@ -206,7 +206,7 @@ qa_dispose(X509 *crt, RSA *rsa)
   }
 
   /*
-   *  Key seems resistent: exit with status -1
+   *  Key seems resistent: exit successfully.
    */
-  return -1;
+  return 0;
 }

+ 1 - 1
src/questions/metadata.c

@@ -65,7 +65,7 @@ metadata_question_ask_crt(X509* crt)
   BN_free(serial);
 
   /* public key */
-  /* pkey = X509_get_pubkey(crt); */
+  pkey = X509_get_pubkey(crt);
   /* BIO_printf(out, "%-10s\n", PKEY); */
   /* PEM_write_bio_RSAPublicKey(out, pkey->pkey.rsa); */
   /* BIO_printf(out, "\r\n\r\n"); */

+ 2 - 2
src/questions/tests/test_fermat.test

@@ -1,5 +1,5 @@
 ../../qa -a fermat fermat.pem > /dev/null
-[[ $? == 0 ]] || exit 1
+[[ $? == 1 ]] || exit 1
 
 ../../qa -a fermat fermat2.pem > /dev/null
-[[ $? == 0 ]] || exit 1
+[[ $? == 1 ]] || exit 1