From 50c86ab9b33976f62f7977a551f4510cfd5260c2 Mon Sep 17 00:00:00 2001 From: Robert Anderson <randerson@lbsd.net> Date: Mon, 12 Oct 2009 10:53:09 +0000 Subject: [PATCH] Check that we have attribute name, operator and value before adding --- smradius/attributes.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/smradius/attributes.pm b/smradius/attributes.pm index 39725718..d4bd8b49 100644 --- a/smradius/attributes.pm +++ b/smradius/attributes.pm @@ -68,9 +68,18 @@ sub addAttribute { my ($server,$nattributes,$vattributes,$attribute) = @_; + + # Check we have the name, operator AND value + if (!defined($attribute->{'Name'}) || !defined($attribute->{'Operator'}) || !defined($attribute->{'Value'})) { + $server->log(LOG_DEBUG,"[ATTRIBUTES] Problem adding attribute with name = ".niceUndef($attribute->{'Name'}). + ", operator = ".niceUndef($attribute->{'Operator'}).", value = ".niceUndef($attribute->{'Value'})); + return; + } + # Clean them up a bit $attribute->{'Name'} =~ s/\s*(\S+)\s*/$1/; $attribute->{'Operator'} =~ s/\s*(\S+)\s*/$1/; + # Grab attribue name, operator and value my $name = $attribute->{'Name'}; my $operator = $attribute->{'Operator'}; -- GitLab