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

Function process_drive_job

modules/md/mod_md_drive.c:72–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70};
71
72static void process_drive_job(md_renew_ctx_t *dctx, md_job_t *job, apr_pool_t *ptemp)
73{
74 const md_t *md;
75 md_result_t *result = NULL;
76 apr_status_t rv;
77
78 md_job_load(job);
79 /* Evaluate again on loaded value. Values will change when watchdog switches child process */
80 if (apr_time_now() < job->next_run) return;
81
82 job->next_run = 0;
83 if (job->finished && job->notified_renewed) {
84 /* finished and notification handled, nothing to do. */
85 goto leave;
86 }
87
88 md = md_get_by_name(dctx->mc->mds, job->mdomain);
89 AP_DEBUG_ASSERT(md);
90
91 result = md_result_md_make(ptemp, md->name);
92 if (job->last_result) md_result_assign(result, job->last_result);
93
94 if (md->state == MD_S_MISSING_INFORMATION) {
95 /* Missing information, this will not change until configuration
96 * is changed and server reloaded. */
97 job->fatal_error = 1;
98 job->next_run = 0;
99 goto leave;
100 }
101
102 if (md_will_renew_cert(md)) {
103 /* Renew the MDs credentials in a STAGING area. Might be invoked repeatedly
104 * without discarding previous/intermediate results.
105 * Only returns SUCCESS when the renewal is complete, e.g. STAGING has a
106 * complete set of new credentials.
107 */
108 apr_time_t renew_at, now;
109 const char *ari_explain_url = NULL;
110
111 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, dctx->s, APLOGNO(10052)
112 "md(%s): state=%d, driving", job->mdomain, md->state);
113
114 renew_at = md_reg_renew_at(dctx->mc->reg, md, ptemp);
115 now = apr_time_now();
116
117 if (md->stapling && dctx->mc->ocsp &&
118 md_reg_has_revoked_certs(dctx->mc->reg, dctx->mc->ocsp, md, ptemp)) {
119 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, dctx->s, APLOGNO(10500)
120 "md(%s): need to renew, OCSP reports revoked "
121 "certificate(s)", job->mdomain);
122 }
123 else if (!renew_at || renew_at <= now) {
124 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, dctx->s, APLOGNO(10512)
125 "md(%s): need to renew now", job->mdomain);
126 }
127 else {
128 apr_time_t ari_renew_at = 0;
129 char ts[APR_RFC822_DATE_LEN];

Callers 1

run_watchdogFunction · 0.85

Calls 15

md_job_loadFunction · 0.85
md_get_by_nameFunction · 0.85
md_result_md_makeFunction · 0.85
md_result_assignFunction · 0.85
md_will_renew_certFunction · 0.85
md_reg_renew_atFunction · 0.85
md_reg_has_revoked_certsFunction · 0.85
md_reg_ari_renew_atFunction · 0.85
md_duration_printFunction · 0.85
md_event_raiseFunction · 0.85
md_job_start_runFunction · 0.85
md_reg_store_getFunction · 0.85

Tested by

no test coverage detected