]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
ids-functions.pl: Remove logging calls from downloader.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sat, 26 Mar 2022 10:14:40 +0000 (11:14 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sat, 26 Mar 2022 10:14:40 +0000 (11:14 +0100)
The download script should not directly do the logging stuff.

It simply should download the files for the requested provider and
return an error code on fail.

The logging should be done at another place.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
config/cfgroot/ids-functions.pl

index 5b299dc44ca9f333edab86abadbaaabe2474bf69..f4541ce778968ab1c4e9903630c2f81c40ca454b 100644 (file)
@@ -327,9 +327,6 @@ sub downloadruleset ($) {
                $downloader->proxy(['http', 'https'], $proxy_url);
        }
 
-       # Log download/update of the ruleset.
-       &_log_to_syslog("Downloading ruleset for provider: $provider.");
-
        # Grab the download url for the provider.
        my $url = $IDS::Ruleset::Providers{$provider}{'dl_url'};
 
@@ -343,12 +340,8 @@ sub downloadruleset ($) {
 
        }
 
-       # Abort if no url could be determined for the provider.
-       unless ($url) {
-               # Log error and abort.
-               &_log_to_syslog("Unable to gather a download URL for the selected ruleset provider.");
-               return "no url";
-       }
+       # Abort and return "no url", if no url could be determined for the provider.
+       return "no url" unless ($url);
 
        # Pass the requested URL to the downloader.
        my $request = HTTP::Request->new(GET => $url);
@@ -395,9 +388,6 @@ sub downloadruleset ($) {
 
                # Check if the server responds with 304 (Not Modified).
                } elsif ($response->code == 304) {
-                       # Log to syslog.
-                       &_log_to_syslog("Ruleset is up-to-date, no update required.");
-
                        # Return "not modified".
                        return "not modified";
 
@@ -406,9 +396,6 @@ sub downloadruleset ($) {
                        # Obtain error.
                        my $error = $response->content;
 
-                       # Log error message.
-                       &_log_to_syslog("Unable to download the ruleset. \($error\)");
-
                        # Return the error message from response..
                        return "$error";
                }
@@ -438,10 +425,6 @@ sub downloadruleset ($) {
 
        # Check if both file sizes match.
        if (($remote_filesize) && ($remote_filesize ne $local_filesize)) {
-               # Log error message.
-               &_log_to_syslog("Unable to completely download the ruleset. ");
-               &_log_to_syslog("Only got $local_filesize Bytes instead of $remote_filesize Bytes. ");
-
                # Delete temporary file.
                unlink("$tmpfile");
 
@@ -449,18 +432,6 @@ sub downloadruleset ($) {
                return "incomplete download";
        }
 
-       # Check if a file name could be obtained.
-       unless ($dl_rulesfile) {
-               # Log error message.
-               &_log_to_syslog("Unable to store the downloaded rules file. ");
-
-               # Delete downloaded temporary file.
-               unlink("$tmpfile");
-
-               # Return "1" - false.
-               return 1;
-       }
-
        # Overwrite the may existing rulefile or tarball with the downloaded one.
        move("$tmpfile", "$dl_rulesfile");