| 1004 | } ocsp_status_ctx_t; |
| 1005 | |
| 1006 | static md_json_t *mk_jstat(md_ocsp_status_t *ostat, md_ocsp_reg_t *reg, apr_pool_t *p) |
| 1007 | { |
| 1008 | md_ocsp_cert_stat_t stat; |
| 1009 | md_timeperiod_t valid, renewal; |
| 1010 | md_json_t *json, *jobj; |
| 1011 | apr_status_t rv; |
| 1012 | |
| 1013 | json = md_json_create(p); |
| 1014 | md_json_sets(ostat->md_name, json, MD_KEY_DOMAIN, NULL); |
| 1015 | md_json_sets(ostat->hexid, json, MD_KEY_ID, NULL); |
| 1016 | ocsp_get_meta(&stat, &valid, reg, ostat, p); |
| 1017 | md_json_sets(md_ocsp_cert_stat_name(stat), json, MD_KEY_STATUS, NULL); |
| 1018 | md_json_sets(ostat->hex_sha256, json, MD_KEY_CERT, MD_KEY_SHA256_FINGERPRINT, NULL); |
| 1019 | md_json_sets(ostat->responder_url, json, MD_KEY_URL, NULL); |
| 1020 | md_json_set_timeperiod(&valid, json, MD_KEY_VALID, NULL); |
| 1021 | renewal = md_timeperiod_slice_before_end(&valid, ®->renew_window); |
| 1022 | md_json_set_time(renewal.start, json, MD_KEY_RENEW_AT, NULL); |
| 1023 | if ((MD_OCSP_CERT_ST_UNKNOWN == stat) || renewal.start < apr_time_now()) { |
| 1024 | /* We have no answer yet, or it should be in renew now. Add job information */ |
| 1025 | rv = job_loadj(&jobj, ostat->md_name, reg, p); |
| 1026 | if (APR_SUCCESS == rv) { |
| 1027 | md_json_setj(jobj, json, MD_KEY_RENEWAL, NULL); |
| 1028 | } |
| 1029 | } |
| 1030 | return json; |
| 1031 | } |
| 1032 | |
| 1033 | static int add_ostat(void *baton, const void *key, apr_ssize_t klen, const void *val) |
| 1034 | { |
no test coverage detected