Allow prompting of create/drop user to handle spaces.
This commit is contained in:
parent
5804a7ce3e
commit
0847fea6b9
@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.24 2002/04/12 09:37:10 momjian Exp $
|
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.25 2002/04/12 09:42:31 momjian Exp $
|
||||||
#
|
#
|
||||||
# Note - this should NOT be setuid.
|
# Note - this should NOT be setuid.
|
||||||
#
|
#
|
||||||
@ -27,6 +27,10 @@ Password=
|
|||||||
PSQLOPT=
|
PSQLOPT=
|
||||||
Encrypted= # blank uses default
|
Encrypted= # blank uses default
|
||||||
|
|
||||||
|
# These handle spaces/tabs in identifiers
|
||||||
|
_IFS="$IFS"
|
||||||
|
NL="
|
||||||
|
"
|
||||||
# Check for echo -n vs echo \c
|
# Check for echo -n vs echo \c
|
||||||
|
|
||||||
if echo '\c' | grep -s c >/dev/null 2>&1
|
if echo '\c' | grep -s c >/dev/null 2>&1
|
||||||
@ -178,19 +182,25 @@ trap 'stty echo >/dev/null 2>&1' 1 2 3 15
|
|||||||
|
|
||||||
if [ -z "$NewUser" ]; then
|
if [ -z "$NewUser" ]; then
|
||||||
$ECHO_N "Enter name of user to add: "$ECHO_C
|
$ECHO_N "Enter name of user to add: "$ECHO_C
|
||||||
read NewUser
|
IFS="$NL"
|
||||||
|
read NewUser
|
||||||
|
IFS="$_IFS"
|
||||||
[ "$?" -ne 0 ] && exit 1
|
[ "$?" -ne 0 ] && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PwPrompt" ]; then
|
if [ "$PwPrompt" ]; then
|
||||||
$ECHO_N "Enter password for user \"$NewUser\": "$ECHO_C
|
$ECHO_N "Enter password for user \"$NewUser\": "$ECHO_C
|
||||||
stty -echo >/dev/null 2>&1
|
stty -echo >/dev/null 2>&1
|
||||||
|
IFS="$NL"
|
||||||
read FirstPw
|
read FirstPw
|
||||||
|
IFS="$_IFS"
|
||||||
stty echo >/dev/null 2>&1
|
stty echo >/dev/null 2>&1
|
||||||
echo
|
echo
|
||||||
$ECHO_N "Enter it again: "$ECHO_C
|
$ECHO_N "Enter it again: "$ECHO_C
|
||||||
stty -echo >/dev/null 2>&1
|
stty -echo >/dev/null 2>&1
|
||||||
|
IFS="$NL"
|
||||||
read SecondPw
|
read SecondPw
|
||||||
|
IFS="$_IFS"
|
||||||
stty echo >/dev/null 2>&1
|
stty echo >/dev/null 2>&1
|
||||||
echo
|
echo
|
||||||
if [ "$FirstPw" != "$SecondPw" ]; then
|
if [ "$FirstPw" != "$SecondPw" ]; then
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.16 2002/04/12 09:37:11 momjian Exp $
|
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.17 2002/04/12 09:42:32 momjian Exp $
|
||||||
#
|
#
|
||||||
# Note - this should NOT be setuid.
|
# Note - this should NOT be setuid.
|
||||||
#
|
#
|
||||||
@ -22,6 +22,10 @@ PSQLOPT=
|
|||||||
forcedel=t
|
forcedel=t
|
||||||
DelUser=
|
DelUser=
|
||||||
|
|
||||||
|
# These handle spaces/tabs in identifiers
|
||||||
|
_IFS="$IFS"
|
||||||
|
NL="
|
||||||
|
"
|
||||||
# Check for echo -n vs echo \c
|
# Check for echo -n vs echo \c
|
||||||
|
|
||||||
if echo '\c' | grep -s c >/dev/null 2>&1
|
if echo '\c' | grep -s c >/dev/null 2>&1
|
||||||
@ -125,7 +129,9 @@ fi
|
|||||||
|
|
||||||
if [ -z "$DelUser" ]; then
|
if [ -z "$DelUser" ]; then
|
||||||
$ECHO_N "Enter name of user to delete: "$ECHO_C
|
$ECHO_N "Enter name of user to delete: "$ECHO_C
|
||||||
read DelUser
|
IFS="$NL"
|
||||||
|
read DelUser
|
||||||
|
IFS="$_IFS"
|
||||||
[ "$?" -ne 0 ] && exit 1
|
[ "$?" -ne 0 ] && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user