add caa support
Hanno Böck

Hanno Böck commited on 2017-03-08 23:39:30
Zeige 3 geänderte Dateien mit 30 Einfügungen und 3 Löschungen.

... ...
@@ -65,9 +65,13 @@ foreach ($records AS $rec)
65 65
   {
66 66
     $data = (int) $rec['spec'] . ' 1 ' . $data;
67 67
   }
68
+  if ($rec['type'] == 'caa')
69
+  {
70
+    $data = $caa_properties[(int) $rec['spec']] . ' 0 "' . $data.'"';
71
+  }
68 72
   $ttl = ($rec['ttl'] ? $rec['ttl'] : 3600);
69 73
   $link = $rec['fqdn'];
70
-  if (!in_array($rec['type'], array('a', 'aaaa', 'mx', 'cname', 'ns', 'txt', 'spf', 'ptr', 'sshfp'))) {
74
+  if (!in_array($rec['type'], array('a', 'aaaa', 'mx', 'cname', 'ns', 'txt', 'spf', 'ptr', 'sshfp', 'caa'))) {
71 75
       $editable = false;
72 76
   }
73 77
   if ($editable) {
... ...
@@ -106,6 +110,7 @@ output('<h4>Neuen DNS-Record anlegen</h4>
106 110
 <li>'.internal_link('dns_record_edit', 'NS (Nameserver)', 'id=new&type=ns&domain='.$domain->id).'</li>
107 111
 <li>'.internal_link('dns_record_edit', 'TXT', 'id=new&type=txt&domain='.$domain->id).'</li>
108 112
 <li>'.internal_link('dns_record_edit', 'SSHFP', 'id=new&type=sshfp&domain='.$domain->id).'</li>
113
+<li>'.internal_link('dns_record_edit', 'CAA', 'id=new&type=caa&domain='.$domain->id).'</li>
109 114
 </ul>
110 115
 
111 116
 <h4>Automatische DNS-Records</h4>
... ...
@@ -137,6 +137,20 @@ if ($type == 'sshfp')
137 137
 ';
138 138
 }
139 139
 
140
+if ($type == 'caa')
141
+{
142
+  $option="";
143
+  foreach ($caa_properties as $key => $property) {
144
+    $option .= '<option value="'.$key.'" ';
145
+    if ($key == $data['spec']) $option .= 'selected="selected"';
146
+    $option .= '>'.$property.' ('.$key.')</option>';
147
+  }
148
+  $form .= '
149
+<tr><td><label for="spec">Property tag:</label></td><td><select name="spec" id="spec">'.$option.'</select></td></tr>
150
+<tr><td><label for="data">Inhalt:</label></td><td><input type="text" name="data" id="data" value="'.$data['data'].'" /></td></tr>
151
+';
152
+}
153
+
140 154
 if ($dyndns)
141 155
 {
142 156
   $form .= '
... ...
@@ -21,6 +21,7 @@ require_once('inc/error.php');
21 21
 
22 22
 require_once('class/domain.php');
23 23
 
24
+$caa_properties= array( 0 => "issue", 1 => "issuewild", 2 => "iodef" );
24 25
 
25 26
 function get_dyndns_accounts() 
26 27
 {
... ...
@@ -144,7 +145,7 @@ function get_dyndns_records($id)
144 145
   return $data;
145 146
 }
146 147
 
147
-$valid_record_types = array('a', 'aaaa', 'mx', 'ns', 'spf', 'txt', 'cname', 'ptr', 'srv', 'raw', 'sshfp');
148
+$valid_record_types = array('a', 'aaaa', 'mx', 'ns', 'spf', 'txt', 'cname', 'ptr', 'srv', 'raw', 'sshfp', 'caa');
148 149
 
149 150
 
150 151
 function blank_dns_record($type)
... ...
@@ -211,7 +212,7 @@ function get_domain_auto_records($domainname)
211 212
 }
212 213
 
213 214
 
214
-$implemented_record_types = array('a', 'aaaa', 'mx', 'spf', 'txt', 'cname', 'ptr', 'srv', 'ns', 'sshfp');
215
+$implemented_record_types = array('a', 'aaaa', 'mx', 'spf', 'txt', 'cname', 'ptr', 'srv', 'ns', 'sshfp', 'caa');
215 216
 
216 217
 function save_dns_record($id, $record)
217 218
 {
... ...
@@ -292,6 +293,13 @@ function save_dns_record($id, $record)
292 293
         system_failure('text entry missing');
293 294
       break;
294 295
 
296
+    case 'caa':
297
+      $record['dyndns'] = NULL;
298
+      $record['spec'] = max( (int) $record['spec'], 1);
299
+      $record['ip'] = NULL;
300
+      if (! $record['data'] )
301
+        system_failure('text entry missing');
302
+      break;
295 303
 
296 304
     case 'srv':
297 305
       system_failure('not implemented yet');
298 306