File chkrootkit-0.58b.patch of Package chkrootkit

diff -Nur chkrootkit-0.57-orig/chkrootkit chkrootkit-0.57/chkrootkit
--- chkrootkit-0.57-orig/chkrootkit	2023-01-10 21:50:36.000000000 +0100
+++ chkrootkit-0.57/chkrootkit	2023-02-12 12:47:35.243863908 +0100
@@ -195,31 +195,31 @@
     fi
 
     if [ "${EXPERT}" = "t" ]; then
-        expertmode_output "./ifpromisc" -v
+        expertmode_output "/usr/sbin/ifpromisc" -v
         return 5
     fi
-    if [ ! -x ./ifpromisc ]; then
-      echo "not tested: can't exec ./ifpromisc"
+    if [ ! -x /usr/sbin/ifpromisc ]; then
+      echo "not tested: can't exec /usr/sbin/ifpromisc"
       return ${NOT_TESTED}
     else
-      [ "${QUIET}" != "t" ] && ./ifpromisc -v || ./ifpromisc -q
+      [ "${QUIET}" != "t" ] && /usr/sbin/ifpromisc -v || /usr/sbin/ifpromisc -q
     fi
 }
 
 chkutmp() {
-    if [ ! -x ./chkutmp -o ${mode} = "pm" ]; then
-      echo "not tested: can't exec ./chkutmp"
+    if [ ! -x /usr/sbin/chkutmp -o ${mode} = "pm" ]; then
+      echo "not tested: can't exec /usr/sbin/chkutmp"
       return ${NOT_TESTED}
     fi
-    if ./chkutmp
+    if /usr/sbin/chkutmp
     then
       if [ "${QUIET}" != "t" ]; then echo "chkutmp: nothing deleted"; fi
     fi
 }
 
 z2 () {
-    if [ ! -x ./chklastlog ]; then
-      echo "not tested: can't exec ./chklastlog"
+    if [ ! -x /usr/sbin/chklastlog ]; then
+      echo "not tested: can't exec /usr/sbin/chklastlog"
       return ${NOT_TESTED}
     fi
 
@@ -232,32 +232,32 @@
     fi
 
     if [ "${EXPERT}" = "t" ]; then
-        expertmode_output "./chklastlog -f ${ROOTDIR}${WTMP} -l ${ROOTDIR}${LASTLOG}"
+        expertmode_output "/usr/sbin/chklastlog -f ${ROOTDIR}${WTMP} -l ${ROOTDIR}${LASTLOG}"
         return 5
     fi
 
-    if ./chklastlog -f ${ROOTDIR}${WTMP} -l ${ROOTDIR}${LASTLOG}
+    if /usr/sbin/chklastlog -f ${ROOTDIR}${WTMP} -l ${ROOTDIR}${LASTLOG}
     then
       if [ "${QUIET}" != "t" ]; then echo "chklastlog: nothing deleted"; fi
     fi
 }
 
 wted () {
-    if [ ! -x ./chkwtmp ]; then
-      echo "not tested: can't exec ./chkwtmp"
+    if [ ! -x /usr/sbin/chkwtmp ]; then
+      echo "not tested: can't exec /usr/sbin/chkwtmp"
       return ${NOT_TESTED}
     fi
 
    if [ "$SYSTEM" = "SunOS" ]; then
-       if [ ! -x ./check_wtmpx ]; then
-          echo "not tested: can't exec ./check_wtmpx"
+       if [ ! -x /usr/sbin/check_wtmpx ]; then
+          echo "not tested: can't exec /usr/sbin/check_wtmpx"
        else
           if [ "${EXPERT}" = "t" ]; then
-             expertmode_output "./check_wtmpx"
+             expertmode_output "/usr/sbin/check_wtmpx"
               return 5
           fi
 	  if [ -f ${ROOTDIR}var/adm/wtmp ]; then
-             if ./check_wtmpx
+             if /usr/sbin/check_wtmpx
                 then
                 if [ "${QUIET}" != "t" ]; then \
                    echo "check_wtmpx: nothing deleted in /var/adm/wtmpx"; fi
@@ -268,12 +268,12 @@
        WTMP=`loc wtmp wtmp "${ROOTDIR}var/log ${ROOTDIR}var/adm"`
 
        if [ "${EXPERT}" = "t" ]; then
-          expertmode_output "./chkwtmp -f ${WTMP}"
+          expertmode_output "/usr/sbin/chkwtmp -f ${WTMP}"
           return 5
        fi
     fi
 
-    if ./chkwtmp -f ${WTMP}
+    if /usr/sbin/chkwtmp -f ${WTMP}
     then
       if [ "${QUIET}" != "t" ]; then echo "chkwtmp: nothing deleted"; fi
     fi
@@ -313,8 +313,8 @@
     prog=""
     if [  \( "${SYSTEM}" = "Linux"  -o \( "${SYSTEM}" = "FreeBSD" -a \
        `echo ${V} | ${awk} '{ if ($1 > 4.3 || $1 < 6.0) print 1; else print 0 }'` -eq 1 \) \) -a "${ROOTDIR}" = "/" ]; then
-       [  -x ./chkproc -a "`find /proc -maxdepth 1 2>/dev/null| wc -l`" -gt 1 ] && prog="./chkproc"
-      [  -x ./chkdirs ] && prog="$prog ./chkdirs"
+       [  -x /usr/sbin/chkproc -a "`find /proc -maxdepth 1 2>/dev/null| wc -l`" -gt 1 ] && prog="/usr/sbin/chkproc"
+      [  -x /usr/sbin/chkdirs ] && prog="$prog /usr/sbin/chkdirs"
       if [ "$prog" = "" -o ${mode} = "pm" ]; then
          echo "not tested: can't exec $prog"
          return ${NOT_TESTED}
@@ -326,7 +326,7 @@
          PV=`$ps -V 2>/dev/null| $cut -d " " -f 3 |${awk} -F . '{ print $1 "." $2 $3 }' | ${awk} '{ if ($0 > 3.19) print 3; else if ($0 < 2.015) print 1; else print 2 }'`
          [ "$PV" = "" ] &&  PV=2
          [ "${SYSTEM}" = "SunOS" ] && PV=0
-         expertmode_output "./chkproc -v -v -p $PV"
+         expertmode_output "/usr/sbin/chkproc -v -v -p $PV"
          return 5
       fi
 
@@ -355,7 +355,7 @@
       if [ "${DEBUG}" = "t" ]; then
            ${echo} "*** PV=$PV ***"
       fi
-      if ./chkproc -p ${PV}; then
+      if /usr/sbin/chkproc -p ${PV}; then
          if [ "${QUIET}" != "t" ]; then echo "chkproc: nothing detected"; fi
       else
          echo "chkproc: Warning: Possible LKM Trojan installed"
@@ -366,7 +366,7 @@
             [ -d $i ] && dirs="$dirs $i"
          fi 
       done
-      if ./chkdirs $dirs;  then
+      if /usr/sbin/chkdirs $dirs;  then
          if [ "${QUIET}" != "t" ]; then echo "chkdirs: nothing detected"; fi
       else
 	    echo "chkdirs: Warning: Possible LKM Trojan installed"
@@ -2002,18 +2002,18 @@
 
    if [ "${SYSTEM}" = "Linux" ]
    then
-      if [ ! -x ./strings-static ]; then
-        printn "can't exec ./strings-static, "
+      if [ ! -x /usr/sbin/strings-static ]; then
+        printn "can't exec /usr/sbin/strings-static, "
         return ${NOT_TESTED}
       fi
 
       if [ "${EXPERT}" = "t" ]; then
-          expertmode_output "./strings-static -a ${CMD}"
+          expertmode_output "/usr/sbin/strings-static -a ${CMD}"
           return 5
       fi
 
       ### strings must be a statically linked binary.
-      if ./strings-static -a ${CMD} > /dev/null 2>&1
+      if /usr/sbin/strings-static -a ${CMD} > /dev/null 2>&1
       then
          STATUS=${INFECTED}
       fi
@@ -2895,7 +2895,7 @@
         xxx=`loc $file $file $chkrkpth`
         eval $file=$xxx
         case "$xxx" in
-        /* | ./* | ../*)
+        /* | /usr/sbin/* | ../*)
 
                 if [ ! -x "${xxx}" ]
                 then
diff -Nur chkrootkit-0.57-orig/Makefile chkrootkit-0.57/Makefile
--- chkrootkit-0.57-orig/Makefile	2022-06-17 01:33:18.000000000 +0200
+++ chkrootkit-0.57/Makefile	2023-02-12 12:42:58.566502919 +0100
@@ -4,7 +4,8 @@
 #
 
 CC       ?= cc
-CFLAGS	 += -DHAVE_LASTLOG_H
+OPTFLAGS = -O2
+CFLAGS   = -DHAVE_LASTLOG_H -Wall $(OPTFLAGS)
 STATIC   = -static
 
 ###
@@ -41,36 +42,27 @@
 
 chklastlog:   chklastlog.c
 	${CC} ${CFLAGS} -o $@ chklastlog.c
-	@strip $@
 
 chkwtmp:   chkwtmp.c
 	${CC} ${CFLAGS} -o $@ chkwtmp.c
-	@strip $@
 
 ifpromisc:   ifpromisc.c
 	${CC} ${CFLAGS} ${LDFLAGS}  -D_FILE_OFFSET_BITS=64 -o $@ ifpromisc.c
-	@strip $@
 
 chkproc:   chkproc.c
-	${CC} ${LDFLAGS} -o $@ chkproc.c
-	@strip $@
+	${CC} ${CFLAGS} ${LDFLAGS} -o $@ chkproc.c
 
 chkdirs:   chkdirs.c
-	${CC} ${LDFLAGS} -o $@ chkdirs.c
-	@strip $@
+	${CC} ${CFLAGS} ${LDFLAGS} -o $@ chkdirs.c
 
 check_wtmpx:   check_wtmpx.c
-	${CC} ${LDFLAGS} -o $@ check_wtmpx.c
-	@strip $@
+	${CC} ${CFLAGS} ${LDFLAGS} -o $@ check_wtmpx.c
 
 chkutmp:   chkutmp.c
-	${CC} ${LDFLAGS} -o $@ chkutmp.c
-	@strip $@
-
+	${CC} ${CFLAGS} ${LDFLAGS} -o $@ chkutmp.c
 
 strings-static:   strings.c
-	${CC} ${STATIC} ${LDFLAGS} -o $@ strings.c
-	@strip $@
+	${CC} ${STATIC} ${CFLAGS} ${LDFLAGS} -o $@ strings.c
 
 clean:
 	rm -f ${OBJS} core chklastlog chkwtmp ifpromisc chkproc chkdirs check_wtmpx strings-static chkutmp
diff -Nur chkrootkit-0.57-orig/strings.c chkrootkit-0.57/strings.c
--- chkrootkit-0.57-orig/strings.c	2022-06-17 01:33:18.000000000 +0200
+++ chkrootkit-0.57/strings.c	2023-02-12 12:44:04.842828916 +0100
@@ -11,6 +11,7 @@
 
 #include <stdio.h>
 #include <strings.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <ctype.h>
openSUSE Build Service is sponsored by