]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/ids.cgi
proxy.cgi: Fix for Bug #12826 'squid >=5 crashes on literal IPv6 addresses'
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / ids.cgi
index 1d4c3928c1b9393ce8e0a1854d0ffe345502ba39..369bf0276021120ba1f51cfad13bf6c44d557f9a 100644 (file)
@@ -433,20 +433,34 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) {
        unless ($errormessage) {
                # Lock the webpage and print notice about downloading
                # a new ruleset.
-               &working_notice("$Lang::tr{'ids download new ruleset'}");
+               &_open_working_notice("$Lang::tr{'ids download new ruleset'}");
 
                # Call subfunction to download the ruleset.
-               if(&IDS::downloadruleset($provider)) {
-                       $errormessage = "$provider - $Lang::tr{'could not download latest updates'}";
+               my $return = &IDS::downloadruleset($provider);
+
+               # Check if the download function gives a return code.
+               if ($return) {
+                       # Handle different return codes.
+                       if ($return eq "not modified") {
+                               $errormessage = "$provider - $Lang::tr{'ids ruleset is up to date'}";
+                       } else {
+                               $errormessage = "$provider - $Lang::tr{'could not download latest updates'}: $return";
+                       }
 
                        # Call function to store the errormessage.
                        &IDS::_store_error_message($errormessage);
 
+                       # Close the working notice.
+                       &_close_working_notice();
+
                        # Preform a reload of the page.
                        &reload();
                } else {
                        # Call subfunction to launch oinkmaster.
-                       &oinkmaster_web();
+                       &oinkmaster_web("nolock");
+
+                       # Close the working notice.
+                       &_close_working_notice();
 
                        # Check if the IDS is running.
                        if(&IDS::ids_is_running()) {
@@ -747,8 +761,11 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) {
                                &working_notice("$Lang::tr{'ids working'}");
 
                                # Download the ruleset.
-                               if(&IDS::downloadruleset($provider)) {
-                                       $errormessage = "$Lang::tr{'ids could not add provider'} - $Lang::tr{'ids unable to download the ruleset'}";
+                               my $return = &IDS::downloadruleset($provider);
+
+                               # Check if the downloader returned a code.
+                               if ($return) {
+                                       $errormessage = "$Lang::tr{'ids could not add provider'} - $Lang::tr{'ids unable to download the ruleset'}: $return";
 
                                        # Call function to store the errormessage.
                                        &IDS::_store_error_message($errormessage);
@@ -889,6 +906,9 @@ if ($cgiparams{'RULESET'} eq $Lang::tr{'ids apply'}) {
        # Drop the stored ruleset file.
        &IDS::drop_dl_rulesfile($provider);
 
+       # Remove may stored etag data.
+       &IDS::remove_from_etags($provider);
+
        # Get the name of the provider rulessets include file.
        my $provider_used_rulefile = &IDS::get_provider_used_rulesfiles_file($provider);
 
@@ -1094,17 +1114,6 @@ END
 
 print <<END
                                </tr>
-
-                               <tr>
-                                       <td><br><br></td>
-                                       <td><br><br></td>
-                                       <td><br><br></td>
-                                       <td><br><br></td>
-                               </tr>
-
-                               <tr>
-                                       <td colspan='4'><b>$Lang::tr{'ids automatic rules update'}</b></td>
-                               </tr>
                        </table>
 
                        <br><br>
@@ -1161,6 +1170,16 @@ END
                                        $col="bgcolor='$color{'color20'}'";
                                }
 
+                               # Handle providers which are not longer supported.
+                               unless ($provider_name) {
+                                       # Set the provider name to the provider handle
+                                       # to display something helpful.
+                                       $provider_name = $provider;
+
+                                       # Assign background color
+                                       $col="bgcolor='#FF4D4D'";
+                               }
+
                                # Choose icons for the checkboxes.
                                my $status_gif;
                                my $status_gdesc;
@@ -1770,7 +1789,8 @@ END
 ## Function to show the area where additional provider actions can be done.
 #
 sub show_additional_provider_actions() {
-       my $disabled;
+       my $disabled_reset;
+       my $disabled_update;
        my %used_providers = ();
 
        # Read-in providers settings file.
@@ -1785,7 +1805,12 @@ sub show_additional_provider_actions() {
 
        # Disable the reset provider button if no provider modified sids file exists.
        unless (-f $modifications_file) {
-               $disabled = "disabled";
+               $disabled_reset = "disabled";
+       }
+
+       # Disable the manual update button if the provider is not longer supported.
+       unless ($IDS::Ruleset::Providers{$provider}) {
+               $disabled_update = "disabled";
        }
 
        &Header::openbox('100%', 'center', "");
@@ -1795,8 +1820,8 @@ sub show_additional_provider_actions() {
                                <tr>
                                        <td align='center'>
                                                <input type='hidden' name='PROVIDER' value='$provider'>
-                                               <input type='submit' name='PROVIDERS' value='$Lang::tr{'ids reset provider'}' $disabled>
-                                               <input type='submit' name='PROVIDERS' value='$Lang::tr{'ids force ruleset update'}'>
+                                               <input type='submit' name='PROVIDERS' value='$Lang::tr{'ids reset provider'}' $disabled_reset>
+                                               <input type='submit' name='PROVIDERS' value='$Lang::tr{'ids force ruleset update'}' $disabled_update>
                                        </td>
                                </tr>
                        </table>
@@ -1851,10 +1876,14 @@ sub _close_working_notice () {
 ## oinkmaster function, but provides a lot of HTML formated status output.
 #
 sub oinkmaster_web () {
+       my ($nolock) = @_;
+
        my @enabled_providers = &IDS::get_enabled_providers();
 
        # Lock the webpage and print message.
-        &_open_working_notice("$Lang::tr{'ids apply ruleset changes'}");
+       unless ($nolock) {
+               &_open_working_notice("$Lang::tr{'ids apply ruleset changes'}");
+       }
 
         # Check if the files in rulesdir have the correct permissions.
         &IDS::_check_rulesdir_permissions();
@@ -1892,7 +1921,9 @@ sub oinkmaster_web () {
         &_add_to_notice("$Lang::tr{'ids finished'}");
 
        # Close the working notice.
-       &_close_working_notice();
+       unless ($nolock) {
+               &_close_working_notice();
+       }
 }
 
 #
@@ -2031,6 +2062,9 @@ sub get_provider_name($) {
        my ($handle) = @_;
        my $provider_name;
 
+       # Early exit if the given provider does not longer exist.
+       return unless ($IDS::Ruleset::Providers{$handle});
+
        # Get the required translation string for the given provider handle.
        my $tr_string = $IDS::Ruleset::Providers{$handle}{'tr_string'};