|
From: <ssm...@us...> - 2007-01-04 16:50:20
|
Revision: 2123
http://svn.sourceforge.net/selinux/?rev=2123&view=rev
Author: ssmalley
Date: 2007-01-04 08:50:14 -0800 (Thu, 04 Jan 2007)
Log Message:
-----------
Author: Daniel J Walsh
Email: dw...@re...
Subject: Patch for libselinux
Date: Wed, 03 Jan 2007 13:07:20 -0500
Fix for matchpatchon utility to lstat file if it exists to get correct
filecontext.
Modified Paths:
--------------
trunk/libselinux/ChangeLog
trunk/libselinux/VERSION
trunk/libselinux/utils/matchpathcon.c
Modified: trunk/libselinux/ChangeLog
===================================================================
--- trunk/libselinux/ChangeLog 2007-01-03 16:14:11 UTC (rev 2122)
+++ trunk/libselinux/ChangeLog 2007-01-04 16:50:14 UTC (rev 2123)
@@ -1,8 +1,13 @@
+1.33.3 2007-01-04
+ * Merged patch for matchpathcon utility to use file mode information
+ when available from Dan Walsh.
+
1.33.2 2006-11-27
- * Merged patch to compile wit -fPIC instead of -fpic from
- Manoj Srivastava to prevent hitting the global offest table
- limit. Patch changed to include libselinux and libsemanage in
+ * Merged patch to compile with -fPIC instead of -fpic from
+ Manoj Srivastava to prevent hitting the global offset table
+ limit. Patch changed to include libsepol and libsemanage in
addition to libselinux.
+
1.33.1 2006-10-19
* Merged updated flask definitions from Darrel Goeddel.
This adds the context security class, and also adds
Modified: trunk/libselinux/VERSION
===================================================================
--- trunk/libselinux/VERSION 2007-01-03 16:14:11 UTC (rev 2122)
+++ trunk/libselinux/VERSION 2007-01-04 16:50:14 UTC (rev 2123)
@@ -1 +1 @@
-1.33.2
+1.33.3
Modified: trunk/libselinux/utils/matchpathcon.c
===================================================================
--- trunk/libselinux/utils/matchpathcon.c 2007-01-03 16:14:11 UTC (rev 2122)
+++ trunk/libselinux/utils/matchpathcon.c 2007-01-04 16:50:14 UTC (rev 2123)
@@ -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,
- "usage: %s [-n] [-f file_contexts] [-p prefix] path...\n",
+ "usage: %s [-N] [-n] [-f file_contexts] [-p prefix] [-V] path...\n",
progname);
exit(1);
}
-int printmatchpathcon(char *path, int header)
+int printmatchpathcon(char *path, int header, int mode)
{
char *buf;
- int rc = matchpathcon(path, 0, &buf);
+ 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);
- error += printmatchpathcon(argv[i], 0);
+ error += printmatchpathcon(argv[i], 0, mode);
freecon(con);
} else {
printf
("actual context unknown: %s, should be ",
strerror(errno));
- error += printmatchpathcon(argv[i], 0);
+ error += printmatchpathcon(argv[i], 0,mode);
}
}
} else {
- error += printmatchpathcon(argv[i], header);
+ error += printmatchpathcon(argv[i], header, mode);
}
}
matchpathcon_fini();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|