From 5c4d65bd9e6f537fa9fda56c4f8bb5f77211ad08 Mon Sep 17 00:00:00 2001 From: Hans Zandbelt Date: Wed, 11 Dec 2024 07:51:19 +0100 Subject: [PATCH] code: avoid embedding defines in macro arguments re-enable SonarQube Signed-off-by: Hans Zandbelt --- .../{sonarqube.yml.save => sonarqube.yml} | 0 ChangeLog | 1 + src/cfg/cmds.c | 20 ++++++++------ src/mod_auth_openidc.c | 26 +++++++++---------- 4 files changed, 26 insertions(+), 21 deletions(-) rename .github/workflows/{sonarqube.yml.save => sonarqube.yml} (100%) diff --git a/.github/workflows/sonarqube.yml.save b/.github/workflows/sonarqube.yml similarity index 100% rename from .github/workflows/sonarqube.yml.save rename to .github/workflows/sonarqube.yml diff --git a/ChangeLog b/ChangeLog index 347a50e8..6140567a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 12/11/2024 - code: loop over authz arrays with index instead of pointer +- code: avoid embedding defines in macro arguments 12/10/2024 - github: add SonarQube analysis to Github workflows diff --git a/src/cfg/cmds.c b/src/cfg/cmds.c index ac093a7e..0d32e915 100644 --- a/src/cfg/cmds.c +++ b/src/cfg/cmds.c @@ -255,19 +255,23 @@ const command_rec oidc_cfg_cmds[] = { // cache +#ifdef USE_MEMCACHE +#define _OIDC_CMDS_CACHE_TYPE_MEMCACHE "'memcache'|" +#else +#define _OIDC_CMDS_CACHE_TYPE_MEMCACHE +#endif +#ifdef USE_LIBHIREDIS +#define _OIDC_CMDS_CACHE_TYPE_REDIS "'redis'|" +#else +#define _OIDC_CMDS_CACHE_TYPE_REDIS +#endif + AP_INIT_TAKE1( OIDCCacheType, oidc_cmd_cache_type_set, NULL, RSRC_CONF, - "cache backend must be one of ['shm'|" -#ifdef USE_MEMCACHE - "'memcache'|" -#endif -#ifdef USE_LIBHIREDIS - "'redis'|" -#endif - "'file']."), + "cache backend must be one of ['shm'|" _OIDC_CMDS_CACHE_TYPE_MEMCACHE _OIDC_CMDS_CACHE_TYPE_REDIS "'file']."), OIDC_CFG_CMD( AP_INIT_TAKE1, OIDCCacheEncrypt, diff --git a/src/mod_auth_openidc.c b/src/mod_auth_openidc.c index 284494ad..8c917016 100644 --- a/src/mod_auth_openidc.c +++ b/src/mod_auth_openidc.c @@ -1665,28 +1665,28 @@ static int oidc_post_config(apr_pool_t *pool, apr_pool_t *p1, apr_pool_t *p2, se return OK; } - ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, - "%s - init - cjose %s, %s, EC=%s, GCM=%s, Memcache=%s, Redis=%s, JQ=%s", NAMEVERSION, - cjose_version(), oidc_util_openssl_version(s->process->pool), OIDC_JOSE_EC_SUPPORT ? "yes" : "no", - OIDC_JOSE_GCM_SUPPORT ? "yes" : "no", #ifdef USE_MEMCACHE - "yes" +#define _OIDC_USE_MEMCACHE "yes" #else - "no" +#define _OIDC_USE_MEMCACHE "no" #endif - , + #ifdef USE_LIBHIREDIS - "yes" +#define _OIDC_USE_REDIS "yes" #else - "no" +#define _OIDC_USE_REDIS "no" #endif - , + #ifdef USE_LIBJQ - "yes" +#define _OIDC_USE_JQ "yes" #else - "no" +#define _OIDC_USE_JQ "no" #endif - ); + + ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, + "%s - init - cjose %s, %s, EC=%s, GCM=%s, Memcache=%s, Redis=%s, JQ=%s", NAMEVERSION, + cjose_version(), oidc_util_openssl_version(s->process->pool), OIDC_JOSE_EC_SUPPORT ? "yes" : "no", + OIDC_JOSE_GCM_SUPPORT ? "yes" : "no", _OIDC_USE_MEMCACHE, _OIDC_USE_REDIS, _OIDC_USE_JQ); oidc_http_init();