Bläddra i källkod

Exit properly when errors on ns/dnssec.php

Miraty 3 år sedan
förälder
incheckning
ab87c8522c
1 ändrade filer med 3 tillägg och 1 borttagningar
  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];