summaryrefslogtreecommitdiffstats
path: root/server/bin/setsmbpass
diff options
context:
space:
mode:
authorramon <ramongomez@us.es>2014-04-03 11:04:58 +0000
committerramon <ramongomez@us.es>2014-04-03 11:04:58 +0000
commit3638bcd671d264077716e1aa8738e9ef6acd2ea0 (patch)
treeb28d5e403bf92adeca4cf950bb8aaa6fb05e7a6a /server/bin/setsmbpass
parent65baf165f99450092e7f4918f43c0d9ad58ed1fb (diff)
#616: Volver a tener eco en consola si se corta el script {{{setsmbpass}}}.
git-svn-id: https://opengnsys.es/svn/branches/version1.0@4218 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'server/bin/setsmbpass')
-rwxr-xr-xserver/bin/setsmbpass6
1 files changed, 5 insertions, 1 deletions
diff --git a/server/bin/setsmbpass b/server/bin/setsmbpass
index 0514c014..82d7ce46 100755
--- a/server/bin/setsmbpass
+++ b/server/bin/setsmbpass
@@ -28,17 +28,21 @@ fi
# Crear clave para usuario de acceso a los recursos.
if [ -r $CLIENTINITRD ]; then
+ # Recuperar eco de consola si se corta el proceso.
+ trap "stty echo 2>/dev/null" KILL
+ # Obtener clave del teclado sin eco en pantalla.
stty -echo 2>/dev/null
echo -n "Clave del usuario Samba: "
read SAMBAPASS
# Solo se deben aceptar números y letras para la clave de acceso.
- if [ -n "${SAMBAPASS//[a-zA-Z0-9]/}" ]; then
+ if [[ "$SAMBAPASS" =~ [^a-zA-Z0-9] ]]; then
echo
echo "$PROG: Error: la clave solo debe contener caracteres alfanuméricos" >&2
stty echo 2>/dev/null
exit 2
fi
echo
+ # Obtener confirmación clave sin eco en pantalla.
echo -n "Confirmar clave: "
read SAMBAPASS2
echo