From 334a9f66939fe7462357504fbfc2c712c52f7f7f Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 09 Jul 2008 15:02:29 -0400
Subject: [PATCH]
---
interface/lib/classes/validate_dns.inc.php | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/interface/lib/classes/validate_dns.inc.php b/interface/lib/classes/validate_dns.inc.php
index 2c6255f..a161510 100644
--- a/interface/lib/classes/validate_dns.inc.php
+++ b/interface/lib/classes/validate_dns.inc.php
@@ -76,8 +76,11 @@
$parts = explode(".", $field);
$i = 0;
+ $empty = 0;
foreach ($parts as $part){
$i++;
+
+ if(trim($part) == '') $empty += 1;
if(strlen($part) > 63) $error .= $desc." ".$app->tform->wordbook['error_63_characters']."<br>\r\n";
@@ -95,6 +98,12 @@
$error .= $desc." ".$app->tform->wordbook['error_no_wildcard_allowed']."<br>\r\n";
}
}
+ }
+
+ if(substr($field, -1) == '.'){
+ if($i > 2 && $empty > 1) $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
+ } else {
+ if($empty > 0 && $field != '') $error .= $desc." ".$app->tform->wordbook['error_invalid_characters']."<br>\r\n";
}
if(substr($field, -1) == '.' && $area == 'Name'){
@@ -176,7 +185,7 @@
} else {
for($n = 0; $n < 4; $n++){
$q = $ip_parts[$n];
- if(!is_numeric($q) || (int)$q < 0 || (int)$q > 255) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_a']."<br>\r\n";
+ if(!is_numeric($q) || (int)$q < 0 || (int)$q > 255 || trim($q) !== $q) $error .= $app->tform->wordbook['data_txt']." ".$app->tform->wordbook['error_a']."<br>\r\n";
}
}
$rr['data'] = (int)$ip_parts[0].".".(int)$ip_parts[1].".".(int)$ip_parts[2].".".(int)$ip_parts[3];
@@ -264,10 +273,10 @@
$serial_date = substr($serial, 0, 8);
$count = intval(substr($serial, 8, 2));
$current_date = date("Ymd");
- if($serial_date == $current_date){
+ if($serial_date >= $current_date){
$count += 1;
$count = str_pad($count, 2, "0", STR_PAD_LEFT);
- $new_serial = $current_date.$count;
+ $new_serial = $serial_date.$count;
} else {
$new_serial = $current_date.'01';
}
--
Gitblit v1.9.1