- Fix up patch to get it upstreamed

This commit is contained in:
Daniel J Walsh 2009-01-12 15:55:47 +00:00
parent 26c90567dd
commit 25dcff4b7d
2 changed files with 64 additions and 57 deletions

View File

@ -1,6 +1,6 @@
diff --exclude-from=exclude -N -u -r nsalibsemanage/include/semanage/modules.h libsemanage-2.0.30/include/semanage/modules.h diff --exclude-from=exclude -N -u -r nsalibsemanage/include/semanage/modules.h libsemanage-2.0.30/include/semanage/modules.h
--- nsalibsemanage/include/semanage/modules.h 2008-08-28 09:34:24.000000000 -0400 --- nsalibsemanage/include/semanage/modules.h 2008-08-28 09:34:24.000000000 -0400
+++ libsemanage-2.0.30/include/semanage/modules.h 2008-12-04 15:15:23.000000000 -0500 +++ libsemanage-2.0.30/include/semanage/modules.h 2009-01-12 09:38:35.420740000 -0500
@@ -30,10 +30,16 @@ @@ -30,10 +30,16 @@
int semanage_module_install(semanage_handle_t *, int semanage_module_install(semanage_handle_t *,
@ -18,21 +18,9 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/include/semanage/modules.h l
int semanage_module_remove(semanage_handle_t *, char *module_name); int semanage_module_remove(semanage_handle_t *, char *module_name);
/* semanage_module_info is for getting information on installed /* semanage_module_info is for getting information on installed
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/Makefile libsemanage-2.0.30/src/Makefile
--- nsalibsemanage/src/Makefile 2008-08-28 09:34:24.000000000 -0400
+++ libsemanage-2.0.30/src/Makefile 2008-12-04 15:15:23.000000000 -0500
@@ -54,7 +54,7 @@
ranlib $@
$(LIBSO): $(LOBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol -lselinux -lustr -L$(LIBDIR) -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol -lselinux -lbz2 -lustr -L$(LIBDIR) -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
ln -sf $@ $(TARGET)
conf-scan.c: conf-scan.l conf-parse.h
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage-2.0.30/src/direct_api.c diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage-2.0.30/src/direct_api.c
--- nsalibsemanage/src/direct_api.c 2008-11-14 17:10:15.000000000 -0500 --- nsalibsemanage/src/direct_api.c 2008-11-14 17:10:15.000000000 -0500
+++ libsemanage-2.0.30/src/direct_api.c 2008-12-04 15:15:23.000000000 -0500 +++ libsemanage-2.0.30/src/direct_api.c 2009-01-12 10:20:45.394714000 -0500
@@ -50,6 +50,7 @@ @@ -50,6 +50,7 @@
#include "semanage_store.h" #include "semanage_store.h"
#include "database_policydb.h" #include "database_policydb.h"
@ -76,8 +64,8 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+#include <string.h> +#include <string.h>
+#include <sys/sendfile.h> +#include <sys/sendfile.h>
+ +
+/* bzip() a file to '*data', returning the total number of uncompressed bytes +/* bzip() a data to a file, returning the total number of compressed bytes
+ * in the file. Returns 0 if file could not be decompressed. */ + * in the file. Returns -1 if file could not be compressed. */
+static size_t bzip(const char *filename, char *data, size_t num_bytes) { +static size_t bzip(const char *filename, char *data, size_t num_bytes) {
+ BZFILE* b; + BZFILE* b;
+ size_t size = 1<<16; + size_t size = 1<<16;
@ -87,13 +75,13 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+ FILE *f; + FILE *f;
+ +
+ if ((f = fopen(filename, "wb")) == NULL) { + if ((f = fopen(filename, "wb")) == NULL) {
+ return 0; + return -1;
+ } + }
+ +
+ b = BZ2_bzWriteOpen( &bzerror, f, 9, 0, 0); + b = BZ2_bzWriteOpen( &bzerror, f, 9, 0, 0);
+ if (bzerror != BZ_OK) { + if (bzerror != BZ_OK) {
+ BZ2_bzWriteClose ( &bzerror, b, 1, 0, 0 ); + BZ2_bzWriteClose ( &bzerror, b, 1, 0, 0 );
+ return 0; + return -1;
+ } + }
+ +
+ while ( num_bytes > total ) { + while ( num_bytes > total ) {
@ -105,7 +93,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+ BZ2_bzWrite ( &bzerror, b, &data[total], len ); + BZ2_bzWrite ( &bzerror, b, &data[total], len );
+ if (bzerror == BZ_IO_ERROR) { + if (bzerror == BZ_IO_ERROR) {
+ BZ2_bzWriteClose ( &bzerror, b, 1, 0, 0 ); + BZ2_bzWriteClose ( &bzerror, b, 1, 0, 0 );
+ return 0; + return -1;
+ } + }
+ total += len; + total += len;
+ } + }
@ -113,13 +101,13 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+ BZ2_bzWriteClose ( &bzerror, b, 0, 0, 0 ); + BZ2_bzWriteClose ( &bzerror, b, 0, 0, 0 );
+ fclose(f); + fclose(f);
+ if (bzerror == BZ_IO_ERROR) { + if (bzerror == BZ_IO_ERROR) {
+ return 0; + return -1;
+ } + }
+ return total; + return total;
+} +}
+ +
+/* bunzip() a file to '*data', returning the total number of uncompressed bytes +/* bunzip() a file to '*data', returning the total number of uncompressed bytes
+ * in the file. Returns 0 if file could not be decompressed. */ + * in the file. Returns -1 if file could not be decompressed. */
+size_t bunzip(FILE *f, char **data) { +size_t bunzip(FILE *f, char **data) {
+ BZFILE* b; + BZFILE* b;
+ size_t nBuf; + size_t nBuf;
@ -131,7 +119,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+ b = BZ2_bzReadOpen ( &bzerror, f, 0, 0, NULL, 0 ); + b = BZ2_bzReadOpen ( &bzerror, f, 0, 0, NULL, 0 );
+ if ( bzerror != BZ_OK ) { + if ( bzerror != BZ_OK ) {
+ BZ2_bzReadClose ( &bzerror, b ); + BZ2_bzReadClose ( &bzerror, b );
+ return 0; + return -1;
+ } + }
+ +
+ char *uncompress = realloc(NULL, size); + char *uncompress = realloc(NULL, size);
@ -150,7 +138,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+ if ( bzerror != BZ_STREAM_END ) { + if ( bzerror != BZ_STREAM_END ) {
+ BZ2_bzReadClose ( &bzerror, b ); + BZ2_bzReadClose ( &bzerror, b );
+ free(uncompress); + free(uncompress);
+ return 0; + return -1;
+ } + }
+ BZ2_bzReadClose ( &bzerror, b ); + BZ2_bzReadClose ( &bzerror, b );
+ +
@ -162,16 +150,16 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+ * If the file is bzip compressed map_file will uncompress + * If the file is bzip compressed map_file will uncompress
+ * the file into '*data'. + * the file into '*data'.
+ * Returns the total number of bytes in memory . + * Returns the total number of bytes in memory .
+ * Returns 0 if file could not be opened or mapped. */ + * Returns -1 if file could not be opened or mapped. */
+static size_t map_file(int fd, char **data, int *compressed) +static size_t map_file(int fd, char **data, int *compressed)
+{ +{
+ int size; + int size = -1;
+ char *uncompress; + char *uncompress;
+ if ((size = bunzip(fdopen(fd, "r"), &uncompress)) > 0) { + if ((size = bunzip(fdopen(fd, "r"), &uncompress)) > 0) {
+ *data = mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); + *data = mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
+ if (*data == MAP_FAILED) { + if (*data == MAP_FAILED) {
+ free(uncompress); + free(uncompress);
+ return 0; + return -1;
+ } else { + } else {
+ memcpy(*data, uncompress, size); + memcpy(*data, uncompress, size);
+ } + }
@ -182,7 +170,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+ if (fstat(fd, &sb) == -1 || + if (fstat(fd, &sb) == -1 ||
+ (*data = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) == + (*data = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) ==
+ MAP_FAILED) { + MAP_FAILED) {
+ size = 0; + size = -1;
+ } else { + } else {
+ size = sb.st_size; + size = sb.st_size;
+ } + }
@ -234,18 +222,19 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
seusers_modified, users_extra_modified; seusers_modified, users_extra_modified;
dbase_config_t *users = semanage_user_dbase_local(sh); dbase_config_t *users = semanage_user_dbase_local(sh);
dbase_config_t *users_base = semanage_user_base_dbase_local(sh); dbase_config_t *users_base = semanage_user_base_dbase_local(sh);
@@ -815,7 +967,9 @@ @@ -815,8 +967,10 @@
&filename)) != 0) { &filename)) != 0) {
goto cleanup; goto cleanup;
} }
- if (write_file(sh, filename, data, data_len) == -1) { - if (write_file(sh, filename, data, data_len) == -1) {
+
+ if (bzip(filename, data, data_len) == 0) { + if (bzip(filename, data, data_len) == 0) {
+ ERR(sh, "Error while writing to %s.", filename); + ERR(sh, "Error while writing to %s.", filename);
retval = -3; retval = -3;
+ goto cleanup;
} }
retval = 0; retval = 0;
@@ -826,19 +980,60 @@ cleanup:
@@ -826,17 +980,58 @@
return retval; return retval;
} }
@ -275,7 +264,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+ int in_fd = -1; + int in_fd = -1;
+ +
+ if ((in_fd = open(install_filename, O_RDONLY)) == -1) { + if ((in_fd = open(install_filename, O_RDONLY)) == -1) {
+ return 0; + return -1;
+ } + }
+ +
+ if ((data_len = map_file(in_fd, &data, &compressed)) == 0) { + if ((data_len = map_file(in_fd, &data, &compressed)) == 0) {
@ -312,12 +301,9 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+static int get_direct_upgrade_filename(semanage_handle_t * sh, +static int get_direct_upgrade_filename(semanage_handle_t * sh,
+ char *data, size_t data_len, char **outfilename) { + char *data, size_t data_len, char **outfilename) {
int i, retval, num_modules = 0; int i, retval, num_modules = 0;
- char *module_name = NULL, *version = NULL, *filename = NULL; char *module_name = NULL, *version = NULL, *filename = NULL;
+ char *filename = NULL, *module_name = NULL, *version = NULL;
semanage_module_info_t *modinfo = NULL; semanage_module_info_t *modinfo = NULL;
if ((retval = parse_module_headers(sh, data, data_len, @@ -868,14 +1063,9 @@
&module_name, &version,
@@ -868,14 +1063,10 @@
if (retval == -4) { if (retval == -4) {
ERR(sh, "There does not already exist a module named %s.", ERR(sh, "There does not already exist a module named %s.",
module_name); module_name);
@ -326,14 +312,13 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
- if (write_file(sh, filename, data, data_len) == -1) { - if (write_file(sh, filename, data, data_len) == -1) {
- retval = -3; - retval = -3;
} }
+
cleanup: cleanup:
free(version); free(version);
- free(filename); - free(filename);
free(module_name); free(module_name);
for (i = 0; modinfo != NULL && i < num_modules; i++) { for (i = 0; modinfo != NULL && i < num_modules; i++) {
semanage_module_info_t *m = semanage_module_info_t *m =
@@ -883,6 +1074,80 @@ @@ -883,6 +1073,80 @@
semanage_module_info_datum_destroy(m); semanage_module_info_datum_destroy(m);
} }
free(modinfo); free(modinfo);
@ -386,7 +371,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+ int in_fd = -1; + int in_fd = -1;
+ +
+ if ((in_fd = open(module_filename, O_RDONLY)) == -1) { + if ((in_fd = open(module_filename, O_RDONLY)) == -1) {
+ return 0; + return -1;
+ } + }
+ +
+ if ((data_len = map_file(in_fd, &data, &compressed)) == 0) { + if ((data_len = map_file(in_fd, &data, &compressed)) == 0) {
@ -414,7 +399,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
return retval; return retval;
} }
@@ -903,7 +1168,8 @@ @@ -903,14 +1167,59 @@
if ((filename = semanage_path(SEMANAGE_TMP, SEMANAGE_BASE)) == NULL) { if ((filename = semanage_path(SEMANAGE_TMP, SEMANAGE_BASE)) == NULL) {
goto cleanup; goto cleanup;
} }
@ -422,9 +407,10 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+ if (bzip(filename, base_data, data_len) == 0) { + if (bzip(filename, base_data, data_len) == 0) {
+ ERR(sh, "Error while writing to %s.", filename); + ERR(sh, "Error while writing to %s.", filename);
retval = -3; retval = -3;
+ goto cleanup;
} }
retval = 0; retval = 0;
@@ -911,6 +1177,49 @@ cleanup:
return retval; return retval;
} }
@ -443,7 +429,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+ int in_fd; + int in_fd;
+ +
+ if ((in_fd = open(install_filename, O_RDONLY)) == -1) { + if ((in_fd = open(install_filename, O_RDONLY)) == -1) {
+ return 0; + return -1;
+ } + }
+ +
+ if ((data_len = map_file(in_fd, &data, &compressed)) == 0) { + if ((data_len = map_file(in_fd, &data, &compressed)) == 0) {
@ -474,7 +460,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
/* Removes a module from the sandbox. Returns 0 on success, -1 if out /* Removes a module from the sandbox. Returns 0 on success, -1 if out
* of memory, -2 if module not found or could not be removed. */ * of memory, -2 if module not found or could not be removed. */
static int semanage_direct_remove(semanage_handle_t * sh, char *module_name) static int semanage_direct_remove(semanage_handle_t * sh, char *module_name)
@@ -1005,15 +1314,26 @@ @@ -1005,15 +1314,29 @@
* report it */ * report it */
continue; continue;
} }
@ -484,9 +470,12 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
+ if ((size = bunzip(fp, &data)) != 0) { + if ((size = bunzip(fp, &data)) != 0) {
+ fclose(fp); + fclose(fp);
+ fp = fmemopen(data, size, "rb"); + fp = fmemopen(data, size, "rb");
+ if (!fp) {
+ ERR(sh, "Out of memory!");
+ goto cleanup;
+ }
+ } + }
+ rewind(fp); + rewind(fp);
+
__fsetlocking(fp, FSETLOCKING_BYCALLER); __fsetlocking(fp, FSETLOCKING_BYCALLER);
sepol_policy_file_set_fp(pf, fp); sepol_policy_file_set_fp(pf, fp);
if (sepol_module_package_info(pf, &type, &name, &version)) { if (sepol_module_package_info(pf, &type, &name, &version)) {
@ -503,19 +492,18 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
(*modinfo)[*num_modules].version = version; (*modinfo)[*num_modules].version = version;
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.h libsemanage-2.0.30/src/direct_api.h diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.h libsemanage-2.0.30/src/direct_api.h
--- nsalibsemanage/src/direct_api.h 2008-11-14 17:10:15.000000000 -0500 --- nsalibsemanage/src/direct_api.h 2008-11-14 17:10:15.000000000 -0500
+++ libsemanage-2.0.30/src/direct_api.h 2008-12-04 15:15:23.000000000 -0500 +++ libsemanage-2.0.30/src/direct_api.h 2009-01-12 10:23:16.078163000 -0500
@@ -37,6 +37,7 @@ @@ -39,4 +39,7 @@
int semanage_direct_access_check(struct semanage_handle *sh); int semanage_direct_mls_enabled(struct semanage_handle *sh);
-int semanage_direct_mls_enabled(struct semanage_handle *sh);
+#include <stdio.h> +#include <stdio.h>
+size_t bunzip(FILE *f, char **data); +size_t bunzip(FILE *f, char **data);
+
#endif #endif
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/genhomedircon.c libsemanage-2.0.30/src/genhomedircon.c diff --exclude-from=exclude -N -u -r nsalibsemanage/src/genhomedircon.c libsemanage-2.0.30/src/genhomedircon.c
--- nsalibsemanage/src/genhomedircon.c 2008-08-28 09:34:24.000000000 -0400 --- nsalibsemanage/src/genhomedircon.c 2008-08-28 09:34:24.000000000 -0400
+++ libsemanage-2.0.30/src/genhomedircon.c 2008-12-04 15:16:11.000000000 -0500 +++ libsemanage-2.0.30/src/genhomedircon.c 2009-01-12 09:38:35.444738000 -0500
@@ -487,7 +487,6 @@ @@ -487,7 +487,6 @@
const char *role_prefix) const char *role_prefix)
{ {
@ -547,7 +535,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/genhomedircon.c libseman
*errors = STATUS_ERR; *errors = STATUS_ERR;
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/libsemanage.map libsemanage-2.0.30/src/libsemanage.map diff --exclude-from=exclude -N -u -r nsalibsemanage/src/libsemanage.map libsemanage-2.0.30/src/libsemanage.map
--- nsalibsemanage/src/libsemanage.map 2008-11-14 17:10:15.000000000 -0500 --- nsalibsemanage/src/libsemanage.map 2008-11-14 17:10:15.000000000 -0500
+++ libsemanage-2.0.30/src/libsemanage.map 2008-12-04 15:15:23.000000000 -0500 +++ libsemanage-2.0.30/src/libsemanage.map 2009-01-12 09:38:35.456740000 -0500
@@ -3,8 +3,10 @@ @@ -3,8 +3,10 @@
semanage_is_managed; semanage_connect; semanage_disconnect; semanage_is_managed; semanage_connect; semanage_disconnect;
semanage_msg_*; semanage_msg_*;
@ -561,9 +549,21 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/libsemanage.map libseman
semanage_module_list; semanage_module_info_datum_destroy; semanage_module_list; semanage_module_info_datum_destroy;
semanage_module_list_nth; semanage_module_get_name; semanage_module_list_nth; semanage_module_get_name;
semanage_module_get_version; semanage_select_store; semanage_module_get_version; semanage_select_store;
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/Makefile libsemanage-2.0.30/src/Makefile
--- nsalibsemanage/src/Makefile 2008-08-28 09:34:24.000000000 -0400
+++ libsemanage-2.0.30/src/Makefile 2009-01-12 09:38:35.424738000 -0500
@@ -54,7 +54,7 @@
ranlib $@
$(LIBSO): $(LOBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol -lselinux -lustr -L$(LIBDIR) -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol -lselinux -lbz2 -lustr -L$(LIBDIR) -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
ln -sf $@ $(TARGET)
conf-scan.c: conf-scan.l conf-parse.h
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/modules.c libsemanage-2.0.30/src/modules.c diff --exclude-from=exclude -N -u -r nsalibsemanage/src/modules.c libsemanage-2.0.30/src/modules.c
--- nsalibsemanage/src/modules.c 2008-08-28 09:34:24.000000000 -0400 --- nsalibsemanage/src/modules.c 2008-08-28 09:34:24.000000000 -0400
+++ libsemanage-2.0.30/src/modules.c 2008-12-04 15:15:23.000000000 -0500 +++ libsemanage-2.0.30/src/modules.c 2009-01-12 09:38:35.462738000 -0500
@@ -52,6 +52,25 @@ @@ -52,6 +52,25 @@
return sh->funcs->install(sh, module_data, data_len); return sh->funcs->install(sh, module_data, data_len);
} }
@ -644,7 +644,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/modules.c libsemanage-2.
if (sh->funcs->remove == NULL) { if (sh->funcs->remove == NULL) {
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/policy.h libsemanage-2.0.30/src/policy.h diff --exclude-from=exclude -N -u -r nsalibsemanage/src/policy.h libsemanage-2.0.30/src/policy.h
--- nsalibsemanage/src/policy.h 2008-08-28 09:34:24.000000000 -0400 --- nsalibsemanage/src/policy.h 2008-08-28 09:34:24.000000000 -0400
+++ libsemanage-2.0.30/src/policy.h 2008-12-04 15:15:23.000000000 -0500 +++ libsemanage-2.0.30/src/policy.h 2009-01-12 09:38:35.481737000 -0500
@@ -49,8 +49,14 @@ @@ -49,8 +49,14 @@
/* Install a policy module */ /* Install a policy module */
int (*install) (struct semanage_handle *, char *, size_t); int (*install) (struct semanage_handle *, char *, size_t);
@ -672,7 +672,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/policy.h libsemanage-2.0
/* Should be backend independent */ /* Should be backend independent */
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage.conf libsemanage-2.0.30/src/semanage.conf diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage.conf libsemanage-2.0.30/src/semanage.conf
--- nsalibsemanage/src/semanage.conf 2008-08-28 09:34:24.000000000 -0400 --- nsalibsemanage/src/semanage.conf 2008-08-28 09:34:24.000000000 -0400
+++ libsemanage-2.0.30/src/semanage.conf 2008-12-04 15:15:23.000000000 -0500 +++ libsemanage-2.0.30/src/semanage.conf 2009-01-12 09:38:35.487738000 -0500
@@ -35,4 +35,4 @@ @@ -35,4 +35,4 @@
# given in <sepol/policydb.h>. Change this setting if a different # given in <sepol/policydb.h>. Change this setting if a different
# version is necessary. # version is necessary.
@ -681,7 +681,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage.conf libsemanag
+expand-check=0 +expand-check=0
diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage_store.c libsemanage-2.0.30/src/semanage_store.c diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage_store.c libsemanage-2.0.30/src/semanage_store.c
--- nsalibsemanage/src/semanage_store.c 2008-11-11 16:13:18.000000000 -0500 --- nsalibsemanage/src/semanage_store.c 2008-11-11 16:13:18.000000000 -0500
+++ libsemanage-2.0.30/src/semanage_store.c 2008-12-04 15:15:23.000000000 -0500 +++ libsemanage-2.0.30/src/semanage_store.c 2009-01-12 10:17:08.334866000 -0500
@@ -440,6 +440,8 @@ @@ -440,6 +440,8 @@
char tmp[PATH_MAX]; char tmp[PATH_MAX];
char buf[4192]; char buf[4192];
@ -691,7 +691,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage_store.c libsema
n = snprintf(tmp, PATH_MAX, "%s.tmp", dst); n = snprintf(tmp, PATH_MAX, "%s.tmp", dst);
if (n < 0 || n >= PATH_MAX) if (n < 0 || n >= PATH_MAX)
return -1; return -1;
@@ -1523,16 +1525,26 @@ @@ -1523,16 +1525,30 @@
ERR(sh, "Could not open module file %s for reading.", filename); ERR(sh, "Could not open module file %s for reading.", filename);
goto cleanup; goto cleanup;
} }
@ -701,6 +701,10 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage_store.c libsema
+ if ((size = bunzip(fp, &data)) != 0) { + if ((size = bunzip(fp, &data)) != 0) {
+ fclose(fp); + fclose(fp);
+ fp = fmemopen(data, size, "rb"); + fp = fmemopen(data, size, "rb");
+ if (!fp) {
+ ERR(sh, "Out of memory!");
+ goto cleanup;
+ }
+ } + }
+ rewind(fp); + rewind(fp);
__fsetlocking(fp, FSETLOCKING_BYCALLER); __fsetlocking(fp, FSETLOCKING_BYCALLER);

View File

@ -3,7 +3,7 @@
Summary: SELinux binary policy manipulation library Summary: SELinux binary policy manipulation library
Name: libsemanage Name: libsemanage
Version: 2.0.30 Version: 2.0.30
Release: 2%{?dist} Release: 3%{?dist}
License: LGPLv2+ License: LGPLv2+
Group: System Environment/Libraries Group: System Environment/Libraries
Source: http://www.nsa.gov/selinux/archives/libsemanage-%{version}.tgz Source: http://www.nsa.gov/selinux/archives/libsemanage-%{version}.tgz
@ -90,6 +90,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/python*/site-packages/* %{_libdir}/python*/site-packages/*
%changelog %changelog
* Mon Jan 12 2009 Dan Walsh <dwalsh@redhat.com> - 2.0.30-3
- Fix up patch to get it upstreamed
* Thu Dec 04 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.0.30-2 * Thu Dec 04 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 2.0.30-2
- Rebuild for Python 2.6 - Rebuild for Python 2.6