/[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.1 by stephdl, Tue Dec 2 21:28:06 2014 UTC Revision 1.2 by stephdl, Tue Dec 2 23:45:49 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-02 22:03:55.241508287 +0100  +++ 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,35 @@  @@ -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 );
 + my $ndb = esmith::NetworksDB->open_ro();  
8  +  +
9  +    #start to find the local network range  +   my @relayclients = split /[,:]/, ${qpsmtpd}{UnauthenticatedRelayClients} || '';
10  +    my $localAccess = '';  +   return "# No relay clients are defined" unless (scalar @relayclients);
11  +    foreach ($ndb->local_access_spec())  +
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  +       {  +       {
20  +         # If there's a / in the network string  +       # If there's a / in the network string
21  +         # then convert to CIDR notation  +       # then convert to CIDR notation
22  +         if (m!/!)  +       if (m!/!)
23  +         {  +           {
24  +           my ($ip,$bits) = Net::IPv4Addr::ipv4_parse($_);  +           my ($ip,$bits) = Net::IPv4Addr::ipv4_parse($_);
25  +           $localAccess .= "$ip/$bits";  +           push (@localAccess,"$ip/$bits");
26  +         }  +           }
27  +       }  +       }
28  +  +
29  +    my @relayclients = split /[,:]/, ${qpsmtpd}{RelayClients} || '';  +   foreach my  $localAccess (@localAccess)
 +  
 +    return "# No relay clients are defined" unless (scalar @relayclients);  
 +  
 +    foreach my $relayclients (@relayclients)  
30  +       {  +       {
31  +         if ( (isValidIP($relayclients) && ipv4_in_network ("$localAccess",$relayclients) ) || ($relayclients eq $localAccess))  +       if (isValidIP($relayclients) && ipv4_in_network ("$localAccess",$relayclients))
32  +           {  +           {
33  +              $OUT .= "$relayclients\n";  +           $OUT .= "$relayclients\n";
34  +           }  +           }
35  +         else  +       else
36  +           {  +           {
37  +              $OUT .= "## $relayclients is not an IP or in the localnetwork\n";  +           $OUT .= "## $relayclients is not an IP or not in the localnetwork\n";
38  +           }  +           }
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