diff options
author | beck <> | 2017-01-26 00:58:32 +0000 |
---|---|---|
committer | beck <> | 2017-01-26 00:58:32 +0000 |
commit | 119f57723b3389086c84a3c0d39d5cea07d6c598 (patch) | |
tree | 864a15cb3bcc895efece8a1d0bd2834131216128 /src/usr.sbin/ocspcheck | |
parent | 410f791fcc6d0823cefbe0fd97a00a43b0ededa7 (diff) | |
download | openbsd-119f57723b3389086c84a3c0d39d5cea07d6c598.tar.gz openbsd-119f57723b3389086c84a3c0d39d5cea07d6c598.tar.bz2 openbsd-119f57723b3389086c84a3c0d39d5cea07d6c598.zip |
Use numeric exit codes consistently rather than a mix
ok jsing@
Diffstat (limited to 'src/usr.sbin/ocspcheck')
-rw-r--r-- | src/usr.sbin/ocspcheck/ocspcheck.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/usr.sbin/ocspcheck/ocspcheck.c b/src/usr.sbin/ocspcheck/ocspcheck.c index 5b665a0876..393ab84d9f 100644 --- a/src/usr.sbin/ocspcheck/ocspcheck.c +++ b/src/usr.sbin/ocspcheck/ocspcheck.c | |||
@@ -306,7 +306,7 @@ ocsp_request_new_from_cert(char *file, int nonce) | |||
306 | request->fullchain = read_fullchain(file, &count); | 306 | request->fullchain = read_fullchain(file, &count); |
307 | /* Drop rpath from pledge, we don't need to read anymore */ | 307 | /* Drop rpath from pledge, we don't need to read anymore */ |
308 | if (pledge("stdio inet dns", NULL) == -1) | 308 | if (pledge("stdio inet dns", NULL) == -1) |
309 | err(EXIT_FAILURE, "pledge"); | 309 | err(1, "pledge"); |
310 | 310 | ||
311 | if (request->fullchain == NULL) | 311 | if (request->fullchain == NULL) |
312 | return NULL; | 312 | return NULL; |
@@ -547,12 +547,12 @@ main(int argc, char **argv) | |||
547 | staplefd = open(outfile, O_WRONLY|O_CREAT, | 547 | staplefd = open(outfile, O_WRONLY|O_CREAT, |
548 | S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH); | 548 | S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH); |
549 | if (staplefd < 0) | 549 | if (staplefd < 0) |
550 | err(EXIT_FAILURE, "Unable to open output file %s", | 550 | err(1, "Unable to open output file %s", |
551 | outfile); | 551 | outfile); |
552 | } | 552 | } |
553 | 553 | ||
554 | if (pledge("stdio inet rpath dns", NULL) == -1) | 554 | if (pledge("stdio inet rpath dns", NULL) == -1) |
555 | err(EXIT_FAILURE, "pledge"); | 555 | err(1, "pledge"); |
556 | 556 | ||
557 | /* | 557 | /* |
558 | * Load our certificate and keystore, and build up an | 558 | * Load our certificate and keystore, and build up an |
@@ -560,12 +560,12 @@ main(int argc, char **argv) | |||
560 | * we have been given to check. | 560 | * we have been given to check. |
561 | */ | 561 | */ |
562 | if ((castore = read_cacerts(cafile)) == NULL) | 562 | if ((castore = read_cacerts(cafile)) == NULL) |
563 | exit(EXIT_FAILURE); | 563 | exit(1); |
564 | if ((request = ocsp_request_new_from_cert(certfile, nonce)) == NULL) | 564 | if ((request = ocsp_request_new_from_cert(certfile, nonce)) == NULL) |
565 | exit(EXIT_FAILURE); | 565 | exit(1); |
566 | 566 | ||
567 | if ((host = url2host(request->url, &port, &path)) == NULL) | 567 | if ((host = url2host(request->url, &port, &path)) == NULL) |
568 | errx(EXIT_FAILURE, "Invalid OCSP url %s from %s", request->url, | 568 | errx(1, "Invalid OCSP url %s from %s", request->url, |
569 | certfile); | 569 | certfile); |
570 | dspew("Built an %ld byte ocsp request\n", request->size); | 570 | dspew("Built an %ld byte ocsp request\n", request->size); |
571 | vspew("Using %s to host %s, port %d, path %s\n", | 571 | vspew("Using %s to host %s, port %d, path %s\n", |
@@ -584,14 +584,14 @@ main(int argc, char **argv) | |||
584 | hget = http_get(sources, rescount, host, port, path, | 584 | hget = http_get(sources, rescount, host, port, path, |
585 | request->data, request->size); | 585 | request->data, request->size); |
586 | if (hget == NULL) | 586 | if (hget == NULL) |
587 | errx(EXIT_FAILURE, "http_get"); | 587 | errx(1, "http_get"); |
588 | httph = http_head_parse(hget->http, hget->xfer, &httphsz); | 588 | httph = http_head_parse(hget->http, hget->xfer, &httphsz); |
589 | dspew("Server at %s returns:\n", host); | 589 | dspew("Server at %s returns:\n", host); |
590 | for (i = 0; i < httphsz; i++) | 590 | for (i = 0; i < httphsz; i++) |
591 | dspew(" [%s]=[%s]\n", httph[i].key, httph[i].val); | 591 | dspew(" [%s]=[%s]\n", httph[i].key, httph[i].val); |
592 | dspew(" [Body]=[%ld bytes]\n", hget->bodypartsz); | 592 | dspew(" [Body]=[%ld bytes]\n", hget->bodypartsz); |
593 | if (hget->bodypartsz <= 0) | 593 | if (hget->bodypartsz <= 0) |
594 | errx(EXIT_FAILURE, "No body in reply from %s", host); | 594 | errx(1, "No body in reply from %s", host); |
595 | 595 | ||
596 | /* | 596 | /* |
597 | * Pledge minimally before fiddling with libcrypto init routines | 597 | * Pledge minimally before fiddling with libcrypto init routines |
@@ -599,7 +599,7 @@ main(int argc, char **argv) | |||
599 | */ | 599 | */ |
600 | 600 | ||
601 | if (pledge("stdio", NULL) == -1) | 601 | if (pledge("stdio", NULL) == -1) |
602 | err(EXIT_FAILURE, "pledge"); | 602 | err(1, "pledge"); |
603 | 603 | ||
604 | /* | 604 | /* |
605 | * Validate the OCSP response we got back | 605 | * Validate the OCSP response we got back |
@@ -607,7 +607,7 @@ main(int argc, char **argv) | |||
607 | OPENSSL_add_all_algorithms_noconf(); | 607 | OPENSSL_add_all_algorithms_noconf(); |
608 | if (!validate_response(hget->bodypart, hget->bodypartsz, | 608 | if (!validate_response(hget->bodypart, hget->bodypartsz, |
609 | request, castore, host, certfile)) | 609 | request, castore, host, certfile)) |
610 | exit(EXIT_FAILURE); | 610 | exit(1); |
611 | 611 | ||
612 | /* | 612 | /* |
613 | * If we have been given a place to save a staple, | 613 | * If we have been given a place to save a staple, |
@@ -628,5 +628,5 @@ main(int argc, char **argv) | |||
628 | } | 628 | } |
629 | close(staplefd); | 629 | close(staplefd); |
630 | } | 630 | } |
631 | exit(EXIT_SUCCESS); | 631 | exit(0); |
632 | } | 632 | } |