libselinux/libselinux-rhat.patch

41 lines
1.4 KiB
Diff
Raw Normal View History

diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig.i libselinux-2.0.15/src/selinuxswig.i
--- nsalibselinux/src/selinuxswig.i 2007-05-18 09:58:34.000000000 -0400
+++ libselinux-2.0.15/src/selinuxswig.i 2007-05-15 15:07:02.000000000 -0400
@@ -41,6 +40,36 @@
$1 = (security_context_t)PyString_AsString($input);
}
+%typemap(python,argout) security_context_t ** {
+ int i;
+ PyObject *security_context_string;
+
+ PyObject *list_security_context = PyList_New(0); // Create the list.
+ if (list_security_context) {
+ security_context_t *p_security_context_t = *arg3;
+ for (i=0; i < result; i++) {
+ security_context_string = PyString_FromString(strdup((char *)p_security_context_t[i]));
+ if (PyList_Append(list_security_context, security_context_string) < 0) {
+ PyErr_SetString(PyExc_MemoryError,"typemap(argout) security_context_t **: Fail to insert item in list.");
+ Py_DECREF(list_security_context);
+ $result = SWIG_From_int(STATUS_ERR);
+ break;
+ }
+ }
+ freeconary(p_security_context_t);
+ }
+ else {
+ PyErr_SetString(PyExc_MemoryError,"typemap(argout) security_context_t **: Fail to create list.");
+ $result = SWIG_From_int(STATUS_ERR);
+ }
+
+ %append_output(list_security_context);
+}
+
+%typemap(in, numinputs=0) security_context_t **(security_context_t *temp=NULL) {
+ $1 = &temp;
+}
+
%typedef unsigned mode_t;
%include "../include/selinux/get_context_list.h"