summaryrefslogtreecommitdiffstats
path: root/server/util.c
diff options
context:
space:
mode:
authorAndré Malo <nd@apache.org>2003-03-07 00:53:52 +0100
committerAndré Malo <nd@apache.org>2003-03-07 00:53:52 +0100
commitc8185c253b6d4d0b3340e32072db54463231af7e (patch)
treee9b87479795a218a9bc9d8302eaab13d0b18a62b /server/util.c
parentmod_usertrack: don't set the cookie in subrequests. This works (diff)
downloadapache2-c8185c253b6d4d0b3340e32072db54463231af7e.tar.xz
apache2-c8185c253b6d4d0b3340e32072db54463231af7e.zip
Minor MMN bump:
Forward port: Escape special characters (especially control characters) in mod_log_config to make a clear distinction between client-supplied strings (with special characters) and server-side strings. This was already introduced in version 1.3.25. Obtained from: Patch in 1.3.25-dev by Martin git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98912 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--server/util.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/server/util.c b/server/util.c
index 246274edf5..3e6c55bc29 100644
--- a/server/util.c
+++ b/server/util.c
@@ -1784,6 +1784,58 @@ AP_DECLARE(char *) ap_escape_html(apr_pool_t *p, const char *s)
return x;
}
+AP_DECLARE(char *) ap_escape_logitem(apr_pool_t *p, const char *str)
+{
+ char *ret;
+ unsigned char *d;
+ const unsigned char *s;
+
+ if (!str) {
+ return NULL;
+ }
+
+ ret = apr_palloc(p, 4 * strlen(str) + 1); /* Be safe */
+ d = (unsigned char *)ret;
+ s = (const unsigned char *)str;
+ for (; *s; ++s) {
+
+ if (TEST_CHAR(*s, T_ESCAPE_LOGITEM)) {
+ *d++ = '\\';
+ switch(*s) {
+ case '\b':
+ *d++ = 'b';
+ break;
+ case '\n':
+ *d++ = 'n';
+ break;
+ case '\r':
+ *d++ = 'r';
+ break;
+ case '\t':
+ *d++ = 't';
+ break;
+ case '\v':
+ *d++ = 'v';
+ break;
+ case '\\':
+ case '"':
+ *d++ = *s;
+ break;
+ default:
+ c2x(*s, d);
+ *d = 'x';
+ d += 3;
+ }
+ }
+ else {
+ *d++ = *s;
+ }
+ }
+ *d = '\0';
+
+ return ret;
+}
+
AP_DECLARE(int) ap_is_directory(apr_pool_t *p, const char *path)
{
apr_finfo_t finfo;