diff options
author | Eric Covener <covener@apache.org> | 2021-10-21 18:54:46 +0000 |
---|---|---|
committer | Eric Covener <covener@apache.org> | 2021-10-21 18:54:46 +0000 |
commit | b125eddc6892786fbd87fccdad3cc8c059a1d925 (patch) | |
tree | 780452870ce4c28674ab58d70bb9c4db13dcce40 /modules/mappers/mod_dir.c | |
parent | 9c14928e7961060376cefbdd2274ab3c3facecd0 (diff) | |
download | httpd-b125eddc6892786fbd87fccdad3cc8c059a1d925.tar.gz |
add DirectorySlashNotFound to silence scanners
Almost as awkwardly named as IndexForbiddenReturn404
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894456 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/mappers/mod_dir.c')
-rw-r--r-- | modules/mappers/mod_dir.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/mappers/mod_dir.c b/modules/mappers/mod_dir.c index 3aebd9c0b4..0bb6a274bb 100644 --- a/modules/mappers/mod_dir.c +++ b/modules/mappers/mod_dir.c @@ -48,6 +48,7 @@ typedef struct dir_config_struct { moddir_cfg checkhandler; int redirect_index; const char *dflt; + moddir_cfg do_slash_notfound; } dir_config_rec; #define DIR_CMD_PERMS OR_INDEXES @@ -88,6 +89,13 @@ static const char *configure_slash(cmd_parms *cmd, void *d_, int arg) d->do_slash = arg ? MODDIR_ON : MODDIR_OFF; return NULL; } +static const char *configure_slash_notfound(cmd_parms *cmd, void *d_, int arg) +{ + dir_config_rec *d = d_; + + d->do_slash_notfound = arg ? MODDIR_ON : MODDIR_OFF; + return NULL; +} static const char *configure_checkhandler(cmd_parms *cmd, void *d_, int arg) { dir_config_rec *d = d_; @@ -132,6 +140,8 @@ static const command_rec dir_cmds[] = "a list of file names"), AP_INIT_FLAG("DirectorySlash", configure_slash, NULL, DIR_CMD_PERMS, "On or Off"), + AP_INIT_FLAG("DirectorySlashNotFound", configure_slash_notfound, NULL, DIR_CMD_PERMS, + "On or Off"), AP_INIT_FLAG("DirectoryCheckHandler", configure_checkhandler, NULL, DIR_CMD_PERMS, "On or Off"), AP_INIT_TAKE1("DirectoryIndexRedirect", configure_redirect, @@ -146,6 +156,7 @@ static void *create_dir_config(apr_pool_t *p, char *dummy) new->index_names = NULL; new->do_slash = MODDIR_UNSET; + new->do_slash_notfound = MODDIR_UNSET; new->checkhandler = MODDIR_UNSET; new->redirect_index = REDIRECT_UNSET; return (void *) new; @@ -160,6 +171,8 @@ static void *merge_dir_configs(apr_pool_t *p, void *basev, void *addv) new->index_names = add->index_names ? add->index_names : base->index_names; new->do_slash = (add->do_slash == MODDIR_UNSET) ? base->do_slash : add->do_slash; + new->do_slash_notfound = + (add->do_slash_notfound == MODDIR_UNSET) ? base->do_slash_notfound : add->do_slash_notfound; new->checkhandler = (add->checkhandler == MODDIR_UNSET) ? base->checkhandler : add->checkhandler; new->redirect_index= @@ -251,6 +264,10 @@ static int fixup_dir(request_rec *r) return DECLINED; } + if (d->do_slash_notfound == MODDIR_ON) { + return HTTP_NOT_FOUND; + } + /* Only redirect non-get requests if we have no note to warn * that this browser cannot handle redirs on non-GET requests * (such as Microsoft's WebFolders). |