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++ )) (( rlength++ ))
fi 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 for i in $( seq 1 $(( $length - $rlength )) ); do
pickcar "$carset" pickcar "$carset"
done done

View File

@@ -35,6 +35,7 @@
# 27/08/2022 v3.0.0 : splitted everything, added rain screensaver # 27/08/2022 v3.0.0 : splitted everything, added rain screensaver
# 07/11/2022 v3.0.1 : added concatenation to rmspc, added ku, error managed in meteo # 07/11/2022 v3.0.1 : added concatenation to rmspc, added ku, error managed in meteo
# 08/11/2022 v3.1.0 : added password generator # 08/11/2022 v3.1.0 : added password generator
# 10/11/2022 v3.1.1 : genpwd: test if password is doable
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Copyright (c) 2013-2022 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org> # Copyright (c) 2013-2022 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
# Protected by the BSD3 license. Please read bellow for details. # Protected by the BSD3 license. Please read bellow for details.
@@ -70,7 +71,7 @@
# * OF SUCH DAMAGE. # * OF SUCH DAMAGE.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
export PROFVERSION="3.1.0" export PROFVERSION="3.1.1"
export DEFAULT_CITY="Toulouse" export DEFAULT_CITY="Toulouse"