From e253f943257111ac8e79e6d875ff9a4595154521 Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Mon, 8 Feb 2016 14:12:25 +0100 Subject: [PATCH] Make sure tempdir is created even in offline mode. (RHBZ#1305175) --- ...walld-0.3.14.2-pid_file_RHBZ#1233232.patch | 58 ------------------- firewalld-0.4.0-tempdir_RHBZ1305175.patch | 26 +++++++++ firewalld.spec | 7 ++- 3 files changed, 32 insertions(+), 59 deletions(-) delete mode 100644 firewalld-0.3.14.2-pid_file_RHBZ#1233232.patch create mode 100644 firewalld-0.4.0-tempdir_RHBZ1305175.patch diff --git a/firewalld-0.3.14.2-pid_file_RHBZ#1233232.patch b/firewalld-0.3.14.2-pid_file_RHBZ#1233232.patch deleted file mode 100644 index f785bc7..0000000 --- a/firewalld-0.3.14.2-pid_file_RHBZ#1233232.patch +++ /dev/null @@ -1,58 +0,0 @@ -commit 3a1f22c95bb5723456533de5aa821143682b8e3d -Author: Thomas Woerner -Date: Thu Jun 18 16:55:40 2015 +0200 - - firewalld: Fixed 'pid_file' referenced before assignment (RHBZ#1233232) - -diff --git a/src/firewalld b/src/firewalld -index 2db71a8..bd81316 100755 ---- a/src/firewalld -+++ b/src/firewalld -@@ -82,6 +82,7 @@ def setup_logging(args): - log.addDebugLogging("*", log.stdout) - - def startup(args): -+ pid_file = "/var/run/firewalld.pid" - try: - if not args.nofork: - # do the UNIX double-fork magic, see Stevens' "Advanced -@@ -119,7 +120,6 @@ def startup(args): - - if not args.nopid: - # write the pid file -- pid_file = "/var/run/firewalld.pid" - with open(pid_file, "w") as f: - f.write(str(os.getpid())) - -@@ -128,27 +128,27 @@ def startup(args): - server.run_server(args.debug_gc) - - # Clean up on exit -- if os.path.exists(pid_file) and not args.nopid: -+ if not args.nopid and os.path.exists(pid_file): - os.remove(pid_file) - - except OSError as e: - log.fatal(_("Fork #1 failed: %d (%s)") % (e.errno, e.strerror)) - log.error(traceback.format_exc()) -- if os.path.exists(pid_file) and not args.nopid: -+ if not args.nopid and os.path.exists(pid_file): - os.remove(pid_file) - sys.exit(1) - - except dbus.exceptions.DBusException as e: - log.fatal(str(e)) - log.error(traceback.format_exc()) -- if os.path.exists(pid_file) and not args.nopid: -+ if not args.nopid and os.path.exists(pid_file): - os.remove(pid_file) - sys.exit(1) - - except IOError as e: - log.fatal(str(e)) - log.error(traceback.format_exc()) -- if os.path.exists(pid_file) and not args.nopid: -+ if not args.nopid and os.path.exists(pid_file): - os.remove(pid_file) - sys.exit(1) - diff --git a/firewalld-0.4.0-tempdir_RHBZ1305175.patch b/firewalld-0.4.0-tempdir_RHBZ1305175.patch new file mode 100644 index 0000000..913e1c2 --- /dev/null +++ b/firewalld-0.4.0-tempdir_RHBZ1305175.patch @@ -0,0 +1,26 @@ +From 7c6b91b1c32fe502d1a6ffc3e29f09481bcf7ab1 Mon Sep 17 00:00:00 2001 +From: Jiri Popelka +Date: Mon, 8 Feb 2016 13:42:41 +0100 +Subject: [PATCH 1/2] Make sure tempdir is created even in offline mode. + +--- + src/firewall/functions.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/firewall/functions.py b/src/firewall/functions.py +index 9b19139..6dbac26 100644 +--- a/src/firewall/functions.py ++++ b/src/firewall/functions.py +@@ -265,6 +265,9 @@ def firewalld_is_active(): + + def tempFile(): + try: ++ if not os.path.exists(FIREWALLD_TEMPDIR): ++ os.mkdir(FIREWALLD_TEMPDIR, 0o750) ++ + return tempfile.NamedTemporaryFile(mode='wt', prefix="temp.", + dir=FIREWALLD_TEMPDIR, delete=False) + except Exception as msg: +-- +2.5.0 + diff --git a/firewalld.spec b/firewalld.spec index 4c550be..7b128d3 100644 --- a/firewalld.spec +++ b/firewalld.spec @@ -8,7 +8,7 @@ Summary: A firewall daemon with D-Bus interface providing a dynamic firewall Name: firewalld Version: 0.4.0 -Release: 1%{?dist} +Release: 2%{?dist} URL: http://www.firewalld.org License: GPLv2+ Source0: https://fedorahosted.org/released/firewalld/%{name}-%{version}.tar.bz2 @@ -18,6 +18,7 @@ Source2: FedoraWorkstation.xml %endif %if 0%{?fedora} Patch0: firewalld-0.2.6-MDNS-default.patch +Patch1: firewalld-0.4.0-tempdir_RHBZ1305175.patch %endif BuildArch: noarch BuildRequires: desktop-file-utils @@ -172,6 +173,7 @@ Workstation product specific firewalld configuration settings. %setup -q %if 0%{?fedora} %patch0 -p1 +%patch1 -p1 %endif %if 0%{?with_python3} @@ -484,6 +486,9 @@ fi %endif %changelog +* Mon Feb 08 2016 Jiri Popelka - 0.4.0-2 +- Make sure tempdir is created even in offline mode. (RHBZ#1305175) + * Mon Feb 1 2016 Thomas Woerner - 0.4.0-1 - Version 0.4.0 - Speed ups