https://issues.apache.org/SpamAssassin/show_bug.cgi?id=7030
Bug ID: 7030
Summary: BayesStore/Redis.pm: authentication doesn't work with
Redis 2.6 and earlier
Product: Spamassassin
Version: 3.4.0
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Libraries
Assignee: [email protected]
Reporter: [email protected]
Mail::SpamAssassin::BayesStore::Redis supports authentication; however, how it
checks to see if authentication is required is by connecting to the Redis
server and issuing a SELECT command. It expects NOAUTH to be returned if
authentication is enabled. Redis 2.6.x and earlier, however, seem to return ERR
instead of NOAUTH:
(output from redis-cli for 2.6 with auth on)
redis 127.0.0.1:6379> SELECT 2
(error) ERR operation not permitted
(output from redis-cli for 2.8 with auth on)
127.0.0.1:6379> select 2
(error) NOAUTH Authentication required.
As a result, as shipped, the module doesn't work with anything but Redis 2.8.
My perl is pretty rusty but I think the following patch may be sufficient
(although it may be desirable to make sure that the ERR actually is returning
an auth error (e.g. "operation not permitted").
--- Redis.pm 2014-02-07 03:36:28.000000000 -0500
+++ Redis-26.pm 2014-03-31 13:36:20.992470082 -0400
@@ -224,7 +224,7 @@
eval {
$r->call('SELECT', $db_id) eq 'OK' ? 1 : 0;
} or do {
- if ($@ =~ /\bNOAUTH\b/) {
+ if ($@ =~ /\bNOAUTH\b/ || $@ =~ /\bERR\b/) {
defined $self->{password}
or die "Redis server requires authentication, no password provided";
$r->call('AUTH', $self->{password});
After I applied this patch, the Redis bits work as I would expect.
--
You are receiving this mail because:
You are the assignee for the bug.