int has_read_cl_first = 0; /* have we read S_FIRST_T? */
#ifdef WITH_SELINUX
int flask_enabled = is_selinux_enabled();
- int retval;
+ int retval = -1;
struct av_decision avd;
char *user_name = NULL;
#endif
if (get_default_context(user_name, NULL, &cf->cf_user_context))
error_e("NO CONTEXT for Linux user '%s' (SELinux user '%s')",
cf->cf_user, user_name);
- retval =
- security_compute_av(cf->cf_user_context, cf->cf_file_context,
- SECCLASS_FILE, FILE__ENTRYPOINT, &avd);
- if (retval || ((FILE__ENTRYPOINT & avd.allowed) != FILE__ENTRYPOINT)) {
+ /* we no longer need those - clean them up */
+ Free_safe(sename);
+ Free_safe(selevl);
+
+ security_class_t sec_class = string_to_security_class("file");
+ if (!sec_class) {
+ error_e("Failed to translate security class 'file'\n");
+ goto err;
+ }
+
+ access_vector_t access_vec = string_to_av_perm(sec_class, "entrypoint");
+ if (!access_vec) {
+ error_e("Failed to translate security class file\n");
+ goto err;
+ }
+
+ /* if we get here, sec_class and access_vec are both defined */
+ retval = security_compute_av(cf->cf_user_context, cf->cf_file_context,
+ sec_class, access_vec, &avd);
+
+ if (retval || ((access_vec & avd.allowed) != access_vec)) {
syslog(LOG_ERR, "ENTRYPOINT FAILED for Linux user '%s' "
"(CONTEXT %s) for file CONTEXT %s", cf->cf_user,
cf->cf_user_context, cf->cf_file_context);
goto err;
}
- Free_safe(sename);
- Free_safe(selevl);
}
#endif