- Fix up patch to get it upstreamed
This commit is contained in:
parent
25dcff4b7d
commit
8aa784b272
@ -1,6 +1,6 @@
|
||||
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
|
||||
+++ libsemanage-2.0.30/include/semanage/modules.h 2009-01-12 09:38:35.420740000 -0500
|
||||
+++ libsemanage-2.0.30/include/semanage/modules.h 2009-01-12 13:20:46.000000000 -0500
|
||||
@@ -30,10 +30,16 @@
|
||||
|
||||
int semanage_module_install(semanage_handle_t *,
|
||||
@ -20,7 +20,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/include/semanage/modules.h l
|
||||
/* semanage_module_info is for getting information on installed
|
||||
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
|
||||
+++ libsemanage-2.0.30/src/direct_api.c 2009-01-12 10:20:45.394714000 -0500
|
||||
+++ libsemanage-2.0.30/src/direct_api.c 2009-01-12 14:34:36.000000000 -0500
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "semanage_store.h"
|
||||
#include "database_policydb.h"
|
||||
@ -66,7 +66,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
|
||||
+
|
||||
+/* bzip() a data to a file, returning the total number of compressed bytes
|
||||
+ * 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 ssize_t bzip(const char *filename, char *data, size_t num_bytes) {
|
||||
+ BZFILE* b;
|
||||
+ size_t size = 1<<16;
|
||||
+ int bzerror;
|
||||
@ -108,7 +108,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
|
||||
+
|
||||
+/* bunzip() a file to '*data', returning the total number of uncompressed bytes
|
||||
+ * in the file. Returns -1 if file could not be decompressed. */
|
||||
+size_t bunzip(FILE *f, char **data) {
|
||||
+ssize_t bunzip(FILE *f, char **data) {
|
||||
+ BZFILE* b;
|
||||
+ size_t nBuf;
|
||||
+ char buf[1<<18];
|
||||
@ -151,9 +151,9 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
|
||||
+ * the file into '*data'.
|
||||
+ * Returns the total number of bytes in memory .
|
||||
+ * Returns -1 if file could not be opened or mapped. */
|
||||
+static size_t map_file(int fd, char **data, int *compressed)
|
||||
+static ssize_t map_file(int fd, char **data, int *compressed)
|
||||
+{
|
||||
+ int size = -1;
|
||||
+ ssize_t size = -1;
|
||||
+ char *uncompress;
|
||||
+ if ((size = bunzip(fdopen(fd, "r"), &uncompress)) > 0) {
|
||||
+ *data = mmap(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
|
||||
@ -227,7 +227,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
|
||||
goto cleanup;
|
||||
}
|
||||
- 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);
|
||||
retval = -3;
|
||||
+ goto cleanup;
|
||||
@ -346,7 +346,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
|
||||
+ data, data_len,
|
||||
+ &filename);
|
||||
+ if (retval == 0) {
|
||||
+ if (bzip(filename, data, data_len) == 0) {
|
||||
+ if (bzip(filename, data, data_len) <= 0) {
|
||||
+ ERR(sh, "Error while writing to %s.", filename);
|
||||
+ retval = -3;
|
||||
+ }
|
||||
@ -404,7 +404,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
|
||||
goto cleanup;
|
||||
}
|
||||
- if (write_file(sh, filename, base_data, data_len) == -1) {
|
||||
+ if (bzip(filename, base_data, data_len) == 0) {
|
||||
+ if (bzip(filename, base_data, data_len) <= 0) {
|
||||
+ ERR(sh, "Error while writing to %s.", filename);
|
||||
retval = -3;
|
||||
+ goto cleanup;
|
||||
@ -464,10 +464,10 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
|
||||
* report it */
|
||||
continue;
|
||||
}
|
||||
+ size_t size;
|
||||
+ ssize_t size;
|
||||
+ char *data = NULL;
|
||||
+
|
||||
+ if ((size = bunzip(fp, &data)) != 0) {
|
||||
+ if ((size = bunzip(fp, &data)) > 0) {
|
||||
+ fclose(fp);
|
||||
+ fp = fmemopen(data, size, "rb");
|
||||
+ if (!fp) {
|
||||
@ -492,18 +492,19 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/direct_api.c libsemanage
|
||||
(*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
|
||||
--- nsalibsemanage/src/direct_api.h 2008-11-14 17:10:15.000000000 -0500
|
||||
+++ libsemanage-2.0.30/src/direct_api.h 2009-01-12 10:23:16.078163000 -0500
|
||||
@@ -39,4 +39,7 @@
|
||||
+++ libsemanage-2.0.30/src/direct_api.h 2009-01-12 13:43:27.000000000 -0500
|
||||
@@ -39,4 +39,8 @@
|
||||
|
||||
int semanage_direct_mls_enabled(struct semanage_handle *sh);
|
||||
|
||||
+#include <stdio.h>
|
||||
+size_t bunzip(FILE *f, char **data);
|
||||
+#include <unistd.h>
|
||||
+ssize_t bunzip(FILE *f, char **data);
|
||||
+
|
||||
#endif
|
||||
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
|
||||
+++ libsemanage-2.0.30/src/genhomedircon.c 2009-01-12 09:38:35.444738000 -0500
|
||||
+++ libsemanage-2.0.30/src/genhomedircon.c 2009-01-12 13:20:46.000000000 -0500
|
||||
@@ -487,7 +487,6 @@
|
||||
const char *role_prefix)
|
||||
{
|
||||
@ -535,7 +536,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/genhomedircon.c libseman
|
||||
*errors = STATUS_ERR;
|
||||
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
|
||||
+++ libsemanage-2.0.30/src/libsemanage.map 2009-01-12 09:38:35.456740000 -0500
|
||||
+++ libsemanage-2.0.30/src/libsemanage.map 2009-01-12 13:20:46.000000000 -0500
|
||||
@@ -3,8 +3,10 @@
|
||||
semanage_is_managed; semanage_connect; semanage_disconnect;
|
||||
semanage_msg_*;
|
||||
@ -551,7 +552,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/libsemanage.map libseman
|
||||
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
|
||||
+++ libsemanage-2.0.30/src/Makefile 2009-01-12 13:20:46.000000000 -0500
|
||||
@@ -54,7 +54,7 @@
|
||||
ranlib $@
|
||||
|
||||
@ -563,7 +564,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/Makefile libsemanage-2.0
|
||||
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
|
||||
--- nsalibsemanage/src/modules.c 2008-08-28 09:34:24.000000000 -0400
|
||||
+++ libsemanage-2.0.30/src/modules.c 2009-01-12 09:38:35.462738000 -0500
|
||||
+++ libsemanage-2.0.30/src/modules.c 2009-01-12 13:20:46.000000000 -0500
|
||||
@@ -52,6 +52,25 @@
|
||||
return sh->funcs->install(sh, module_data, data_len);
|
||||
}
|
||||
@ -644,7 +645,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/modules.c libsemanage-2.
|
||||
if (sh->funcs->remove == NULL) {
|
||||
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
|
||||
+++ libsemanage-2.0.30/src/policy.h 2009-01-12 09:38:35.481737000 -0500
|
||||
+++ libsemanage-2.0.30/src/policy.h 2009-01-12 13:20:46.000000000 -0500
|
||||
@@ -49,8 +49,14 @@
|
||||
/* Install a policy module */
|
||||
int (*install) (struct semanage_handle *, char *, size_t);
|
||||
@ -672,7 +673,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/policy.h libsemanage-2.0
|
||||
/* Should be backend independent */
|
||||
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
|
||||
+++ libsemanage-2.0.30/src/semanage.conf 2009-01-12 09:38:35.487738000 -0500
|
||||
+++ libsemanage-2.0.30/src/semanage.conf 2009-01-12 13:20:46.000000000 -0500
|
||||
@@ -35,4 +35,4 @@
|
||||
# given in <sepol/policydb.h>. Change this setting if a different
|
||||
# version is necessary.
|
||||
@ -681,7 +682,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage.conf libsemanag
|
||||
+expand-check=0
|
||||
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
|
||||
+++ libsemanage-2.0.30/src/semanage_store.c 2009-01-12 10:17:08.334866000 -0500
|
||||
+++ libsemanage-2.0.30/src/semanage_store.c 2009-01-12 13:20:46.000000000 -0500
|
||||
@@ -440,6 +440,8 @@
|
||||
char tmp[PATH_MAX];
|
||||
char buf[4192];
|
||||
@ -698,7 +699,7 @@ diff --exclude-from=exclude -N -u -r nsalibsemanage/src/semanage_store.c libsema
|
||||
+ size_t size;
|
||||
+ char *data = NULL;
|
||||
+
|
||||
+ if ((size = bunzip(fp, &data)) != 0) {
|
||||
+ if ((size = bunzip(fp, &data)) > 0) {
|
||||
+ fclose(fp);
|
||||
+ fp = fmemopen(data, size, "rb");
|
||||
+ if (!fp) {
|
||||
|
Loading…
Reference in New Issue
Block a user