diff options
author | Tom Lane | 2005-07-26 16:38:29 +0000 |
---|---|---|
committer | Tom Lane | 2005-07-26 16:38:29 +0000 |
commit | af019fb9aec0274875a10a89c68c8fecb949349f (patch) | |
tree | 21f9b389c49ef4386bc8faf9adcd26199417a806 /src/include | |
parent | f9fd1764615ed5d85fab703b0ffb0c323fe7dfd5 (diff) |
Add a role property 'rolinherit' which, when false, denotes that the role
doesn't automatically inherit the privileges of roles it is a member of;
for such a role, membership in another role can be exploited only by doing
explicit SET ROLE. The default inherit setting is TRUE, so by default
the behavior doesn't change, but creating a user with NOINHERIT gives closer
adherence to our current reading of SQL99. Documentation still lacking,
and I think the information schema needs another look.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/catalog/catversion.h | 4 | ||||
-rw-r--r-- | src/include/catalog/pg_authid.h | 22 | ||||
-rw-r--r-- | src/include/nodes/parsenodes.h | 15 | ||||
-rw-r--r-- | src/include/utils/acl.h | 3 |
4 files changed, 30 insertions, 14 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 592ea17b115..38f31b114bf 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.291 2005/07/26 00:04:18 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.292 2005/07/26 16:38:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 200507251 +#define CATALOG_VERSION_NO 200507261 #endif diff --git a/src/include/catalog/pg_authid.h b/src/include/catalog/pg_authid.h index 2ea15fea8a1..6672138d865 100644 --- a/src/include/catalog/pg_authid.h +++ b/src/include/catalog/pg_authid.h @@ -10,7 +10,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_authid.h,v 1.1 2005/06/28 05:09:05 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_authid.h,v 1.2 2005/07/26 16:38:28 tgl Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -44,6 +44,7 @@ CATALOG(pg_authid,1260) BKI_SHARED_RELATION { NameData rolname; /* name of role */ bool rolsuper; /* read this field via superuser() only! */ + bool rolinherit; /* inherit privileges from other roles? */ bool rolcreaterole; /* allowed to create more roles? */ bool rolcreatedb; /* allowed to create databases? */ bool rolcatupdate; /* allowed to alter catalogs manually? */ @@ -69,16 +70,17 @@ typedef FormData_pg_authid *Form_pg_authid; * compiler constants for pg_authid * ---------------- */ -#define Natts_pg_authid 9 +#define Natts_pg_authid 10 #define Anum_pg_authid_rolname 1 #define Anum_pg_authid_rolsuper 2 -#define Anum_pg_authid_rolcreaterole 3 -#define Anum_pg_authid_rolcreatedb 4 -#define Anum_pg_authid_rolcatupdate 5 -#define Anum_pg_authid_rolcanlogin 6 -#define Anum_pg_authid_rolpassword 7 -#define Anum_pg_authid_rolvaliduntil 8 -#define Anum_pg_authid_rolconfig 9 +#define Anum_pg_authid_rolinherit 3 +#define Anum_pg_authid_rolcreaterole 4 +#define Anum_pg_authid_rolcreatedb 5 +#define Anum_pg_authid_rolcatupdate 6 +#define Anum_pg_authid_rolcanlogin 7 +#define Anum_pg_authid_rolpassword 8 +#define Anum_pg_authid_rolvaliduntil 9 +#define Anum_pg_authid_rolconfig 10 /* ---------------- * initial contents of pg_authid @@ -87,7 +89,7 @@ typedef FormData_pg_authid *Form_pg_authid; * user choices. * ---------------- */ -DATA(insert OID = 10 ( "POSTGRES" t t t t t _null_ _null_ _null_ )); +DATA(insert OID = 10 ( "POSTGRES" t t t t t t _null_ _null_ _null_ )); #define BOOTSTRAP_SUPERUSERID 10 diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 32f9b03c585..6d388b07d31 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.285 2005/06/28 19:51:24 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.286 2005/07/26 16:38:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1139,11 +1139,24 @@ typedef struct DropPLangStmt /* ---------------------- * Create/Alter/Drop Role Statements + * + * Note: these node types are also used for the backwards-compatible + * Create/Alter/Drop User/Group statements. In the ALTER and DROP cases + * there's really no need to distinguish what the original spelling was, + * but for CREATE we mark the type because the defaults vary. * ---------------------- */ +typedef enum RoleStmtType +{ + ROLESTMT_ROLE, + ROLESTMT_USER, + ROLESTMT_GROUP +} RoleStmtType; + typedef struct CreateRoleStmt { NodeTag type; + RoleStmtType stmt_type; /* ROLE/USER/GROUP */ char *role; /* role name */ List *options; /* List of DefElem nodes */ } CreateRoleStmt; diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h index d3ef0031985..1f216009098 100644 --- a/src/include/utils/acl.h +++ b/src/include/utils/acl.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/acl.h,v 1.82 2005/07/14 21:46:30 tgl Exp $ + * $PostgreSQL: pgsql/src/include/utils/acl.h,v 1.83 2005/07/26 16:38:29 tgl Exp $ * * NOTES * An ACL array is simply an array of AclItems, representing the union @@ -210,6 +210,7 @@ extern AclMode aclmask(const Acl *acl, Oid roleid, Oid ownerId, AclMode mask, AclMaskHow how); extern int aclmembers(const Acl *acl, Oid **roleids); +extern bool has_privs_of_role(Oid member, Oid role); extern bool is_member_of_role(Oid member, Oid role); extern bool is_admin_of_role(Oid member, Oid role); extern void check_is_member_of_role(Oid member, Oid role); |