You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Martin Kraemer <Ma...@mch.sni.de> on 1997/11/07 17:39:19 UTC

[PATCH] More checks for command context in http_core

Hi,
I've added a new command context checking function to make context checks in
configuration file parsing more uniform. Before you give a +1 please re-check
if the individual tests for command context are correct.

The common check routine
    check_cmd_context(cmd, NOT_IN_VIRTUALHOST | NOT_IN_DIR_LOC_FILE | NOT_IN_LIMIT);
checks the command context against the (contextually supplied) constraints.
If the command is invoked in an invalid context, then an appropriate error
string is returned.

So, e.g.,

+    const char *err = check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT);
+    if (err != NULL) return err;

will replace the older tests
 
-    if (cmd->path) return "<Directory> sections don't nest";
-    if (cmd->limited != -1) return "Can't have <Directory> within <Limit>";

NB: I also made the missing_endsection() routine simpler: it now gets the
cmd-> pointer and therefore _knows_ about the current command name.

NB2: Many context errors weren't caught before. The ServerPath directive
for instance should not be allowed in <Location> or <Files> context,
right?

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request