libselinux/libselinux-rhat.patch
Daniel J Walsh e0ab958383 - Add selinuxswig fixes
- Stop using PAGE_SIZE and start using sysconfig(_SC_PAGE_SIZE)
2006-05-02 18:23:25 +00:00

218 lines
6.8 KiB
Diff

diff --exclude-from=exclude -N -u -r nsalibselinux/src/canonicalize_context.c libselinux-1.30.3/src/canonicalize_context.c
--- nsalibselinux/src/canonicalize_context.c 2005-11-08 09:34:17.000000000 -0500
+++ libselinux-1.30.3/src/canonicalize_context.c 2006-05-02 14:11:27.000000000 -0400
@@ -23,7 +23,7 @@
if (fd < 0)
return -1;
- size = PAGE_SIZE;
+ size = selinux_page_size;
buf = malloc(size);
if (!buf) {
ret = -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/compute_av.c libselinux-1.30.3/src/compute_av.c
--- nsalibselinux/src/compute_av.c 2005-08-23 13:34:34.000000000 -0400
+++ libselinux-1.30.3/src/compute_av.c 2006-05-02 14:11:33.000000000 -0400
@@ -26,7 +26,7 @@
if (fd < 0)
return -1;
- len = PAGE_SIZE;
+ len = selinux_page_size;
buf = malloc(len);
if (!buf) {
ret = -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/compute_create.c libselinux-1.30.3/src/compute_create.c
--- nsalibselinux/src/compute_create.c 2005-08-23 13:34:34.000000000 -0400
+++ libselinux-1.30.3/src/compute_create.c 2006-05-02 14:11:39.000000000 -0400
@@ -25,7 +25,7 @@
if (fd < 0)
return -1;
- size = PAGE_SIZE;
+ size = selinux_page_size;
buf = malloc(size);
if (!buf) {
ret = -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/compute_member.c libselinux-1.30.3/src/compute_member.c
--- nsalibselinux/src/compute_member.c 2005-08-25 11:32:02.000000000 -0400
+++ libselinux-1.30.3/src/compute_member.c 2006-05-02 14:11:55.000000000 -0400
@@ -25,7 +25,7 @@
if (fd < 0)
return -1;
- size = PAGE_SIZE;
+ size = selinux_page_size;
buf = malloc(size);
if (!buf) {
ret = -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/compute_relabel.c libselinux-1.30.3/src/compute_relabel.c
--- nsalibselinux/src/compute_relabel.c 2005-08-25 11:32:02.000000000 -0400
+++ libselinux-1.30.3/src/compute_relabel.c 2006-05-02 14:12:05.000000000 -0400
@@ -25,7 +25,7 @@
if (fd < 0)
return -1;
- size = PAGE_SIZE;
+ size = selinux_page_size;
buf = malloc(size);
if (!buf) {
ret = -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/compute_user.c libselinux-1.30.3/src/compute_user.c
--- nsalibselinux/src/compute_user.c 2005-08-23 13:34:34.000000000 -0400
+++ libselinux-1.30.3/src/compute_user.c 2006-05-02 14:13:15.000000000 -0400
@@ -26,7 +26,7 @@
if (fd < 0)
return -1;
- size = PAGE_SIZE;
+ size = selinux_page_size;
buf = malloc(size);
if (!buf) {
ret = -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/enabled.c libselinux-1.30.3/src/enabled.c
--- nsalibselinux/src/enabled.c 2005-08-23 13:34:34.000000000 -0400
+++ libselinux-1.30.3/src/enabled.c 2006-05-02 14:13:20.000000000 -0400
@@ -22,7 +22,7 @@
if (fd < 0)
return -1;
- size = PAGE_SIZE;
+ size = selinux_page_size;
buf = malloc(size);
if (!buf) {
enabled = -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/getcon.c libselinux-1.30.3/src/getcon.c
--- nsalibselinux/src/getcon.c 2005-08-23 13:34:34.000000000 -0400
+++ libselinux-1.30.3/src/getcon.c 2006-05-02 14:13:24.000000000 -0400
@@ -18,7 +18,7 @@
if (fd < 0)
return -1;
- size = PAGE_SIZE;
+ size = selinux_page_size;
buf = malloc(size);
if (!buf) {
ret = -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/getexeccon.c libselinux-1.30.3/src/getexeccon.c
--- nsalibselinux/src/getexeccon.c 2005-08-25 11:32:02.000000000 -0400
+++ libselinux-1.30.3/src/getexeccon.c 2006-05-02 14:13:34.000000000 -0400
@@ -18,7 +18,7 @@
if (fd < 0)
return -1;
- size = PAGE_SIZE;
+ size = selinux_page_size;
buf = malloc(size);
if (!buf) {
ret = -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/getfscreatecon.c libselinux-1.30.3/src/getfscreatecon.c
--- nsalibselinux/src/getfscreatecon.c 2005-08-25 11:32:02.000000000 -0400
+++ libselinux-1.30.3/src/getfscreatecon.c 2006-05-02 14:13:39.000000000 -0400
@@ -18,7 +18,7 @@
if (fd < 0)
return -1;
- size = PAGE_SIZE;
+ size = selinux_page_size;
buf = malloc(size);
if (!buf) {
ret = -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/getpidcon.c libselinux-1.30.3/src/getpidcon.c
--- nsalibselinux/src/getpidcon.c 2005-08-25 11:32:02.000000000 -0400
+++ libselinux-1.30.3/src/getpidcon.c 2006-05-02 14:13:46.000000000 -0400
@@ -22,7 +22,7 @@
if (fd < 0)
return -1;
- size = PAGE_SIZE;
+ size = selinux_page_size;
buf = malloc(size);
if (!buf) {
ret = -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/getprevcon.c libselinux-1.30.3/src/getprevcon.c
--- nsalibselinux/src/getprevcon.c 2005-08-23 13:34:34.000000000 -0400
+++ libselinux-1.30.3/src/getprevcon.c 2006-05-02 14:13:51.000000000 -0400
@@ -18,7 +18,7 @@
if (fd < 0)
return -1;
- size = PAGE_SIZE;
+ size = selinux_page_size;
buf = malloc(size);
if (!buf) {
ret = -1;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/init.c libselinux-1.30.3/src/init.c
--- nsalibselinux/src/init.c 2005-12-14 14:16:46.000000000 -0500
+++ libselinux-1.30.3/src/init.c 2006-05-02 14:18:48.000000000 -0400
@@ -7,12 +7,14 @@
#include <asm/page.h>
#include <stdio.h>
#include <dlfcn.h>
+#include <unistd.h>
#include "dso.h"
#include "policy.h"
#include "selinux_internal.h"
char *selinux_mnt = NULL;
+int selinux_page_size=0;
static void init_selinuxmnt(void)
{
@@ -27,11 +29,12 @@
if (!fp)
return;
- size = PAGE_SIZE;
+ size = selinux_page_size;
+
buf = malloc(size);
if (!buf)
goto out;
-
+
memset(buf, 0, size);
while(( bufp = fgets_unlocked(buf, size, fp)))
@@ -134,6 +137,7 @@
static void init_lib(void) __attribute__ ((constructor));
static void init_lib(void)
{
+ selinux_page_size = sysconf(_SC_PAGE_SIZE);
init_selinuxmnt();
init_translations();
}
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinux_internal.h libselinux-1.30.3/src/selinux_internal.h
--- nsalibselinux/src/selinux_internal.h 2005-12-01 10:10:32.000000000 -0500
+++ libselinux-1.30.3/src/selinux_internal.h 2006-05-02 14:11:05.000000000 -0400
@@ -71,3 +71,4 @@
extern int load_setlocaldefs hidden;
extern int require_seusers hidden;
+extern int selinux_page_size hidden;
diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig.i libselinux-1.30.3/src/selinuxswig.i
--- nsalibselinux/src/selinuxswig.i 2006-04-14 07:21:23.000000000 -0400
+++ libselinux-1.30.3/src/selinuxswig.i 2006-05-02 13:08:05.000000000 -0400
@@ -28,9 +28,18 @@
%typemap(in, numinputs=0) security_context_t *(security_context_t temp) {
$1 = &temp;
}
-%typemap(argout) security_context_t * {
- $result = SWIG_Python_AppendOutput($result, PyString_FromString(*$1));
+%typemap(argout) security_context_t * (char *temp) {
+ if (*$1)
+ temp = *$1;
+ else
+ temp = "";
+ $result = SWIG_Python_AppendOutput($result, PyString_FromString(temp));
+}
+
+%typemap(in) security_context_t {
+ $1 = (security_context_t)PyString_AsString($input);
}
+
%typedef unsigned mode_t;
extern int is_selinux_enabled(void);