Skip to content

Commit

Permalink
Ensure XPath for ConfigDaemon matches exactly one element (#1224)
Browse files Browse the repository at this point in the history
  • Loading branch information
z-e-r-0-t authored Jan 13, 2024
1 parent 8740947 commit 854c930
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/Froxlor/Config/ConfigDaemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
2 changes: 1 addition & 1 deletion lib/configfiles/gentoo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 854c930

Please sign in to comment.