Re: Crash in mod_md if httpd.json not readable

"Stefan Eissing via dev" <[email protected]>
Newsgroups gmane.comp.apache.devel
Message-ID <[email protected]>

> Am 27.01.2025 um 20:43 schrieb Rainer Jung <[email protected]>:
> 
> This is not new and of course mod_md can not work if md/httpd.json is not readable. But the process should not crash.
> 
> mod_md logs:
> 
> (13)Permission denied: AH10072: setup md registry
> 
> and then crashes.
> 
> In mod_md.c function md_post_config_before_ssl() we jump to leave after logging the message:
> 
>    886     rv = md_reg_create(&mc->reg, p, store, mc->proxy_url, mc->ca_certs,
>    887                        mc->min_delay, mc->retry_failover,
>    888                        mc->use_store_locks, mc->lock_wait_timeout);
>    889     if (APR_SUCCESS != rv) {
>    890         ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, APLOGNO(10072) "setup md registry");
>    891         goto leave;
>    892     }
> 
> But in leave we have:
> 
>    947 leave:
>    948     md_reg_unlock_global(mc->reg, ptemp);
>    949     return rv;
>    950 }
> 
> And this crashes in md_reg_unlock_global(), when mc->reg is NULL:
> 
> void md_reg_unlock_global(md_reg_t *reg, apr_pool_t *p)
> {
>    if (reg->use_store_locks) {
>        md_store_unlock_global(reg->store, p);
>    }
> }
> 
> It might probably just be enough to check for NULL in leave.
> 
> Should I log an issue against GH mod_md?

Yes, please open an issue.

> 
> Thanks and best regards,
> 
> Rainer
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.