fix: rewrote dovecot sql query management

This commit is contained in:
Dominik Meyer 2025-02-07 11:23:59 +01:00
parent cf5cb8c29c
commit c2548833ed
Signed by: byterazor
GPG Key ID: EABDA0FD5981BC97

View File

@ -75,13 +75,15 @@ sub createDSN
sub updateTransactionWithRecipientInfo
{
my ($self, $transaction, $sth) = @_;
my ($self, $transaction, $rcpt_row) = @_;
return unless $sth->rows == 1;
return 0 unless defined($rcpt_row);
return 0 unless defined($rcpt_row->{username});
return 0 unless defined($rcpt_row->{dovecot_server});
my $row = $sth->fetchrow_hashref;
my $dovecot_server = $row->{dovecot_server};
my $username = $row->{username};
my $dovecot_server = $rcpt_row->{dovecot_server};
my $username = $rcpt_row->{username};
my $result = $self->{fetch_dovecot_details_sth}->execute($dovecot_server);
if (!$result)
@ -96,7 +98,7 @@ sub updateTransactionWithRecipientInfo
return 0;
}
$row = $self->{fetch_dovecot_details_sth}->fetchrow_hashref();
my $row = $self->{fetch_dovecot_details_sth}->fetchrow_hashref();
my $hostname = $row->{hostname};
my $port = $row->{port};
@ -135,7 +137,7 @@ sub hook_rcpt {
if ($self->{rcpt_sth}->rows == 1)
{
$self->log(LOGDEBUG, " found recipient in database");
my $ret = $self->updateTransactionWithRecipientInfo($transaction, $self->{rcpt_sth});
my $ret = $self->updateTransactionWithRecipientInfo($transaction, $self->{rcpt_sth}->fetchrow_hashref );
if (!$ret)
{