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);
}
Пример #2
0
/*
 * Initialize the traditional NetBSD security model.
 */
void
secmodel_bsd44_init(void)
{
	secmodel_securelevel_init();
	secmodel_bsd44_curtain = 0;
}