Skip to content

Maxmind key check fails #1286

@dwhile

Description

@dwhile

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

  • MailWatch Version: stable 1.2.0

Server configuration

  • Operation System: Fedora 38
  • PHP version: 8.1.22
  • Database: mariadb 10.5.21
  • Mail Server: Sendmail
  • Used web server: Apache

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

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

allows it to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions