8a44c08
diff --exclude-from=exclude -N -u -r nsalibselinux/man/man8/selinuxconlist.8 libselinux-2.0.75/man/man8/selinuxconlist.8
6137b9c
--- nsalibselinux/man/man8/selinuxconlist.8	1969-12-31 19:00:00.000000000 -0500
8a44c08
+++ libselinux-2.0.75/man/man8/selinuxconlist.8	2008-11-14 12:05:38.000000000 -0500
6137b9c
@@ -0,0 +1,18 @@
6137b9c
+.TH "selinuxconlist" "1" "7 May 2008" "dwalsh@redhat.com" "SELinux Command Line documentation"
6137b9c
+.SH "NAME"
6137b9c
+selinuxconlist \- list all SELinux context reachable for user
6137b9c
+.SH "SYNOPSIS"
6137b9c
+.B selinuxconlist [-l level] user [context]
6137b9c
+
6137b9c
+.SH "DESCRIPTION"
6137b9c
+.B selinuxconlist
6137b9c
+reports the list of context reachable for user from the current context or specified context
6137b9c
+
6137b9c
+.B \-l level
6137b9c
+mcs/mls level
6137b9c
+
6137b9c
+.SH AUTHOR	
6137b9c
+This manual page was written by Dan Walsh <dwalsh@redhat.com>.
6137b9c
+
6137b9c
+.SH "SEE ALSO"
6137b9c
+secon(8), selinuxdefcon(8)
8a44c08
diff --exclude-from=exclude -N -u -r nsalibselinux/man/man8/selinuxdefcon.8 libselinux-2.0.75/man/man8/selinuxdefcon.8
6137b9c
--- nsalibselinux/man/man8/selinuxdefcon.8	1969-12-31 19:00:00.000000000 -0500
8a44c08
+++ libselinux-2.0.75/man/man8/selinuxdefcon.8	2008-11-14 12:05:38.000000000 -0500
6137b9c
@@ -0,0 +1,19 @@
6137b9c
+.TH "selinuxdefcon" "1" "7 May 2008" "dwalsh@redhat.com" "SELinux Command Line documentation"
6137b9c
+.SH "NAME"
6137b9c
+selinuxdefcon \- list default SELinux context for user 
6137b9c
+
6137b9c
+.SH "SYNOPSIS"
6137b9c
+.B selinuxdefcon [-l level] user [fromcon]
6137b9c
+
6137b9c
+.SH "DESCRIPTION"
6137b9c
+.B seconlist
6137b9c
+reports the default context for the specified user from current context or specified context
6137b9c
+
6137b9c
+.B \-l level
6137b9c
+mcs/mls level
6137b9c
+
6137b9c
+.SH AUTHOR	
6137b9c
+This manual page was written by Dan Walsh <dwalsh@redhat.com>.
6137b9c
+
6137b9c
+.SH "SEE ALSO"
6137b9c
+secon(8), selinuxconlist(8)
8a44c08
diff --exclude-from=exclude -N -u -r nsalibselinux/src/callbacks.c libselinux-2.0.75/src/callbacks.c
b345116
--- nsalibselinux/src/callbacks.c	2008-08-28 09:34:24.000000000 -0400
8a44c08
+++ libselinux-2.0.75/src/callbacks.c	2008-11-14 12:05:38.000000000 -0500
94f8e13
@@ -16,6 +16,7 @@
88ff8b4
 {
94f8e13
 	int rc;
94f8e13
 	va_list ap;
94f8e13
+	if (is_selinux_enabled() == 0) return 0;
94f8e13
 	va_start(ap, fmt);
94f8e13
 	rc = vfprintf(stderr, fmt, ap);
94f8e13
 	va_end(ap);
8a44c08
diff --exclude-from=exclude -N -u -r nsalibselinux/src/label_x.c libselinux-2.0.75/src/label_x.c
8a44c08
--- nsalibselinux/src/label_x.c	2008-08-28 09:34:24.000000000 -0400
8a44c08
+++ libselinux-2.0.75/src/label_x.c	2008-11-17 10:25:12.000000000 -0500
8a44c08
@@ -11,6 +11,7 @@
8a44c08
 #include <ctype.h>
8a44c08
 #include <errno.h>
8a44c08
 #include <limits.h>
8a44c08
+#include <fnmatch.h>
8a44c08
 #include "callbacks.h"
8a44c08
 #include "label_internal.h"
8a44c08
 
8a44c08
@@ -199,9 +200,7 @@
8a44c08
 	for (i = 0; i < data->nspec; i++) {
8a44c08
 		if (spec_arr[i].type != type)
8a44c08
 			continue;
8a44c08
-		if (!strncmp(spec_arr[i].key, "*", 2))
8a44c08
-			break;
8a44c08
-		if (!strncmp(spec_arr[i].key, key, strlen(key) + 1))
8a44c08
+		if (!fnmatch(spec_arr[i].key, key, 0))
8a44c08
 			break;
8a44c08
 	}
8a44c08
 
8a44c08
diff --exclude-from=exclude -N -u -r nsalibselinux/src/matchpathcon.c libselinux-2.0.75/src/matchpathcon.c
b345116
--- nsalibselinux/src/matchpathcon.c	2008-08-28 09:34:24.000000000 -0400
8a44c08
+++ libselinux-2.0.75/src/matchpathcon.c	2008-11-14 12:05:38.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
 
8a44c08
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinux.py libselinux-2.0.75/src/selinux.py
8a44c08
--- nsalibselinux/src/selinux.py	2008-08-28 09:34:24.000000000 -0400
8a44c08
+++ libselinux-2.0.75/src/selinux.py	2008-11-14 17:09:54.000000000 -0500
8a44c08
@@ -1,5 +1,5 @@
8a44c08
 # This file was automatically generated by SWIG (http://www.swig.org).
8a44c08
-# Version 1.3.33
8a44c08
+# Version 1.3.35
8a44c08
 #
8a44c08
 # Don't modify this file, modify the SWIG interface instead.
8a44c08
 # This file is compatible with both classic and new-style classes.
8a44c08
@@ -48,6 +48,29 @@
8a44c08
 del types
8a44c08
 
8a44c08
 
8a44c08
+import shutil, os
8a44c08
+
8a44c08
+def restorecon(path, recursive=False):
8a44c08
+    """ Restore SELinux context on a given path """
8a44c08
+    mode = os.stat(path)[stat.ST_MODE]
8a44c08
+    status, context = matchpathcon(path, mode)
8a44c08
+    if status == 0:
8a44c08
+        lsetfilecon(path, context)
8a44c08
+        if recursive:
8a44c08
+            os.path.walk(path, lambda arg, dirname, fnames:
8a44c08
+                             map(restorecon, [os.path.join(dirname, fname)
9e66b86
+                                              for fname in fnames]), None)
8a44c08
+
8a44c08
+def copytree(src, dest):
8a44c08
+    """ An SELinux-friendly shutil.copytree method """
8a44c08
+    shutil.copytree(src, dest)
8a44c08
+    restorecon(dest, recursive=True)
8a44c08
+
8a44c08
+def install(src, dest):
8a44c08
+    """ An SELinux-friendly shutil.move method """
8a44c08
+    shutil.move(src, dest)
8a44c08
+    restorecon(dest, recursive=True)
8a44c08
+
8a44c08
 is_selinux_enabled = _selinux.is_selinux_enabled
8a44c08
 is_selinux_mls_enabled = _selinux.is_selinux_mls_enabled
8a44c08
 getcon = _selinux.getcon
8a44c08
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig.i libselinux-2.0.75/src/selinuxswig.i
8a44c08
--- nsalibselinux/src/selinuxswig.i	2008-08-28 09:34:24.000000000 -0400
8a44c08
+++ libselinux-2.0.75/src/selinuxswig.i	2008-11-14 16:55:43.000000000 -0500
8a44c08
@@ -2,6 +2,7 @@
8a44c08
  *          James Athey
8a44c08
  */
8a44c08
 
8a44c08
+
8a44c08
 %module selinux
8a44c08
 %{
8a44c08
 	#include "selinux/selinux.h"
8a44c08
@@ -10,6 +11,7 @@
8a44c08
 	#include "../include/selinux/get_default_type.h"
8a44c08
 	#include "../include/selinux/get_context_list.h"
8a44c08
 %}
8a44c08
+
8a44c08
 %apply int *OUTPUT { int *enforce };
8a44c08
 %apply int *OUTPUT { size_t * };
8a44c08
 
8a44c08
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig_python.i libselinux-2.0.75/src/selinuxswig_python.i
8a44c08
--- nsalibselinux/src/selinuxswig_python.i	2008-08-28 09:34:24.000000000 -0400
8a44c08
+++ libselinux-2.0.75/src/selinuxswig_python.i	2008-11-14 17:09:50.000000000 -0500
8a44c08
@@ -6,6 +6,32 @@
8a44c08
 	#include "selinux/selinux.h"
8a44c08
 %}
8a44c08
 
8a44c08
+%pythoncode %{
8a44c08
+
8a44c08
+import shutil, os
8a44c08
+
8a44c08
+def restorecon(path, recursive=False):
8a44c08
+    """ Restore SELinux context on a given path """
8a44c08
+    mode = os.stat(path)[stat.ST_MODE]
8a44c08
+    status, context = matchpathcon(path, mode)
8a44c08
+    if status == 0:
8a44c08
+        lsetfilecon(path, context)
8a44c08
+        if recursive:
8a44c08
+            os.path.walk(path, lambda arg, dirname, fnames:
8a44c08
+                             map(restorecon, [os.path.join(dirname, fname)
8a44c08
+                              s                for fname in fnames]), None)
8a44c08
+
8a44c08
+def copytree(src, dest):
8a44c08
+    """ An SELinux-friendly shutil.copytree method """
8a44c08
+    shutil.copytree(src, dest)
8a44c08
+    restorecon(dest, recursive=True)
8a44c08
+
8a44c08
+def install(src, dest):
8a44c08
+    """ An SELinux-friendly shutil.move method """
8a44c08
+    shutil.move(src, dest)
8a44c08
+    restorecon(dest, recursive=True)
8a44c08
+%}
8a44c08
+
8a44c08
 /* security_get_boolean_names() typemap */
8a44c08
 %typemap(argout) (char ***names, int *len) {
8a44c08
 	PyObject* list = PyList_New(*$2);
8a44c08
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig_wrap.c libselinux-2.0.75/src/selinuxswig_wrap.c
8a44c08
--- nsalibselinux/src/selinuxswig_wrap.c	2008-08-28 09:34:24.000000000 -0400
8a44c08
+++ libselinux-2.0.75/src/selinuxswig_wrap.c	2008-11-14 17:09:54.000000000 -0500
8a44c08
@@ -1,6 +1,6 @@
8a44c08
 /* ----------------------------------------------------------------------------
8a44c08
  * This file was automatically generated by SWIG (http://www.swig.org).
8a44c08
- * Version 1.3.33
8a44c08
+ * Version 1.3.35
8a44c08
  * 
8a44c08
  * This file is not intended to be easily readable and contains a number of 
8a44c08
  * coding conventions designed to improve portability and efficiency. Do not make
8a44c08
@@ -126,7 +126,7 @@
8a44c08
 
8a44c08
 /* This should only be incremented when either the layout of swig_type_info changes,
8a44c08
    or for whatever reason, the runtime changes incompatibly */
8a44c08
-#define SWIG_RUNTIME_VERSION "3"
8a44c08
+#define SWIG_RUNTIME_VERSION "4"
8a44c08
 
8a44c08
 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
8a44c08
 #ifdef SWIG_TYPE_TABLE
8a44c08
@@ -161,6 +161,7 @@
8a44c08
 
8a44c08
 /* Flags for pointer conversions */
8a44c08
 #define SWIG_POINTER_DISOWN        0x1
8a44c08
+#define SWIG_CAST_NEW_MEMORY       0x2
8a44c08
 
8a44c08
 /* Flags for new pointer objects */
8a44c08
 #define SWIG_POINTER_OWN           0x1
8a44c08
@@ -301,10 +302,10 @@
8a44c08
 extern "C" {
8a44c08
 #endif
8a44c08
 
8a44c08
-typedef void *(*swig_converter_func)(void *);
8a44c08
+typedef void *(*swig_converter_func)(void *, int *);
8a44c08
 typedef struct swig_type_info *(*swig_dycast_func)(void **);
8a44c08
 
8a44c08
-/* Structure to store inforomation on one type */
8a44c08
+/* Structure to store information on one type */
8a44c08
 typedef struct swig_type_info {
8a44c08
   const char             *name;			/* mangled name of this type */
8a44c08
   const char             *str;			/* human readable name of this type */
8a44c08
@@ -431,8 +432,8 @@
8a44c08
   Cast a pointer up an inheritance hierarchy
8a44c08
 */
8a44c08
 SWIGRUNTIMEINLINE void *
8a44c08
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
8a44c08
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
8a44c08
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
8a44c08
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
8a44c08
 }
8a44c08
 
8a44c08
 /* 
8a44c08
@@ -856,7 +857,7 @@
8a44c08
     Py_DECREF(old_str);
8a44c08
     Py_DECREF(value);
8a44c08
   } else {
8a44c08
-    PyErr_Format(PyExc_RuntimeError, mesg);
8a44c08
+    PyErr_SetString(PyExc_RuntimeError, mesg);
8a44c08
   }
8a44c08
 }
8a44c08
 
8a44c08
@@ -1416,7 +1417,7 @@
8a44c08
 {
8a44c08
   PySwigObject *sobj = (PySwigObject *) v;
8a44c08
   PyObject *next = sobj->next;
8a44c08
-  if (sobj->own) {
8a44c08
+  if (sobj->own == SWIG_POINTER_OWN) {
8a44c08
     swig_type_info *ty = sobj->ty;
8a44c08
     PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
8a44c08
     PyObject *destroy = data ? data->destroy : 0;
8a44c08
@@ -1434,12 +1435,13 @@
8a44c08
 	res = ((*meth)(mself, v));
8a44c08
       }
8a44c08
       Py_XDECREF(res);
8a44c08
-    } else {
8a44c08
-      const char *name = SWIG_TypePrettyName(ty);
8a44c08
+    } 
8a44c08
 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
8a44c08
-      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
8a44c08
-#endif
8a44c08
+    else {
8a44c08
+      const char *name = SWIG_TypePrettyName(ty);
8a44c08
+      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
8a44c08
     }
8a44c08
+#endif
8a44c08
   } 
8a44c08
   Py_XDECREF(next);
8a44c08
   PyObject_DEL(v);
8a44c08
@@ -1944,7 +1946,7 @@
8a44c08
 
8a44c08
 SWIGRUNTIME int
8a44c08
 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
8a44c08
-  if (own) {
8a44c08
+  if (own == SWIG_POINTER_OWN) {
8a44c08
     PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
8a44c08
     if (sobj) {
8a44c08
       int oldown = sobj->own;
8a44c08
@@ -1965,6 +1967,8 @@
8a44c08
     return SWIG_OK;
8a44c08
   } else {
8a44c08
     PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
8a44c08
+    if (own)
8a44c08
+      *own = 0;
8a44c08
     while (sobj) {
8a44c08
       void *vptr = sobj->ptr;
8a44c08
       if (ty) {
8a44c08
@@ -1978,7 +1982,15 @@
8a44c08
 	  if (!tc) {
8a44c08
 	    sobj = (PySwigObject *)sobj->next;
8a44c08
 	  } else {
8a44c08
-	    if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
8a44c08
+	    if (ptr) {
8a44c08
+              int newmemory = 0;
8a44c08
+              *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
8a44c08
+              if (newmemory == SWIG_CAST_NEW_MEMORY) {
8a44c08
+                assert(own);
8a44c08
+                if (own)
8a44c08
+                  *own = *own | SWIG_CAST_NEW_MEMORY;
8a44c08
+              }
8a44c08
+            }
8a44c08
 	    break;
8a44c08
 	  }
8a44c08
 	}
8a44c08
@@ -1988,7 +2000,8 @@
8a44c08
       }
8a44c08
     }
8a44c08
     if (sobj) {
8a44c08
-      if (own) *own = sobj->own;
8a44c08
+      if (own)
8a44c08
+        *own = *own | sobj->own;
8a44c08
       if (flags & SWIG_POINTER_DISOWN) {
8a44c08
 	sobj->own = 0;
8a44c08
       }
8a44c08
@@ -2053,8 +2066,13 @@
8a44c08
     }
8a44c08
     if (ty) {
8a44c08
       swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
8a44c08
-      if (!tc) return SWIG_ERROR;
8a44c08
-      *ptr = SWIG_TypeCast(tc,vptr);
8a44c08
+      if (tc) {
8a44c08
+        int newmemory = 0;
8a44c08
+        *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
8a44c08
+        assert(!newmemory); /* newmemory handling not yet implemented */
8a44c08
+      } else {
8a44c08
+        return SWIG_ERROR;
8a44c08
+      }
8a44c08
     } else {
8a44c08
       *ptr = vptr;
8a44c08
     }
8a44c08
@@ -2506,7 +2524,7 @@
8a44c08
 
8a44c08
 #define SWIG_name    "_selinux"
8a44c08
 
8a44c08
-#define SWIGVERSION 0x010333 
8a44c08
+#define SWIGVERSION 0x010335 
8a44c08
 #define SWIG_VERSION SWIGVERSION
8a44c08
 
8a44c08
 
8a44c08
@@ -4273,7 +4291,7 @@
8a44c08
   struct av_decision *result = 0 ;
8a44c08
   
8a44c08
   if (!PyArg_ParseTuple(args,(char *)":new_av_decision")) SWIG_fail;
8a44c08
-  result = (struct av_decision *)(struct av_decision *) calloc(1, sizeof(struct av_decision));
8a44c08
+  result = (struct av_decision *)calloc(1, sizeof(struct av_decision));
8a44c08
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_av_decision, SWIG_POINTER_NEW |  0 );
8a44c08
   return resultobj;
8a44c08
 fail:
8a44c08
@@ -4305,7 +4323,7 @@
8a44c08
 
8a44c08
 SWIGINTERN PyObject *av_decision_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
8a44c08
   PyObject *obj;
8a44c08
-  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
8a44c08
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
8a44c08
   SWIG_TypeNewClientData(SWIGTYPE_p_av_decision, SWIG_NewClientData(obj));
8a44c08
   return SWIG_Py_Void();
8a44c08
 }
8a44c08
@@ -4428,7 +4446,7 @@
8a44c08
   struct selinux_opt *result = 0 ;
8a44c08
   
8a44c08
   if (!PyArg_ParseTuple(args,(char *)":new_selinux_opt")) SWIG_fail;
8a44c08
-  result = (struct selinux_opt *)(struct selinux_opt *) calloc(1, sizeof(struct selinux_opt));
8a44c08
+  result = (struct selinux_opt *)calloc(1, sizeof(struct selinux_opt));
8a44c08
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_selinux_opt, SWIG_POINTER_NEW |  0 );
8a44c08
   return resultobj;
8a44c08
 fail:
8a44c08
@@ -4460,7 +4478,7 @@
8a44c08
 
8a44c08
 SWIGINTERN PyObject *selinux_opt_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
8a44c08
   PyObject *obj;
8a44c08
-  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
8a44c08
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
8a44c08
   SWIG_TypeNewClientData(SWIGTYPE_p_selinux_opt, SWIG_NewClientData(obj));
8a44c08
   return SWIG_Py_Void();
8a44c08
 }
8a44c08
@@ -4626,7 +4644,7 @@
8a44c08
   union selinux_callback *result = 0 ;
8a44c08
   
8a44c08
   if (!PyArg_ParseTuple(args,(char *)":new_selinux_callback")) SWIG_fail;
8a44c08
-  result = (union selinux_callback *)(union selinux_callback *) calloc(1, sizeof(union selinux_callback));
8a44c08
+  result = (union selinux_callback *)calloc(1, sizeof(union selinux_callback));
8a44c08
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_selinux_callback, SWIG_POINTER_NEW |  0 );
8a44c08
   return resultobj;
8a44c08
 fail:
8a44c08
@@ -4658,7 +4676,7 @@
8a44c08
 
8a44c08
 SWIGINTERN PyObject *selinux_callback_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
8a44c08
   PyObject *obj;
8a44c08
-  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
8a44c08
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
8a44c08
   SWIG_TypeNewClientData(SWIGTYPE_p_selinux_callback, SWIG_NewClientData(obj));
8a44c08
   return SWIG_Py_Void();
8a44c08
 }
8a44c08
@@ -5586,7 +5604,7 @@
8a44c08
   SELboolean *result = 0 ;
8a44c08
   
8a44c08
   if (!PyArg_ParseTuple(args,(char *)":new_SELboolean")) SWIG_fail;
8a44c08
-  result = (SELboolean *)(SELboolean *) calloc(1, sizeof(SELboolean));
8a44c08
+  result = (SELboolean *)calloc(1, sizeof(SELboolean));
8a44c08
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_SELboolean, SWIG_POINTER_NEW |  0 );
8a44c08
   return resultobj;
8a44c08
 fail:
8a44c08
@@ -5618,7 +5636,7 @@
8a44c08
 
8a44c08
 SWIGINTERN PyObject *SELboolean_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
8a44c08
   PyObject *obj;
8a44c08
-  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
8a44c08
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
8a44c08
   SWIG_TypeNewClientData(SWIGTYPE_p_SELboolean, SWIG_NewClientData(obj));
8a44c08
   return SWIG_Py_Void();
8a44c08
 }
8a44c08
@@ -6139,7 +6157,7 @@
8a44c08
   struct security_class_mapping *result = 0 ;
8a44c08
   
8a44c08
   if (!PyArg_ParseTuple(args,(char *)":new_security_class_mapping")) SWIG_fail;
8a44c08
-  result = (struct security_class_mapping *)(struct security_class_mapping *) calloc(1, sizeof(struct security_class_mapping));
8a44c08
+  result = (struct security_class_mapping *)calloc(1, sizeof(struct security_class_mapping));
8a44c08
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_security_class_mapping, SWIG_POINTER_NEW |  0 );
8a44c08
   return resultobj;
8a44c08
 fail:
8a44c08
@@ -6171,7 +6189,7 @@
8a44c08
 
8a44c08
 SWIGINTERN PyObject *security_class_mapping_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
8a44c08
   PyObject *obj;
8a44c08
-  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
8a44c08
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
8a44c08
   SWIG_TypeNewClientData(SWIGTYPE_p_security_class_mapping, SWIG_NewClientData(obj));
8a44c08
   return SWIG_Py_Void();
8a44c08
 }
8a44c08
@@ -7596,7 +7614,7 @@
8a44c08
   struct security_id *result = 0 ;
8a44c08
   
8a44c08
   if (!PyArg_ParseTuple(args,(char *)":new_security_id")) SWIG_fail;
8a44c08
-  result = (struct security_id *)(struct security_id *) calloc(1, sizeof(struct security_id));
8a44c08
+  result = (struct security_id *)calloc(1, sizeof(struct security_id));
8a44c08
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_security_id, SWIG_POINTER_NEW |  0 );
8a44c08
   return resultobj;
8a44c08
 fail:
8a44c08
@@ -7628,7 +7646,7 @@
8a44c08
 
8a44c08
 SWIGINTERN PyObject *security_id_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
8a44c08
   PyObject *obj;
8a44c08
-  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
8a44c08
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
8a44c08
   SWIG_TypeNewClientData(SWIGTYPE_p_security_id, SWIG_NewClientData(obj));
8a44c08
   return SWIG_Py_Void();
8a44c08
 }
8a44c08
@@ -7915,7 +7933,7 @@
8a44c08
   struct avc_entry_ref *result = 0 ;
8a44c08
   
8a44c08
   if (!PyArg_ParseTuple(args,(char *)":new_avc_entry_ref")) SWIG_fail;
8a44c08
-  result = (struct avc_entry_ref *)(struct avc_entry_ref *) calloc(1, sizeof(struct avc_entry_ref));
8a44c08
+  result = (struct avc_entry_ref *)calloc(1, sizeof(struct avc_entry_ref));
8a44c08
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_avc_entry_ref, SWIG_POINTER_NEW |  0 );
8a44c08
   return resultobj;
8a44c08
 fail:
8a44c08
@@ -7947,7 +7965,7 @@
8a44c08
 
8a44c08
 SWIGINTERN PyObject *avc_entry_ref_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
8a44c08
   PyObject *obj;
8a44c08
-  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
8a44c08
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
8a44c08
   SWIG_TypeNewClientData(SWIGTYPE_p_avc_entry_ref, SWIG_NewClientData(obj));
8a44c08
   return SWIG_Py_Void();
8a44c08
 }
8a44c08
@@ -8061,7 +8079,7 @@
8a44c08
   struct avc_memory_callback *result = 0 ;
8a44c08
   
8a44c08
   if (!PyArg_ParseTuple(args,(char *)":new_avc_memory_callback")) SWIG_fail;
8a44c08
-  result = (struct avc_memory_callback *)(struct avc_memory_callback *) calloc(1, sizeof(struct avc_memory_callback));
8a44c08
+  result = (struct avc_memory_callback *)calloc(1, sizeof(struct avc_memory_callback));
8a44c08
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_avc_memory_callback, SWIG_POINTER_NEW |  0 );
8a44c08
   return resultobj;
8a44c08
 fail:
8a44c08
@@ -8093,7 +8111,7 @@
8a44c08
 
8a44c08
 SWIGINTERN PyObject *avc_memory_callback_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
8a44c08
   PyObject *obj;
8a44c08
-  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
8a44c08
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
8a44c08
   SWIG_TypeNewClientData(SWIGTYPE_p_avc_memory_callback, SWIG_NewClientData(obj));
8a44c08
   return SWIG_Py_Void();
8a44c08
 }
8a44c08
@@ -8207,7 +8225,7 @@
8a44c08
   struct avc_log_callback *result = 0 ;
8a44c08
   
8a44c08
   if (!PyArg_ParseTuple(args,(char *)":new_avc_log_callback")) SWIG_fail;
8a44c08
-  result = (struct avc_log_callback *)(struct avc_log_callback *) calloc(1, sizeof(struct avc_log_callback));
8a44c08
+  result = (struct avc_log_callback *)calloc(1, sizeof(struct avc_log_callback));
8a44c08
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_avc_log_callback, SWIG_POINTER_NEW |  0 );
8a44c08
   return resultobj;
8a44c08
 fail:
8a44c08
@@ -8239,7 +8257,7 @@
8a44c08
 
8a44c08
 SWIGINTERN PyObject *avc_log_callback_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
8a44c08
   PyObject *obj;
8a44c08
-  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
8a44c08
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
8a44c08
   SWIG_TypeNewClientData(SWIGTYPE_p_avc_log_callback, SWIG_NewClientData(obj));
8a44c08
   return SWIG_Py_Void();
8a44c08
 }
8a44c08
@@ -8353,7 +8371,7 @@
8a44c08
   struct avc_thread_callback *result = 0 ;
8a44c08
   
8a44c08
   if (!PyArg_ParseTuple(args,(char *)":new_avc_thread_callback")) SWIG_fail;
8a44c08
-  result = (struct avc_thread_callback *)(struct avc_thread_callback *) calloc(1, sizeof(struct avc_thread_callback));
8a44c08
+  result = (struct avc_thread_callback *)calloc(1, sizeof(struct avc_thread_callback));
8a44c08
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_avc_thread_callback, SWIG_POINTER_NEW |  0 );
8a44c08
   return resultobj;
8a44c08
 fail:
8a44c08
@@ -8385,7 +8403,7 @@
8a44c08
 
8a44c08
 SWIGINTERN PyObject *avc_thread_callback_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
8a44c08
   PyObject *obj;
8a44c08
-  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
8a44c08
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
8a44c08
   SWIG_TypeNewClientData(SWIGTYPE_p_avc_thread_callback, SWIG_NewClientData(obj));
8a44c08
   return SWIG_Py_Void();
8a44c08
 }
8a44c08
@@ -8603,7 +8621,7 @@
8a44c08
   struct avc_lock_callback *result = 0 ;
8a44c08
   
8a44c08
   if (!PyArg_ParseTuple(args,(char *)":new_avc_lock_callback")) SWIG_fail;
8a44c08
-  result = (struct avc_lock_callback *)(struct avc_lock_callback *) calloc(1, sizeof(struct avc_lock_callback));
8a44c08
+  result = (struct avc_lock_callback *)calloc(1, sizeof(struct avc_lock_callback));
8a44c08
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_avc_lock_callback, SWIG_POINTER_NEW |  0 );
8a44c08
   return resultobj;
8a44c08
 fail:
8a44c08
@@ -8635,7 +8653,7 @@
8a44c08
 
8a44c08
 SWIGINTERN PyObject *avc_lock_callback_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
8a44c08
   PyObject *obj;
8a44c08
-  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
8a44c08
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
8a44c08
   SWIG_TypeNewClientData(SWIGTYPE_p_avc_lock_callback, SWIG_NewClientData(obj));
8a44c08
   return SWIG_Py_Void();
8a44c08
 }
8a44c08
@@ -9493,7 +9511,7 @@
8a44c08
   struct avc_cache_stats *result = 0 ;
8a44c08
   
8a44c08
   if (!PyArg_ParseTuple(args,(char *)":new_avc_cache_stats")) SWIG_fail;
8a44c08
-  result = (struct avc_cache_stats *)(struct avc_cache_stats *) calloc(1, sizeof(struct avc_cache_stats));
8a44c08
+  result = (struct avc_cache_stats *)calloc(1, sizeof(struct avc_cache_stats));
8a44c08
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_avc_cache_stats, SWIG_POINTER_NEW |  0 );
8a44c08
   return resultobj;
8a44c08
 fail:
8a44c08
@@ -9525,7 +9543,7 @@
8a44c08
 
8a44c08
 SWIGINTERN PyObject *avc_cache_stats_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
8a44c08
   PyObject *obj;
8a44c08
-  if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL;
8a44c08
+  if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
8a44c08
   SWIG_TypeNewClientData(SWIGTYPE_p_avc_cache_stats, SWIG_NewClientData(obj));
8a44c08
   return SWIG_Py_Void();
8a44c08
 }
8a44c08
@@ -10513,7 +10531,7 @@
8a44c08
 SWIG_InitializeModule(void *clientdata) {
8a44c08
   size_t i;
8a44c08
   swig_module_info *module_head, *iter;
8a44c08
-  int found;
8a44c08
+  int found, init;
8a44c08
   
8a44c08
   clientdata = clientdata;
8a44c08
   
8a44c08
@@ -10523,6 +10541,9 @@
8a44c08
     swig_module.type_initial = swig_type_initial;
8a44c08
     swig_module.cast_initial = swig_cast_initial;
8a44c08
     swig_module.next = &swig_module;
8a44c08
+    init = 1;
8a44c08
+  } else {
8a44c08
+    init = 0;
8a44c08
   }
8a44c08
   
8a44c08
   /* Try and load any already created modules */
8a44c08
@@ -10551,6 +10572,12 @@
8a44c08
     module_head->next = &swig_module;
8a44c08
   }
8a44c08
   
8a44c08
+  /* When multiple interpeters are used, a module could have already been initialized in
8a44c08
+       a different interpreter, but not yet have a pointer in this interpreter.
8a44c08
+       In this case, we do not want to continue adding types... everything should be
8a44c08
+       set up already */
8a44c08
+  if (init == 0) return;
8a44c08
+  
8a44c08
   /* Now work on filling in swig_module.types */
8a44c08
 #ifdef SWIGRUNTIME_DEBUG
8a44c08
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);