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

Diff 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 | View Patch Patch

Revision 1.2 by stephdl, Tue Dec 2 23:45:49 2014 UTC Revision 1.3 by stephdl, Wed Dec 3 23:53:41 2014 UTC
# Line 1  Line 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  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  --- 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-03 00:42:56.346024376 +0100  +++ 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  @@ -0,0 +1,37 @@  @@ -0,0 +1,37 @@
5  +{  +{
6  +   use esmith::util::network qw( isValidIP );  +   use esmith::util::network qw(isValidIP);
7  +   use Net::IPv4Addr qw( ipv4_in_network );  +   use Net::IPv4Addr qw(ipv4_in_network ipv4_parse);
8  +  +
9  +   my @relayclients = split /[,:]/, ${qpsmtpd}{UnauthenticatedRelayClients} || '';  +   my $relayclients = ${qpsmtpd}{UnauthenticatedRelayClients} || return;
10  +   return "# No relay clients are defined" unless (scalar @relayclients);  +   my @relayclients = split /[,:]/, $relayclients;
11  +  +
 +   foreach my $relayclients (@relayclients)  
 +   {  
 +   #start to find the local network range  
12  +   my $ndb = esmith::NetworksDB->open_ro();  +   my $ndb = esmith::NetworksDB->open_ro();
 +   my @localAccess;  
13  +  +
14  +   foreach ($ndb->local_access_spec())  +   sub convert_to_cidr
15    +   {
16    +       $_ = 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    +
26    +   foreach my $relayclient (@relayclients)
27    +   {
28    +       if (!isValidIP($relayclient))
29  +       {  +       {
30  +       # If there's a / in the network string  +           $OUT .= "## $relayclient is not an IP\n";
 +       # then convert to CIDR notation  
 +       if (m!/!)  
 +           {  
 +           my ($ip,$bits) = Net::IPv4Addr::ipv4_parse($_);  
 +           push (@localAccess,"$ip/$bits");  
 +           }  
31  +       }  +       }
32  +  +       elsif (grep { ipv4_in_network($_, $relayclient) } @localAccess)
 +   foreach my  $localAccess (@localAccess)  
33  +       {  +       {
34  +       if (isValidIP($relayclients) && ipv4_in_network ("$localAccess",$relayclients))  +           $OUT .= "$relayclient\n";
35  +           {  +       }
 +           $OUT .= "$relayclients\n";  
 +           }  
36  +       else  +       else
37  +           {  +       {
38  +           $OUT .= "## $relayclients is not an IP or not in the localnetwork\n";  +           $OUT .= "## $relayclient is not in any local network\n";
 +           }  
39  +       }  +       }
40  +   }  +   }
41  +}  +}


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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