diff options
author | Ben Laurie <ben@apache.org> | 2004-01-03 16:33:41 +0100 |
---|---|---|
committer | Ben Laurie <ben@apache.org> | 2004-01-03 16:33:41 +0100 |
commit | b2d154535bf3b576fcdeab9ca14474b40e8f01fb (patch) | |
tree | 26c76484a742864d4ada7417d973eecb340e3b37 /server/gen_test_char.c | |
parent | Use ap_assert(). (diff) | |
download | apache2-b2d154535bf3b576fcdeab9ca14474b40e8f01fb.tar.xz apache2-b2d154535bf3b576fcdeab9ca14474b40e8f01fb.zip |
Make forensic logging EBCDIC-safe.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102153 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/gen_test_char.c')
-rw-r--r-- | server/gen_test_char.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/server/gen_test_char.c b/server/gen_test_char.c index 83d7b4bc02..d37ba6d9b6 100644 --- a/server/gen_test_char.c +++ b/server/gen_test_char.c @@ -74,6 +74,7 @@ #define T_OS_ESCAPE_PATH (0x04) #define T_HTTP_TOKEN_STOP (0x08) #define T_ESCAPE_LOGITEM (0x10) +#define T_ESCAPE_FORENSIC (0x20) int main(int argc, char *argv[]) { @@ -87,6 +88,7 @@ int main(int argc, char *argv[]) "#define T_OS_ESCAPE_PATH (%u)\n" "#define T_HTTP_TOKEN_STOP (%u)\n" "#define T_ESCAPE_LOGITEM (%u)\n" + "#define T_ESCAPE_FORENSIC (%u)\n" "\n" "static const unsigned char test_char_table[256] = {\n" " 0,", @@ -94,7 +96,8 @@ int main(int argc, char *argv[]) T_ESCAPE_PATH_SEGMENT, T_OS_ESCAPE_PATH, T_HTTP_TOKEN_STOP, - T_ESCAPE_LOGITEM); + T_ESCAPE_LOGITEM, + T_ESCAPE_FORENSIC); /* we explicitly dealt with NUL above * in case some strchr() do bogosity with it */ @@ -147,6 +150,14 @@ int main(int argc, char *argv[]) flags |= T_ESCAPE_LOGITEM; } + /* For forensic logging, scape all control characters, top bit set, + * :, | (used as delimiters) and % (used for escaping). + */ + if (!apr_isprint(c) || c == ':' || c == '|' || c == '%' + || apr_iscntrl(c)) { + flags |= T_ESCAPE_FORENSIC; + } + printf("%u%c", flags, (c < 255) ? ',' : ' '); } |