- Fix swig call for getpidcon

This commit is contained in:
Daniel J Walsh 2005-12-20 14:44:43 +00:00
parent 41b7ee2ce3
commit 407234b39f
2 changed files with 209 additions and 19 deletions

View File

@ -1,17 +1,204 @@
diff --exclude-from=exclude -N -u -r nsalibselinux/src/init.c libselinux-1.29.1/src/init.c
--- nsalibselinux/src/init.c 2005-10-06 12:31:32.000000000 -0400
+++ libselinux-1.29.1/src/init.c 2005-12-13 15:39:22.000000000 -0500
@@ -118,6 +118,13 @@
#ifdef SHARED
context_translations = 0;
if (translation_lib_handle) {
+ int (*lib_trans_finish)(void) = NULL;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig.i libselinux-1.29.2/src/selinuxswig.i
--- nsalibselinux/src/selinuxswig.i 2005-12-08 12:52:24.000000000 -0500
+++ libselinux-1.29.2/src/selinuxswig.i 2005-12-20 09:41:32.000000000 -0500
@@ -36,7 +37,7 @@
extern int is_selinux_mls_enabled(void);
extern int getcon(security_context_t *con);
extern int setcon(security_context_t con);
-extern int getpidcon(pid_t pid, security_context_t *con);
+extern int getpidcon(int pid, security_context_t *con);
extern int getprevcon(security_context_t *con);
extern int getexeccon(security_context_t *con);
extern int setexeccon(security_context_t con);
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig_wrap.c libselinux-1.29.2/src/selinuxswig_wrap.c
--- nsalibselinux/src/selinuxswig_wrap.c 2005-12-08 12:52:24.000000000 -0500
+++ libselinux-1.29.2/src/selinuxswig_wrap.c 2005-12-20 09:41:35.000000000 -0500
@@ -1322,17 +1322,16 @@
/* -------- TYPES TABLE (BEGIN) -------- */
#define SWIGTYPE_p_mode_t swig_types[0]
-#define SWIGTYPE_p_pid_t swig_types[1]
-#define SWIGTYPE_p_SELboolean swig_types[2]
-#define SWIGTYPE_p_char swig_types[3]
-#define SWIGTYPE_p_p_p_char swig_types[4]
-#define SWIGTYPE_p_access_vector_t swig_types[5]
-#define SWIGTYPE_p_p_char swig_types[6]
-#define SWIGTYPE_size_t swig_types[7]
-#define SWIGTYPE_p_security_context_t swig_types[8]
-#define SWIGTYPE_ptrdiff_t swig_types[9]
-#define SWIGTYPE_p_int swig_types[10]
-static swig_type_info *swig_types[12];
+#define SWIGTYPE_p_SELboolean swig_types[1]
+#define SWIGTYPE_p_char swig_types[2]
+#define SWIGTYPE_p_p_p_char swig_types[3]
+#define SWIGTYPE_p_access_vector_t swig_types[4]
+#define SWIGTYPE_p_p_char swig_types[5]
+#define SWIGTYPE_size_t swig_types[6]
+#define SWIGTYPE_p_security_context_t swig_types[7]
+#define SWIGTYPE_ptrdiff_t swig_types[8]
+#define SWIGTYPE_p_int swig_types[9]
+static swig_type_info *swig_types[11];
/* -------- TYPES TABLE (END) -------- */
@@ -1355,59 +1354,7 @@
int is_selinux_mls_enabled(void);
int getcon(security_context_t *);
int setcon(security_context_t);
-int getpidcon(pid_t,security_context_t *);
-int getprevcon(security_context_t *);
-int getexeccon(security_context_t *);
-int setexeccon(security_context_t);
-int getfscreatecon(security_context_t *);
-int setfscreatecon(security_context_t);
-int getfilecon(char const *,security_context_t *);
-
-/* returns SWIG_OLDOBJ if the input is a raw char*, SWIG_PYSTR if is a PyString */
-SWIGINTERN int
-SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize)
-{
- static swig_type_info* pchar_info = 0;
- char* vptr = 0;
- if (!pchar_info) pchar_info = SWIG_TypeQuery("char *");
- if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_info, 0) != -1) {
- if (cptr) *cptr = vptr;
- if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
- return SWIG_OLDOBJ;
- } else {
- PyErr_Clear();
- if (PyString_Check(obj)) {
- if (cptr) {
- *cptr = PyString_AS_STRING(obj);
- if (psize) {
- *psize = PyString_GET_SIZE(obj) + 1;
- }
- }
- return SWIG_PYSTR;
- }
- }
- if (cptr) {
- SWIG_type_error("char *", obj);
- }
- return 0;
-}
-
-
-SWIGINTERNSHORT int
-SWIG_AsCharPtr(PyObject *obj, char **val)
-{
- if (SWIG_AsCharPtrAndSize(obj, val, (size_t*)(0))) {
- return 1;
- }
- if (val) {
- PyErr_Clear();
- SWIG_type_error("char *", obj);
- }
- return 0;
-}
-
-int lgetfilecon(char const *,security_context_t *);
-int fgetfilecon(int,security_context_t *);
+int getpidcon(int,security_context_t *);
#include <limits.h>
@@ -1509,6 +1456,58 @@
return SWIG_AsVal_int(obj, (int*)0);
}
+int getprevcon(security_context_t *);
+int getexeccon(security_context_t *);
+int setexeccon(security_context_t);
+int getfscreatecon(security_context_t *);
+int setfscreatecon(security_context_t);
+int getfilecon(char const *,security_context_t *);
+
+ lib_trans_finish = dlsym(translation_lib_handle,
+ "finish_context_translations");
+ if (! dlerror())
+ lib_trans_finish();
+
dlclose(translation_lib_handle);
translation_lib_handle = NULL;
}
+/* returns SWIG_OLDOBJ if the input is a raw char*, SWIG_PYSTR if is a PyString */
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize)
+{
+ static swig_type_info* pchar_info = 0;
+ char* vptr = 0;
+ if (!pchar_info) pchar_info = SWIG_TypeQuery("char *");
+ if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_info, 0) != -1) {
+ if (cptr) *cptr = vptr;
+ if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
+ return SWIG_OLDOBJ;
+ } else {
+ PyErr_Clear();
+ if (PyString_Check(obj)) {
+ if (cptr) {
+ *cptr = PyString_AS_STRING(obj);
+ if (psize) {
+ *psize = PyString_GET_SIZE(obj) + 1;
+ }
+ }
+ return SWIG_PYSTR;
+ }
+ }
+ if (cptr) {
+ SWIG_type_error("char *", obj);
+ }
+ return 0;
+}
+
+
+SWIGINTERNSHORT int
+SWIG_AsCharPtr(PyObject *obj, char **val)
+{
+ if (SWIG_AsCharPtrAndSize(obj, val, (size_t*)(0))) {
+ return 1;
+ }
+ if (val) {
+ PyErr_Clear();
+ SWIG_type_error("char *", obj);
+ }
+ return 0;
+}
+
+int lgetfilecon(char const *,security_context_t *);
+int fgetfilecon(int,security_context_t *);
int setfilecon(char const *,security_context_t);
int lsetfilecon(char const *,security_context_t);
int fsetfilecon(int,security_context_t);
@@ -1799,7 +1798,7 @@
static PyObject *_wrap_getpidcon(PyObject *self, PyObject *args) {
PyObject *resultobj;
- pid_t arg1 ;
+ int arg1 ;
security_context_t *arg2 = (security_context_t *) 0 ;
int result;
security_context_t temp2 ;
@@ -1810,14 +1809,8 @@
}
if(!PyArg_ParseTuple(args,(char *)"O:getpidcon",&obj0)) goto fail;
{
- pid_t * argp;
- SWIG_Python_ConvertPtr(obj0, (void **)&argp, SWIGTYPE_p_pid_t, SWIG_POINTER_EXCEPTION);
- if (SWIG_arg_fail(1)) SWIG_fail;
- if (argp == NULL) {
- SWIG_null_ref("pid_t");
- }
+ arg1 = (int)(SWIG_As_int(obj0));
if (SWIG_arg_fail(1)) SWIG_fail;
- arg1 = *argp;
}
result = (int)getpidcon(arg1,arg2);
@@ -3142,7 +3135,6 @@
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
static swig_type_info _swigt__p_mode_t[] = {{"_p_mode_t", 0, "mode_t *", 0, 0, 0, 0},{"_p_mode_t", 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0}};
-static swig_type_info _swigt__p_pid_t[] = {{"_p_pid_t", 0, "pid_t *", 0, 0, 0, 0},{"_p_pid_t", 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0}};
static swig_type_info _swigt__p_SELboolean[] = {{"_p_SELboolean", 0, "SELboolean *", 0, 0, 0, 0},{"_p_SELboolean", 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0}};
static swig_type_info _swigt__p_char[] = {{"_p_char", 0, "char *", 0, 0, 0, 0},{"_p_char", 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0}};
static swig_type_info _swigt__p_p_p_char[] = {{"_p_p_p_char", 0, "char ***", 0, 0, 0, 0},{"_p_p_p_char", 0, 0, 0, 0, 0, 0},{0, 0, 0, 0, 0, 0, 0}};
@@ -3155,7 +3147,6 @@
static swig_type_info *swig_types_initial[] = {
_swigt__p_mode_t,
-_swigt__p_pid_t,
_swigt__p_SELboolean,
_swigt__p_char,
_swigt__p_p_p_char,

View File

@ -3,11 +3,11 @@
Summary: SELinux library and simple utilities
Name: libselinux
Version: 1.29.2
Release: 2
Release: 3
License: Public domain (uncopyrighted)
Group: System Environment/Libraries
Source: http://www.nsa.gov/selinux/archives/%{name}-%{version}.tgz
#Patch: libselinux-rhat.patch
Patch: libselinux-rhat.patch
Requires: libsepol >= %{libsepolver}
Requires: libsetrans >= %{libsetransver}
@ -49,7 +49,7 @@ needed for developing SELinux applications.
%prep
%setup -q
#%patch -p1 -b .rhat
%patch -p1 -b .rhat
%build
make clean
@ -109,6 +109,9 @@ exit 0
%{_libdir}/python2.4/site-packages/selinux.py*
%changelog
* Tue Dec 20 2005 Dan Walsh <dwalsh@redhat.com> 1.29.2-3
- Fix swig call for getpidcon
* Mon Dec 19 2005 Dan Walsh <dwalsh@redhat.com> 1.29.2-2
- Move libselinux.so to base package