mailwatch / MailWatch

MailWatch for MailScanner is a web-based front-end to MailScanner
http://mailwatch.org/
GNU General Public License v2.0
119 stars 66 forks source link

Maxmind key check fails #1286

Closed dwhile closed 1 year ago

dwhile commented 1 year ago

Issue summary

The check on the Maxmind key is incorrect and results in being unable to download the GeoIP database.

Steps to reproduce

  1. Get key from Maxmind
  2. Enter into config file
  3. Try to update database

Expected result

Database update should succeed

Actual result

Get error message about needing a key.

Installation

Version and method

Server configuration

The key check in functions.php at line 4628 uses a regex to check the key and only allows 12 or 16 characters (a-zAZ0-9). The key obtained from Maxmind was 40 characters long and included the underscore () character so the check failed.

Changing that line to: if (pregmatch('/^([0-9A-Za-z]{12}|[0-9A-Za-z]{16}|[0-9A-Za-z]{40})$/', $input)) {

allows it to work.

endelwar commented 1 year ago

Thanks @dwhile for catching this!