From 1ee7299f9582a25f8e17d5d41b4fd12a8217691b Mon Sep 17 00:00:00 2001 From: cajus Date: Mon, 7 Dec 2009 14:56:23 +0000 Subject: [PATCH] Add rudimentary checks git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14876 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../dns/class_servDNSeditZoneEntries.inc | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZoneEntries.inc b/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZoneEntries.inc index 87e1efc5e..263514000 100644 --- a/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZoneEntries.inc +++ b/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZoneEntries.inc @@ -290,6 +290,14 @@ class servDNSeditZoneEntries extends plugin $tmp2 = array(); foreach($device['RECORDS'] as $Num => $Rec){ + /* Check values */ + if ($Rec['type'] != "pTRRecord") { + $msg= $this->checkRecordType($DevName, $Rec['type'], $Rec['value']); + if ($msg != "") { + $message[]= $msg; + } + } + /* Check for multiple use of unique record types */ if(in_array($Rec['type'],$singleEntries)){ @@ -500,6 +508,26 @@ class servDNSeditZoneEntries extends plugin } + /* Check record types for strange inputs */ + function checkRecordType($name, $type, $value) + { +echo $type; + $checks= array( + "aRecord" => "/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/" + ); + + /* No check for entry */ + if (!isset($checks[$type])) { + return ""; + } + + /* Else check ;-) */ + if (!preg_match($checks[$type], $value)) { + return (sprintf("The syntax of entry %s (record type %s, value %s) is invalid!", $name, $type, $value)); + } + } + + function remove_from_parent() { } -- 2.30.2