diff -Naur orig/odmrd dest/odmrd --- orig/odmrd 2006-05-16 10:17:57.000000000 +0200 +++ dest/odmrd 2006-05-17 11:12:21.000000000 +0200 @@ -29,6 +29,7 @@ # -c /path/to/conf.file specifies the location of the configuration file # -d debug mode - turns on verbose logging # -v print version and exit +# -n nb specifies the number of mail to take durinf each pool (all by default) # ########################################################################## # @@ -42,7 +43,7 @@ use Getopt::Std; my %opts; -getopts('c:dv', \%opts); +getopts('n:c:dv', \%opts); if ($opts{'v'}) { print "$progname\n"; exit 0; @@ -105,6 +106,7 @@ $config{debug} = 1 if $opts{'d'}; $config{conf_file} = $opts{'c'} if $opts{'c'}; +$config{max_msgs} = $opts{'n'} if (int($opts{'n'})); syslog(LOG_DEBUG, "$progname startup"); @@ -665,11 +667,16 @@ next unless $dom; # domains we undeffed because of bad characters my $dir = $config{spool}."/".$dom."/"; opendir(DIR, $dir) || next; - my @msgs = readdir(DIR); + # Sort list to have non spam mails (msg.0000) in the begining of the list + my @msgs = sort(readdir(DIR)); + # Only filenames starting with 'msg.0...' are interesting + @msgs = grep(/^msg\.\d/, @msgs); + # if specifie, only take n first msgs of the list + splice(@msgs, $config{max_msgs}) if($config{max_msgs}); foreach $msg (@msgs) { syslog(LOG_DEBUG, "considering '%s'", $msg) if $config{debug}; - next if $msg =~ /^temp\./; # skip temporary files - next if $msg =~ /^bad\./; # skip bad files + #next if $msg =~ /^temp\./; # skip temporary files + #next if $msg =~ /^bad\./; # skip bad files next unless -f $dir.$msg; # use only plain files if ($msg =~ /^([-\w\.]+)$/) { @@ -1554,6 +1561,8 @@ # Configuration file. Can be over-ridden with command line option -c /path/to/conf.file $config{conf_file} = "/etc/odmrd.conf"; +# Number of message take (0 = all) +$config{max_msgs} = 0; } # end of sub ########################################################################## @@ -1574,7 +1583,7 @@ spool hostname timeout_cmd timeout_msg max_invalid_cmds max_msg_age debug user group sendmail conf_file lockext mysql_host mysql_port mysql_socket mysql_user mysql_pass mysql_db mysql - sql_pass sql_domainlist sql_checkdomain sql_acct_table + sql_pass sql_domainlist sql_checkdomain sql_acct_table max_msgs allow_login acct_mysql use_sendfile standalone daemon server_ip server_port timeout_dns max_lock_age max_invalid_auth pidfile}; my @confkeys_binary = qw{ diff -Naur orig/odmrd.conf dest/odmrd.conf --- orig/odmrd.conf 2006-05-16 10:17:57.000000000 +0200 +++ dest/odmrd.conf 2006-05-16 11:21:56.000000000 +0200 @@ -91,6 +91,9 @@ # time (in days) after which a message will be bounced back (0 is infinite) #max_msg_age 0 +# Number of messages to take during poll (0 = all) +#max_msgs 0 + # extension of lockfiles #lockext ..LCK