psss / rpms / libselinux

Forked from rpms/libselinux 5 years ago
Clone
cc63ca7
--- libselinux-1.19.1/include/selinux/selinux.h.rhat	2004-11-09 09:14:24.000000000 -0500
cc63ca7
+++ libselinux-1.19.1/include/selinux/selinux.h	2004-11-19 11:21:37.514236820 -0500
4962db3
@@ -176,7 +176,7 @@
4962db3
 /* Match the specified media and against the media contexts 
4962db3
    configuration and set *con to refer to the resulting context.
4962db3
    Caller must free con via freecon. */
4962db3
-extern int matchmediacon(const char *path,
4962db3
+extern int matchmediacon(const char *media,
4962db3
 		 security_context_t *con);
4962db3
 
4962db3
 /*
cc63ca7
--- libselinux-1.19.1/utils/setsebool.c.rhat	2004-11-09 09:14:24.000000000 -0500
cc63ca7
+++ libselinux-1.19.1/utils/setsebool.c	2004-11-19 11:21:37.560231630 -0500
cc63ca7
@@ -35,6 +35,8 @@
cc63ca7
 
cc63ca7
 	if (strcmp(argv[1], "-P") == 0) {
cc63ca7
 		permanent = 1;
cc63ca7
+		if (argc < 3) 
cc63ca7
+			usage();
cc63ca7
 		start = 2;
cc63ca7
 	}
cc63ca7
 	else
cc63ca7
--- libselinux-1.19.1/utils/getsebool.c.rhat	2004-11-09 09:14:24.000000000 -0500
cc63ca7
+++ libselinux-1.19.1/utils/getsebool.c	2004-11-19 11:21:37.559231743 -0500
cc63ca7
@@ -83,8 +83,14 @@
cc63ca7
 			rc = -1;
cc63ca7
 			goto out;
cc63ca7
 		}
cc63ca7
-		printf("%s --> active: %d pending: %d\n", names[i],
cc63ca7
-		       active, pending);
cc63ca7
+		if (pending != active) {
cc63ca7
+			printf("%s --> %s pending: %s\n", names[i],
cc63ca7
+			       ( active ? "active" : "inactive"),
cc63ca7
+			       ( pending ? "active" : "inactive"));
cc63ca7
+		} else {
cc63ca7
+			printf("%s --> %s\n", names[i],
cc63ca7
+			       ( active ? "active" : "inactive"));
cc63ca7
+		}
cc63ca7
 	}
cc63ca7
 
cc63ca7
 out:
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/utils/avcstat.c	2004-11-19 11:21:37.558231856 -0500
cc63ca7
@@ -0,0 +1,224 @@
cc63ca7
+/*
cc63ca7
+ * avcstat - Display SELinux avc statistics.
cc63ca7
+ *
cc63ca7
+ * Copyright (C) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com>
cc63ca7
+ *
cc63ca7
+ * This program is free software; you can redistribute it and/or modify
cc63ca7
+ * it under the terms of the GNU General Public License version 2,
cc63ca7
+ * as published by the Free Software Foundation.
cc63ca7
+ *
cc63ca7
+ */
cc63ca7
+#include <stdio.h>
cc63ca7
+#include <stdlib.h>
cc63ca7
+#include <libgen.h>
cc63ca7
+#include <stdarg.h>
cc63ca7
+#include <errno.h>
cc63ca7
+#include <string.h>
cc63ca7
+#include <fcntl.h>
cc63ca7
+#include <unistd.h>
cc63ca7
+#include <signal.h>
cc63ca7
+#include <sys/types.h>
cc63ca7
+#include <sys/stat.h>
cc63ca7
+#include <sys/ioctl.h>
cc63ca7
+#include <linux/limits.h>
4962db3
+
cc63ca7
+#define DEF_STAT_FILE	"/avc/cache_stats"
cc63ca7
+#define DEF_BUF_SIZE	8192
cc63ca7
+#define HEADERS		"lookups hits misses allocations reclaims frees"
4962db3
+
cc63ca7
+struct avc_cache_stats {
cc63ca7
+	unsigned int lookups;
cc63ca7
+	unsigned int hits;
cc63ca7
+	unsigned int misses;
cc63ca7
+	unsigned int allocations;
cc63ca7
+	unsigned int reclaims;
cc63ca7
+	unsigned int frees;
cc63ca7
+};
4962db3
+
cc63ca7
+static int interval;
cc63ca7
+static int rows;
cc63ca7
+static char *progname;
cc63ca7
+static char buf[DEF_BUF_SIZE];
4962db3
+
cc63ca7
+/* selinuxfs mount point */
cc63ca7
+extern char *selinux_mnt;
4962db3
+
4962db3
+
cc63ca7
+static void die(const char *msg, ...)
cc63ca7
+{
cc63ca7
+	va_list args;
cc63ca7
+	
cc63ca7
+	fputs("ERROR: ", stderr);
cc63ca7
+	
cc63ca7
+	va_start(args, msg);
cc63ca7
+	vfprintf(stderr, msg, args);
cc63ca7
+	va_end(args);
cc63ca7
+	
cc63ca7
+	if (errno)
cc63ca7
+		fprintf(stderr, ": %s", strerror(errno));
cc63ca7
+		
cc63ca7
+	fputc('\n', stderr);
cc63ca7
+	exit(1);
cc63ca7
+}
4962db3
+
cc63ca7
+static void usage(void)
cc63ca7
+{
cc63ca7
+	printf("\nUsage: %s [-c] [-f status_file] [interval]\n\n", progname);
cc63ca7
+	printf("Display SELinux AVC statistics.  If the interval parameter is specified, the\n");
cc63ca7
+	printf("program will loop, displaying updated statistics every \'interval\' seconds.\n");
cc63ca7
+	printf("Relative values are displayed by default. Use the -c option to specify the\n");
cc63ca7
+	printf("display of cumulative values.  The -f option specifies the location of the\n");
cc63ca7
+	printf("AVC statistics file, defaulting to \'%s\%s\'.\n\n", selinux_mnt, DEF_STAT_FILE);
cc63ca7
+}
4962db3
+
cc63ca7
+static void set_window_rows(void)
cc63ca7
+{
cc63ca7
+	int ret;
cc63ca7
+	struct winsize ws;
cc63ca7
+	
cc63ca7
+	ret = ioctl(fileno(stdout), TIOCGWINSZ, &ws);
cc63ca7
+	if (ret < 0 || ws.ws_row < 3)
cc63ca7
+		ws.ws_row = 24;
cc63ca7
+	rows = ws.ws_row;
cc63ca7
+}
4962db3
+
cc63ca7
+static void sighandler(int num)
cc63ca7
+{
cc63ca7
+	if (num == SIGWINCH)
cc63ca7
+		set_window_rows();
cc63ca7
+}
cc63ca7
+
cc63ca7
+int main(int argc, char **argv)
cc63ca7
+{
cc63ca7
+	int fd, i, cumulative = 0;
cc63ca7
+	struct sigaction sa;
cc63ca7
+	char avcstatfile[PATH_MAX];
cc63ca7
+	snprintf(avcstatfile, sizeof avcstatfile, "%s%s", selinux_mnt, DEF_STAT_FILE);
cc63ca7
+	progname = basename(argv[0]);
cc63ca7
+	
cc63ca7
+	while((i = getopt(argc, argv, "cf:h?-")) != -1) {
cc63ca7
+		switch (i) {
cc63ca7
+		case 'c':
cc63ca7
+			cumulative = 1;
cc63ca7
+			break;
cc63ca7
+		case 'f':
cc63ca7
+			strncpy(avcstatfile, optarg, sizeof avcstatfile);
cc63ca7
+			break;
cc63ca7
+		case 'h':
cc63ca7
+		case '-':
cc63ca7
+			usage();
cc63ca7
+			exit(0);
cc63ca7
+		default:
cc63ca7
+			usage();
cc63ca7
+			die("unrecognized parameter", i);
cc63ca7
+		}
cc63ca7
+	}
cc63ca7
+
cc63ca7
+	if (optind < argc) {
cc63ca7
+		char *arg = argv[optind];
cc63ca7
+		unsigned int n = strtoul(arg, NULL, 10);
cc63ca7
+		
cc63ca7
+		if (errno == ERANGE) {
cc63ca7
+			usage();
cc63ca7
+			die("invalid interval \'%s\'", arg);
cc63ca7
+		}
cc63ca7
+		if (n == 0) {
cc63ca7
+			usage();
cc63ca7
+			exit (0);
cc63ca7
+		}
cc63ca7
+		interval = n;
cc63ca7
+	}
cc63ca7
+	
cc63ca7
+	sa.sa_handler = sighandler;
cc63ca7
+	sa.sa_flags = SA_RESTART;
cc63ca7
+
cc63ca7
+	i = sigaction(SIGWINCH, &sa, NULL);
cc63ca7
+	if (i < 0)
cc63ca7
+		die("sigaction");
cc63ca7
+	
cc63ca7
+	set_window_rows();
cc63ca7
+	fd = open(avcstatfile, O_RDONLY);
cc63ca7
+	if (fd < 0)
cc63ca7
+		die("open: \'%s\'", avcstatfile);
cc63ca7
+	
cc63ca7
+	for (i = 0;; i++) {
cc63ca7
+		char *line;
cc63ca7
+		ssize_t ret, parsed = 0;
cc63ca7
+		struct avc_cache_stats tot, rel, last;
cc63ca7
+		
cc63ca7
+		memset(buf, 0, DEF_BUF_SIZE);
cc63ca7
+		ret = read(fd, buf, DEF_BUF_SIZE);
cc63ca7
+		if (ret < 0)
cc63ca7
+			die("read");
cc63ca7
+			
cc63ca7
+		if (ret == 0)
cc63ca7
+			die("read: \'%s\': unexpected end of file", avcstatfile);
cc63ca7
+
cc63ca7
+		line = strtok(buf, "\n");
cc63ca7
+		if (!line)
cc63ca7
+			die("unable to parse \'%s\': end of line not found", avcstatfile); 
cc63ca7
+
cc63ca7
+		if (strcmp(line, HEADERS))
cc63ca7
+			die("unable to parse \'%s\': invalid headers", avcstatfile);
cc63ca7
+
cc63ca7
+		if (!i || !(i % (rows - 2)))
cc63ca7
+			printf("%10s %10s %10s %10s %10s %10s\n", "lookups",
cc63ca7
+			       "hits", "misses", "allocs", "reclaims", "frees");
cc63ca7
+
cc63ca7
+		memset(&tot, 0, sizeof(tot));
cc63ca7
+		
cc63ca7
+		while ((line = strtok(NULL, "\n"))) {
cc63ca7
+			struct avc_cache_stats tmp;
cc63ca7
+			
cc63ca7
+			ret = sscanf(line, "%u %u %u %u %u %u",
cc63ca7
+				     &tmp.lookups,
cc63ca7
+				     &tmp.hits,
cc63ca7
+				     &tmp.misses,
cc63ca7
+				     &tmp.allocations,
cc63ca7
+				     &tmp.reclaims,
cc63ca7
+				     &tmp.frees);
cc63ca7
+			if (ret != 6)
cc63ca7
+				die("unable to parse \'%s\': scan error", avcstatfile);
cc63ca7
+			
cc63ca7
+			tot.lookups += tmp.lookups;
cc63ca7
+			tot.hits += tmp.hits;
cc63ca7
+			tot.misses += tmp.misses;
cc63ca7
+			tot.allocations += tmp.allocations;
cc63ca7
+			tot.reclaims += tmp.reclaims;
cc63ca7
+			tot.frees += tmp.frees;
cc63ca7
+			parsed = 1;
cc63ca7
+		}
cc63ca7
+
cc63ca7
+		if (!parsed)
cc63ca7
+			die("unable to parse \'%s\': no data", avcstatfile);
cc63ca7
+
cc63ca7
+		if (cumulative || (!cumulative && !i))
cc63ca7
+			printf("%10u %10u %10u %10u %10u %10u\n",
cc63ca7
+			       tot.lookups, tot.hits, tot.misses,
cc63ca7
+			       tot.allocations, tot.reclaims, tot.frees);
cc63ca7
+		else {
cc63ca7
+			rel.lookups = tot.lookups - last.lookups;
cc63ca7
+			rel.hits = tot.hits - last.hits;
cc63ca7
+			rel.misses = tot.misses - last.misses;
cc63ca7
+			rel.allocations = tot.allocations - last.allocations;
cc63ca7
+			rel.reclaims = tot.reclaims - last.reclaims;
cc63ca7
+			rel.frees = tot.frees - last.frees;
cc63ca7
+			printf("%10u %10u %10u %10u %10u %10u\n",
cc63ca7
+			       rel.lookups, rel.hits, rel.misses,
cc63ca7
+			       rel.allocations, rel.reclaims, rel.frees);
cc63ca7
+		}
cc63ca7
+		
cc63ca7
+		if (!interval)
cc63ca7
+			break;
cc63ca7
+
cc63ca7
+		memcpy(&last, &tot, sizeof(last));
cc63ca7
+		sleep(interval);
cc63ca7
+
cc63ca7
+		ret = lseek(fd, 0, 0);
cc63ca7
+		if (ret < 0)
cc63ca7
+			die("lseek");
cc63ca7
+	}
cc63ca7
+
cc63ca7
+	close(fd);
cc63ca7
+	return 0;
cc63ca7
+}
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/rpm_execcon.3	2004-11-19 11:21:37.534234563 -0500
4962db3
@@ -0,0 +1 @@
cc63ca7
+.so man3/getexeccon.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/selinux_media_context_path.3	2004-11-19 11:21:37.551232645 -0500
4962db3
@@ -0,0 +1 @@
cc63ca7
+.so man3/selinux_binary_policy_path.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/context_user_get.3	2004-11-19 11:21:37.524235691 -0500
4962db3
@@ -0,0 +1 @@
4962db3
+.so man3/context_new.3
cc63ca7
--- libselinux-1.19.1/man/man3/getcon.3.rhat	2004-11-09 09:14:24.000000000 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/getcon.3	2004-11-19 11:21:37.526235466 -0500
4962db3
@@ -8,7 +8,9 @@
4962db3
 .br 
4962db3
 .BI "int getprevcon(security_context_t *" context );
4962db3
 .br
4962db3
-.BI "int getpidcon(pid_t pid, security_context_t *" context );
4962db3
+.BI "int getpidcon(pid_t " pid ", security_context_t *" context );
4962db3
+.br
4962db3
+.BI "int getpeercon(int " fd ", security_context_t *" context);
4962db3
 
4962db3
 .SH "DESCRIPTION"
4962db3
 .B getcon
4962db3
@@ -21,6 +23,9 @@
4962db3
 .B getpidcon
4962db3
 returns the process context for the specified PID.
4962db3
 
4962db3
+.B getpeercon
4962db3
+retrieves context of peer socket, and set *context to refer to it, which must be free'd with freecon.
4962db3
+
4962db3
 .SH "RETURN VALUE"
4962db3
 On error -1 is returned.  On success 0 is returned.
4962db3
 
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/context_user_set.3	2004-11-19 11:21:37.525235579 -0500
4962db3
@@ -0,0 +1 @@
cc63ca7
+.so man3/context_new.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/getpeercon.3	2004-11-19 11:21:37.530235014 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/getcon.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/context_type_set.3	2004-11-19 11:21:37.523235804 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/context_new.3
cc63ca7
--- libselinux-1.19.1/man/man3/get_ordered_context_list.3.rhat	2004-11-09 09:14:24.000000000 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/get_ordered_context_list.3	2004-11-19 11:29:45.211209677 -0500
4962db3
@@ -1,6 +1,6 @@
4962db3
 .TH "get_ordered_context_list" "3" "1 January 2004" "russell@coker.com.au" "SE Linux API documentation"
4962db3
 .SH "NAME"
4962db3
-get_ordered_context_list, get_default_context, query_user_context \- determine context(s) for user login sessions
cc63ca7
+get_ordered_context_list, get_default_context, get_default_context_with_role, query_user_context, manual_user_enter_context, get_default_role \- determine context(s) for user login sessions
4962db3
 
4962db3
 .SH "SYNOPSIS"
4962db3
 .B #include <selinux/selinux.h>
cc63ca7
@@ -11,10 +11,13 @@
cc63ca7
 .sp
cc63ca7
 .BI "int get_default_context(const char *" user ", security_context_t "fromcon ", security_context_t *" newcon );
cc63ca7
 .sp
cc63ca7
+.BI "int get_default_context_with_role(const char* " user ", const char *" role ", security_context_t " fromcon ", security_context_t *" newcon ");
cc63ca7
+.sp
4962db3
 .BI "int query_user_context(security_context_t *" list ", security_context_t *" newcon );
4962db3
 .sp
4962db3
 .BI "int manual_user_enter_context(const char *" user ", security_context_t *" newcon );
4962db3
-
4962db3
+.sp
4962db3
+.BI "int get_default_type(const char *" role ", char **" type );
4962db3
 
4962db3
 .SH "DESCRIPTION"
4962db3
 .B get_ordered_context_list
cc63ca7
@@ -31,14 +34,26 @@
cc63ca7
 is the same as get_ordered_context_list but only returns a single context
cc63ca7
 which has to be freed with freecon.
cc63ca7
 
cc63ca7
+.B get_default_context_with_role
cc63ca7
+Given a list of authorized security contexts for the user, query the user to select one and set *newcon to refer to it, which has to be freed with freecon.
cc63ca7
+
cc63ca7
+NOTE get_default_context_with_role is the same as get_default_context
cc63ca7
+except that it only returns a context with the specified role, returning
cc63ca7
+-1 if no such context is reachable for that user.
cc63ca7
+
cc63ca7
 .B query_user_context
cc63ca7
 takes a list of contexts, queries the user via stdin/stdout as to which context
cc63ca7
 they want, and returns a new context as selected by the user (which has to be
cc63ca7
 freed with freecon).
4962db3
 
cc63ca7
 .B manual_user_enter_context
cc63ca7
-allows the user to manually enter a context as a fallback if a list of
cc63ca7
-authorized contexts could not be obtained. Caller must free via freecon.
cc63ca7
+allows the user to manually enter a context as a fallback if a list of authorized contexts could not be obtained. Caller must free via freecon.
cc63ca7
+
4962db3
+.B get_default_type
cc63ca7
+Get the default type (domain) for 'role' and set 'type' to refer to it, which has to be freed with free.
4962db3
+
4962db3
+.B get_default_context_with_role
cc63ca7
+Given a list of authorized security contexts for the user, query the user to select one and set *newcon to refer to it, which has to be freed with freecon.
cc63ca7
 
4962db3
 .SH "RETURN VALUE"
4962db3
 0 for success and on error -1 is returned.
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/context_free.3	2004-11-19 11:21:37.515236707 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/context_new.3
cc63ca7
--- libselinux-1.19.1/man/man3/getexeccon.3.rhat	2004-11-09 09:14:24.000000000 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/getexeccon.3	2004-11-19 11:21:37.528235240 -0500
cc63ca7
@@ -8,6 +8,8 @@
cc63ca7
 .BI "int getexeccon(security_context_t *" context );
cc63ca7
 .br 
cc63ca7
 .BI "int setexeccon(security_context_t "context );
cc63ca7
+.br 
cc63ca7
+.BI "int rpm_execcon(unsigned int " verified ", const char *" filename ", char *const " argv "[] , char *const " envp "[]);
cc63ca7
 
cc63ca7
 .SH "DESCRIPTION"
cc63ca7
 .B getexeccon
cc63ca7
@@ -31,6 +33,11 @@
4962db3
 
cc63ca7
 Note: Signal handlers that perform an execve must take care to
cc63ca7
 save, reset, and restore the exec context to avoid unexpected behaviors.
cc63ca7
+.br
cc63ca7
+
cc63ca7
+.B rpm_execcon
cc63ca7
+Execute a helper for rpm in an appropriate security context.
cc63ca7
+
cc63ca7
 .SH "RETURN VALUE"
cc63ca7
 On error -1 is returned.
cc63ca7
 
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/context_range_set.3	2004-11-19 11:21:37.519236255 -0500
4962db3
@@ -0,0 +1 @@
cc63ca7
+.so man3/context_new.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/security_commit_booleans.3	2004-11-19 11:21:37.535234450 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/security_load_booleans.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/security_set_boolean.3	2004-11-19 11:21:37.542233661 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/security_load_booleans.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/selinux_failsafe_context_path.3	2004-11-19 11:21:37.549232871 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/selinux_binary_policy_path.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/security_get_boolean_pending.3	2004-11-19 11:21:37.540233886 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/security_load_booleans.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/context_role_set.3	2004-11-19 11:21:37.521236030 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/context_new.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/context_range_get.3	2004-11-19 11:21:37.518236368 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/context_new.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/context_role_get.3	2004-11-19 11:21:37.520236143 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/context_new.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/security_get_boolean_active.3	2004-11-19 11:21:37.537234225 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/security_load_booleans.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/selinux_removable_context_path.3	2004-11-19 11:21:37.552232532 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/selinux_binary_policy_path.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/set_matchpathcon_printf.3	2004-11-19 11:21:37.555232194 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/matchpathcon.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/context_new.3	2004-11-19 11:23:54.697758320 -0500
cc63ca7
@@ -0,0 +1,56 @@
cc63ca7
+.TH "context_new" "3" "15 November 2004" "dwalsh@redhat.com" "SELinux API documentation"
4962db3
+.SH "NAME"
cc63ca7
+context_new, context_str, context_free, context_type_get, context_type_set, context_range_get, context_range_set,context_role_get, context_role_set, context_user_get, context_user_set \- Routines to manipulate SELinux security contexts
4962db3
+
4962db3
+.SH "SYNOPSIS"
cc63ca7
+.B #include <selinux/context.h>
cc63ca7
+.br 
cc63ca7
+.B "context_t context_new(const char *" context_str );
4962db3
+.br 
cc63ca7
+.B "const char * context_str(context_t " con );
cc63ca7
+.br 
cc63ca7
+.B "void context_free(context_t " con );
cc63ca7
+.br 
cc63ca7
+.B "const char * context_type_get(context_t " con );
cc63ca7
+.br 
cc63ca7
+.B "const char * context_range_get(context_t " con );
cc63ca7
+.br 
cc63ca7
+.B "const char * context_role_get(context_t " con );
cc63ca7
+.br 
cc63ca7
+.B "const char * context_user_get(context_t " con );
cc63ca7
+.br 
cc63ca7
+.B "const char * context_type_set(context_t " con ", const char* " type);
cc63ca7
+.br 
cc63ca7
+.B "const char * context_range_set(context_t " con ", const char* " range);
cc63ca7
+.br 
cc63ca7
+.B "const char * context_role_set(context_t " con ", const char* " role );
cc63ca7
+.br 
cc63ca7
+.B "const char * context_user_set(context_t " con ", const char* " user );
4962db3
+
4962db3
+.SH "DESCRIPTION"
cc63ca7
+ Functions to deal with security contexts in user space.
4962db3
+
cc63ca7
+context_new
cc63ca7
+ Return a new context initialized to a context string 
4962db3
+
cc63ca7
+context_str
cc63ca7
+Return a pointer to the string value of the context_t
cc63ca7
+Valid until the next call to context_str or context_free 
cc63ca7
+for the same context_t*
cc63ca7
+
cc63ca7
+context_free
cc63ca7
+Free the storage used by a context
cc63ca7
+
cc63ca7
+context_type_get, context_range_get, context_role_get, context_user_get
cc63ca7
+Get a pointer to the string value of a context component
cc63ca7
+
cc63ca7
+NOTE: Values returned by the get functions are only valid until the next call 
cc63ca7
+to a set function or context_free() for the same context_t structure.
cc63ca7
+
cc63ca7
+context_type_set, context_range_set, context_role_set, context_user_set
cc63ca7
+Set a context component
4962db3
+
cc63ca7
+.SH "RETURN VALUE"
cc63ca7
+On success, zero is returned. On failure, -1 is returned and errno is
cc63ca7
+set appropriately.
4962db3
+
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/context_type_get.3	2004-11-19 11:21:37.522235917 -0500
4962db3
@@ -0,0 +1 @@
cc63ca7
+.so man3/context_new.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/security_get_boolean_names.3	2004-11-19 11:21:37.539233999 -0500
4962db3
@@ -0,0 +1 @@
4962db3
+.so man3/security_load_booleans.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/selinux_booleans_path.3	2004-11-19 11:21:37.545233322 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/selinux_binary_policy_path.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/checkPasswdAccess.3	2004-11-19 11:21:37.514236820 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/security_compute_av.3
cc63ca7
--- libselinux-1.19.1/man/man3/security_compute_av.3.rhat	2004-11-09 09:14:24.000000000 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/security_compute_av.3	2004-11-19 11:32:59.943237946 -0500
4962db3
@@ -15,6 +15,8 @@
4962db3
 .BI "int security_compute_relabel(security_context_t "scon ", security_context_t "tcon ", security_class_t "tclass ", security_context_t *" newcon );
4962db3
 .sp
4962db3
 .BI "int security_compute_user(security_context_t "scon ", const char *" username ", security_context_t **" con );
4962db3
+.sp
4962db3
+.BI "int checkPasswdAccess(access_vector_t " requested );
4962db3
 
4962db3
 .SH "DESCRIPTION"
4962db3
 .B security_compute_av
4962db3
@@ -42,6 +44,9 @@
4962db3
 source context. Is mainly used by
4962db3
 .B get_ordered_context_list.
4962db3
 
4962db3
+.B checkPasswdAccess
cc63ca7
+This functions is a helper functions that allows you to check for a permission in the passwd class. checkPasswdAccess uses getprevcon() for the source and target security contexts.
4962db3
+
4962db3
 .SH "RETURN VALUE"
4962db3
 0 for success and on error -1 is returned.
4962db3
 
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/selinux_binary_policy_path.3	2004-11-19 11:21:37.544233435 -0500
4962db3
@@ -0,0 +1,75 @@
4962db3
+.TH "security_get_boolean_names" "3" "15 November 2004" "dwalsh@redhat.com" "SELinux API Documentation"
4962db3
+.SH "NAME"
4962db3
+selinux_binary_policy_path,selinux_failsafe_context_path,selinux_removable_context_path,selinux_default_context_path, selinux_user_contexts_path, selinux_file_context_path, selinux_media_context_path, selinux_contexts_path, selinux_booleans_path
4962db3
+.sp
4962db3
+These functions return the paths to specific files under the 
4962db3
+   policy root directory.
4962db3
+
4962db3
+.SH "SYNOPSIS"
4962db3
+.B #include <selinux/selinux.h>
4962db3
+.sp
4962db3
+.br
4962db3
+extern const char *selinux_binary_policy_path(void);
4962db3
+.br
4962db3
+extern const char *selinux_failsafe_context_path(void);
4962db3
+.br
4962db3
+extern const char *selinux_removable_context_path(void);
4962db3
+.br
4962db3
+extern const char *selinux_default_context_path(void);
4962db3
+.br
4962db3
+extern const char *selinux_user_contexts_path(void);
4962db3
+.br
4962db3
+extern const char *selinux_file_context_path(void);
4962db3
+.br
4962db3
+extern const char *selinux_media_context_path(void);
4962db3
+.br
4962db3
+extern const char *selinux_contexts_path(void);
4962db3
+.br
4962db3
+extern const char *selinux_booleans_path(void);
4962db3
+
4962db3
+
4962db3
+.SH "DESCRIPTION"
4962db3
+
4962db3
+These functions return the paths to specific files under the 
4962db3
+   policy root directory.
4962db3
+
4962db3
+.br
4962db3
+selinux_binary_policy_path
4962db3
+.br
4962db3
+Default Binary Policy
4962db3
+.sp
4962db3
+selinux_failsafe_context_path
4962db3
+.br
4962db3
+Default failsafe context file
4962db3
+.sp
4962db3
+selinux_removable_context_path
4962db3
+.br
4962db3
+Default removeable context file
4962db3
+.sp
4962db3
+selinux_default_context_path
4962db3
+.br
4962db3
+Default context used by login programs and daemons that assume user roles.
4962db3
+.sp
4962db3
+selinux_user_contexts_path
4962db3
+.br
4962db3
+Default user context file; used by login programs for default login context
4962db3
+.sp
4962db3
+selinux_file_context_path
4962db3
+.br
4962db3
+Default file context file used restorecon
4962db3
+.sp
4962db3
+selinux_media_context_path
4962db3
+.br
4962db3
+Default media context file use to set contexts on media devices (cdrom, floppies)
4962db3
+.sp
4962db3
+selinux_contexts_path 
4962db3
+.br 
4962db3
+Parent directory of context files
4962db3
+.sp
4962db3
+selinux_booleans_path
4962db3
+.br 
4962db3
+Boolean file path, used by boolean manipulation tools
4962db3
+
4962db3
+.SH AUTHOR	
4962db3
+This manual page was written by Dan Walsh <dwalsh@redhat.com>.
4962db3
+
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/selinux_contexts_path.3	2004-11-19 11:21:37.546233209 -0500
4962db3
@@ -0,0 +1 @@
4962db3
+.so man3/selinux_binary_policy_path.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/selinux_file_context_path.3	2004-11-19 11:21:37.550232758 -0500
4962db3
@@ -0,0 +1 @@
4962db3
+.so man3/selinux_binary_policy_path.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/matchmediacon.3	2004-11-19 11:32:02.685698348 -0500
cc63ca7
@@ -0,0 +1,26 @@
cc63ca7
+.TH "matchmediacon" "3" "15 November 2004" "dwalsh@redhat.com" "SE Linux API documentation"
6864134
+.SH "NAME"
cc63ca7
+matchmediacon \- get the default security context for the specified mediatype from the policy.
6864134
+
6864134
+.SH "SYNOPSIS"
cc63ca7
+.B #include <selinux/selinux.h>
cc63ca7
+.sp
cc63ca7
+.BI "int matchmediacon(const char *" media ", security_context_t *" con);"
cc63ca7
+.br 
6864134
+
6864134
+.SH "DESCRIPTION"
cc63ca7
+.br
cc63ca7
+.B matchmediacon 
cc63ca7
+matches the specified media type with the media contexts configuration and sets the security context "con" to refer to the resulting context. 
cc63ca7
+.sp
cc63ca7
+.br
cc63ca7
+.B Note: 
cc63ca7
+   Caller must free returned security context "con" using freecon.
cc63ca7
+.SH "RETURN VALUE"
cc63ca7
+Returns 0 on success or -1 otherwise.
6864134
+
cc63ca7
+.SH Files
cc63ca7
+/etc/selinux/POLICYTYPE/contexts/files/media
6864134
+
cc63ca7
+.SH "SEE ALSO"
cc63ca7
+.BR freecon "(3)
cc63ca7
--- libselinux-1.19.1/man/man3/matchpathcon.3.rhat	2004-11-09 09:14:24.000000000 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/matchpathcon.3	2004-11-19 11:21:37.533234676 -0500
cc63ca7
@@ -5,17 +5,22 @@
cc63ca7
 .SH "SYNOPSIS"
cc63ca7
 .B #include <selinux/selinux.h>
cc63ca7
 .sp
cc63ca7
-.BI "int matchpathcon(const char *" path ", mode_t " mode ", security_context_t *" con);"
cc63ca7
+.BI "int matchpathcon(const char *" path ", mode_t " mode ", security_context_t *" con);
cc63ca7
 .br 
cc63ca7
+.BI "void set_matchpathcon_printf(void (*f)(const char *fmt, ...));"
437c89f
 
437c89f
 .SH "DESCRIPTION"
cc63ca7
 .br
cc63ca7
 .B matchpathcon 
cc63ca7
 matches the specified pathname and mode against the file contexts configuration and sets the security context "con" to refer to the resulting context. "mode" can be 0 to disable mode matching, but should be provided whenever possible, as it may affect the matching.
cc63ca7
-.sp
cc63ca7
-.br
cc63ca7
 .B Note: 
cc63ca7
    Caller must free returned security context "con" using freecon.
6864134
+
cc63ca7
+.B set_matchpathcon_printf
6864134
+
cc63ca7
+Set the function used by matchpathcon when displaying errors about the file_contexts configuration.  If not set, then this defaults to fprintf(stderr, fmt, ...).
cc63ca7
+.sp
cc63ca7
+.br
cc63ca7
 .SH "RETURN VALUE"
cc63ca7
 Returns 0 on success or -1 otherwise.
cc63ca7
 
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/security_load_booleans.3	2004-11-19 11:35:47.204365772 -0500
cc63ca7
@@ -0,0 +1,61 @@
cc63ca7
+.TH "security_get_boolean_names" "3" "15 November 2004" "dwalsh@redhat.com" "SELinux API Documentation"
cc63ca7
+.SH "NAME"
cc63ca7
+security_load_booleans, security_set_boolean, security_commit_booleans, 
cc63ca7
+security_get_boolean_names, security_get_boolean_active, security_get_boolean_pending 
cc63ca7
+.sp
cc63ca7
+routines for manipulating SELinux boolean values
6864134
+
cc63ca7
+.SH "SYNOPSIS"
cc63ca7
+.B #include <selinux/selinux.h>
cc63ca7
+.sp
cc63ca7
+extern int security_load_booleans(char *path);
cc63ca7
+.br
cc63ca7
+extern int security_get_boolean_names(char ***names, int *len);
cc63ca7
+.br
cc63ca7
+extern int security_get_boolean_pending(const char *name);
cc63ca7
+.br
cc63ca7
+extern int security_get_boolean_active(const char *name);
cc63ca7
+.br
cc63ca7
+extern int security_set_boolean(const char *name, int value);
cc63ca7
+.br
cc63ca7
+extern int security_commit_booleans(void);
6864134
+
6864134
+
cc63ca7
+.SH "DESCRIPTION"
6864134
+
cc63ca7
+The SELinux policy can include conditional rules that are enabled or
cc63ca7
+disabled based on the current values of a set of policy booleans.
cc63ca7
+These policy booleans allow runtime modification of the security
cc63ca7
+policy without having to load a new policy.  
6864134
+
cc63ca7
+The SELinux API allows for a transaction based update.  So you can set several boolean values and the commit them all at once.
6864134
+
cc63ca7
+security_load_booleans
cc63ca7
+.br
cc63ca7
+Load policy boolean settings. Path may be NULL, in which case the booleans are loaded from the active policy boolean configuration file.
6864134
+
cc63ca7
+security_get_boolean_names
cc63ca7
+.br
cc63ca7
+Returns a list of boolean names, currently supported by the loaded policy.
6864134
+
cc63ca7
+security_set_boolean 
cc63ca7
+.br
cc63ca7
+Sets the pending value for boolean 
6864134
+
cc63ca7
+security_get_boolean_pending
cc63ca7
+.br
cc63ca7
+Return pending value for boolean
6864134
+
cc63ca7
+security_get_boolean_active
cc63ca7
+.br
cc63ca7
+Return active value for boolean
6864134
+
cc63ca7
+security_commit_booleans
cc63ca7
+.br
cc63ca7
+Commit all pending values for the booleans.
6864134
+
cc63ca7
+.SH AUTHOR	
cc63ca7
+This manual page was written by Dan Walsh <dwalsh@redhat.com>.
6864134
+
cc63ca7
+.SH "SEE ALSO"
cc63ca7
+getsebool(8), booleans(8), togglesebool(8)
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/selinux_default_context_path.3	2004-11-19 11:21:37.547233097 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/selinux_binary_policy_path.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/get_default_context_with_role.3	2004-11-19 11:21:37.527235353 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/get_ordered_context_list.3
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man3/selinux_user_contexts_path.3	2004-11-19 11:21:37.554232307 -0500
cc63ca7
@@ -0,0 +1 @@
cc63ca7
+.so man3/selinux_binary_policy_path.3
cc63ca7
--- libselinux-1.19.1/man/man8/getsebool.8.rhat	2004-11-09 09:14:24.000000000 -0500
cc63ca7
+++ libselinux-1.19.1/man/man8/getsebool.8	2004-11-19 11:21:37.557231968 -0500
cc63ca7
@@ -8,13 +8,12 @@
437c89f
 
cc63ca7
 .SH "DESCRIPTION"
cc63ca7
 .B getsebool 
cc63ca7
-reports the current state of either a particular SELinux boolean or
cc63ca7
-all SELinux booleans.  The state consists of two values, the active
cc63ca7
-value and the pending value.  The active value indicates the value
cc63ca7
-that is presently applied to the policy.  The pending value indicates
cc63ca7
+reports where a particular SELinux boolean or
cc63ca7
+all SELinux booleans are active or inactive.  
cc63ca7
+In certain situations a boolean can be in one state with a pending 
cc63ca7
+change to the other state.  getsebool will report this as a pending change.
cc63ca7
+The pending value indicates
cc63ca7
 the value that will be applied upon the next boolean commit.
cc63ca7
-Typically, these values will be the same; they only differ when in the
cc63ca7
-middle of a boolean change transaction.
38be80f
 
cc63ca7
 The setting of boolean values occurs in two stages; first the pending
cc63ca7
 value is changed, then the booleans are committed, causing their
cc63ca7
--- /dev/null	2004-11-19 04:10:22.696886456 -0500
cc63ca7
+++ libselinux-1.19.1/man/man8/avcstat.8	2004-11-19 11:21:37.556232081 -0500
cc63ca7
@@ -0,0 +1,28 @@
cc63ca7
+.TH "avcstat" "8" "18 Nov 2004" "dwalsh@redhat.com" "SELinux Command Line documentation"
cc63ca7
+.SH "NAME"
cc63ca7
+avcstat \- Display SELinux AVC statistics
cc63ca7
+
cc63ca7
+.SH "SYNOPSIS"
cc63ca7
+.B avcstat
cc63ca7
+.I [-c] [-f status_file] [interval]
cc63ca7
+
cc63ca7
+.SH "DESCRIPTION"
cc63ca7
+.B avcstat 
cc63ca7
+
cc63ca7
+Display SELinux AVC statistics.  If the interval parameter is specified, the
cc63ca7
+program will loop, displaying updated statistics every 'interval' seconds.
cc63ca7
+Relative values are displayed by default. 
cc63ca7
+
cc63ca7
+.SH OPTIONS
cc63ca7
+.TP
cc63ca7
+.B \-c
cc63ca7
+Display the cumulative values.
cc63ca7
+
cc63ca7
+.TP
cc63ca7
+.B \-f
cc63ca7
+Specifies the location of the AVC statistics file, defaulting to '/selinux/avc/cache_stats'.
cc63ca7
+
cc63ca7
+.SH AUTHOR	
cc63ca7
+This manual page was written by Dan Walsh <dwalsh@redhat.com>.
cc63ca7
+The program was written by James Morris <jmorris@redhat.com>.
cc63ca7
+