From de3eecf2fe064639000b122cda381d894fa6d59e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Fri, 13 Sep 2024 12:38:06 +0200 Subject: [PATCH 1/2] Simplify Context/Alias checking for CONFIG command --- native/mod_manager/mod_manager.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/native/mod_manager/mod_manager.c b/native/mod_manager/mod_manager.c index 94fb65e7..c23dfd66 100644 --- a/native/mod_manager/mod_manager.c +++ b/native/mod_manager/mod_manager.c @@ -1247,7 +1247,7 @@ static char *process_context_alias(char *key, char *val, apr_pool_t *p, struct c if (strcasecmp(key, "Alias") == 0) { char *tmp; - if (phost->host && ((!phost->context && in_config) || !in_config)) { + if (phost->host && !in_config) { *errtype = TYPESYNTAX; return in_config ? SALIBAD : SMULALB; } @@ -1272,9 +1272,9 @@ static char *process_context_alias(char *key, char *val, apr_pool_t *p, struct c } if (strcasecmp(key, "Context") == 0) { - if (phost->context) { + if (phost->context && !in_config) { *errtype = TYPESYNTAX; - return in_config ? SCONBAD : SMULCTB; + return SMULCTB; } if (check_context_alias_length(val, CONTEXTSZ)) { *errtype = TYPESYNTAX; From 4c442d1c2fc44feb0e3d7516d21bbc1255f9e2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Fri, 13 Sep 2024 12:39:31 +0200 Subject: [PATCH 2/2] Fix unused parameters compile warnings --- native/mod_manager/mod_manager.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/native/mod_manager/mod_manager.c b/native/mod_manager/mod_manager.c index c23dfd66..c4d67180 100644 --- a/native/mod_manager/mod_manager.c +++ b/native/mod_manager/mod_manager.c @@ -742,6 +742,7 @@ static char **process_buff(request_rec *r, char *buff) static apr_status_t insert_update_host_helper(server_rec *s, mem_t *mem, hostinfo_t *info, char *alias) { + (void)s; strncpy(info->host, alias, HOSTALIASZ); info->host[HOSTALIASZ] = '\0'; return insert_update_host(mem, info); @@ -797,6 +798,7 @@ static void read_remove_context(mem_t *mem, contextinfo_t *context) static apr_status_t insert_update_context_helper(server_rec *s, mem_t *mem, contextinfo_t *info, char *context, int status) { + (void)s; info->id = 0; strncpy(info->context, context, CONTEXTSZ); info->context[CONTEXTSZ] = '\0';