From: Daniel J Walsh <dwalsh@redhat.com>
To: Stephen Smalley <sds@tycho.nsa.gov>, SE Linux <selinux@tycho.nsa.gov>
Subject: Patch for libselinux
Date: Wed, 03 Jan 2007 13:07:20 -0500 [thread overview]
Message-ID: <459BF0D8.60908@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 85 bytes --]
Fix for matchpatchon utility to lstat file if it exists to get correct
filecontext.
[-- Attachment #2: libselinux-rhat.patch --]
[-- Type: text/x-patch, Size: 1930 bytes --]
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
--- nsalibselinux/utils/matchpathcon.c 2006-11-16 17:15:17.000000000 -0500
+++ 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,
- "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();
next reply other threads:[~2007-01-03 18:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-03 18:07 Daniel J Walsh [this message]
2007-01-04 16:36 ` Patch for libselinux Stephen Smalley
2007-01-04 16:51 ` Karl MacMillan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=459BF0D8.60908@redhat.com \
--to=dwalsh@redhat.com \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.