All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Adams <cmadams@hiwaay.net>
To: SELinux@tycho.nsa.gov
Subject: Bug in restorecond for the first user logged in
Date: Thu, 12 Aug 2010 14:51:28 -0500	[thread overview]
Message-ID: <20100812195128.GC897947@hiwaay.net> (raw)

The first user that logs in will not be caught by restorecond.  The utmp
checking function only returns that there was a change when the previous
list of users was non-NULL.

Here's a patch that works for me (this is against the latest Red Hat
Enterprise Linux 5 policycoreutils release, but I checked the current
source tree and the same problem is present):

diff -urN policycoreutils-1.33.12-dist/restorecond/utmpwatcher.c policycoreutils-1.33.12/restorecond/utmpwatcher.c
--- policycoreutils-1.33.12-dist/restorecond/utmpwatcher.c	2007-01-11 13:01:39.000000000 -0600
+++ policycoreutils-1.33.12/restorecond/utmpwatcher.c	2010-08-12 14:13:24.000000000 -0500
@@ -69,10 +69,9 @@
 
 	utmp_wd =
 	    inotify_add_watch(inotify_fd, utmp_path, IN_MOVED_FROM | IN_MODIFY);
-	if (prev_utmp_ptr) {
-		changed = strings_list_diff(prev_utmp_ptr, utmp_ptr);
+	changed = strings_list_diff(prev_utmp_ptr, utmp_ptr);
+	if (prev_utmp_ptr)
 		strings_list_free(prev_utmp_ptr);
-	}
 	return changed;
 }
 

-- 
Chris Adams <cmadams@hiwaay.net>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

             reply	other threads:[~2010-08-12 19:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-12 19:51 Chris Adams [this message]
2010-08-13 18:13 ` Bug in restorecond for the first user logged in Daniel J Walsh
2010-08-13 18:16   ` Chris Adams

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=20100812195128.GC897947@hiwaay.net \
    --to=cmadams@hiwaay.net \
    --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.