- Don't write to system-wide configuration file (bug #479178).

This commit is contained in:
Tim Waugh 2009-01-12 18:41:08 +00:00
parent 660b3a5894
commit e53647a38f
2 changed files with 22 additions and 3 deletions

View File

@ -1,7 +1,23 @@
diff -up hplip-2.8.12/base/g.py.no-root-config hplip-2.8.12/base/g.py
--- hplip-2.8.12/base/g.py.no-root-config 2008-12-17 20:41:12.000000000 +0000
+++ hplip-2.8.12/base/g.py 2008-12-23 10:19:44.000000000 +0000
@@ -107,6 +107,10 @@ class Config(dict):
+++ hplip-2.8.12/base/g.py 2009-01-12 12:22:31.000000000 +0000
@@ -91,6 +91,15 @@ class ConfigSection(dict):
self.config_obj.set(self.section_name, option, val)
+ filename = self.filename
+ if filename.startswith ("/root/") or filename.startswith ("/var/"):
+ # Don't try writing a file in root's home directory.
+ return
+ elif filename.startswith ("/etc/"):
+ # Certainly don't try writing the system-wide config file!
+ # See bug #479178.
+ return
+
try:
f = file(self.filename, 'w')
self.config_obj.write(f)
@@ -107,6 +116,10 @@ class Config(dict):
log.debug("Reading config file %s" % filename)

View File

@ -1,7 +1,7 @@
Summary: HP Linux Imaging and Printing Project
Name: hplip
Version: 2.8.12
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+ and MIT
Group: System Environment/Daemons
Conflicts: system-config-printer < 0.6.132
@ -313,6 +313,9 @@ fi
exit 0
%changelog
* Mon Jan 12 2009 Tim Waugh <twaugh@redhat.com> 2.8.12-2
- Don't write to system-wide configuration file (bug #479178).
* Tue Dec 23 2008 Tim Waugh <twaugh@redhat.com> 2.8.12-1
- 2.8.12.