From 854c930696ad1706a10caacc591d06c87936e133 Mon Sep 17 00:00:00 2001 From: sro0 <35873310+sro0@users.noreply.github.com> Date: Sat, 13 Jan 2024 12:31:15 +0100 Subject: [PATCH] Ensure XPath for ConfigDaemon matches exactly one element (#1224) --- lib/Froxlor/Config/ConfigDaemon.php | 3 +++ lib/configfiles/gentoo.xml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Froxlor/Config/ConfigDaemon.php b/lib/Froxlor/Config/ConfigDaemon.php index 78ca96bdf4..f90dc8f9e4 100644 --- a/lib/Froxlor/Config/ConfigDaemon.php +++ b/lib/Froxlor/Config/ConfigDaemon.php @@ -91,6 +91,9 @@ public function __construct($xml, $xpath) $this->fullxml = $xml; $this->xpath = $xpath; $this->daemon = $this->fullxml->xpath($this->xpath); + if (count($this->daemon) !== 1) { + throw new Exception('XPath "' . $this->xpath . '" didn\'t return exactly one element'); + } $attributes = $this->daemon[0]->attributes(); if ($attributes['title'] != '') { $this->title = $this->parseContent((string)$attributes['title']); diff --git a/lib/configfiles/gentoo.xml b/lib/configfiles/gentoo.xml index 7027f4c8fe..81d5f70c8b 100644 --- a/lib/configfiles/gentoo.xml +++ b/lib/configfiles/gentoo.xml @@ -1702,7 +1702,7 @@ dovecot unix - n n - - pipe - //service[@type='smtp']/general/commands[@index=1]