Commit a65ad08e authored by ale's avatar ale

Add a slash on the login redirect URL only when necessary

parent 210f1644
......@@ -490,6 +490,14 @@ static int mod_sso_method_handler(request_rec *r) {
return DECLINED;
}
static int ends_with_slash(const char *s) {
int l = strlen(s);
if (l < 1) {
return 0;
}
return s[l-1] == '/';
}
static int redirect_to_login_server(request_rec *r, modsso_config *s_cfg,
const char *service_host,
const char *service, const char **groups,
......@@ -499,7 +507,8 @@ static int redirect_to_login_server(request_rec *r, modsso_config *s_cfg,
dest = full_uri(r, service_host);
login_url = apr_pstrcat(r->pool, "https://", s_cfg->login_server,
"/?s=", modsso_url_encode(r->pool, service),
ends_with_slash(s_cfg->login_server) ? "" : "/",
"?s=", modsso_url_encode(r->pool, service),
"&d=", modsso_url_encode(r->pool, dest), NULL);
if (s_cfg->session_key != NULL) {
// If we have a session key, send a nonce to the login server. We
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment