[vhffs-dev] [2194] Adding webarea blacklisting feature |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 2194
Author: lau
Date: 2012-06-12 22:22:25 +0200 (Tue, 12 Jun 2012)
Log Message:
-----------
Adding webarea blacklisting feature
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Services/Web.pm
trunk/vhffs-backend/conf/vhffs.conf.dist.in
Modified: trunk/vhffs-api/src/Vhffs/Services/Web.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Services/Web.pm 2012-05-31 10:21:57 UTC (rev 2193)
+++ trunk/vhffs-api/src/Vhffs/Services/Web.pm 2012-06-12 20:22:25 UTC (rev 2194)
@@ -84,7 +84,20 @@
return undef unless defined $user and defined $group;
return undef unless Vhffs::Functions::check_domain_name($servername);
+ my $webconf = $vhffs->get_config->get_service('web');
my $web;
+
+ if( open(my $badwebareas, '<', $webconf->{'bad_webarea_file'} ) {
+ while( <$badwebareas> ) {
+ chomp;
+ if ( $servername =~ /(?:^|\.)$_$/ ) {
+ close $badwebareas;
+ return undef;
+ }
+ }
+ close $badwebareas;
+ }
+
my $dbh = $vhffs->get_db();
local $dbh->{RaiseError} = 1;
local $dbh->{PrintError} = 0;
Modified: trunk/vhffs-backend/conf/vhffs.conf.dist.in
===================================================================
--- trunk/vhffs-backend/conf/vhffs.conf.dist.in 2012-05-31 10:21:57 UTC (rev 2193)
+++ trunk/vhffs-backend/conf/vhffs.conf.dist.in 2012-06-12 20:22:25 UTC (rev 2194)
@@ -203,6 +203,10 @@
# Configuration for web service
<web>
+ # This is a file containing all refused webareas, one domain per line.
+ # Refused webareas include the domain and its sub-domains.
+ bad_webarea_file = @CONFDIR@/bl_webarea
+
# Use this module or not
activate = yes