[prev in list] [next in list] [prev in thread] [next in thread] 

List:       chkrootkit-users
Subject:    [crt-users] qoutes around 'test' strings
From:       Stephen Samuel <samuel () bcgreen ! com>
Date:       2004-04-08 5:45:06
Message-ID: 4074E6E2.50506 () bcgreen ! com
[Download RAW message or body]

I ran chkrootkit today, and I got the following error message:
./chkrootkit: line 725: [: /var/www/cgi-bin: binary operator expected
(appeared a couple of dozen times).

Looking into chkrootkit, I found bare strings in 'test'
         [ -f ${CGIDIR}/$i ] && files="${files} ${CGIDIR}/$i"


so I quoted it.. I then went thru the script and quoted
just about every other similarly questionable filename
test that I could find.

In the process I found the line:
    if [ `find ${LIBS} -name libproc.a 2> /dev/null` ]

now, what appears to be going on here is that, if the 'find' script
finds a libproc.a file, it will complain... HOWEVER: if libproc.a
is in a directory with a  space in the name (or there is a second one),
then the test will choke. -- so I quoted this line too.
    if [ "`find ${LIBS} -name libproc.a 2> /dev/null`" ]

(a null string evaluates as false in test.

Diff attached (simple diff because it's easier to check)


-- 
Stephen Samuel +1(604)876-0426                samuel@bcgreen.com
		   http://www.bcgreen.com/~samuel/
    Powerful committed communication. Transformation touching
      the jewel within each person and bringing it to light.

["chkrootkit.diff" (text/plain)]

===================================================================
RCS file: RCS/chkrootkit,v
retrieving revision 1.1
diff -r1.1 chkrootkit
51c51
<       if [ -f ${i} ]; then
---
>       if [ -f "${i}" ]; then
78c78
<       if [ -f ${i} ]; then
---
>       if [ -f "${i}" ]; then
100c100
<       if [ -f ${i} ]; then
---
>       if [ -f "${i}" ]; then
175c175
<     if [ ! -f $WTMP -a ! -f $LASTLOG ]; then
---
>     if [ ! -f "$WTMP" -a ! -f "$LASTLOG" ]; then
205c205
< 	  if [ -f ${ROOTDIR}var/adm/wtmp ]; then 
---
> 	  if [ -f "${ROOTDIR}var/adm/wtmp" ]; then 
324,326c324,326
<         [ -d ${ROOTDIR}usr/lib/.fx ] && expertmode_output ${find} ${ROOTDIR}usr/lib/.fx
<         [ -d ${ROOTDIR}var/local/.lpd ] && expertmode_output ${find} ${ROOTDIR}var/local/.lpd
<         [ -d ${ROOTDIR}dev/rd/cdb ] && expertmode_output ${find} ${ROOTDIR}dev/rd/cdb
---
>         [ -d "${ROOTDIR}usr/lib/.fx" ] && expertmode_output ${find} ${ROOTDIR}usr/lib/.fx
>         [ -d "${ROOTDIR}var/local/.lpd" ] && expertmode_output ${find} ${ROOTDIR}var/local/.lpd
>         [ -d "${ROOTDIR}dev/rd/cdb" ] && expertmode_output ${find} ${ROOTDIR}dev/rd/cdb
342c342
<         [ -d ${ROOTDIR}usr/local/lib ] && \
---
>         [ -d "${ROOTDIR}usr/local/lib" ] && \
377c377
< 	[ -f ${CGIDIR}/$i ] && echo ${CGIDIR}/$i
---
> 	[ -f "${CGIDIR}/$i" ] && echo ${CGIDIR}/$i
525c525
<       if [ -d ${ROOTDIR}${i} ]; then
---
>       if [ -d "${ROOTDIR}${i}" ]; then
534c534
<       if [ -f ${ROOTDIR}${i} ]; then
---
>       if [ -f "${ROOTDIR}${i}" ]; then
558c558
<    if [ -d ${ROOTDIR}var/lib/games/.k ]
---
>    if [ -d "${ROOTDIR}var/lib/games/.k" ]
568,570c568,570
<    if [ -f ${ROOTDIR}etc/ttyhash -o -f ${ROOTDIR}sbin/xlogin -o \
<         -d ${ROOTDIR}usr/src/.puta  -o -r ${ROOTDIR}lib/ldlib.tk -o \
<         -d ${ROOTDIR}usr/info/.t0rn ]
---
>    if [ -f "${ROOTDIR}etc/ttyhash" -o -f "${ROOTDIR}sbin/xlogin" -o \
>         -d "${ROOTDIR}usr/src/.puta"  -o -r "${ROOTDIR}lib/ldlib.tk" -o \
>         -d "${ROOTDIR}usr/info/.t0rn" ]
580c580
<    [ -d ${ROOTDIR}lib ] && LIBS=${ROOTDIR}lib
---
>    [ -d "${ROOTDIR}lib" ] && LIBS=${ROOTDIR}lib
583c583
<    if [ `find ${LIBS} -name libproc.a 2> /dev/null` ]
---
>    if [ "`find ${LIBS} -name libproc.a 2> /dev/null`" ]
593,594c593,594
<    if [ -d ${ROOTDIR}usr/info/.torn -o -d ${ROOTDIR}dev/.lib -o \
<         -f ${ROOTDIR}bin/in.telnetd -o -f ${ROOTDIR}bin/mjy ]
---
>    if [ -d "${ROOTDIR}usr/info/.torn" -o -d "${ROOTDIR}dev/.lib" -o \
>         -f "${ROOTDIR}bin/in.telnetd" -o -f "${ROOTDIR}bin/mjy" ]
671c671
<       elif [ -d ${ROOTDIR}dev/.kork -o -f ${ROOTDIR}bin/.ps -o  \
---
>       elif [ -d "${ROOTDIR}dev/.kork" -o -f "${ROOTDIR}bin/.ps" -o  \
682,683c682,683
<    if [ -d ${ROOTDIR}usr/src/.poop -o -f \
<         ${ROOTDIR}tmp/ramen.tgz -o -f ${ROOTDIR}etc/xinetd.d/asp ]
---
>    if [ -d "${ROOTDIR}usr/src/.poop" -o -f \
>         "${ROOTDIR}tmp/ramen.tgz" -o -f "${ROOTDIR}etc/xinetd.d/asp" ]
725c725
< 	[ -f ${CGIDIR}/$i ] && files="${files} ${CGIDIR}/$i"
---
> 	[ -f "${CGIDIR}/$i" ] && files="${files} ${CGIDIR}/$i"
800,805c800,805
<    if [ -d ${ROOTDIR}usr/lib/.egcs ] || [ -f ${ROOTDIR}usr/lib/libfl.so ] || \
<       [ -d ${ROOTDIR}usr/lib/.kinetic ] || [ -d ${ROOTDIR}usr/lib/.wormie ] || \
<       [ -f ${ROOTDIR}usr/lib/liblog.o ] || [ -f ${ROOTDIR}usr/include/addr.h ] || \
<       [ -f ${ROOTDIR}usr/include/cron.h ] || [ -f ${ROOTDIR}usr/include/file.h ] || \
<       [ -f ${ROOTDIR}usr/include/proc.h ] || [ -f ${ROOTDIR}usr/include/syslogs.h ] || \
<       [ -f ${ROOTDIR}usr/include/chk.h ]; then
---
>    if [ -d "${ROOTDIR}usr/lib/.egcs" ] || [ -f "${ROOTDIR}usr/lib/libfl.so" ] || \
>       [ -d "${ROOTDIR}usr/lib/.kinetic" ] || [ -d "${ROOTDIR}usr/lib/.wormie" ] || \
>       [ -f "${ROOTDIR}usr/lib/liblog.o" ] || [ -f "${ROOTDIR}usr/include/addr.h" ] || \
>       [ -f "${ROOTDIR}usr/include/cron.h" ] || [ -f "${ROOTDIR}usr/include/file.h" ] || \
>       [ -f "${ROOTDIR}usr/include/proc.h" ] || [ -f "${ROOTDIR}usr/include/syslogs.h" ] || \
>       [ -f "${ROOTDIR}usr/include/chk.h" ]; then
870c870
<       if [ -f ${ROOTDIR}usr/include/${i} ]; then
---
>       if [ -f "${ROOTDIR}usr/include/${i}" ]; then
881c881
<    if [ -f ${ROOTDIR}etc/rc.d/init.d/network ]; then
---
>    if [ -f "${ROOTDIR}etc/rc.d/init.d/network" ]; then
891c891
<    if [ -f ${ROOTDIR}sbin/init ]; then
---
>    if [ -f "${ROOTDIR}sbin/init" ]; then
904c904
<    if [ -f ${ROOTDIR}usr/bin/volc -o -f ${ROOTDIR}usr/lib/volc ] ; then
---
>    if [ -f "${ROOTDIR}usr/bin/volc" -o -f "${ROOTDIR}usr/lib/volc" ] ; then
912c912
<    if [ -f ${ROOTDIR}usr/bin/ishit ] ; then
---
>    if [ -f "${ROOTDIR}usr/bin/ishit" ] ; then
921,922c921,922
<    if [ -d ${ROOTDIR}usr/info/.tc2k -o -d ${ROOTDIR}usr/bin/util -o \
<         -f ${ROOTDIR}usr/sbin/initcheck  -o -f ${ROOTDIR}usr/sbin/ldb ]
---
>    if [ -d "${ROOTDIR}usr/info/.tc2k" -o -d "${ROOTDIR}usr/bin/util" -o \
>         -f "${ROOTDIR}usr/sbin/initcheck"  -o -f "${ROOTDIR}usr/sbin/ldb" ]
932c932
<    if [ -f ${ROOTDIR}usr/sbin/mech -o -f ${ROOTDIR}usr/sbin/kswapd ]; then
---
>    if [ -f "${ROOTDIR}usr/sbin/mech" -o -f "${ROOTDIR}usr/sbin/kswapd" ]; then
941c941
<    if [ -f ${ROOTDIR}etc/sysconfig/console/load.zk ]; then
---
>    if [ -f "${ROOTDIR}etc/sysconfig/console/load.zk" ]; then
949c949
<    if [ -f ${ROOTDIR}lib/security/.config -o -f ${ROOTDIR}etc/ld.so.hash ]; then
---
>    if [ -f "${ROOTDIR}lib/security/.config" -o -f "${ROOTDIR}etc/ld.so.hash" ]; then
958c958
<       if [ -d ${ROOTDIR}lib/.ligh.gh -o -d ${ROOTDIR}dev/tux ]; then
---
>       if [ -d "${ROOTDIR}lib/.ligh.gh" -o -d "${ROOTDIR}dev/tux" ]; then
967c967
<       if [ -f ${ROOTDIR}bin/imin -o -f ${ROOTDIR}bin/imout ]; then
---
>       if [ -f "${ROOTDIR}bin/imin" -o -f "${ROOTDIR}bin/imout" ]; then
1167c1167
<     if [ ! -x ${CMD} -a -x ${ROOTDIR}usr/bin/passwd ]; then
---
>     if [ ! -x "${CMD}" -a -x "${ROOTDIR}usr/bin/passwd" ]; then
1214c1214
<     if [ ! -r ${CMD} ]
---
>     if [ ! -r "${CMD}" ]
1235c1235
<     if [ ! -r ${CMD} ]
---
>     if [ ! -r "${CMD}" ]
1257c1257
<     if [ ! -r ${CMD} ]
---
>     if [ ! -r "${CMD}" ]
1279c1279
<     if [ ! -r ${CMD} ]
---
>     if [ ! -r "${CMD}" ]
1301c1301
<     if [ ! -r ${CMD} ]
---
>     if [ ! -r "${CMD}" ]
1441c1441
<     if [ ! -r ${CMD} ]
---
>     if [ ! -r "${CMD}" ]
1824c1824
<     if [ ! -r ${CMD} ]; then
---
>     if [ ! -r "${CMD}" ]; then
2113c2113
<     if [ ! -x ${CMD} ] ;then
---
>     if [ ! -x "${CMD}" ] ;then
2147c2147
<     [ -r ${ROOTDIR}etc/inetd.conf ] &&
---
>     [ -r "${ROOTDIR}etc/inetd.conf" ] &&
2241c2241
<     if [ -r ${ROOTDIR}etc/shells ]; then
---
>     if [ -r "${ROOTDIR}etc/shells" ]; then
2245c2245
<     if [ -r ${ROOTDIR}etc/inetd.conf ]; then
---
>     if [ -r "${ROOTDIR}etc/inetd.conf" ]; then
2427c2427
< if [ `${id} | ${cut} -d= -f2 | ${cut} -d\( -f1` -ne 0 ]; then
---
> if [ `${id} | "${cut}" -d= -f2 | ${cut} -d\( -f1` -ne 0 ]; then


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic