Permalink
Browse files

More strict ascii domain name filtering

  • Loading branch information...
1 parent cde0492 commit 77ca3bea87d0d383c35d6479a2a09bb21be75a79 @khalahan committed Nov 15, 2011
Showing with 3 additions and 2 deletions.
  1. +2 −2 name.class.php
  2. +1 −0 namescan.php
View
@@ -40,8 +40,8 @@ public function isNameValid() {
$this->errors[] = 'Not in the domain namespace';
return false;
}
- if(!preg_match('@^[^/]+/[\x00-\x7F]+$@', $this->name)) {
- $this->errors[] = 'Not an ascii name';
+ if(!preg_match('@^[^/]+/[a-z0-9_-]+$@', $this->name)) {
+ $this->errors[] = 'Not an ascii idn name';
return false;
}
return true;
View
@@ -11,6 +11,7 @@
#print_r($name_scan);
#$name_scan[] = array('name'=>'d/test5','value'=>"{\"info\":{\"registrar\":\"http://register.dot-bit.org\"},\"map\": {\"\": \"46.137.88.107\", \"www\": \"46.137.88.107\"} }");
#$name_scan[] = array('name'=>'d/test5','value'=>"{\"info\":{\"registrar\":\"http://register.dot-bit.org\"},\"dns\":[\"ns0.web-sweet-web.net\",\"ns1.web-sweet-web.net\"],\"map\":{\"\":{\"ns\":[\"ns0.web-sweet-web.net\",\"ns1.web-sweet-web.net\"]}}} ");
+#$name_scan[] = array('name'=>'d/test5','value'=>'{"ip":"10.0.0.1","map":{"":"10.0.0.1"}}');
// Exit if bad data
if(!count($name_scan) && !isset($name_scan[0]['name'])) {

0 comments on commit 77ca3be

Please sign in to comment.