mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Restructure aclcheck error reporting to make permission-failure
messages more uniform and internationalizable: the global array aclcheck_error_strings[] is gone in favor of a subroutine aclcheck_error(). Partial implementation of namespace-related permission checks --- not all done yet.
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.151 2002/04/24 02:48:55 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.152 2002/04/27 03:45:03 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -124,9 +124,10 @@ CheckDropPermissions(RangeVar *rel, char rightkind)
|
||||
if (classform->relkind != rightkind)
|
||||
DropErrorMsg(rel->relname, classform->relkind, rightkind);
|
||||
|
||||
if (!pg_class_ownercheck(relOid, GetUserId()))
|
||||
elog(ERROR, "you do not own %s \"%s\"",
|
||||
rentry->name, rel->relname);
|
||||
/* Allow DROP to either table owner or schema owner */
|
||||
if (!pg_class_ownercheck(relOid, GetUserId()) &&
|
||||
!pg_namespace_ownercheck(classform->relnamespace, GetUserId()))
|
||||
aclcheck_error(ACLCHECK_NOT_OWNER, rel->relname);
|
||||
|
||||
if (!allowSystemTableMods && IsSystemClass(classform))
|
||||
elog(ERROR, "%s \"%s\" is a system %s",
|
||||
@@ -149,8 +150,7 @@ CheckOwnership(RangeVar *rel, bool noCatalogs)
|
||||
elog(ERROR, "Relation \"%s\" does not exist", rel->relname);
|
||||
|
||||
if (!pg_class_ownercheck(relOid, GetUserId()))
|
||||
elog(ERROR, "%s: %s", rel->relname,
|
||||
aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
|
||||
aclcheck_error(ACLCHECK_NOT_OWNER, rel->relname);
|
||||
|
||||
if (noCatalogs)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user