Hi,

I'm still a novice and learning, but I'm playing with 0.95 and have come across an issue with the hosts_allow plugin.
Specifically this part in sub in_hosts_allow:

            $const = Qpsmtpd::Constants::return_code($const) || DECLINED;
            if ($const =~ /deny/i) {
                $self->log(LOGINFO, "fail, $message");
            }

The second line can seemingly never be true, as the preceding line has replaced the value of $const read from the config file with a return /code/ (e.g. 901).

Should there also be a 'return $const, $message;' to return the failure before reaching:
            $self->log(LOGDEBUG, "pass, $const, $message");
            return $const, $message;

as always logs a 'pass', regardless of the actual response.


There'll undoubtedly be a more elegant way, but as a kludge for me, I've changed this to:

        if (join('.', unpack('C4', inet_aton($remote) & $mask)) eq $net) {
            my $action = $const;
            $const = Qpsmtpd::Constants::return_code($const) || DECLINED;
            if ($action =~ /deny/i) {
                $self->log(LOGINFO, "fail, $message");
                return $const, $message;
            }

Is there a particular reason for using codes rather than the keys in this section?

Chris.

Reply via email to