static int secmodel_overlay_modcmd(modcmd_t cmd, void *arg) { int error = 0; switch (cmd) { case MODULE_CMD_INIT: error = secmodel_register(&overlay_sm, SECMODEL_OVERLAY_ID, SECMODEL_OVERLAY_NAME, NULL, NULL, NULL); if (error != 0) printf("secmodel_overlay_modcmd::init: " "secmodel_register returned %d\n", error); secmodel_overlay_init(); secmodel_suser_stop(); secmodel_securelevel_stop(); secmodel_overlay_start(); sysctl_security_overlay_setup(&sysctl_overlay_log); break; case MODULE_CMD_FINI: sysctl_teardown(&sysctl_overlay_log); secmodel_overlay_stop(); error = secmodel_deregister(overlay_sm); if (error != 0) printf("secmodel_overlay_modcmd::fini: " "secmodel_deregister returned %d\n", error); break; case MODULE_CMD_AUTOUNLOAD: error = EPERM; break; default: error = ENOTTY; break; } return error; }
static int securelevel_modcmd(modcmd_t cmd, void *arg) { int error = 0; switch (cmd) { case MODULE_CMD_INIT: secmodel_securelevel_init(); error = secmodel_register(&securelevel_sm, SECMODEL_SECURELEVEL_ID, SECMODEL_SECURELEVEL_NAME, NULL, securelevel_eval, NULL); if (error != 0) printf("securelevel_modcmd::init: secmodel_register " "returned %d\n", error); secmodel_securelevel_start(); sysctl_security_securelevel_setup(&securelevel_sysctl_log); break; case MODULE_CMD_FINI: sysctl_teardown(&securelevel_sysctl_log); secmodel_securelevel_stop(); error = secmodel_deregister(securelevel_sm); if (error != 0) printf("securelevel_modcmd::fini: secmodel_deregister " "returned %d\n", error); break; case MODULE_CMD_AUTOUNLOAD: error = EPERM; break; default: error = ENOTTY; break; } return (error); }