diff options
author | Robert Haas | 2012-03-09 20:18:45 +0000 |
---|---|---|
committer | Robert Haas | 2012-03-09 20:18:45 +0000 |
commit | e914a144d3aaa0a09e0aab031d7e6f58389401ce (patch) | |
tree | 09d5d2c29e546764eb0562067ab3359ce2e4f9d6 /contrib/sepgsql/proc.c | |
parent | 07d1edb954bc8f5d0e2c010dec8482328af38cb8 (diff) |
sepgsql DROP support.
KaiGai Kohei
Diffstat (limited to 'contrib/sepgsql/proc.c')
-rw-r--r-- | contrib/sepgsql/proc.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/contrib/sepgsql/proc.c b/contrib/sepgsql/proc.c index b902797d8fb..1efbc906c6b 100644 --- a/contrib/sepgsql/proc.c +++ b/contrib/sepgsql/proc.c @@ -131,6 +131,48 @@ sepgsql_proc_post_create(Oid functionId) } /* + * sepgsql_proc_drop + * + * It checks privileges to drop the supplied function. + */ +void +sepgsql_proc_drop(Oid functionId) +{ + ObjectAddress object; + char *audit_name; + + /* + * check db_schema:{remove_name} permission + */ + object.classId = NamespaceRelationId; + object.objectId = get_func_namespace(functionId); + object.objectSubId = 0; + audit_name = getObjectDescription(&object); + + sepgsql_avc_check_perms(&object, + SEPG_CLASS_DB_SCHEMA, + SEPG_DB_SCHEMA__REMOVE_NAME, + audit_name, + true); + pfree(audit_name); + + /* + * check db_procedure:{drop} permission + */ + object.classId = ProcedureRelationId; + object.objectId = functionId; + object.objectSubId = 0; + audit_name = getObjectDescription(&object); + + sepgsql_avc_check_perms(&object, + SEPG_CLASS_DB_PROCEDURE, + SEPG_DB_PROCEDURE__DROP, + audit_name, + true); + pfree(audit_name); +} + +/* * sepgsql_proc_relabel * * It checks privileges to relabel the supplied function |