count certs that verify and if no verify at all, whine
This commit is contained in:
@@ -820,6 +820,7 @@ struct verify {
|
|||||||
hx509_certs chain;
|
hx509_certs chain;
|
||||||
const char *hostname;
|
const char *hostname;
|
||||||
int errors;
|
int errors;
|
||||||
|
int count;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -834,8 +835,10 @@ verify_f(hx509_context hxcontext, void *ctx, hx509_cert c)
|
|||||||
printf("verify_path: %s: %d\n", s, ret);
|
printf("verify_path: %s: %d\n", s, ret);
|
||||||
hx509_free_error_string(s);
|
hx509_free_error_string(s);
|
||||||
v->errors++;
|
v->errors++;
|
||||||
} else
|
} else {
|
||||||
|
v->count++;
|
||||||
printf("path ok\n");
|
printf("path ok\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (v->hostname) {
|
if (v->hostname) {
|
||||||
ret = hx509_verify_hostname(hxcontext, c, 0, HX509_HN_HOSTNAME,
|
ret = hx509_verify_hostname(hxcontext, c, 0, HX509_HN_HOSTNAME,
|
||||||
@@ -965,6 +968,12 @@ pcert_verify(struct verify_options *opt, int argc, char **argv)
|
|||||||
|
|
||||||
hx509_revoke_free(&revoke_ctx);
|
hx509_revoke_free(&revoke_ctx);
|
||||||
|
|
||||||
|
|
||||||
|
if (v.count == 0) {
|
||||||
|
printf("no certs verify at all\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (v.errors) {
|
if (v.errors) {
|
||||||
printf("failed verifing %d checks\n", v.errors);
|
printf("failed verifing %d checks\n", v.errors);
|
||||||
return 1;
|
return 1;
|
||||||
|
Reference in New Issue
Block a user