From d0411a285f29375cf213ad34ed6e3bcd356c9e51 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 5 Aug 2013 10:05:05 -0400 Subject: [PATCH] fix defect 2959 --- xCAT-server/lib/perl/xCAT/xcatd.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/xcatd.pm b/xCAT-server/lib/perl/xCAT/xcatd.pm index 67891d54e..ed76310dc 100644 --- a/xCAT-server/lib/perl/xCAT/xcatd.pm +++ b/xCAT-server/lib/perl/xCAT/xcatd.pm @@ -69,15 +69,18 @@ sub validate { $policytable->close; my $rule; my $peerstatus="untrusted"; + # This sorts the policy table rows based on the level of the priority field in the row. + # note the lower the number in the policy table the higher the priority + my @sortedpolicies = sort { $a->{priority} <=> $b->{priority} } (@$policies); # check to see if peerhost is trusted - foreach $rule (@$policies) { + foreach $rule (@sortedpolicies) { if (($rule->{name} and $rule->{name} eq $peername) && ($rule->{rule}=~ /trusted/i)) { $peerstatus="Trusted"; last; } } - RULE: foreach $rule (@$policies) { + RULE: foreach $rule (@sortedpolicies) { if ($rule->{name} and $rule->{name} ne '*') { #TODO: more complex matching (lists, wildcards) next unless ($peername and $peername eq $rule->{name});