]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Merge remote-tracking branch 'amarx/BUG10620' into next
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 26 Sep 2014 11:03:22 +0000 (13:03 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 26 Sep 2014 11:03:22 +0000 (13:03 +0200)
57 files changed:
config/cfgroot/general-functions.pl
config/firewall/firewall-lib.pl
config/firewall/rules.pl
config/rootfiles/core/84/exclude [moved from config/rootfiles/core/82/exclude with 100% similarity]
config/rootfiles/core/84/filelists/bash [new symlink]
config/rootfiles/core/84/filelists/dnsmasq [new symlink]
config/rootfiles/core/84/filelists/files [new file with mode: 0644]
config/rootfiles/core/84/meta [moved from config/rootfiles/core/82/meta with 100% similarity]
config/rootfiles/core/84/update.sh [new file with mode: 0644]
config/rootfiles/oldcore/82/exclude [new file with mode: 0644]
config/rootfiles/oldcore/82/filelists/armv5tel/gmp [moved from config/rootfiles/core/82/filelists/armv5tel/gmp with 100% similarity]
config/rootfiles/oldcore/82/filelists/batctl [moved from config/rootfiles/core/82/filelists/batctl with 100% similarity]
config/rootfiles/oldcore/82/filelists/boost [moved from config/rootfiles/core/82/filelists/boost with 100% similarity]
config/rootfiles/oldcore/82/filelists/files [moved from config/rootfiles/core/82/filelists/files with 100% similarity]
config/rootfiles/oldcore/82/filelists/i586/gmp [moved from config/rootfiles/core/82/filelists/i586/gmp with 100% similarity]
config/rootfiles/oldcore/82/filelists/iputils [new symlink]
config/rootfiles/oldcore/82/filelists/libnl-3 [moved from config/rootfiles/core/82/filelists/libnl-3 with 100% similarity]
config/rootfiles/oldcore/82/filelists/mpfr [moved from config/rootfiles/core/82/filelists/mpfr with 100% similarity]
config/rootfiles/oldcore/82/filelists/openssl-compat [new symlink]
config/rootfiles/oldcore/82/filelists/ppp [moved from config/rootfiles/core/82/filelists/ppp with 100% similarity]
config/rootfiles/oldcore/82/meta [new file with mode: 0644]
config/rootfiles/oldcore/82/update.sh [moved from config/rootfiles/core/82/update.sh with 100% similarity]
config/rootfiles/oldcore/83/exclude [new file with mode: 0644]
config/rootfiles/oldcore/83/filelists/bash [new symlink]
config/rootfiles/oldcore/83/filelists/files [new file with mode: 0644]
config/rootfiles/oldcore/83/filelists/findutils [new symlink]
config/rootfiles/oldcore/83/filelists/squid [new symlink]
config/rootfiles/oldcore/83/meta [new file with mode: 0644]
config/rootfiles/oldcore/83/update.sh [new file with mode: 0644]
config/rootfiles/packages/perl-PDF-API2
config/xen-image/README
html/cgi-bin/firewall.cgi
html/cgi-bin/fwhosts.cgi
html/cgi-bin/logs.cgi/ids.dat
html/cgi-bin/urlfilter.cgi
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl
lfs/bash
lfs/dnsmasq
lfs/glibc
lfs/openssl-compat
lfs/rsync
lfs/samba
lfs/sane
make.sh
src/patches/bash/bash32-052 [new file with mode: 0644]
src/patches/bash/bash32-053 [new file with mode: 0644]
src/patches/dnsmasq-2.71-support-nettle-3.0.patch [deleted file]
src/patches/dnsmasq-2.71-use-nettle-with-minigmp.patch [deleted file]
src/patches/dnsmasq-2.72rc2-Add-support-to-read-ISC-DHCP-lease-file.patch [moved from src/patches/dnsmasq-2.70-Add-support-to-read-ISC-DHCP-lease-file.patch with 94% similarity]
src/patches/glibc/glibc-rh1008310.patch [new file with mode: 0644]
src/patches/glibc/glibc-rh1022022.patch [new file with mode: 0644]
src/patches/glibc/glibc-rh1091162.patch [new file with mode: 0644]
src/patches/glibc/glibc-rh1098050.patch [new file with mode: 0644]
src/patches/glibc/glibc-rh1133809-1.patch [new file with mode: 0644]
src/patches/glibc/glibc-rh1133809-2.patch [new file with mode: 0644]
src/squid-accounting/acct-lib.pl

index 8ed87fc80e58d5b40f3a5cc108d2d3e36fb767c8..35ae7c0930e8fd91cae3d60e0558d6a5e06299cd 100644 (file)
@@ -286,7 +286,7 @@ sub validip
 sub validmask {
        my $mask = shift;
 
-       return &Network::check_netmask($mask) or &Network::check_prefix($mask);
+       return &Network::check_netmask($mask) || &Network::check_prefix($mask);
 }
 
 sub validipormask
@@ -388,7 +388,9 @@ sub iporsubtocidr
 }
 
 sub getnetworkip {
-       return &Network::get_netaddress(shift);
+       my $arg = join("/", @_);
+
+       return &Network::get_netaddress($arg);
 }
 
 sub getccdbc
index c4a19e5d80caa17b6cc0dc68b612c8814da14c59..9b3f2bff43525e2d6a93c151354f006460705df8 100755 (executable)
@@ -217,7 +217,7 @@ sub get_std_net_ip
        }elsif($val eq 'BLUE'){
                return "$netsettings{'BLUE_NETADDRESS'}/$netsettings{'BLUE_NETMASK'}";
        }elsif($val eq 'RED'){
-               return "0.0.0.0/0 -o $con";
+               return "0.0.0.0/0";
        }elsif($val =~ /OpenVPN/i){
                return "$ovpnsettings{'DOVPN_SUBNET'}";
        }elsif($val =~ /IPsec/i){
@@ -226,6 +226,23 @@ sub get_std_net_ip
                return ;
        }
 }
+sub get_interface
+{
+       my $net=shift;
+       if($net eq "$netsettings{'GREEN_NETADDRESS'}/$netsettings{'GREEN_NETMASK'}"){
+               return "$netsettings{'GREEN_DEV'}";
+       }
+       if($net eq "$netsettings{'ORANGE_NETADDRESS'}/$netsettings{'ORANGE_NETMASK'}"){
+               return "$netsettings{'ORANGE_DEV'}";
+       }
+       if($net eq "$netsettings{'BLUE_NETADDRESS'}/$netsettings{'BLUE_NETMASK'}"){
+               return "$netsettings{'BLUE_DEV'}";
+       }
+       if($net eq "0.0.0.0/0"){
+               return "$netsettings{'RED_DEV'}";
+       }
+       return "";
+}
 sub get_net_ip
 {
        my $val=shift;
@@ -305,9 +322,9 @@ sub get_address
        # address. Otherwise, we assume that it is an IP address.
        if ($key ~~ ["src_addr", "tgt_addr"]) {
                if (&General::validmac($value)) {
-                       push(@ret, "-m mac --mac-source $value");
+                       push(@ret, ["-m mac --mac-source $value", ""]);
                } else {
-                       push(@ret, $value);
+                       push(@ret, [$value, ""]);
                }
 
        # If a default network interface (GREEN, BLUE, etc.) is selected, we
@@ -316,88 +333,90 @@ sub get_address
                my $external_interface = &get_external_interface();
 
                my $network_address = &get_std_net_ip($value, $external_interface);
+
                if ($network_address) {
-                       push(@ret, $network_address);
+                       my $interface = &get_interface($network_address);
+                       push(@ret, [$network_address, $interface]);
                }
 
        # Custom networks.
        } elsif ($key ~~ ["cust_net_src", "cust_net_tgt", "Custom Network"]) {
                my $network_address = &get_net_ip($value);
                if ($network_address) {
-                       push(@ret, $network_address);
+                       push(@ret, [$network_address, ""]);
                }
 
        # Custom hosts.
        } elsif ($key ~~ ["cust_host_src", "cust_host_tgt", "Custom Host"]) {
                my $host_address = &get_host_ip($value, $type);
                if ($host_address) {
-                       push(@ret, $host_address);
+                       push(@ret, [$host_address, ""]);
                }
 
        # OpenVPN networks.
        } elsif ($key ~~ ["ovpn_net_src", "ovpn_net_tgt", "OpenVPN static network"]) {
                my $network_address = &get_ovpn_net_ip($value, 1);
                if ($network_address) {
-                       push(@ret, $network_address);
+                       push(@ret, [$network_address, ""]);
                }
 
        # OpenVPN hosts.
        } elsif ($key ~~ ["ovpn_host_src", "ovpn_host_tgt", "OpenVPN static host"]) {
                my $host_address = &get_ovpn_host_ip($value, 33);
                if ($host_address) {
-                       push(@ret, $host_address);
+                       push(@ret, [$host_address, ""]);
                }
 
        # OpenVPN N2N.
        } elsif ($key ~~ ["ovpn_n2n_src", "ovpn_n2n_tgt", "OpenVPN N-2-N"]) {
                my $network_address = &get_ovpn_n2n_ip($value, 11);
                if ($network_address) {
-                       push(@ret, $network_address);
+                       push(@ret, [$network_address, ""]);
                }
 
        # IPsec networks.
        } elsif ($key ~~ ["ipsec_net_src", "ipsec_net_tgt", "IpSec Network"]) {
                my $network_address = &get_ipsec_net_ip($value, 11);
                if ($network_address) {
-                       push(@ret, $network_address);
+                       push(@ret, [$network_address, ""]);
                }
 
        # The firewall's own IP addresses.
        } elsif ($key ~~ ["ipfire", "ipfire_src"]) {
                # ALL
                if ($value eq "ALL") {
-                       push(@ret, "0/0");
+                       push(@ret, ["0/0", ""]);
 
                # GREEN
                } elsif ($value eq "GREEN") {
-                       push(@ret, $netsettings{"GREEN_ADDRESS"});
+                       push(@ret, [$netsettings{"GREEN_ADDRESS"}, ""]);
 
                # BLUE
                } elsif ($value eq "BLUE") {
-                       push(@ret, $netsettings{"BLUE_ADDRESS"});
+                       push(@ret, [$netsettings{"BLUE_ADDRESS"}, ""]);
 
                # ORANGE
                } elsif ($value eq "ORANGE") {
-                       push(@ret, $netsettings{"ORANGE_ADDRESS"});
+                       push(@ret, [$netsettings{"ORANGE_ADDRESS"}, ""]);
 
                # RED
                } elsif ($value ~~ ["RED", "RED1"]) {
                        my $address = &get_external_address();
                        if ($address) {
-                               push(@ret, $address);
+                               push(@ret, [$address, ""]);
                        }
 
                # Aliases
                } else {
                        my $alias = &get_alias($value);
                        if ($alias) {
-                               push(@ret, $alias);
+                               push(@ret, [$alias, ""]);
                        }
                }
 
        # If nothing was selected, we assume "any".
        } else {
-               push(@ret, "0/0");
+               push(@ret, ["0/0", ""]);
        }
 
        return @ret;
index b6b6b1cbfb80117e744fe509bafb898b982707be..40fb8dd2ac821f360b3f77c57624e09ce2893773 100755 (executable)
@@ -268,6 +268,33 @@ sub buildrules {
                        }
                }
 
+               # Concurrent connection limit
+               my @ratelimit_options = ();
+               if ($$hash{$key}[32] eq 'ON') {
+                       my $conn_limit = $$hash{$key}[33];
+
+                       if ($conn_limit ge 1) {
+                               push(@ratelimit_options, ("-m", "connlimit"));
+
+                               # Use the the entire source IP address
+                               push(@ratelimit_options, "--connlimit-saddr");
+                               push(@ratelimit_options, ("--connlimit-mask", "32"));
+
+                               # Apply the limit
+                               push(@ratelimit_options, ("--connlimit-upto", $conn_limit));
+                       }
+               }
+
+               # Ratelimit
+               if ($$hash{$key}[34] eq 'ON') {
+                       my $rate_limit = "$$hash{$key}[35]/$$hash{$key}[36]";
+
+                               if ($rate_limit) {
+                                       push(@ratelimit_options, ("-m", "limit"));
+                                       push(@ratelimit_options, ("--limit", $rate_limit));
+                               }
+               }
+
                # Check which protocols are used in this rule and so that we can
                # later group rules by protocols.
                my @protocols = &get_protocols($hash, $key);
@@ -295,22 +322,26 @@ sub buildrules {
                                next unless ($src);
 
                                # Sanitize source.
-                               my $source = $src;
+                               my $source = @$src[0];
                                if ($source ~~ @ANY_ADDRESSES) {
                                        $source = "";
                                }
 
+                               my $source_intf = @$src[1];
+
                                foreach my $dst (@destinations) {
                                        # Skip invalid rules.
                                        next unless (defined $dst);
                                        next if (!$dst || ($dst eq "none"));
 
                                        # Sanitize destination.
-                                       my $destination = $dst;
+                                       my $destination = @$dst[0];
                                        if ($destination ~~ @ANY_ADDRESSES) {
                                                $destination = "";
                                        }
 
+                                       my $destination_intf = @$dst[1];
+
                                        # Array with iptables arguments.
                                        my @options = ();
 
@@ -327,15 +358,26 @@ sub buildrules {
                                                push(@source_options, ("-s", $source));
                                        }
 
+                                       if ($source_intf) {
+                                               push(@source_options, ("-i", $source_intf));
+                                       }
+
                                        # Prepare destination options.
                                        my @destination_options = ();
                                        if ($destination) {
                                                push(@destination_options, ("-d", $destination));
                                        }
 
+                                       if ($destination_intf) {
+                                               push(@destination_options, ("-o", $destination_intf));
+                                       }
+
                                        # Add time constraint options.
                                        push(@options, @time_options);
 
+                                       # Add ratelimiting option
+                                       push(@options, @ratelimit_options);
+
                                        my $firewall_is_in_source_subnet = 1;
                                        if ($source) {
                                                $firewall_is_in_source_subnet = &firewall_is_in_subnet($source);
@@ -366,7 +408,7 @@ sub buildrules {
                                                        # Make port-forwardings useable from the internal networks.
                                                        my @internal_addresses = &fwlib::get_internal_firewall_ip_addresses(1);
                                                        unless ($nat_address ~~ @internal_addresses) {
-                                                               &add_dnat_mangle_rules($nat_address, @nat_options);
+                                                               &add_dnat_mangle_rules($nat_address, $source_intf, @nat_options);
                                                        }
 
                                                        push(@nat_options, @source_options);
@@ -687,6 +729,7 @@ sub get_dnat_target_port {
 
 sub add_dnat_mangle_rules {
        my $nat_address = shift;
+       my $interface = shift;
        my @options = @_;
 
        my $mark = 0;
@@ -697,6 +740,8 @@ sub add_dnat_mangle_rules {
                next unless (exists $defaultNetworks{$zone . "_NETADDRESS"});
                next unless (exists $defaultNetworks{$zone . "_NETMASK"});
 
+               next if ($interface && $interface ne $defaultNetworks{$zone . "_DEV"});
+
                my @mangle_options = @options;
 
                my $netaddress = $defaultNetworks{$zone . "_NETADDRESS"};
diff --git a/config/rootfiles/core/84/filelists/bash b/config/rootfiles/core/84/filelists/bash
new file mode 120000 (symlink)
index 0000000..de970cb
--- /dev/null
@@ -0,0 +1 @@
+../../../common/bash
\ No newline at end of file
diff --git a/config/rootfiles/core/84/filelists/dnsmasq b/config/rootfiles/core/84/filelists/dnsmasq
new file mode 120000 (symlink)
index 0000000..d469c74
--- /dev/null
@@ -0,0 +1 @@
+../../../common/dnsmasq
\ No newline at end of file
diff --git a/config/rootfiles/core/84/filelists/files b/config/rootfiles/core/84/filelists/files
new file mode 100644 (file)
index 0000000..6b0dcea
--- /dev/null
@@ -0,0 +1,7 @@
+etc/system-release
+etc/issue
+srv/web/ipfire/cgi-bin/firewall.cgi
+srv/web/ipfire/cgi-bin/fwhosts.cgi
+usr/lib/firewall/firewall-lib.pl
+usr/lib/firewall/rules.pl
+var/ipfire/langs
diff --git a/config/rootfiles/core/84/update.sh b/config/rootfiles/core/84/update.sh
new file mode 100644 (file)
index 0000000..1b83326
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/bash
+############################################################################
+#                                                                          #
+# This file is part of the IPFire Firewall.                                #
+#                                                                          #
+# IPFire is free software; you can redistribute it and/or modify           #
+# it under the terms of the GNU General Public License as published by     #
+# the Free Software Foundation; either version 3 of the License, or        #
+# (at your option) any later version.                                      #
+#                                                                          #
+# IPFire is distributed in the hope that it will be useful,                #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
+# GNU General Public License for more details.                             #
+#                                                                          #
+# You should have received a copy of the GNU General Public License        #
+# along with IPFire; if not, write to the Free Software                    #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
+#                                                                          #
+# Copyright (C) 2014 IPFire-Team <info@ipfire.org>.                        #
+#                                                                          #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+/usr/local/bin/backupctrl exclude >/dev/null 2>&1
+
+# Remove old core updates from pakfire cache to save space...
+core=84
+for (( i=1; i<=$core; i++ ))
+do
+       rm -f /var/cache/pakfire/core-upgrade-*-$i.ipfire
+done
+
+# Stop services
+/etc/init.d/dnsmasq stop
+
+# Remove old files
+
+# Extract files
+extract_files
+
+# Start services
+/etc/init.d/dnsmasq start
+
+# Update Language cache
+perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"
+
+sync
+
+# This update need a reboot...
+touch /var/run/need_reboot
+
+# Finish
+/etc/init.d/fireinfo start
+sendprofile
+
+# Don't report the exitcode last command
+exit 0
diff --git a/config/rootfiles/oldcore/82/exclude b/config/rootfiles/oldcore/82/exclude
new file mode 100644 (file)
index 0000000..18e9b4d
--- /dev/null
@@ -0,0 +1,20 @@
+boot/config.txt
+etc/collectd.custom
+etc/ipsec.conf
+etc/ipsec.secrets
+etc/ipsec.user.conf
+etc/ipsec.user.secrets
+etc/localtime
+etc/shadow
+etc/ssh/ssh_config
+etc/ssh/sshd_config
+etc/ssl/openssl.cnf
+etc/sudoers
+etc/sysconfig/firewall.local
+etc/sysconfig/rc.local
+etc/udev/rules.d/30-persistent-network.rules
+srv/web/ipfire/html/proxy.pac
+var/ipfire/ovpn
+var/log/cache
+var/state/dhcp/dhcpd.leases
+var/updatecache
diff --git a/config/rootfiles/oldcore/82/filelists/iputils b/config/rootfiles/oldcore/82/filelists/iputils
new file mode 120000 (symlink)
index 0000000..361c28f
--- /dev/null
@@ -0,0 +1 @@
+../../../common/iputils
\ No newline at end of file
diff --git a/config/rootfiles/oldcore/82/filelists/openssl-compat b/config/rootfiles/oldcore/82/filelists/openssl-compat
new file mode 120000 (symlink)
index 0000000..c9fa421
--- /dev/null
@@ -0,0 +1 @@
+../../../common/openssl-compat
\ No newline at end of file
diff --git a/config/rootfiles/oldcore/82/meta b/config/rootfiles/oldcore/82/meta
new file mode 100644 (file)
index 0000000..d547fa8
--- /dev/null
@@ -0,0 +1 @@
+DEPS=""
diff --git a/config/rootfiles/oldcore/83/exclude b/config/rootfiles/oldcore/83/exclude
new file mode 100644 (file)
index 0000000..18e9b4d
--- /dev/null
@@ -0,0 +1,20 @@
+boot/config.txt
+etc/collectd.custom
+etc/ipsec.conf
+etc/ipsec.secrets
+etc/ipsec.user.conf
+etc/ipsec.user.secrets
+etc/localtime
+etc/shadow
+etc/ssh/ssh_config
+etc/ssh/sshd_config
+etc/ssl/openssl.cnf
+etc/sudoers
+etc/sysconfig/firewall.local
+etc/sysconfig/rc.local
+etc/udev/rules.d/30-persistent-network.rules
+srv/web/ipfire/html/proxy.pac
+var/ipfire/ovpn
+var/log/cache
+var/state/dhcp/dhcpd.leases
+var/updatecache
diff --git a/config/rootfiles/oldcore/83/filelists/bash b/config/rootfiles/oldcore/83/filelists/bash
new file mode 120000 (symlink)
index 0000000..de970cb
--- /dev/null
@@ -0,0 +1 @@
+../../../common/bash
\ No newline at end of file
diff --git a/config/rootfiles/oldcore/83/filelists/files b/config/rootfiles/oldcore/83/filelists/files
new file mode 100644 (file)
index 0000000..5c0b6fe
--- /dev/null
@@ -0,0 +1,6 @@
+etc/system-release
+etc/issue
+srv/web/ipfire/cgi-bin/logs.cgi/ids.dat
+srv/web/ipfire/cgi-bin/proxy.cgi
+srv/web/ipfire/cgi-bin/urlfilter.cgi
+var/ipfire/general-functions.pl
diff --git a/config/rootfiles/oldcore/83/filelists/findutils b/config/rootfiles/oldcore/83/filelists/findutils
new file mode 120000 (symlink)
index 0000000..545280a
--- /dev/null
@@ -0,0 +1 @@
+../../../common/findutils
\ No newline at end of file
diff --git a/config/rootfiles/oldcore/83/filelists/squid b/config/rootfiles/oldcore/83/filelists/squid
new file mode 120000 (symlink)
index 0000000..2dc8372
--- /dev/null
@@ -0,0 +1 @@
+../../../common/squid
\ No newline at end of file
diff --git a/config/rootfiles/oldcore/83/meta b/config/rootfiles/oldcore/83/meta
new file mode 100644 (file)
index 0000000..d547fa8
--- /dev/null
@@ -0,0 +1 @@
+DEPS=""
diff --git a/config/rootfiles/oldcore/83/update.sh b/config/rootfiles/oldcore/83/update.sh
new file mode 100644 (file)
index 0000000..c766b42
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/bash
+############################################################################
+#                                                                          #
+# This file is part of the IPFire Firewall.                                #
+#                                                                          #
+# IPFire is free software; you can redistribute it and/or modify           #
+# it under the terms of the GNU General Public License as published by     #
+# the Free Software Foundation; either version 3 of the License, or        #
+# (at your option) any later version.                                      #
+#                                                                          #
+# IPFire is distributed in the hope that it will be useful,                #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of           #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
+# GNU General Public License for more details.                             #
+#                                                                          #
+# You should have received a copy of the GNU General Public License        #
+# along with IPFire; if not, write to the Free Software                    #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA #
+#                                                                          #
+# Copyright (C) 2014 IPFire-Team <info@ipfire.org>.                        #
+#                                                                          #
+############################################################################
+#
+. /opt/pakfire/lib/functions.sh
+/usr/local/bin/backupctrl exclude >/dev/null 2>&1
+
+# Remove old core updates from pakfire cache to save space...
+core=83
+for (( i=1; i<=$core; i++ ))
+do
+       rm -f /var/cache/pakfire/core-upgrade-*-$i.ipfire
+done
+
+# Stop services
+
+# Remove old files
+
+# Extract files
+extract_files
+
+# reload init because glibc/linker changed
+telinit -u
+
+# Start services
+
+# Update Language cache
+perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"
+
+sync
+
+# This update need a reboot...
+touch /var/run/need_reboot
+
+# Finish
+/etc/init.d/fireinfo start
+sendprofile
+
+# Don't report the exitcode last command
+exit 0
index c594d82429c82202cef77f1e5c8155e9b1dbe09b..642579a6e5c0ee6b5f8dad800abec7399f057106 100644 (file)
@@ -129,9 +129,9 @@ usr/lib/perl5/site_perl/5.12.3/PDF/API2/Resource/uniglyph.txt
 usr/lib/perl5/site_perl/5.12.3/PDF/API2/UniWrap.pm
 usr/lib/perl5/site_perl/5.12.3/PDF/API2/Util.pm
 usr/lib/perl5/site_perl/5.12.3/PDF/API2/Win32.pm
-#usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/auto/PDF
-#usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/auto/PDF/API2
-#usr/lib/perl5/site_perl/5.12.3/i586-linux-thread-multi/auto/PDF/API2/.packlist
+#usr/lib/perl5/site_perl/5.12.3/MACHINE-linux-thread-multi/auto/PDF
+#usr/lib/perl5/site_perl/5.12.3/MACHINE-linux-thread-multi/auto/PDF/API2
+#usr/lib/perl5/site_perl/5.12.3/MACHINE-linux-thread-multi/auto/PDF/API2/.packlist
 #usr/share/man/man3/PDF::API2.3
 #usr/share/man/man3/PDF::API2::Annotation.3
 #usr/share/man/man3/PDF::API2::Basic::PDF::Array.3
index 574812166f72a9a01654d5b066891e5a99a2bbcf..5318673117e43f46bca63dd1d78ee9db7ec4e6fd 100644 (file)
@@ -19,6 +19,7 @@ other usefull commands from the Dom0:
 - reset the fire: "xm destroy ipfire-xen"
 - look what is going on: "xm top" or "xm list"
 
-This script can also build a Citrix XenCenter xva image.
+This script can also build a Citrix XenCenter xva image. (Need xz-aware
+xen version. Tested with Citrix Xen Server 6.2.5 beta)
 - run "XEN_IMG_TYPE=xva sh xen-image-maker.sh" to build an xva image.
 - import the vm with "xe vm-import file=ipfire.xfa"
index e6ae5272a2c2f5f7bc382196c3c91bcaf631510e..badee6b3c02ac115f4d9eda0abc02ae928ebd896 100644 (file)
@@ -161,6 +161,22 @@ print<<END;
                        \$("#TIME_CONSTRAINTS").toggle();
                });
 
+               // Limit concurrent connections per ip
+               if(!\$("#USE_LIMIT_CONCURRENT_CONNECTIONS_PER_IP").attr("checked")) {
+                       \$("#LIMIT_CON").hide();
+               }
+               \$("#USE_LIMIT_CONCURRENT_CONNECTIONS_PER_IP").change(function() {
+                       \$("#LIMIT_CON").toggle();
+               });
+
+               // Rate-limit new connections
+               if(!\$("#USE_RATELIMIT").attr("checked")) {
+                       \$("#RATELIMIT").hide();
+               }
+               \$("#USE_RATELIMIT").change(function() {
+                       \$("#RATELIMIT").toggle();
+               });
+
                // Automatically select radio buttons when corresponding
                // dropdown menu changes.
                \$("select").change(function() {
@@ -222,8 +238,8 @@ if ($fwdfwsettings{'ACTION'} eq 'saverule')
                #check if we have an identical rule already
                if($fwdfwsettings{'oldrulenumber'} eq $fwdfwsettings{'rulepos'}){
                        foreach my $key (sort keys %configinputfw){
-                               if (   "$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'},$fwdfwsettings{'USE_NAT'},$fwdfwsettings{$fwdfwsettings{'nat'}},$fwdfwsettings{'dnatport'},$fwdfwsettings{'nat'}"
-                                       eq "$configinputfw{$key}[0],$configinputfw{$key}[2],$configinputfw{$key}[3],$configinputfw{$key}[4],$configinputfw{$key}[5],$configinputfw{$key}[6],$configinputfw{$key}[7],$configinputfw{$key}[8],$configinputfw{$key}[9],$configinputfw{$key}[10],$configinputfw{$key}[11],$configinputfw{$key}[12],$configinputfw{$key}[13],$configinputfw{$key}[14],$configinputfw{$key}[15],$configinputfw{$key}[17],$configinputfw{$key}[18],$configinputfw{$key}[19],$configinputfw{$key}[20],$configinputfw{$key}[21],$configinputfw{$key}[22],$configinputfw{$key}[23],$configinputfw{$key}[24],$configinputfw{$key}[25],$configinputfw{$key}[26],$configinputfw{$key}[27],$configinputfw{$key}[28],$configinputfw{$key}[29],$configinputfw{$key}[30],$configinputfw{$key}[31]"){
+                               if (   "$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'},$fwdfwsettings{'USE_NAT'},$fwdfwsettings{$fwdfwsettings{'nat'}},$fwdfwsettings{'dnatport'},$fwdfwsettings{'nat'},$fwdfwsettings{'LIMIT_CON_CON'},$fwdfwsettings{'concon'},$fwdfwsettings{'RATE_LIMIT'},$fwdfwsettings{'ratecon'},$fwdfwsettings{'RATETIME'}"
+                                       eq "$configinputfw{$key}[0],$configinputfw{$key}[2],$configinputfw{$key}[3],$configinputfw{$key}[4],$configinputfw{$key}[5],$configinputfw{$key}[6],$configinputfw{$key}[7],$configinputfw{$key}[8],$configinputfw{$key}[9],$configinputfw{$key}[10],$configinputfw{$key}[11],$configinputfw{$key}[12],$configinputfw{$key}[13],$configinputfw{$key}[14],$configinputfw{$key}[15],$configinputfw{$key}[17],$configinputfw{$key}[18],$configinputfw{$key}[19],$configinputfw{$key}[20],$configinputfw{$key}[21],$configinputfw{$key}[22],$configinputfw{$key}[23],$configinputfw{$key}[24],$configinputfw{$key}[25],$configinputfw{$key}[26],$configinputfw{$key}[27],$configinputfw{$key}[28],$configinputfw{$key}[29],$configinputfw{$key}[30],$configinputfw{$key}[31],$configinputfw{$key}[32],$configinputfw{$key}[33],$configinputfw{$key}[34],$configinputfw{$key}[35],$configinputfw{$key}[36]"){
                                                $errormessage.=$Lang::tr{'fwdfw err ruleexists'};
                                                if($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && $fwdfwsettings{'ruleremark'} ne '' && !&validremark($fwdfwsettings{'ruleremark'})){
                                                        $errormessage=$Lang::tr{'fwdfw err remark'}."<br>";
@@ -241,14 +257,14 @@ if ($fwdfwsettings{'ACTION'} eq 'saverule')
                if($fwdfwsettings{'rulepos'} > 0 && !$fwdfwsettings{'oldrulenumber'}){
                        $fwdfwsettings{'oldrulenumber'}=$maxkey;
                        foreach my $key (sort keys %configinputfw){
-                               if (   "$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'},$fwdfwsettings{'USE_NAT'},$fwdfwsettings{$fwdfwsettings{'nat'}},$fwdfwsettings{'dnatport'},$fwdfwsettings{'nat'}"
-                                       eq "$configinputfw{$key}[0],$configinputfw{$key}[2],$configinputfw{$key}[3],$configinputfw{$key}[4],$configinputfw{$key}[5],$configinputfw{$key}[6],$configinputfw{$key}[7],$configinputfw{$key}[8],$configinputfw{$key}[9],$configinputfw{$key}[10],$configinputfw{$key}[11],$configinputfw{$key}[12],$configinputfw{$key}[13],$configinputfw{$key}[14],$configinputfw{$key}[15],$configinputfw{$key}[17],$configinputfw{$key}[18],$configinputfw{$key}[19],$configinputfw{$key}[20],$configinputfw{$key}[21],$configinputfw{$key}[22],$configinputfw{$key}[23],$configinputfw{$key}[24],$configinputfw{$key}[25],$configinputfw{$key}[26],$configinputfw{$key}[27],$configinputfw{$key}[28],$configinputfw{$key}[29],$configinputfw{$key}[30],$configinputfw{$key}[31]"){
+                               if (   "$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'},$fwdfwsettings{'USE_NAT'},$fwdfwsettings{$fwdfwsettings{'nat'}},$fwdfwsettings{'dnatport'},$fwdfwsettings{'nat'},$fwdfwsettings{'LIMIT_CON_CON'},$fwdfwsettings{'concon'},$fwdfwsettings{'RATE_LIMIT'},$fwdfwsettings{'ratecon'},$fwdfwsettings{'RATETIME'}"
+                                       eq "$configinputfw{$key}[0],$configinputfw{$key}[2],$configinputfw{$key}[3],$configinputfw{$key}[4],$configinputfw{$key}[5],$configinputfw{$key}[6],$configinputfw{$key}[7],$configinputfw{$key}[8],$configinputfw{$key}[9],$configinputfw{$key}[10],$configinputfw{$key}[11],$configinputfw{$key}[12],$configinputfw{$key}[13],$configinputfw{$key}[14],$configinputfw{$key}[15],$configinputfw{$key}[17],$configinputfw{$key}[18],$configinputfw{$key}[19],$configinputfw{$key}[20],$configinputfw{$key}[21],$configinputfw{$key}[22],$configinputfw{$key}[23],$configinputfw{$key}[24],$configinputfw{$key}[25],$configinputfw{$key}[26],$configinputfw{$key}[27],$configinputfw{$key}[28],$configinputfw{$key}[29],$configinputfw{$key}[30],$configinputfw{$key}[31],$configinputfw{$key}[32],$configinputfw{$key}[33],$configinputfw{$key}[34],$configinputfw{$key}[35],$configinputfw{$key}[36]"){
                                                $errormessage.=$Lang::tr{'fwdfw err ruleexists'};
                                }
                        }
                }
                #check if we just close a rule
-               if( $fwdfwsettings{'oldgrp1a'} eq  $fwdfwsettings{'grp1'} && $fwdfwsettings{'oldgrp1b'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'oldgrp2a'} eq  $fwdfwsettings{'grp2'} && $fwdfwsettings{'oldgrp2b'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} &&  $fwdfwsettings{'oldgrp3a'} eq $fwdfwsettings{'grp3'} && $fwdfwsettings{'oldgrp3b'} eq  $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'oldruletype'} eq $fwdfwsettings{'chain'}) {
+               if( $fwdfwsettings{'oldgrp1a'} eq  $fwdfwsettings{'grp1'} && $fwdfwsettings{'oldgrp1b'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'oldgrp2a'} eq  $fwdfwsettings{'grp2'} && $fwdfwsettings{'oldgrp2b'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} &&  $fwdfwsettings{'oldgrp3a'} eq $fwdfwsettings{'grp3'} && $fwdfwsettings{'oldgrp3b'} eq  $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'oldruletype'} eq $fwdfwsettings{'chain'} ) {
                        if($fwdfwsettings{'nosave'} eq 'on' && $fwdfwsettings{'updatefwrule'} eq 'on'){
                                $errormessage='';
                                $fwdfwsettings{'nosave2'} = 'on';
@@ -266,8 +282,8 @@ if ($fwdfwsettings{'ACTION'} eq 'saverule')
                my $maxkey=&General::findhasharraykey(\%configoutgoingfw);
                if($fwdfwsettings{'oldrulenumber'} eq $fwdfwsettings{'rulepos'}){
                        foreach my $key (sort keys %configoutgoingfw){
-                               if (   "$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'},$fwdfwsettings{'USE_NAT'},$fwdfwsettings{$fwdfwsettings{'nat'}},$fwdfwsettings{'dnatport'},$fwdfwsettings{'nat'}"
-                                       eq "$configoutgoingfw{$key}[0],$configoutgoingfw{$key}[2],$configoutgoingfw{$key}[3],$configoutgoingfw{$key}[4],$configoutgoingfw{$key}[5],$configoutgoingfw{$key}[6],$configoutgoingfw{$key}[7],$configoutgoingfw{$key}[8],$configoutgoingfw{$key}[9],$configoutgoingfw{$key}[10],$configoutgoingfw{$key}[11],$configoutgoingfw{$key}[12],$configoutgoingfw{$key}[13],$configoutgoingfw{$key}[14],$configoutgoingfw{$key}[15],$configoutgoingfw{$key}[17],$configoutgoingfw{$key}[18],$configoutgoingfw{$key}[19],$configoutgoingfw{$key}[20],$configoutgoingfw{$key}[21],$configoutgoingfw{$key}[22],$configoutgoingfw{$key}[23],$configoutgoingfw{$key}[24],$configoutgoingfw{$key}[25],$configoutgoingfw{$key}[26],$configoutgoingfw{$key}[27],$configoutgoingfw{$key}[28],$configoutgoingfw{$key}[29],$configoutgoingfw{$key}[30],$configoutgoingfw{$key}[31]"){
+                               if (   "$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'},$fwdfwsettings{'USE_NAT'},$fwdfwsettings{$fwdfwsettings{'nat'}},$fwdfwsettings{'dnatport'},$fwdfwsettings{'nat'},$fwdfwsettings{'LIMIT_CON_CON'},$fwdfwsettings{'concon'},$fwdfwsettings{'RATE_LIMIT'},$fwdfwsettings{'ratecon'},$fwdfwsettings{'RATETIME'}"
+                                       eq "$configoutgoingfw{$key}[0],$configoutgoingfw{$key}[2],$configoutgoingfw{$key}[3],$configoutgoingfw{$key}[4],$configoutgoingfw{$key}[5],$configoutgoingfw{$key}[6],$configoutgoingfw{$key}[7],$configoutgoingfw{$key}[8],$configoutgoingfw{$key}[9],$configoutgoingfw{$key}[10],$configoutgoingfw{$key}[11],$configoutgoingfw{$key}[12],$configoutgoingfw{$key}[13],$configoutgoingfw{$key}[14],$configoutgoingfw{$key}[15],$configoutgoingfw{$key}[17],$configoutgoingfw{$key}[18],$configoutgoingfw{$key}[19],$configoutgoingfw{$key}[20],$configoutgoingfw{$key}[21],$configoutgoingfw{$key}[22],$configoutgoingfw{$key}[23],$configoutgoingfw{$key}[24],$configoutgoingfw{$key}[25],$configoutgoingfw{$key}[26],$configoutgoingfw{$key}[27],$configoutgoingfw{$key}[28],$configoutgoingfw{$key}[29],$configoutgoingfw{$key}[30],$configoutgoingfw{$key}[31],$configoutgoingfw{$key}[32],$configoutgoingfw{$key}[33],$configoutgoingfw{$key}[34],$configoutgoingfw{$key}[35],$configoutgoingfw{$key}[36]"){
                                                $errormessage.=$Lang::tr{'fwdfw err ruleexists'};
                                                if($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && $fwdfwsettings{'ruleremark'} ne '' && !&validremark($fwdfwsettings{'ruleremark'})){
                                                        $errormessage=$Lang::tr{'fwdfw err remark'}."<br>";
@@ -285,14 +301,14 @@ if ($fwdfwsettings{'ACTION'} eq 'saverule')
                if($fwdfwsettings{'rulepos'} > 0 && !$fwdfwsettings{'oldrulenumber'}){
                        $fwdfwsettings{'oldrulenumber'}=$maxkey;
                        foreach my $key (sort keys %configoutgoingfw){
-                               if (   "$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'},$fwdfwsettings{'USE_NAT'},$fwdfwsettings{$fwdfwsettings{'nat'}},$fwdfwsettings{'dnatport'},$fwdfwsettings{'nat'}"
-                                       eq "$configoutgoingfw{$key}[0],$configoutgoingfw{$key}[2],$configoutgoingfw{$key}[3],$configoutgoingfw{$key}[4],$configoutgoingfw{$key}[5],$configoutgoingfw{$key}[6],$configoutgoingfw{$key}[7],$configoutgoingfw{$key}[8],$configoutgoingfw{$key}[9],$configoutgoingfw{$key}[10],$configoutgoingfw{$key}[11],$configoutgoingfw{$key}[12],$configoutgoingfw{$key}[13],$configoutgoingfw{$key}[14],$configoutgoingfw{$key}[15],$configoutgoingfw{$key}[17],$configoutgoingfw{$key}[18],$configoutgoingfw{$key}[19],$configoutgoingfw{$key}[20],$configoutgoingfw{$key}[21],$configoutgoingfw{$key}[22],$configoutgoingfw{$key}[23],$configoutgoingfw{$key}[24],$configoutgoingfw{$key}[25],$configoutgoingfw{$key}[26],$configoutgoingfw{$key}[27],$configoutgoingfw{$key}[28],$configoutgoingfw{$key}[29],$configoutgoingfw{$key}[30],$configoutgoingfw{$key}[31]"){
+                               if (   "$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'LOG'},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'},$fwdfwsettings{'USE_NAT'},$fwdfwsettings{$fwdfwsettings{'nat'}},$fwdfwsettings{'dnatport'},$fwdfwsettings{'nat'},$fwdfwsettings{'LIMIT_CON_CON'},$fwdfwsettings{'concon'},$fwdfwsettings{'RATE_LIMIT'},$fwdfwsettings{'ratecon'},$fwdfwsettings{'RATETIME'}"
+                                       eq "$configoutgoingfw{$key}[0],$configoutgoingfw{$key}[2],$configoutgoingfw{$key}[3],$configoutgoingfw{$key}[4],$configoutgoingfw{$key}[5],$configoutgoingfw{$key}[6],$configoutgoingfw{$key}[7],$configoutgoingfw{$key}[8],$configoutgoingfw{$key}[9],$configoutgoingfw{$key}[10],$configoutgoingfw{$key}[11],$configoutgoingfw{$key}[12],$configoutgoingfw{$key}[13],$configoutgoingfw{$key}[14],$configoutgoingfw{$key}[15],$configoutgoingfw{$key}[17],$configoutgoingfw{$key}[18],$configoutgoingfw{$key}[19],$configoutgoingfw{$key}[20],$configoutgoingfw{$key}[21],$configoutgoingfw{$key}[22],$configoutgoingfw{$key}[23],$configoutgoingfw{$key}[24],$configoutgoingfw{$key}[25],$configoutgoingfw{$key}[26],$configoutgoingfw{$key}[27],$configoutgoingfw{$key}[28],$configoutgoingfw{$key}[29],$configoutgoingfw{$key}[30],$configoutgoingfw{$key}[31],$configoutgoingfw{$key}[32],$configoutgoingfw{$key}[33],$configoutgoingfw{$key}[34],$configoutgoingfw{$key}[35],$configoutgoingfw{$key}[36]"){
                                                $errormessage.=$Lang::tr{'fwdfw err ruleexists'};
                                }
                        }
                }
                #check if we just close a rule
-               if( $fwdfwsettings{'oldgrp1a'} eq  $fwdfwsettings{'grp1'} && $fwdfwsettings{'oldgrp1b'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'oldgrp2a'} eq  $fwdfwsettings{'grp2'} && $fwdfwsettings{'oldgrp2b'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} &&  $fwdfwsettings{'oldgrp3a'} eq $fwdfwsettings{'grp3'} && $fwdfwsettings{'oldgrp3b'} eq  $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'oldruletype'} eq $fwdfwsettings{'chain'}) {
+               if( $fwdfwsettings{'oldgrp1a'} eq  $fwdfwsettings{'grp1'} && $fwdfwsettings{'oldgrp1b'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'oldgrp2a'} eq  $fwdfwsettings{'grp2'} && $fwdfwsettings{'oldgrp2b'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} &&  $fwdfwsettings{'oldgrp3a'} eq $fwdfwsettings{'grp3'} && $fwdfwsettings{'oldgrp3b'} eq  $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'oldruletype'} eq $fwdfwsettings{'chain'} ) {
                        if($fwdfwsettings{'nosave'} eq 'on' && $fwdfwsettings{'updatefwrule'} eq 'on'){
                                $fwdfwsettings{'nosave2'} = 'on';
                                $errormessage='';
@@ -312,8 +328,8 @@ if ($fwdfwsettings{'ACTION'} eq 'saverule')
                if($fwdfwsettings{'oldrulenumber'} eq $fwdfwsettings{'rulepos'}){
                        #check if we have an identical rule already
                        foreach my $key (sort keys %configfwdfw){
-                               if (   "$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'},$fwdfwsettings{'USE_NAT'},$fwdfwsettings{$fwdfwsettings{'nat'}},$fwdfwsettings{'dnatport'},$fwdfwsettings{'nat'}"
-                                       eq "$configfwdfw{$key}[0],$configfwdfw{$key}[2],$configfwdfw{$key}[3],$configfwdfw{$key}[4],$configfwdfw{$key}[5],$configfwdfw{$key}[6],$configfwdfw{$key}[7],$configfwdfw{$key}[8],$configfwdfw{$key}[9],$configfwdfw{$key}[10],$configfwdfw{$key}[11],$configfwdfw{$key}[12],$configfwdfw{$key}[13],$configfwdfw{$key}[14],$configfwdfw{$key}[15],$configfwdfw{$key}[18],$configfwdfw{$key}[19],$configfwdfw{$key}[20],$configfwdfw{$key}[21],$configfwdfw{$key}[22],$configfwdfw{$key}[23],$configfwdfw{$key}[24],$configfwdfw{$key}[25],$configfwdfw{$key}[26],$configfwdfw{$key}[27],$configfwdfw{$key}[28],$configfwdfw{$key}[29],$configfwdfw{$key}[30],$configfwdfw{$key}[31]"){
+                               if (   "$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'},$fwdfwsettings{'USE_NAT'},$fwdfwsettings{$fwdfwsettings{'nat'}},$fwdfwsettings{'dnatport'},$fwdfwsettings{'nat'},$fwdfwsettings{'LIMIT_CON_CON'},$fwdfwsettings{'concon'},$fwdfwsettings{'RATE_LIMIT'},$fwdfwsettings{'ratecon'},$fwdfwsettings{'RATETIME'}"
+                                       eq "$configfwdfw{$key}[0],$configfwdfw{$key}[2],$configfwdfw{$key}[3],$configfwdfw{$key}[4],$configfwdfw{$key}[5],$configfwdfw{$key}[6],$configfwdfw{$key}[7],$configfwdfw{$key}[8],$configfwdfw{$key}[9],$configfwdfw{$key}[10],$configfwdfw{$key}[11],$configfwdfw{$key}[12],$configfwdfw{$key}[13],$configfwdfw{$key}[14],$configfwdfw{$key}[15],$configfwdfw{$key}[18],$configfwdfw{$key}[19],$configfwdfw{$key}[20],$configfwdfw{$key}[21],$configfwdfw{$key}[22],$configfwdfw{$key}[23],$configfwdfw{$key}[24],$configfwdfw{$key}[25],$configfwdfw{$key}[26],$configfwdfw{$key}[27],$configfwdfw{$key}[28],$configfwdfw{$key}[29],$configfwdfw{$key}[30],$configfwdfw{$key}[31],$configfwdfw{$key}[32],$configfwdfw{$key}[33],$configfwdfw{$key}[34],$configfwdfw{$key}[35],$configfwdfw{$key}[36]"){
                                                $errormessage.=$Lang::tr{'fwdfw err ruleexists'};
                                                if($fwdfwsettings{'oldruleremark'} ne $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'updatefwrule'} eq 'on' && $fwdfwsettings{'ruleremark'} ne '' && !&validremark($fwdfwsettings{'ruleremark'})){
                                                        $errormessage=$Lang::tr{'fwdfw err remark'}."<br>";
@@ -331,19 +347,35 @@ if ($fwdfwsettings{'ACTION'} eq 'saverule')
                if($fwdfwsettings{'rulepos'} > 0 && !$fwdfwsettings{'oldrulenumber'}){
                        $fwdfwsettings{'oldrulenumber'}=$maxkey;
                        foreach my $key (sort keys %configfwdfw){
-                               if (   "$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'},$fwdfwsettings{'USE_NAT'},$fwdfwsettings{$fwdfwsettings{'nat'}},$fwdfwsettings{'dnatport'},$fwdfwsettings{'nat'}"
-                                       eq "$configfwdfw{$key}[0],$configfwdfw{$key}[2],$configfwdfw{$key}[3],$configfwdfw{$key}[4],$configfwdfw{$key}[5],$configfwdfw{$key}[6],$configfwdfw{$key}[7],$configfwdfw{$key}[8],$configfwdfw{$key}[9],$configfwdfw{$key}[10],$configfwdfw{$key}[11],$configfwdfw{$key}[12],$configfwdfw{$key}[13],$configfwdfw{$key}[14],$configfwdfw{$key}[15],$configfwdfw{$key}[18],$configfwdfw{$key}[19],$configfwdfw{$key}[20],$configfwdfw{$key}[21],$configfwdfw{$key}[22],$configfwdfw{$key}[23],$configfwdfw{$key}[24],$configfwdfw{$key}[25],$configfwdfw{$key}[26],$configfwdfw{$key}[27],$configfwdfw{$key}[28],$configfwdfw{$key}[29],$configfwdfw{$key}[30],$configfwdfw{$key}[31]"){
+                               if (   "$fwdfwsettings{'RULE_ACTION'},$fwdfwsettings{'ACTIVE'},$fwdfwsettings{'grp1'},$fwdfwsettings{$fwdfwsettings{'grp1'}},$fwdfwsettings{'grp2'},$fwdfwsettings{$fwdfwsettings{'grp2'}},$fwdfwsettings{'USE_SRC_PORT'},$fwdfwsettings{'PROT'},$fwdfwsettings{'ICMP_TYPES'},$fwdfwsettings{'SRC_PORT'},$fwdfwsettings{'USESRV'},$fwdfwsettings{'TGT_PROT'},$fwdfwsettings{'ICMP_TGT'},$fwdfwsettings{'grp3'},$fwdfwsettings{$fwdfwsettings{'grp3'}},$fwdfwsettings{'TIME'},$fwdfwsettings{'TIME_MON'},$fwdfwsettings{'TIME_TUE'},$fwdfwsettings{'TIME_WED'},$fwdfwsettings{'TIME_THU'},$fwdfwsettings{'TIME_FRI'},$fwdfwsettings{'TIME_SAT'},$fwdfwsettings{'TIME_SUN'},$fwdfwsettings{'TIME_FROM'},$fwdfwsettings{'TIME_TO'},$fwdfwsettings{'USE_NAT'},$fwdfwsettings{$fwdfwsettings{'nat'}},$fwdfwsettings{'dnatport'},$fwdfwsettings{'nat'},$fwdfwsettings{'LIMIT_CON_CON'},$fwdfwsettings{'concon'},$fwdfwsettings{'RATE_LIMIT'},$fwdfwsettings{'ratecon'},$fwdfwsettings{'RATETIME'}"
+                                       eq "$configfwdfw{$key}[0],$configfwdfw{$key}[2],$configfwdfw{$key}[3],$configfwdfw{$key}[4],$configfwdfw{$key}[5],$configfwdfw{$key}[6],$configfwdfw{$key}[7],$configfwdfw{$key}[8],$configfwdfw{$key}[9],$configfwdfw{$key}[10],$configfwdfw{$key}[11],$configfwdfw{$key}[12],$configfwdfw{$key}[13],$configfwdfw{$key}[14],$configfwdfw{$key}[15],$configfwdfw{$key}[18],$configfwdfw{$key}[19],$configfwdfw{$key}[20],$configfwdfw{$key}[21],$configfwdfw{$key}[22],$configfwdfw{$key}[23],$configfwdfw{$key}[24],$configfwdfw{$key}[25],$configfwdfw{$key}[26],$configfwdfw{$key}[27],$configfwdfw{$key}[28],$configfwdfw{$key}[29],$configfwdfw{$key}[30],$configfwdfw{$key}[31],$configfwdfw{$key}[32],$configfwdfw{$key}[33],$configfwdfw{$key}[34],$configfwdfw{$key}[35],$configfwdfw{$key}[36]"){
                                                $errormessage.=$Lang::tr{'fwdfw err ruleexists'};
                                }
                        }
                }
                #check if we just close a rule
-               if( $fwdfwsettings{'oldgrp1a'} eq  $fwdfwsettings{'grp1'} && $fwdfwsettings{'oldgrp1b'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'oldgrp2a'} eq  $fwdfwsettings{'grp2'} && $fwdfwsettings{'oldgrp2b'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} &&  $fwdfwsettings{'oldgrp3a'} eq $fwdfwsettings{'grp3'} && $fwdfwsettings{'oldgrp3b'} eq  $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'oldruletype'} eq $fwdfwsettings{'chain'}) {
+               if( $fwdfwsettings{'oldgrp1a'} eq  $fwdfwsettings{'grp1'} && $fwdfwsettings{'oldgrp1b'} eq $fwdfwsettings{$fwdfwsettings{'grp1'}} && $fwdfwsettings{'oldgrp2a'} eq  $fwdfwsettings{'grp2'} && $fwdfwsettings{'oldgrp2b'} eq $fwdfwsettings{$fwdfwsettings{'grp2'}} &&  $fwdfwsettings{'oldgrp3a'} eq $fwdfwsettings{'grp3'} && $fwdfwsettings{'oldgrp3b'} eq  $fwdfwsettings{$fwdfwsettings{'grp3'}} && $fwdfwsettings{'oldusesrv'} eq $fwdfwsettings{'USESRV'} && $fwdfwsettings{'oldruleremark'} eq $fwdfwsettings{'ruleremark'} && $fwdfwsettings{'oldruletype'} eq $fwdfwsettings{'chain'}){
                        if($fwdfwsettings{'nosave'} eq 'on' && $fwdfwsettings{'updatefwrule'} eq 'on'){
                                $fwdfwsettings{'nosave2'} = 'on';
                                $errormessage='';
                        }
                }
+               #check max concurrent connections per ip address
+               if ($fwdfwsettings{'LIMIT_CON_CON'} eq 'ON'){
+                       if (!($fwdfwsettings{'concon'} =~ /^(\d+)$/)) {
+                               $errormessage.=$Lang::tr{'fwdfw err concon'};
+                       }
+               }else{
+                       $fwdfwsettings{'concon'}='';
+               }
+               #check ratelimit value
+               if ($fwdfwsettings{'RATE_LIMIT'} eq 'ON'){
+                       if (!($fwdfwsettings{'ratecon'} =~ /^(\d+)$/)) {
+                               $errormessage.=$Lang::tr{'fwdfw err ratecon'};
+                       }
+               }else{
+                       $fwdfwsettings{'ratecon'}='';
+               }
                #increase counters
                if (!$errormessage){
                        if ($fwdfwsettings{'nosave2'} ne 'on'){
@@ -1064,7 +1096,6 @@ print<<END;
 END
        foreach my $network (sort keys %defaultNetworks)
                {
-                       next if($defaultNetworks{$network}{'NAME'} eq "RED" && $srctgt eq 'src');
                        next if($defaultNetworks{$network}{'NAME'} eq "IPFire");
                        print "<option value='$defaultNetworks{$network}{'NAME'}'";
                        print " selected='selected'" if ($fwdfwsettings{$fwdfwsettings{$grp}} eq $defaultNetworks{$network}{'NAME'});
@@ -1517,6 +1548,11 @@ sub newrule
                                $fwdfwsettings{'nat'}                                   = $hash{$key}[31]; #changed order
                                $fwdfwsettings{$fwdfwsettings{'nat'}}   = $hash{$key}[29];
                                $fwdfwsettings{'dnatport'}                              = $hash{$key}[30];
+                               $fwdfwsettings{'LIMIT_CON_CON'}                 = $hash{$key}[32];
+                               $fwdfwsettings{'concon'}                                = $hash{$key}[33];
+                               $fwdfwsettings{'RATE_LIMIT'}                    = $hash{$key}[34];
+                               $fwdfwsettings{'ratecon'}                               = $hash{$key}[35];
+                               $fwdfwsettings{'RATETIME'}                              = $hash{$key}[36];
                                $checked{'grp1'}{$fwdfwsettings{'grp1'}}                                = 'CHECKED';
                                $checked{'grp2'}{$fwdfwsettings{'grp2'}}                                = 'CHECKED';
                                $checked{'grp3'}{$fwdfwsettings{'grp3'}}                                = 'CHECKED';
@@ -1534,12 +1570,15 @@ sub newrule
                                $checked{'TIME_SUN'}{$fwdfwsettings{'TIME_SUN'}}                = 'CHECKED';
                                $checked{'USE_NAT'}{$fwdfwsettings{'USE_NAT'}}                  = 'CHECKED';
                                $checked{'nat'}{$fwdfwsettings{'nat'}}                                  = 'CHECKED';
+                               $checked{'LIMIT_CON_CON'}{$fwdfwsettings{'LIMIT_CON_CON'}}      = 'CHECKED';
+                               $checked{'RATE_LIMIT'}{$fwdfwsettings{'RATE_LIMIT'}}    = 'CHECKED';
                                $selected{'TIME_FROM'}{$fwdfwsettings{'TIME_FROM'}}             = 'selected';
                                $selected{'TIME_TO'}{$fwdfwsettings{'TIME_TO'}}                 = 'selected';
                                $selected{'ipfire'}{$fwdfwsettings{$fwdfwsettings{'grp2'}}} ='selected';
                                $selected{'ipfire_src'}{$fwdfwsettings{$fwdfwsettings{'grp1'}}} ='selected';
                                $selected{'dnat'}{$fwdfwsettings{'dnat'}}                               ='selected';
                                $selected{'snat'}{$fwdfwsettings{'snat'}}                               ='selected';
+                               $selected{'RATETIME'}{$fwdfwsettings{'RATETIME'}}               ='selected';
                        }
                }
                $fwdfwsettings{'oldgrp1a'}=$fwdfwsettings{'grp1'};
@@ -1552,6 +1591,11 @@ sub newrule
                $fwdfwsettings{'oldruleremark'}=$fwdfwsettings{'ruleremark'};
                $fwdfwsettings{'oldnat'}=$fwdfwsettings{'USE_NAT'};
                $fwdfwsettings{'oldruletype'}=$fwdfwsettings{'chain'};
+               $fwdfwsettings{'oldconcon'}=$fwdfwsettings{'LIMIT_CON_CON'};
+               $fwdfwsettings{'olduseratelimit'}=$fwdfwsettings{'RATE_LIMIT'};
+               $fwdfwsettings{'olduseratelimitamount'}=$fwdfwsettings{'ratecon'};
+               $fwdfwsettings{'oldratelimittime'}=$fwdfwsettings{'RATETIME'};
+
                #check if manual ip (source) is orange network
                if ($fwdfwsettings{'grp1'} eq 'src_addr'){
                        my ($sip,$scidr) = split("/",$fwdfwsettings{$fwdfwsettings{'grp1'}});
@@ -1573,6 +1617,7 @@ sub newrule
                $fwdfwsettings{'oldusesrv'}=$fwdfwsettings{'USESRV'};
                $fwdfwsettings{'oldruleremark'}=$fwdfwsettings{'ruleremark'};
                $fwdfwsettings{'oldnat'}=$fwdfwsettings{'USE_NAT'};
+               $fwdfwsettings{'oldconcon'}=$fwdfwsettings{'LIMIT_CON_CON'};
                #check if manual ip (source) is orange network
                if ($fwdfwsettings{'grp1'} eq 'src_addr'){
                        my ($sip,$scidr) = split("/",$fwdfwsettings{$fwdfwsettings{'grp1'}});
@@ -2012,6 +2057,44 @@ END
                                        </table>
                                </td>
                        </tr>
+                       <tr>
+                               <td width='1%'>
+                                       <input type='checkbox' name='LIMIT_CON_CON' id="USE_LIMIT_CONCURRENT_CONNECTIONS_PER_IP" value='ON' $checked{'LIMIT_CON_CON'}{'ON'}>
+                               </td>
+                               <td>$Lang::tr{'fwdfw limitconcon'}</td>
+                       </tr>
+                       <tr id="LIMIT_CON">
+                               <td colspan='2'>
+                                       <table width='66%' border='0'>
+                                               <tr>
+                                                       <td width="20em">&nbsp;</td>
+                                                       <td>$Lang::tr{'fwdfw maxconcon'}: <input type='text' name='concon' size='2' value="$fwdfwsettings{'concon'}"></td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td width='1%'>
+                                       <input type='checkbox' name='RATE_LIMIT' id="USE_RATELIMIT" value='ON' $checked{'RATE_LIMIT'}{'ON'}>
+                               </td>
+                               <td>$Lang::tr{'fwdfw ratelimit'}</td>
+                       </tr>
+                       <tr id="RATELIMIT">
+                               <td colspan='2'>
+                                       <table width='66%' border='0'>
+                                               <tr>
+                                                       <td width="20em">&nbsp;</td>
+                                                       <td>$Lang::tr{'fwdfw numcon'}: <input type='text' name='ratecon' size='2' value="$fwdfwsettings{'ratecon'}"> /
+                                                               <select name='RATETIME' style='width:100px;'>
+                                                                       <option value='second' $selected{'RATETIME'}{'second'}>$Lang::tr{'age second'}</option>
+                                                                       <option value='minute' $selected{'RATETIME'}{'minute'}>$Lang::tr{'minute'}</option>
+                                                                       <option value='hour' $selected{'RATETIME'}{'hour'}>$Lang::tr{'hour'}</option>
+                                                               </select>
+                                                       </td>
+                                               </tr>
+                                       </table>
+                               </td>
+                       </tr>
                </table>
                <br>
 END
@@ -2044,6 +2127,7 @@ END
                        <input type='hidden' name='oldorange' value='$fwdfwsettings{'oldorange'}' />
                        <input type='hidden' name='oldnat' value='$fwdfwsettings{'oldnat'}' />
                        <input type='hidden' name='oldruletype' value='$fwdfwsettings{'oldruletype'}' />
+                       <input type='hidden' name='oldconcon' value='$fwdfwsettings{'oldconcon'}' />
                        <input type='hidden' name='ACTION' value='saverule' ></form><form method='post' style='display:inline'><input type='submit' value='$Lang::tr{'fwhost back'}' style='min-width:100px;'><input type='hidden' name='ACTION' value'reset'></td></td>
                        </table></form>
 END
@@ -2180,6 +2264,11 @@ sub saverule
                        $$hash{$key}[29] = $fwdfwsettings{$fwdfwsettings{'nat'}};
                        $$hash{$key}[30] = $fwdfwsettings{'dnatport'};
                        $$hash{$key}[31] = $fwdfwsettings{'nat'};
+                       $$hash{$key}[32] = $fwdfwsettings{'LIMIT_CON_CON'};
+                       $$hash{$key}[33] = $fwdfwsettings{'concon'};
+                       $$hash{$key}[34] = $fwdfwsettings{'RATE_LIMIT'};
+                       $$hash{$key}[35] = $fwdfwsettings{'ratecon'};
+                       $$hash{$key}[36] = $fwdfwsettings{'RATETIME'};
                        &General::writehasharray("$config", $hash);
                }else{
                        foreach my $key (sort {$a <=> $b} keys %$hash){
@@ -2216,6 +2305,11 @@ sub saverule
                                        $$hash{$key}[29] = $fwdfwsettings{$fwdfwsettings{'nat'}};
                                        $$hash{$key}[30] = $fwdfwsettings{'dnatport'};
                                        $$hash{$key}[31] = $fwdfwsettings{'nat'};
+                                       $$hash{$key}[32] = $fwdfwsettings{'LIMIT_CON_CON'};
+                                       $$hash{$key}[33] = $fwdfwsettings{'concon'};
+                                       $$hash{$key}[34] = $fwdfwsettings{'RATE_LIMIT'};
+                                       $$hash{$key}[35] = $fwdfwsettings{'ratecon'};
+                                       $$hash{$key}[36] = $fwdfwsettings{'RATETIME'};
                                        last;
                                }
                        }
index 1f96336a6b4d9b964b80572504aeacf5089c5cf3..c3642f0f0e9ca7838d9b8b766df55e3c3197b1c1 100644 (file)
@@ -291,42 +291,13 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' )
                        $errormessage=$errormessage.$Lang::tr{'fwhost err sub32'};
                }
                if($fwhostsettings{'error'} ne 'on'){
-                       #check if we use one of ipfire's networks (green,orange,blue)
-                       if (($ownnet{'GREEN_NETADDRESS'}        ne '' && $ownnet{'GREEN_NETADDRESS'}    ne '0.0.0.0') && ($fwhostsettings{'IP'} eq $ownnet{'GREEN_NETADDRESS'} && $fwhostsettings{'SUBNET'} eq $ownnet{'GREEN_NETMASK'}))
-                       { 
-                               $errormessage=$errormessage.$Lang::tr{'ccd err green'}."<br>";
-                               $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
-                               if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';}
-                       }
-                       if (($ownnet{'ORANGE_NETADDRESS'}       ne '' && $ownnet{'ORANGE_NETADDRESS'}   ne '0.0.0.0') && ($fwhostsettings{'IP'} eq $ownnet{'ORANGE_NETADDRESS'} && $fwhostsettings{'SUBNET'} eq $ownnet{'ORANGE_NETMASK'}))
-                       { 
-                               $errormessage=$errormessage.$Lang::tr{'ccd err orange'}."<br>";
-                               $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
-                               if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';}
-                       }
-                       if (($ownnet{'BLUE_NETADDRESS'}         ne '' && $ownnet{'BLUE_NETADDRESS'}     ne '0.0.0.0') && ($fwhostsettings{'IP'} eq $ownnet{'BLUE_NETADDRESS'} && $fwhostsettings{'SUBNET'} eq $ownnet{'BLUE_NETMASK'}))
-                       { 
-                               $errormessage=$errormessage.$Lang::tr{'ccd err blue'}."<br>";
-                               $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
-                               if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';}
-                       }
-                       if (($ownnet{'RED_NETADDRESS'}  ne '' && $ownnet{'RED_NETADDRESS'}              ne '0.0.0.0') && ($fwhostsettings{'IP'} eq $ownnet{'RED_NETADDRESS'} && $fwhostsettings{'SUBNET'} eq $ownnet{'RED_NETMASK'}))
-                       { 
-                               $errormessage=$errormessage.$Lang::tr{'ccd err red'}."<br>";
-                               $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
-                               if ($fwhostsettings{'update'} eq 'on'){$fwhostsettings{'ACTION'}='editnet';}
-                       }
+                               my $fullip="$fwhostsettings{'IP'}/".&General::iporsubtocidr($fwhostsettings{'SUBNET'});
+                               $errormessage=$errormessage.&General::checksubnets($fwhostsettings{'HOSTNAME'},$fullip,"");
                }
                #only check plausi when no error till now
                if (!$errormessage){
                        &plausicheck("editnet");
                }
-               #check if network ip is part of an already used one 
-               if(&checksubnet(\%customnetwork))
-               {
-                       $errormessage=$errormessage.$Lang::tr{'fwhost err partofnet'};
-                       $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
-               }                               
                if($fwhostsettings{'actualize'} eq 'on' && $fwhostsettings{'newnet'} ne 'on' && $errormessage)
                {
                        $fwhostsettings{'actualize'} = '';
@@ -338,9 +309,8 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' )
                        $customnetwork{$key}[3] = $fwhostsettings{'orgnetremark'};
                        &General::writehasharray("$confignet", \%customnetwork);
                        undef %customnetwork;
-               }                       
+               }
                if (!$errormessage){
-                       
                        &General::readhasharray("$confignet", \%customnetwork);
                        if ($fwhostsettings{'ACTION'} eq 'updatenet'){
                                if ($fwhostsettings{'update'} == '0'){
@@ -392,7 +362,7 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' )
                                                &General::writehasharray("$fwconfiginp", \%fwinp);
                                        }
                                }
-                       }                                       
+                       }
                        my $key = &General::findhasharraykey (\%customnetwork);
                        foreach my $i (0 .. 3) { $customnetwork{$key}[$i] = "";}
                        $fwhostsettings{'SUBNET'}       = &General::iporsubtocidr($fwhostsettings{'SUBNET'});
@@ -416,7 +386,8 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' )
                        }
                        &addnet;
                        &viewtablenet;
-               }else           {
+               }else{
+                       $fwhostsettings{'HOSTNAME'} = $fwhostsettings{'orgname'};
                        &addnet;
                        &viewtablenet;
                }
@@ -1644,7 +1615,10 @@ sub getcolor
                        $tdcolor="<font style='color: $Header::colourblue;'>$c</font>";
                        return $tdcolor;
                }
-
+               if ("$sip/$scidr" eq "0.0.0.0/0"){
+                       $tdcolor="<font style='color: $Header::colourred;'>$c</font>";
+                       return $tdcolor;
+               }
                #Check if IP is part of OpenVPN N2N subnet
                foreach my $key (sort keys %ccdhost){
                        if ($ccdhost{$key}[3] eq 'net'){
@@ -2501,6 +2475,9 @@ sub getipforgroup
                        &General::readhash("${General::swroot}/vpn/settings",\%hash);
                        return $hash{'RW_NET'};
                }
+               if ($name eq 'RED'){
+                       return "0.0.0.0/0";
+               }
        }
 }
 sub decrease
index 86207c2aa248dc355d6ce1378de7310ee7fa7d77..44b3abdac8c77bb64bed7051c56a95c1ed73cc63 100644 (file)
@@ -336,7 +336,7 @@ print <<END
 END
        ;
        if ($sid ne "n/a") {
-               print "<a href='http://www.snort.org/search/sid/$sid' ";
+               print "<a href='https://www.snort.org/rule_docs/$sid' ";
                print "target='_blank'>$sid</a></td>\n";
        } else {
                print $sid;
index 9f7e6ff8240356aba1322650c6f8b6076234d7db..78f7b321baede5d97aa12d126e39709e31298735 100644 (file)
@@ -935,7 +935,7 @@ if (($besettings{'ACTION'} eq $Lang::tr{'urlfilter install blacklist'}) && ($bes
                close FILE;
 
                system("rm -f $dbdir/$besettings{'BE_NAME'}/*.db");
-               system("/usr/sbin/squidGuard -c $editdir/install.conf -C all");
+               system("/usr/bin/squidGuard -c $editdir/install.conf -C all");
                system("chmod a+w $dbdir/$besettings{'BE_NAME'}/*.db");
 
                &readblockcategories;
index 6c46f70bfabdd99611b666a873431a9ba502a4f4..b7692ee7b7e659c8a5383eb221f20f6a46916635 100644 (file)
 'fwdfw dnat porterr' => 'Für NAT-Regeln muss ein einzelner Port oder Portbereich angegeben werden.',
 'fwdfw dnat porterr2' => 'Externer Port (NAT) darf nur angegeben werden, wenn ein Ziel-Port definiert ist.',
 'fwdfw edit' => 'Bearbeiten',
+'fwdfw err concon' => 'Ungültige Zahl für gleichzeitige Verbindungen',
 'fwdfw err nosrc' => 'Keine Quelle ausgewählt',
 'fwdfw err nosrcip' => 'Bitte Quell-IP-Adresse angeben',
 'fwdfw err notgt' => 'Kein Ziel ausgewählt',
 'fwdfw err notgtip' => 'Bitte Ziel-IP-Adresse angeben',
 'fwdfw err prot_port' => 'Bei dem gewählten Protokoll sind Quell- und Zielport nicht erlaubt',
 'fwdfw err prot_port1' => 'Bei Nutzung von Quell- oder Zielport muss als Protokoll TCP oder UDP gewählt werden.',
+'fwdfw err ratecon' => 'Ungültiger Wert bei Anzahl der Verbindungen für Ratenlimitierung',
 'fwdfw err remark' => 'Die Bemerkung enthält ungültige Zeichen',
 'fwdfw err ruleexists' => 'Eine identische Regel existiert bereits',
 'fwdfw err same' => 'Quelle und Ziel sind identisch',
 'fwdfw hint mac' => 'Sie nutzen MAC-Adressen in der Zielgruppe. Diese werden bei der Regelerstellung Ã¼bersprungen.',
 'fwdfw iface' => 'Interface',
 'fwdfw ipsec network' => 'IPsec-Netzwerke:',
+'fwdfw limitconcon' => 'Beschränke gleichzeitige Verbindungen je IP-Adresse',
 'fwdfw log' => 'Log',
 'fwdfw log rule' => 'Logging aktivieren',
 'fwdfw man port' => 'Port(s):',
 'fwdfw many' => 'Diverse',
+'fwdfw maxconcon' => 'Max. gleichzeitige Verbindungen',
 'fwdfw menu' => 'Firewall',
 'fwdfw movedown' => 'Herunter',
 'fwdfw moveup' => 'Herauf',
 'fwdfw natport used' => 'Der eingegebene Port wird bereits von einer anderen DNAT-Regel benutzt.',
 'fwdfw newrule' => 'Neue Regel erstellen',
+'fwdfw numcon' => 'Anzahl der Verbindungen',
 'fwdfw p2p txt' => 'P2P-Netzwerke erlauben/verbieten.',
 'fwdfw pol allow' => 'Zugelassen',
 'fwdfw pol block' => 'Blockiert',
 'fwdfw pol title' => 'Standardverhalten der Firewall',
 'fwdfw prot41' => 'IPv6 Encapsulation (Protokoll 41)',
 'fwdfw prot41 short' => 'IPv6 Encap',
+'fwdfw ratelimit' => 'Ratenlimitierung für neue Verbindungen',
 'fwdfw red' => 'ROT',
 'fwdfw reread' => 'Änderungen Ã¼bernehmen',
 'fwdfw rule action' => 'Regelaktion:',
 'fwhost err remark' => 'Ungültige Bemerkung. Erlaubte Zeichen: Klein- und Großbuchstaben, Bindestrich, Unterstrich, Runde Klammern, Semikolon, Punkt.',
 'fwhost err srv exists' => 'Ein Service mit diesem Namen existiert bereits',
 'fwhost err srvexist' => 'Dieser Dienst ist bereits in der Gruppe',
-'fwhost err sub32' => 'Bitte einen einzelnen Host hinzufügen, keine Netzwerke',
+'fwhost err sub32' => 'Bitte Netzwerke hinzufügen, keinen einzelnen Host',
 'fwhost green' => 'Grün',
 'fwhost hint' => 'Hinweis',
 'fwhost hosts' => 'Firewall-Hosts',
index b537868d2c6bf1f9d249f5693774529f0c4331b5..a15090a41810057140db1d97582e720e48a29426 100644 (file)
 'fwdfw dnat porterr' => 'You have to select a single port or portrange (tcp/udp) for NAT',
 'fwdfw dnat porterr2' => 'Cannot use external port (NAT) when no destination port is defined.',
 'fwdfw edit' => 'Edit',
+'fwdfw err concon' => 'Invalid number for concurrent connections',
 'fwdfw err nosrc' => 'No source selected.',
 'fwdfw err nosrcip' => 'Please provide a source IP address.',
 'fwdfw err notgt' => 'No destination selected.',
 'fwdfw err notgtip' => 'Please provide a destination IP address.',
 'fwdfw err prot_port' => 'Source- or targetport are not allowed with selected protocol',
 'fwdfw err prot_port1' => 'When using Source- or targetport you have to select TCP or UDP for protocol',
+'fwdfw err ratecon' => 'Invalid value for connections in Rate-limit',
 'fwdfw err remark' => 'Invalid characters in remark.',
 'fwdfw err ruleexists' => 'This rule already exists.',
 'fwdfw err same' => 'Source and destination are identical.',
 'fwdfw hint mac' => 'The destination group contains MAC addresses, which will be skipped during rule creation.',
 'fwdfw iface' => 'Interface',
 'fwdfw ipsec network' => 'IPsec networks:',
+'fwdfw limitconcon' => 'Limit concurrent connections per IP address',
 'fwdfw log' => 'Log',
 'fwdfw log rule' => 'Log rule',
 'fwdfw man port' => 'Port(s):',
 'fwdfw many' => 'Many',
+'fwdfw maxconcon' => 'Max. concurrent connections',
 'fwdfw menu' => 'Firewall',
 'fwdfw movedown' => 'Move down',
 'fwdfw moveup' => 'Move up',
 'fwdfw natport used' => 'The given port for NAPT is already in use by an other DNAT rule.',
 'fwdfw newrule' => 'New rule',
+'fwdfw numcon' => 'Number of connections',
 'fwdfw p2p txt' => 'Grant/deny access to P2P networks.',
 'fwdfw pol allow' => 'Allowed',
 'fwdfw pol block' => 'Blocked',
 'fwdfw pol title' => 'Default firewall behaviour',
 'fwdfw prot41' => 'IPv6 Encapsulation (Protocol 41)',
 'fwdfw prot41 short' => 'IPv6 Encap',
+'fwdfw ratelimit' => 'Rate-limit new connections',
 'fwdfw red' => 'RED',
 'fwdfw reread' => 'Apply changes',
 'fwdfw rule action' => 'Rule action:',
 'fwhost err remark' => 'Invalid remark. Allowed characters: Upper- and lowercase letters, digits, space, dash, braces, semicolon, pipe and dot.',
 'fwhost err srv exists' => 'A service with the same name already exists',
 'fwhost err srvexist' => 'This service already exists in the group',
-'fwhost err sub32' => 'Please add a single host, not a network.',
+'fwhost err sub32' => 'Please add a network, not a single host',
 'fwhost green' => 'Green',
 'fwhost hint' => 'Note',
 'fwhost hosts' => 'Firewall Hosts',
index c89ff545a99b6e1a6952f219b19abd8ffecbe4d6..55afd24ef2900fce7c1ce4dcf465edac715e6682 100644 (file)
--- a/lfs/bash
+++ b/lfs/bash
@@ -89,13 +89,14 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
 
-       for i in $$(seq 1 51); do \
+       for i in $$(seq 1 53); do \
                cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/bash/bash32-$$(printf "%03d" "$${i}") || exit 1; \
        done
 
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/bash-4.0-paths-1.patch
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/bash-4.0-profile-1.patch
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/bash-3.2-ssh_source_bash.patch
+
        cd $(DIR_APP) && ./configure $(EXTRA_CONFIG)
        cd $(DIR_APP) && make $(EXTRA_MAKE)
        cd $(DIR_APP) && make $(EXTRA_INSTALL) install
index 58b001755dbbc8d6175537ed94d9f8c4a266d8f7..60dabf4a53ce7ed16df026302dae3fd0b783afd8 100644 (file)
@@ -24,7 +24,7 @@
 
 include Config
 
-VER        = 2.71
+VER        = 2.72
 
 THISAPP    = dnsmasq-$(VER)
 DL_FILE    = $(THISAPP).tar.xz
@@ -42,7 +42,7 @@ objects = $(DL_FILE)
 
 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
 
-$(DL_FILE)_MD5 = 9e2e4d59c75e71ee3ca817ff0f9be69e
+$(DL_FILE)_MD5 = 0256e0a71e27c8d8a5c89a0d18f3cfe2
 
 install : $(TARGET)
 
@@ -72,9 +72,7 @@ $(subst %,%_MD5,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
-       cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dnsmasq-2.71-use-nettle-with-minigmp.patch
-       cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dnsmasq-2.71-support-nettle-3.0.patch
-       cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dnsmasq-2.70-Add-support-to-read-ISC-DHCP-lease-file.patch
+       cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dnsmasq-2.72rc2-Add-support-to-read-ISC-DHCP-lease-file.patch
        cd $(DIR_APP) && sed -i src/config.h \
                -e 's|/\* #define HAVE_IDN \*/|#define HAVE_IDN|g' \
                -e 's|/\* #define HAVE_DNSSEC \*/|#define HAVE_DNSSEC|g' \
index f0d8aba647caeda0d2d636c4ab7f7e84bb51954a..32c494f24388a06cbb18d45530f3372d148ca564 100644 (file)
--- a/lfs/glibc
+++ b/lfs/glibc
@@ -268,6 +268,12 @@ endif
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh966775.patch
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh966778.patch
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh970090.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh1008310.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh1022022.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh1091162.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh1098050.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh1133809-1.patch
+       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh1133809-2.patch
 
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc-resolv-stack_chk_fail.patch
        cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc-remove-ctors-dtors-output-sections.patch
index d2ae6a0e909d412a639d1d38157e710502591a1b..604ac1324432847b2e0425af3dfde7cb3c39dcfc 100644 (file)
@@ -1,7 +1,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2013  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2014  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -24,7 +24,7 @@
 
 include Config
 
-VER        = 0.9.8y
+VER        = 0.9.8zb
 
 THISAPP    = openssl-$(VER)
 DL_FILE    = $(THISAPP).tar.gz
@@ -40,7 +40,7 @@ objects = $(DL_FILE)
 
 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
 
-$(DL_FILE)_MD5 = 47c7fb37f78c970f1d30aa2f9e9e26d8
+$(DL_FILE)_MD5 = 65c5f42734f8ecd58990b12a9afa6453
 
 install : $(TARGET)
 
index 57c822cc2bc8e72b2f862a37e479224e2282b3c8..8899ec0ed47783d7437749687625b19d66b80d74 100644 (file)
--- a/lfs/rsync
+++ b/lfs/rsync
@@ -24,7 +24,7 @@
 
 include Config
 
-VER        = 3.1.0
+VER        = 3.1.1
 
 THISAPP    = rsync-$(VER)
 DL_FILE    = $(THISAPP).tar.gz
@@ -32,7 +32,7 @@ DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = rsync
-PAK_VER    = 8
+PAK_VER    = 9
 
 DEPS       = ""
 
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
 
 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
 
-$(DL_FILE)_MD5 = 3be148772a33224771a8d4d2a028b132
+$(DL_FILE)_MD5 = 43bd6676f0b404326eee2d63be3cdcfe
 
 install : $(TARGET)
 
index 4bd42cbb276a3b28c6993d9e6df2e2ae688bcf92..3772ad3028085043be106f52ee19ea3184343d69 100644 (file)
--- a/lfs/samba
+++ b/lfs/samba
@@ -32,7 +32,7 @@ DL_FROM    = $(URL_IPFIRE)
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = samba
-PAK_VER    = 58
+PAK_VER    = 59
 
 DEPS       = "cups krb5"
 
index 842b5484610ae9013a4275a0efd17a900084f9ce..39b9603b5ba51c59f12da06ba7a21b3a9de8530d 100644 (file)
--- a/lfs/sane
+++ b/lfs/sane
@@ -33,9 +33,9 @@ DIR_APP    = $(DIR_SRC)/sane-backends-$(VER)
 TARGET     = $(DIR_INFO)/$(THISAPP)
 
 PROG       = sane
-PAK_VER    = 3
+PAK_VER    = 4
 
-DEPS       = "libtiff"
+DEPS       = "cups libtiff"
 
 ###############################################################################
 # Top-level Rules
diff --git a/make.sh b/make.sh
index ce45d0d9ed21ff2e173ca1188e8dcd41d2572f57..23ef2b66e4cbd56ed7fbc0712360dd049d0999a9 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -25,8 +25,8 @@
 NAME="IPFire"                                                  # Software name
 SNAME="ipfire"                                                 # Short name
 VERSION="2.15"                                                 # Version number
-CORE="82"                                                      # Core Level (Filename)
-PAKFIRE_CORE="82"                                              # Core Level (PAKFIRE)
+CORE="84"                                                      # Core Level (Filename)
+PAKFIRE_CORE="83"                                              # Core Level (PAKFIRE)
 GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`                   # Git Branch
 SLOGAN="www.ipfire.org"                                                # Software slogan
 CONFIG_ROOT=/var/ipfire                                                # Configuration rootdir
diff --git a/src/patches/bash/bash32-052 b/src/patches/bash/bash32-052
new file mode 100644 (file)
index 0000000..78e7d92
--- /dev/null
@@ -0,0 +1,104 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release: 3.2
+Patch-ID: bash32-052
+
+Bug-Reported-by:       Stephane Chazelas <stephane.chazelas@gmail.com>
+Bug-Reference-ID:
+Bug-Reference-URL:
+
+Bug-Description:
+
+Under certain circumstances, bash will execute user code while processing the
+environment for exported function definitions.
+
+Patch (apply with `patch -p0'):
+
+*** ../bash-3.2.51/builtins/common.h   2006-03-06 09:38:44.000000000 -0500
+--- builtins/common.h  2014-09-16 19:08:02.000000000 -0400
+***************
+*** 34,37 ****
+--- 34,39 ----
+  
+  /* Flags for describe_command, shared between type.def and command.def */
++ #define SEVAL_FUNCDEF        0x080           /* only allow function definitions */
++ #define SEVAL_ONECMD 0x100           /* only allow a single command */
+  #define CDESC_ALL            0x001   /* type -a */
+  #define CDESC_SHORTDESC              0x002   /* command -V */
+*** ../bash-3.2.51/builtins/evalstring.c       2008-11-15 17:47:04.000000000 -0500
+--- builtins/evalstring.c      2014-09-16 19:08:02.000000000 -0400
+***************
+*** 235,238 ****
+--- 235,246 ----
+             struct fd_bitmap *bitmap;
+  
++            if ((flags & SEVAL_FUNCDEF) && command->type != cm_function_def)
++              {
++                internal_warning ("%s: ignoring function definition attempt", from_file);
++                should_jump_to_top_level = 0;
++                last_result = last_command_exit_value = EX_BADUSAGE;
++                break;
++              }
++ 
+             bitmap = new_fd_bitmap (FD_BITMAP_SIZE);
+             begin_unwind_frame ("pe_dispose");
+***************
+*** 292,295 ****
+--- 300,306 ----
+             dispose_fd_bitmap (bitmap);
+             discard_unwind_frame ("pe_dispose");
++ 
++            if (flags & SEVAL_ONECMD)
++              break;
+           }
+       }
+*** ../bash-3.2.51/variables.c 2008-11-15 17:15:06.000000000 -0500
+--- variables.c        2014-09-16 19:10:39.000000000 -0400
+***************
+*** 319,328 ****
+         strcpy (temp_string + char_index + 1, string);
+  
+!        parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST);
+! 
+!        /* Ancient backwards compatibility.  Old versions of bash exported
+!           functions like name()=() {...} */
+!        if (name[char_index - 1] == ')' && name[char_index - 2] == '(')
+!          name[char_index - 2] = '\0';
+  
+         if (temp_var = find_function (name))
+--- 319,326 ----
+         strcpy (temp_string + char_index + 1, string);
+  
+!        /* Don't import function names that are invalid identifiers from the
+!           environment. */
+!        if (legal_identifier (name))
+!          parse_and_execute (temp_string, name, SEVAL_NONINT|SEVAL_NOHIST|SEVAL_FUNCDEF|SEVAL_ONECMD);
+  
+         if (temp_var = find_function (name))
+***************
+*** 333,340 ****
+         else
+           report_error (_("error importing function definition for `%s'"), name);
+- 
+-        /* ( */
+-        if (name[char_index - 1] == ')' && name[char_index - 2] == '\0')
+-          name[char_index - 2] = '(';         /* ) */
+       }
+  #if defined (ARRAY_VARS)
+--- 331,334 ----
+*** ../bash-3.2/patchlevel.h   Thu Apr 13 08:31:04 2006
+--- patchlevel.h       Mon Oct 16 14:22:54 2006
+***************
+*** 26,30 ****
+     looks for to find the patch level (for the sccs version string). */
+  
+! #define PATCHLEVEL 51
+  
+  #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+     looks for to find the patch level (for the sccs version string). */
+  
+! #define PATCHLEVEL 52
+  
+  #endif /* _PATCHLEVEL_H_ */
diff --git a/src/patches/bash/bash32-053 b/src/patches/bash/bash32-053
new file mode 100644 (file)
index 0000000..e7efce7
--- /dev/null
@@ -0,0 +1,54 @@
+                            BASH PATCH REPORT
+                            =================
+
+Bash-Release: 3.2
+Patch-ID: bash32-053
+
+Bug-Reported-by:       Tavis Ormandy <taviso () cmpxchg8b com>
+Bug-Reference-ID:
+Bug-Reference-URL:     http://twitter.com/taviso/statuses/514887394294652929
+
+Bug-Description:
+
+Under certain circumstances, bash can incorrectly save a lookahead character and
+return it on a subsequent call, even when reading a new line.
+
+Patch:
+
+*** ../bash-3.2.52/parse.y     2008-04-29 21:24:55.000000000 -0400
+--- parse.y    2014-09-25 16:18:41.000000000 -0400
+***************
+*** 2504,2507 ****
+--- 2504,2509 ----
+    word_desc_to_read = (WORD_DESC *)NULL;
+  
++   eol_ungetc_lookahead = 0;
++ 
+    last_read_token = '\n';
+    token_to_read = '\n';
+*** ../bash-3.2.52/y.tab.c     2006-09-25 08:15:16.000000000 -0400
+--- y.tab.c    2014-09-25 20:28:17.000000000 -0400
+***************
+*** 3833,3836 ****
+--- 3833,3838 ----
+    word_desc_to_read = (WORD_DESC *)NULL;
+  
++   eol_ungetc_lookahead = 0;
++ 
+    last_read_token = '\n';
+    token_to_read = '\n';
+*** ../bash-3.2/patchlevel.h   Thu Apr 13 08:31:04 2006
+--- patchlevel.h       Mon Oct 16 14:22:54 2006
+***************
+*** 26,30 ****
+     looks for to find the patch level (for the sccs version string). */
+  
+! #define PATCHLEVEL 52
+  
+  #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+     looks for to find the patch level (for the sccs version string). */
+  
+! #define PATCHLEVEL 53
+  
+  #endif /* _PATCHLEVEL_H_ */
diff --git a/src/patches/dnsmasq-2.71-support-nettle-3.0.patch b/src/patches/dnsmasq-2.71-support-nettle-3.0.patch
deleted file mode 100644 (file)
index 593a7cd..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-From cdb755c5f16a6768c3e8b1f345fe15fc9244228d Mon Sep 17 00:00:00 2001
-From: Simon Kelley <simon@thekelleys.org.uk>
-Date: Wed, 18 Jun 2014 20:52:53 +0100
-Subject: [PATCH] Fix FTBFS with Nettle-3.0.
-
----
- CHANGELOG    |    3 +++
- src/dnssec.c |   18 ++++++++++++------
- 2 files changed, 15 insertions(+), 6 deletions(-)
-
-diff --git a/src/dnssec.c b/src/dnssec.c
-index 2ffb75d..69bfc29 100644
---- a/src/dnssec.c
-+++ b/src/dnssec.c
-@@ -28,6 +28,12 @@
- #include <nettle/nettle-meta.h>
- #include <nettle/bignum.h>
-+/* Nettle-3.0 moved to a new API for DSA. We use a name that's defined in the new API
-+   to detect Nettle-3, and invoke the backwards compatibility mode. */
-+#ifdef dsa_params_init
-+#include <nettle/dsa-compat.h>
-+#endif
-+
- #define SERIAL_UNDEF  -100
- #define SERIAL_EQ        0
-@@ -121,8 +127,8 @@ static int hash_init(const struct nettle_hash *hash, void **ctxp, unsigned char
-   return 1;
- }
-   
--static int rsa_verify(struct blockdata *key_data, unsigned int key_len, unsigned char *sig, size_t sig_len,
--                    unsigned char *digest, int algo)
-+static int dnsmasq_rsa_verify(struct blockdata *key_data, unsigned int key_len, unsigned char *sig, size_t sig_len,
-+                            unsigned char *digest, int algo)
- {
-   unsigned char *p;
-   size_t exp_len;
-@@ -173,8 +179,8 @@ static int rsa_verify(struct blockdata *key_data, unsigned int key_len, unsigned
-   return 0;
- }  
--static int dsa_verify(struct blockdata *key_data, unsigned int key_len, unsigned char *sig, size_t sig_len,
--                    unsigned char *digest, int algo)
-+static int dnsmasq_dsa_verify(struct blockdata *key_data, unsigned int key_len, unsigned char *sig, size_t sig_len,
-+                            unsigned char *digest, int algo)
- {
-   unsigned char *p;
-   unsigned int t;
-@@ -293,10 +299,10 @@ static int verify(struct blockdata *key_data, unsigned int key_len, unsigned cha
-   switch (algo)
-     {
-     case 1: case 5: case 7: case 8: case 10:
--      return rsa_verify(key_data, key_len, sig, sig_len, digest, algo);
-+      return dnsmasq_rsa_verify(key_data, key_len, sig, sig_len, digest, algo);
-       
-     case 3: case 6: 
--      return dsa_verify(key_data, key_len, sig, sig_len, digest, algo);
-+      return dnsmasq_dsa_verify(key_data, key_len, sig, sig_len, digest, algo);
-  
- #ifndef NO_NETTLE_ECC   
-     case 13: case 14:
--- 
-1.7.10.4
-
diff --git a/src/patches/dnsmasq-2.71-use-nettle-with-minigmp.patch b/src/patches/dnsmasq-2.71-use-nettle-with-minigmp.patch
deleted file mode 100644 (file)
index 374c9ec..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-From 063efb330a3f341c2548e2cf1f67f83e49cd6395 Mon Sep 17 00:00:00 2001
-From: Simon Kelley <simon@thekelleys.org.uk>
-Date: Tue, 17 Jun 2014 19:49:31 +0100
-Subject: [PATCH] Build config: add -DNO_GMP for use with nettle/mini-gmp
-
----
- Makefile        |    2 +-
- bld/pkg-wrapper |    9 +++++++--
- src/config.h    |    7 +++++++
- src/dnssec.c    |    3 ++-
- 4 files changed, 17 insertions(+), 4 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index c58b50b..17eeb27 100644
---- a/Makefile
-+++ b/Makefile
-@@ -61,7 +61,7 @@ lua_cflags =    `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CON
- lua_libs =      `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --libs lua5.1` 
- nettle_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC $(PKG_CONFIG) --cflags nettle hogweed`
- nettle_libs =   `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC $(PKG_CONFIG) --libs nettle hogweed`
--gmp_libs =      `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC $(PKG_CONFIG) --copy -lgmp`
-+gmp_libs =      `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC NO_GMP --copy -lgmp`
- sunos_libs =    `if uname | grep SunOS >/dev/null 2>&1; then echo -lsocket -lnsl -lposix4; fi`
- version =     -DVERSION='\"`$(top)/bld/get-version $(top)`\"'
-diff --git a/bld/pkg-wrapper b/bld/pkg-wrapper
-index 9f9332d..0ddb678 100755
---- a/bld/pkg-wrapper
-+++ b/bld/pkg-wrapper
-@@ -11,9 +11,14 @@ in=`cat`
- if grep "^\#[[:space:]]*define[[:space:]]*$search" config.h >/dev/null 2>&1 || \
-     echo $in | grep $search >/dev/null 2>&1; then
--
-+# Nasty, nasty, in --copy, arg 2 is another config to search for, use with NO_GMP
-     if [ $op = "--copy" ]; then
--      pkg="$*"
-+      if grep "^\#[[:space:]]*define[[:space:]]*$pkg" config.h >/dev/null 2>&1 || \
-+            echo $in | grep $pkg >/dev/null 2>&1; then
-+          pkg=""
-+      else 
-+          pkg="$*"
-+      fi
-     elif grep "^\#[[:space:]]*define[[:space:]]*${search}_STATIC" config.h >/dev/null 2>&1 || \
-             echo $in | grep ${search}_STATIC >/dev/null 2>&1; then
-       pkg=`$pkg  --static $op $*`
-diff --git a/src/config.h b/src/config.h
-index 2155544..ee6d218 100644
---- a/src/config.h
-+++ b/src/config.h
-@@ -105,6 +105,8 @@ HAVE_AUTH
-    define this to include the facility to act as an authoritative DNS
-    server for one or more zones.
-+HAVE_DNSSEC
-+   include DNSSEC validator.
- NO_IPV6
- NO_TFTP
-@@ -118,6 +120,11 @@ NO_AUTH
-    which are enabled  by default in the distributed source tree. Building dnsmasq
-    with something like "make COPTS=-DNO_SCRIPT" will do the trick.
-+NO_NETTLE_ECC
-+   Don't include the ECDSA cypher in DNSSEC validation. Needed for older Nettle versions.
-+NO_GMP
-+   Don't use and link against libgmp, Useful if nettle is built with --enable-mini-gmp.
-+
- LEASEFILE
- CONFFILE
- RESOLVFILE
-diff --git a/src/dnssec.c b/src/dnssec.c
-index 44d626b..2ffb75d 100644
---- a/src/dnssec.c
-+++ b/src/dnssec.c
-@@ -26,7 +26,8 @@
- #  include <nettle/ecc-curve.h>
- #endif
- #include <nettle/nettle-meta.h>
--#include <gmp.h>
-+#include <nettle/bignum.h>
-+
- #define SERIAL_UNDEF  -100
- #define SERIAL_EQ        0
--- 
-1.7.10.4
-
similarity index 94%
rename from src/patches/dnsmasq-2.70-Add-support-to-read-ISC-DHCP-lease-file.patch
rename to src/patches/dnsmasq-2.72rc2-Add-support-to-read-ISC-DHCP-lease-file.patch
index 3194e1f2298cc8d467c3c8d2c6592784cae8f111..9912c7ca93161bc83cfced0e435480adf48fc472 100644 (file)
@@ -1,18 +1,18 @@
 diff --git a/Makefile b/Makefile
-index 292c8bd..5e0cdbe 100644
+index 58a7975..616c6b7 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -69,7 +69,7 @@ objs = cache.o rfc1035.o util.o option.o forward.o network.o \
         dnsmasq.o dhcp.o lease.o rfc2131.o netlink.o dbus.o bpf.o \
         helper.o tftp.o log.o conntrack.o dhcp6.o rfc3315.o \
         dhcp-common.o outpacket.o radv.o slaac.o auth.o ipset.o \
--       domain.o dnssec.o blockdata.o
-+       domain.o dnssec.o blockdata.o isc.o
+-       domain.o dnssec.o blockdata.o tables.o loop.o
++       domain.o dnssec.o blockdata.o tables.o loop.o isc.o
  
  hdrs = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \
         dns-protocol.h radv-protocol.h ip6addr.h
 diff --git a/src/cache.c b/src/cache.c
-index 5cec918..1f5657f 100644
+index 2c3a498..77a7046 100644
 --- a/src/cache.c
 +++ b/src/cache.c
 @@ -17,7 +17,7 @@
@@ -65,10 +65,10 @@ index 5cec918..1f5657f 100644
        cache_hash(crec);
  
 diff --git a/src/dnsmasq.c b/src/dnsmasq.c
-index 1c96a0e..156ac9a 100644
+index f4a89fc..a448ec4 100644
 --- a/src/dnsmasq.c
 +++ b/src/dnsmasq.c
-@@ -934,6 +934,11 @@ int main (int argc, char **argv)
+@@ -940,6 +940,11 @@ int main (int argc, char **argv)
  
          poll_resolv(0, daemon->last_resolv != 0, now);          
          daemon->last_resolv = now;
@@ -81,18 +81,24 @@ index 1c96a0e..156ac9a 100644
        
        if (FD_ISSET(piperead, &rset))
 diff --git a/src/dnsmasq.h b/src/dnsmasq.h
-index 3032546..a40b2a9 100644
+index e74b15a..4a35168 100644
 --- a/src/dnsmasq.h
 +++ b/src/dnsmasq.h
-@@ -1447,3 +1447,8 @@ void slaac_add_addrs(struct dhcp_lease *lease, time_t now, int force);
- time_t periodic_slaac(time_t now, struct dhcp_lease *leases);
+@@ -1463,9 +1463,13 @@ time_t periodic_slaac(time_t now, struct dhcp_lease *leases);
  void slaac_ping_reply(struct in6_addr *sender, unsigned char *packet, char *interface, struct dhcp_lease *leases);
  #endif
-+
 +/* isc.c */
 +#ifdef HAVE_ISC_READER
 +void load_dhcp(time_t now);
 +#endif
++
+ /* loop.c */
+ #ifdef HAVE_LOOP
+ void loop_send_probes();
+ int detect_loop(char *query, int type);
+ #endif
+-
 diff --git a/src/isc.c b/src/isc.c
 new file mode 100644
 index 0000000..5106442
@@ -351,10 +357,10 @@ index 0000000..5106442
 +
 +#endif
 diff --git a/src/option.c b/src/option.c
-index daa728f..d16c982 100644
+index 45d8875..29c9ee5 100644
 --- a/src/option.c
 +++ b/src/option.c
-@@ -1642,7 +1642,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
+@@ -1669,7 +1669,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
        ret_err(_("bad MX target"));
        break;
  
diff --git a/src/patches/glibc/glibc-rh1008310.patch b/src/patches/glibc/glibc-rh1008310.patch
new file mode 100644 (file)
index 0000000..3658a9f
--- /dev/null
@@ -0,0 +1,45 @@
+diff -Nrup a/malloc/malloc.c b/malloc/malloc.c
+--- a/malloc/malloc.c  2013-09-23 17:08:33.698331221 -0400
++++ b/malloc/malloc.c  2013-09-23 21:04:25.901270645 -0400
+@@ -3879,6 +3879,13 @@ public_mEMALIGn(size_t alignment, size_t
+   /* Otherwise, ensure that it is at least a minimum chunk size */
+   if (alignment <  MINSIZE) alignment = MINSIZE;
++  /* Check for overflow.  */
++  if (bytes > SIZE_MAX - alignment - MINSIZE)
++    {
++      __set_errno (ENOMEM);
++      return 0;
++    }
++
+   arena_get(ar_ptr, bytes + alignment + MINSIZE);
+   if(!ar_ptr)
+     return 0;
+@@ -3924,6 +3931,13 @@ public_vALLOc(size_t bytes)
+   size_t pagesz = mp_.pagesize;
++  /* Check for overflow.  */
++  if (bytes > SIZE_MAX - pagesz - MINSIZE)
++    {
++      __set_errno (ENOMEM);
++      return 0;
++    }
++
+   __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
+                                       __const __malloc_ptr_t)) =
+     force_reg (__memalign_hook);
+@@ -3975,6 +3989,13 @@ public_pVALLOc(size_t bytes)
+   size_t page_mask = mp_.pagesize - 1;
+   size_t rounded_bytes = (bytes + page_mask) & ~(page_mask);
++  /* Check for overflow.  */
++  if (bytes > SIZE_MAX - 2*pagesz - MINSIZE)
++    {
++      __set_errno (ENOMEM);
++      return 0;
++    }
++
+   __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
+                                       __const __malloc_ptr_t)) =
+     force_reg (__memalign_hook);
diff --git a/src/patches/glibc/glibc-rh1022022.patch b/src/patches/glibc/glibc-rh1022022.patch
new file mode 100644 (file)
index 0000000..6d23bb1
--- /dev/null
@@ -0,0 +1,20 @@
+diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
+index 81e928a..05883bd 100644
+--- a/sysdeps/posix/getaddrinfo.c
++++ b/sysdeps/posix/getaddrinfo.c
+@@ -832,8 +832,13 @@ gaih_inet (const char *name, const struct gaih_service *service,
+         while (!no_more)
+           {
+             no_data = 0;
+-            nss_gethostbyname4_r fct4
+-              = __nss_lookup_function (nip, "gethostbyname4_r");
++            nss_gethostbyname4_r fct4 = NULL;
++
++            /* gethostbyname4_r sends out parallel A and AAAA queries and
++               is thus only suitable for PF_UNSPEC.  */
++            if (req->ai_family == PF_UNSPEC)
++              fct4 = __nss_lookup_function (nip, "gethostbyname4_r");
++
+             if (fct4 != NULL)
+               {
+                 int herrno;
diff --git a/src/patches/glibc/glibc-rh1091162.patch b/src/patches/glibc/glibc-rh1091162.patch
new file mode 100644 (file)
index 0000000..7825682
--- /dev/null
@@ -0,0 +1,58 @@
+commit 362b47fe09ca9a928d444c7e2f7992f7f61bfc3e
+Author: Maxim Kuvyrkov <maxim@kugelworks.com>
+Date:   Tue Dec 24 09:44:50 2013 +1300
+
+    Fix race in free() of fastbin chunk: BZ #15073
+    
+    Perform sanity check only if we have_lock.  Due to lockless nature of fastbins
+    we need to be careful derefencing pointers to fastbin entries (chunksize(old)
+    in this case) in multithreaded environments.
+    
+    The fix is to add have_lock to the if-condition checks.  The rest of the patch
+    only makes code more readable.
+    
+       * malloc/malloc.c (_int_free): Perform sanity check only if we
+       have_lock.
+
+diff --git a/malloc/malloc.c b/malloc/malloc.c
+index b1668b5..5e419ad 100644
+--- a/malloc/malloc.c
++++ b/malloc/malloc.c
+@@ -3783,25 +3783,29 @@ _int_free(mstate av, mchunkptr p, int have_lock)
+     fb = &fastbin (av, idx);
+ #ifdef ATOMIC_FASTBINS
+-    mchunkptr fd;
+-    mchunkptr old = *fb;
++    /* Atomically link P to its fastbin: P->FD = *FB; *FB = P;  */
++    mchunkptr old = *fb, old2;
+     unsigned int old_idx = ~0u;
+     do
+       {
+-      /* Another simple check: make sure the top of the bin is not the
+-         record we are going to add (i.e., double free).  */
++      /* Check that the top of the bin is not the record we are going to add
++         (i.e., double free).  */
+       if (__builtin_expect (old == p, 0))
+         {
+           errstr = "double free or corruption (fasttop)";
+           goto errout;
+         }
+-      if (old != NULL)
++      /* Check that size of fastbin chunk at the top is the same as
++         size of the chunk that we are adding.  We can dereference OLD
++         only if we have the lock, otherwise it might have already been
++         deallocated.  See use of OLD_IDX below for the actual check.  */
++      if (have_lock && old != NULL)
+         old_idx = fastbin_index(chunksize(old));
+-      p->fd = fd = old;
++      p->fd = old2 = old;
+       }
+-    while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd);
++    while ((old = catomic_compare_and_exchange_val_rel (fb, p, old2)) != old2);
+-    if (fd != NULL && __builtin_expect (old_idx != idx, 0))
++    if (have_lock && old != NULL && __builtin_expect (old_idx != idx, 0))
+       {
+       errstr = "invalid fastbin entry (free)";
+       goto errout;
diff --git a/src/patches/glibc/glibc-rh1098050.patch b/src/patches/glibc/glibc-rh1098050.patch
new file mode 100644 (file)
index 0000000..e5ff3ca
--- /dev/null
@@ -0,0 +1,28 @@
+commit cf26a0cb6a0bbaca46a01ddad6662e5e5159a32a
+Author: Siddhesh Poyarekar <siddhesh@redhat.com>
+Date:   Thu May 15 12:33:11 2014 +0530
+
+    Return EAI_AGAIN for AF_UNSPEC when herrno is TRY_AGAIN (BZ #16849)
+    
+    getaddrinfo correctly returns EAI_AGAIN for AF_INET and AF_INET6
+    queries.  For AF_UNSPEC however, an older change
+    (a682a1bf553b1efe4dbb03207fece5b719cec482) broke the check and due to
+    that the returned error was EAI_NONAME.
+    
+    This patch fixes the check so that a non-authoritative not-found is
+    returned as EAI_AGAIN to the user instead of EAI_NONAME.
+
+diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
+index 6258330..8f392b9 100644
+--- a/sysdeps/posix/getaddrinfo.c
++++ b/sysdeps/posix/getaddrinfo.c
+@@ -867,8 +867,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
+                     if (status != NSS_STATUS_TRYAGAIN
+                         || rc != ERANGE || herrno != NETDB_INTERNAL)
+                       {
+-                        if (status == NSS_STATUS_TRYAGAIN
+-                            && herrno == TRY_AGAIN)
++                        if (herrno == TRY_AGAIN)
+                           no_data = EAI_AGAIN;
+                         else
+                           no_data = herrno == NO_DATA;
diff --git a/src/patches/glibc/glibc-rh1133809-1.patch b/src/patches/glibc/glibc-rh1133809-1.patch
new file mode 100644 (file)
index 0000000..12b9949
--- /dev/null
@@ -0,0 +1,199 @@
+2014-08-21  Florian Weimer  <fweimer@redhat.com>
+
+       [BZ #17187]
+       * iconv/gconv_trans.c (struct known_trans, search_tree, lock,
+       trans_compare, open_translit, __gconv_translit_find):
+       Remove module loading code.
+
+diff --git a/iconv/gconv_trans.c b/iconv/gconv_trans.c
+index 1e25854..d71c029 100644
+--- a/iconv/gconv_trans.c
++++ b/iconv/gconv_trans.c
+@@ -238,181 +238,11 @@ __gconv_transliterate (struct __gconv_step *step,
+   return __GCONV_ILLEGAL_INPUT;
+ }
+-
+-/* Structure to represent results of found (or not) transliteration
+-   modules.  */
+-struct known_trans
+-{
+-  /* This structure must remain the first member.  */
+-  struct trans_struct info;
+-
+-  char *fname;
+-  void *handle;
+-  int open_count;
+-};
+-
+-
+-/* Tree with results of previous calls to __gconv_translit_find.  */
+-static void *search_tree;
+-
+-/* We modify global data.   */
+-__libc_lock_define_initialized (static, lock);
+-
+-
+-/* Compare two transliteration entries.  */
+-static int
+-trans_compare (const void *p1, const void *p2)
+-{
+-  const struct known_trans *s1 = (const struct known_trans *) p1;
+-  const struct known_trans *s2 = (const struct known_trans *) p2;
+-
+-  return strcmp (s1->info.name, s2->info.name);
+-}
+-
+-
+-/* Open (maybe reopen) the module named in the struct.  Get the function
+-   and data structure pointers we need.  */
+-static int
+-open_translit (struct known_trans *trans)
+-{
+-  __gconv_trans_query_fct queryfct;
+-
+-  trans->handle = __libc_dlopen (trans->fname);
+-  if (trans->handle == NULL)
+-    /* Not available.  */
+-    return 1;
+-
+-  /* Find the required symbol.  */
+-  queryfct = __libc_dlsym (trans->handle, "gconv_trans_context");
+-  if (queryfct == NULL)
+-    {
+-      /* We cannot live with that.  */
+-    close_and_out:
+-      __libc_dlclose (trans->handle);
+-      trans->handle = NULL;
+-      return 1;
+-    }
+-
+-  /* Get the context.  */
+-  if (queryfct (trans->info.name, &trans->info.csnames, &trans->info.ncsnames)
+-      != 0)
+-    goto close_and_out;
+-
+-  /* Of course we also have to have the actual function.  */
+-  trans->info.trans_fct = __libc_dlsym (trans->handle, "gconv_trans");
+-  if (trans->info.trans_fct == NULL)
+-    goto close_and_out;
+-
+-  /* Now the optional functions.  */
+-  trans->info.trans_init_fct =
+-    __libc_dlsym (trans->handle, "gconv_trans_init");
+-  trans->info.trans_context_fct =
+-    __libc_dlsym (trans->handle, "gconv_trans_context");
+-  trans->info.trans_end_fct =
+-    __libc_dlsym (trans->handle, "gconv_trans_end");
+-
+-  trans->open_count = 1;
+-
+-  return 0;
+-}
+-
+-
+ int
+ internal_function
+ __gconv_translit_find (struct trans_struct *trans)
+ {
+-  struct known_trans **found;
+-  const struct path_elem *runp;
+-  int res = 1;
+-
+-  /* We have to have a name.  */
+-  assert (trans->name != NULL);
+-
+-  /* Acquire the lock.  */
+-  __libc_lock_lock (lock);
+-
+-  /* See whether we know this module already.  */
+-  found = __tfind (trans, &search_tree, trans_compare);
+-  if (found != NULL)
+-    {
+-      /* Is this module available?  */
+-      if ((*found)->handle != NULL)
+-      {
+-        /* Maybe we have to reopen the file.  */
+-        if ((*found)->handle != (void *) -1)
+-          /* The object is not unloaded.  */
+-          res = 0;
+-        else if (open_translit (*found) == 0)
+-          {
+-            /* Copy the data.  */
+-            *trans = (*found)->info;
+-            (*found)->open_count++;
+-            res = 0;
+-          }
+-      }
+-    }
+-  else
+-    {
+-      size_t name_len = strlen (trans->name) + 1;
+-      int need_so = 0;
+-      struct known_trans *newp;
+-
+-      /* We have to continue looking for the module.  */
+-      if (__gconv_path_elem == NULL)
+-      __gconv_get_path ();
+-
+-      /* See whether we have to append .so.  */
+-      if (name_len <= 4 || memcmp (&trans->name[name_len - 4], ".so", 3) != 0)
+-      need_so = 1;
+-
+-      /* Create a new entry.  */
+-      newp = (struct known_trans *) malloc (sizeof (struct known_trans)
+-                                          + (__gconv_max_path_elem_len
+-                                             + name_len + 3)
+-                                          + name_len);
+-      if (newp != NULL)
+-      {
+-        char *cp;
+-
+-        /* Clear the struct.  */
+-        memset (newp, '\0', sizeof (struct known_trans));
+-
+-        /* Store a copy of the module name.  */
+-        newp->info.name = cp = (char *) (newp + 1);
+-        cp = __mempcpy (cp, trans->name, name_len);
+-
+-        newp->fname = cp;
+-
+-        /* Search in all the directories.  */
+-        for (runp = __gconv_path_elem; runp->name != NULL; ++runp)
+-          {
+-            cp = __mempcpy (__stpcpy ((char *) newp->fname, runp->name),
+-                            trans->name, name_len);
+-            if (need_so)
+-              memcpy (cp, ".so", sizeof (".so"));
+-
+-            if (open_translit (newp) == 0)
+-              {
+-                /* We found a module.  */
+-                res = 0;
+-                break;
+-              }
+-          }
+-
+-        if (res)
+-          newp->fname = NULL;
+-
+-        /* In any case we'll add the entry to our search tree.  */
+-        if (__tsearch (newp, &search_tree, trans_compare) == NULL)
+-          {
+-            /* Yickes, this should not happen.  Unload the object.  */
+-            res = 1;
+-            /* XXX unload here.  */
+-          }
+-      }
+-    }
+-
+-  __libc_lock_unlock (lock);
+-
+-  return res;
++  /* This function always fails.  Transliteration module loading is
++     not implemented.  */
++  return 1;
+ }
+-- 
+1.9.3
+
diff --git a/src/patches/glibc/glibc-rh1133809-2.patch b/src/patches/glibc/glibc-rh1133809-2.patch
new file mode 100644 (file)
index 0000000..8148abb
--- /dev/null
@@ -0,0 +1,625 @@
+commit 585367266923156ac6fb789939a923641ba5aaf4
+Author: Florian Weimer <fweimer@redhat.com>
+Date:   Wed May 28 14:05:03 2014 +0200
+
+    manual: Update the locale documentation
+
+commit 4e8f95a0df7c2300b830ec12c0ae1e161bc8a8a3
+Author: Florian Weimer <fweimer@redhat.com>
+Date:   Mon May 12 15:24:12 2014 +0200
+
+    _nl_find_locale: Improve handling of crafted locale names [BZ #17137]
+    
+    Prevent directory traversal in locale-related environment variables
+    (CVE-2014-0475).
+
+commit d183645616b0533b3acee28f1a95570bffbdf50f
+Author: Florian Weimer <fweimer@redhat.com>
+Date:   Wed May 28 14:41:52 2014 +0200
+
+    setlocale: Use the heap for the copy of the locale argument
+    
+    This avoids alloca calls with potentially large arguments.
+
+diff -pruN glibc-2.18/locale/findlocale.c glibc-2.18.patched/locale/findlocale.c
+--- glibc-2.18/locale/findlocale.c     2013-08-11 04:22:55.000000000 +0530
++++ glibc-2.18.patched/locale/findlocale.c     2014-08-26 16:14:50.403253778 +0530
+@@ -17,6 +17,7 @@
+    02111-1307 USA.  */
+ #include <assert.h>
++#include <errno.h>
+ #include <locale.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -57,6 +58,45 @@ struct loaded_l10nfile *_nl_locale_file_
+ const char _nl_default_locale_path[] attribute_hidden = LOCALEDIR;
++/* Checks if the name is actually present, that is, not NULL and not
++   empty.  */
++static inline int
++name_present (const char *name)
++{
++  return name != NULL && name[0] != '\0';
++}
++
++/* Checks that the locale name neither extremely long, nor contains a
++   ".." path component (to prevent directory traversal).  */
++static inline int
++valid_locale_name (const char *name)
++{
++  /* Not set.  */
++  size_t namelen = strlen (name);
++  /* Name too long.  The limit is arbitrary and prevents stack overflow
++     issues later.  */
++  if (__builtin_expect (namelen > 255, 0))
++    return 0;
++  /* Directory traversal attempt.  */
++  static const char slashdot[4] = {'/', '.', '.', '/'};
++  if (__builtin_expect (memmem (name, namelen,
++                              slashdot, sizeof (slashdot)) != NULL, 0))
++    return 0;
++  if (namelen == 2 && __builtin_expect (name[0] == '.' && name [1] == '.', 0))
++    return 0;
++  if (namelen >= 3
++      && __builtin_expect (((name[0] == '.'
++                           && name[1] == '.'
++                           && name[2] == '/')
++                          || (name[namelen - 3] == '/'
++                              && name[namelen - 2] == '.'
++                              && name[namelen - 1] == '.')), 0))
++    return 0;
++  /* If there is a slash in the name, it must start with one.  */
++  if (__builtin_expect (memchr (name, '/', namelen) != NULL, 0) && name[0] != '/')
++    return 0;
++  return 1;
++}
+ struct __locale_data *
+ internal_function
+@@ -65,7 +105,7 @@ _nl_find_locale (const char *locale_path
+ {
+   int mask;
+   /* Name of the locale for this category.  */
+-  char *loc_name;
++  char *loc_name = (char *) *name;
+   const char *language;
+   const char *modifier;
+   const char *territory;
+@@ -73,31 +113,39 @@ _nl_find_locale (const char *locale_path
+   const char *normalized_codeset;
+   struct loaded_l10nfile *locale_file;
+-  if ((*name)[0] == '\0')
++  if (loc_name[0] == '\0')
+     {
+       /* The user decides which locale to use by setting environment
+        variables.  */
+-      *name = getenv ("LC_ALL");
+-      if (*name == NULL || (*name)[0] == '\0')
+-      *name = getenv (_nl_category_names.str
++      loc_name = getenv ("LC_ALL");
++      if (!name_present (loc_name))
++      loc_name = getenv (_nl_category_names.str
+                       + _nl_category_name_idxs[category]);
+-      if (*name == NULL || (*name)[0] == '\0')
+-      *name = getenv ("LANG");
++      if (!name_present (loc_name))
++      loc_name = getenv ("LANG");
++      if (!name_present (loc_name))
++      loc_name = (char *) _nl_C_name;
+     }
+-  if (*name == NULL || (*name)[0] == '\0'
+-      || (__builtin_expect (__libc_enable_secure, 0)
+-        && strchr (*name, '/') != NULL))
+-    *name = (char *) _nl_C_name;
++  /* We used to fall back to the C locale if the name contains a slash
++     character '/', but we now check for directory traversal in
++     valid_locale_name, so this is no longer necessary.  */
+-  if (__builtin_expect (strcmp (*name, _nl_C_name), 1) == 0
+-      || __builtin_expect (strcmp (*name, _nl_POSIX_name), 1) == 0)
++  if (__builtin_expect (strcmp (loc_name, _nl_C_name), 1) == 0
++      || __builtin_expect (strcmp (loc_name, _nl_POSIX_name), 1) == 0)
+     {
+       /* We need not load anything.  The needed data is contained in
+        the library itself.  */
+       *name = (char *) _nl_C_name;
+       return _nl_C[category];
+     }
++  else if (!valid_locale_name (loc_name))
++    {
++      __set_errno (EINVAL);
++      return NULL;
++    }
++
++  *name = loc_name;
+   /* We really have to load some data.  First we try the archive,
+      but only if there was no LOCPATH environment variable specified.  */
+diff -pruN glibc-2.18/locale/setlocale.c glibc-2.18.patched/locale/setlocale.c
+--- glibc-2.18/locale/setlocale.c      2013-08-11 04:22:55.000000000 +0530
++++ glibc-2.18.patched/locale/setlocale.c      2014-08-26 16:14:50.401253764 +0530
+@@ -272,6 +272,8 @@ setlocale (int category, const char *loc
+        of entries of the form `CATEGORY=VALUE'.  */
+       const char *newnames[__LC_LAST];
+       struct __locale_data *newdata[__LC_LAST];
++      /* Copy of the locale argument, for in-place splitting.  */
++      char *locale_copy = NULL;
+       /* Set all name pointers to the argument name.  */
+       for (category = 0; category < __LC_LAST; ++category)
+@@ -281,7 +283,13 @@ setlocale (int category, const char *loc
+       if (__builtin_expect (strchr (locale, ';') != NULL, 0))
+       {
+         /* This is a composite name.  Make a copy and split it up.  */
+-        char *np = strdupa (locale);
++        locale_copy = strdup (locale);
++        if (__builtin_expect (locale_copy == NULL, 0))
++          {
++            __libc_rwlock_unlock (__libc_setlocale_lock);
++            return NULL;
++          }
++        char *np = locale_copy;
+         char *cp;
+         int cnt;
+@@ -299,6 +307,7 @@ setlocale (int category, const char *loc
+               {
+               error_return:
+                 __libc_rwlock_unlock (__libc_setlocale_lock);
++                free (locale_copy);
+                 /* Bogus category name.  */
+                 ERROR_RETURN;
+@@ -391,8 +400,9 @@ setlocale (int category, const char *loc
+       /* Critical section left.  */
+       __libc_rwlock_unlock (__libc_setlocale_lock);
+-      /* Free the resources (the locale path variable).  */
++      /* Free the resources.  */
+       free (locale_path);
++      free (locale_copy);
+       return composite;
+     }
+diff -pruN glibc-2.18/localedata/Makefile glibc-2.18.patched/localedata/Makefile
+--- glibc-2.18/localedata/Makefile     2014-08-26 16:15:22.656474571 +0530
++++ glibc-2.18.patched/localedata/Makefile     2014-08-26 16:14:50.403253778 +0530
+@@ -77,7 +77,7 @@ locale_test_suite := tst_iswalnum tst_is
+ tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
+       tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
+-      tst-strfmon1 tst-sscanf tst-strptime
++      tst-strfmon1 tst-sscanf tst-strptime tst-setlocale3
+ ifeq (yes,$(build-shared))
+ ifneq (no,$(PERL))
+ tests: $(objpfx)mtrace-tst-leaks
+@@ -288,6 +288,7 @@ tst-strfmon1-ENV = $(TEST_MBWC_ENV)
+ tst-strptime-ENV = $(TEST_MBWC_ENV)
+ tst-setlocale-ENV = LOCPATH=$(common-objpfx)localedata LC_ALL=ja_JP.EUC-JP
++tst-setlocale3-ENV = LOCPATH=$(common-objpfx)localedata
+ bug-iconv-trans-ENV = LOCPATH=$(common-objpfx)localedata
+diff -pruN glibc-2.18/localedata/tst-setlocale3.c glibc-2.18.patched/localedata/tst-setlocale3.c
+--- glibc-2.18/localedata/tst-setlocale3.c     1970-01-01 05:30:00.000000000 +0530
++++ glibc-2.18.patched/localedata/tst-setlocale3.c     2014-08-26 16:14:50.403253778 +0530
+@@ -0,0 +1,203 @@
++/* Regression test for setlocale invalid environment variable handling.
++   Copyright (C) 2014 Free Software Foundation, Inc.
++   This file is part of the GNU C Library.
++
++   The GNU C Library is free software; you can redistribute it and/or
++   modify it under the terms of the GNU Lesser General Public
++   License as published by the Free Software Foundation; either
++   version 2.1 of the License, or (at your option) any later version.
++
++   The GNU C Library is distributed in the hope that it will be useful,
++   but WITHOUT ANY WARRANTY; without even the implied warranty of
++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++   Lesser General Public License for more details.
++
++   You should have received a copy of the GNU Lesser General Public
++   License along with the GNU C Library; if not, see
++   <http://www.gnu.org/licenses/>.  */
++
++#include <locale.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++/* The result of setlocale may be overwritten by subsequent calls, so
++   this wrapper makes a copy.  */
++static char *
++setlocale_copy (int category, const char *locale)
++{
++  const char *result = setlocale (category, locale);
++  if (result == NULL)
++    return NULL;
++  return strdup (result);
++}
++
++static char *de_locale;
++
++static void
++setlocale_fail (const char *envstring)
++{
++  setenv ("LC_CTYPE", envstring, 1);
++  if (setlocale (LC_CTYPE, "") != NULL)
++    {
++      printf ("unexpected setlocale success for \"%s\" locale\n", envstring);
++      exit (1);
++    }
++  const char *newloc = setlocale (LC_CTYPE, NULL);
++  if (strcmp (newloc, de_locale) != 0)
++    {
++      printf ("failed setlocale call \"%s\" changed locale to \"%s\"\n",
++            envstring, newloc);
++      exit (1);
++    }
++}
++
++static void
++setlocale_success (const char *envstring)
++{
++  setenv ("LC_CTYPE", envstring, 1);
++  char *newloc = setlocale_copy (LC_CTYPE, "");
++  if (newloc == NULL)
++    {
++      printf ("setlocale for \"%s\": %m\n", envstring);
++      exit (1);
++    }
++  if (strcmp (newloc, de_locale) == 0)
++    {
++      printf ("setlocale with LC_CTYPE=\"%s\" left locale at \"%s\"\n",
++            envstring, de_locale);
++      exit (1);
++    }
++  if (setlocale (LC_CTYPE, de_locale) == NULL)
++    {
++      printf ("restoring locale \"%s\" with LC_CTYPE=\"%s\": %m\n",
++            de_locale, envstring);
++      exit (1);
++    }
++  char *newloc2 = setlocale_copy (LC_CTYPE, newloc);
++  if (newloc2 == NULL)
++    {
++      printf ("restoring locale \"%s\" following \"%s\": %m\n",
++            newloc, envstring);
++      exit (1);
++    }
++  if (strcmp (newloc, newloc2) != 0)
++    {
++      printf ("representation of locale \"%s\" changed from \"%s\" to \"%s\"",
++            envstring, newloc, newloc2);
++      exit (1);
++    }
++  free (newloc);
++  free (newloc2);
++
++  if (setlocale (LC_CTYPE, de_locale) == NULL)
++    {
++      printf ("restoring locale \"%s\" with LC_CTYPE=\"%s\": %m\n",
++            de_locale, envstring);
++      exit (1);
++    }
++}
++
++/* Checks that a known-good locale still works if LC_ALL contains a
++   value which should be ignored.  */
++static void
++setlocale_ignore (const char *to_ignore)
++{
++  const char *fr_locale = "fr_FR.UTF-8";
++  setenv ("LC_CTYPE", fr_locale, 1);
++  char *expected_locale = setlocale_copy (LC_CTYPE, "");
++  if (expected_locale == NULL)
++    {
++      printf ("setlocale with LC_CTYPE=\"%s\" failed: %m\n", fr_locale);
++      exit (1);
++    }
++  if (setlocale (LC_CTYPE, de_locale) == NULL)
++    {
++      printf ("failed to restore locale: %m\n");
++      exit (1);
++    }
++  unsetenv ("LC_CTYPE");
++
++  setenv ("LC_ALL", to_ignore, 1);
++  setenv ("LC_CTYPE", fr_locale, 1);
++  const char *actual_locale = setlocale (LC_CTYPE, "");
++  if (actual_locale == NULL)
++    {
++      printf ("setlocale with LC_ALL, LC_CTYPE=\"%s\" failed: %m\n",
++            fr_locale);
++      exit (1);
++    }
++  if (strcmp (actual_locale, expected_locale) != 0)
++    {
++      printf ("setlocale under LC_ALL failed: got \"%s\", expected \"%s\"\n",
++            actual_locale, expected_locale);
++      exit (1);
++    }
++  unsetenv ("LC_CTYPE");
++  setlocale_success (fr_locale);
++  unsetenv ("LC_ALL");
++  free (expected_locale);
++}
++
++static int
++do_test (void)
++{
++  /* The glibc test harness sets this environment variable
++     uncondionally.  */
++  unsetenv ("LC_ALL");
++
++  de_locale = setlocale_copy (LC_CTYPE, "de_DE.UTF-8");
++  if (de_locale == NULL)
++    {
++      printf ("setlocale (LC_CTYPE, \"de_DE.UTF-8\"): %m\n");
++      return 1;
++    }
++  setlocale_success ("C");
++  setlocale_success ("en_US.UTF-8");
++  setlocale_success ("/en_US.UTF-8");
++  setlocale_success ("//en_US.UTF-8");
++  setlocale_ignore ("");
++
++  setlocale_fail ("does-not-exist");
++  setlocale_fail ("/");
++  setlocale_fail ("/../localedata/en_US.UTF-8");
++  setlocale_fail ("en_US.UTF-8/");
++  setlocale_fail ("en_US.UTF-8/..");
++  setlocale_fail ("en_US.UTF-8/../en_US.UTF-8");
++  setlocale_fail ("../localedata/en_US.UTF-8");
++  {
++    size_t large_length = 1024;
++    char *large_name = malloc (large_length + 1);
++    if (large_name == NULL)
++      {
++      puts ("malloc failure");
++      return 1;
++      }
++    memset (large_name, '/', large_length);
++    const char *suffix = "en_US.UTF-8";
++    strcpy (large_name + large_length - strlen (suffix), suffix);
++    setlocale_fail (large_name);
++    free (large_name);
++  }
++  {
++    size_t huge_length = 64 * 1024 * 1024;
++    char *huge_name = malloc (huge_length + 1);
++    if (huge_name == NULL)
++      {
++      puts ("malloc failure");
++      return 1;
++      }
++    memset (huge_name, 'X', huge_length);
++    huge_name[huge_length] = '\0';
++    /* Construct a composite locale specification. */
++    const char *prefix = "LC_CTYPE=de_DE.UTF-8;LC_TIME=";
++    memcpy (huge_name, prefix, strlen (prefix));
++    setlocale_fail (huge_name);
++    free (huge_name);
++  }
++
++  return 0;
++}
++
++#define TEST_FUNCTION do_test ()
++#include "../test-skeleton.c"
+diff -pruN glibc-2.18/manual/locale.texi glibc-2.18.patched/manual/locale.texi
+--- glibc-2.18/manual/locale.texi      2013-08-11 04:22:55.000000000 +0530
++++ glibc-2.18.patched/manual/locale.texi      2014-08-26 16:14:50.404253785 +0530
+@@ -29,6 +29,7 @@ will follow the conventions preferred by
+ * Setting the Locale::          How a program specifies the locale
+                                  with library functions.
+ * Standard Locales::            Locale names available on all systems.
++* Locale Names::                Format of system-specific locale names.
+ * Locale Information::          How to access the information for the locale.
+ * Formatting Numbers::          A dedicated function to format numbers.
+ * Yes-or-No Questions::         Check a Response against the locale.
+@@ -99,14 +100,16 @@ locale named @samp{espana-castellano} to
+ most of Spain.
+ The set of locales supported depends on the operating system you are
+-using, and so do their names.  We can't make any promises about what
+-locales will exist, except for one standard locale called @samp{C} or
+-@samp{POSIX}.  Later we will describe how to construct locales.
+-@comment (@pxref{Building Locale Files}).
++using, and so do their names, except that the standard locale called
++@samp{C} or @samp{POSIX} always exist.  @xref{Locale Names}.
++
++In order to force the system to always use the default locale, the
++user can set the @code{LC_ALL} environment variable to @samp{C}.
+ @cindex combining locales
+-A user also has the option of specifying different locales for different
+-purposes---in effect, choosing a mixture of multiple locales.
++A user also has the option of specifying different locales for
++different purposes---in effect, choosing a mixture of multiple
++locales.  @xref{Locale Categories}.
+ For example, the user might specify the locale @samp{espana-castellano}
+ for most purposes, but specify the locale @samp{usa-english} for
+@@ -120,7 +123,7 @@ which locales apply.  However, the user
+ for a particular subset of those purposes.
+ @node Locale Categories, Setting the Locale, Choosing Locale, Locales
+-@section Categories of Activities that Locales Affect
++@section Locale Categories
+ @cindex categories for locales
+ @cindex locale categories
+@@ -128,7 +131,11 @@ The purposes that locales serve are grou
+ that a user or a program can choose the locale for each category
+ independently.  Here is a table of categories; each name is both an
+ environment variable that a user can set, and a macro name that you can
+-use as an argument to @code{setlocale}.
++use as the first argument to @code{setlocale}.
++
++The contents of the environment variable (or the string in the second
++argument to @code{setlocale}) has to be a valid locale name.
++@xref{Locale Names}.
+ @vtable @code
+ @comment locale.h
+@@ -172,7 +179,7 @@ for affirmative and negative responses.
+ @comment locale.h
+ @comment ISO
+ @item LC_ALL
+-This is not an environment variable; it is only a macro that you can use
++This is not a category; it is only a macro that you can use
+ with @code{setlocale} to set a single locale for all purposes.  Setting
+ this environment variable overwrites all selections by the other
+ @code{LC_*} variables or @code{LANG}.
+@@ -225,13 +232,7 @@ The symbols in this section are defined
+ @comment ISO
+ @deftypefun {char *} setlocale (int @var{category}, const char *@var{locale})
+ The function @code{setlocale} sets the current locale for category
+-@var{category} to @var{locale}.  A list of all the locales the system
+-provides can be created by running
+-
+-@pindex locale
+-@smallexample
+-  locale -a
+-@end smallexample
++@var{category} to @var{locale}.
+ If @var{category} is @code{LC_ALL}, this specifies the locale for all
+ purposes.  The other possible values of @var{category} specify an
+@@ -256,10 +257,9 @@ is passed in as @var{locale} parameter.
+ When you read the current locale for category @code{LC_ALL}, the value
+ encodes the entire combination of selected locales for all categories.
+-In this case, the value is not just a single locale name.  In fact, we
+-don't make any promises about what it looks like.  But if you specify
+-the same ``locale name'' with @code{LC_ALL} in a subsequent call to
+-@code{setlocale}, it restores the same combination of locale selections.
++If you specify the same ``locale name'' with @code{LC_ALL} in a
++subsequent call to @code{setlocale}, it restores the same combination
++of locale selections.
+ To be sure you can use the returned string encoding the currently selected
+ locale at a later time, you must make a copy of the string.  It is not
+@@ -275,6 +275,11 @@ for @var{category}.
+ If a nonempty string is given for @var{locale}, then the locale of that
+ name is used if possible.
++The effective locale name (either the second argument to
++@code{setlocale}, or if the argument is an empty string, the name
++obtained from the process environment) must be valid locale name.
++@xref{Locale Names}.
++
+ If you specify an invalid locale name, @code{setlocale} returns a null
+ pointer and leaves the current locale unchanged.
+ @end deftypefun
+@@ -328,7 +323,7 @@ locale categories, and future versions o
+ portability, assume that any symbol beginning with @samp{LC_} might be
+ defined in @file{locale.h}.
+-@node Standard Locales, Locale Information, Setting the Locale, Locales
++@node Standard Locales, Locale Names, Setting the Locale, Locales
+ @section Standard Locales
+ The only locale names you can count on finding on all operating systems
+@@ -362,7 +357,94 @@ with the environment, rather than trying
+ locale explicitly by name.  Remember, different machines might have
+ different sets of locales installed.
+-@node Locale Information, Formatting Numbers, Standard Locales, Locales
++@node Locale Names, Locale Information, Standard Locales, Locales
++@section Locale Names
++
++The following command prints a list of locales supported by the
++system:
++
++@pindex locale
++@smallexample
++  locale -a
++@end smallexample
++
++@strong{Portability Note:} With the notable exception of the standard
++locale names @samp{C} and @samp{POSIX}, locale names are
++system-specific.
++
++Most locale names follow XPG syntax and consist of up to four parts:
++
++@smallexample
++@var{language}[_@var{territory}[.@var{codeset}]][@@@var{modifier}]
++@end smallexample
++
++Beside the first part, all of them are allowed to be missing.  If the
++full specified locale is not found, less specific ones are looked for.
++The various parts will be stripped off, in the following order:
++
++@enumerate
++@item
++codeset
++@item
++normalized codeset
++@item
++territory
++@item
++modifier
++@end enumerate
++
++For example, the locale name @samp{de_AT.iso885915@@euro} denotes a
++German-language locale for use in Austria, using the ISO-8859-15
++(Latin-9) character set, and with the Euro as the currency symbol.
++
++In addition to locale names which follow XPG syntax, systems may
++provide aliases such as @samp{german}.  Both categories of names must
++not contain the slash character @samp{/}.
++
++If the locale name starts with a slash @samp{/}, it is treated as a
++path relative to the configured locale directories; see @code{LOCPATH}
++below.  The specified path must not contain a component @samp{..}, or
++the name is invalid, and @code{setlocale} will fail.
++
++@strong{Portability Note:} POSIX suggests that if a locale name starts
++with a slash @samp{/}, it is resolved as an absolute path.  However,
++the GNU C Library treats it as a relative path under the directories listed
++in @code{LOCPATH} (or the default locale directory if @code{LOCPATH}
++is unset).
++
++Locale names which are longer than an implementation-defined limit are
++invalid and cause @code{setlocale} to fail.
++
++As a special case, locale names used with @code{LC_ALL} can combine
++several locales, reflecting different locale settings for different
++categories.  For example, you might want to use a U.S. locale with ISO
++A4 paper format, so you set @code{LANG} to @samp{en_US.UTF-8}, and
++@code{LC_PAPER} to @samp{de_DE.UTF-8}.  In this case, the
++@code{LC_ALL}-style combined locale name is
++
++@smallexample
++LC_CTYPE=en_US.UTF-8;LC_TIME=en_US.UTF-8;LC_PAPER=de_DE.UTF-8;@dots{}
++@end smallexample
++
++followed by other category settings not shown here.
++
++@vindex LOCPATH
++The path used for finding locale data can be set using the
++@code{LOCPATH} environment variable.  This variable lists the
++directories in which to search for locale definitions, separated by a
++colon @samp{:}.
++
++The default path for finding locale data is system specific.  A typical
++value for the @code{LOCPATH} default is:
++
++@smallexample
++/usr/share/locale
++@end smallexample
++
++The value of @code{LOCPATH} is ignored by privileged programs for
++security reasons, and only the default directory is used.
++
++@node Locale Information, Formatting Numbers, Locale Names, Locales
+ @section Accessing Locale Information
+ There are several ways to access locale information.  The simplest
index f0081b7ef9551049e8ef027dc63e879a6aa496a8..a19140d04cd055714d8dae3dd556b73222488d85 100644 (file)
@@ -460,7 +460,6 @@ sub pdf2 {
        $lines->linewidth('0.5');
 
        #Fill BILL DATA into PDF
-       setlocale(LC_ALL, "$mainsettings{'LANGUAGE'}_$uplang");
        foreach (@billar) {
                my ($a1,$a2) = split( /\,/, $_ );
                $a2=sprintf"%.2f",($a2/1024/1024);