Exemplo n.º 1
0
static void modify_cipso_rules(char *file)
{
	char path[PATH_MAX];
	sprintf(path,"%s/%s", CIPSO_D_PATH, file);

	if (apply_cipso(path))
		syslog(LOG_ERR, "Failed to load cipso rules (%s) : %m", path);
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{
	int c;

	for ( ; ; ) {
		c = getopt_long(argc, argv, short_options, options, NULL);

		if (c == -1)
			break;

		switch (c) {
		case 'v':
			printf("%s (libsmack) version " PACKAGE_VERSION "\n",
			       basename(argv[0]));
			exit(0);
		case 'h':
			printf(usage, basename(argv[0]));
			exit(0);
		default:
			printf(usage, basename(argv[0]));
			exit(1);
		}
	}

	if (!smack_smackfs_path()) {
		fprintf(stderr, "SmackFS is not mounted.\n");
		exit(1);
	}

	if ((argc - optind) > 1) {
		printf(usage, basename(argv[0]));
		exit(1);
	}

	if (argc == 1) {
		if (apply_cipso(NULL))
			exit(1);
	} else {
		if (apply_cipso(argv[1]))
			exit(1);
	}

	exit(0);
}
Exemplo n.º 3
0
static int apply_all(void)
{
	if (!smack_smackfs_path()) {
		fprintf(stderr, "SmackFS is not mounted.\n");
		return -1;
	}

	if (clear())
		return -1;

	if (apply_rules(ACCESSES_D_PATH, 0))
		return -1;

	if (apply_cipso(CIPSO_D_PATH))
		return -1;

	return 0;
}
Exemplo n.º 4
0
static int apply_all(void)
{
	if (is_smackfs_mounted() != 1) {
		fprintf(stderr, "ERROR: SmackFS is not mounted.\n");
		return -1;
	}

	if (clear())
		return -1;

	if (apply_rules(ACCESSES_D_PATH, 0))
		perror("apply_rules");

	if (apply_cipso(CIPSO_D_PATH))
		perror("apply_cipso");

	return 0;
}
Exemplo n.º 5
0
int main(int argc, char **argv)
{
	if (!smack_smackfs_path()) {
		fprintf(stderr, "SmackFS is not mounted.\n");
		exit(1);
	}

	if (argc > 2) {
		fprintf(stderr, "Usage: %s <path>\n", argv[0]);
		exit(1);
	}

	if (argc == 1) {
		if (apply_cipso_file(STDIN_FILENO))
			exit(1);
	} else {
		if (apply_cipso(argv[1]))
			exit(1);
	}

	exit(0);
}