Skip to content

Commit d1ba8c9

Browse files
committed
1 parent 2d368b7 commit d1ba8c9

File tree

8 files changed

+26
-7
lines changed

8 files changed

+26
-7
lines changed

interface/lib/classes/tform.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -855,10 +855,10 @@ function checkPerm($record_id,$perm) {
855855
$result = false;
856856
if($this->formDef["auth_preset"]["userid"] == $_SESSION["s"]["user"]["userid"] && stristr($perm,$this->formDef["auth_preset"]["perm_user"])) $result = true;
857857
if($this->formDef["auth_preset"]["groupid"] == $_SESSION["s"]["user"]["groupid"] && stristr($perm,$this->formDef["auth_preset"]["perm_group"])) $result = true;
858-
if(@stristr($perm,$this->formDef["auth_preset"]["perm_other"])) $result = true;
858+
if(@stristr($this->formDef["auth_preset"]["perm_other"],$perm)) $result = true;
859859

860860
// if preset == 0, everyone can insert a record of this type
861-
if($this->formDef["auth_preset"]["userid"] == 0 AND $this->formDef["auth_preset"]["groupid"] == 0 AND (@stristr($perm,$this->formDef["auth_preset"]["perm_user"] OR @stristr($perm,$this->formDef["auth_preset"]["perm_group"])) $result = true;
861+
if($this->formDef["auth_preset"]["userid"] == 0 AND $this->formDef["auth_preset"]["groupid"] == 0 AND (@stristr($this->formDef["auth_preset"]["perm_user"],$perm) OR @stristr($this->formDef["auth_preset"]["perm_group"],$perm))) $result = true;
862862

863863
return $result;
864864

interface/lib/classes/validate_dns.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function validate_field($field, $area, $zoneid, $wildcard_allowed = 1){
103103
if(substr($field, -1) == '.'){
104104
if($i > 2 && $empty > 1) $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
105105
} else {
106-
if($empty > 0) $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
106+
if($empty > 0 && $field != '') $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
107107
}
108108

109109
if(substr($field, -1) == '.' && $area == 'Name'){

interface/web/dns/form/rr.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
$form["db_history"] = "yes";
4343
$form["tab_default"] = "rr";
4444
$form["list_default"] = "rr_list.php";
45-
$form["auth"] = 'no'; // yes / no
45+
$form["auth"] = 'yes'; // yes / no
4646

4747
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
4848
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user

interface/web/dns/form/soa.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
$form["db_history"] = "yes";
4343
$form["tab_default"] = "soa";
4444
$form["list_default"] = "soa_list.php";
45-
$form["auth"] = 'no'; // yes / no
45+
$form["auth"] = 'yes'; // yes / no
4646

4747
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
4848
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user

interface/web/dns/rr_del.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ class page_action extends tform_actions {
5656
function onDelete() {
5757
global $app, $conf;
5858

59-
$rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE id = ".$_REQUEST['id']);
59+
$app->uses('tform');
60+
if(!$rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE id = ".$_REQUEST['id']." AND ".$app->tform->getAuthSQL('d'))) $app->error('not allowed');
61+
62+
//$rr = $app->db->queryOneRecord("SELECT * FROM rr WHERE id = ".$_REQUEST['id']);
6063
$zone_id = $rr['zone'];
6164

6265
// update serial

interface/web/dns/rr_edit.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,16 @@
5353

5454
class page_action extends tform_actions {
5555

56+
5657
function onSubmit() {
5758
global $app, $conf;
5859

60+
if($this->dataRecord['id'] > 0){
61+
if(!$app->tform->checkPerm($this->dataRecord['id'],'u')) $app->error('not allowed');
62+
} else {
63+
if(!$app->tform->checkPerm($this->dataRecord['id'],'i')) $app->error('not allowed');
64+
}
65+
5966
$this->dataRecord["zone"] = $_SESSION['s']['list']['rr']['parent_id'];
6067

6168
$app->uses('validate_dns');

interface/web/dns/soa_del.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ class page_action extends tform_actions {
5656
function onDelete() {
5757
global $app, $conf;
5858

59+
$app->uses('tform');
60+
if(!$soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$_REQUEST['id']." AND ".$app->tform->getAuthSQL('d'))) $app->error('not allowed');
61+
5962
// PTR
6063
if($conf['auto_create_ptr'] == 1 && trim($conf['default_ns']) != '' && trim($conf['default_mbox']) != ''){
61-
$soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$_REQUEST['id']);
64+
//$soa = $app->db->queryOneRecord("SELECT * FROM soa WHERE id = ".$_REQUEST['id']);
6265
$rrs = $app->db->queryAllRecords("SELECT * FROM rr WHERE zone = '".$_REQUEST['id']."' AND (type = 'A' OR type = 'AAAA')");
6366
if(!empty($rrs)){
6467
foreach($rrs as $rr){

interface/web/dns/soa_edit.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ class page_action extends tform_actions {
5656
function onSubmit() {
5757
global $app, $conf;
5858

59+
if($this->dataRecord['id'] > 0){
60+
if(!$app->tform->checkPerm($this->dataRecord['id'],'u')) $app->error('not allowed');
61+
} else {
62+
if(!$app->tform->checkPerm($this->dataRecord['id'],'i')) $app->error('not allowed');
63+
}
64+
5965
$app->uses('validate_dns');
6066
$app->tform->errorMessage .= $app->validate_dns->validate_soa($this->dataRecord);
6167

0 commit comments

Comments
 (0)