File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 4949# ----------------------------------------------------------#
5050
5151# Parsing user's salt
52- salt=$( grep " ^$user :" /etc/shadow | cut -f 3 -d \$ )
52+ shadow=$( grep " ^$user :" /etc/shadow)
53+ salt=$( echo " $shadow " | cut -f 3 -d \$ )
54+ method=$( echo " $shadow " | cut -f 2 -d \$ )
55+ if [ " $method " -eq ' 1' ]; then
56+ method=' md5'
57+ else
58+ method=' sha-512'
59+ fi
60+
5361if [[ -z " $salt " ]] || [[ " ${# salt} " -gt 12 ]]; then
5462 echo " Error: password missmatch"
5563 echo " $DATE $user $ip failed to login" >> $VESTA /log/auth.log
5664 exit 9
5765fi
5866
5967# Generating SHA-512
60- hash=$( $BIN /v-generate-password-hash sha-512 $salt <<< $password )
68+ hash=$( $BIN /v-generate-password-hash $method $salt <<< $password )
6169if [[ -z " $hash " ]]; then
6270 echo " Error: password missmatch"
6371 echo " $DATE $user $ip failed to login" >> $VESTA /log/auth.log
You can’t perform that action at this time.
0 commit comments