浏览代码

Exit properly when errors on ns/dnssec.php

Miraty 3 年之前
父节点
当前提交
ab87c8522c
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      public/ns/dnssec.php

+ 3 - 1
public/ns/dnssec.php

@@ -33,7 +33,9 @@ if (isset($_POST['zone']) AND isset($_SESSION['username'])) {
 
 	$zoneContent = file_get_contents(KNOT_ZONES_PATH . "/" . $_POST['zone'] . "zone");
 
-	preg_match("#\n" . preg_quote($_POST['zone']) . "\s+0\s+CDS\s+([0-9]{1,5})\s+([0-9]{1,2})\s+([0-9])\s+([0-9A-F]{64})\n#", $zoneContent, $matches);
+	$found = preg_match("#\n" . preg_quote($_POST['zone']) . "\s+0\s+CDS\s+([0-9]{1,5})\s+([0-9]{1,2})\s+([0-9])\s+([0-9A-F]{64})\n#", $zoneContent, $matches);
+	if ($found !== 1)
+		exit("ERROR: Unable to get public key record from zone file");
 
 	$tag = $matches[1];
 	$algo = $matches[2];