diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-28 05:09:14 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-28 05:09:14 +0000 |
commit | 7762619e95272974f90a38d8d85aafbe0e94add5 (patch) | |
tree | d7f756687beb883406489d59d13f722995fd7660 /src/backend/catalog/namespace.c | |
parent | 977530d8da2683dff036c2994395ab518527b93e (diff) | |
download | postgresql-7762619e95272974f90a38d8d85aafbe0e94add5.tar.gz postgresql-7762619e95272974f90a38d8d85aafbe0e94add5.zip |
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.
Diffstat (limited to 'src/backend/catalog/namespace.c')
-rw-r--r-- | src/backend/catalog/namespace.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c index 3cfcc6f9b46..6b12bda6615 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -13,7 +13,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * 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 @@ #include "access/xact.h" #include "catalog/dependency.h" #include "catalog/namespace.h" +#include "catalog/pg_authid.h" #include "catalog/pg_conversion.h" #include "catalog/pg_namespace.h" #include "catalog/pg_opclass.h" #include "catalog/pg_operator.h" #include "catalog/pg_proc.h" -#include "catalog/pg_shadow.h" #include "catalog/pg_type.h" #include "commands/dbcommands.h" #include "lib/stringinfo.h" @@ -1499,7 +1499,7 @@ FindDefaultConversionProc(int4 for_encoding, int4 to_encoding) static void recomputeNamespacePath(void) { - AclId userId = GetUserId(); + Oid roleid = GetUserId(); char *rawname; List *namelist; List *oidlist; @@ -1511,7 +1511,7 @@ recomputeNamespacePath(void) /* * Do nothing if path is already valid. */ - if (namespaceSearchPathValid && namespaceUser == userId) + if (namespaceSearchPathValid && namespaceUser == roleid) return; /* Need a modifiable copy of namespace_search_path string */ @@ -1542,21 +1542,21 @@ recomputeNamespacePath(void) /* $user --- substitute namespace matching user name, if any */ HeapTuple tuple; - tuple = SearchSysCache(SHADOWSYSID, - ObjectIdGetDatum(userId), + tuple = SearchSysCache(AUTHOID, + ObjectIdGetDatum(roleid), 0, 0, 0); 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, - CStringGetDatum(uname), + CStringGetDatum(rname), 0, 0, 0); ReleaseSysCache(tuple); if (OidIsValid(namespaceId) && !list_member_oid(oidlist, namespaceId) && - pg_namespace_aclcheck(namespaceId, userId, + pg_namespace_aclcheck(namespaceId, roleid, ACL_USAGE) == ACLCHECK_OK) oidlist = lappend_oid(oidlist, namespaceId); } @@ -1569,7 +1569,7 @@ recomputeNamespacePath(void) 0, 0, 0); if (OidIsValid(namespaceId) && !list_member_oid(oidlist, namespaceId) && - pg_namespace_aclcheck(namespaceId, userId, + pg_namespace_aclcheck(namespaceId, roleid, ACL_USAGE) == ACLCHECK_OK) oidlist = lappend_oid(oidlist, namespaceId); } @@ -1622,7 +1622,7 @@ recomputeNamespacePath(void) /* Mark the path valid. */ namespaceSearchPathValid = true; - namespaceUser = userId; + namespaceUser = roleid; /* Clean up. */ pfree(rawname); @@ -1674,7 +1674,7 @@ InitTempTableNamespace(void) * that access the temp namespace for my own backend skip * permissions checks on it. */ - namespaceId = NamespaceCreate(namespaceName, BOOTSTRAP_USESYSID); + namespaceId = NamespaceCreate(namespaceName, BOOTSTRAP_SUPERUSERID); /* Advance command counter to make namespace visible */ CommandCounterIncrement(); } |