From 09b2410688888c0f39ee780e35a51ba06469f382 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Mon, 5 Aug 2019 10:27:34 +0000 Subject: [PATCH] * mod_md: fix compiler warnings git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1864425 13f79535-47bb-0310-9956-ffa450edef68 --- modules/md/md_acme_acct.c | 2 +- modules/md/md_acme_order.c | 2 +- modules/md/md_crypt.c | 3 +++ modules/md/md_time.c | 2 +- modules/md/md_version.h | 4 ++-- modules/md/mod_md.c | 32 ++++++++++++-------------------- modules/md/mod_md_config.c | 4 ++-- modules/md/mod_md_drive.c | 2 +- 8 files changed, 23 insertions(+), 28 deletions(-) diff --git a/modules/md/md_acme_acct.c b/modules/md/md_acme_acct.c index 0f55ab258f..e1e36dfff8 100644 --- a/modules/md/md_acme_acct.c +++ b/modules/md/md_acme_acct.c @@ -443,7 +443,7 @@ static apr_status_t acct_upd(md_acme_t *acme, apr_pool_t *p, } apr_array_clear(acct->contacts); - md_json_getsa(acct->contacts, body, MD_KEY_CONTACT, NULL); + md_json_dupsa(acct->contacts, acme->p, body, MD_KEY_CONTACT, NULL); if (md_json_has_key(body, MD_KEY_STATUS, NULL)) { acct->status = acct_st_from_str(md_json_gets(body, MD_KEY_STATUS, NULL)); } diff --git a/modules/md/md_acme_order.c b/modules/md/md_acme_order.c index 51956e97c0..9314f20678 100644 --- a/modules/md/md_acme_order.c +++ b/modules/md/md_acme_order.c @@ -505,7 +505,7 @@ static apr_status_t check_challenges(void *baton, int attempt) default: rv = APR_EINVAL; md_result_printf(ctx->result, rv, - "domain authorization for %s failed with state %s", + "domain authorization for %s failed with state %d", authz->domain, authz->state); md_result_log(ctx->result, MD_LOG_ERR); goto leave; diff --git a/modules/md/md_crypt.c b/modules/md/md_crypt.c index c9f73614cd..57c32a2bfb 100644 --- a/modules/md/md_crypt.c +++ b/modules/md/md_crypt.c @@ -1545,6 +1545,9 @@ apr_status_t md_cert_get_ct_scts(apr_array_header_t *scts, apr_pool_t *p, const md_log_perror(MD_LOG_MARK, MD_LOG_TRACE3, 0, p, "ct_sct, found %d SCT extensions", scts->nelts); return APR_SUCCESS; #else + (void)scts; + (void)p; + (void)cert; return APR_ENOTIMPL; #endif } diff --git a/modules/md/md_time.c b/modules/md/md_time.c index f99b8865d8..4f494b3eff 100644 --- a/modules/md/md_time.c +++ b/modules/md/md_time.c @@ -219,7 +219,7 @@ const char *md_timeslice_parse(const md_timeslice_t **pts, apr_pool_t *p, const char *val, apr_interval_time_t norm) { md_timeslice_t *ts; - int percent; + int percent = 0; *pts = NULL; if (!val) { diff --git a/modules/md/md_version.h b/modules/md/md_version.h index 21286a2616..d7ebed23b6 100644 --- a/modules/md/md_version.h +++ b/modules/md/md_version.h @@ -27,7 +27,7 @@ * @macro * Version number of the md module as c string */ -#define MOD_MD_VERSION "2.0.7" +#define MOD_MD_VERSION "2.0.10" /** * @macro @@ -35,7 +35,7 @@ * release. This is a 24 bit number with 8 bits for major number, 8 bits * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203. */ -#define MOD_MD_VERSION_NUM 0x020007 +#define MOD_MD_VERSION_NUM 0x02000a #define MD_ACME_DEF_URL "https://acme-v02.api.letsencrypt.org/directory" diff --git a/modules/md/mod_md.c b/modules/md/mod_md.c index 23ad12ee2f..154a08ef11 100644 --- a/modules/md/mod_md.c +++ b/modules/md/mod_md.c @@ -143,8 +143,8 @@ static apr_status_t store_file_ev(void *baton, struct md_store_t *store, ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, s, "store event=%d on %s %s (group %d)", ev, (ftype == APR_DIR)? "dir" : "file", fname, group); - /* Directories in group CHALLENGES and STAGING are written to under a different user. - * Give him ownership. + /* Directories in group CHALLENGES, STAGING and OCSP are written to + * under a different user. Give her ownership. */ if (ftype == APR_DIR) { switch (group) { @@ -191,7 +191,8 @@ static apr_status_t setup_store(md_store_t **pstore, md_mod_conf_t *mc, md_store_fs_set_event_cb(*pstore, store_file_ev, s); if (APR_SUCCESS != (rv = check_group_dir(*pstore, MD_SG_CHALLENGES, p, s)) || APR_SUCCESS != (rv = check_group_dir(*pstore, MD_SG_STAGING, p, s)) - || APR_SUCCESS != (rv = check_group_dir(*pstore, MD_SG_ACCOUNTS, p, s))) { + || APR_SUCCESS != (rv = check_group_dir(*pstore, MD_SG_ACCOUNTS, p, s)) + ) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, APLOGNO(10047) "setup challenges directory"); } @@ -707,8 +708,8 @@ static void init_watched_names(md_mod_conf_t *mc, apr_pool_t *p, apr_pool_t *pte } } -static apr_status_t md_post_config(apr_pool_t *p, apr_pool_t *plog, - apr_pool_t *ptemp, server_rec *s) +static apr_status_t md_post_config_before_ssl(apr_pool_t *p, apr_pool_t *plog, + apr_pool_t *ptemp, server_rec *s) { void *data = NULL; const char *mod_md_init_key = "mod_md_init_counter"; @@ -751,11 +752,10 @@ static apr_status_t md_post_config(apr_pool_t *p, apr_pool_t *plog, if (APR_SUCCESS != (rv = setup_store(&store, mc, p, s)) || APR_SUCCESS != (rv = md_reg_create(&mc->reg, p, store, mc->proxy_url))) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, APLOGNO(10072) - "setup md registry"); + ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, APLOGNO(10072) "setup md registry"); goto leave; } - + init_ssl(); /* How to bootstrap this module: @@ -939,17 +939,8 @@ static apr_status_t get_certificate(server_rec *s, apr_pool_t *p, int fallback, } if (!sc->assigned) { - /* Hmm, mod_ssl (or someone like it) asks for certificates for a server - * where we did not assign a MD to. Either the user forgot to configure - * that server with SSL certs, has misspelled a server name or we have - * a bug that prevented us from taking responsibility for this server. - * Either way, make some polite noise */ - ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, s, APLOGNO(10114) - "asked for certificate of server %s which has no MD assigned. This " - "could be ok, but most likely it is either a misconfiguration or " - "a bug. Please check server names and MD names carefully and if " - "everything checks open, please open an issue.", - s->server_hostname); + /* With the new hooks in mod_ssl, we are invoked for all server_rec. It is + * therefore normal, when we have nothing to add here. */ return APR_ENOENT; } @@ -1254,8 +1245,9 @@ static void md_hooks(apr_pool_t *pool) ap_log_perror(APLOG_MARK, APLOG_TRACE1, 0, pool, "installing hooks"); /* Run once after configuration is set, before mod_ssl. + * Run again after mod_ssl is done. */ - ap_hook_post_config(md_post_config, NULL, mod_ssl, APR_HOOK_MIDDLE); + ap_hook_post_config(md_post_config_before_ssl, NULL, mod_ssl, APR_HOOK_MIDDLE); /* Run once after a child process has been created. */ diff --git a/modules/md/mod_md_config.c b/modules/md/mod_md_config.c index 9123a22d32..ffb09470db 100644 --- a/modules/md/mod_md_config.c +++ b/modules/md/mod_md_config.c @@ -45,7 +45,7 @@ static md_mod_conf_t defmc = { NULL, /* list of mds */ #if AP_MODULE_MAGIC_AT_LEAST(20180906, 2) - NULL, /* base dirm by default state-dir-relative */ + NULL, /* base dir by default state-dir-relative */ #else MD_DEFAULT_BASE_DIR, #endif @@ -897,7 +897,7 @@ apr_status_t md_config_post_config(server_rec *s, apr_pool_t *p) if (mc->hsts_max_age > 0) { mc->hsts_header = apr_psprintf(p, "max-age=%d", mc->hsts_max_age); } - + #if AP_MODULE_MAGIC_AT_LEAST(20180906, 2) if (mc->base_dir == NULL) { mc->base_dir = ap_state_dir_relative(p, MD_DEFAULT_BASE_DIR); diff --git a/modules/md/mod_md_drive.c b/modules/md/mod_md_drive.c index 670c7e7910..31fdc27225 100644 --- a/modules/md/mod_md_drive.c +++ b/modules/md/mod_md_drive.c @@ -149,7 +149,7 @@ static apr_status_t send_notification(md_drive_ctx *dctx, md_job_t *job, const m const char * const *argv; const char *cmdline; int exit_code; - apr_status_t rv; + apr_status_t rv = APR_SUCCESS; if (!strcmp("renewed", reason)) { if (dctx->mc->notify_cmd) { -- 2.50.1