3
0

reserved zones

This commit is contained in:
Philippe Pittoli 2014-05-08 19:42:38 +02:00
parent f80420a0a4
commit d24074fdc9
2 changed files with 22 additions and 1 deletions

View File

@ -28,6 +28,22 @@ sub is_domain_name {
return $dn =~ $ndd;
}
sub is_reserved {
my ($domain) = @_;
my $filename = "reserved.zone";
open my $entree, '<:encoding(UTF-8)', $filename or
die "Impossible d'ouvrir '$filename' en lecture : $!";
while(<$entree>) {
if(m/^$domain$/) {
return 1;
}
}
return 0;
}
# eventually change place
sub initco {
@ -301,7 +317,11 @@ prefix '/domain' => sub {
my $creationSuccess = '';
if( param('domain') =~ /^[a-zA-Z0-9]+[a-zA-Z0-9-]+[a-zA-Z0-9]+$|^[a-zA-Z0-9]+$/ )
if(is_reserved(param('domain'))) {
session errmsg =>
q{Le nom de domaine est réservé};
}
elsif( param('domain') =~ /^[a-zA-Z0-9]+[a-zA-Z0-9-]+[a-zA-Z0-9]+$|^[a-zA-Z0-9]+$/)
{
my $cfg = new Config::Simple(dirname(__FILE__).'/../conf/config.ini');

1
www/lib/reserved.zone Normal file
View File

@ -0,0 +1 @@
www