Skip to content

Commit d883c95

Browse files
committed
fix usage of OIDCPreservePostTemplates, regression in 2.4.17; see #1325
thanks @perry19987 Signed-off-by: Hans Zandbelt <[email protected]>
1 parent 6c62125 commit d883c95

3 files changed

Lines changed: 16 additions & 9 deletions

File tree

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
05/27/2025
2+
- fix usage of OIDCPreservePostTemplates, regression in 2.4.17; see #1325; thanks @perry19987
3+
14
05/22/2025
25
- metrics: avoid possible segfault after restart twice; thanks @atzm
36

src/handle/response.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,12 @@ apr_byte_t oidc_response_post_preserve_javascript(request_rec *r, const char *lo
143143
}
144144
json = apr_psprintf(r->pool, "{ %s }", json);
145145

146-
if (oidc_cfg_post_preserve_template_get(cfg) != NULL)
146+
if (oidc_cfg_post_preserve_template_get(cfg) != NULL) {
147147
if (oidc_util_html_send_in_template(
148148
r, oidc_cfg_post_preserve_template_get(cfg), &_oidc_response_post_preserve_template_contents,
149149
json, OIDC_POST_PRESERVE_ESCAPE_NONE, location, OIDC_POST_PRESERVE_ESCAPE_JAVASCRIPT) == OK)
150150
return TRUE;
151+
}
151152

152153
const char *jmethod = "preserveOnLoad";
153154
const char *jscript = apr_psprintf(
@@ -677,11 +678,9 @@ static int oidc_response_process(request_rec *r, oidc_cfg_t *c, oidc_session_t *
677678
/* check whether form post data was preserved; if so restore it */
678679
if (_oidc_strcmp(original_method, OIDC_METHOD_FORM_POST) == 0) {
679680
if (oidc_cfg_post_restore_template_get(c) != NULL)
680-
if (oidc_util_html_send_in_template(r, oidc_cfg_post_restore_template_get(c),
681-
&_oidc_response_post_restore_template_contents,
682-
original_url, OIDC_POST_PRESERVE_ESCAPE_JAVASCRIPT, "",
683-
OIDC_POST_PRESERVE_ESCAPE_NONE) == OK)
684-
return TRUE;
681+
return oidc_util_html_send_in_template(
682+
r, oidc_cfg_post_restore_template_get(c), &_oidc_response_post_restore_template_contents,
683+
original_url, OIDC_POST_PRESERVE_ESCAPE_JAVASCRIPT, "", OIDC_POST_PRESERVE_ESCAPE_NONE);
685684
return oidc_response_post_preserved_restore(r, original_url);
686685
}
687686

src/proto/request.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,9 +717,14 @@ int oidc_proto_request_auth(request_rec *r, struct oidc_provider_t *provider, co
717717

718718
} else {
719719

720-
/* signal this to the content handler */
721-
rv = oidc_util_html_content_prep(r, OIDC_REQUEST_STATE_KEY_AUTHN_PRESERVE, "Preserving...",
722-
javascript, "preserveOnLoad", "<p>Preserving...</p>");
720+
// NB: if a template is in use, we should not override
721+
// OIDC_REQUEST_STATE_KEY_HTTP with OIDC_REQUEST_STATE_KEY_AUTHN_PRESERVE
722+
if (oidc_request_state_get(r, OIDC_REQUEST_STATE_KEY_HTTP) == NULL) {
723+
/* signal this to the content handler */
724+
rv = oidc_util_html_content_prep(r, OIDC_REQUEST_STATE_KEY_AUTHN_PRESERVE,
725+
"Preserving...", javascript, "preserveOnLoad",
726+
"<p>Preserving...</p>");
727+
}
723728
}
724729

725730
} else {

0 commit comments

Comments
 (0)