Skip to content

Commit e04f6ab

Browse files
committed
2.4.19dev: drop support for Apache 2.2
bump to 2.4.19dev Signed-off-by: Hans Zandbelt <[email protected]>
1 parent 4543c6c commit e04f6ab

13 files changed

Lines changed: 3 additions & 291 deletions

File tree

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
11/17/2025
22
- metadata: avoid double-free when validation of provider metadata fails
3+
- drop support for Apache 2.2
4+
- bump to 2.4.19dev
35

46
11/14/2025
57
- test: add test/test_proto.c and migrate proto tests from test.c

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
AC_INIT([mod_auth_openidc],[2.4.18.2dev],[[email protected]])
1+
AC_INIT([mod_auth_openidc],[2.4.19dev],[[email protected]])
22

33
AC_SUBST(NAMEVER, AC_PACKAGE_TARNAME()-AC_PACKAGE_VERSION())
44

src/cache/common.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,7 @@ static apr_byte_t oidc_cache_mutex_global_create(server_rec *s, oidc_cache_mutex
118118

119119
/* need this on Linux */
120120
#ifdef AP_NEED_SET_MUTEX_PERMS
121-
#if MODULE_MAGIC_NUMBER_MAJOR >= 20081201
122121
rv = ap_unixd_set_global_mutex_perms(m->gmutex);
123-
#else
124-
rv = unixd_set_global_mutex_perms(m->gmutex);
125-
#endif
126122
if (rv != APR_SUCCESS) {
127123
oidc_serror(s, "unixd_set_global_mutex_perms failed; could not set permissions: %s (%d)",
128124
oidc_cache_status2str(s->process->pool, rv), rv);

src/cfg/cfg.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,7 @@ typedef enum {
141141
#define OIDC_HTML_ERROR_TEMPLATE_DEPRECATED "deprecated"
142142

143143
typedef struct oidc_apr_expr_t {
144-
#if HAVE_APACHE_24
145144
ap_expr_info_t *expr;
146-
#endif
147145
char *str;
148146
} oidc_apr_expr_t;
149147

src/cfg/parse.c

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -530,44 +530,6 @@ const char *oidc_cfg_parse_action_on_error_refresh_as(apr_pool_t *pool, const ch
530530
return oidc_cfg_parse_option(pool, options, OIDC_CFG_OPTIONS_SIZE(options), arg, (int *)action);
531531
}
532532

533-
#if !(HAVE_APACHE_24)
534-
static char *ap_get_exec_line(apr_pool_t *p, const char *cmd, const char *const *argv) {
535-
char buf[MAX_STRING_LEN];
536-
apr_procattr_t *procattr;
537-
apr_proc_t *proc;
538-
apr_file_t *fp;
539-
apr_size_t nbytes = 1;
540-
char c;
541-
int k;
542-
543-
if (apr_procattr_create(&procattr, p) != APR_SUCCESS)
544-
return NULL;
545-
if (apr_procattr_io_set(procattr, APR_FULL_BLOCK, APR_FULL_BLOCK, APR_FULL_BLOCK) != APR_SUCCESS)
546-
return NULL;
547-
if (apr_procattr_dir_set(procattr, ap_make_dirstr_parent(p, cmd)) != APR_SUCCESS)
548-
return NULL;
549-
if (apr_procattr_cmdtype_set(procattr, APR_PROGRAM) != APR_SUCCESS)
550-
return NULL;
551-
proc = apr_pcalloc(p, sizeof(apr_proc_t));
552-
if (apr_proc_create(proc, cmd, argv, NULL, procattr, p) != APR_SUCCESS)
553-
return NULL;
554-
fp = proc->out;
555-
556-
if (fp == NULL)
557-
return NULL;
558-
/* XXX: we are reading 1 byte at a time here */
559-
for (k = 0; apr_file_read(fp, &c, &nbytes) == APR_SUCCESS && nbytes == 1 && (k < MAX_STRING_LEN - 1);) {
560-
if (c == '\n' || c == '\r')
561-
break;
562-
buf[k++] = c;
563-
}
564-
buf[k] = '\0';
565-
apr_file_close(fp);
566-
567-
return apr_pstrndup(p, buf, k);
568-
}
569-
#endif
570-
571533
/*
572534
* set a string value in the server config with exec support
573535
*/

src/const.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ static inline int _oidc_str_to_int(const char *s, const int default_value) {
110110
#define snprintf _snprintf
111111
#endif
112112

113-
#define HAVE_APACHE_24 MODULE_MAGIC_NUMBER_MAJOR >= 20100714
114-
115113
#ifndef OIDC_DEBUG
116114
#define OIDC_DEBUG APLOG_DEBUG
117115
#endif

src/handle/authz.c

Lines changed: 0 additions & 191 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,6 @@ static apr_byte_t oidc_authz_skip_to_content_handler(request_rec *r) {
448448
return FALSE;
449449
}
450450

451-
#if HAVE_APACHE_24
452-
453451
/*
454452
* Apache >=2.4 authorization routine: match the claims from the authenticated user against the Require primitive
455453
*/
@@ -635,192 +633,3 @@ authz_status oidc_authz_24_checker_claims_expr(request_rec *r, const char *requi
635633
return oidc_authz_24_checker(r, require_args, parsed_require_args, oidc_authz_match_claims_expr);
636634
}
637635
#endif
638-
639-
#else
640-
641-
/*
642-
* Apache <2.4 authorization routine: match the claims from the authenticated user against the Require primitive
643-
*/
644-
static int oidc_authz_22_worker(request_rec *r, json_t *claims, const require_line *const reqs, int nelts) {
645-
const int m = r->method_number;
646-
const char *token;
647-
const char *requirement;
648-
int i;
649-
int have_oauthattr = 0;
650-
int count_oauth_claims = 0;
651-
oidc_authz_match_claim_fn_type match_claim_fn = NULL;
652-
653-
/* go through applicable Require directives */
654-
for (i = 0; i < nelts; ++i) {
655-
656-
/* ignore this Require if it's in a <Limit> section that exclude this method */
657-
if (!(reqs[i].method_mask & (AP_METHOD_BIT << m))) {
658-
continue;
659-
}
660-
661-
/* ignore if it's not a "Require claim ..." */
662-
requirement = reqs[i].requirement;
663-
664-
token = ap_getword_white(r->pool, &requirement);
665-
666-
/* see if we've got anything meant for us */
667-
if (_oidc_strnatcasecmp(token, OIDC_REQUIRE_CLAIM_NAME) == 0) {
668-
match_claim_fn = oidc_authz_match_claim;
669-
#ifdef USE_LIBJQ
670-
} else if (_oidc_strnatcasecmp(token, OIDC_REQUIRE_CLAIMS_EXPR_NAME) == 0) {
671-
match_claim_fn = oidc_authz_match_claims_expr;
672-
#endif
673-
} else {
674-
continue;
675-
}
676-
677-
/* ok, we have a "Require claim/claims_expr" to satisfy */
678-
have_oauthattr = 1;
679-
680-
/*
681-
* If we have an applicable claim, but no claims were sent in the request, then we can
682-
* just stop looking here, because it's not satisfiable. The code after this loop will
683-
* give the appropriate response.
684-
*/
685-
if (!claims) {
686-
break;
687-
}
688-
689-
/*
690-
* iterate over the claim specification strings in this require directive searching
691-
* for a specification that matches one of the claims/expressions.
692-
*/
693-
while (*requirement) {
694-
token = ap_getword_conf(r->pool, &requirement);
695-
count_oauth_claims++;
696-
697-
oidc_debug(r, "evaluating claim/expr specification: %s", token);
698-
699-
if (match_claim_fn(r, token, claims) == TRUE) {
700-
701-
/* if *any* claim matches, then authorization has succeeded and all of the others are
702-
* ignored */
703-
oidc_debug(r, "require claim/expr '%s' matched", token);
704-
return OK;
705-
}
706-
}
707-
708-
oidc_authz_error_add(r, requirement);
709-
}
710-
711-
/* if there weren't any "Require claim" directives, we're irrelevant */
712-
if (!have_oauthattr) {
713-
oidc_debug(r, "no claim/expr statements found, not performing authz");
714-
return DECLINED;
715-
}
716-
/* if there was a "Require claim", but no actual claims, that's cause to warn the admin of an iffy configuration
717-
*/
718-
if (count_oauth_claims == 0) {
719-
oidc_warn(r, "'require claim/expr' missing specification(s) in configuration, declining");
720-
return DECLINED;
721-
}
722-
723-
/* log the event, also in Apache speak */
724-
oidc_debug(r, "authorization denied for require claims (0/%d): '%s'", nelts,
725-
nelts > 0 ? reqs[0].requirement : "(none)");
726-
727-
ap_note_auth_failure(r);
728-
729-
return HTTP_UNAUTHORIZED;
730-
}
731-
732-
/*
733-
* find out which action we need to take when encountering an unauthorized request
734-
*/
735-
static int oidc_authz_22_unauthorized_user(request_rec *r) {
736-
737-
oidc_cfg_t *c = ap_get_module_config(r->server->module_config, &auth_openidc_module);
738-
739-
if (_oidc_strnatcasecmp((const char *)ap_auth_type(r), OIDC_AUTH_TYPE_OPENID_OAUTH20) == 0) {
740-
OIDC_METRICS_COUNTER_INC(r, c, OM_AUTHZ_ERROR_OAUTH20);
741-
oidc_proto_return_www_authenticate(r, "insufficient_scope",
742-
"Different scope(s) or other claims required");
743-
return HTTP_UNAUTHORIZED;
744-
}
745-
746-
/* see if we've configured OIDCUnAutzAction for this path */
747-
switch (oidc_cfg_dir_unautz_action_get(r)) {
748-
case OIDC_UNAUTZ_RETURN403:
749-
OIDC_METRICS_COUNTER_INC(r, c, OM_AUTHZ_ACTION_403);
750-
if (oidc_cfg_dir_unauthz_arg_get(r))
751-
oidc_util_html_send(r, "Authorization Error", NULL, NULL, oidc_cfg_dir_unauthz_arg_get(r),
752-
HTTP_FORBIDDEN);
753-
return HTTP_FORBIDDEN;
754-
case OIDC_UNAUTZ_RETURN401:
755-
OIDC_METRICS_COUNTER_INC(r, c, OM_AUTHZ_ACTION_401);
756-
if (oidc_cfg_dir_unauthz_arg_get(r))
757-
oidc_util_html_send(r, "Authorization Error", NULL, NULL, oidc_cfg_dir_unauthz_arg_get(r),
758-
HTTP_UNAUTHORIZED);
759-
return HTTP_UNAUTHORIZED;
760-
case OIDC_UNAUTZ_RETURN302:
761-
OIDC_METRICS_COUNTER_INC(r, c, OM_AUTHZ_ACTION_302);
762-
oidc_http_hdr_out_location_set(r, oidc_cfg_dir_unauthz_arg_get(r));
763-
return HTTP_MOVED_TEMPORARILY;
764-
case OIDC_UNAUTZ_AUTHENTICATE:
765-
/*
766-
* exception handling: if this looks like a XMLHttpRequest call we
767-
* won't redirect the user and thus avoid creating a state cookie
768-
* for a non-browser (= Javascript) call that will never return from the OP
769-
*/
770-
if (oidc_is_auth_capable_request(r) == FALSE) {
771-
OIDC_METRICS_COUNTER_INC(r, c, OM_AUTHZ_ACTION_401);
772-
return HTTP_UNAUTHORIZED;
773-
}
774-
775-
OIDC_METRICS_COUNTER_INC(r, c, OM_AUTHZ_ACTION_AUTH);
776-
}
777-
778-
return oidc_request_authenticate_user(r, c, NULL, oidc_util_url_cur(r, oidc_cfg_x_forwarded_headers_get(c)),
779-
NULL, NULL, NULL, oidc_cfg_dir_path_auth_request_params_get(r),
780-
oidc_cfg_dir_path_scope_get(r));
781-
}
782-
783-
/*
784-
* generic Apache <2.4 authorization hook for this module
785-
* handles both OpenID Connect and OAuth 2.0 in the same way, based on the claims stored in the request context
786-
*/
787-
int oidc_authz_22_checker(request_rec *r) {
788-
789-
/* check for anonymous access and PASS mode */
790-
if ((r->user != NULL) && (_oidc_strlen(r->user) == 0)) {
791-
r->user = NULL;
792-
if (oidc_cfg_dir_unauth_action_get(r) == OIDC_UNAUTH_PASS)
793-
return OK;
794-
if (oidc_authz_skip_to_content_handler(r) == TRUE)
795-
return OK;
796-
if (r->method_number == M_OPTIONS)
797-
return OK;
798-
}
799-
800-
/* get the set of claims from the request state (they've been set in the authentication part earlier */
801-
json_t *claims = oidc_authz_merge_claims(r);
802-
803-
/* get the Require statements */
804-
const apr_array_header_t *const reqs_arr = ap_requires(r);
805-
806-
/* see if we have any */
807-
const require_line *const reqs = reqs_arr ? (require_line *)reqs_arr->elts : NULL;
808-
if (!reqs_arr) {
809-
oidc_debug(r, "no require statements found, so declining to perform authorization.");
810-
return DECLINED;
811-
}
812-
813-
/* dispatch to the <2.4 specific authz routine */
814-
int rc = oidc_authz_22_worker(r, claims, reqs, reqs_arr->nelts);
815-
816-
/* cleanup */
817-
if (claims)
818-
json_decref(claims);
819-
820-
if ((rc == HTTP_UNAUTHORIZED) && ap_auth_type(r))
821-
rc = oidc_authz_22_unauthorized_user(r);
822-
823-
return rc;
824-
}
825-
826-
#endif

src/handle/handle.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,13 @@
6060
#endif
6161
typedef apr_byte_t (*oidc_authz_match_claim_fn_type)(request_rec *, const char *const, json_t *);
6262
apr_byte_t oidc_authz_match_claim(request_rec *r, const char *const attr_spec, json_t *claims);
63-
#if HAVE_APACHE_24
6463
#ifdef USE_LIBJQ
6564
authz_status oidc_authz_24_checker_claims_expr(request_rec *r, const char *require_args,
6665
const void *parsed_require_args);
6766
#endif
6867
authz_status oidc_authz_24_checker_claim(request_rec *r, const char *require_args, const void *parsed_require_args);
6968
authz_status oidc_authz_24_worker(request_rec *r, json_t *claims, const char *require_args,
7069
const void *parsed_require_args, oidc_authz_match_claim_fn_type match_claim_fn);
71-
#else
72-
int oidc_authz_22_checker(request_rec *r);
73-
#endif
7470

7571
// content.c
7672
int oidc_content_handler(request_rec *r);

src/mod_auth_openidc.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,8 +1769,6 @@ static int oidc_post_config(apr_pool_t *pool, apr_pool_t *p1, apr_pool_t *p2, se
17691769
return oidc_config_check_merged_vhost_configs(pool, s);
17701770
}
17711771

1772-
#if HAVE_APACHE_24
1773-
17741772
/*
17751773
* parse an Apache expression in the configured require value
17761774
*/
@@ -1799,8 +1797,6 @@ static const authz_provider oidc_authz_claims_expr_provider = {
17991797
};
18001798
#endif
18011799

1802-
#endif
1803-
18041800
/*
18051801
* initialize cache context in child process if required
18061802
*/
@@ -1923,19 +1919,13 @@ static void oidc_register_hooks(apr_pool_t *pool) {
19231919
ap_hook_handler(oidc_content_handler, NULL, proxySucc, APR_HOOK_FIRST);
19241920
ap_hook_insert_filter(oidc_filter_in_insert_filter, NULL, NULL, APR_HOOK_MIDDLE);
19251921
ap_register_input_filter(oidcFilterName, oidc_filter_in_filter, NULL, AP_FTYPE_RESOURCE);
1926-
#if HAVE_APACHE_24
19271922
ap_hook_check_authn(oidc_check_user_id, NULL, NULL, APR_HOOK_MIDDLE, AP_AUTH_INTERNAL_PER_CONF);
19281923
ap_register_auth_provider(pool, AUTHZ_PROVIDER_GROUP, OIDC_REQUIRE_CLAIM_NAME, "0", &oidc_authz_claim_provider,
19291924
AP_AUTH_INTERNAL_PER_CONF);
19301925
#ifdef USE_LIBJQ
19311926
ap_register_auth_provider(pool, AUTHZ_PROVIDER_GROUP, OIDC_REQUIRE_CLAIMS_EXPR_NAME, "0",
19321927
&oidc_authz_claims_expr_provider, AP_AUTH_INTERNAL_PER_CONF);
19331928
#endif
1934-
#else
1935-
static const char *const authzSucc[] = {"mod_authz_user.c", NULL};
1936-
ap_hook_check_user_id(oidc_check_user_id, NULL, NULL, APR_HOOK_MIDDLE);
1937-
ap_hook_auth_checker(oidc_authz_22_checker, NULL, authzSucc, APR_HOOK_MIDDLE);
1938-
#endif
19391929
}
19401930

19411931
// clang-format off

src/util/expr.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ char *oidc_util_apr_expr_parse(cmd_parms *cmd, const char *str, oidc_apr_expr_t
132132
return NULL;
133133
*expr = apr_pcalloc(cmd->pool, sizeof(oidc_apr_expr_t));
134134
(*expr)->str = apr_pstrdup(cmd->pool, str);
135-
#if HAVE_APACHE_24
136135
const char *expr_err = NULL;
137136
unsigned int flags = AP_EXPR_FLAG_DONT_VARY & AP_EXPR_FLAG_RESTRICTED;
138137
if (result_is_str)
@@ -142,7 +141,6 @@ char *oidc_util_apr_expr_parse(cmd_parms *cmd, const char *str, oidc_apr_expr_t
142141
rv = apr_pstrcat(cmd->temp_pool, "cannot parse expression: ", expr_err, NULL);
143142
*expr = NULL;
144143
}
145-
#endif
146144
return rv;
147145
}
148146

@@ -153,7 +151,6 @@ const char *oidc_util_apr_expr_exec(request_rec *r, const oidc_apr_expr_t *expr,
153151
const char *expr_result = NULL;
154152
if (expr == NULL)
155153
return NULL;
156-
#if HAVE_APACHE_24
157154
const char *expr_err = NULL;
158155
if (result_is_str) {
159156
expr_result = ap_expr_str_exec(r, expr->expr, &expr_err);
@@ -164,8 +161,5 @@ const char *oidc_util_apr_expr_exec(request_rec *r, const oidc_apr_expr_t *expr,
164161
oidc_error(r, "executing expression \"%s\" failed: %s", expr->str, expr_err);
165162
expr_result = NULL;
166163
}
167-
#else
168-
expr_result = expr->str;
169-
#endif
170164
return expr_result;
171165
}

0 commit comments

Comments
 (0)