Commit 69329a6d authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Whitespace & copyright cleanup

parent 35f625e1
# Policy handling functions
# Copyright (C) 2009, AllWorldIT
# Copyright (C) 2009-2014, AllWorldIT
# Copyright (C) 2008, LinuxRulz
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
......@@ -90,9 +90,9 @@ sub getPolicy
# Grab all the policy members
my $sth = DBSelect('
SELECT
SELECT
policies.Name, policies.Priority, policies.Disabled AS PolicyDisabled,
policy_members.ID, policy_members.PolicyID, policy_members.Source,
policy_members.ID, policy_members.PolicyID, policy_members.Source,
policy_members.Destination, policy_members.Disabled AS MemberDisabled
FROM
policies, policy_members
......@@ -140,7 +140,7 @@ sub getPolicy
} else {
# Split off sources
my @rawSources = split(/,/,$policyMember->{'Source'});
$server->log(LOG_DEBUG,"[POLICIES] $debugTxt: Main policy sources '".join(',',@rawSources)."'") if ($log);
# Default to no match
......@@ -163,7 +163,7 @@ sub getPolicy
}
}
}
$server->log(LOG_INFO,"[POLICIES] $debugTxt: Source matching result: matched=$sourceMatch") if($log);
# Check if we passed the tests
next if (!$sourceMatch);
......@@ -177,11 +177,11 @@ sub getPolicy
if (!defined($policyMember->{'Destination'}) || lc($policyMember->{'Destination'}) eq "any") {
$server->log(LOG_DEBUG,"[POLICIES] $debugTxt: Destination not defined or 'any', explicit match: matched=1") if ($log);
$destinationMatch = 1;
} else {
# Split off destinations
my @rawDestinations = split(/,/,$policyMember->{'Destination'});
$server->log(LOG_DEBUG,"[POLICIES] $debugTxt: Main policy destinations '".join(',',@rawDestinations)."'") if ($log);
# Parse in group data
......@@ -233,7 +233,7 @@ sub getGroupMembers
# Grab group members
my $sth = DBSelect("
SELECT
SELECT
policy_group_members.Member
FROM
policy_groups, policy_group_members
......@@ -267,7 +267,7 @@ sub policySourceItemMatches
my ($negate,$tmpItem) = ($rawItem =~ /^(!)?(.*)/);
# See if we match %, if we do its a group
my ($isGroup,$item) = ($tmpItem =~ /^(%)?(.*)/);
# Check if this is a group
my $match = 0;
if ($isGroup) {
......@@ -276,7 +276,7 @@ sub policySourceItemMatches
$server->log(LOG_WARN,"[POLICIES] $debugTxt: Source policy group '$item' appears to be used more than once, possible loop, aborting!");
return -1;
}
# We going deeper, record the depth
$history->{$item} = keys(%{$history});
# Check if we not tooo deep
......@@ -344,7 +344,7 @@ sub policySourceItemMatches
} else {
$server->log(LOG_WARN,"[POLICIES] $debugTxt: - Source '".$item."' is not a valid specification");
}
$match = 1 if ($res);
}
......@@ -366,7 +366,7 @@ sub policyDestinationItemMatches
my ($negate,$tmpItem) = ($rawItem =~ /^(!)?(.*)/);
# See if we match %, if we do its a group
my ($isGroup,$item) = ($tmpItem =~ /^(%)?(.*)/);
# Check if this is a group
my $match = 0;
if ($isGroup) {
......@@ -375,7 +375,7 @@ sub policyDestinationItemMatches
$server->log(LOG_WARN,"[POLICIES] $debugTxt: Destination policy group '$item' appears to be used more than once, possible loop, aborting!");
return -1;
}
# We going deeper, record the depth
$history->{$item} = keys(%{$history});
# Check if we not tooo deep
......@@ -422,7 +422,7 @@ sub policyDestinationItemMatches
} else {
$server->log(LOG_WARN,"[POLICIES] $debugTxt: - Destination '$item' is not a valid specification");
}
$match = 1 if ($res);
}
......@@ -563,7 +563,7 @@ sub reverseDNSMatches
$match = 1;
}
}
return $match;
}
......@@ -597,8 +597,8 @@ sub decodePolicyData
my ($email,$rawPolicy) = ($item =~ /<([^>]*)>#(.*)/);
# Make sure that the recipient data in the DB is not null, ie. it may
# of been killed by the admin before it updated it
# Make sure that the recipient data in the DB is not null, ie. it may
# of been killed by the admin before it updated it
if (defined($email) && defined($rawPolicy)) {
# Loop with raw policies
foreach my $policy (split(/;/,$rawPolicy)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment