policycoreutils-2.5-7

- hll/pp: Warn if module name different than output filename
This commit is contained in:
Petr Lautrbach 2016-04-29 18:09:09 +02:00
parent 0921732e44
commit 72f5beeec0
2 changed files with 90 additions and 2 deletions

View File

@ -1,3 +1,13 @@
diff --git policycoreutils-2.5/ChangeLog policycoreutils-2.5/ChangeLog
index d8fb067..cad1bbc 100644
--- policycoreutils-2.5/ChangeLog
+++ policycoreutils-2.5/ChangeLog
@@ -1,3 +1,5 @@
+ * hll/pp: Warn if module name different than output filename, from James Carter
+
2.5 2016-02-23
* sepolicy: Do not overwrite CFLAGS, from Nicolas Iooss.
* sepolicy: Rename policy global variable conflict, from Nicolas Iooss.
diff --git policycoreutils-2.5/Makefile policycoreutils-2.5/Makefile diff --git policycoreutils-2.5/Makefile policycoreutils-2.5/Makefile
index 962ac12..6a9c40c 100644 index 962ac12..6a9c40c 100644
--- policycoreutils-2.5/Makefile --- policycoreutils-2.5/Makefile
@ -1773,6 +1783,81 @@ index abf8d3b..f50fcb2 100644
- except ValueError, e: - except ValueError, e:
+ except ValueError as e: + except ValueError as e:
self.error(e.args[0]) self.error(e.args[0])
diff --git policycoreutils-2.5/hll/pp/pp.c policycoreutils-2.5/hll/pp/pp.c
index 866734f..9245975 100644
--- policycoreutils-2.5/hll/pp/pp.c
+++ policycoreutils-2.5/hll/pp/pp.c
@@ -28,6 +28,7 @@
#include <sepol/module.h>
#include <sepol/module_to_cil.h>
+#include <sepol/policydb/module.h>
char *progname;
@@ -68,6 +69,8 @@ int main(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
struct sepol_module_package *mod_pkg = NULL;
+ char *ifile = NULL;
+ char *ofile = NULL;
FILE *in = NULL;
FILE *out = NULL;
int outfd = -1;
@@ -89,20 +92,23 @@ int main(int argc, char **argv)
}
if (argc >= optind + 1 && strcmp(argv[1], "-") != 0) {
- in = fopen(argv[1], "rb");
+ ifile = argv[1];
+ in = fopen(ifile, "rb");
if (in == NULL) {
- log_err("Failed to open %s: %s", argv[1], strerror(errno));
+ log_err("Failed to open %s: %s", ifile, strerror(errno));
rc = -1;
goto exit;
}
} else {
+ ifile = "stdin";
in = stdin;
}
if (argc >= optind + 2 && strcmp(argv[2], "-") != 0) {
- out = fopen(argv[2], "w");
+ ofile = argv[2];
+ out = fopen(ofile, "w");
if (out == NULL) {
- log_err("Failed to open %s: %s", argv[2], strerror(errno));
+ log_err("Failed to open %s: %s", ofile, strerror(errno));
rc = -1;
goto exit;
}
@@ -122,6 +128,25 @@ int main(int argc, char **argv)
fclose(in);
in = NULL;
+ if (ofile) {
+ char *mod_name = mod_pkg->policy->p.name;
+ char *cil_path = strdup(ofile);
+ if (cil_path == NULL) {
+ log_err("No memory available for strdup\n");
+ rc = -1;
+ goto exit;
+ }
+ char *cil_name = basename(cil_path);
+ char *separator = strrchr(cil_name, '.');
+ if (separator) {
+ *separator = '\0';
+ }
+ if (strcmp(mod_name, cil_name) != 0) {
+ fprintf(stderr, "Warning: SELinux userspace will refer to the module from %s as %s rather than %s\n", ifile, cil_name, mod_name);
+ }
+ free(cil_path);
+ }
+
rc = sepol_module_package_to_cil(out, mod_pkg);
if (rc != 0) {
goto exit;
diff --git policycoreutils-2.5/po/Makefile policycoreutils-2.5/po/Makefile diff --git policycoreutils-2.5/po/Makefile policycoreutils-2.5/po/Makefile
index a693823..555f381 100644 index a693823..555f381 100644
--- policycoreutils-2.5/po/Makefile --- policycoreutils-2.5/po/Makefile

View File

@ -7,7 +7,7 @@
Summary: SELinux policy core utilities Summary: SELinux policy core utilities
Name: policycoreutils Name: policycoreutils
Version: 2.5 Version: 2.5
Release: 6%{?dist} Release: 7%{?dist}
License: GPLv2 License: GPLv2
Group: System Environment/Base Group: System Environment/Base
# https://github.com/SELinuxProject/selinux/wiki/Releases # https://github.com/SELinuxProject/selinux/wiki/Releases
@ -23,7 +23,7 @@ Source7: selinux-autorelabel-mark.service
# download https://raw.githubusercontent.com/fedora-selinux/scripts/master/selinux/make-fedora-selinux-patch.sh # download https://raw.githubusercontent.com/fedora-selinux/scripts/master/selinux/make-fedora-selinux-patch.sh
# run: # run:
# $ VERSION=2.5 ./make-fedora-selinux-patch.sh policycoreutils # $ VERSION=2.5 ./make-fedora-selinux-patch.sh policycoreutils
# HEAD https://github.com/fedora-selinux/selinux/commit/4bfb84c7ff7b33cf06b9a6b2317d24054b9db562 # HEAD https://github.com/fedora-selinux/selinux/commit/f900ff37022119de47d516f103ccfd339d52c861
Patch: policycoreutils-fedora.patch Patch: policycoreutils-fedora.patch
# $ VERSION=1.2.3 ./make-fedora-selinux-patch.sh sepolgen # $ VERSION=1.2.3 ./make-fedora-selinux-patch.sh sepolgen
Patch1: sepolgen-fedora.patch Patch1: sepolgen-fedora.patch
@ -427,6 +427,9 @@ The policycoreutils-restorecond package contains the restorecond service.
%systemd_postun_with_restart restorecond.service %systemd_postun_with_restart restorecond.service
%changelog %changelog
* Fri Apr 29 2016 Petr Lautrbach <plautrba@redhat.com> - 2.5-7
- hll/pp: Warn if module name different than output filename
* Mon Apr 25 2016 Petr Lautrbach <plautrba@redhat.com> - 2.5-6 * Mon Apr 25 2016 Petr Lautrbach <plautrba@redhat.com> - 2.5-6
- Ship selinux-autorelabel utility and systemd unit files (#1328825) - Ship selinux-autorelabel utility and systemd unit files (#1328825)