From 26d55153b4fd3f4519387aec1b233540a84694ef Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Thu, 28 Jun 2007 15:34:25 +0000 Subject: [PATCH] - Another go at avoiding AVC messages on boot (bug #244205). --- hplip-no-root-config.patch | 19 +++++++------------ hplip.spec | 5 ++++- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/hplip-no-root-config.patch b/hplip-no-root-config.patch index 2c708d8..2bcdf49 100644 --- a/hplip-no-root-config.patch +++ b/hplip-no-root-config.patch @@ -1,28 +1,23 @@ --- hplip-1.7.4a/base/g.py.no-root-config 2007-06-14 15:40:43.000000000 +0100 -+++ hplip-1.7.4a/base/g.py 2007-06-14 15:43:21.000000000 +0100 -@@ -88,6 +88,16 @@ ++++ hplip-1.7.4a/base/g.py 2007-06-28 16:33:47.000000000 +0100 +@@ -88,6 +88,10 @@ dict.__setattr__(self, "config_obj", ConfigParser.ConfigParser()) dict.__setattr__(self, "filename", filename) -+ if filename.startswith ("/root/"): -+ import sys, posixpath -+ argv0 = sys.argv[0] -+ name = posixpath.basename (argv0) -+ if name == "hp" or name == "hpfax": -+ # Don't try opening a file in root's home directory. We are -+ # running as a CUPS backend, and doing so would cause an -+ # SELinux AVC message (bug #241776). -+ return ++ if filename.startswith ("/root/") or os.getuid () == 0: ++ # Don't try opening a file in root's home directory. ++ return + try: pathmode = os.stat(filename)[stat.ST_MODE] if pathmode & 0022 != 0: -@@ -129,7 +139,8 @@ +@@ -129,7 +133,9 @@ prop.sys_config_file = '/etc/hp/hplip.conf' prop.user_config_file = os.path.expanduser('~/.hplip.conf') -if not os.path.exists(prop.user_config_file): +if (not prop.user_config_file.startswith ("/root/") and ++ not os.getuid () == 0 and + not os.path.exists(prop.user_config_file)): try: file(prop.user_config_file, 'w').close() diff --git a/hplip.spec b/hplip.spec index 4182f34..bdb43b9 100644 --- a/hplip.spec +++ b/hplip.spec @@ -1,7 +1,7 @@ Summary: HP Linux Imaging and Printing Project Name: hplip Version: 1.7.4a -Release: 2%{?dist} +Release: 3%{?dist} License: GPL/MIT/BSD Group: System Environment/Daemons Conflicts: system-config-printer < 0.6.132 @@ -289,6 +289,9 @@ fi exit 0 %changelog +* Thu Jun 28 2007 Tim Waugh 1.7.4a-3 +- Another go at avoiding AVC messages on boot (bug #244205). + * Thu Jun 14 2007 Tim Waugh 1.7.4a-2 - Don't try to write a /root/.hplip.conf file when running as a CUPS backend (bug #244205).