Skip to content

Commit 73e6656

Browse files
author
Serghey Rodin
committed
RACK911LABS.COM: simpler and safer hash check
1 parent d14b7d9 commit 73e6656

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bin/v-check-user-hash

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ else
7575
method='des'
7676
fi
7777

78+
# Checking salt
7879
if [ -z "$salt" ]; then
7980
echo "Error: password missmatch"
8081
echo "$date $time $user $ip failed to login" >> $VESTA/log/auth.log
8182
exit 9
8283
fi
8384

84-
# Checking hash
85-
result=$(grep "^$user:$hash:" /etc/shadow 2>/dev/null)
86-
if [[ -z "$result" ]]; then
85+
# Comparing hashes
86+
if [[ "$shadow" != "$hash" ]]; then
8787
echo "Error: password missmatch"
8888
echo "$date $time $user $ip failed to login" >> $VESTA/log/auth.log
8989
exit 9

0 commit comments

Comments
 (0)