/[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.2 - (hide annotations) (download)
Tue Dec 2 23:45:49 2014 UTC (9 years, 11 months ago) by stephdl
Branch: MAIN
Changes since 1.1: +26 -24 lines
* Tue Dec 2 2014 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-9.sme
- allow IP relayclient stored by DB [SME: 8704]
- Code from Stefano ZAmboni <zamboni@mind-at-work.it>

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.2 +++ smeserver-qpsmtpd-2.4.0.bz8704/root/etc/e-smith/templates/var/service/qpsmtpd/config/relayclients/60myAppliances 2014-12-03 00:42:56.346024376 +0100
4     @@ -0,0 +1,37 @@
5 stephdl 1.1 +{
6 stephdl 1.2 + use esmith::util::network qw( isValidIP );
7     + use Net::IPv4Addr qw( ipv4_in_network );
8 stephdl 1.1 +
9 stephdl 1.2 + my @relayclients = split /[,:]/, ${qpsmtpd}{UnauthenticatedRelayClients} || '';
10     + return "# No relay clients are defined" unless (scalar @relayclients);
11     +
12     + foreach my $relayclients (@relayclients)
13     + {
14     + #start to find the local network range
15     + my $ndb = esmith::NetworksDB->open_ro();
16     + my @localAccess;
17     +
18     + foreach ($ndb->local_access_spec())
19 stephdl 1.1 + {
20 stephdl 1.2 + # If there's a / in the network string
21     + # then convert to CIDR notation
22     + if (m!/!)
23     + {
24 stephdl 1.1 + my ($ip,$bits) = Net::IPv4Addr::ipv4_parse($_);
25 stephdl 1.2 + push (@localAccess,"$ip/$bits");
26     + }
27 stephdl 1.1 + }
28     +
29 stephdl 1.2 + foreach my $localAccess (@localAccess)
30 stephdl 1.1 + {
31 stephdl 1.2 + if (isValidIP($relayclients) && ipv4_in_network ("$localAccess",$relayclients))
32 stephdl 1.1 + {
33 stephdl 1.2 + $OUT .= "$relayclients\n";
34 stephdl 1.1 + }
35 stephdl 1.2 + else
36 stephdl 1.1 + {
37 stephdl 1.2 + $OUT .= "## $relayclients is not an IP or not in the localnetwork\n";
38 stephdl 1.1 + }
39     + }
40 stephdl 1.2 + }
41 stephdl 1.1 +}

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