e1e36a0
diff --exclude-from=exclude -N -u -r nsalibselinux/include/selinux/av_permissions.h libselinux-2.0.46/include/selinux/av_permissions.h
c4aa29e
--- nsalibselinux/include/selinux/av_permissions.h	2007-11-15 15:52:46.000000000 -0500
831e63b
+++ libselinux-2.0.46/include/selinux/av_permissions.h	2008-01-10 13:25:57.000000000 -0500
c4aa29e
@@ -900,6 +900,8 @@
c4aa29e
 #define PACKET__SEND                              0x00000001UL
c4aa29e
 #define PACKET__RECV                              0x00000002UL
c4aa29e
 #define PACKET__RELABELTO                         0x00000004UL
c4aa29e
+#define PACKET__FLOW_IN                           0x00000008UL
c4aa29e
+#define PACKET__FLOW_OUT                          0x00000010UL
c4aa29e
 #define KEY__VIEW                                 0x00000001UL
c4aa29e
 #define KEY__READ                                 0x00000002UL
c4aa29e
 #define KEY__WRITE                                0x00000004UL
831e63b
diff --exclude-from=exclude -N -u -r nsalibselinux/src/audit2why.c libselinux-2.0.46/src/audit2why.c
831e63b
--- nsalibselinux/src/audit2why.c	1969-12-31 19:00:00.000000000 -0500
831e63b
+++ libselinux-2.0.46/src/audit2why.c	2008-01-10 13:31:17.000000000 -0500
831e63b
@@ -0,0 +1,462 @@
831e63b
+#include <unistd.h>
831e63b
+#include <stdlib.h>
831e63b
+#include <ctype.h>
831e63b
+#include <errno.h>
831e63b
+#include <getopt.h>
831e63b
+#include <limits.h>
831e63b
+#include <sepol/sepol.h>
831e63b
+#include <sepol/policydb/services.h>
831e63b
+#include <Python.h>
831e63b
+#include <selinux/selinux.h>
831e63b
+
831e63b
+#define UNKNOWN -1
831e63b
+#define BADSCON -2
831e63b
+#define BADTCON -3
831e63b
+#define BADTCLASS -4
831e63b
+#define BADPERM -5
831e63b
+#define BADCOMPUTE -6
831e63b
+#define NOPOLICY -7
831e63b
+#define ALLOW 0
831e63b
+#define DONTAUDIT 1
831e63b
+#define TERULE 2
831e63b
+#define BOOLEAN 3
831e63b
+#define CONSTRAINT 4
831e63b
+#define RBAC 5
831e63b
+
831e63b
+struct boolean_t {
831e63b
+	char *name;
831e63b
+	int active;
831e63b
+};
831e63b
+
831e63b
+static struct boolean_t **boollist = NULL;
831e63b
+static int boolcnt = 0;
831e63b
+
831e63b
+struct avc_t {
831e63b
+	sepol_handle_t *handle;
831e63b
+	policydb_t policydb;
831e63b
+	sepol_security_id_t ssid;
831e63b
+	sepol_security_id_t tsid;
831e63b
+	sepol_security_class_t tclass;
831e63b
+	sepol_access_vector_t av;
831e63b
+};
831e63b
+
831e63b
+static struct avc_t *avc = NULL;
831e63b
+
831e63b
+static sidtab_t sidtab;
831e63b
+
831e63b
+static int load_booleans(const sepol_bool_t * boolean,
831e63b
+			 void *arg __attribute__ ((__unused__)))
831e63b
+{
831e63b
+	boollist[boolcnt] =
831e63b
+	    (struct boolean_t *)malloc(sizeof(struct boolean_t));
831e63b
+	boollist[boolcnt]->name = strdup(sepol_bool_get_name(boolean));
831e63b
+	boollist[boolcnt]->active = sepol_bool_get_value(boolean);
831e63b
+	boolcnt++;
831e63b
+	return 0;
831e63b
+}
831e63b
+
831e63b
+static int check_booleans(struct avc_t *avc, struct boolean_t ***bools)
831e63b
+{
831e63b
+	char errormsg[PATH_MAX];
831e63b
+	struct sepol_av_decision avd;
831e63b
+	unsigned int reason;
831e63b
+	int rc;
831e63b
+	int i;
831e63b
+	sepol_bool_key_t *key = NULL;
831e63b
+	sepol_bool_t *boolean = NULL;
831e63b
+	int fcnt = 0;
831e63b
+	int *foundlist = calloc(boolcnt, sizeof(int));
831e63b
+	if (!foundlist) {
831e63b
+		PyErr_SetString( PyExc_MemoryError, "Out of memory\n");
831e63b
+		return fcnt;
831e63b
+	}
831e63b
+	for (i = 0; i < boolcnt; i++) {
831e63b
+		char *name = boollist[i]->name;
831e63b
+		int active = boollist[i]->active;
831e63b
+		rc = sepol_bool_key_create(avc->handle, name, &key);
831e63b
+		if (rc < 0) {
831e63b
+			PyErr_SetString( PyExc_RuntimeError, 
831e63b
+					 "Could not create boolean key.\n");
831e63b
+			break;
831e63b
+		}
831e63b
+		rc = sepol_bool_query(avc->handle,
831e63b
+				      (sepol_policydb_t *) & avc->policydb,
831e63b
+				      key, &boolean);
831e63b
+
831e63b
+		if (rc < 0) {
831e63b
+			snprintf(errormsg, sizeof(errormsg), 
831e63b
+				 "Could not find boolean %s.\n", name);
831e63b
+			PyErr_SetString( PyExc_RuntimeError, errormsg);
831e63b
+			break;
831e63b
+		}
831e63b
+
831e63b
+		sepol_bool_set_value(boolean, !active);
831e63b
+
831e63b
+		rc = sepol_bool_set(avc->handle,
831e63b
+				    (sepol_policydb_t *) & avc->policydb,
831e63b
+				    key, boolean);
831e63b
+		if (rc < 0) {
831e63b
+			snprintf(errormsg, sizeof(errormsg), 
831e63b
+				 "Could not set boolean data %s.\n", name);
831e63b
+			PyErr_SetString( PyExc_RuntimeError, errormsg);
831e63b
+			break;
831e63b
+		}
831e63b
+
831e63b
+		/* Reproduce the computation. */
831e63b
+		rc = sepol_compute_av_reason(avc->ssid, avc->tsid, avc->tclass,
831e63b
+					     avc->av, &avd, &reason);
831e63b
+		if (rc < 0) {
831e63b
+			snprintf(errormsg, sizeof(errormsg), 
831e63b
+				 "Error during access vector computation, skipping...");
831e63b
+			PyErr_SetString( PyExc_RuntimeError, errormsg);
831e63b
+
831e63b
+			sepol_bool_free(boolean);
831e63b
+			break;
831e63b
+		} else {
831e63b
+			if (!reason) {
831e63b
+				foundlist[fcnt] = i;
831e63b
+				fcnt++;
831e63b
+			}
831e63b
+			sepol_bool_set_value((sepol_bool_t *) boolean, active);
831e63b
+			rc = sepol_bool_set(avc->handle,
831e63b
+					    (sepol_policydb_t *) & avc->
831e63b
+					    policydb, key,
831e63b
+					    (sepol_bool_t *) boolean);
831e63b
+			if (rc < 0) {
831e63b
+				snprintf(errormsg, sizeof(errormsg), 
831e63b
+					 "Could not set boolean data %s.\n",
831e63b
+					 name);
831e63b
+			
831e63b
+				PyErr_SetString( PyExc_RuntimeError, errormsg);
831e63b
+				break;
831e63b
+			}
831e63b
+		}
831e63b
+		sepol_bool_free(boolean);
831e63b
+		sepol_bool_key_free(key);
831e63b
+		key = NULL;
831e63b
+		boolean = NULL;
831e63b
+	}
831e63b
+	if (key)
831e63b
+		sepol_bool_key_free(key);
831e63b
+
831e63b
+	if (boolean)
831e63b
+		sepol_bool_free(boolean);
831e63b
+
831e63b
+	if (fcnt > 0) {
831e63b
+		*bools = (struct boolean_t **)
831e63b
+			calloc(sizeof(struct boolean_t), fcnt + 1);
831e63b
+		struct boolean_t *b = (struct boolean_t *) *bools;
831e63b
+		for (i = 0; i < fcnt; i++) {
831e63b
+			int ctr = foundlist[i];
831e63b
+			b[i].name = strdup(boollist[ctr]->name);
831e63b
+			b[i].active = !boollist[ctr]->active;
831e63b
+		}
831e63b
+	}
831e63b
+	free(foundlist);
831e63b
+	return fcnt;
831e63b
+}
831e63b
+
831e63b
+static PyObject *finish(PyObject *self __attribute__((unused)), PyObject *args) {
831e63b
+	PyObject *result = 0;
831e63b
+  
831e63b
+	if (PyArg_ParseTuple(args,(char *)":finish")) {
831e63b
+		int i = 0;
831e63b
+		for (i = 0; i < boolcnt; i++) {
831e63b
+			free(boollist[i]->name);
831e63b
+			free(boollist[i]);
831e63b
+		}
831e63b
+		free(boollist);
831e63b
+		sepol_sidtab_shutdown(&sidtab);
831e63b
+		sepol_sidtab_destroy(&sidtab);
831e63b
+		policydb_destroy(&avc->policydb);
831e63b
+		sepol_handle_destroy(avc->handle);
831e63b
+		free(avc);
831e63b
+		avc = NULL;
831e63b
+		boollist = NULL;
831e63b
+		boolcnt = 0;
831e63b
+	  
831e63b
+		/* Boilerplate to return "None" */
831e63b
+		Py_RETURN_NONE;
831e63b
+	}
831e63b
+	return result;
831e63b
+}
831e63b
+
831e63b
+
831e63b
+static int __policy_init(const char *init_path)
831e63b
+{
831e63b
+	FILE *fp;
831e63b
+	int vers = 0;
831e63b
+	char path[PATH_MAX];
831e63b
+	char errormsg[PATH_MAX];
831e63b
+	struct policy_file pf;
831e63b
+	int rc;
831e63b
+	unsigned int cnt;
831e63b
+
831e63b
+	if (init_path) {
831e63b
+		strncpy(path, init_path, PATH_MAX);
831e63b
+		fp = fopen(path, "r");
831e63b
+		if (!fp) {
831e63b
+			snprintf(errormsg, sizeof(errormsg), 
831e63b
+				 "unable to open %s:  %s\n",
831e63b
+				 path, strerror(errno));
831e63b
+			PyErr_SetString( PyExc_ValueError, errormsg);
831e63b
+			return 0;    // trigger exception
831e63b
+		}
831e63b
+	} else {
831e63b
+		vers = security_policyvers();
831e63b
+		if (vers < 0) {
831e63b
+			snprintf(errormsg, sizeof(errormsg), 
831e63b
+				 "Could not get policy version:  %s\n",
831e63b
+				 strerror(errno));
831e63b
+			PyErr_SetString( PyExc_ValueError, errormsg);
831e63b
+			return 1;
831e63b
+		}
831e63b
+		snprintf(path, PATH_MAX, "%s.%d",
831e63b
+			 selinux_binary_policy_path(), vers);
831e63b
+		fp = fopen(path, "r");
831e63b
+		while (!fp && errno == ENOENT && --vers) {
831e63b
+			snprintf(path, PATH_MAX, "%s.%d",
831e63b
+				 selinux_binary_policy_path(), vers);
831e63b
+			fp = fopen(path, "r");
831e63b
+		}
831e63b
+		if (!fp) {
831e63b
+			snprintf(errormsg, sizeof(errormsg), 
831e63b
+				 "unable to open %s.%d:  %s\n",
831e63b
+				 selinux_binary_policy_path(),
831e63b
+				 security_policyvers(), strerror(errno));
831e63b
+			PyErr_SetString( PyExc_ValueError, errormsg);
831e63b
+			return 1;
831e63b
+		}
831e63b
+	}
831e63b
+
831e63b
+	avc = calloc(sizeof(struct avc_t), 1);
831e63b
+	if (!avc) {
831e63b
+		PyErr_SetString( PyExc_MemoryError, "Out of memory\n");
831e63b
+		return 1;
831e63b
+	}
831e63b
+
831e63b
+	/* Set up a policydb directly so that we can mutate it later
831e63b
+	   for booleans and user settings.  Otherwise we would just use
831e63b
+	   sepol_set_policydb_from_file() here. */
831e63b
+	pf.fp = fp;
831e63b
+	pf.type = PF_USE_STDIO;
831e63b
+	if (policydb_init(&avc->policydb)) {
831e63b
+		snprintf(errormsg, sizeof(errormsg), 
831e63b
+			 "policydb_init failed: %s\n", strerror(errno));
831e63b
+		PyErr_SetString( PyExc_RuntimeError, errormsg);
831e63b
+		fclose(fp);
831e63b
+		return 1;
831e63b
+	}
831e63b
+	if (policydb_read(&avc->policydb, &pf, 0)) {
831e63b
+		snprintf(errormsg, sizeof(errormsg), 
831e63b
+			 "invalid binary policy %s\n", path);
831e63b
+		PyErr_SetString( PyExc_ValueError, errormsg);
831e63b
+		fclose(fp);
831e63b
+		return 1;
831e63b
+	}
831e63b
+	fclose(fp);
831e63b
+	sepol_set_policydb(&avc->policydb);
831e63b
+	if (!init_path) {
831e63b
+		/* If they didn't specify a full path of a binary policy file,
831e63b
+		   then also try loading any boolean settings and user
831e63b
+		   definitions from the active locations.  Otherwise,
831e63b
+		   they can use genpolbools and genpolusers to build a
831e63b
+		   binary policy file that includes any desired settings
831e63b
+		   and then apply audit2why -p to the resulting file. 
831e63b
+		   Errors are non-fatal as such settings are optional. */
831e63b
+		sepol_debug(0);
831e63b
+		(void)sepol_genbools_policydb(&avc->policydb,
831e63b
+					      selinux_booleans_path());
831e63b
+		(void)sepol_genusers_policydb(&avc->policydb,
831e63b
+					      selinux_users_path());
831e63b
+	}
831e63b
+	avc->handle = sepol_handle_create();
831e63b
+
831e63b
+	rc = sepol_bool_count(avc->handle,
831e63b
+			      (sepol_policydb_t *) & avc->policydb, &cnt);
831e63b
+	if (rc < 0) {
831e63b
+		PyErr_SetString( PyExc_RuntimeError, "unable to get bool count\n");
831e63b
+		return 1;
831e63b
+	}
831e63b
+
831e63b
+	boollist = calloc(cnt, sizeof(struct boolean_t));
831e63b
+	if (!boollist) {
831e63b
+		PyErr_SetString( PyExc_MemoryError, "Out of memory\n");
831e63b
+		return 1;
831e63b
+	}
831e63b
+
831e63b
+	sepol_bool_iterate(avc->handle,
831e63b
+			   (const sepol_policydb_t *)&avc->policydb,
831e63b
+			   load_booleans, (void *)NULL);
831e63b
+
831e63b
+	/* Initialize the sidtab for subsequent use by sepol_context_to_sid
831e63b
+	   and sepol_compute_av_reason. */
831e63b
+	rc = sepol_sidtab_init(&sidtab);
831e63b
+	if (rc < 0) {
831e63b
+		PyErr_SetString( PyExc_RuntimeError, "unable to init sidtab\n");
831e63b
+		free(boollist);
831e63b
+		return 1;
831e63b
+	}
831e63b
+	sepol_set_sidtab(&sidtab);
831e63b
+	return 0;
831e63b
+}
831e63b
+
831e63b
+static PyObject *init(PyObject *self __attribute__((unused)), PyObject *args) {
831e63b
+  int result;
831e63b
+  char *init_path=NULL;
831e63b
+  if (PyArg_ParseTuple(args,(char *)"|s:policy_init",&init_path)) 
831e63b
+	  result = __policy_init(init_path);
831e63b
+  return Py_BuildValue("i", result);
831e63b
+}
831e63b
+
831e63b
+#define RETURN(X) \
831e63b
+	PyList_SetItem(result, 0, Py_BuildValue("i", X));	\
831e63b
+	return result;						
831e63b
+
831e63b
+static PyObject *analyze(PyObject *self __attribute__((unused)) , PyObject *args) {
831e63b
+	security_context_t scon; 
831e63b
+	security_context_t tcon;
831e63b
+	char *tclassstr; 
831e63b
+	PyObject *listObj;
831e63b
+	PyObject *strObj;
831e63b
+	int numlines;
831e63b
+	struct boolean_t **bools;
831e63b
+	unsigned int reason;
831e63b
+	sepol_security_id_t ssid, tsid;
831e63b
+	sepol_security_class_t tclass;
831e63b
+	sepol_access_vector_t perm, av;
831e63b
+	struct sepol_av_decision avd;
831e63b
+	int rc;
831e63b
+	int i=0;
831e63b
+	PyObject *result = PyList_New(2);
831e63b
+	if (!result) return NULL;
831e63b
+	Py_INCREF(Py_None);
831e63b
+	PyList_SetItem(result, 1, Py_None);
831e63b
+
831e63b
+	if (!PyArg_ParseTuple(args,(char *)"sssO!:audit2why",&scon,&tcon,&tclassstr,&PyList_Type, &listObj)) 
831e63b
+		return NULL;
831e63b
+  
831e63b
+	/* get the number of lines passed to us */
831e63b
+	numlines = PyList_Size(listObj);
831e63b
+
831e63b
+	/* should raise an error here. */
831e63b
+	if (numlines < 0)	return NULL; /* Not a list */
831e63b
+
831e63b
+	if (!avc) {
831e63b
+		RETURN(NOPOLICY)
831e63b
+	}
831e63b
+
831e63b
+	rc = sepol_context_to_sid(scon, strlen(scon) + 1, &ssid);
831e63b
+	if (rc < 0) {
831e63b
+		RETURN(BADSCON)
831e63b
+	}
831e63b
+	rc = sepol_context_to_sid(tcon, strlen(tcon) + 1, &tsid);
831e63b
+	if (rc < 0) {
831e63b
+		RETURN(BADTCON)
831e63b
+	}
831e63b
+	tclass = string_to_security_class(tclassstr);
831e63b
+	if (!tclass) {
831e63b
+		RETURN(BADTCLASS)
831e63b
+	}
831e63b
+	/* Convert the permission list to an AV. */
831e63b
+	av = 0;
831e63b
+
831e63b
+	/* iterate over items of the list, grabbing strings, and parsing
831e63b
+	   for numbers */
831e63b
+	for (i=0; i
831e63b
+		char *permstr;
831e63b
+
831e63b
+		/* grab the string object from the next element of the list */
831e63b
+		strObj = PyList_GetItem(listObj, i); /* Can't fail */
831e63b
+		
831e63b
+		/* make it a string */
831e63b
+		permstr = PyString_AsString( strObj );
831e63b
+		
831e63b
+		perm = string_to_av_perm(tclass, permstr);
831e63b
+		if (!perm) {
831e63b
+			RETURN(BADPERM)
831e63b
+		}
831e63b
+		av |= perm;
831e63b
+	}
831e63b
+
831e63b
+	/* Reproduce the computation. */
831e63b
+	rc = sepol_compute_av_reason(ssid, tsid, tclass, av, &avd, &reason);
831e63b
+	if (rc < 0) {
831e63b
+		RETURN(BADCOMPUTE)
831e63b
+	}
831e63b
+
831e63b
+	if (!reason) {
831e63b
+		RETURN(ALLOW)
831e63b
+	}
831e63b
+	if (reason & SEPOL_COMPUTEAV_TE) {
831e63b
+		avc->ssid = ssid;
831e63b
+		avc->tsid = tsid;
831e63b
+		avc->tclass = tclass;
831e63b
+		avc->av = av;
831e63b
+		if (check_booleans(avc, &bools) == 0) {
831e63b
+			if (av & ~avd.auditdeny) {
831e63b
+				RETURN(DONTAUDIT)
831e63b
+			} else {
831e63b
+				RETURN(TERULE)
831e63b
+			}
831e63b
+		} else {
831e63b
+			PyList_SetItem(result, 0, Py_BuildValue("i", BOOLEAN));
831e63b
+			struct boolean_t *b=(struct boolean_t *) bools;
831e63b
+			int len=0;
831e63b
+			while (b->name) {
831e63b
+				len++; b++;
831e63b
+			}
831e63b
+			b = (struct boolean_t *) bools;
831e63b
+			PyObject *boollist = PyList_New(len);
831e63b
+			len=0;
831e63b
+			while(b->name) {
831e63b
+				PyObject *bool = PyList_New(2);
831e63b
+				PyList_SetItem(bool, 0, PyString_FromString(b->name));
831e63b
+				PyList_SetItem(bool, 1, Py_BuildValue("i", b->active));
831e63b
+				PyList_SetItem(boollist, len++, bool);
831e63b
+				b++;
831e63b
+			}
831e63b
+			free(bools);
831e63b
+			PyList_SetItem(result, 1, boollist);
831e63b
+			return result;
831e63b
+		}
831e63b
+	}
831e63b
+
831e63b
+	if (reason & SEPOL_COMPUTEAV_CONS) {
831e63b
+		RETURN(CONSTRAINT);
831e63b
+	}
831e63b
+
831e63b
+	if (reason & SEPOL_COMPUTEAV_RBAC) {
831e63b
+		RETURN(RBAC)
831e63b
+	}
831e63b
+        RETURN(BADCOMPUTE)
831e63b
+}
831e63b
+
831e63b
+static PyMethodDef audit2whyMethods[] = {
831e63b
+    {"init",  init, METH_VARARGS,
831e63b
+     "Initialize policy database."},
831e63b
+    {"analyze",  analyze, METH_VARARGS,
831e63b
+     "Analyze AVC."},
831e63b
+    {"finish",  finish, METH_VARARGS,
831e63b
+     "Finish using policy, free memory."},
831e63b
+    {NULL, NULL, 0, NULL}        /* Sentinel */
831e63b
+};
831e63b
+
831e63b
+PyMODINIT_FUNC
831e63b
+initaudit2why(void)
831e63b
+{
831e63b
+	PyObject *m = Py_InitModule("audit2why", audit2whyMethods);
831e63b
+	PyModule_AddIntConstant(m,"UNKNOWN", UNKNOWN);
831e63b
+	PyModule_AddIntConstant(m,"BADSCON", BADSCON);
831e63b
+	PyModule_AddIntConstant(m,"BADTCON", BADTCON);
831e63b
+	PyModule_AddIntConstant(m,"BADTCLASS", BADTCLASS);
831e63b
+	PyModule_AddIntConstant(m,"BADPERM", BADPERM);
831e63b
+	PyModule_AddIntConstant(m,"BADCOMPUTE", BADCOMPUTE);
831e63b
+	PyModule_AddIntConstant(m,"NOPOLICY", NOPOLICY);
831e63b
+	PyModule_AddIntConstant(m,"ALLOW", ALLOW);
831e63b
+	PyModule_AddIntConstant(m,"DONTAUDIT", DONTAUDIT);
831e63b
+	PyModule_AddIntConstant(m,"TERULE", TERULE);
831e63b
+	PyModule_AddIntConstant(m,"BOOLEAN", BOOLEAN);
831e63b
+	PyModule_AddIntConstant(m,"CONSTRAINT", CONSTRAINT);
831e63b
+	PyModule_AddIntConstant(m,"RBAC", RBAC);
831e63b
+}
e1e36a0
diff --exclude-from=exclude -N -u -r nsalibselinux/src/Makefile libselinux-2.0.46/src/Makefile
e1e36a0
--- nsalibselinux/src/Makefile	2007-09-26 19:37:45.000000000 -0400
831e63b
+++ libselinux-2.0.46/src/Makefile	2008-01-10 13:25:57.000000000 -0500
831e63b
@@ -18,6 +18,7 @@
831e63b
 SWIGSO=_selinux.so
831e63b
 SWIGFILES=$(SWIGSO) selinux.py 
831e63b
 LIBSO=$(TARGET).$(LIBVERSION)
831e63b
+AUDIT2WHYSO=audit2why.so
831e63b
 
831e63b
 ifeq ($(DISABLE_AVC),y)
831e63b
 	UNUSED_SRCS+=avc.c avc_internal.c avc_sidtab.c mapping.c stringrep.c checkAccess.c
831e63b
@@ -28,7 +29,7 @@
831e63b
 ifeq ($(DISABLE_RPM),y)
831e63b
 	UNUSED_SRCS+=rpm.c
831e63b
 endif
831e63b
-SRCS= $(filter-out $(UNUSED_SRCS), $(filter-out $(SWIGCOUT),$(wildcard *.c)))
831e63b
+SRCS= $(filter-out $(UNUSED_SRCS), $(filter-out audit2why.c $(SWIGCOUT),$(wildcard *.c)))
831e63b
 
831e63b
 OBJS= $(patsubst %.c,%.o,$(SRCS))
831e63b
 LOBJS= $(patsubst %.c,%.lo,$(SRCS))
831e63b
@@ -47,7 +48,7 @@
831e63b
 
831e63b
 all: $(LIBA) $(LIBSO) 
831e63b
 
831e63b
-pywrap: all $(SWIGSO)
831e63b
+pywrap: all $(SWIGSO) $(AUDIT2WHYSO)
831e63b
 
831e63b
 $(LIBA):  $(OBJS)
831e63b
 	$(AR) rcs $@ $^
831e63b
@@ -63,6 +64,12 @@
831e63b
 	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -ldl -L$(LIBDIR) -Wl,-soname,$(LIBSO),-z,defs,-z,relro
831e63b
 	ln -sf $@ $(TARGET) 
831e63b
 
831e63b
+audit2why.lo: audit2why.c
831e63b
+	$(CC) $(CFLAGS) -I$(PYINC) -fPIC -DSHARED -c -o $@ $<
831e63b
+
831e63b
+$(AUDIT2WHYSO): audit2why.lo
831e63b
+	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -L. -lselinux ${LIBDIR}/libsepol.a -L$(LIBDIR) -Wl,-soname,$@
831e63b
+
831e63b
 %.o:  %.c policy.h
831e63b
 	$(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
831e63b
 
831e63b
@@ -77,20 +84,21 @@
e1e36a0
 
e1e36a0
 install: all 
e1e36a0
 	test -d $(LIBDIR) || install -m 755 -d $(LIBDIR)
e1e36a0
-	install -m 644 $(LIBA) $(LIBDIR)
e1e36a0
 	test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
e1e36a0
 	install -m 755 $(LIBSO) $(SHLIBDIR)
e1e36a0
 	cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET)
e1e36a0
 
e1e36a0
 install-pywrap: pywrap
831e63b
-	test -d $(PYTHONLIBDIR)/site-packages || install -m 755 -d $(PYTHONLIBDIR)/site-packages
e1e36a0
-	install -m 755 $(SWIGFILES) $(PYTHONLIBDIR)/site-packages
831e63b
+	test -d $(PYTHONLIBDIR)/site-packages || install -m 755 -d $(PYTHONLIBDIR)/site-packages/selinux
831e63b
+	install -m 755 $(SWIGSO) $(PYTHONLIBDIR)/site-packages/selinux
831e63b
+	install -m 755 $(AUDIT2WHYSO) $(PYTHONLIBDIR)/site-packages/selinux
831e63b
+	install -m 644  selinux.py $(PYTHONLIBDIR)/site-packages/selinux/__init_.py
e1e36a0
 
e1e36a0
 relabel:
e1e36a0
 	/sbin/restorecon $(SHLIBDIR)/$(LIBSO)
831e63b
 
831e63b
 clean: 
831e63b
-	-rm -f $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(SWIGLOBJ) $(SWIGSO) $(TARGET) 
831e63b
+	-rm -f $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(SWIGLOBJ) $(SWIGSO) $(TARGET) $(AUDIT2WHYSO) *.o *.lo *~
831e63b
 
831e63b
 distclean: clean
831e63b
 	rm -f $(SWIGCOUT) $(SWIGFILES)
e1e36a0
diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchpathcon.c libselinux-2.0.46/src/matchpathcon.c
39606ee
--- nsalibselinux/src/matchpathcon.c	2007-09-28 09:48:58.000000000 -0400
831e63b
+++ libselinux-2.0.46/src/matchpathcon.c	2008-01-10 13:25:57.000000000 -0500
71cd138
@@ -2,6 +2,7 @@
71cd138
 #include <string.h>
71cd138
 #include <errno.h>
71cd138
 #include <stdio.h>
71cd138
+#include <syslog.h>
71cd138
 #include "selinux_internal.h"
71cd138
 #include "label_internal.h"
71cd138
 #include "callbacks.h"
0fa749d
@@ -57,7 +58,7 @@
71cd138
 {
71cd138
 	va_list ap;
71cd138
 	va_start(ap, fmt);
71cd138
-	vfprintf(stderr, fmt, ap);
0fa749d
+	vsyslog(LOG_ERR, fmt, ap);
71cd138
 	va_end(ap);
71cd138
 }
71cd138
 
8054023
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinux.py libselinux-2.0.46/src/selinux.py
8054023
--- nsalibselinux/src/selinux.py	2007-10-05 13:09:54.000000000 -0400
831e63b
+++ libselinux-2.0.46/src/selinux.py	2008-01-10 13:26:25.000000000 -0500
8054023
@@ -1,5 +1,5 @@
8054023
 # This file was automatically generated by SWIG (http://www.swig.org).
8054023
-# Version 1.3.31
8054023
+# Version 1.3.33
8054023
 #
8054023
 # Don't modify this file, modify the SWIG interface instead.
8054023
 # This file is compatible with both classic and new-style classes.
8054023
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig.i libselinux-2.0.46/src/selinuxswig.i
8054023
--- nsalibselinux/src/selinuxswig.i	2007-10-01 09:54:35.000000000 -0400
831e63b
+++ libselinux-2.0.46/src/selinuxswig.i	2008-01-10 13:25:57.000000000 -0500
831e63b
@@ -5,11 +5,16 @@
831e63b
 %module selinux
831e63b
 %{
831e63b
 	#include "selinux/selinux.h"
831e63b
+	#include "../include/selinux/selinux.h"
831e63b
+	#include "../include/selinux/get_default_type.h"
831e63b
+	#include "../include/selinux/get_context_list.h"
831e63b
 %}
831e63b
 %apply int *OUTPUT { int *enforce };
8054023
 %apply int *OUTPUT { size_t * };
8054023
 
8054023
 %typedef unsigned mode_t;
8054023
+%typedef unsigned pid_t;
831e63b
+%typedef char * security_contextx_t;
8054023
 
8054023
 %typemap(in, numinputs=0) (char ***names, int *len) (char **temp1, int temp2) {
8054023
 	$1 = &temp1;
8054023
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig_wrap.c libselinux-2.0.46/src/selinuxswig_wrap.c
8054023
--- nsalibselinux/src/selinuxswig_wrap.c	2007-10-05 13:09:54.000000000 -0400
831e63b
+++ libselinux-2.0.46/src/selinuxswig_wrap.c	2008-01-10 13:26:25.000000000 -0500
8054023
@@ -1,6 +1,6 @@
8054023
 /* ----------------------------------------------------------------------------
8054023
  * This file was automatically generated by SWIG (http://www.swig.org).
8054023
- * Version 1.3.31
8054023
+ * Version 1.3.33
8054023
  * 
8054023
  * This file is not intended to be easily readable and contains a number of 
8054023
  * coding conventions designed to improve portability and efficiency. Do not make
8054023
@@ -17,14 +17,14 @@
8054023
 
8054023
 /* template workaround for compilers that cannot correctly implement the C++ standard */
8054023
 #ifndef SWIGTEMPLATEDISAMBIGUATOR
8054023
-# if defined(__SUNPRO_CC)
8054023
-#   if (__SUNPRO_CC <= 0x560)
8054023
-#     define SWIGTEMPLATEDISAMBIGUATOR template
8054023
-#   else
8054023
-#     define SWIGTEMPLATEDISAMBIGUATOR 
8054023
-#   endif
8054023
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
8054023
+#  define SWIGTEMPLATEDISAMBIGUATOR template
8054023
+# elif defined(__HP_aCC)
8054023
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
8054023
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
8054023
+#  define SWIGTEMPLATEDISAMBIGUATOR template
8054023
 # else
8054023
-#   define SWIGTEMPLATEDISAMBIGUATOR 
8054023
+#  define SWIGTEMPLATEDISAMBIGUATOR
8054023
 # endif
8054023
 #endif
8054023
 
8054023
@@ -107,6 +107,12 @@
8054023
 # define _CRT_SECURE_NO_DEPRECATE
8054023
 #endif
8054023
 
8054023
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
8054023
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
8054023
+# define _SCL_SECURE_NO_DEPRECATE
8054023
+#endif
8054023
+
8054023
+
8054023
 
8054023
 /* Python.h has to appear first */
8054023
 #include <Python.h>
8054023
@@ -343,7 +349,7 @@
8054023
     while ((*f2 == ' ') && (f2 != l2)) ++f2;
8054023
     if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
8054023
   }
8054023
-  return (l1 - f1) - (l2 - f2);
8054023
+  return (int)((l1 - f1) - (l2 - f2));
8054023
 }
8054023
 
8054023
 /*
8054023
@@ -1090,14 +1096,14 @@
8054023
 /* Unpack the argument tuple */
8054023
 
8054023
 SWIGINTERN int
8054023
-SWIG_Python_UnpackTuple(PyObject *args, const char *name, int min, int max, PyObject **objs)
8054023
+SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
8054023
 {
8054023
   if (!args) {
8054023
     if (!min && !max) {
8054023
       return 1;
8054023
     } else {
8054023
       PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", 
8054023
-		   name, (min == max ? "" : "at least "), min);
8054023
+		   name, (min == max ? "" : "at least "), (int)min);
8054023
       return 0;
8054023
     }
8054023
   }  
8054023
@@ -1105,14 +1111,14 @@
8054023
     PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
8054023
     return 0;
8054023
   } else {
8054023
-    register int l = PyTuple_GET_SIZE(args);
8054023
+    register Py_ssize_t l = PyTuple_GET_SIZE(args);
8054023
     if (l < min) {
8054023
       PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
8054023
-		   name, (min == max ? "" : "at least "), min, l);
8054023
+		   name, (min == max ? "" : "at least "), (int)min, (int)l);
8054023
       return 0;
8054023
     } else if (l > max) {
8054023
       PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
8054023
-		   name, (min == max ? "" : "at most "), max, l);
8054023
+		   name, (min == max ? "" : "at most "), (int)max, (int)l);
8054023
       return 0;
8054023
     } else {
8054023
       register int i;
8054023
@@ -1591,9 +1597,11 @@
8054023
     (unaryfunc)0,                 /*nb_float*/
8054023
     (unaryfunc)PySwigObject_oct,  /*nb_oct*/
8054023
     (unaryfunc)PySwigObject_hex,  /*nb_hex*/
8054023
-#if PY_VERSION_HEX >= 0x02020000
8054023
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */ 
8054023
-#elif PY_VERSION_HEX >= 0x02000000
8054023
+#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
8054023
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
8054023
+#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
8054023
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
8054023
+#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
8054023
     0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
8054023
 #endif
8054023
   };
8054023
@@ -2458,14 +2466,13 @@
8054023
 #define SWIGTYPE_p_int swig_types[7]
8054023
 #define SWIGTYPE_p_p_char swig_types[8]
8054023
 #define SWIGTYPE_p_p_p_char swig_types[9]
8054023
-#define SWIGTYPE_p_pid_t swig_types[10]
8054023
-#define SWIGTYPE_p_security_class_mapping swig_types[11]
8054023
-#define SWIGTYPE_p_selinux_callback swig_types[12]
8054023
-#define SWIGTYPE_p_selinux_opt swig_types[13]
8054023
-#define SWIGTYPE_p_unsigned_int swig_types[14]
8054023
-#define SWIGTYPE_p_unsigned_short swig_types[15]
8054023
-static swig_type_info *swig_types[17];
8054023
-static swig_module_info swig_module = {swig_types, 16, 0, 0, 0, 0};
8054023
+#define SWIGTYPE_p_security_class_mapping swig_types[10]
8054023
+#define SWIGTYPE_p_selinux_callback swig_types[11]
8054023
+#define SWIGTYPE_p_selinux_opt swig_types[12]
8054023
+#define SWIGTYPE_p_unsigned_int swig_types[13]
8054023
+#define SWIGTYPE_p_unsigned_short swig_types[14]
8054023
+static swig_type_info *swig_types[16];
8054023
+static swig_module_info swig_module = {swig_types, 15, 0, 0, 0, 0};
8054023
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
8054023
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
8054023
 
8054023
@@ -2484,7 +2491,7 @@
8054023
 
8054023
 #define SWIG_name    "_selinux"
8054023
 
8054023
-#define SWIGVERSION 0x010331 
8054023
+#define SWIGVERSION 0x010333 
8054023
 #define SWIG_VERSION SWIGVERSION
8054023
 
8054023
 
831e63b
@@ -2496,6 +2503,9 @@
831e63b
 
831e63b
 
831e63b
 	#include "selinux/selinux.h"
831e63b
+	#include "../include/selinux/selinux.h"
831e63b
+	#include "../include/selinux/get_default_type.h"
831e63b
+	#include "../include/selinux/get_context_list.h"
831e63b
 
831e63b
 
831e63b
   #define SWIG_From_long   PyInt_FromLong 
831e63b
@@ -2577,14 +2587,12 @@
8054023
 
8054023
 
8054023
 #include <limits.h>
8054023
-#ifndef LLONG_MIN
8054023
-# define LLONG_MIN	LONG_LONG_MIN
8054023
-#endif
8054023
-#ifndef LLONG_MAX
8054023
-# define LLONG_MAX	LONG_LONG_MAX
8054023
-#endif
8054023
-#ifndef ULLONG_MAX
8054023
-# define ULLONG_MAX	ULONG_LONG_MAX
8054023
+#if !defined(SWIG_NO_LLONG_MAX)
8054023
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
8054023
+#   define LLONG_MAX __LONG_LONG_MAX__
8054023
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
8054023
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
8054023
+# endif
8054023
 #endif
8054023
 
8054023
 
831e63b
@@ -2669,13 +2677,18 @@
8054023
 
8054023
 
8054023
 SWIGINTERN int
8054023
-SWIG_AsVal_long (PyObject *obj, long* val)
8054023
+SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) 
8054023
 {
8054023
   if (PyInt_Check(obj)) {
8054023
-    if (val) *val = PyInt_AsLong(obj);
8054023
-    return SWIG_OK;
8054023
+    long v = PyInt_AsLong(obj);
8054023
+    if (v >= 0) {
8054023
+      if (val) *val = v;
8054023
+      return SWIG_OK;
8054023
+    } else {
8054023
+      return SWIG_OverflowError;
8054023
+    }
8054023
   } else if (PyLong_Check(obj)) {
8054023
-    long v = PyLong_AsLong(obj);
8054023
+    unsigned long v = PyLong_AsUnsignedLong(obj);
8054023
     if (!PyErr_Occurred()) {
8054023
       if (val) *val = v;
8054023
       return SWIG_OK;
831e63b
@@ -2686,7 +2699,7 @@
8054023
 #ifdef SWIG_PYTHON_CAST_MODE
8054023
   {
8054023
     int dispatch = 0;
8054023
-    long v = PyInt_AsLong(obj);
8054023
+    unsigned long v = PyLong_AsUnsignedLong(obj);
8054023
     if (!PyErr_Occurred()) {
8054023
       if (val) *val = v;
8054023
       return SWIG_AddCast(SWIG_OK);
831e63b
@@ -2696,8 +2709,8 @@
8054023
     if (!dispatch) {
8054023
       double d;
8054023
       int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d);;
8054023
-      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
8054023
-	if (val) *val = (long)(d);
8054023
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
8054023
+	if (val) *val = (unsigned long)(d);
8054023
 	return res;
8054023
       }
8054023
     }
831e63b
@@ -2708,15 +2721,15 @@
8054023
 
8054023
 
8054023
 SWIGINTERN int
8054023
-SWIG_AsVal_int (PyObject * obj, int *val)
8054023
+SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
8054023
 {
8054023
-  long v;
8054023
-  int res = SWIG_AsVal_long (obj, &v);
8054023
+  unsigned long v;
8054023
+  int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
8054023
   if (SWIG_IsOK(res)) {
8054023
-    if ((v < INT_MIN || v > INT_MAX)) {
8054023
+    if ((v > UINT_MAX)) {
8054023
       return SWIG_OverflowError;
8054023
     } else {
8054023
-      if (val) *val = (int)(v);
8054023
+      if (val) *val = (unsigned int)(v);
8054023
     }
8054023
   }  
8054023
   return res;
831e63b
@@ -2724,18 +2737,13 @@
8054023
 
8054023
 
8054023
 SWIGINTERN int
8054023
-SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) 
8054023
+SWIG_AsVal_long (PyObject *obj, long* val)
8054023
 {
8054023
   if (PyInt_Check(obj)) {
8054023
-    long v = PyInt_AsLong(obj);
8054023
-    if (v >= 0) {
8054023
-      if (val) *val = v;
8054023
-      return SWIG_OK;
8054023
-    } else {
8054023
-      return SWIG_OverflowError;
8054023
-    }
8054023
+    if (val) *val = PyInt_AsLong(obj);
8054023
+    return SWIG_OK;
8054023
   } else if (PyLong_Check(obj)) {
8054023
-    unsigned long v = PyLong_AsUnsignedLong(obj);
8054023
+    long v = PyLong_AsLong(obj);
8054023
     if (!PyErr_Occurred()) {
8054023
       if (val) *val = v;
8054023
       return SWIG_OK;
831e63b
@@ -2746,7 +2754,7 @@
8054023
 #ifdef SWIG_PYTHON_CAST_MODE
8054023
   {
8054023
     int dispatch = 0;
8054023
-    unsigned long v = PyLong_AsUnsignedLong(obj);
8054023
+    long v = PyInt_AsLong(obj);
8054023
     if (!PyErr_Occurred()) {
8054023
       if (val) *val = v;
8054023
       return SWIG_AddCast(SWIG_OK);
831e63b
@@ -2756,8 +2764,8 @@
8054023
     if (!dispatch) {
8054023
       double d;
8054023
       int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d);;
8054023
-      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
8054023
-	if (val) *val = (unsigned long)(d);
8054023
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
8054023
+	if (val) *val = (long)(d);
8054023
 	return res;
8054023
       }
8054023
     }
831e63b
@@ -2768,15 +2776,15 @@
8054023
 
8054023
 
8054023
 SWIGINTERN int
8054023
-SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
8054023
+SWIG_AsVal_int (PyObject * obj, int *val)
8054023
 {
8054023
-  unsigned long v;
8054023
-  int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
8054023
+  long v;
8054023
+  int res = SWIG_AsVal_long (obj, &v);
8054023
   if (SWIG_IsOK(res)) {
8054023
-    if ((v > UINT_MAX)) {
8054023
+    if ((v < INT_MIN || v > INT_MAX)) {
8054023
       return SWIG_OverflowError;
8054023
     } else {
8054023
-      if (val) *val = (unsigned int)(v);
8054023
+      if (val) *val = (int)(v);
8054023
     }
8054023
   }  
8054023
   return res;
831e63b
@@ -2986,24 +2994,18 @@
8054023
   pid_t arg1 ;
8054023
   security_context_t *arg2 = (security_context_t *) 0 ;
8054023
   int result;
8054023
-  void *argp1 ;
8054023
-  int res1 = 0 ;
8054023
+  unsigned int val1 ;
8054023
+  int ecode1 = 0 ;
8054023
   security_context_t temp2 = 0 ;
8054023
   PyObject * obj0 = 0 ;
8054023
   
8054023
   arg2 = &temp2;
8054023
   if (!PyArg_ParseTuple(args,(char *)"O:getpidcon",&obj0)) SWIG_fail;
8054023
-  {
8054023
-    res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_pid_t,  0 );
8054023
-    if (!SWIG_IsOK(res1)) {
8054023
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getpidcon" "', argument " "1"" of type '" "pid_t""'"); 
8054023
-    }  
8054023
-    if (!argp1) {
8054023
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "getpidcon" "', argument " "1"" of type '" "pid_t""'");
8054023
-    } else {
8054023
-      arg1 = *((pid_t *)(argp1));
8054023
-    }
8054023
-  }
8054023
+  ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1);
8054023
+  if (!SWIG_IsOK(ecode1)) {
8054023
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "getpidcon" "', argument " "1"" of type '" "pid_t""'");
8054023
+  } 
8054023
+  arg1 = (pid_t)(val1);
8054023
   result = (int)getpidcon(arg1,arg2);
8054023
   resultobj = SWIG_From_int((int)(result));
8054023
   if (*arg2) {
831e63b
@@ -3025,24 +3027,18 @@
8054023
   pid_t arg1 ;
8054023
   security_context_t *arg2 = (security_context_t *) 0 ;
8054023
   int result;
8054023
-  void *argp1 ;
8054023
-  int res1 = 0 ;
8054023
+  unsigned int val1 ;
8054023
+  int ecode1 = 0 ;
8054023
   security_context_t temp2 = 0 ;
8054023
   PyObject * obj0 = 0 ;
8054023
   
8054023
   arg2 = &temp2;
8054023
   if (!PyArg_ParseTuple(args,(char *)"O:getpidcon_raw",&obj0)) SWIG_fail;
8054023
-  {
8054023
-    res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_pid_t,  0 );
8054023
-    if (!SWIG_IsOK(res1)) {
8054023
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getpidcon_raw" "', argument " "1"" of type '" "pid_t""'"); 
8054023
-    }  
8054023
-    if (!argp1) {
8054023
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "getpidcon_raw" "', argument " "1"" of type '" "pid_t""'");
8054023
-    } else {
8054023
-      arg1 = *((pid_t *)(argp1));
8054023
-    }
8054023
-  }
8054023
+  ecode1 = SWIG_AsVal_unsigned_SS_int(obj0, &val1);
8054023
+  if (!SWIG_IsOK(ecode1)) {
8054023
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "getpidcon_raw" "', argument " "1"" of type '" "pid_t""'");
8054023
+  } 
8054023
+  arg1 = (pid_t)(val1);
8054023
   result = (int)getpidcon_raw(arg1,arg2);
8054023
   resultobj = SWIG_From_int((int)(result));
8054023
   if (*arg2) {
831e63b
@@ -8149,7 +8145,7 @@
8054023
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
8054023
 
8054023
 static swig_type_info _swigt__p_SELboolean = {"_p_SELboolean", "SELboolean *", 0, 0, (void*)0, 0};
8054023
-static swig_type_info _swigt__p_av_decision = {"_p_av_decision", "struct av_decision *", 0, 0, (void*)0, 0};
8054023
+static swig_type_info _swigt__p_av_decision = {"_p_av_decision", "struct av_decision *|av_decision *", 0, 0, (void*)0, 0};
8054023
 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
8054023
 static swig_type_info _swigt__p_f_int_p_q_const__char_v_______int = {"_p_f_int_p_q_const__char_v_______int", "int (*)(int,char const *,...)", 0, 0, (void*)0, 0};
8054023
 static swig_type_info _swigt__p_f_p_p_char__int = {"_p_f_p_p_char__int", "int (*)(char **)|int (*)(security_context_t *)", 0, 0, (void*)0, 0};
831e63b
@@ -8158,12 +8154,11 @@
8054023
 static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0};
8054023
 static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **|security_context_t *", 0, 0, (void*)0, 0};
8054023
 static swig_type_info _swigt__p_p_p_char = {"_p_p_p_char", "char ***|security_context_t **", 0, 0, (void*)0, 0};
8054023
-static swig_type_info _swigt__p_pid_t = {"_p_pid_t", "pid_t *", 0, 0, (void*)0, 0};
8054023
-static swig_type_info _swigt__p_security_class_mapping = {"_p_security_class_mapping", "struct security_class_mapping *", 0, 0, (void*)0, 0};
8054023
-static swig_type_info _swigt__p_selinux_callback = {"_p_selinux_callback", "union selinux_callback *", 0, 0, (void*)0, 0};
8054023
-static swig_type_info _swigt__p_selinux_opt = {"_p_selinux_opt", "selinux_opt *", 0, 0, (void*)0, 0};
8054023
-static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "unsigned int *|access_vector_t *", 0, 0, (void*)0, 0};
8054023
-static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|security_class_t *", 0, 0, (void*)0, 0};
8054023
+static swig_type_info _swigt__p_security_class_mapping = {"_p_security_class_mapping", "struct security_class_mapping *|security_class_mapping *", 0, 0, (void*)0, 0};
8054023
+static swig_type_info _swigt__p_selinux_callback = {"_p_selinux_callback", "union selinux_callback *|selinux_callback *", 0, 0, (void*)0, 0};
8054023
+static swig_type_info _swigt__p_selinux_opt = {"_p_selinux_opt", "struct selinux_opt *|selinux_opt *", 0, 0, (void*)0, 0};
8054023
+static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "unsigned int *|access_vector_t *|mode_t *|pid_t *", 0, 0, (void*)0, 0};
8054023
+static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "security_class_t *|unsigned short *", 0, 0, (void*)0, 0};
8054023
 
8054023
 static swig_type_info *swig_type_initial[] = {
8054023
   &_swigt__p_SELboolean,
831e63b
@@ -8176,7 +8171,6 @@
8054023
   &_swigt__p_int,
8054023
   &_swigt__p_p_char,
8054023
   &_swigt__p_p_p_char,
8054023
-  &_swigt__p_pid_t,
8054023
   &_swigt__p_security_class_mapping,
8054023
   &_swigt__p_selinux_callback,
8054023
   &_swigt__p_selinux_opt,
831e63b
@@ -8194,7 +8188,6 @@
8054023
 static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
8054023
 static swig_cast_info _swigc__p_p_char[] = {  {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
8054023
 static swig_cast_info _swigc__p_p_p_char[] = {  {&_swigt__p_p_p_char, 0, 0, 0},{0, 0, 0, 0}};
8054023
-static swig_cast_info _swigc__p_pid_t[] = {  {&_swigt__p_pid_t, 0, 0, 0},{0, 0, 0, 0}};
8054023
 static swig_cast_info _swigc__p_security_class_mapping[] = {  {&_swigt__p_security_class_mapping, 0, 0, 0},{0, 0, 0, 0}};
8054023
 static swig_cast_info _swigc__p_selinux_callback[] = {  {&_swigt__p_selinux_callback, 0, 0, 0},{0, 0, 0, 0}};
8054023
 static swig_cast_info _swigc__p_selinux_opt[] = {  {&_swigt__p_selinux_opt, 0, 0, 0},{0, 0, 0, 0}};
831e63b
@@ -8212,7 +8205,6 @@
8054023
   _swigc__p_int,
8054023
   _swigc__p_p_char,
8054023
   _swigc__p_p_p_char,
8054023
-  _swigc__p_pid_t,
8054023
   _swigc__p_security_class_mapping,
8054023
   _swigc__p_selinux_callback,
8054023
   _swigc__p_selinux_opt,