Commit 7762619e authored by Tom Lane's avatar Tom Lane

Replace pg_shadow and pg_group by new role-capable catalogs pg_authid

and pg_auth_members.  There are still many loose ends to finish in this
patch (no documentation, no regression tests, no pg_dump support for
instance).  But I'm going to commit it now anyway so that Alvaro can
make some progress on shared dependencies.  The catalog changes should
be pretty much done.
parent 977530d8
This diff is collapsed.
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.260 2005/06/26 22:05:35 tgl Exp $ $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.261 2005/06/28 05:08:50 tgl Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -8443,8 +8443,8 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, .. ...@@ -8443,8 +8443,8 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
<para> <para>
<function>has_table_privilege</function> checks whether a user <function>has_table_privilege</function> checks whether a user
can access a table in a particular way. The user can be can access a table in a particular way. The user can be
specified by name or by ID specified by name or by OID
(<literal>pg_user.usesysid</literal>), or if the argument is (<literal>pg_authid.oid</literal>), or if the argument is
omitted omitted
<function>current_user</function> is assumed. The table can be specified <function>current_user</function> is assumed. The table can be specified
by name or by OID. (Thus, there are actually six variants of by name or by OID. (Thus, there are actually six variants of
...@@ -8756,9 +8756,9 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); ...@@ -8756,9 +8756,9 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
in it refer to the relation indicated by the second parameter</entry> in it refer to the relation indicated by the second parameter</entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_get_userbyid</function>(<parameter>userid</parameter>)</literal></entry> <entry><literal><function>pg_get_userbyid</function>(<parameter>roleid</parameter>)</literal></entry>
<entry><type>name</type></entry> <entry><type>name</type></entry>
<entry>get user name with given ID</entry> <entry>get role name with given ID</entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_get_serial_sequence</function>(<parameter>table_name</parameter>, <parameter>column_name</parameter>)</literal></entry> <entry><literal><function>pg_get_serial_sequence</function>(<parameter>table_name</parameter>, <parameter>column_name</parameter>)</literal></entry>
...@@ -8805,7 +8805,7 @@ SELECT pg_type_is_visible('myschema.widget'::regtype); ...@@ -8805,7 +8805,7 @@ SELECT pg_type_is_visible('myschema.widget'::regtype);
<para> <para>
<function>pg_get_userbyid</function> <function>pg_get_userbyid</function>
extracts a user's name given a user ID number. extracts a role's name given its OID.
<function>pg_get_serial_sequence</function> <function>pg_get_serial_sequence</function>
fetches the name of the sequence associated with a serial or fetches the name of the sequence associated with a serial or
bigserial column. The name is suitably formatted bigserial column. The name is suitably formatted
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.6 2005/06/19 22:34:56 tgl Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.7 2005/06/28 05:08:51 tgl Exp $
* *
* NOTES * NOTES
* Each global transaction is associated with a global transaction * Each global transaction is associated with a global transaction
...@@ -107,7 +107,7 @@ typedef struct GlobalTransactionData ...@@ -107,7 +107,7 @@ typedef struct GlobalTransactionData
PGPROC proc; /* dummy proc */ PGPROC proc; /* dummy proc */
TimestampTz prepared_at; /* time of preparation */ TimestampTz prepared_at; /* time of preparation */
XLogRecPtr prepare_lsn; /* XLOG offset of prepare record */ XLogRecPtr prepare_lsn; /* XLOG offset of prepare record */
AclId owner; /* ID of user that executed the xact */ Oid owner; /* ID of user that executed the xact */
TransactionId locking_xid; /* top-level XID of backend working on xact */ TransactionId locking_xid; /* top-level XID of backend working on xact */
bool valid; /* TRUE if fully prepared */ bool valid; /* TRUE if fully prepared */
char gid[GIDSIZE]; /* The GID assigned to the prepared xact */ char gid[GIDSIZE]; /* The GID assigned to the prepared xact */
...@@ -206,7 +206,7 @@ TwoPhaseShmemInit(void) ...@@ -206,7 +206,7 @@ TwoPhaseShmemInit(void)
*/ */
GlobalTransaction GlobalTransaction
MarkAsPreparing(TransactionId xid, const char *gid, MarkAsPreparing(TransactionId xid, const char *gid,
TimestampTz prepared_at, AclId owner, Oid databaseid) TimestampTz prepared_at, Oid owner, Oid databaseid)
{ {
GlobalTransaction gxact; GlobalTransaction gxact;
int i; int i;
...@@ -350,7 +350,7 @@ MarkAsPrepared(GlobalTransaction gxact) ...@@ -350,7 +350,7 @@ MarkAsPrepared(GlobalTransaction gxact)
* Locate the prepared transaction and mark it busy for COMMIT or PREPARE. * Locate the prepared transaction and mark it busy for COMMIT or PREPARE.
*/ */
static GlobalTransaction static GlobalTransaction
LockGXact(const char *gid, AclId user) LockGXact(const char *gid, Oid user)
{ {
int i; int i;
...@@ -559,7 +559,7 @@ pg_prepared_xact(PG_FUNCTION_ARGS) ...@@ -559,7 +559,7 @@ pg_prepared_xact(PG_FUNCTION_ARGS)
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "prepared", TupleDescInitEntry(tupdesc, (AttrNumber) 3, "prepared",
TIMESTAMPTZOID, -1, 0); TIMESTAMPTZOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 4, "ownerid", TupleDescInitEntry(tupdesc, (AttrNumber) 4, "ownerid",
INT4OID, -1, 0); OIDOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 5, "dbid", TupleDescInitEntry(tupdesc, (AttrNumber) 5, "dbid",
OIDOID, -1, 0); OIDOID, -1, 0);
...@@ -601,7 +601,7 @@ pg_prepared_xact(PG_FUNCTION_ARGS) ...@@ -601,7 +601,7 @@ pg_prepared_xact(PG_FUNCTION_ARGS)
values[0] = TransactionIdGetDatum(gxact->proc.xid); values[0] = TransactionIdGetDatum(gxact->proc.xid);
values[1] = DirectFunctionCall1(textin, CStringGetDatum(gxact->gid)); values[1] = DirectFunctionCall1(textin, CStringGetDatum(gxact->gid));
values[2] = TimestampTzGetDatum(gxact->prepared_at); values[2] = TimestampTzGetDatum(gxact->prepared_at);
values[3] = Int32GetDatum(gxact->owner); values[3] = ObjectIdGetDatum(gxact->owner);
values[4] = ObjectIdGetDatum(gxact->proc.databaseId); values[4] = ObjectIdGetDatum(gxact->proc.databaseId);
tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls); tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
...@@ -690,7 +690,7 @@ typedef struct TwoPhaseFileHeader ...@@ -690,7 +690,7 @@ typedef struct TwoPhaseFileHeader
TransactionId xid; /* original transaction XID */ TransactionId xid; /* original transaction XID */
Oid database; /* OID of database it was in */ Oid database; /* OID of database it was in */
TimestampTz prepared_at; /* time of preparation */ TimestampTz prepared_at; /* time of preparation */
AclId owner; /* user running the transaction */ Oid owner; /* user running the transaction */
int32 nsubxacts; /* number of following subxact XIDs */ int32 nsubxacts; /* number of following subxact XIDs */
int32 ncommitrels; /* number of delete-on-commit rels */ int32 ncommitrels; /* number of delete-on-commit rels */
int32 nabortrels; /* number of delete-on-abort rels */ int32 nabortrels; /* number of delete-on-abort rels */
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.207 2005/06/19 20:00:38 tgl Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.208 2005/06/28 05:08:51 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -121,7 +121,7 @@ typedef struct TransactionStateData ...@@ -121,7 +121,7 @@ typedef struct TransactionStateData
* context */ * context */
ResourceOwner curTransactionOwner; /* my query resources */ ResourceOwner curTransactionOwner; /* my query resources */
List *childXids; /* subcommitted child XIDs */ List *childXids; /* subcommitted child XIDs */
AclId currentUser; /* subxact start current_user */ Oid currentUser; /* subxact start current_user */
bool prevXactReadOnly; /* entry-time xact r/o state */ bool prevXactReadOnly; /* entry-time xact r/o state */
struct TransactionStateData *parent; /* back link to parent */ struct TransactionStateData *parent; /* back link to parent */
} TransactionStateData; } TransactionStateData;
...@@ -1488,8 +1488,10 @@ CommitTransaction(void) ...@@ -1488,8 +1488,10 @@ CommitTransaction(void)
/* NOTIFY commit must come before lower-level cleanup */ /* NOTIFY commit must come before lower-level cleanup */
AtCommit_Notify(); AtCommit_Notify();
/* Update flat files if we changed pg_database, pg_shadow or pg_group */ /*
/* This should be the last step before commit */ * Update flat files if we changed pg_database, pg_authid or
* pg_auth_members. This should be the last step before commit.
*/
AtEOXact_UpdateFlatFiles(true); AtEOXact_UpdateFlatFiles(true);
/* Prevent cancel/die interrupt while cleaning up */ /* Prevent cancel/die interrupt while cleaning up */
...@@ -3847,7 +3849,7 @@ PushTransaction(void) ...@@ -3847,7 +3849,7 @@ PushTransaction(void)
{ {
TransactionState p = CurrentTransactionState; TransactionState p = CurrentTransactionState;
TransactionState s; TransactionState s;
AclId currentUser; Oid currentUser;
/* /*
* At present, GetUserId cannot fail, but let's not assume that. Get * At present, GetUserId cannot fail, but let's not assume that. Get
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Makefile for backend/catalog # Makefile for backend/catalog
# #
# $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.53 2004/07/21 20:34:45 momjian Exp $ # $PostgreSQL: pgsql/src/backend/catalog/Makefile,v 1.54 2005/06/28 05:08:52 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -31,8 +31,9 @@ POSTGRES_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/,\ ...@@ -31,8 +31,9 @@ POSTGRES_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/,\
pg_operator.h pg_opclass.h pg_am.h pg_amop.h pg_amproc.h \ pg_operator.h pg_opclass.h pg_am.h pg_amop.h pg_amproc.h \
pg_language.h pg_largeobject.h pg_aggregate.h pg_statistic.h \ pg_language.h pg_largeobject.h pg_aggregate.h pg_statistic.h \
pg_rewrite.h pg_trigger.h pg_listener.h pg_description.h pg_cast.h \ pg_rewrite.h pg_trigger.h pg_listener.h pg_description.h pg_cast.h \
pg_namespace.h pg_conversion.h pg_database.h pg_shadow.h pg_group.h \ pg_namespace.h pg_conversion.h pg_database.h \
pg_tablespace.h pg_depend.h indexing.h \ pg_authid.h pg_auth_members.h pg_tablespace.h pg_depend.h \
indexing.h \
) )
pg_includes := $(sort -I$(top_srcdir)/src/include -I$(top_builddir)/src/include) pg_includes := $(sort -I$(top_srcdir)/src/include -I$(top_builddir)/src/include)
......
This diff is collapsed.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $PostgreSQL: pgsql/src/backend/catalog/genbki.sh,v 1.36 2005/04/14 20:03:23 tgl Exp $ # $PostgreSQL: pgsql/src/backend/catalog/genbki.sh,v 1.37 2005/06/28 05:08:52 tgl Exp $
# #
# NOTES # NOTES
# non-essential whitespace is removed from the generated file. # non-essential whitespace is removed from the generated file.
...@@ -114,6 +114,14 @@ for dir in $INCLUDE_DIRS; do ...@@ -114,6 +114,14 @@ for dir in $INCLUDE_DIRS; do
fi fi
done done
# Get BOOTSTRAP_SUPERUSERID from catalog/pg_authid.h
for dir in $INCLUDE_DIRS; do
if [ -f "$dir/catalog/pg_authid.h" ]; then
BOOTSTRAP_SUPERUSERID=`grep '^#define[ ]*BOOTSTRAP_SUPERUSERID' $dir/catalog/pg_authid.h | $AWK '{ print $3 }'`
break
fi
done
# Get PG_CATALOG_NAMESPACE from catalog/pg_namespace.h # Get PG_CATALOG_NAMESPACE from catalog/pg_namespace.h
for dir in $INCLUDE_DIRS; do for dir in $INCLUDE_DIRS; do
if [ -f "$dir/catalog/pg_namespace.h" ]; then if [ -f "$dir/catalog/pg_namespace.h" ]; then
...@@ -153,7 +161,7 @@ sed -e "s/;[ ]*$//g" \ ...@@ -153,7 +161,7 @@ sed -e "s/;[ ]*$//g" \
-e "s/[ ]TransactionId/ xid/g" \ -e "s/[ ]TransactionId/ xid/g" \
-e "s/^TransactionId/xid/g" \ -e "s/^TransactionId/xid/g" \
-e "s/(TransactionId/(xid/g" \ -e "s/(TransactionId/(xid/g" \
-e "s/PGUID/1/g" \ -e "s/PGUID/$BOOTSTRAP_SUPERUSERID/g" \
-e "s/NAMEDATALEN/$NAMEDATALEN/g" \ -e "s/NAMEDATALEN/$NAMEDATALEN/g" \
-e "s/PGNSP/$PG_CATALOG_NAMESPACE/g" \ -e "s/PGNSP/$PG_CATALOG_NAMESPACE/g" \
| $AWK ' | $AWK '
......
This diff is collapsed.
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.75 2005/04/14 20:03:23 tgl Exp $ * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.76 2005/06/28 05:08:52 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
#include "access/xact.h" #include "access/xact.h"
#include "catalog/dependency.h" #include "catalog/dependency.h"
#include "catalog/namespace.h" #include "catalog/namespace.h"
#include "catalog/pg_authid.h"
#include "catalog/pg_conversion.h" #include "catalog/pg_conversion.h"
#include "catalog/pg_namespace.h" #include "catalog/pg_namespace.h"
#include "catalog/pg_opclass.h" #include "catalog/pg_opclass.h"
#include "catalog/pg_operator.h" #include "catalog/pg_operator.h"
#include "catalog/pg_proc.h" #include "catalog/pg_proc.h"
#include "catalog/pg_shadow.h"
#include "catalog/pg_type.h" #include "catalog/pg_type.h"
#include "commands/dbcommands.h" #include "commands/dbcommands.h"
#include "lib/stringinfo.h" #include "lib/stringinfo.h"
...@@ -1499,7 +1499,7 @@ FindDefaultConversionProc(int4 for_encoding, int4 to_encoding) ...@@ -1499,7 +1499,7 @@ FindDefaultConversionProc(int4 for_encoding, int4 to_encoding)
static void static void
recomputeNamespacePath(void) recomputeNamespacePath(void)
{ {
AclId userId = GetUserId(); Oid roleid = GetUserId();
char *rawname; char *rawname;
List *namelist; List *namelist;
List *oidlist; List *oidlist;
...@@ -1511,7 +1511,7 @@ recomputeNamespacePath(void) ...@@ -1511,7 +1511,7 @@ recomputeNamespacePath(void)
/* /*
* Do nothing if path is already valid. * Do nothing if path is already valid.
*/ */
if (namespaceSearchPathValid && namespaceUser == userId) if (namespaceSearchPathValid && namespaceUser == roleid)
return; return;
/* Need a modifiable copy of namespace_search_path string */ /* Need a modifiable copy of namespace_search_path string */
...@@ -1542,21 +1542,21 @@ recomputeNamespacePath(void) ...@@ -1542,21 +1542,21 @@ recomputeNamespacePath(void)
/* $user --- substitute namespace matching user name, if any */ /* $user --- substitute namespace matching user name, if any */
HeapTuple tuple; HeapTuple tuple;
tuple = SearchSysCache(SHADOWSYSID, tuple = SearchSysCache(AUTHOID,
ObjectIdGetDatum(userId), ObjectIdGetDatum(roleid),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(tuple)) if (HeapTupleIsValid(tuple))
{ {
char *uname; char *rname;
uname = NameStr(((Form_pg_shadow) GETSTRUCT(tuple))->usename); rname = NameStr(((Form_pg_authid) GETSTRUCT(tuple))->rolname);
namespaceId = GetSysCacheOid(NAMESPACENAME, namespaceId = GetSysCacheOid(NAMESPACENAME,
CStringGetDatum(uname), CStringGetDatum(rname),
0, 0, 0); 0, 0, 0);
ReleaseSysCache(tuple); ReleaseSysCache(tuple);
if (OidIsValid(namespaceId) && if (OidIsValid(namespaceId) &&
!list_member_oid(oidlist, namespaceId) && !list_member_oid(oidlist, namespaceId) &&
pg_namespace_aclcheck(namespaceId, userId, pg_namespace_aclcheck(namespaceId, roleid,
ACL_USAGE) == ACLCHECK_OK) ACL_USAGE) == ACLCHECK_OK)
oidlist = lappend_oid(oidlist, namespaceId); oidlist = lappend_oid(oidlist, namespaceId);
} }
...@@ -1569,7 +1569,7 @@ recomputeNamespacePath(void) ...@@ -1569,7 +1569,7 @@ recomputeNamespacePath(void)
0, 0, 0); 0, 0, 0);
if (OidIsValid(namespaceId) && if (OidIsValid(namespaceId) &&
!list_member_oid(oidlist, namespaceId) && !list_member_oid(oidlist, namespaceId) &&
pg_namespace_aclcheck(namespaceId, userId, pg_namespace_aclcheck(namespaceId, roleid,
ACL_USAGE) == ACLCHECK_OK) ACL_USAGE) == ACLCHECK_OK)
oidlist = lappend_oid(oidlist, namespaceId); oidlist = lappend_oid(oidlist, namespaceId);
} }
...@@ -1622,7 +1622,7 @@ recomputeNamespacePath(void) ...@@ -1622,7 +1622,7 @@ recomputeNamespacePath(void)
/* Mark the path valid. */ /* Mark the path valid. */
namespaceSearchPathValid = true; namespaceSearchPathValid = true;
namespaceUser = userId; namespaceUser = roleid;
/* Clean up. */ /* Clean up. */
pfree(rawname); pfree(rawname);
...@@ -1674,7 +1674,7 @@ InitTempTableNamespace(void) ...@@ -1674,7 +1674,7 @@ InitTempTableNamespace(void)
* that access the temp namespace for my own backend skip * that access the temp namespace for my own backend skip
* permissions checks on it. * permissions checks on it.
*/ */
namespaceId = NamespaceCreate(namespaceName, BOOTSTRAP_USESYSID); namespaceId = NamespaceCreate(namespaceName, BOOTSTRAP_SUPERUSERID);
/* Advance command counter to make namespace visible */ /* Advance command counter to make namespace visible */
CommandCounterIncrement(); CommandCounterIncrement();
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.23 2005/05/27 00:57:49 neilc Exp $ * $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.24 2005/06/28 05:08:52 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
*/ */
Oid Oid
ConversionCreate(const char *conname, Oid connamespace, ConversionCreate(const char *conname, Oid connamespace,
AclId conowner, Oid conowner,
int32 conforencoding, int32 contoencoding, int32 conforencoding, int32 contoencoding,
Oid conproc, bool def) Oid conproc, bool def)
{ {
...@@ -95,7 +95,7 @@ ConversionCreate(const char *conname, Oid connamespace, ...@@ -95,7 +95,7 @@ ConversionCreate(const char *conname, Oid connamespace,
namestrcpy(&cname, conname); namestrcpy(&cname, conname);
values[Anum_pg_conversion_conname - 1] = NameGetDatum(&cname); values[Anum_pg_conversion_conname - 1] = NameGetDatum(&cname);
values[Anum_pg_conversion_connamespace - 1] = ObjectIdGetDatum(connamespace); values[Anum_pg_conversion_connamespace - 1] = ObjectIdGetDatum(connamespace);
values[Anum_pg_conversion_conowner - 1] = Int32GetDatum(conowner); values[Anum_pg_conversion_conowner - 1] = ObjectIdGetDatum(conowner);
values[Anum_pg_conversion_conforencoding - 1] = Int32GetDatum(conforencoding); values[Anum_pg_conversion_conforencoding - 1] = Int32GetDatum(conforencoding);
values[Anum_pg_conversion_contoencoding - 1] = Int32GetDatum(contoencoding); values[Anum_pg_conversion_contoencoding - 1] = Int32GetDatum(contoencoding);
values[Anum_pg_conversion_conproc - 1] = ObjectIdGetDatum(conproc); values[Anum_pg_conversion_conproc - 1] = ObjectIdGetDatum(conproc);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/pg_namespace.c,v 1.13 2005/04/14 20:03:23 tgl Exp $ * $PostgreSQL: pgsql/src/backend/catalog/pg_namespace.c,v 1.14 2005/06/28 05:08:52 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* --------------- * ---------------
*/ */
Oid Oid
NamespaceCreate(const char *nspName, int32 ownerSysId) NamespaceCreate(const char *nspName, Oid ownerId)
{ {
Relation nspdesc; Relation nspdesc;
HeapTuple tup; HeapTuple tup;
...@@ -57,7 +57,7 @@ NamespaceCreate(const char *nspName, int32 ownerSysId) ...@@ -57,7 +57,7 @@ NamespaceCreate(const char *nspName, int32 ownerSysId)
} }
namestrcpy(&nname, nspName); namestrcpy(&nname, nspName);
values[Anum_pg_namespace_nspname - 1] = NameGetDatum(&nname); values[Anum_pg_namespace_nspname - 1] = NameGetDatum(&nname);
values[Anum_pg_namespace_nspowner - 1] = Int32GetDatum(ownerSysId); values[Anum_pg_namespace_nspowner - 1] = ObjectIdGetDatum(ownerId);
nulls[Anum_pg_namespace_nspacl - 1] = 'n'; nulls[Anum_pg_namespace_nspacl - 1] = 'n';
nspdesc = heap_open(NamespaceRelationId, RowExclusiveLock); nspdesc = heap_open(NamespaceRelationId, RowExclusiveLock);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/pg_operator.c,v 1.91 2005/04/14 20:03:23 tgl Exp $ * $PostgreSQL: pgsql/src/backend/catalog/pg_operator.c,v 1.92 2005/06/28 05:08:52 tgl Exp $
* *
* NOTES * NOTES
* these routines moved here from commands/define.c and somewhat cleaned up. * these routines moved here from commands/define.c and somewhat cleaned up.
...@@ -235,7 +235,7 @@ OperatorShellMake(const char *operatorName, ...@@ -235,7 +235,7 @@ OperatorShellMake(const char *operatorName,
namestrcpy(&oname, operatorName); namestrcpy(&oname, operatorName);
values[i++] = NameGetDatum(&oname); /* oprname */ values[i++] = NameGetDatum(&oname); /* oprname */
values[i++] = ObjectIdGetDatum(operatorNamespace); /* oprnamespace */ values[i++] = ObjectIdGetDatum(operatorNamespace); /* oprnamespace */
values[i++] = Int32GetDatum(GetUserId()); /* oprowner */ values[i++] = ObjectIdGetDatum(GetUserId()); /* oprowner */
values[i++] = CharGetDatum(leftTypeId ? (rightTypeId ? 'b' : 'r') : 'l'); /* oprkind */ values[i++] = CharGetDatum(leftTypeId ? (rightTypeId ? 'b' : 'r') : 'l'); /* oprkind */
values[i++] = BoolGetDatum(false); /* oprcanhash */ values[i++] = BoolGetDatum(false); /* oprcanhash */
values[i++] = ObjectIdGetDatum(leftTypeId); /* oprleft */ values[i++] = ObjectIdGetDatum(leftTypeId); /* oprleft */
...@@ -519,7 +519,7 @@ OperatorCreate(const char *operatorName, ...@@ -519,7 +519,7 @@ OperatorCreate(const char *operatorName,
namestrcpy(&oname, operatorName); namestrcpy(&oname, operatorName);
values[i++] = NameGetDatum(&oname); /* oprname */ values[i++] = NameGetDatum(&oname); /* oprname */
values[i++] = ObjectIdGetDatum(operatorNamespace); /* oprnamespace */ values[i++] = ObjectIdGetDatum(operatorNamespace); /* oprnamespace */
values[i++] = Int32GetDatum(GetUserId()); /* oprowner */ values[i++] = ObjectIdGetDatum(GetUserId()); /* oprowner */
values[i++] = CharGetDatum(leftTypeId ? (rightTypeId ? 'b' : 'r') : 'l'); /* oprkind */ values[i++] = CharGetDatum(leftTypeId ? (rightTypeId ? 'b' : 'r') : 'l'); /* oprkind */
values[i++] = BoolGetDatum(canHash); /* oprcanhash */ values[i++] = BoolGetDatum(canHash); /* oprcanhash */
values[i++] = ObjectIdGetDatum(leftTypeId); /* oprleft */ values[i++] = ObjectIdGetDatum(leftTypeId); /* oprleft */
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.129 2005/05/03 16:51:00 tgl Exp $ * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.130 2005/06/28 05:08:52 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -217,7 +217,7 @@ ProcedureCreate(const char *procedureName, ...@@ -217,7 +217,7 @@ ProcedureCreate(const char *procedureName,
namestrcpy(&procname, procedureName); namestrcpy(&procname, procedureName);
values[Anum_pg_proc_proname - 1] = NameGetDatum(&procname); values[Anum_pg_proc_proname - 1] = NameGetDatum(&procname);
values[Anum_pg_proc_pronamespace - 1] = ObjectIdGetDatum(procNamespace); values[Anum_pg_proc_pronamespace - 1] = ObjectIdGetDatum(procNamespace);
values[Anum_pg_proc_proowner - 1] = Int32GetDatum(GetUserId()); values[Anum_pg_proc_proowner - 1] = ObjectIdGetDatum(GetUserId());
values[Anum_pg_proc_prolang - 1] = ObjectIdGetDatum(languageObjectId); values[Anum_pg_proc_prolang - 1] = ObjectIdGetDatum(languageObjectId);
values[Anum_pg_proc_proisagg - 1] = BoolGetDatum(isAgg); values[Anum_pg_proc_proisagg - 1] = BoolGetDatum(isAgg);
values[Anum_pg_proc_prosecdef - 1] = BoolGetDatum(security_definer); values[Anum_pg_proc_prosecdef - 1] = BoolGetDatum(security_definer);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.100 2005/04/14 20:03:23 tgl Exp $ * $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.101 2005/06/28 05:08:52 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -227,7 +227,7 @@ TypeCreate(const char *typeName, ...@@ -227,7 +227,7 @@ TypeCreate(const char *typeName,
namestrcpy(&name, typeName); namestrcpy(&name, typeName);
values[i++] = NameGetDatum(&name); /* typname */ values[i++] = NameGetDatum(&name); /* typname */
values[i++] = ObjectIdGetDatum(typeNamespace); /* typnamespace */ values[i++] = ObjectIdGetDatum(typeNamespace); /* typnamespace */
values[i++] = Int32GetDatum(GetUserId()); /* typowner */ values[i++] = ObjectIdGetDatum(GetUserId()); /* typowner */
values[i++] = Int16GetDatum(internalSize); /* typlen */ values[i++] = Int16GetDatum(internalSize); /* typlen */
values[i++] = BoolGetDatum(passedByValue); /* typbyval */ values[i++] = BoolGetDatum(passedByValue); /* typbyval */
values[i++] = CharGetDatum(typeType); /* typtype */ values[i++] = CharGetDatum(typeType); /* typtype */
......
...@@ -3,9 +3,45 @@ ...@@ -3,9 +3,45 @@
* *
* Copyright (c) 1996-2005, PostgreSQL Global Development Group * Copyright (c) 1996-2005, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.15 2005/06/18 19:33:42 tgl Exp $ * $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.16 2005/06/28 05:08:52 tgl Exp $
*/ */
CREATE VIEW pg_roles AS
SELECT
rolname,
rolsuper,
rolcreaterole,
rolcreatedb,
rolcatupdate,
rolcanlogin,
'********'::text as rolpassword,
rolvaliduntil,
rolconfig
FROM pg_authid;
CREATE VIEW pg_shadow AS
SELECT
rolname AS usename,
oid AS usesysid,
rolcreatedb AS usecreatedb,
rolsuper AS usesuper,
rolcatupdate AS usecatupd,
rolpassword AS passwd,
rolvaliduntil::abstime AS valuntil,
rolconfig AS useconfig
FROM pg_authid
WHERE rolcanlogin;
REVOKE ALL on pg_shadow FROM public;
CREATE VIEW pg_group AS
SELECT
rolname AS groname,
oid AS grosysid,
ARRAY(SELECT member FROM pg_auth_members WHERE roleid = oid) AS grolist
FROM pg_authid
WHERE NOT rolcanlogin;
CREATE VIEW pg_user AS CREATE VIEW pg_user AS
SELECT SELECT
usename, usename,
...@@ -111,10 +147,10 @@ CREATE VIEW pg_locks AS ...@@ -111,10 +147,10 @@ CREATE VIEW pg_locks AS
CREATE VIEW pg_prepared_xacts AS CREATE VIEW pg_prepared_xacts AS
SELECT P.transaction, P.gid, P.prepared, SELECT P.transaction, P.gid, P.prepared,
U.usename AS owner, D.datname AS database U.rolname AS owner, D.datname AS database
FROM pg_prepared_xact() AS P FROM pg_prepared_xact() AS P
(transaction xid, gid text, prepared timestamptz, ownerid int4, dbid oid) (transaction xid, gid text, prepared timestamptz, ownerid oid, dbid oid)
LEFT JOIN pg_shadow U ON P.ownerid = U.usesysid LEFT JOIN pg_authid U ON P.ownerid = U.oid
LEFT JOIN pg_database D ON P.dbid = D.oid; LEFT JOIN pg_database D ON P.dbid = D.oid;
CREATE VIEW pg_settings AS CREATE VIEW pg_settings AS
...@@ -269,7 +305,7 @@ CREATE VIEW pg_stat_activity AS ...@@ -269,7 +305,7 @@ CREATE VIEW pg_stat_activity AS
D.datname AS datname, D.datname AS datname,
pg_stat_get_backend_pid(S.backendid) AS procpid, pg_stat_get_backend_pid(S.backendid) AS procpid,
pg_stat_get_backend_userid(S.backendid) AS usesysid, pg_stat_get_backend_userid(S.backendid) AS usesysid,
U.usename AS usename, U.rolname AS usename,
pg_stat_get_backend_activity(S.backendid) AS current_query, pg_stat_get_backend_activity(S.backendid) AS current_query,
pg_stat_get_backend_activity_start(S.backendid) AS query_start, pg_stat_get_backend_activity_start(S.backendid) AS query_start,
pg_stat_get_backend_start(S.backendid) AS backend_start, pg_stat_get_backend_start(S.backendid) AS backend_start,
...@@ -277,9 +313,9 @@ CREATE VIEW pg_stat_activity AS ...@@ -277,9 +313,9 @@ CREATE VIEW pg_stat_activity AS
pg_stat_get_backend_client_port(S.backendid) AS client_port pg_stat_get_backend_client_port(S.backendid) AS client_port
FROM pg_database D, FROM pg_database D,
(SELECT pg_stat_get_backend_idset() AS backendid) AS S, (SELECT pg_stat_get_backend_idset() AS backendid) AS S,
pg_shadow U pg_authid U
WHERE pg_stat_get_backend_dbid(S.backendid) = D.oid AND WHERE pg_stat_get_backend_dbid(S.backendid) = D.oid AND
pg_stat_get_backend_userid(S.backendid) = U.usesysid; pg_stat_get_backend_userid(S.backendid) = U.oid;
CREATE VIEW pg_stat_database AS CREATE VIEW pg_stat_database AS
SELECT SELECT
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.26 2005/04/14 20:03:23 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.27 2005/06/28 05:08:53 tgl Exp $
* *
* DESCRIPTION * DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the * The "DefineFoo" routines take the parse tree and pick out the
...@@ -295,7 +295,7 @@ RenameAggregate(List *name, TypeName *basetype, const char *newname) ...@@ -295,7 +295,7 @@ RenameAggregate(List *name, TypeName *basetype, const char *newname)
* Change aggregate owner * Change aggregate owner
*/ */
void void
AlterAggregateOwner(List *name, TypeName *basetype, AclId newOwnerSysId) AlterAggregateOwner(List *name, TypeName *basetype, Oid newOwnerId)
{ {
Oid basetypeOid; Oid basetypeOid;
Oid procOid; Oid procOid;
...@@ -329,7 +329,7 @@ AlterAggregateOwner(List *name, TypeName *basetype, AclId newOwnerSysId) ...@@ -329,7 +329,7 @@ AlterAggregateOwner(List *name, TypeName *basetype, AclId newOwnerSysId)
* If the new owner is the same as the existing owner, consider the * If the new owner is the same as the existing owner, consider the
* command to have succeeded. This is for dump restoration purposes. * command to have succeeded. This is for dump restoration purposes.
*/ */
if (procForm->proowner != newOwnerSysId) if (procForm->proowner != newOwnerId)
{ {
/* Otherwise, must be superuser to change object ownership */ /* Otherwise, must be superuser to change object ownership */
if (!superuser()) if (!superuser())
...@@ -341,7 +341,7 @@ AlterAggregateOwner(List *name, TypeName *basetype, AclId newOwnerSysId) ...@@ -341,7 +341,7 @@ AlterAggregateOwner(List *name, TypeName *basetype, AclId newOwnerSysId)
* Modify the owner --- okay to scribble on tup because it's a * Modify the owner --- okay to scribble on tup because it's a
* copy * copy
*/ */
procForm->proowner = newOwnerSysId; procForm->proowner = newOwnerId;
simple_heap_update(rel, &tup->t_self, tup); simple_heap_update(rel, &tup->t_self, tup);
CatalogUpdateIndexes(rel, tup); CatalogUpdateIndexes(rel, tup);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.12 2004/12/31 21:59:41 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.13 2005/06/28 05:08:53 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -64,10 +64,6 @@ ExecRenameStmt(RenameStmt *stmt) ...@@ -64,10 +64,6 @@ ExecRenameStmt(RenameStmt *stmt)
RenameFunction(stmt->object, stmt->objarg, stmt->newname); RenameFunction(stmt->object, stmt->objarg, stmt->newname);
break; break;
case OBJECT_GROUP:
RenameGroup(stmt->subname, stmt->newname);
break;
case OBJECT_LANGUAGE: case OBJECT_LANGUAGE:
RenameLanguage(stmt->subname, stmt->newname); RenameLanguage(stmt->subname, stmt->newname);
break; break;
...@@ -76,6 +72,10 @@ ExecRenameStmt(RenameStmt *stmt) ...@@ -76,6 +72,10 @@ ExecRenameStmt(RenameStmt *stmt)
RenameOpClass(stmt->object, stmt->subname, stmt->newname); RenameOpClass(stmt->object, stmt->subname, stmt->newname);
break; break;
case OBJECT_ROLE:
RenameRole(stmt->subname, stmt->newname);
break;
case OBJECT_SCHEMA: case OBJECT_SCHEMA:
RenameSchema(stmt->subname, stmt->newname); RenameSchema(stmt->subname, stmt->newname);
break; break;
...@@ -84,10 +84,6 @@ ExecRenameStmt(RenameStmt *stmt) ...@@ -84,10 +84,6 @@ ExecRenameStmt(RenameStmt *stmt)
RenameTableSpace(stmt->subname, stmt->newname); RenameTableSpace(stmt->subname, stmt->newname);
break; break;
case OBJECT_USER:
RenameUser(stmt->subname, stmt->newname);
break;
case OBJECT_TABLE: case OBJECT_TABLE:
case OBJECT_INDEX: case OBJECT_INDEX:
case OBJECT_COLUMN: case OBJECT_COLUMN:
...@@ -153,7 +149,7 @@ ExecRenameStmt(RenameStmt *stmt) ...@@ -153,7 +149,7 @@ ExecRenameStmt(RenameStmt *stmt)
void void
ExecAlterOwnerStmt(AlterOwnerStmt *stmt) ExecAlterOwnerStmt(AlterOwnerStmt *stmt)
{ {
AclId newowner = get_usesysid(stmt->newowner); Oid newowner = get_roleid_checked(stmt->newowner);
switch (stmt->objectType) switch (stmt->objectType)
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.18 2005/05/03 19:17:59 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.19 2005/06/28 05:08:53 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -175,7 +175,7 @@ RenameConversion(List *name, const char *newname) ...@@ -175,7 +175,7 @@ RenameConversion(List *name, const char *newname)
* Change conversion owner * Change conversion owner
*/ */
void void
AlterConversionOwner(List *name, AclId newOwnerSysId) AlterConversionOwner(List *name, Oid newOwnerId)
{ {
Oid conversionOid; Oid conversionOid;
HeapTuple tup; HeapTuple tup;
...@@ -203,7 +203,7 @@ AlterConversionOwner(List *name, AclId newOwnerSysId) ...@@ -203,7 +203,7 @@ AlterConversionOwner(List *name, AclId newOwnerSysId)
* If the new owner is the same as the existing owner, consider the * If the new owner is the same as the existing owner, consider the
* command to have succeeded. This is for dump restoration purposes. * command to have succeeded. This is for dump restoration purposes.
*/ */
if (convForm->conowner != newOwnerSysId) if (convForm->conowner != newOwnerId)
{ {
/* Otherwise, must be superuser to change object ownership */ /* Otherwise, must be superuser to change object ownership */
if (!superuser()) if (!superuser())
...@@ -215,7 +215,7 @@ AlterConversionOwner(List *name, AclId newOwnerSysId) ...@@ -215,7 +215,7 @@ AlterConversionOwner(List *name, AclId newOwnerSysId)
* Modify the owner --- okay to scribble on tup because it's a * Modify the owner --- okay to scribble on tup because it's a
* copy * copy
*/ */
convForm->conowner = newOwnerSysId; convForm->conowner = newOwnerId;
simple_heap_update(rel, &tup->t_self, tup); simple_heap_update(rel, &tup->t_self, tup);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.245 2005/06/02 01:21:22 momjian Exp $ * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.246 2005/06/28 05:08:53 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "catalog/index.h" #include "catalog/index.h"
#include "catalog/namespace.h" #include "catalog/namespace.h"
#include "catalog/pg_index.h" #include "catalog/pg_index.h"
#include "catalog/pg_shadow.h"
#include "catalog/pg_type.h" #include "catalog/pg_type.h"
#include "commands/copy.h" #include "commands/copy.h"
#include "commands/trigger.h" #include "commands/trigger.h"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.161 2005/06/25 22:47:29 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.162 2005/06/28 05:08:53 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
#include "access/genam.h" #include "access/genam.h"
#include "access/heapam.h" #include "access/heapam.h"
#include "catalog/catalog.h" #include "catalog/catalog.h"
#include "catalog/indexing.h"
#include "catalog/pg_authid.h"
#include "catalog/pg_database.h" #include "catalog/pg_database.h"
#include "catalog/pg_shadow.h"
#include "catalog/pg_tablespace.h" #include "catalog/pg_tablespace.h"
#include "catalog/indexing.h"
#include "commands/comment.h" #include "commands/comment.h"
#include "commands/dbcommands.h" #include "commands/dbcommands.h"
#include "commands/tablespace.h" #include "commands/tablespace.h"
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
/* non-export function prototypes */ /* non-export function prototypes */
static bool get_db_info(const char *name, Oid *dbIdP, int4 *ownerIdP, static bool get_db_info(const char *name, Oid *dbIdP, Oid *ownerIdP,
int *encodingP, bool *dbIsTemplateP, bool *dbAllowConnP, int *encodingP, bool *dbIsTemplateP, bool *dbAllowConnP,
Oid *dbLastSysOidP, Oid *dbLastSysOidP,
TransactionId *dbVacuumXidP, TransactionId *dbFrozenXidP, TransactionId *dbVacuumXidP, TransactionId *dbFrozenXidP,
...@@ -70,7 +70,7 @@ createdb(const CreatedbStmt *stmt) ...@@ -70,7 +70,7 @@ createdb(const CreatedbStmt *stmt)
HeapScanDesc scan; HeapScanDesc scan;
Relation rel; Relation rel;
Oid src_dboid; Oid src_dboid;
AclId src_owner; Oid src_owner;
int src_encoding; int src_encoding;
bool src_istemplate; bool src_istemplate;
bool src_allowconn; bool src_allowconn;
...@@ -85,7 +85,7 @@ createdb(const CreatedbStmt *stmt) ...@@ -85,7 +85,7 @@ createdb(const CreatedbStmt *stmt)
Datum new_record[Natts_pg_database]; Datum new_record[Natts_pg_database];
char new_record_nulls[Natts_pg_database]; char new_record_nulls[Natts_pg_database];
Oid dboid; Oid dboid;
AclId datdba; Oid datdba;
ListCell *option; ListCell *option;
DefElem *dtablespacename = NULL; DefElem *dtablespacename = NULL;
DefElem *downer = NULL; DefElem *downer = NULL;
...@@ -186,13 +186,13 @@ createdb(const CreatedbStmt *stmt) ...@@ -186,13 +186,13 @@ createdb(const CreatedbStmt *stmt)
nodeTag(dencoding->arg)); nodeTag(dencoding->arg));
} }
/* obtain sysid of proposed owner */ /* obtain OID of proposed owner */
if (dbowner) if (dbowner)
datdba = get_usesysid(dbowner); /* will ereport if no such user */ datdba = get_roleid_checked(dbowner);
else else
datdba = GetUserId(); datdba = GetUserId();
if (datdba == GetUserId()) if (is_member_of_role(GetUserId(), datdba))
{ {
/* creating database for self: can be superuser or createdb */ /* creating database for self: can be superuser or createdb */
if (!superuser() && !have_createdb_privilege()) if (!superuser() && !have_createdb_privilege())
...@@ -243,7 +243,7 @@ createdb(const CreatedbStmt *stmt) ...@@ -243,7 +243,7 @@ createdb(const CreatedbStmt *stmt)
*/ */
if (!src_istemplate) if (!src_istemplate)
{ {
if (!superuser() && GetUserId() != src_owner) if (!pg_database_ownercheck(src_dboid, GetUserId()))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied to copy database \"%s\"", errmsg("permission denied to copy database \"%s\"",
...@@ -483,7 +483,7 @@ createdb(const CreatedbStmt *stmt) ...@@ -483,7 +483,7 @@ createdb(const CreatedbStmt *stmt)
new_record[Anum_pg_database_datname - 1] = new_record[Anum_pg_database_datname - 1] =
DirectFunctionCall1(namein, CStringGetDatum(dbname)); DirectFunctionCall1(namein, CStringGetDatum(dbname));
new_record[Anum_pg_database_datdba - 1] = Int32GetDatum(datdba); new_record[Anum_pg_database_datdba - 1] = ObjectIdGetDatum(datdba);
new_record[Anum_pg_database_encoding - 1] = Int32GetDatum(encoding); new_record[Anum_pg_database_encoding - 1] = Int32GetDatum(encoding);
new_record[Anum_pg_database_datistemplate - 1] = BoolGetDatum(false); new_record[Anum_pg_database_datistemplate - 1] = BoolGetDatum(false);
new_record[Anum_pg_database_datallowconn - 1] = BoolGetDatum(true); new_record[Anum_pg_database_datallowconn - 1] = BoolGetDatum(true);
...@@ -557,9 +557,8 @@ createdb(const CreatedbStmt *stmt) ...@@ -557,9 +557,8 @@ createdb(const CreatedbStmt *stmt)
void void
dropdb(const char *dbname) dropdb(const char *dbname)
{ {
int4 db_owner;
bool db_istemplate;
Oid db_id; Oid db_id;
bool db_istemplate;
Relation pgdbrel; Relation pgdbrel;
SysScanDesc pgdbscan; SysScanDesc pgdbscan;
ScanKeyData key; ScanKeyData key;
...@@ -588,13 +587,13 @@ dropdb(const char *dbname) ...@@ -588,13 +587,13 @@ dropdb(const char *dbname)
*/ */
pgdbrel = heap_open(DatabaseRelationId, ExclusiveLock); pgdbrel = heap_open(DatabaseRelationId, ExclusiveLock);
if (!get_db_info(dbname, &db_id, &db_owner, NULL, if (!get_db_info(dbname, &db_id, NULL, NULL,
&db_istemplate, NULL, NULL, NULL, NULL, NULL)) &db_istemplate, NULL, NULL, NULL, NULL, NULL))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_DATABASE), (errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database \"%s\" does not exist", dbname))); errmsg("database \"%s\" does not exist", dbname)));
if (GetUserId() != db_owner && !superuser()) if (!pg_database_ownercheck(db_id, GetUserId()))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_DATABASE, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_DATABASE,
dbname); dbname);
...@@ -818,8 +817,7 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt) ...@@ -818,8 +817,7 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
(errcode(ERRCODE_UNDEFINED_DATABASE), (errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database \"%s\" does not exist", stmt->dbname))); errmsg("database \"%s\" does not exist", stmt->dbname)));
if (!(superuser() if (!pg_database_ownercheck(HeapTupleGetOid(tuple), GetUserId()))
|| ((Form_pg_database) GETSTRUCT(tuple))->datdba == GetUserId()))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_DATABASE, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_DATABASE,
stmt->dbname); stmt->dbname);
...@@ -878,7 +876,7 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt) ...@@ -878,7 +876,7 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
* ALTER DATABASE name OWNER TO newowner * ALTER DATABASE name OWNER TO newowner
*/ */
void void
AlterDatabaseOwner(const char *dbname, AclId newOwnerSysId) AlterDatabaseOwner(const char *dbname, Oid newOwnerId)
{ {
HeapTuple tuple; HeapTuple tuple;
Relation rel; Relation rel;
...@@ -910,7 +908,7 @@ AlterDatabaseOwner(const char *dbname, AclId newOwnerSysId) ...@@ -910,7 +908,7 @@ AlterDatabaseOwner(const char *dbname, AclId newOwnerSysId)
* command to have succeeded. This is to be consistent with other * command to have succeeded. This is to be consistent with other
* objects. * objects.
*/ */
if (datForm->datdba != newOwnerSysId) if (datForm->datdba != newOwnerId)
{ {
Datum repl_val[Natts_pg_database]; Datum repl_val[Natts_pg_database];
char repl_null[Natts_pg_database]; char repl_null[Natts_pg_database];
...@@ -930,7 +928,7 @@ AlterDatabaseOwner(const char *dbname, AclId newOwnerSysId) ...@@ -930,7 +928,7 @@ AlterDatabaseOwner(const char *dbname, AclId newOwnerSysId)
memset(repl_repl, ' ', sizeof(repl_repl)); memset(repl_repl, ' ', sizeof(repl_repl));
repl_repl[Anum_pg_database_datdba - 1] = 'r'; repl_repl[Anum_pg_database_datdba - 1] = 'r';
repl_val[Anum_pg_database_datdba - 1] = Int32GetDatum(newOwnerSysId); repl_val[Anum_pg_database_datdba - 1] = ObjectIdGetDatum(newOwnerId);
/* /*
* Determine the modified ACL for the new owner. This is only * Determine the modified ACL for the new owner. This is only
...@@ -943,7 +941,7 @@ AlterDatabaseOwner(const char *dbname, AclId newOwnerSysId) ...@@ -943,7 +941,7 @@ AlterDatabaseOwner(const char *dbname, AclId newOwnerSysId)
if (!isNull) if (!isNull)
{ {
newAcl = aclnewowner(DatumGetAclP(aclDatum), newAcl = aclnewowner(DatumGetAclP(aclDatum),
datForm->datdba, newOwnerSysId); datForm->datdba, newOwnerId);
repl_repl[Anum_pg_database_datacl - 1] = 'r'; repl_repl[Anum_pg_database_datacl - 1] = 'r';
repl_val[Anum_pg_database_datacl - 1] = PointerGetDatum(newAcl); repl_val[Anum_pg_database_datacl - 1] = PointerGetDatum(newAcl);
} }
...@@ -972,7 +970,7 @@ AlterDatabaseOwner(const char *dbname, AclId newOwnerSysId) ...@@ -972,7 +970,7 @@ AlterDatabaseOwner(const char *dbname, AclId newOwnerSysId)
*/ */
static bool static bool
get_db_info(const char *name, Oid *dbIdP, int4 *ownerIdP, get_db_info(const char *name, Oid *dbIdP, Oid *ownerIdP,
int *encodingP, bool *dbIsTemplateP, bool *dbAllowConnP, int *encodingP, bool *dbIsTemplateP, bool *dbAllowConnP,
Oid *dbLastSysOidP, Oid *dbLastSysOidP,
TransactionId *dbVacuumXidP, TransactionId *dbFrozenXidP, TransactionId *dbVacuumXidP, TransactionId *dbFrozenXidP,
...@@ -1007,7 +1005,7 @@ get_db_info(const char *name, Oid *dbIdP, int4 *ownerIdP, ...@@ -1007,7 +1005,7 @@ get_db_info(const char *name, Oid *dbIdP, int4 *ownerIdP,
/* oid of the database */ /* oid of the database */
if (dbIdP) if (dbIdP)
*dbIdP = HeapTupleGetOid(tuple); *dbIdP = HeapTupleGetOid(tuple);
/* sysid of the owner */ /* oid of the owner */
if (ownerIdP) if (ownerIdP)
*ownerIdP = dbform->datdba; *ownerIdP = dbform->datdba;
/* character encoding */ /* character encoding */
...@@ -1046,12 +1044,12 @@ have_createdb_privilege(void) ...@@ -1046,12 +1044,12 @@ have_createdb_privilege(void)
bool result = false; bool result = false;
HeapTuple utup; HeapTuple utup;
utup = SearchSysCache(SHADOWSYSID, utup = SearchSysCache(AUTHOID,
Int32GetDatum(GetUserId()), ObjectIdGetDatum(GetUserId()),
0, 0, 0); 0, 0, 0);
if (HeapTupleIsValid(utup)) if (HeapTupleIsValid(utup))
{ {
result = ((Form_pg_shadow) GETSTRUCT(utup))->usecreatedb; result = ((Form_pg_authid) GETSTRUCT(utup))->rolcreatedb;
ReleaseSysCache(utup); ReleaseSysCache(utup);
} }
return result; return result;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.61 2005/04/14 20:03:23 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.62 2005/06/28 05:08:53 tgl Exp $
* *
* DESCRIPTION * DESCRIPTION
* These routines take the parse tree and pick out the * These routines take the parse tree and pick out the
...@@ -853,7 +853,7 @@ RenameFunction(List *name, List *argtypes, const char *newname) ...@@ -853,7 +853,7 @@ RenameFunction(List *name, List *argtypes, const char *newname)
* Change function owner * Change function owner
*/ */
void void
AlterFunctionOwner(List *name, List *argtypes, AclId newOwnerSysId) AlterFunctionOwner(List *name, List *argtypes, Oid newOwnerId)
{ {
Oid procOid; Oid procOid;
HeapTuple tup; HeapTuple tup;
...@@ -882,7 +882,7 @@ AlterFunctionOwner(List *name, List *argtypes, AclId newOwnerSysId) ...@@ -882,7 +882,7 @@ AlterFunctionOwner(List *name, List *argtypes, AclId newOwnerSysId)
* If the new owner is the same as the existing owner, consider the * If the new owner is the same as the existing owner, consider the
* command to have succeeded. This is for dump restoration purposes. * command to have succeeded. This is for dump restoration purposes.
*/ */
if (procForm->proowner != newOwnerSysId) if (procForm->proowner != newOwnerId)
{ {
Datum repl_val[Natts_pg_proc]; Datum repl_val[Natts_pg_proc];
char repl_null[Natts_pg_proc]; char repl_null[Natts_pg_proc];
...@@ -902,7 +902,7 @@ AlterFunctionOwner(List *name, List *argtypes, AclId newOwnerSysId) ...@@ -902,7 +902,7 @@ AlterFunctionOwner(List *name, List *argtypes, AclId newOwnerSysId)
memset(repl_repl, ' ', sizeof(repl_repl)); memset(repl_repl, ' ', sizeof(repl_repl));
repl_repl[Anum_pg_proc_proowner - 1] = 'r'; repl_repl[Anum_pg_proc_proowner - 1] = 'r';
repl_val[Anum_pg_proc_proowner - 1] = Int32GetDatum(newOwnerSysId); repl_val[Anum_pg_proc_proowner - 1] = ObjectIdGetDatum(newOwnerId);
/* /*
* Determine the modified ACL for the new owner. This is only * Determine the modified ACL for the new owner. This is only
...@@ -914,7 +914,7 @@ AlterFunctionOwner(List *name, List *argtypes, AclId newOwnerSysId) ...@@ -914,7 +914,7 @@ AlterFunctionOwner(List *name, List *argtypes, AclId newOwnerSysId)
if (!isNull) if (!isNull)
{ {
newAcl = aclnewowner(DatumGetAclP(aclDatum), newAcl = aclnewowner(DatumGetAclP(aclDatum),
procForm->proowner, newOwnerSysId); procForm->proowner, newOwnerId);
repl_repl[Anum_pg_proc_proacl - 1] = 'r'; repl_repl[Anum_pg_proc_proacl - 1] = 'r';
repl_val[Anum_pg_proc_proacl - 1] = PointerGetDatum(newAcl); repl_val[Anum_pg_proc_proacl - 1] = PointerGetDatum(newAcl);
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.32 2005/04/14 20:03:23 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.33 2005/06/28 05:08:53 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -321,7 +321,7 @@ DefineOpClass(CreateOpClassStmt *stmt) ...@@ -321,7 +321,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
namestrcpy(&opcName, opcname); namestrcpy(&opcName, opcname);
values[i++] = NameGetDatum(&opcName); /* opcname */ values[i++] = NameGetDatum(&opcName); /* opcname */
values[i++] = ObjectIdGetDatum(namespaceoid); /* opcnamespace */ values[i++] = ObjectIdGetDatum(namespaceoid); /* opcnamespace */
values[i++] = Int32GetDatum(GetUserId()); /* opcowner */ values[i++] = ObjectIdGetDatum(GetUserId()); /* opcowner */
values[i++] = ObjectIdGetDatum(typeoid); /* opcintype */ values[i++] = ObjectIdGetDatum(typeoid); /* opcintype */
values[i++] = BoolGetDatum(stmt->isDefault); /* opcdefault */ values[i++] = BoolGetDatum(stmt->isDefault); /* opcdefault */
values[i++] = ObjectIdGetDatum(storageoid); /* opckeytype */ values[i++] = ObjectIdGetDatum(storageoid); /* opckeytype */
...@@ -880,7 +880,7 @@ RenameOpClass(List *name, const char *access_method, const char *newname) ...@@ -880,7 +880,7 @@ RenameOpClass(List *name, const char *access_method, const char *newname)
* Change opclass owner * Change opclass owner
*/ */
void void
AlterOpClassOwner(List *name, const char *access_method, AclId newOwnerSysId) AlterOpClassOwner(List *name, const char *access_method, Oid newOwnerId)
{ {
Oid opcOid; Oid opcOid;
Oid amOid; Oid amOid;
...@@ -945,7 +945,7 @@ AlterOpClassOwner(List *name, const char *access_method, AclId newOwnerSysId) ...@@ -945,7 +945,7 @@ AlterOpClassOwner(List *name, const char *access_method, AclId newOwnerSysId)
* If the new owner is the same as the existing owner, consider the * If the new owner is the same as the existing owner, consider the
* command to have succeeded. This is for dump restoration purposes. * command to have succeeded. This is for dump restoration purposes.
*/ */
if (opcForm->opcowner != newOwnerSysId) if (opcForm->opcowner != newOwnerId)
{ {
/* Otherwise, must be superuser to change object ownership */ /* Otherwise, must be superuser to change object ownership */
if (!superuser()) if (!superuser())
...@@ -957,7 +957,7 @@ AlterOpClassOwner(List *name, const char *access_method, AclId newOwnerSysId) ...@@ -957,7 +957,7 @@ AlterOpClassOwner(List *name, const char *access_method, AclId newOwnerSysId)
* Modify the owner --- okay to scribble on tup because it's a * Modify the owner --- okay to scribble on tup because it's a
* copy * copy
*/ */
opcForm->opcowner = newOwnerSysId; opcForm->opcowner = newOwnerId;
simple_heap_update(rel, &tup->t_self, tup); simple_heap_update(rel, &tup->t_self, tup);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.21 2005/04/14 20:03:24 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.22 2005/06/28 05:08:54 tgl Exp $
* *
* DESCRIPTION * DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the * The "DefineFoo" routines take the parse tree and pick out the
...@@ -269,7 +269,7 @@ RemoveOperatorById(Oid operOid) ...@@ -269,7 +269,7 @@ RemoveOperatorById(Oid operOid)
*/ */
void void
AlterOperatorOwner(List *name, TypeName *typeName1, TypeName *typeName2, AlterOperatorOwner(List *name, TypeName *typeName1, TypeName *typeName2,
AclId newOwnerSysId) Oid newOwnerId)
{ {
Oid operOid; Oid operOid;
HeapTuple tup; HeapTuple tup;
...@@ -293,7 +293,7 @@ AlterOperatorOwner(List *name, TypeName *typeName1, TypeName *typeName2, ...@@ -293,7 +293,7 @@ AlterOperatorOwner(List *name, TypeName *typeName1, TypeName *typeName2,
* If the new owner is the same as the existing owner, consider the * If the new owner is the same as the existing owner, consider the
* command to have succeeded. This is for dump restoration purposes. * command to have succeeded. This is for dump restoration purposes.
*/ */
if (oprForm->oprowner != newOwnerSysId) if (oprForm->oprowner != newOwnerId)
{ {
/* Otherwise, must be superuser to change object ownership */ /* Otherwise, must be superuser to change object ownership */
if (!superuser()) if (!superuser())
...@@ -305,7 +305,7 @@ AlterOperatorOwner(List *name, TypeName *typeName1, TypeName *typeName2, ...@@ -305,7 +305,7 @@ AlterOperatorOwner(List *name, TypeName *typeName1, TypeName *typeName2,
* Modify the owner --- okay to scribble on tup because it's a * Modify the owner --- okay to scribble on tup because it's a
* copy * copy
*/ */
oprForm->oprowner = newOwnerSysId; oprForm->oprowner = newOwnerId;
simple_heap_update(rel, &tup->t_self, tup); simple_heap_update(rel, &tup->t_self, tup);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.30 2005/06/21 00:58:15 neilc Exp $ * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.31 2005/06/28 05:08:54 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -42,11 +42,11 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) ...@@ -42,11 +42,11 @@ CreateSchemaCommand(CreateSchemaStmt *stmt)
Oid namespaceId; Oid namespaceId;
List *parsetree_list; List *parsetree_list;
ListCell *parsetree_item; ListCell *parsetree_item;
AclId owner_userid; Oid owner_uid;
AclId saved_userid; Oid saved_uid;
AclResult aclresult; AclResult aclresult;
saved_userid = GetUserId(); saved_uid = GetUserId();
/* /*
* Figure out user identities. * Figure out user identities.
...@@ -54,12 +54,11 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) ...@@ -54,12 +54,11 @@ CreateSchemaCommand(CreateSchemaStmt *stmt)
if (!authId) if (!authId)
{ {
owner_userid = saved_userid; owner_uid = saved_uid;
} }
else if (superuser()) else if (superuser())
{ {
/* The following will error out if user does not exist */ owner_uid = get_roleid_checked(authId);
owner_userid = get_usesysid(authId);
/* /*
* Set the current user to the requested authorization so that * Set the current user to the requested authorization so that
...@@ -67,15 +66,15 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) ...@@ -67,15 +66,15 @@ CreateSchemaCommand(CreateSchemaStmt *stmt)
* (This will revert to session user on error or at the end of * (This will revert to session user on error or at the end of
* this routine.) * this routine.)
*/ */
SetUserId(owner_userid); SetUserId(owner_uid);
} }
else else
{ {
const char *owner_name; const char *owner_name;
/* not superuser */ /* not superuser */
owner_userid = saved_userid; owner_uid = saved_uid;
owner_name = GetUserNameFromId(owner_userid); owner_name = GetUserNameFromId(owner_uid);
if (strcmp(authId, owner_name) != 0) if (strcmp(authId, owner_name) != 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
...@@ -87,7 +86,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) ...@@ -87,7 +86,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt)
/* /*
* Permissions checks. * Permissions checks.
*/ */
aclresult = pg_database_aclcheck(MyDatabaseId, saved_userid, ACL_CREATE); aclresult = pg_database_aclcheck(MyDatabaseId, saved_uid, ACL_CREATE);
if (aclresult != ACLCHECK_OK) if (aclresult != ACLCHECK_OK)
aclcheck_error(aclresult, ACL_KIND_DATABASE, aclcheck_error(aclresult, ACL_KIND_DATABASE,
get_database_name(MyDatabaseId)); get_database_name(MyDatabaseId));
...@@ -99,7 +98,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) ...@@ -99,7 +98,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt)
errdetail("The prefix \"pg_\" is reserved for system schemas."))); errdetail("The prefix \"pg_\" is reserved for system schemas.")));
/* Create the schema's namespace */ /* Create the schema's namespace */
namespaceId = NamespaceCreate(schemaName, owner_userid); namespaceId = NamespaceCreate(schemaName, owner_uid);
/* Advance cmd counter to make the namespace visible */ /* Advance cmd counter to make the namespace visible */
CommandCounterIncrement(); CommandCounterIncrement();
...@@ -149,7 +148,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) ...@@ -149,7 +148,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt)
PopSpecialNamespace(namespaceId); PopSpecialNamespace(namespaceId);
/* Reset current user */ /* Reset current user */
SetUserId(saved_userid); SetUserId(saved_uid);
} }
...@@ -279,7 +278,7 @@ RenameSchema(const char *oldname, const char *newname) ...@@ -279,7 +278,7 @@ RenameSchema(const char *oldname, const char *newname)
* Change schema owner * Change schema owner
*/ */
void void
AlterSchemaOwner(const char *name, AclId newOwnerSysId) AlterSchemaOwner(const char *name, Oid newOwnerId)
{ {
HeapTuple tup; HeapTuple tup;
Relation rel; Relation rel;
...@@ -300,7 +299,7 @@ AlterSchemaOwner(const char *name, AclId newOwnerSysId) ...@@ -300,7 +299,7 @@ AlterSchemaOwner(const char *name, AclId newOwnerSysId)
* If the new owner is the same as the existing owner, consider the * If the new owner is the same as the existing owner, consider the
* command to have succeeded. This is for dump restoration purposes. * command to have succeeded. This is for dump restoration purposes.
*/ */
if (nspForm->nspowner != newOwnerSysId) if (nspForm->nspowner != newOwnerId)
{ {
Datum repl_val[Natts_pg_namespace]; Datum repl_val[Natts_pg_namespace];
char repl_null[Natts_pg_namespace]; char repl_null[Natts_pg_namespace];
...@@ -320,7 +319,7 @@ AlterSchemaOwner(const char *name, AclId newOwnerSysId) ...@@ -320,7 +319,7 @@ AlterSchemaOwner(const char *name, AclId newOwnerSysId)
memset(repl_repl, ' ', sizeof(repl_repl)); memset(repl_repl, ' ', sizeof(repl_repl));
repl_repl[Anum_pg_namespace_nspowner - 1] = 'r'; repl_repl[Anum_pg_namespace_nspowner - 1] = 'r';
repl_val[Anum_pg_namespace_nspowner - 1] = Int32GetDatum(newOwnerSysId); repl_val[Anum_pg_namespace_nspowner - 1] = ObjectIdGetDatum(newOwnerId);
/* /*
* Determine the modified ACL for the new owner. This is only * Determine the modified ACL for the new owner. This is only
...@@ -332,7 +331,7 @@ AlterSchemaOwner(const char *name, AclId newOwnerSysId) ...@@ -332,7 +331,7 @@ AlterSchemaOwner(const char *name, AclId newOwnerSysId)
if (!isNull) if (!isNull)
{ {
newAcl = aclnewowner(DatumGetAclP(aclDatum), newAcl = aclnewowner(DatumGetAclP(aclDatum),
nspForm->nspowner, newOwnerSysId); nspForm->nspowner, newOwnerId);
repl_repl[Anum_pg_namespace_nspacl - 1] = 'r'; repl_repl[Anum_pg_namespace_nspacl - 1] = 'r';
repl_val[Anum_pg_namespace_nspacl - 1] = PointerGetDatum(newAcl); repl_val[Anum_pg_namespace_nspacl - 1] = PointerGetDatum(newAcl);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.161 2005/06/06 20:22:57 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.162 2005/06/28 05:08:54 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -231,9 +231,9 @@ static void ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, ...@@ -231,9 +231,9 @@ static void ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
const char *colName, TypeName *typename); const char *colName, TypeName *typename);
static void ATPostAlterTypeCleanup(List **wqueue, AlteredTableInfo *tab); static void ATPostAlterTypeCleanup(List **wqueue, AlteredTableInfo *tab);
static void ATPostAlterTypeParse(char *cmd, List **wqueue); static void ATPostAlterTypeParse(char *cmd, List **wqueue);
static void ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId); static void ATExecChangeOwner(Oid relationOid, Oid newOwnerId);
static void change_owner_recurse_to_sequences(Oid relationOid, static void change_owner_recurse_to_sequences(Oid relationOid,
int32 newOwnerSysId); Oid newOwnerId);
static void ATExecClusterOn(Relation rel, const char *indexName); static void ATExecClusterOn(Relation rel, const char *indexName);
static void ATExecDropCluster(Relation rel); static void ATExecDropCluster(Relation rel);
static void ATPrepSetTableSpace(AlteredTableInfo *tab, Relation rel, static void ATPrepSetTableSpace(AlteredTableInfo *tab, Relation rel,
...@@ -2133,8 +2133,8 @@ ATExecCmd(AlteredTableInfo *tab, Relation rel, AlterTableCmd *cmd) ...@@ -2133,8 +2133,8 @@ ATExecCmd(AlteredTableInfo *tab, Relation rel, AlterTableCmd *cmd)
AlterTableCreateToastTable(RelationGetRelid(rel), false); AlterTableCreateToastTable(RelationGetRelid(rel), false);
break; break;
case AT_ChangeOwner: /* ALTER OWNER */ case AT_ChangeOwner: /* ALTER OWNER */
/* get_usesysid raises an error if no such user */ ATExecChangeOwner(RelationGetRelid(rel),
ATExecChangeOwner(RelationGetRelid(rel), get_usesysid(cmd->name)); get_roleid_checked(cmd->name));
break; break;
case AT_ClusterOn: /* CLUSTER ON */ case AT_ClusterOn: /* CLUSTER ON */
ATExecClusterOn(rel, cmd->name); ATExecClusterOn(rel, cmd->name);
...@@ -5233,7 +5233,7 @@ ATPostAlterTypeParse(char *cmd, List **wqueue) ...@@ -5233,7 +5233,7 @@ ATPostAlterTypeParse(char *cmd, List **wqueue)
* ALTER TABLE OWNER * ALTER TABLE OWNER
*/ */
static void static void
ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId) ATExecChangeOwner(Oid relationOid, Oid newOwnerId)
{ {
Relation target_rel; Relation target_rel;
Relation class_rel; Relation class_rel;
...@@ -5277,7 +5277,7 @@ ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId) ...@@ -5277,7 +5277,7 @@ ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId)
* If the new owner is the same as the existing owner, consider the * If the new owner is the same as the existing owner, consider the
* command to have succeeded. This is for dump restoration purposes. * command to have succeeded. This is for dump restoration purposes.
*/ */
if (tuple_class->relowner != newOwnerSysId) if (tuple_class->relowner != newOwnerId)
{ {
Datum repl_val[Natts_pg_class]; Datum repl_val[Natts_pg_class];
char repl_null[Natts_pg_class]; char repl_null[Natts_pg_class];
...@@ -5297,7 +5297,7 @@ ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId) ...@@ -5297,7 +5297,7 @@ ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId)
memset(repl_repl, ' ', sizeof(repl_repl)); memset(repl_repl, ' ', sizeof(repl_repl));
repl_repl[Anum_pg_class_relowner - 1] = 'r'; repl_repl[Anum_pg_class_relowner - 1] = 'r';
repl_val[Anum_pg_class_relowner - 1] = Int32GetDatum(newOwnerSysId); repl_val[Anum_pg_class_relowner - 1] = ObjectIdGetDatum(newOwnerId);
/* /*
* Determine the modified ACL for the new owner. This is only * Determine the modified ACL for the new owner. This is only
...@@ -5309,7 +5309,7 @@ ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId) ...@@ -5309,7 +5309,7 @@ ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId)
if (!isNull) if (!isNull)
{ {
newAcl = aclnewowner(DatumGetAclP(aclDatum), newAcl = aclnewowner(DatumGetAclP(aclDatum),
tuple_class->relowner, newOwnerSysId); tuple_class->relowner, newOwnerId);
repl_repl[Anum_pg_class_relacl - 1] = 'r'; repl_repl[Anum_pg_class_relacl - 1] = 'r';
repl_val[Anum_pg_class_relacl - 1] = PointerGetDatum(newAcl); repl_val[Anum_pg_class_relacl - 1] = PointerGetDatum(newAcl);
} }
...@@ -5337,7 +5337,7 @@ ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId) ...@@ -5337,7 +5337,7 @@ ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId)
/* For each index, recursively change its ownership */ /* For each index, recursively change its ownership */
foreach(i, index_oid_list) foreach(i, index_oid_list)
ATExecChangeOwner(lfirst_oid(i), newOwnerSysId); ATExecChangeOwner(lfirst_oid(i), newOwnerId);
list_free(index_oid_list); list_free(index_oid_list);
} }
...@@ -5346,10 +5346,10 @@ ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId) ...@@ -5346,10 +5346,10 @@ ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId)
{ {
/* If it has a toast table, recurse to change its ownership */ /* If it has a toast table, recurse to change its ownership */
if (tuple_class->reltoastrelid != InvalidOid) if (tuple_class->reltoastrelid != InvalidOid)
ATExecChangeOwner(tuple_class->reltoastrelid, newOwnerSysId); ATExecChangeOwner(tuple_class->reltoastrelid, newOwnerId);
/* If it has dependent sequences, recurse to change them too */ /* If it has dependent sequences, recurse to change them too */
change_owner_recurse_to_sequences(relationOid, newOwnerSysId); change_owner_recurse_to_sequences(relationOid, newOwnerId);
} }
} }
...@@ -5366,7 +5366,7 @@ ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId) ...@@ -5366,7 +5366,7 @@ ATExecChangeOwner(Oid relationOid, int32 newOwnerSysId)
* ownership. * ownership.
*/ */
static void static void
change_owner_recurse_to_sequences(Oid relationOid, int32 newOwnerSysId) change_owner_recurse_to_sequences(Oid relationOid, Oid newOwnerId)
{ {
Relation depRel; Relation depRel;
SysScanDesc scan; SysScanDesc scan;
...@@ -5416,7 +5416,7 @@ change_owner_recurse_to_sequences(Oid relationOid, int32 newOwnerSysId) ...@@ -5416,7 +5416,7 @@ change_owner_recurse_to_sequences(Oid relationOid, int32 newOwnerSysId)
} }
/* We don't need to close the sequence while we alter it. */ /* We don't need to close the sequence while we alter it. */
ATExecChangeOwner(depForm->objid, newOwnerSysId); ATExecChangeOwner(depForm->objid, newOwnerId);
/* Now we can close it. Keep the lock till end of transaction. */ /* Now we can close it. Keep the lock till end of transaction. */
relation_close(seqRel, NoLock); relation_close(seqRel, NoLock);
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.22 2005/06/19 21:34:01 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.23 2005/06/28 05:08:54 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -208,7 +208,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt) ...@@ -208,7 +208,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
Oid tablespaceoid; Oid tablespaceoid;
char *location; char *location;
char *linkloc; char *linkloc;
AclId ownerid; Oid ownerId;
/* validate */ /* validate */
...@@ -225,12 +225,9 @@ CreateTableSpace(CreateTableSpaceStmt *stmt) ...@@ -225,12 +225,9 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
/* However, the eventual owner of the tablespace need not be */ /* However, the eventual owner of the tablespace need not be */
if (stmt->owner) if (stmt->owner)
{ ownerId = get_roleid_checked(stmt->owner);
/* No need to check result, get_usesysid() does that */
ownerid = get_usesysid(stmt->owner);
}
else else
ownerid = GetUserId(); ownerId = GetUserId();
/* Unix-ify the offered path, and strip any trailing slashes */ /* Unix-ify the offered path, and strip any trailing slashes */
location = pstrdup(stmt->location); location = pstrdup(stmt->location);
...@@ -297,7 +294,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt) ...@@ -297,7 +294,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
values[Anum_pg_tablespace_spcname - 1] = values[Anum_pg_tablespace_spcname - 1] =
DirectFunctionCall1(namein, CStringGetDatum(stmt->tablespacename)); DirectFunctionCall1(namein, CStringGetDatum(stmt->tablespacename));
values[Anum_pg_tablespace_spcowner - 1] = values[Anum_pg_tablespace_spcowner - 1] =
Int32GetDatum(ownerid); ObjectIdGetDatum(ownerId);
values[Anum_pg_tablespace_spclocation - 1] = values[Anum_pg_tablespace_spclocation - 1] =
DirectFunctionCall1(textin, CStringGetDatum(location)); DirectFunctionCall1(textin, CStringGetDatum(location));
nulls[Anum_pg_tablespace_spcacl - 1] = 'n'; nulls[Anum_pg_tablespace_spcacl - 1] = 'n';
...@@ -426,9 +423,8 @@ DropTableSpace(DropTableSpaceStmt *stmt) ...@@ -426,9 +423,8 @@ DropTableSpace(DropTableSpaceStmt *stmt)
tablespaceoid = HeapTupleGetOid(tuple); tablespaceoid = HeapTupleGetOid(tuple);
/* Must be superuser or owner */ /* Must be tablespace owner */
if (GetUserId() != ((Form_pg_tablespace) GETSTRUCT(tuple))->spcowner && if (!pg_tablespace_ownercheck(tablespaceoid, GetUserId()))
!superuser())
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TABLESPACE, aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_TABLESPACE,
tablespacename); tablespacename);
...@@ -711,8 +707,8 @@ RenameTableSpace(const char *oldname, const char *newname) ...@@ -711,8 +707,8 @@ RenameTableSpace(const char *oldname, const char *newname)
heap_endscan(scan); heap_endscan(scan);
/* Must be owner or superuser */ /* Must be owner */
if (newform->spcowner != GetUserId() && !superuser()) if (!pg_tablespace_ownercheck(HeapTupleGetOid(newtuple), GetUserId()))
aclcheck_error(ACLCHECK_NO_PRIV, ACL_KIND_TABLESPACE, oldname); aclcheck_error(ACLCHECK_NO_PRIV, ACL_KIND_TABLESPACE, oldname);
/* Validate new name */ /* Validate new name */
...@@ -750,7 +746,7 @@ RenameTableSpace(const char *oldname, const char *newname) ...@@ -750,7 +746,7 @@ RenameTableSpace(const char *oldname, const char *newname)
* Change tablespace owner * Change tablespace owner
*/ */
void void
AlterTableSpaceOwner(const char *name, AclId newOwnerSysId) AlterTableSpaceOwner(const char *name, Oid newOwnerId)
{ {
Relation rel; Relation rel;
ScanKeyData entry[1]; ScanKeyData entry[1];
...@@ -778,7 +774,7 @@ AlterTableSpaceOwner(const char *name, AclId newOwnerSysId) ...@@ -778,7 +774,7 @@ AlterTableSpaceOwner(const char *name, AclId newOwnerSysId)
* If the new owner is the same as the existing owner, consider the * If the new owner is the same as the existing owner, consider the
* command to have succeeded. This is for dump restoration purposes. * command to have succeeded. This is for dump restoration purposes.
*/ */
if (spcForm->spcowner != newOwnerSysId) if (spcForm->spcowner != newOwnerId)
{ {
Datum repl_val[Natts_pg_tablespace]; Datum repl_val[Natts_pg_tablespace];
char repl_null[Natts_pg_tablespace]; char repl_null[Natts_pg_tablespace];
...@@ -798,7 +794,7 @@ AlterTableSpaceOwner(const char *name, AclId newOwnerSysId) ...@@ -798,7 +794,7 @@ AlterTableSpaceOwner(const char *name, AclId newOwnerSysId)
memset(repl_repl, ' ', sizeof(repl_repl)); memset(repl_repl, ' ', sizeof(repl_repl));
repl_repl[Anum_pg_tablespace_spcowner - 1] = 'r'; repl_repl[Anum_pg_tablespace_spcowner - 1] = 'r';
repl_val[Anum_pg_tablespace_spcowner - 1] = Int32GetDatum(newOwnerSysId); repl_val[Anum_pg_tablespace_spcowner - 1] = ObjectIdGetDatum(newOwnerId);
/* /*
* Determine the modified ACL for the new owner. This is only * Determine the modified ACL for the new owner. This is only
...@@ -811,7 +807,7 @@ AlterTableSpaceOwner(const char *name, AclId newOwnerSysId) ...@@ -811,7 +807,7 @@ AlterTableSpaceOwner(const char *name, AclId newOwnerSysId)
if (!isNull) if (!isNull)
{ {
newAcl = aclnewowner(DatumGetAclP(aclDatum), newAcl = aclnewowner(DatumGetAclP(aclDatum),
spcForm->spcowner, newOwnerSysId); spcForm->spcowner, newOwnerId);
repl_repl[Anum_pg_tablespace_spcacl - 1] = 'r'; repl_repl[Anum_pg_tablespace_spcacl - 1] = 'r';
repl_val[Anum_pg_tablespace_spcacl - 1] = PointerGetDatum(newAcl); repl_val[Anum_pg_tablespace_spcacl - 1] = PointerGetDatum(newAcl);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.72 2005/05/06 17:24:53 tgl Exp $ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.73 2005/06/28 05:08:54 tgl Exp $
* *
* DESCRIPTION * DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the * The "DefineFoo" routines take the parse tree and pick out the
...@@ -2016,7 +2016,7 @@ GetDomainConstraints(Oid typeOid) ...@@ -2016,7 +2016,7 @@ GetDomainConstraints(Oid typeOid)
* Change the owner of a type. * Change the owner of a type.
*/ */
void void
AlterTypeOwner(List *names, AclId newOwnerSysId) AlterTypeOwner(List *names, Oid newOwnerId)
{ {
TypeName *typename; TypeName *typename;
Oid typeOid; Oid typeOid;
...@@ -2063,7 +2063,7 @@ AlterTypeOwner(List *names, AclId newOwnerSysId) ...@@ -2063,7 +2063,7 @@ AlterTypeOwner(List *names, AclId newOwnerSysId)
* If the new owner is the same as the existing owner, consider the * If the new owner is the same as the existing owner, consider the
* command to have succeeded. This is for dump restoration purposes. * command to have succeeded. This is for dump restoration purposes.
*/ */
if (typTup->typowner != newOwnerSysId) if (typTup->typowner != newOwnerId)
{ {
/* Otherwise, must be superuser to change object ownership */ /* Otherwise, must be superuser to change object ownership */
if (!superuser()) if (!superuser())
...@@ -2075,7 +2075,7 @@ AlterTypeOwner(List *names, AclId newOwnerSysId) ...@@ -2075,7 +2075,7 @@ AlterTypeOwner(List *names, AclId newOwnerSysId)
* Modify the owner --- okay to scribble on typTup because it's a * Modify the owner --- okay to scribble on typTup because it's a
* copy * copy
*/ */
typTup->typowner = newOwnerSysId; typTup->typowner = newOwnerId;
simple_heap_update(rel, &tup->t_self, tup); simple_heap_update(rel, &tup->t_self, tup);
......
This diff is collapsed.
This diff is collapsed.
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.250 2005/06/20 18:37:01 tgl Exp $ * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.251 2005/06/28 05:08:55 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -352,7 +352,7 @@ ExecCheckRTEPerms(RangeTblEntry *rte) ...@@ -352,7 +352,7 @@ ExecCheckRTEPerms(RangeTblEntry *rte)
{ {
AclMode requiredPerms; AclMode requiredPerms;
Oid relOid; Oid relOid;
AclId userid; Oid userid;
/* /*
* Only plain-relation RTEs need to be checked here. Subquery RTEs * Only plain-relation RTEs need to be checked here. Subquery RTEs
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.133 2005/05/06 17:24:53 tgl Exp $ * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.134 2005/06/28 05:08:55 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1270,7 +1270,7 @@ ExecInitAgg(Agg *node, EState *estate) ...@@ -1270,7 +1270,7 @@ ExecInitAgg(Agg *node, EState *estate)
/* Check that aggregate owner has permission to call component fns */ /* Check that aggregate owner has permission to call component fns */
{ {
HeapTuple procTuple; HeapTuple procTuple;
AclId aggOwner; Oid aggOwner;
procTuple = SearchSysCache(PROCOID, procTuple = SearchSysCache(PROCOID,
ObjectIdGetDatum(aggref->aggfnoid), ObjectIdGetDatum(aggref->aggfnoid),
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.256 2005/06/26 22:05:37 tgl Exp $ * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.257 2005/06/28 05:08:57 tgl Exp $
* *
* NOTES * NOTES
* Every node type that can appear in stored rules' parsetrees *must* * Every node type that can appear in stored rules' parsetrees *must*
...@@ -1535,7 +1535,7 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node) ...@@ -1535,7 +1535,7 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry *node)
WRITE_BOOL_FIELD(inh); WRITE_BOOL_FIELD(inh);
WRITE_BOOL_FIELD(inFromCl); WRITE_BOOL_FIELD(inFromCl);
WRITE_UINT_FIELD(requiredPerms); WRITE_UINT_FIELD(requiredPerms);
WRITE_UINT_FIELD(checkAsUser); WRITE_OID_FIELD(checkAsUser);
} }
static void static void
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.179 2005/06/26 22:05:37 tgl Exp $ * $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.180 2005/06/28 05:08:57 tgl Exp $
* *
* NOTES * NOTES
* Path and Plan nodes do not have any readfuncs support, because we * Path and Plan nodes do not have any readfuncs support, because we
...@@ -917,7 +917,7 @@ _readRangeTblEntry(void) ...@@ -917,7 +917,7 @@ _readRangeTblEntry(void)
READ_BOOL_FIELD(inh); READ_BOOL_FIELD(inh);
READ_BOOL_FIELD(inFromCl); READ_BOOL_FIELD(inFromCl);
READ_UINT_FIELD(requiredPerms); READ_UINT_FIELD(requiredPerms);
READ_UINT_FIELD(checkAsUser); READ_OID_FIELD(checkAsUser);
READ_DONE(); READ_DONE();
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment