46#define ACL_ID_PUBLIC 0
66#define ACLITEM_GET_PRIVS(item) ((item).ai_privs & 0xFFFFFFFF)
67#define ACLITEM_GET_GOPTIONS(item) (((item).ai_privs >> 32) & 0xFFFFFFFF)
68#define ACLITEM_GET_RIGHTS(item) ((item).ai_privs)
70#define ACL_GRANT_OPTION_FOR(privs) (((AclMode) (privs) & 0xFFFFFFFF) << 32)
71#define ACL_OPTION_TO_PRIVS(privs) (((AclMode) (privs) >> 32) & 0xFFFFFFFF)
73#define ACLITEM_SET_PRIVS(item,privs) \
74 ((item).ai_privs = ((item).ai_privs & ~((AclMode) 0xFFFFFFFF)) | \
75 ((AclMode) (privs) & 0xFFFFFFFF))
76#define ACLITEM_SET_GOPTIONS(item,goptions) \
77 ((item).ai_privs = ((item).ai_privs & ~(((AclMode) 0xFFFFFFFF) << 32)) | \
78 (((AclMode) (goptions) & 0xFFFFFFFF) << 32))
79#define ACLITEM_SET_RIGHTS(item,rights) \
80 ((item).ai_privs = (AclMode) (rights))
82#define ACLITEM_SET_PRIVS_GOPTIONS(item,privs,goptions) \
83 ((item).ai_privs = ((AclMode) (privs) & 0xFFFFFFFF) | \
84 (((AclMode) (goptions) & 0xFFFFFFFF) << 32))
87#define ACLITEM_ALL_PRIV_BITS ((AclMode) 0xFFFFFFFF)
88#define ACLITEM_ALL_GOPTION_BITS ((AclMode) 0xFFFFFFFF << 32)
108#define ACL_NUM(ACL) (ARR_DIMS(ACL)[0])
109#define ACL_DAT(ACL) ((AclItem *) ARR_DATA_PTR(ACL))
110#define ACL_N_SIZE(N) (ARR_OVERHEAD_NONULLS(1) + ((N) * sizeof(AclItem)))
111#define ACL_SIZE(ACL) ARR_SIZE(ACL)
116#define DatumGetAclItemP(X) ((AclItem *) DatumGetPointer(X))
117#define PG_GETARG_ACLITEM_P(n) DatumGetAclItemP(PG_GETARG_DATUM(n))
118#define PG_RETURN_ACLITEM_P(x) PG_RETURN_POINTER(x)
120#define DatumGetAclP(X) ((Acl *) PG_DETOAST_DATUM(X))
121#define DatumGetAclPCopy(X) ((Acl *) PG_DETOAST_DATUM_COPY(X))
122#define PG_GETARG_ACL_P(n) DatumGetAclP(PG_GETARG_DATUM(n))
123#define PG_GETARG_ACL_P_COPY(n) DatumGetAclPCopy(PG_GETARG_DATUM(n))
124#define PG_RETURN_ACL_P(x) PG_RETURN_POINTER(x)
129#define ACL_MODECHG_ADD 1
130#define ACL_MODECHG_DEL 2
131#define ACL_MODECHG_EQL 3
137#define ACL_INSERT_CHR 'a'
138#define ACL_SELECT_CHR 'r'
139#define ACL_UPDATE_CHR 'w'
140#define ACL_DELETE_CHR 'd'
141#define ACL_TRUNCATE_CHR 'D'
142#define ACL_REFERENCES_CHR 'x'
143#define ACL_TRIGGER_CHR 't'
144#define ACL_EXECUTE_CHR 'X'
145#define ACL_USAGE_CHR 'U'
146#define ACL_CREATE_CHR 'C'
147#define ACL_CREATE_TEMP_CHR 'T'
148#define ACL_CONNECT_CHR 'c'
149#define ACL_SET_CHR 's'
150#define ACL_ALTER_SYSTEM_CHR 'A'
151#define ACL_MAINTAIN_CHR 'm'
154#define ACL_ALL_RIGHTS_STR "arwdDxtXUCTcsAm"
159#define ACL_ALL_RIGHTS_COLUMN (ACL_INSERT|ACL_SELECT|ACL_UPDATE|ACL_REFERENCES)
160#define ACL_ALL_RIGHTS_RELATION (ACL_INSERT|ACL_SELECT|ACL_UPDATE|ACL_DELETE|ACL_TRUNCATE|ACL_REFERENCES|ACL_TRIGGER|ACL_MAINTAIN)
161#define ACL_ALL_RIGHTS_SEQUENCE (ACL_USAGE|ACL_SELECT|ACL_UPDATE)
162#define ACL_ALL_RIGHTS_DATABASE (ACL_CREATE|ACL_CREATE_TEMP|ACL_CONNECT)
163#define ACL_ALL_RIGHTS_FDW (ACL_USAGE)
164#define ACL_ALL_RIGHTS_FOREIGN_SERVER (ACL_USAGE)
165#define ACL_ALL_RIGHTS_FUNCTION (ACL_EXECUTE)
166#define ACL_ALL_RIGHTS_LANGUAGE (ACL_USAGE)
167#define ACL_ALL_RIGHTS_LARGEOBJECT (ACL_SELECT|ACL_UPDATE)
168#define ACL_ALL_RIGHTS_PARAMETER_ACL (ACL_SET|ACL_ALTER_SYSTEM)
169#define ACL_ALL_RIGHTS_SCHEMA (ACL_USAGE|ACL_CREATE)
170#define ACL_ALL_RIGHTS_TABLESPACE (ACL_CREATE)
171#define ACL_ALL_RIGHTS_TYPE (ACL_USAGE)
227 const Acl *acl,
Oid ownerId,
270 const char *objectname);
273 const char *objectname,
const char *colname);
AclResult object_aclcheck_ext(Oid classid, Oid objectid, Oid roleid, AclMode mode, bool *is_missing)
void initialize_acl(void)
void ExecuteGrantStmt(GrantStmt *stmt)
AclResult pg_largeobject_aclcheck_snapshot(Oid lobj_oid, Oid roleid, AclMode mode, Snapshot snapshot)
void RemoveRoleFromInitPriv(Oid roleid, Oid classid, Oid objid, int32 objsubid)
bool is_admin_of_role(Oid member, Oid role)
Acl * aclconcat(const Acl *left_acl, const Acl *right_acl)
Acl * aclmerge(const Acl *left_acl, const Acl *right_acl, Oid ownerId)
bool has_bypassrls_privilege(Oid roleid)
AclResult pg_class_aclcheck_ext(Oid table_oid, Oid roleid, AclMode mode, bool *is_missing)
void aclcheck_error_col(AclResult aclerr, ObjectType objtype, const char *objectname, const char *colname)
AclResult pg_attribute_aclcheck_all_ext(Oid table_oid, Oid roleid, AclMode mode, AclMaskHow how, bool *is_missing)
void recordDependencyOnNewAcl(Oid classId, Oid objectId, int32 objsubId, Oid ownerId, Acl *acl)
Oid select_best_admin(Oid member, Oid role)
Acl * acldefault(ObjectType objtype, Oid ownerId)
Oid get_role_oid_or_public(const char *rolname)
void ExecAlterDefaultPrivilegesStmt(ParseState *pstate, AlterDefaultPrivilegesStmt *stmt)
bool aclequal(const Acl *left_acl, const Acl *right_acl)
AclResult pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode, AclMaskHow how)
Acl * aclupdate(const Acl *old_acl, const AclItem *mod_aip, int modechg, Oid ownerId, DropBehavior behavior)
bool is_member_of_role(Oid member, Oid role)
AclResult pg_parameter_aclcheck(const char *name, Oid roleid, AclMode mode)
void ReplaceRoleInInitPriv(Oid oldroleid, Oid newroleid, Oid classid, Oid objid, int32 objsubid)
void select_best_grantor(Oid roleId, AclMode privileges, const Acl *acl, Oid ownerId, Oid *grantorId, AclMode *grantOptions)
bool is_member_of_role_nosuper(Oid member, Oid role)
bool has_privs_of_role(Oid member, Oid role)
Acl * make_empty_acl(void)
void recordExtObjInitPriv(Oid objoid, Oid classoid)
int aclmembers(const Acl *acl, Oid **roleids)
Acl * aclnewowner(const Acl *old_acl, Oid oldOwnerId, Oid newOwnerId)
bool member_can_set_role(Oid member, Oid role)
Acl * aclcopy(const Acl *orig_acl)
void aclitemsort(Acl *acl)
AclMode aclmask(const Acl *acl, Oid roleid, Oid ownerId, AclMode mask, AclMaskHow how)
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
AclResult pg_attribute_aclcheck(Oid table_oid, AttrNumber attnum, Oid roleid, AclMode mode)
Oid get_role_oid(const char *rolname, bool missing_ok)
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
bool object_ownercheck(Oid classid, Oid objectid, Oid roleid)
AclResult pg_attribute_aclcheck_ext(Oid table_oid, AttrNumber attnum, Oid roleid, AclMode mode, bool *is_missing)
char * get_rolespec_name(const RoleSpec *role)
void check_can_set_role(Oid member, Oid role)
AclMode pg_class_aclmask(Oid table_oid, Oid roleid, AclMode mask, AclMaskHow how)
void check_rolespec_name(const RoleSpec *role, const char *detail_msg)
void aclcheck_error_type(AclResult aclerr, Oid typeOid)
bool has_createrole_privilege(Oid roleid)
Oid get_rolespec_oid(const RoleSpec *role, bool missing_ok)
Acl * get_user_default_acl(ObjectType objtype, Oid ownerId, Oid nsp_oid)
void RemoveRoleFromObjectACL(Oid roleid, Oid classid, Oid objid)
AclResult pg_class_aclcheck(Oid table_oid, Oid roleid, AclMode mode)
HeapTuple get_rolespec_tuple(const RoleSpec *role)
void removeExtObjInitPriv(Oid objoid, Oid classoid)
static PgChecksumMode mode