From: cebka@lenovo-laptop Date: Mon, 15 Mar 2010 17:54:39 +0000 (+0300) Subject: * Fix another spf core dump while parsing 'include' items X-Git-Tag: 0.3.0~63 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=21dc91eac153c2dade3c393d0e6f6c4e66d51a94;p=rspamd.git * Fix another spf core dump while parsing 'include' items --- diff --git a/conf/lotto.inc b/conf/lotto.inc index 40cb98f2a..1df1a4c0b 100644 --- a/conf/lotto.inc +++ b/conf/lotto.inc @@ -12,5 +12,5 @@ $__KAM_LOTTO5="/(freelotto group|Royal Heritage Lottery|UK National (Online)? Lo $__KAM_LOTTO6="/(Dear Lucky Winner|Winning Notification|Attention:Winner|Dear Winner)/isrP"; $__KAM_LOTTO7="Subject=/(Your Lucky Day|(Attention:|ONLINE) WINNER)/iH"; $KAM_LOTTO1="regexp_match_number(3, ${__KAM_LOTTO1}, ${__KAM_LOTTO2}, ${__KAM_LOTTO3}, ${__KAM_LOTTO4}, ${__KAM_LOTTO5}, ${__KAM_LOTTO6}, ${__KAM_LOTTO7})"; -#$R_LOTTO="regexp_match_number(3, ${__KAM_LOTTO1}, ${__KAM_LOTTO2}, ${__KAM_LOTTO3}, ${__KAM_LOTTO4}, ${__KAM_LOTTO5}, ${__KAM_LOTTO6})"; +$R_LOTTO="regexp_match_number(3, ${__KAM_LOTTO1}, ${__KAM_LOTTO2}, ${__KAM_LOTTO3}, ${__KAM_LOTTO4}, ${__KAM_LOTTO5}, ${__KAM_LOTTO6})"; diff --git a/perl/lib/Mail/Rspamd/Client.pm b/perl/lib/Mail/Rspamd/Client.pm index f026de8cc..9460b1ee9 100644 --- a/perl/lib/Mail/Rspamd/Client.pm +++ b/perl/lib/Mail/Rspamd/Client.pm @@ -28,6 +28,7 @@ the spamd protocol. package Mail::Rspamd::Client; use IO::Socket; +use Carp; use vars qw($VERSION); $VERSION = "1.02"; @@ -125,7 +126,7 @@ sub make_ssl_socket { eval { require IO::Socket::SSL; IO::Socket::SSL->import(LIST); - } or$self->{error} = "IO::Socket::SSL required for imaps"; + } or croak "IO::Socket::SSL required for imaps"; return IO::Socket::SSL->new("$host:$port"); } @@ -240,6 +241,7 @@ C<$is_check_p> either calls PROCESS or CHECK. The return value is a hash reference containing metrics indexed by name. Each metric is hash that contains data: + =over =item * isspam @@ -275,6 +277,7 @@ This method makes a call to the spamd server The return value is a hash reference containing metrics indexed by name. Each metric is hash that contains data: + =over =item * isspam @@ -1205,7 +1208,7 @@ sub process_imap { chomp $password; Term::ReadKey->ReadMode('normal'); $self->{error} = "\n"; - } or die "cannot get password. Check that Term::ReadKey is installed"; + } or croak "cannot get password. Check that Term::ReadKey is installed"; } # Stupid code that does not take care of timeouts etc, just trying to extract messages diff --git a/rspamc.pl.in b/rspamc.pl.in index ba00d5a5c..efadde0a2 100755 --- a/rspamc.pl.in +++ b/rspamc.pl.in @@ -23,6 +23,7 @@ my %cfg = ( 'deliver_to'=> '', 'weight' => 1, 'imap_search' => 'ALL', + 'ip' => '127.0.0.1', ); my $terminal; @@ -42,6 +43,7 @@ Additional options: -d define deliver-to header -w define weight for fuzzy operations -S define search string for IMAP operations +-i emulate that message was send from specified IP Notes: imap format: imap:user::password:[]:host::mbox: @@ -184,7 +186,7 @@ my %args; HELP_MESSAGE() unless scalar @ARGV >= 1; -getopt('c:h:P:s:d:w:S:H:', \%args); +getopt('c:h:P:s:d:w:S:H:i:', \%args); my $cmd = shift; my @path = shift; @@ -229,6 +231,9 @@ if (defined ($args{d})) { if (defined ($args{w})) { $cfg{'weight'} = $args{w}; } +if (defined ($args{i})) { + $cfg{'ip'} = $args{i}; +} if ($cmd =~ /(SYMBOLS|PROCESS|CHECK|URLS|EMAILS)/i) { $cfg{'command'} = $1; diff --git a/src/spf.c b/src/spf.c index 798803a02..0ff92303c 100644 --- a/src/spf.c +++ b/src/spf.c @@ -314,6 +314,11 @@ spf_record_dns_callback (int result, char type, int count, int ttl, void *addres cb->rec->addrs->prev = elt->prev; } + /* Shift temporary list */ + while (tmp->prev) { + tmp = tmp->prev; + } + cb->rec->addrs = tmp; g_list_free1 (elt); } @@ -370,8 +375,8 @@ spf_record_dns_callback (int result, char type, int count, int ttl, void *addres cb->rec->task->save.saved--; if (cb->rec->task->save.saved == 0 && cb->rec->callback) { + cb->rec->callback (cb->rec, cb->rec->task); if (cb->rec->addrs) { - cb->rec->callback (cb->rec, cb->rec->task); g_list_free (cb->rec->addrs); cb->rec->addrs = NULL; }