From mboxrd@z Thu Jan  1 00:00:00 1970
From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH 2/3] extrahd: Skip relative mountpoints
Date: Wed, 02 Aug 2023 09:14:14 +0000
Message-ID: <20230802091415.3168597-2-michael.tremer@ipfire.org>
In-Reply-To: <20230802091415.3168597-1-michael.tremer@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============7473381379423019422=="
List-Id: <development.lists.ipfire.org>

--===============7473381379423019422==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit

Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
---
 config/extrahd/extrahd.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/config/extrahd/extrahd.pl b/config/extrahd/extrahd.pl
index be91e27f6..eba3f9b37 100644
--- a/config/extrahd/extrahd.pl
+++ b/config/extrahd/extrahd.pl
@@ -40,6 +40,12 @@ extrahd_mount() {
 			continue
 		fi
 
+		# Check that the mountpoint starts with a slash
+		if [ "${mountpoint:0:1}" != "/" ]; then
+			log "Skipping invalid mountpoint: ${mountpoint}"
+			continue
+		fi
+
 		# Skip mounting if something is already mounted at the mountpoint
 		if mountpoint "${mountpoint}" &>/dev/null; then
 			continue
-- 
2.39.2


--===============7473381379423019422==--