lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181105175946.GA4124@magnolia>
Date:   Mon, 5 Nov 2018 09:59:46 -0800
From:   "Darrick J. Wong" <darrick.wong@...cle.com>
To:     "Theodore Ts'o" <tytso@....edu>
Cc:     linux-ext4 <linux-ext4@...r.kernel.org>
Subject: [PATCH] e2scrub: fix systemd escaping again

From: Darrick J. Wong <darrick.wong@...cle.com>

Apparently newer versions of systemd than the one on this author's
laptop <cough> now complain about lack of (path) escaping in unit
instance variable contents:

 # e2scrub_all
 Scrubbing /home...
 Invalid unit name "e2scrub@...me" was escaped as "e2scrub@...me"
 (maybe you should use systemd-escape?)
 Starting Online ext4 Metadata Check for /home...

So change the escape_path_for_systemd function to escape paths
unconditionally to make the warning go away.

Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
---
 scrub/e2scrub_all.in |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scrub/e2scrub_all.in b/scrub/e2scrub_all.in
index 9581dc2c4..23d122d25 100644
--- a/scrub/e2scrub_all.in
+++ b/scrub/e2scrub_all.in
@@ -101,13 +101,18 @@ ls_scrub_targets() {
 # systemd doesn't know to do path escaping on the instance variable we pass
 # to the e2scrub service, which breaks things if there is a dash in the path
 # name.  Therefore, do the path escaping ourselves if needed.
+#
+# systemd path escaping also drops the initial slash so we add that back in so
+# that log messages from the service units preserve the full path and users can
+# look up log messages using full paths.  However, for "/" the escaping rules
+# do /not/ drop the initial slash, so we have to special-case that here.
 escape_path_for_systemd() {
 	local path="$1"
 
-	if echo "${path}" | grep -q -- "-"; then
+	if [ "${path}" != "/" ]; then
 		echo "-$(systemd-escape --path "${path}")"
 	else
-		echo "${path}"
+		echo "-"
 	fi
 }
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ