From 14de1c34ad907f2bd0b4409bf1ecf210368861ad Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 20 Feb 2007 14:31:07 +0000 Subject: [PATCH] - Upgrade to upstream Merged patch from Todd Miller to convert int types over to C99 style. --- .cvsignore | 1 + libselinux-rhat.patch | 126 ++++++++++++++++++++++++++++++++++-------- libselinux.spec | 6 +- sources | 2 +- 4 files changed, 109 insertions(+), 26 deletions(-) diff --git a/.cvsignore b/.cvsignore index c9260f1..f1188d1 100644 --- a/.cvsignore +++ b/.cvsignore @@ -106,3 +106,4 @@ libselinux-1.33.6.tgz libselinux-1.34.0.tgz libselinux-1.34.1.tgz libselinux-2.0.0.tgz +libselinux-2.0.1.tgz diff --git a/libselinux-rhat.patch b/libselinux-rhat.patch index 0e6abf0..e7afea2 100644 --- a/libselinux-rhat.patch +++ b/libselinux-rhat.patch @@ -1,27 +1,5 @@ -diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig.i libselinux-1.34.0/src/selinuxswig.i ---- nsalibselinux/src/selinuxswig.i 2007-01-26 16:19:52.000000000 -0500 -+++ libselinux-1.34.0/src/selinuxswig.i 2007-01-24 13:37:27.000000000 -0500 -@@ -28,7 +28,7 @@ - %typemap(in, numinputs=0) security_context_t *(security_context_t temp=NULL) { - $1 = &temp; - } --%typemap(argout) security_context_t * (char *temp) { -+%typemap(argout) security_context_t * (char *temp=NULL) { - if (*$1) - temp = *$1; - else -@@ -126,7 +126,7 @@ - extern int selinux_raw_to_trans_context(char *raw, - security_context_t *transp); - --%typemap(in, numinputs=0) char **(char *temp) { -+%typemap(in, numinputs=0) char **(char *temp=NULL) { - $1 = &temp; - } - -diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig_wrap.c libselinux-1.34.0/src/selinuxswig_wrap.c ---- nsalibselinux/src/selinuxswig_wrap.c 2007-01-26 16:19:52.000000000 -0500 -+++ libselinux-1.34.0/src/selinuxswig_wrap.c 2007-01-24 13:38:47.000000000 -0500 +--- libselinux-2.0.1/src/selinuxswig_wrap.c.rhat 2007-02-20 09:25:03.000000000 -0500 ++++ libselinux-2.0.1/src/selinuxswig_wrap.c 2007-02-20 09:25:14.000000000 -0500 @@ -2832,7 +2832,7 @@ security_context_t *arg1 = (security_context_t *) 0 ; int result; @@ -186,3 +164,103 @@ diff --exclude-from=exclude -N -u -r nsalibselinux/src/selinuxswig_wrap.c libsel PyObject * obj0 = 0 ; { +--- libselinux-2.0.1/src/enabled.c.rhat 2007-02-20 09:25:03.000000000 -0500 ++++ libselinux-2.0.1/src/enabled.c 2007-02-20 09:27:53.000000000 -0500 +@@ -8,10 +8,44 @@ + #include + #include "policy.h" + ++static int readFD (int fd, char **buf) ++{ ++ char *p; ++ size_t size = 16384; ++ int s, filesize; ++ ++ *buf = calloc (16384, sizeof (char)); ++ if (*buf == 0) ++ return -1; ++ ++ filesize = 0; ++ do { ++ p = &(*buf) [filesize]; ++ do { ++ s = read (fd, p, 16384); ++ } while (s < 0 && errno == EINTR); ++ if (s < 0) ++ break; ++ filesize += s; ++ /* only exit for empty reads */ ++ if (s == 0) ++ break; ++ size += s; ++ *buf = realloc (*buf, size); ++ } while (1); ++ ++ if (filesize == 0 && s < 0) { ++ free (*buf); ++ *buf = NULL; ++ return -1; ++ } ++ ++ return filesize; ++} ++ + int is_selinux_enabled(void) + { +- char *buf; +- size_t size; ++ char *buf = NULL; + int fd; + ssize_t ret; + int enabled = 0; +@@ -21,19 +55,11 @@ + if (fd < 0) + return -1; + +- size = selinux_page_size; +- buf = malloc(size); +- if (!buf) { +- enabled = -1; +- goto out; +- } +- +- memset(buf, 0, size); +- +- ret = read(fd, buf, size - 1); ++ ret = readFD(fd, &buf); ++ close(fd); + if (ret < 0) { + enabled = -1; +- goto out2; ++ goto out; + } + + if (!strstr(buf, "selinuxfs")) +@@ -49,7 +75,6 @@ + out2: + free(buf); + out: +- close(fd); + return enabled; + } + +--- libselinux-2.0.1/src/selinuxswig.i.rhat 2007-02-20 09:25:03.000000000 -0500 ++++ libselinux-2.0.1/src/selinuxswig.i 2007-02-20 09:25:14.000000000 -0500 +@@ -28,7 +28,7 @@ + %typemap(in, numinputs=0) security_context_t *(security_context_t temp=NULL) { + $1 = &temp; + } +-%typemap(argout) security_context_t * (char *temp) { ++%typemap(argout) security_context_t * (char *temp=NULL) { + if (*$1) + temp = *$1; + else +@@ -126,7 +126,7 @@ + extern int selinux_raw_to_trans_context(char *raw, + security_context_t *transp); + +-%typemap(in, numinputs=0) char **(char *temp) { ++%typemap(in, numinputs=0) char **(char *temp=NULL) { + $1 = &temp; + } + diff --git a/libselinux.spec b/libselinux.spec index 02dfb1c..c12c0e0 100644 --- a/libselinux.spec +++ b/libselinux.spec @@ -1,7 +1,7 @@ %define libsepolver 2.0.1-1 Summary: SELinux library and simple utilities Name: libselinux -Version: 2.0.0 +Version: 2.0.1 Release: 1%{?dist} License: Public domain (uncopyrighted) Group: System Environment/Libraries @@ -121,6 +121,10 @@ exit 0 %{_libdir}/python*/site-packages/selinux.py* %changelog +* Tue Feb 20 2007 Dan Walsh - 2.0.1-1 +- Upgrade to upstream + * Merged patch from Todd Miller to convert int types over to C99 style. + * Wed Feb 7 2007 Dan Walsh - 2.0.0-1 * Merged patch from Todd Miller to remove sscanf in matchpathcon.c because of the use of the non-standard format %as. (original patch changed diff --git a/sources b/sources index a6976e2..572972c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -29400f2400f108c88e1051a62a139d48 libselinux-2.0.0.tgz +d8b478690440a9012c629a65158823f2 libselinux-2.0.1.tgz