PowerDNS/weakforced

getDBStats() returning wrong status

sshipway opened this issue · 10 comments

wforce v2.0.0-8

The getDBStats() call appears to always return a blacklisted status of true, regardless of the actual fact.

The bl_reason and bl_expiry return empty strings when the item is in reality not listed; possibly these should be absent?

$ curl -s -X GET -H Authorization: Basic XXXX -H Content-Type: application/json http://localhost:8084/?command=getBL
{  "bl_entries": [ { "expiration": "2019-Feb-20 05:23:45", "ip": "1.1.1.1/32", "reason": "Manual" }]}

These items are not in the blacklist but return the wrong value:

$ curl -s -X POST -H Authorization: Basic XXXX -H Content-Type: application/json --data {"login":"foo@company.com"} http://localhost:8084/?command=getDBStats
{"bl_expire": "", "bl_reason": "", "blacklisted": true, "login": "foo@company.com", "stats": {}}

$ curl -s -X POST -H Authorization: Basic XXXX -H Content-Type: application/json --data {"ip":"1.2.3.4"} http://localhost:8084/?command=getDBStats
{"bl_expire": "", "bl_reason": "", "blacklisted": true, "ip": "1.2.3.4", "stats": {}}

This item is in the blacklist and returns correctly:

$ curl -s -X POST -H Authorization: Basic XXXX -H Content-Type: application/json --data {"ip":"1.1.1.1"} http://localhost:8084/?command=getDBStats
{"bl_expire": "2019-Feb-20 05:23:45", "bl_reason": "Manual", "blacklisted": true, "ip": "1.1.1.1", "stats": {}}

I can reproduce this... I'll take a look what's happening.

Ok this is a variable initialisation issue, must have been dumb luck it was working before. How critical is this for you?

Not critical, but it breaks our automated test suite so we cant upgrade to 2.0 in production. Im keen to getv2.0 for the enhanced stats and geoip2.

Understood. I have a fix - will figure out when we can put it into a patch release.

fix is in v.2.0.x branch. Need to schedule a release

JFYI 2.0.1 will be coming out in a few weeks, once QA have some time to smoke-test it

Poised to implement here once it appears in the repo.

I see the release on github. Any chance of a 2.0.1 RPM in the dovecot repo this week? (gives expression like the Cat from Shrek)

It was released today. Enjoy!