File: chkrootkit-chk_passwd.patch

package info (click to toggle)
chkrootkit 0.58b-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 7,796 kB
  • sloc: sh: 187,095; ansic: 3,779; makefile: 103
file content (53 lines) | stat: -rw-r--r-- 1,539 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From: Richard Lewis <richard.lewis.debian@googlemail.com>
Date: Wed, 16 Oct 2024 22:23:12 +0100
Subject: chkrootkit: chk_passwd

Forwarded: yes
(Forwarded by email: 21 Dec 2024)
---
 chkrootkit | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/chkrootkit b/chkrootkit
index 95e4d72..40961d4 100755
--- a/chkrootkit
+++ b/chkrootkit
@@ -1568,27 +1568,30 @@ $1 >= 3.0) print 1; else print 0}')" -eq 1 ]; then
 
 chk_passwd () {
     STATUS=${NOT_INFECTED}
-    CMD=`loc passwd passwd $pth`
+    CMD=$(loc passwd passwd "$pth")
 
-    if [ ! -x ${CMD} -a -x ${ROOTDIR}usr/bin/passwd ]; then
+    if [ ! -x "${CMD}" -a -x "${ROOTDIR}usr/bin/passwd" ]; then
        CMD="${ROOTDIR}usr/bin/passwd"
     fi
+    if [ ! -r "${CMD}" ]; then
+        return "${NOT_FOUND}"
+    fi
 
     if [ "${EXPERT}" = "t" ]; then
-       expertmode_output "${strings} -a ${CMD}"
+        expertmode_output "${strings} -a ${CMD}"
+        return 5
     fi
 
-    if [ "${SYSTEM}" = "OpenBSD" -o "${SYSTEM}" = "SunOS" -o "${SYSTEM}" \
-        = "HP-UX" ]
+    if [ "${SYSTEM}" = "OpenBSD" -o "${SYSTEM}" = "SunOS" -o "${SYSTEM}" = "HP-UX" ]
     then
-       return ${NOT_TESTED}
+       return "${NOT_TESTED}"
     fi
-    if ${strings} -a ${CMD} | ${egrep} "${GENERIC_ROOTKIT_LABEL}|/lib/security" \
+    if "${strings}" -a "${CMD}" | ${egrep} "${GENERIC_ROOTKIT_LABEL}|/lib/security" \
     >/dev/null 2>&1
     then
        STATUS=${INFECTED}
     fi
-    return ${STATUS}
+    return "${STATUS}"
 }
 
 chk_inetd () {