File tree 1 file changed +13
-2
lines changed
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -144,10 +144,17 @@ if [ ! -e "$SHADOW_FILE" ];then
144
144
Display --indent 2 --text " $SHADOW_FILE not found, trying /etc/passwd" --result NOSHADOW --color BLUE
145
145
SHADOW_FILE=" ` echo $SCAN_ROOT /etc/passwd | sed ' s,//*,/,g' ` "
146
146
fi
147
- if [ -e " $SHADOW_FILE " ] ; then
147
+ check_shadow () {
148
148
Display --indent 2 --text " $SHADOW_FILE " --result FOUND --color BLUE
149
149
TMPFILE_ACCT=" ${TEMPYASATDIR} /shadow.tmp"
150
- grep -v ' ^#' " $SHADOW_FILE " | cut -d\: -f1,2 > $TMPFILE_ACCT
150
+ # check if $SHADOW_FILE could be read
151
+ head -n1 $SHADOW_FILE 2> /dev/null > /dev/null
152
+ if [ $? -ne 0 ]; then
153
+ Display --indent 2 --text " $SHADOW_FILE could not be read" --result EPERM --color RED
154
+ return 0
155
+ fi
156
+
157
+ grep -v ' ^#' " $SHADOW_FILE " | cut -d\: -f1,2 > $TMPFILE_ACCT
151
158
while read line
152
159
do
153
160
HASH_METHOD=" ` echo $line | cut -d\: -f2 | cut -c1,2` "
@@ -189,6 +196,10 @@ if [ -e "$SHADOW_FILE" ];then
189
196
# TODO Blowfish $2a
190
197
done < $TMPFILE_ACCT
191
198
rm $TMPFILE_ACCT
199
+ }
200
+
201
+ if [ -e " $SHADOW_FILE " ]; then
202
+ check_shadow
192
203
fi
193
204
194
205
# TODO need more work
You can’t perform that action at this time.
0 commit comments