1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Fix to give super user and createdb user proper update catalog rights.

This commit is contained in:
Bruce Momjian
1999-09-27 16:44:56 +00:00
parent 30659d43eb
commit 74a263ed34
3 changed files with 36 additions and 6 deletions

View File

@ -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 ? "'" : "",

View File

@ -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`