/[smeserver]/rpms/smeserver-qpsmtpd/sme9/smeserver-qpsmtpd-2.4.0-allow_relayclients_wo_authentications.patch
ViewVC logotype

Annotation of /rpms/smeserver-qpsmtpd/sme9/smeserver-qpsmtpd-2.4.0-allow_relayclients_wo_authentications.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (hide annotations) (download)
Wed Dec 3 23:53:41 2014 UTC (9 years, 11 months ago) by stephdl
Branch: MAIN
CVS Tags: smeserver-qpsmtpd-2_4_0-33_el6_sme, smeserver-qpsmtpd-2_4_0-29_el6_sme, smeserver-qpsmtpd-2_4_0-16_el6_sme, smeserver-qpsmtpd-2_4_0-20_el6_sme, smeserver-qpsmtpd-2_4_0-13_el6_sme, smeserver-qpsmtpd-2_4_0-34_el6_sme, smeserver-qpsmtpd-2_4_0-26_el6_sme, smeserver-qpsmtpd-2_4_0-27_el6_sme, smeserver-qpsmtpd-2_4_0-21_el6_sme, smeserver-qpsmtpd-2_4_0-25_el6_sme, smeserver-qpsmtpd-2_4_0-15_el6_sme, smeserver-qpsmtpd-2_4_0-24_el6_sme, smeserver-qpsmtpd-2_4_0-14_el6_sme, smeserver-qpsmtpd-2_4_0-37_el6_sme, smeserver-qpsmtpd-2_4_0-12_el6_sme, smeserver-qpsmtpd-2_4_0-23_el6_sme, smeserver-qpsmtpd-2_4_0-10_el6_sme, smeserver-qpsmtpd-2_4_0-31_el6_sme, smeserver-qpsmtpd-2_4_0-38_el6_sme, smeserver-qpsmtpd-2_4_0-35_el6_sme, smeserver-qpsmtpd-2_4_0-30_el6_sme, smeserver-qpsmtpd-2_4_0-36_el6_sme, smeserver-qpsmtpd-2_4_0-39_el6_sme, smeserver-qpsmtpd-2_4_0-32_el6_sme, smeserver-qpsmtpd-2_4_0-11_el6_sme, smeserver-qpsmtpd-2_4_0-28_el6_sme, HEAD
Changes since 1.2: +26 -26 lines
* Wed Dec 3 2014 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-10.sme
- allow IP relayclient stored by DB [SME: 8704]
- Code from Stefano ZAmboni <zamboni@mind-at-work.it>
- & Charlie Brady <charlieb-contribs-bugzilla@budge.apana.org.au>

1 stephdl 1.1 diff -Nur smeserver-qpsmtpd-2.4.0/root/etc/e-smith/templates/var/service/qpsmtpd/config/relayclients/60myAppliances smeserver-qpsmtpd-2.4.0.bz8704/root/etc/e-smith/templates/var/service/qpsmtpd/config/relayclients/60myAppliances
2     --- smeserver-qpsmtpd-2.4.0/root/etc/e-smith/templates/var/service/qpsmtpd/config/relayclients/60myAppliances 1970-01-01 01:00:00.000000000 +0100
3 stephdl 1.3 +++ smeserver-qpsmtpd-2.4.0.bz8704/root/etc/e-smith/templates/var/service/qpsmtpd/config/relayclients/60myAppliances 2014-12-04 00:41:19.363852378 +0100
4 stephdl 1.2 @@ -0,0 +1,37 @@
5 stephdl 1.1 +{
6 stephdl 1.3 + use esmith::util::network qw(isValidIP);
7     + use Net::IPv4Addr qw(ipv4_in_network ipv4_parse);
8 stephdl 1.1 +
9 stephdl 1.3 + my $relayclients = ${qpsmtpd}{UnauthenticatedRelayClients} || return;
10     + my @relayclients = split /[,:]/, $relayclients;
11 stephdl 1.2 +
12 stephdl 1.3 + my $ndb = esmith::NetworksDB->open_ro();
13     +
14     + sub convert_to_cidr
15 stephdl 1.2 + {
16 stephdl 1.3 + $_ = shift;
17     + return "$_/32" unless m!/!;
18     + my ($ip,$bits) = ipv4_parse($_);
19     + return "$ip/$bits";
20     + }
21     +
22     + my @localAccess = map {
23     + convert_to_cidr($_)
24     + } $ndb->local_access_spec();
25 stephdl 1.2 +
26 stephdl 1.3 + foreach my $relayclient (@relayclients)
27     + {
28     + if (!isValidIP($relayclient))
29 stephdl 1.1 + {
30 stephdl 1.3 + $OUT .= "## $relayclient is not an IP\n";
31 stephdl 1.1 + }
32 stephdl 1.3 + elsif (grep { ipv4_in_network($_, $relayclient) } @localAccess)
33 stephdl 1.1 + {
34 stephdl 1.3 + $OUT .= "$relayclient\n";
35     + }
36 stephdl 1.2 + else
37 stephdl 1.3 + {
38     + $OUT .= "## $relayclient is not in any local network\n";
39 stephdl 1.1 + }
40 stephdl 1.2 + }
41 stephdl 1.1 +}

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed