Commit 35f625e1 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Fixed issue #7, duplicate policy ID's

closes #7
parent f7b48a8e
......@@ -85,7 +85,7 @@ sub getPolicy
$server->log(LOG_DEBUG,"[POLICIES] Going to resolve session data into policy: ".Dumper($sessionData)) if ($log);
# Start with blank policy list
my %matchedPolicies = ();
my $matchedPolicies = { };
# Grab all the policy members
......@@ -208,17 +208,19 @@ sub getPolicy
# Check if we passed the tests
next if (!$destinationMatch);
$matchedPolicies->{$policyMember->{'Priority'}}->{$policyMember->{'PolicyID'}} = 1;
# If we logging, display a list
if ($log) {
foreach my $prio (sort keys %matchedPolicies) {
$server->log(LOG_DEBUG,"[POLICIES] END RESULT: prio=$prio => policy ids: ".join(',',@{$matchedPolicies{$prio}}));
# Work through the list and build our result, which is a priority hash with matches as an array
foreach my $prio (sort {$a <=> $b} keys %{$matchedPolicies}) {
my @policies = keys %{$matchedPolicies->{$prio}};
$server->log(LOG_DEBUG,"[POLICIES] END RESULT: prio=$prio => policy ids: ".join(',',@policies)) if ($log);
# Change from a hash to an array...
$matchedPolicies->{$prio} = \@policies;
return \%matchedPolicies;
return $matchedPolicies;
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