Skip to content

Commit

Permalink
Add hook
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Lunagariya <[email protected]>
  • Loading branch information
HarshLunagariya committed Dec 8, 2024
1 parent 65cedc3 commit f3f1eb3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/backend/catalog/aclchk.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ static void recordExtensionInitPrivWorker(Oid objoid, Oid classoid, int objsubid

tsql_has_linked_srv_permissions_hook_type tsql_has_linked_srv_permissions_hook = NULL;
bbf_execute_grantstmt_as_dbsecadmin_hook_type bbf_execute_grantstmt_as_dbsecadmin_hook = NULL;

pltsql_check_store_init_privs_flag_hook_type pltsql_check_store_init_privs_flag_hook = NULL;
/*
* If is_grant is true, adds the given privileges for the list of
* grantees to the existing old_acl. If is_grant is false, the
Expand Down Expand Up @@ -4687,6 +4687,9 @@ recordExtensionInitPriv(Oid objoid, Oid classoid, int objsubid, Acl *new_acl)
if (!creating_extension && !binary_upgrade_record_init_privs)
return;

if (!pltsql_check_store_init_privs_flag_hook || !((*pltsql_check_store_init_privs_flag_hook)()))
return;

recordExtensionInitPrivWorker(objoid, classoid, objsubid, new_acl);
}

Expand Down
3 changes: 3 additions & 0 deletions src/include/utils/acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ extern PGDLLEXPORT pltsql_get_object_owner_hook_type pltsql_get_object_owner_hoo
typedef bool (*is_bbf_db_ddladmin_operation_hook_type) (Oid namespaceId);
extern PGDLLEXPORT is_bbf_db_ddladmin_operation_hook_type is_bbf_db_ddladmin_operation_hook;

typedef bool (*pltsql_check_store_init_privs_flag_hook_type) (void);
extern PGDLLEXPORT pltsql_check_store_init_privs_flag_hook_type pltsql_check_store_init_privs_flag_hook;

#define IS_BBF_DB_DDLADMIN(namespaceId) \
(is_bbf_db_ddladmin_operation_hook && \
is_bbf_db_ddladmin_operation_hook(namespaceId))
Expand Down

0 comments on commit f3f1eb3

Please sign in to comment.