Skip to content

Commit 7cedfde

Browse files
author
thom
committed
Add remote functions for SSHFP
1 parent 8325db5 commit 7cedfde

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

interface/lib/classes/remote.d/dns.inc.php

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function dns_templatezone_add($session_id, $client_id, $template_id, $dom
5757
$app->uses('tform');
5858
$app->tform->loadFormDef($tform_def_file);
5959
$app->uses('tpl,validate_dns,remoting_lib');
60-
60+
6161
$app->remoting_lib->loadUserProfile($client_id);
6262

6363
//* replace template placeholders
@@ -197,7 +197,7 @@ public function dns_zone_get($session_id, $primary_id) {
197197
$app->remoting_lib->loadFormDef('../dns/form/dns_soa.tform.php');
198198
return $app->remoting_lib->getDataRecord($primary_id);
199199
}
200-
200+
201201
//* Get slave zone details
202202
public function dns_slave_get($session_id, $primary_id) {
203203
global $app;
@@ -211,7 +211,7 @@ public function dns_slave_get($session_id, $primary_id) {
211211
return $app->remoting_lib->getDataRecord($primary_id);
212212
}
213213

214-
214+
215215
//* Add a slave zone
216216
public function dns_slave_add($session_id, $client_id, $params) {
217217
if(!$this->checkPerm($session_id, 'dns_zone_add')) {
@@ -220,7 +220,7 @@ public function dns_slave_add($session_id, $client_id, $params) {
220220
}
221221
return $this->insertQuery('../dns/form/dns_slave.tform.php', $client_id, $params);
222222
}
223-
223+
224224
//* Update a slave zone
225225
public function dns_slave_update($session_id, $client_id, $primary_id, $params) {
226226
if(!$this->checkPerm($session_id, 'dns_zone_update')) {
@@ -296,27 +296,27 @@ public function dns_zone_delete($session_id, $primary_id) {
296296

297297
private function dns_rr_get($session_id, $primary_id, $rr_type = 'A') {
298298
global $app;
299-
299+
300300
$rr_type = strtolower($rr_type);
301301
if(!preg_match('/^[a-z]+$/', $rr_type)) {
302302
throw new SoapFault('permission denied', 'Invalid rr type');
303303
}
304-
304+
305305
if(!$this->checkPerm($session_id, 'dns_' . $rr_type . '_get')) {
306306
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
307307
}
308308
$app->uses('remoting_lib');
309309
$app->remoting_lib->loadFormDef('../dns/form/dns_' . $rr_type . '.tform.php');
310310
return $app->remoting_lib->getDataRecord($primary_id);
311311
}
312-
312+
313313
//* Add a record
314314
private function dns_rr_add($session_id, $client_id, $params, $update_serial=false, $rr_type = 'A') {
315315
$rr_type = strtolower($rr_type);
316316
if(!preg_match('/^[a-z]+$/', $rr_type)) {
317317
throw new SoapFault('permission denied', 'Invalid rr type');
318318
}
319-
319+
320320
if(!$this->checkPerm($session_id, 'dns_' . $rr_type . '_add')) {
321321
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
322322
}
@@ -332,7 +332,7 @@ private function dns_rr_update($session_id, $client_id, $primary_id, $params, $u
332332
if(!preg_match('/^[a-z]+$/', $rr_type)) {
333333
throw new SoapFault('permission denied', 'Invalid rr type');
334334
}
335-
335+
336336
if(!$this->checkPerm($session_id, 'dns_' . $rr_type . '_update')) {
337337
throw new SoapFault('permission_denied', 'You do not have the permissions to access this function.');
338338
return false;
@@ -343,7 +343,7 @@ private function dns_rr_update($session_id, $client_id, $primary_id, $params, $u
343343
}
344344
return $affected_rows;
345345
}
346-
346+
347347
//* Delete a record
348348
private function dns_rr_delete($session_id, $primary_id, $update_serial=false, $rr_type = 'A') {
349349
$rr_type = strtolower($rr_type);
@@ -359,9 +359,9 @@ private function dns_rr_delete($session_id, $primary_id, $update_serial=false, $
359359
$affected_rows = $this->deleteQuery('../dns/form/dns_' . $rr_type . '.tform.php', $primary_id);
360360
return $affected_rows;
361361
}
362-
362+
363363
// ----------------------------------------------------------------------------------------------------------------
364-
364+
365365
//* Get record details
366366
public function dns_aaaa_get($session_id, $primary_id) {
367367
return $this->dns_rr_get($session_id, $primary_id, 'AAAA');
@@ -626,6 +626,28 @@ public function dns_srv_delete($session_id, $primary_id, $update_serial=false) {
626626

627627
// ----------------------------------------------------------------------------------------------------------------
628628

629+
//* Get record details
630+
public function dns_sshfp_get($session_id, $primary_id) {
631+
return $this->dns_rr_get($session_id, $primary_id, 'SSHFP');
632+
}
633+
634+
//* Add a record
635+
public function dns_sshfp_add($session_id, $client_id, $params, $update_serial=false) {
636+
return $this->dns_rr_add($session_id, $client_id, $params, $update_serial, 'SSHFP');
637+
}
638+
639+
//* Update a record
640+
public function dns_sshfp_update($session_id, $client_id, $primary_id, $params, $update_serial=false) {
641+
return $this->dns_rr_update($session_id, $client_id, $primary_id, $params, $update_serial, 'SSHFP');
642+
}
643+
644+
//* Delete a record
645+
public function dns_sshfp_delete($session_id, $primary_id, $update_serial=false) {
646+
return $this->dns_rr_delete($session_id, $primary_id, $update_serial, 'SSHFP');
647+
}
648+
649+
// ----------------------------------------------------------------------------------------------------------------
650+
629651
//* Get record details
630652
public function dns_tlsa_get($session_id, $primary_id) {
631653
return $this->dns_rr_get($session_id, $primary_id, 'TLSA');

interface/web/dns/lib/remote.conf.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
$function_list['dns_ptr_get,dns_ptr_add,dns_ptr_update,dns_ptr_delete'] = 'DNS ptr functions';
1616
$function_list['dns_rp_get,dns_rp_add,dns_rp_update,dns_rp_delete'] = 'DNS rp functions';
1717
$function_list['dns_srv_get,dns_srv_add,dns_srv_update,dns_srv_delete'] = 'DNS srv functions';
18+
$function_list['dns_sshfp_get,dns_sshfp_add,dns_sshfp_update,dns_sshfp_delete'] = 'DNS sshfp functions';
1819
$function_list['dns_tlsa_get,dns_tlsa_add,dns_tlsa_update,dns_tlsa_delete'] = 'DNS tlsa functions';
1920
$function_list['dns_txt_get,dns_txt_add,dns_txt_update,dns_txt_delete'] = 'DNS txt functions';
2021

0 commit comments

Comments
 (0)