Skip to content

Commit d1d6a65

Browse files
committed
release 2.4.16.10
complete case-insensitive protocol/hostname/domain-name comparisons Signed-off-by: Hans Zandbelt <[email protected]>
1 parent d4e282e commit d1d6a65

File tree

6 files changed

+22
-17
lines changed

6 files changed

+22
-17
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
03/21/2025
2+
- core: complete case-insensitive protocol/hostname/domain-name comparisons
3+
- release 2.4.16.10
4+
15
03/20/2025
26
- core: compare hostnames and domains in a case insensitive way in:
37
oidc_request_check_cookie_domain

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.16.10dev],[[email protected]])
1+
AC_INIT([mod_auth_openidc],[2.4.16.10],[[email protected]])
22

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

src/handle/request.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ apr_byte_t oidc_request_check_cookie_domain(request_rec *r, oidc_cfg_t *c, const
5757
_oidc_memset(&r_uri, 0, sizeof(apr_uri_t));
5858
apr_uri_parse(r->pool, original_url, &o_uri);
5959
apr_uri_parse(r->pool, oidc_util_redirect_uri(r, c), &r_uri);
60-
if ((_oidc_strnatcasecmp(o_uri.scheme, r_uri.scheme) != 0) && (_oidc_strcmp(r_uri.scheme, "https") == 0)) {
60+
if ((_oidc_strnatcasecmp(o_uri.scheme, r_uri.scheme) != 0) &&
61+
(_oidc_strnatcasecmp(r_uri.scheme, "https") == 0)) {
6162
oidc_error(r,
6263
"the URL scheme (%s) of the configured " OIDCRedirectURI
6364
" does not match the URL scheme of the URL being accessed (%s): the \"state\" and "
@@ -68,8 +69,8 @@ apr_byte_t oidc_request_check_cookie_domain(request_rec *r, oidc_cfg_t *c, const
6869

6970
if (oidc_cfg_cookie_domain_get(c) == NULL) {
7071
if (_oidc_strnatcasecmp(o_uri.hostname, r_uri.hostname) != 0) {
71-
char *p = _oidc_strstr(o_uri.hostname, r_uri.hostname);
72-
if ((p == NULL) || (_oidc_strcmp(r_uri.hostname, p) != 0)) {
72+
const char *p = oidc_util_strcasestr(o_uri.hostname, r_uri.hostname);
73+
if ((p == NULL) || (_oidc_strnatcasecmp(r_uri.hostname, p) != 0)) {
7374
oidc_error(r,
7475
"the URL hostname (%s) of the configured " OIDCRedirectURI
7576
" does not match the URL hostname of the URL being accessed (%s): the "

src/metrics.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@ apr_byte_t oidc_metrics_is_valid_classname(apr_pool_t *pool, const char *name, c
321321
*valid_names = apr_psprintf(pool, "%s%s%s", *valid_names ? *valid_names : "", *valid_names ? " | " : "",
322322
"claim.id_token.* | claim.userinfo.*");
323323

324-
return apr_table_get(names, name)
325-
? TRUE
326-
: ((strstr(name, "claim.id_token.") != NULL) || (strstr(name, "claim.userinfo.") != NULL));
324+
return apr_table_get(names, name) ? TRUE
325+
: ((_oidc_strstr(name, "claim.id_token.") != NULL) ||
326+
(_oidc_strstr(name, "claim.userinfo.") != NULL));
327327
}
328328

329329
/*
@@ -643,7 +643,7 @@ static void oidc_metrics_store(server_rec *s) {
643643
apr_hash_this(hi2, (const void **)&key, NULL, (void **)&counter_hash);
644644

645645
key = apr_pstrdup(s->process->pool, key);
646-
p = strstr(key, ".");
646+
p = _oidc_strstr(key, ".");
647647
if (p == NULL) {
648648
/* get or create the corresponding metric entry in the global metrics */
649649
j_counter = json_object_get(j_counters, key);

src/mod_auth_openidc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -899,19 +899,19 @@ apr_byte_t oidc_validate_redirect_url(request_rec *r, oidc_cfg_t *c, const char
899899
}
900900
}
901901

902-
if ((uri.hostname == NULL) && (oidc_util_strcasestr(url, "/") != url)) {
902+
if ((uri.hostname == NULL) && (_oidc_strstr(url, "/") != url)) {
903903
*err_str = apr_pstrdup(r->pool, "Malformed URL");
904904
*err_desc = apr_psprintf(
905905
r->pool, "No hostname was parsed and it does not seem to be relative, i.e starting with '/': %s",
906906
url);
907907
oidc_error(r, "%s: %s", *err_str, *err_desc);
908908
return FALSE;
909-
} else if ((uri.hostname == NULL) && (oidc_util_strcasestr(url, "//") == url)) {
909+
} else if ((uri.hostname == NULL) && (_oidc_strstr(url, "//") == url)) {
910910
*err_str = apr_pstrdup(r->pool, "Malformed URL");
911911
*err_desc = apr_psprintf(r->pool, "No hostname was parsed and starting with '//': %s", url);
912912
oidc_error(r, "%s: %s", *err_str, *err_desc);
913913
return FALSE;
914-
} else if ((uri.hostname == NULL) && (oidc_util_strcasestr(url, "/\\") == url)) {
914+
} else if ((uri.hostname == NULL) && (_oidc_strstr(url, "/\\") == url)) {
915915
*err_str = apr_pstrdup(r->pool, "Malformed URL");
916916
*err_desc = apr_psprintf(r->pool, "No hostname was parsed and starting with '/\\': %s", url);
917917
oidc_error(r, "%s: %s", *err_str, *err_desc);
@@ -1429,7 +1429,7 @@ static int oidc_check_config_openid_openidc(server_rec *s, oidc_cfg_t *c) {
14291429
} else {
14301430
apr_uri_parse(s->process->pconf, oidc_cfg_provider_metadata_url_get(oidc_cfg_provider_get(c)),
14311431
&r_uri);
1432-
if ((r_uri.scheme == NULL) || (_oidc_strcmp(r_uri.scheme, "https") != 0)) {
1432+
if ((r_uri.scheme == NULL) || (_oidc_strnatcasecmp(r_uri.scheme, "https") != 0)) {
14331433
oidc_swarn(s,
14341434
"the URL scheme (%s) of the configured " OIDCProviderMetadataURL
14351435
" SHOULD be \"https\" for security reasons!",
@@ -1448,7 +1448,7 @@ static int oidc_check_config_openid_openidc(server_rec *s, oidc_cfg_t *c) {
14481448

14491449
apr_uri_parse(s->process->pconf, oidc_cfg_redirect_uri_get(c), &r_uri);
14501450
if (!redirect_uri_is_relative) {
1451-
if (_oidc_strcmp(r_uri.scheme, "https") != 0) {
1451+
if (_oidc_strnatcasecmp(r_uri.scheme, "https") != 0) {
14521452
oidc_swarn(s,
14531453
"the URL scheme (%s) of the configured " OIDCRedirectURI
14541454
" SHOULD be \"https\" for security reasons (moreover: some Providers may reject "
@@ -1494,7 +1494,7 @@ static int oidc_check_config_oauth(server_rec *s, oidc_cfg_t *c) {
14941494

14951495
if (oidc_cfg_oauth_metadata_url_get(c) != NULL) {
14961496
apr_uri_parse(s->process->pconf, oidc_cfg_oauth_metadata_url_get(c), &r_uri);
1497-
if ((r_uri.scheme == NULL) || (_oidc_strcmp(r_uri.scheme, "https") != 0)) {
1497+
if ((r_uri.scheme == NULL) || (_oidc_strnatcasecmp(r_uri.scheme, "https") != 0)) {
14981498
oidc_swarn(s,
14991499
"the URL scheme (%s) of the configured " OIDCOAuthServerMetadataURL
15001500
" SHOULD be \"https\" for security reasons!",

src/util.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ static const char *oidc_util_current_url_scheme(const request_rec *r, oidc_hdr_x
662662
#endif
663663
}
664664
if ((scheme_str == NULL) ||
665-
((_oidc_strcmp(scheme_str, "http") != 0) && (_oidc_strcmp(scheme_str, "https") != 0))) {
665+
((_oidc_strnatcasecmp(scheme_str, "http") != 0) && (_oidc_strnatcasecmp(scheme_str, "https") != 0))) {
666666
oidc_warn(r,
667667
"detected HTTP scheme \"%s\" is not \"http\" nor \"https\"; perhaps your reverse proxy "
668668
"passes a wrongly configured \"%s\" header: falling back to default \"https\"",
@@ -752,9 +752,9 @@ static const char *oidc_get_current_url_port(const request_rec *r, const char *s
752752
* determine the port locally and don't print it when it's the default for the protocol
753753
*/
754754
const apr_port_t port = r->connection->local_addr->port;
755-
if ((_oidc_strcmp(scheme_str, "https") == 0) && port == 443)
755+
if ((_oidc_strnatcasecmp(scheme_str, "https") == 0) && port == 443)
756756
return NULL;
757-
else if ((_oidc_strcmp(scheme_str, "http") == 0) && port == 80)
757+
else if ((_oidc_strnatcasecmp(scheme_str, "http") == 0) && port == 80)
758758
return NULL;
759759

760760
port_str = apr_psprintf(r->pool, "%u", port);

0 commit comments

Comments
 (0)