Bug#344553: [Logcheck-devel] Bug#344553: logcheck: Fails silently to read config file

Todd Troxell ttroxell at debian.org
Mon Jan 2 09:44:37 UTC 2006


On Sun, Jan 01, 2006 at 08:15:16PM +0200, Markus Peuhkuri wrote:
> Todd Troxell wrote:
> > I see your point.  The config is not really essential.
> > 
> > What do you think about this:
> > 
> > if [ -f $CONFFILE -a -r $CONFFILE]; then
> 
> The problem is still that if CONFFILE is somehow mistyped, it still
> fails silently even if the fragment fixes the error I had with
> permissions.  For my view the correct operation would be following:
> 
> 1) if CONFFILE (from command line) is set, use it.  If it does not
> exists or is unreadable, issue an error
> 
> 2) if CONFFILE is not set, but the default CONFFILE exists AND is
> readable use it
> 
> 3) if default CONFFILE exists, but is unreadable, provide an error
> 
> 4) if default CONFFILE does not exists, use defauls

This sounds right to me.  I've patched CVS similar to the below.
Thanks again.

> To have 1), command line argument processing should be modified as below
> 
>     case "$opt" in
>         c)
>             debug "Setting CONFFILE to $OPTARG"
>             CONFFILE="$OPTARG"
> 	    if [ ! -r $CONFFILE ]; then	
> 		  error "Config file $CONFFILE unreadable or does not exists"
> 	    fi
>           ;;
> 
> For 2) and 4), the existing condition is ok, but needs additional
> condition for 3).
> 
> if [ -r $CONFFILE ]; then
>   . $CONFFILE
> elif [ -f $CONFFILE ]; then  # this provides 3)
>   error "Config file $CONFFILE unreadable"
> fi
> 

-- 
Todd Troxell
http://rapidpacket.com/~xtat





More information about the Logcheck-devel mailing list