All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel J Walsh <dwalsh@redhat.com>
To: SE Linux <selinux@tycho.nsa.gov>
Subject: Patch setfiles to only warn if add_remove fails to lstat on user initiated excludes.
Date: Mon, 10 Aug 2009 11:13:57 -0400	[thread overview]
Message-ID: <4A803935.3040407@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

Currently in F12 if you have file systems that root can not read

# restorecon -R -v /var/lib/libvirt/
Can't stat directory "/home/dwalsh/.gvfs", Permission denied.
Can't stat directory "/home/dwalsh/redhat", Permission denied.

After patch

# ./restorecon -R -v /var/lib/libvirt/

[-- Attachment #2: policycoreutils-setfiles.patch --]
[-- Type: text/plain, Size: 1251 bytes --]

diff -up policycoreutils-2.0.70/setfiles/setfiles.c~ policycoreutils-2.0.70/setfiles/setfiles.c
--- policycoreutils-2.0.70/setfiles/setfiles.c~	2009-08-05 15:11:11.000000000 -0400
+++ policycoreutils-2.0.70/setfiles/setfiles.c	2009-08-10 11:06:54.000000000 -0400
@@ -234,7 +234,7 @@ void filespec_destroy(void)
 	fl_head = NULL;
 }
 
-static int add_exclude(const char *directory)
+static int add_exclude(const char *directory, int warn)
 {
 	struct stat sb;
 	size_t len = 0;
@@ -244,8 +244,8 @@ static int add_exclude(const char *direc
 		return 1;
 	}
 	if (lstat(directory, &sb)) {
-		fprintf(stderr, "Can't stat directory \"%s\", %s.\n",
-			directory, strerror(errno));
+		if (warn) fprintf(stderr, "Can't stat directory \"%s\", %s.\n",
+				directory, strerror(errno));
 		return 0;
 	}
 	if ((sb.st_mode & S_IFDIR) == 0) {
@@ -727,7 +727,7 @@ static void exclude_non_seclabel_mounts(
 
 		/* exclude mount points without the seclabel option */
 		if (!found)
-			add_exclude(mount_info[1]);
+			add_exclude(mount_info[1], 0);
 	}
 
 	free(buf);
@@ -840,7 +840,7 @@ int main(int argc, char **argv)
 			}
 		case 'e':
 			remove_exclude(optarg);
-			if (add_exclude(optarg))
+			if (add_exclude(optarg, 1))
 				exit(1);
 			break;
 		case 'f':

             reply	other threads:[~2009-08-10 15:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-10 15:13 Daniel J Walsh [this message]
2009-08-10 20:03 ` Patch setfiles to only warn if add_remove fails to lstat on user initiated excludes Stephen Smalley
2009-08-10 20:12   ` Stephen Smalley
2009-08-11 12:12     ` Daniel J Walsh
2009-08-11 13:33       ` Stephen Smalley
2009-08-11 14:12         ` Daniel J Walsh

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=4A803935.3040407@redhat.com \
    --to=dwalsh@redhat.com \
    --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.