Add ENCRYPTED/UNENCRYPTED control in createuser script.

This commit is contained in:
Bruce Momjian 2001-08-25 17:46:11 +00:00
parent 0927d9929a
commit 4699d81dc9
2 changed files with 31 additions and 2 deletions

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createuser.sgml,v 1.17 2001/05/02 14:46:33 momjian Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/createuser.sgml,v 1.18 2001/08/25 17:46:11 momjian Exp $
Postgres documentation
-->
@ -132,6 +132,26 @@ Postgres documentation
</listitem>
</varlistentry>
<varlistentry>
<term>--encrypted</term>
<listitem>
<para>
Encrypts the user's password stored in the database. If not
specified, the default is used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--unencrypted</term>
<listitem>
<para>
Does not encrypt the user's password stored in the database. If
not specified, the default is used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">username</replaceable></term>
<listitem>

View File

@ -9,7 +9,7 @@
#
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.17 2001/02/18 18:34:01 momjian Exp $
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.18 2001/08/25 17:46:11 momjian Exp $
#
# Note - this should NOT be setuid.
#
@ -25,6 +25,7 @@ CanCreateDb=
PwPrompt=
Password=
PSQLOPT=
Encrypted= # blank uses default
# Check for echo -n vs echo \c
@ -103,6 +104,12 @@ do
--sysid=*)
SysID=`echo "$1" | sed 's/^--sysid=//'`
;;
--encrypted)
Encrypted=t
;;
--unencrypted)
Encrypted=f
;;
-i*)
SysID=`echo "$1" | sed 's/^-i//'`
;;
@ -226,6 +233,8 @@ SUBQUERY=
[ "$CanCreateDb" = f ] && QUERY="$QUERY NOCREATEDB"
[ "$CanAddUser" = t ] && QUERY="$QUERY CREATEUSER"
[ "$CanAddUser" = f ] && QUERY="$QUERY NOCREATEUSER"
[ "$Encrypted" = t ] && QUERY="$QUERY ENCRYPTED"
[ "$Encrypted" = f ] && QUERY="$QUERY UNENCRYPTED"
${PATHNAME}psql -c "$QUERY" -d template1 $PSQLOPT
if [ $? -ne 0 ]; then