]> granicus.if.org Git - apache/commitdiff
core: use strncmp in check_errorlog_dir and core_dump_config when checking
authorYann Ylavic <ylavic@apache.org>
Tue, 29 May 2018 21:24:11 +0000 (21:24 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 29 May 2018 21:24:11 +0000 (21:24 +0000)
if the ErrorLog directive is configured with the 'syslog' prefix. PR 62102

trunk patch: none, as far as I can see the code in trunk diverged too much
          due to the code in STALLED for ap_errorlog_provider.

Submitted by: elukey, jhriggs, jailletc36
Reviewed by: elukey, jhriggs, ylavic

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1832493 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
server/core.c
server/log.c

diff --git a/CHANGES b/CHANGES
index d778cdd83128ba15ad6c2e21a9ed7e8ce08e76df..988932b448eba0d2f7568a04d2631130be151cbf 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.34
 
+  *) core, log: improve sanity checks for the ErrorLog's syslog config, and
+     explicitly allow ony lowercase 'syslog' settings. PR 62102
+     [Luca Toscano, Jim Riggs, Christophe Jaillet]
+
   *) mod_http2: accurate reporting of h2 data input/output per request via mod_logio. Fixes
      an issue where output sizes where counted n-times on reused slave connections. See
      gituhub issue: https://github.com/icing/mod_h2/issues/158
index 4af08166f617253b2a6913ca7f0293c77daff90a..5e9d6501bd423f079379ee792c972f7ae4f8d202 100644 (file)
@@ -4867,7 +4867,8 @@ AP_DECLARE(int) ap_sys_privileges_handlers(int inc)
 static int check_errorlog_dir(apr_pool_t *p, server_rec *s)
 {
     if (!s->error_fname || s->error_fname[0] == '|'
-        || strcmp(s->error_fname, "syslog") == 0) {
+        || strcmp(s->error_fname, "syslog") == 0
+        || strncmp(s->error_fname, "syslog:", 7) == 0) {
         return APR_SUCCESS;
     }
     else {
@@ -5281,7 +5282,9 @@ static void core_dump_config(apr_pool_t *p, server_rec *s)
     apr_file_printf(out, "ServerRoot: \"%s\"\n", ap_server_root);
     tmp = ap_server_root_relative(p, sconf->ap_document_root);
     apr_file_printf(out, "Main DocumentRoot: \"%s\"\n", tmp);
-    if (s->error_fname[0] != '|' && strcmp(s->error_fname, "syslog") != 0)
+    if (s->error_fname[0] != '|'
+        && strcmp(s->error_fname, "syslog") != 0
+        && strncmp(s->error_fname, "syslog:", 7) != 0)
         tmp = ap_server_root_relative(p, s->error_fname);
     else
         tmp = s->error_fname;
index 22567a43af0b76cbb987e30553dee6ad64d49d4c..bf623eaf7c06b3709fc05235e8dda7bbf0ca15fd 100644 (file)
@@ -396,7 +396,8 @@ static int open_error_log(server_rec *s, int is_main, apr_pool_t *p)
     }
 
 #ifdef HAVE_SYSLOG
-    else if (!strncasecmp(s->error_fname, "syslog", 6)) {
+    else if (strcmp(s->error_fname, "syslog") == 0
+             || strncmp(s->error_fname, "syslog:", 7) == 0) {
         if ((fname = strchr(s->error_fname, ':'))) {
             /* s->error_fname could be [level]:[tag] (see #60525) */
             const char *tag;