Browse Source

Allow DS record removal

Miraty 3 years ago
parent
commit
99f1240ac3
1 changed files with 11 additions and 16 deletions
  1. 11 16
      reg/ds.php

+ 11 - 16
reg/ds.php

@@ -1,6 +1,12 @@
 <?php include "../top.inc.php"; ?>
 
 <form method="post">
+  <label for="action">Action</label>
+  <select name="action" id="action">
+    <option value="add">Ajouter</option>
+    <option value="delete">Retirer</option>
+  </select>
+  <br>
   <label for="zone">Domaine</label>
   <br>
   <select required="" name="zone" id="zone">
@@ -72,38 +78,27 @@ if (isset($_POST['zone']) AND isset($_POST['keytag']) AND isset($_POST['algo'])
       AND !($_POST['algo'] === "15")
       AND !($_POST['algo'] === "16")
     )
-    exit("Incorrect value for algo");
+    exit("Wrong value for algo");
 
   $_POST['keytag'] = intval($_POST['keytag']);
   if ((!preg_match("/^[0-9]{1,6}$/", $_POST['keytag'])) OR !($_POST['keytag'] >= 1) OR !($_POST['keytag'] <= 65535))
-    exit("Incorrect value for keytag");
+    exit("Wrong value for keytag");
 
   if (!$_POST['dt'] === "2" AND !$_POST['dt'] === "4")
-    exit("Incorrect value for dt");
+    exit("Wrong value for dt");
 
   checkAbsoluteDomainFormat($_POST['zone']);
   nsCheckZonePossession($_POST['zone']);
   regCheckDomainPossession($_POST['zone']);
 
+  $action = checkAction($_POST['action']);
+
   $suffix = regGetUpperDomain($_POST['zone']);
 
   exec(KNOTC_PATH . " zone-begin " . $suffix);
   exec(KNOTC_PATH . " zone-" . $action . "set " . $suffix . " " . $_POST['zone'] . " 86400 IN DS " . $_POST['keytag'] . " " . $_POST['algo'] . " " . $_POST['dt'] . " " . $_POST['key']);
   exec(KNOTC_PATH . " zone-commit " . $suffix);
-  //secure.example.   DS      tag=12345 alg=3 digest_type=1 <foofoo>
   echo "La requête a été envoyée à Knot";
-
-  /*
-  moomin3.atope.art.      0       DS      11168 13 1 D39D6B1ED58ECE9FA8AB6B7DB53E78338D45E2FF
-  moomin3.atope.art.      0       DS      11168 13 2 DB7C3B76CF40C1F7C0BF278AB46284BFEA5E7D44B382992E32BB5B3DC50BA7AB
-  moomin3.atope.art.      0       DS      11168 13 4 018F25E4A022463478C9E30136EC53771A1704A0F0B3CE5B883AC9C8A6A55D16B638B4DE70662ACA5295D3669E7CADD9
-  from rfc : secure.example.   DS      tag=12345 alg=3 digest_type=1 <foofoo>
-  */
-
-  //exec("knotc zone-begin atope.art");
-  //exec("knotc zone-set atope.art " . $_POST['subdomain'] . ".atope.art. DS " . $_POST['ns'] . ".");
-  //exec("knotc zone-commit atope.art");
-  //echo "Modifications appliquées";
 }