14,12 → 14,19 |
DIR_KEY="/usr/local/etc/digest" |
SED="/bin/sed -i" |
HOSTNAME=`uname -n` |
Lang=`echo $LANG|cut -c 1-2` |
|
# liste les comptes de chaque profile |
function list () { |
for i in $ALL_PROFILS |
do |
echo "Comptes liés au profil '$i' :" |
if [ $Lang == "fr" ] |
then |
echo "Comptes liés au profil '$i' :" |
|
else |
echo "accounts linked with profile '$i' :" |
fi |
cat $DIR_KEY/key_only_$i | cut -d':' -f1|sort |
done |
} |
70,9 → 77,19 |
--add|-add) |
# ajout d'un compte |
list |
echo -n "Choisissez un profil ($ALL_PROFILS) : " |
if [ $Lang == "fr" ] |
then |
echo -n "Choisissez un profil ($ALL_PROFILS) : " |
else |
echo -n "Select a profile ($ALL_PROFILS) : " |
fi |
read profil |
echo -n "Entrez le nom du compte à créer (profil '$profil') : " |
if [ $Lang == "fr" ] |
then |
echo -n "Entrez le nom du compte à créer (profil '$profil') : " |
else |
echo "Enter the name of the account to create (profile '$profil') : " |
fi |
read account |
# on teste s'il n'existe pas déjà |
for i in $ALL_PROFILS |
81,12 → 98,17 |
for j in $tmp_account |
do |
if [ "$j" = "$account" ] |
then echo "Ce compte existe déjà" |
then if [ $Lang == "fr" ] |
then |
echo "Ce compte existe déjà" |
else |
echo "This account already exists" |
fi |
exit 0 |
fi |
done |
done |
/usr/sbin/htdigest $DIR_KEY/key_only_$profil $HOSTNAME $account |
/usr/bin/htdigest $DIR_KEY/key_only_$profil $HOSTNAME $account |
concat |
list |
;; |
93,7 → 115,12 |
--del|-del) |
# suppression d'un compte |
list |
echo -n "entrez le nom du compte à supprimer : " |
if [ $Lang == "fr" ] |
then |
echo -n "entrez le nom du compte à supprimer : " |
else |
echo -n "enter the name of the account to remove : " |
fi |
read account |
for i in $ALL_PROFILS |
do |
105,8 → 132,14 |
--pass|-pass) |
# changement du mot de passe d'un compte |
list |
echo "Changement de mot de passe" |
echo -n "Entrez le nom du compte : " |
if [ $Lang == "fr" ] |
then |
echo "Changement de mot de passe" |
echo -n "Entrez le nom du compte : " |
else |
echo "Password change" |
echo -n "Enter the name of the account : " |
fi |
read account |
for i in $ALL_PROFILS |
do |
115,7 → 148,7 |
do |
if [ "$j" = "$account" ] |
then |
/usr/sbin/htdigest $DIR_KEY/key_only_$i $HOSTNAME $account |
/usr/bin/htdigest $DIR_KEY/key_only_$i $HOSTNAME $account |
fi |
done |
done |
126,7 → 159,12 |
list |
;; |
*) |
echo "Argument inconnu :$1"; |
if [ $Lang == "fr" ] |
then |
echo "Argument inconnu :$1"; |
else |
echo "Unknown argument : $i"; |
fi |
echo "$usage" |
exit 1 |
;; |