Ensure XPath for ConfigDaemon matches exactly one element (#1224)

This commit is contained in:
sro0
2024-01-13 12:31:15 +01:00
committed by GitHub
parent 8740947323
commit 854c930696
2 changed files with 4 additions and 1 deletions

View File

@@ -91,6 +91,9 @@ class ConfigDaemon
$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']);

View File

@@ -1702,7 +1702,7 @@ dovecot unix - n n - - pipe
</include>
</daemon>
<!-- postfix with dovecot -->
<daemon name="postfix_dovecot"
<daemon name="postfix_dovecot" version="3"
title="Postfix 3 with dovecot" default="true">
<include>//service[@type='smtp']/general/commands[@index=1]
</include>