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