summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian1999-09-27 16:44:56 +0000
committerBruce Momjian1999-09-27 16:44:56 +0000
commit74a263ed34d9beb0df509fccb444291b9a14e462 (patch)
treea9660baea2521a471d7379395f2862a09fdb2e17 /src
parent30659d43eb73272e20f2eb1d785a07ba3b553ed8 (diff)
Fix to give super user and createdb user proper update catalog rights.
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/user.c6
-rw-r--r--src/bin/createuser/createuser.sh9
2 files changed, 11 insertions, 4 deletions
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index c05b6da5856..76b028f7eee 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: user.c,v 1.34 1999/09/18 19:06:41 tgl Exp $
+ * $Id: user.c,v 1.35 1999/09/27 16:44:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -172,12 +172,14 @@ DefineUser(CreateUserStmt *stmt, CommandDest dest)
snprintf(sql, SQL_LENGTH,
"insert into %s (usename,usesysid,usecreatedb,usetrace,"
"usesuper,usecatupd,passwd,valuntil) "
- "values('%s',%d,'%c','f','%c','f',%s%s%s,%s%s%s)",
+ "values('%s',%d,'%c','f','%c','%c',%s%s%s,%s%s%s)",
ShadowRelationName,
stmt->user,
max_id + 1,
(stmt->createdb && *stmt->createdb) ? 't' : 'f',
(stmt->createuser && *stmt->createuser) ? 't' : 'f',
+ ((stmt->createdb && *stmt->createdb) ||
+ (stmt->createuser && *stmt->createuser)) ? 't' : 'f',
havepassword ? "'" : "",
havepassword ? stmt->password : "NULL",
havepassword ? "'" : "",
diff --git a/src/bin/createuser/createuser.sh b/src/bin/createuser/createuser.sh
index a1bd0a24b5e..aead7af672a 100644
--- a/src/bin/createuser/createuser.sh
+++ b/src/bin/createuser/createuser.sh
@@ -8,7 +8,7 @@
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.12 1999/07/30 18:09:49 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.13 1999/09/27 16:44:56 momjian Exp $
#
# Note - this should NOT be setuid.
#
@@ -215,10 +215,15 @@ then
fi
fi
+if [ "$CANCREATE" = "t" -o "$CANADDUSER" = "t" ]
+then CANCATUPD="t"
+else CANCATUPD="f"
+fi
+
QUERY="insert into pg_shadow \
(usename, usesysid, usecreatedb, usetrace, usesuper, usecatupd) \
values \
- ('$NEWUSER', $SYSID, '$CANCREATE', 'f', '$CANADDUSER','f')"
+ ('$NEWUSER', $SYSID, '$CANCREATE', 'f', '$CANADDUSER','$CANCATUPD')"
RES=`$PSQL -c "$QUERY" template1`