- Prevent hpfax trying to load configuration files as user lp.

This commit is contained in:
Tim Waugh 2007-09-25 14:49:26 +00:00
parent d4173d21e8
commit 328ac77d5e
2 changed files with 12 additions and 7 deletions

View File

@ -1,17 +1,18 @@
--- hplip-2.7.6/base/g.py.no-root-config 2007-06-18 17:56:32.000000000 +0100
+++ hplip-2.7.6/base/g.py 2007-06-29 17:58:29.000000000 +0100
@@ -105,6 +105,10 @@
diff -up hplip-2.7.7/base/g.py.no-root-config hplip-2.7.7/base/g.py
--- hplip-2.7.7/base/g.py.no-root-config 2007-06-18 17:56:32.000000000 +0100
+++ hplip-2.7.7/base/g.py 2007-09-25 15:23:23.000000000 +0100
@@ -105,6 +105,10 @@ class Config(dict):
log.debug("Reading config file %s" % filename)
+ if filename.startswith ("/root/"):
+ if filename.startswith ("/root/") or filename.startswith ("/var/"):
+ # Don't try opening a file in root's home directory.
+ return
+
try:
f = file(filename, 'r')
self.config_obj.readfp(f)
@@ -134,23 +138,24 @@
@@ -134,23 +138,25 @@ class Config(dict):
# Config file: directories and ports
prop.sys_config_file = '/etc/hp/hplip.conf'
prop.user_dir = os.path.expanduser('~/.hplip')
@ -26,7 +27,8 @@
prop.user_config_file = os.path.join(prop.user_dir, 'hplip.conf')
-if not os.path.exists(prop.user_config_file):
+if (not prop.user_config_file.startswith ("/root/") and
+if (not (prop.user_config_file.startswith ("/root/") or
+ prop.user_config_file.startswith ("/var/")) and
+ not os.getuid () == 0):
+ os.umask(0037)
try:

View File

@ -1,7 +1,7 @@
Summary: HP Linux Imaging and Printing Project
Name: hplip
Version: 2.7.7
Release: 4%{?dist}
Release: 5%{?dist}
License: GPLv2+ and MIT
Group: System Environment/Daemons
Conflicts: system-config-printer < 0.6.132
@ -278,6 +278,9 @@ fi
exit 0
%changelog
* Tue Sep 25 2007 Tim Waugh <twaugh@redhat.com> 2.7.7-5
- Prevent hpfax trying to load configuration files as user lp.
* Thu Sep 6 2007 Tim Waugh <twaugh@redhat.com> 2.7.7-4
- Reverted udev rules change.
- Ship a HAL FDI file to get correct access control on the USB device