Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect assignment of $count variable in is_autowl and add_autowl functions of Greylist.pm #37

Open
alescano opened this issue May 2, 2022 · 0 comments

Comments

@alescano
Copy link

alescano commented May 2, 2022

Hi @benningm,

I think in these functions return value of do_cached function is being not properly assigned because of the missing parenthesis around $count ( lines 290 and 313 ). I noticed because autowl count in the database was never being incremented.

sub is_autowl {
my ( $self, $r, $sender, $client_ip ) = @_;
my $sender_domain = $self->_extract_sender_domain( $sender );
my $count = $r->do_cached('greylist-autowl-count', sub {
$self->_awl->get( $sender_domain, $client_ip );
} );
if( ! defined $count ) {
$self->log($r, 'client is not on autowl');
return(0);
}
if( $count < $self->autowl_threshold ) {
$self->log($r, 'client has not yet reached autowl_threshold');
return(0);
}
$self->log($r, 'client has valid autowl. updating database');
$self->_awl->incr( $sender_domain, $client_ip );
return(1);
}
sub add_autowl {
my ( $self, $r, $sender, $client_ip ) = @_;
my $sender_domain = $self->_extract_sender_domain( $sender );
my $count = $r->do_cached('greylist-autowl-count', sub {
$self->_awl->get( $sender_domain, $client_ip );
} );
if( defined $count ) {
$self->log($r, 'client already on autowl, just incrementing count');
$self->_awl->incr( $sender_domain, $client_ip );
return;
}
$self->log($r, 'creating initial autowl entry');
$self->_awl->create( $sender_domain, $client_ip );
return;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant