@@ -886,69 +886,3 @@ sepgsql_compute_create(const char *scontext,
886886
887887 return result ;
888888}
889-
890- /*
891- * sepgsql_check_perms
892- *
893- * It makes access control decision without userspace caching mechanism.
894- * If SELinux denied the required accesses on the pair of security labels,
895- * it raises an error or returns false.
896- *
897- * scontext: security label of the subject (mostly, peer process)
898- * tcontext: security label of the object being referenced
899- * tclass: class code (SEPG_CLASS_*) of the object being referenced
900- * required: a mask of required permissions (SEPG_<class>__<perm>)
901- * audit_name: a human-readable object name for audit logs, or NULL.
902- * abort_on_violation: true, if error shall be raised on access violation
903- */
904- bool
905- sepgsql_check_perms (const char * scontext ,
906- const char * tcontext ,
907- uint16 tclass ,
908- uint32 required ,
909- const char * audit_name ,
910- bool abort_on_violation )
911- {
912- struct av_decision avd ;
913- uint32 denied ;
914- uint32 audited ;
915- bool result = true;
916- bool enforcing ;
917-
918- sepgsql_compute_avd (scontext , tcontext , tclass , & avd );
919-
920- denied = required & ~avd .allowed ;
921-
922- if (sepgsql_get_debug_audit ())
923- audited = (denied ? denied : required );
924- else
925- audited = (denied ? (denied & avd .auditdeny )
926- : (required & avd .auditallow ));
927-
928- enforcing = sepgsql_getenforce () > 0 &&
929- (avd .flags & SELINUX_AVD_FLAGS_PERMISSIVE ) == 0 ;
930-
931- if (denied && enforcing )
932- result = false;
933-
934- /*
935- * It records a security audit for the request, if needed. But, when
936- * SE-PgSQL performs 'internal' mode, it needs to keep silent.
937- */
938- if (audited && sepgsql_mode != SEPGSQL_MODE_INTERNAL )
939- {
940- sepgsql_audit_log (denied ,
941- enforcing ,
942- scontext ,
943- tcontext ,
944- tclass ,
945- audited ,
946- audit_name );
947- }
948-
949- if (!result && abort_on_violation )
950- ereport (ERROR ,
951- (errcode (ERRCODE_INSUFFICIENT_PRIVILEGE ),
952- errmsg ("SELinux: security policy violation" )));
953- return result ;
954- }
0 commit comments