| 459 | } |
| 460 | |
| 461 | static apr_status_t ad_chain_retrieve(md_proto_driver_t *d) |
| 462 | { |
| 463 | md_acme_driver_t *ad = d->baton; |
| 464 | apr_status_t rv; |
| 465 | |
| 466 | /* This may be called repeatedly and needs to progress. The relevant state is in |
| 467 | * ad->cred->chain the certificate chain, starting with the new cert for the md |
| 468 | * ad->order->certificate the url where ACME offers us the new md certificate. This may |
| 469 | * be a single one or even the complete chain |
| 470 | * ad->chain_up_link in case the last certificate retrieval did not end the chain, |
| 471 | * the link header with relation "up" gives us the location |
| 472 | * for the next cert in the chain |
| 473 | */ |
| 474 | if (md_array_is_empty(ad->cred->chain)) { |
| 475 | /* Need to start at the order */ |
| 476 | ad->chain_up_link = NULL; |
| 477 | if (!ad->order) { |
| 478 | rv = APR_EGENERAL; |
| 479 | md_log_perror(MD_LOG_MARK, MD_LOG_ERR, rv, d->p, |
| 480 | "%s: asked to retrieve chain, but no order in context", d->md->name); |
| 481 | goto out; |
| 482 | } |
| 483 | if (!ad->order->certificate) { |
| 484 | rv = APR_EGENERAL; |
| 485 | md_log_perror(MD_LOG_MARK, MD_LOG_ERR, rv, d->p, |
| 486 | "%s: asked to retrieve chain, but no certificate url part of order", d->md->name); |
| 487 | goto out; |
| 488 | } |
| 489 | |
| 490 | if (APR_SUCCESS != (rv = md_acme_drive_cert_poll(d, 0))) { |
| 491 | goto out; |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | rv = md_util_try(get_chain, d, 0, ad->cert_poll_timeout, 0, 0, 0); |
| 496 | md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, rv, d->p, "chain retrieved"); |
| 497 | |
| 498 | out: |
| 499 | return rv; |
| 500 | } |
| 501 | |
| 502 | /**************************************************************************************************/ |
| 503 | /* ACME driver init */ |
no test coverage detected