aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-06-09 15:26:40 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2013-06-09 15:26:40 -0400
commitf3839ea117fba6fdb69c75a1fe145aa86a4c8ae3 (patch)
treea9f477f972f6897d5b1fef01a1c4eaa1b93fd29e /src
parent007556bf08e6153c442fe3742adb3685fca3a0e0 (diff)
downloadpostgresql-f3839ea117fba6fdb69c75a1fe145aa86a4c8ae3.tar.gz
postgresql-f3839ea117fba6fdb69c75a1fe145aa86a4c8ae3.zip
Remove ALTER DEFAULT PRIVILEGES' requirement of schema CREATE permissions.
Per discussion, this restriction isn't needed for any real security reason, and it seems to confuse people more often than it helps them. It could also result in some database states being unrestorable. So just drop it. Back-patch to 9.0, where ALTER DEFAULT PRIVILEGES was introduced.
Diffstat (limited to 'src')
-rw-r--r--src/backend/catalog/aclchk.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index cb9b75aa092..ced66b127b9 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -1039,27 +1039,26 @@ SetDefaultACLsInSchemas(InternalDefaultACL *iacls, List *nspnames)
}
else
{
- /* Look up the schema OIDs and do permissions checks */
+ /* Look up the schema OIDs and set permissions for each one */
ListCell *nspcell;
foreach(nspcell, nspnames)
{
char *nspname = strVal(lfirst(nspcell));
- AclResult aclresult;
- /*
- * Note that we must do the permissions check against the target
- * role not the calling user. We require CREATE privileges, since
- * without CREATE you won't be able to do anything using the
- * default privs anyway.
- */
iacls->nspid = get_namespace_oid(nspname, false);
- aclresult = pg_namespace_aclcheck(iacls->nspid, iacls->roleid,
- ACL_CREATE);
- if (aclresult != ACLCHECK_OK)
- aclcheck_error(aclresult, ACL_KIND_NAMESPACE,
- nspname);
+ /*
+ * We used to insist that the target role have CREATE privileges
+ * on the schema, since without that it wouldn't be able to create
+ * an object for which these default privileges would apply.
+ * However, this check proved to be more confusing than helpful,
+ * and it also caused certain database states to not be
+ * dumpable/restorable, since revoking CREATE doesn't cause
+ * default privileges for the schema to go away. So now, we just
+ * allow the ALTER; if the user lacks CREATE he'll find out when
+ * he tries to create an object.
+ */
SetDefaultACL(iacls);
}