| 418 | } |
| 419 | |
| 420 | static apr_status_t acct_upd(md_acme_t *acme, apr_pool_t *p, |
| 421 | const apr_table_t *hdrs, md_json_t *body, void *baton) |
| 422 | { |
| 423 | acct_ctx_t *ctx = baton; |
| 424 | apr_status_t rv = APR_SUCCESS; |
| 425 | md_acme_acct_t *acct = acme->acct; |
| 426 | |
| 427 | if (md_log_is_level(p, MD_LOG_TRACE2)) { |
| 428 | md_log_perror(MD_LOG_MARK, MD_LOG_TRACE2, 0, acme->p, "acct update response: %s", |
| 429 | md_json_writep(body, p, MD_JSON_FMT_COMPACT)); |
| 430 | } |
| 431 | |
| 432 | if (!acct->url) { |
| 433 | const char *location = apr_table_get(hdrs, "location"); |
| 434 | if (!location) { |
| 435 | md_log_perror(MD_LOG_MARK, MD_LOG_WARNING, APR_EINVAL, p, "new acct without location"); |
| 436 | return APR_EINVAL; |
| 437 | } |
| 438 | acct->url = apr_pstrdup(ctx->p, location); |
| 439 | } |
| 440 | |
| 441 | apr_array_clear(acct->contacts); |
| 442 | md_json_dupsa(acct->contacts, acme->p, body, MD_KEY_CONTACT, NULL); |
| 443 | if (md_json_has_key(body, MD_KEY_STATUS, NULL)) { |
| 444 | acct->status = acct_st_from_str(md_json_gets(body, MD_KEY_STATUS, NULL)); |
| 445 | } |
| 446 | if (md_json_has_key(body, MD_KEY_AGREEMENT, NULL)) { |
| 447 | acct->agreement = md_json_dups(acme->p, body, MD_KEY_AGREEMENT, NULL); |
| 448 | } |
| 449 | if (md_json_has_key(body, MD_KEY_ORDERS, NULL)) { |
| 450 | acct->orders = md_json_dups(acme->p, body, MD_KEY_ORDERS, NULL); |
| 451 | } |
| 452 | if (ctx->eab_kid && ctx->eab_hmac) { |
| 453 | acct->eab_kid = ctx->eab_kid; |
| 454 | acct->eab_hmac = ctx->eab_hmac; |
| 455 | } |
| 456 | acct->registration = md_json_clone(ctx->p, body); |
| 457 | |
| 458 | md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, rv, p, "updated acct %s", acct->url); |
| 459 | return rv; |
| 460 | } |
| 461 | |
| 462 | apr_status_t md_acme_acct_update(md_acme_t *acme) |
| 463 | { |
nothing calls this directly
no test coverage detected