MCPcopy Create free account
hub / github.com/apache/httpd / md_reg_renew_at

Function md_reg_renew_at

modules/md/md_reg.c:686–724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

684}
685
686apr_time_t md_reg_renew_at(md_reg_t *reg, const md_t *md, apr_pool_t *p)
687{
688 const md_pubcert_t *pub;
689 const md_cert_t *cert;
690 md_timeperiod_t certlife, renewal;
691 int i;
692 apr_time_t renew_at = 0, now = apr_time_now();
693 apr_status_t rv;
694
695 if (md->state == MD_S_INCOMPLETE) return now;
696 for (i = 0; i < md_cert_count(md); ++i) {
697 rv = md_reg_get_pubcert(&pub, reg, md, i, p);
698 if (APR_STATUS_IS_ENOENT(rv)) {
699 md_log_perror(MD_LOG_MARK, MD_LOG_TRACE1, 0, p,
700 "md(%s): is missing certificate #%d",
701 md->name, i);
702 return now;
703 }
704 if (APR_SUCCESS == rv) {
705 cert = APR_ARRAY_IDX(pub->certs, 0, const md_cert_t*);
706 certlife.start = md_cert_get_not_before(cert);
707 certlife.end = md_cert_get_not_after(cert);
708
709 renewal = md_timeperiod_slice_before_end(&certlife, md->renew_window);
710 if (md_log_is_level(p, MD_LOG_TRACE1)) {
711 md_log_perror(MD_LOG_MARK, MD_LOG_TRACE1, 0, p,
712 "md[%s]: certificate(%d) valid[%s] renewal[%s]",
713 md->name, i,
714 md_timeperiod_print(p, &certlife),
715 md_timeperiod_print(p, &renewal));
716 }
717
718 if (renew_at == 0 || renewal.start < renew_at) {
719 renew_at = renewal.start;
720 }
721 }
722 }
723 return renew_at;
724}
725
726int md_reg_should_renew(md_reg_t *reg, const md_t *md, apr_pool_t *p)
727{

Callers 3

process_drive_jobFunction · 0.85
status_get_md_jsonFunction · 0.85
md_reg_should_renewFunction · 0.85

Calls 8

md_cert_countFunction · 0.85
md_reg_get_pubcertFunction · 0.85
md_log_perrorFunction · 0.85
md_cert_get_not_beforeFunction · 0.85
md_cert_get_not_afterFunction · 0.85
md_log_is_levelFunction · 0.85
md_timeperiod_printFunction · 0.85

Tested by

no test coverage detected