Changeset 1232

Show
Ignore:
Timestamp:
06/19/08 18:21:51 (3 months ago)
Author:
zothos
Message:

reverted the traffic/ispcp-vrl-traff changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CHANGELOG

    r1231 r1232  
    22~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    33 
    4 2008-06-19 Jochen Manz 
    5         - GUI: 
    6                 * Fixed #1355: You can't create a mail alias account if the user part already exists as a subdomain mail account 
    7         - ENGINE: 
    8                 * Fixed Mail traffic accounting 
     42008-06-19 Jochen Manz  
     5        - GUI:  
     6                * Fixed #1355: You can't create a mail alias account if the user part already exists as a subdomain mail account  
    97 
    1082008-06-17 Benedikt Heintel 
  • trunk/engine/traffic/ispcp-vrl-traff

    r1231 r1232  
    317317        my $smtp_from_domain = undef; 
    318318        my $smtp_to_domain = undef; 
    319         my ($query, $rows) = (undef, undef); 
    320         my $extra_size = undef; 
    321         my $recipient_address = undef; 
    322         my %forwarders_table; 
    323319 
    324320    ($rs, $rlog) = gen_log_file($main::cfg{'MAIL_TRAFF_LOG'}, $main::cfg{'TRAFF_LOG_DIR'}, $main::cfg{'LOG_DIR'}); 
     
    345341                if(exists  $main::cfg{'MAIL_LOG_INC_AMAVIS'} && $main::cfg{'MAIL_LOG_INC_AMAVIS'}) { 
    346342                        # Logs including AMAVIS/SPAMASSASSIN/CLAMAV entries 
    347                         $cmd = "$cat $smtp_delivery_log | $awk '{if ( \$10 != \"?\" && !(\$5 ~ /localhost|127.0.0.1/ && \$6 ~ /localhost|127.0.0.1/)) print \$3,\$4,\$10;}' 1>$smtp_log"; 
     343                        $cmd = "$cat $smtp_delivery_log | $awk '{if ( \$10 != \"?\" && !(\$5 ~ /localhost|127.0.0.1/ && \$6 ~ /localhost|127.0.0.1/)) print substr(\$3, index(\$3, \"@\")+1, length(\$3)),substr(\$4, index(\$4, \"@\")+1, length(\$4)),\$10;}' 1>$smtp_log"; 
    348344                } else { 
    349345                        # Logs not including AMAVIS/SPAMASSASSIN/CLAMAV entries 
    350                         $cmd = "$cat $smtp_delivery_log | $awk '{if ( \$10 != \"?\" && \$6 !~ /virtual/ && !(\$5 ~ /localhost|127.0.0.1/ && \$6 ~ /localhost|127.0.0.1/)) print \$3,\$4,\$10;}' 1>$smtp_log"; 
     346                        $cmd = "$cat $smtp_delivery_log | $awk '{if ( \$10 != \"?\" && \$6 !~ /virtual/ && !(\$5 ~ /localhost|127.0.0.1/ && \$6 ~ /localhost|127.0.0.1/)) print substr(\$3, index(\$3, \"@\")+1, length(\$3)),substr(\$4, index(\$4, \"@\")+1, length(\$4)),\$10;}' 1>$smtp_log"; 
    351347                } 
    352348 
     
    366362        } 
    367363 
    368                 # 
    369                 # Build address forwarding recipients table 
    370                 # 
    371                 my $query = <<"SQLEND"; 
    372                         SELECT 
    373                                 concat( mail_acc, '\@', domain_name ) AS mail_from, domain_name, mail_forward 
    374                         FROM 
    375                                 mail_users 
    376                         LEFT JOIN 
    377                                 domain 
    378                         USING  
    379                                 ( domain_id ) 
    380                         WHERE  
    381                                 mail_type LIKE '%normal_forward' 
    382                 UNION 
    383                         SELECT  
    384                                 concat( mail_acc, '\@', subdomain_name, '.', domain_name ) AS mail_from, domain_name, mail_forward 
    385                         FROM  
    386                                 mail_users 
    387                         LEFT JOIN  
    388                                 domain 
    389                         USING 
    390                                 ( domain_id ) 
    391                         LEFT JOIN  
    392                                 subdomain 
    393                         USING 
    394                                 ( domain_id ) 
    395                         WHERE 
    396                                 mail_type LIKE '%subdom_forward' 
    397                 UNION 
    398                         SELECT  
    399                                 concat( mail_acc, '\@', alias_name ) AS mail_from, domain_name, mail_forward 
    400                         FROM  
    401                                 mail_users 
    402                         LEFT JOIN 
    403                                 domain 
    404                         USING 
    405                                 ( domain_id ) 
    406                         LEFT JOIN 
    407                                 domain_aliasses 
    408                         USING 
    409                                 ( domain_id ) 
    410                         WHERE  
    411                                 mail_type LIKE '%alias_forward' 
    412 SQLEND 
    413                  
    414                 ($rs, $rows) = doSQL($query); 
    415                 return $rs if ($rs != 0); 
    416                 foreach (@$rows) { 
    417                         $forwarders_table{@$_[0]} = (@$_[2] =~ tr/,//)+1; 
    418                 } 
    419  
    420364        while (<F>) { 
    421365 
    422366            my $line = $_; 
    423367 
    424             if ($line =~ /^([^@]+)@([^\,]+)\ ([^@]+)@([^\,]+)\ (\d+)\n$/) { 
    425  
    426                                 $smtp_from_domain = $2; 
    427                                 $smtp_to_domain = $4; 
    428                                 $traffic_size = $5; 
    429                                 $recipient_address = $3.'@'.$4; 
    430                                 chomp($line); 
    431                                 push_el(\@main::el, 'collect_mail_traffic()', $line); 
     368            if ($line =~ /^([^\,]+)\ ([^\,]+)\ (\d+)\n$/) { 
     369 
     370                                $smtp_from_domain = $1; 
     371                                $smtp_to_domain = $2; 
     372                                $traffic_size = $3; 
    432373 
    433374                                if($smtp_from_domain =~ /(.*)(\.)(.*\.)(.*)$/ && !exists $main::smtp_traffic{$smtp_from_domain}) { 
     
    438379                                } 
    439380 
    440                                 # Add extra size to account forwardings 
    441                                 if (exists($forwarders_table{$recipient_address})) { 
    442                                         $extra_size = $forwarders_table{$recipient_address} * $traffic_size; 
    443                                         $main::smtp_traffic{$smtp_to_domain} += $extra_size; 
    444                                         push_el(\@main::el, 'collect_mail_traffic()', $recipient_address . ' extra size: ' . $extra_size); 
    445                                 } 
    446  
    447381                if(exists $main::smtp_traffic{$smtp_from_domain}) { 
    448382                        $main::smtp_traffic{$smtp_from_domain} += $traffic_size; 
    449                                         push_el(\@main::el, 'collect_mail_traffic()', "Current traffic count for domain " . $smtp_from_domain . ':' . $main::smtp_traffic{$smtp_from_domain}); 
    450                                 } 
    451                                 elsif(exists $main::smtp_traffic{$smtp_to_domain}) { 
     383                                } 
     384                                else { 
    452385                        $main::smtp_traffic{$smtp_to_domain} += $traffic_size; 
    453                                         push_el(\@main::el, 'collect_mail_traffic()', "Current traffic count for domain " . $smtp_to_domain . ':' . $main::smtp_traffic{$smtp_to_domain}); 
    454386                } 
    455387