genpwd: added some checks

This commit is contained in:
2022-11-10 14:56:51 +01:00
parent 56d2e34ef4
commit c5a43a3942
2 changed files with 9 additions and 1 deletions

View File

@@ -133,6 +133,13 @@ genpwd()
(( rlength++ ))
fi
# Check if we have enough car to have something viable
if [[ ${#carset} -lt $length ]]; then
echo 'Error: not enought caracters are authorised for the password length.'
echo 'Please allow more caracter (preferably) or reduce password lentgh.'
return 1
fi
for i in $( seq 1 $(( $length - $rlength )) ); do
pickcar "$carset"
done