Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions src/civetweb.c
Original file line number Diff line number Diff line change
Expand Up @@ -15189,19 +15189,6 @@ get_rel_url_at_current_server(const char *uri, const struct mg_connection *conn)
auth_domain_check_enabled =
!mg_strcasecmp(conn->ctx->config[ENABLE_AUTH_DOMAIN_CHECK], "yes");

if (!auth_domain_check_enabled) {
return 0;
}

server_domain = conn->ctx->config[AUTHENTICATION_DOMAIN];
if (!server_domain) {
return 0;
}
server_domain_len = strlen(server_domain);
if (!server_domain_len) {
return 0;
}

/* DNS is case insensitive, so use case insensitive string compare here
*/
for (i = 0; abs_uri_protocols[i].proto != NULL; i++) {
Expand Down Expand Up @@ -15262,17 +15249,19 @@ get_rel_url_at_current_server(const char *uri, const struct mg_connection *conn)
* or http://mydomain.com.fake/path/file.ext).
*/
if (auth_domain_check_enabled) {
server_domain = conn->ctx->config[AUTHENTICATION_DOMAIN];
server_domain_len = strlen(server_domain);
if ((server_domain_len == 0) || (hostbegin == NULL)) {
return 0;
}
if ((request_domain_len == server_domain_len)
&& (!memcmp(server_domain, hostbegin, server_domain_len))) {
/* Request is directed to this server - full name match. */
} else {
if (request_domain_len < (server_domain_len + 2)) {
/* Request is directed to another server: The server name is
* longer
* than
* the request name. Drop this case here to avoid overflows
* in
* the
/* Request is directed to another server: The server name
* is longer than the request name.
* Drop this case here to avoid overflows in the
* following checks. */
return 0;
}
Expand Down