libselinux/libselinux-rhat.patch

65 lines
1.9 KiB
Diff
Raw Normal View History

2006-12-06 19:13:54 +00:00
Binary files nsalibselinux/utils/matchpathcon and libselinux-1.33.2/utils/matchpathcon differ
diff --exclude-from=exclude -N -u -r nsalibselinux/utils/matchpathcon.c libselinux-1.33.2/utils/matchpathcon.c
2006-11-30 18:11:20 +00:00
--- nsalibselinux/utils/matchpathcon.c 2006-11-16 17:15:17.000000000 -0500
2006-12-06 19:13:54 +00:00
+++ libselinux-1.33.2/utils/matchpathcon.c 2006-12-06 14:11:29.000000000 -0500
@@ -4,20 +4,23 @@
#include <getopt.h>
#include <errno.h>
#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/errno.h>
#include <selinux/selinux.h>
void usage(const char *progname)
{
fprintf(stderr,
2006-11-30 18:11:20 +00:00
- "usage: %s [-n] [-f file_contexts] [-p prefix] path...\n",
2006-12-06 19:13:54 +00:00
+ "usage: %s [-N] [-n] [-f file_contexts] [-p prefix] [-V] path...\n",
progname);
exit(1);
}
2006-11-30 18:11:20 +00:00
-int printmatchpathcon(char *path, int header)
2006-12-06 19:13:54 +00:00
+int printmatchpathcon(char *path, int header, int mode)
{
char *buf;
2006-11-30 18:11:20 +00:00
- int rc = matchpathcon(path, 0, &buf);
2006-12-06 19:13:54 +00:00
+ int rc = matchpathcon(path, mode, &buf);
if (rc < 0) {
fprintf(stderr, "matchpathcon(%s) failed: %s\n", path,
strerror(errno));
@@ -92,6 +95,11 @@
}
}
for (i = optind; i < argc; i++) {
+ int mode=0;
+ struct stat buf;
+ if (lstat(argv[i], &buf) == 0)
+ mode = buf.st_mode;
+
if (verify) {
if (selinux_file_context_verify(argv[i], 0)) {
printf("%s verified.\n", argv[i]);
@@ -106,17 +114,17 @@
if (rc >= 0) {
printf("%s has context %s, should be ",
argv[i], con);
2006-11-30 18:11:20 +00:00
- error += printmatchpathcon(argv[i], 0);
2006-12-06 19:13:54 +00:00
+ error += printmatchpathcon(argv[i], 0, mode);
freecon(con);
} else {
printf
("actual context unknown: %s, should be ",
strerror(errno));
2006-11-30 18:11:20 +00:00
- error += printmatchpathcon(argv[i], 0);
2006-12-06 19:13:54 +00:00
+ error += printmatchpathcon(argv[i], 0,mode);
}
}
} else {
2006-11-30 18:11:20 +00:00
- error += printmatchpathcon(argv[i], header);
2006-12-06 19:13:54 +00:00
+ error += printmatchpathcon(argv[i], header, mode);
}
}
matchpathcon_fini();