
                        Debian bug report logs - #11834
           apache: /etc/cron.d/apache conf file parsing too fragile
                                       
   Package: [1]apache; Reported by: <roderick@ibcinc.com>; dated Mon, 4
   Aug 1997 17:33:01 GMT; Maintainer for apache is [2]Johnie Ingram
   <johnie@debian.org>.
     _________________________________________________________________
   
Message received at submit@bugs.debian.org:

Received: (at submit) by bugs.debian.org; 4 Aug 1997 17:18:26 +0000
Received: (qmail 2043 invoked from network); 4 Aug 1997 17:18:25 -0000
Received: from cartridge.i-connect.net (qmailr@206.190.143.12)
  by master.debian.org with SMTP; 4 Aug 1997 17:18:25 -0000
Received: (qmail 23747 invoked from network); 4 Aug 1997 14:31:51 -0000
Received: from junior.ibcinc.com (198.22.130.8)
  by cartridge.i-connect.net with SMTP; 4 Aug 1997 14:31:51 -0000
Received: from janus.ibcinc.com (janus.ibcinc.com [38.233.80.130])
        by junior.ibcinc.com (8.8.5/8.8.5/1.6/jr-1.6-l) with ESMTP id KAA28929;
        Mon, 4 Aug 1997 10:29:10 -0400 (EDT)
Received: by janus.ibcinc.com
        id m0wvO93-00000xC
        (Debian Smail-3.2 1996-Jul-4 #2); Mon, 4 Aug 1997 10:30:01 -0400 (EDT)
Message-Id: <m0wvO93-00000xC@janus.ibcinc.com>
Date: Mon, 4 Aug 1997 10:30:01 -0400 (EDT)
From: <roderick@ibcinc.com>
Subject: apache: /etc/cron.d/apache conf file parsing too fragile
To: submit@bugs.debian.org
X-Mailer: bug 2.95

Package: apache
Version: 1.1.3-6

/etc/cron.d/apache's parsing of the apache configuration files is too
fragile, it breaks if you use tabs rather than spaces to separate fields
and it doesn't handle setting the user and group in a file other than
httpd.conf.  Here's a patch.

--- apache.orig Mon Apr  7 14:45:09 1997
+++ apache      Mon Aug  4 10:26:25 1997
@@ -10,8 +10,7 @@
 umask 022

 # This looks for lines in the conf files like: FooLog /some/where
-LOGS=$(egrep -h "^[[:space:]]*[A-Za-z]*Log /" /etc/apache/*.conf \
-    | sed s/^\ *//g | cut -f 2 -d " ")
+LOGS=$(awk '$1 ~ /^[A-Za-z]*Log$/ && $2 ~ /^\// {print $2}' /etc/apache/*.conf
)

 if [ "$LOGS" = "" ]
 then
@@ -19,13 +18,13 @@
     [ -d /var/log/apache ] || exit 0
 fi

-USR=$(egrep -h "^User [a-z]" /etc/apache/httpd.conf | cut -f 2 -d " ")
+USR=$(awk '$1 == "User" { print $2; exit }' /etc/apache/*.conf)
 if [ "$USR" = "" ]
 then
     USR="root"
 fi

-GRP=$(egrep -h "^Group [a-z]" /etc/apache/httpd.conf | cut -f 2 -d " ")
+GRP=$(awk '$1 == "Group" { print $2; exit }' /etc/apache/*.conf)
 if [ "$GRP" = "" ]
 then
     GRP="www-data"

-- System Information
Debian Release: 1.3
Kernel Version: Linux janus 2.0.30 #1 Sun Aug 3 21:48:07 EDT 1997 i586 unknown

Versions of the packages apache depends on:
ldso    Version: 1.8.10-2
libc5   Version: 5.4.33-3
mime-support    Version: 2.12-1
perl    Version: 5.003.07-10
     _________________________________________________________________
   
   Acknowledgement sent to <roderick@ibcinc.com>:
   New bug report received and forwarded. Copy sent to Johnie Ingram
   <johnie@debian.org>. [3]Full text available.
     _________________________________________________________________
   
   Report forwarded to debian-bugs-dist@lists.debian.org, Johnie Ingram
   <johnie@debian.org>:
   Bug#11834; Package apache. [4]Full text available.
     _________________________________________________________________
   
   
    [5]Ian Jackson / [6]owner@bugs.debian.org, through the [7]Debian bug
    tracking mechanism
    
   Last modified: 13:39:03 GMT Wed 12 Nov ([8]timestamp page available).

References

   1. file://localhost/u1/johnie/www/bugs/pa/lapache.html
   2. file://localhost/u1/johnie/www/bugs/ma/lJohnie_Ingram,johnie,debian.org,.html
   3. file://localhost/u1/johnie/www/bugs/11/11834-b.html#m2
   4. file://localhost/u1/johnie/www/bugs/11/11834-b.html#m1
   5. http://www.cl.cam.ac.uk/users/iwj10/
   6. mailto:owner@bugs.debian.org
   7. file://localhost/u1/johnie/www/
   8. file://localhost/u1/johnie/www/bugs/ix/zstamp.html
