]> git.ipfire.org Git - people/stevee/guardian.git/commitdiff
Only perform IP address related operations if an address has been passed.
authorStefan Schantl <stefan.schantl@ipfire.org>
Wed, 3 Feb 2016 08:25:51 +0000 (09:25 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Wed, 3 Feb 2016 08:25:51 +0000 (09:25 +0100)
Some events does not contain any IP address informations, therefore there
is no need to call any address related operations.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
modules/Events.pm

index 8f04f3d6cab3ef580242f895d6c57aea1242a9b6..cfc785ffc24ba00f430a4345558f79560b83fdd7 100644 (file)
@@ -87,20 +87,23 @@ sub CheckAction ($$) {
                 return;
         }
 
-       # Convert and validate the given address.
-       my $bin_address = &Guardian::Base::IPOrNet2Int($address);
-
-       # Abort if the given address could not be converted because it is not valid.
-       unless ($bin_address) {
-               $logger->Log("err", "Invalid IP address: $address");
-               return;
-       }
+       # Check if the given event contains an address.
+       if ($address) {
+               # Convert and validate the given address.
+               my $bin_address = &Guardian::Base::IPOrNet2Int($address);
+
+               # Abort if the given address could not be converted because it is not valid.
+               unless ($bin_address) {
+                       $logger->Log("err", "Invalid IP address: $address");
+                       return;
+               }
 
-       # Check if address should be ignored.
-       if(&_IsOnIgnoreList($bin_address)) {
-               # Log message.
-               $logger->Log("info", "Ignoring event for $address, because it is part of the ignore list.");
-               return;
+               # Check if address should be ignored.
+               if(&_IsOnIgnoreList($bin_address)) {
+                       # Log message.
+                       $logger->Log("info", "Ignoring event for $address, because it is part of the ignore list.");
+                       return;
+               }
        }
 
        # Call required handler.