| 503 | } |
| 504 | |
| 505 | static apr_status_t check_challenges(void *baton, int attempt) |
| 506 | { |
| 507 | order_ctx_t *ctx = baton; |
| 508 | const char *url; |
| 509 | md_acme_authz_t *authz; |
| 510 | apr_status_t rv = APR_SUCCESS; |
| 511 | int i; |
| 512 | |
| 513 | for (i = 0; i < ctx->order->authz_urls->nelts; ++i) { |
| 514 | url = APR_ARRAY_IDX(ctx->order->authz_urls, i, const char*); |
| 515 | md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, rv, ctx->p, "%s: check AUTHZ at %s (attempt %d)", |
| 516 | ctx->name, url, attempt); |
| 517 | |
| 518 | rv = md_acme_authz_retrieve(ctx->acme, ctx->p, url, &authz); |
| 519 | if (APR_SUCCESS == rv) { |
| 520 | switch (authz->state) { |
| 521 | case MD_ACME_AUTHZ_S_VALID: |
| 522 | md_result_printf(ctx->result, rv, |
| 523 | "domain authorization for %s is valid", authz->domain); |
| 524 | break; |
| 525 | case MD_ACME_AUTHZ_S_PENDING: |
| 526 | rv = APR_EAGAIN; |
| 527 | md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, rv, ctx->p, |
| 528 | "%s: status pending at %s", authz->domain, authz->url); |
| 529 | goto leave; |
| 530 | case MD_ACME_AUTHZ_S_INVALID: |
| 531 | rv = APR_EINVAL; |
| 532 | md_result_printf(ctx->result, rv, |
| 533 | "domain authorization for %s failed, CA considers " |
| 534 | "answer to challenge invalid%s.", |
| 535 | authz->domain, authz->error_type? "" : ", no error given"); |
| 536 | md_result_log(ctx->result, MD_LOG_ERR); |
| 537 | goto leave; |
| 538 | default: |
| 539 | rv = APR_EINVAL; |
| 540 | md_result_printf(ctx->result, rv, |
| 541 | "domain authorization for %s failed with state %d", |
| 542 | authz->domain, authz->state); |
| 543 | md_result_log(ctx->result, MD_LOG_ERR); |
| 544 | goto leave; |
| 545 | } |
| 546 | } |
| 547 | else { |
| 548 | md_result_printf(ctx->result, rv, "authorization retrieval failed for %s on <%s>", |
| 549 | ctx->name, url); |
| 550 | } |
| 551 | } |
| 552 | leave: |
| 553 | return rv; |
| 554 | } |
| 555 | |
| 556 | apr_status_t md_acme_order_monitor_authzs(md_acme_order_t *order, md_acme_t *acme, |
| 557 | const md_t *md, apr_interval_time_t timeout, |
nothing calls this directly
no test coverage detected