maxmind / geoipupdate-legacy

GeoIP update client code
GNU General Public License v2.0
258 stars 63 forks source link

geoipupdate-pureperl.pl fails to work with freebie accounts. #81

Open zzqzzqzzq opened 7 years ago

zzqzzqzzq commented 7 years ago

geoip.conf:

$ cat geoip.conf
# The following AccountID and LicenseKey are required placeholders.
# For geoipupdate versions earlier than 2.5.0, use UserId here instead of AccountID.
AccountID 0
LicenseKey 000000000000

# Include one or more of the following edition IDs:
# * GeoLite2-City - GeoLite 2 City
# * GeoLite2-Country - GeoLite2 Country
# For geoipupdate versions earlier than 2.5.0, use ProductIds here instead of EditionIDs.
EditionIDs GeoLite2-City 

Error output:

$ ./geoipupdate-pureperl.pl -v -f geoip.conf -d .
Opened License file geoip.conf
Read in license key 000000000000
Edition IDs GeoLite2-City
MD5 sum of database ./GeoIP.dat is 00000000000000000000000000000000
Send request http://updates.maxmind.com/app/update?license_key=000000000000&md5=00000000000000000000000000000000
401 Unauthorized at ./geoipupdate-pureperl.pl line 229, <$fh> line 11.

Pretty certain its due to line 123:

if ($account_id) {

Unsurprisingly $account_id is zero with a freebie account, so GeoIP_update_database_general never gets called. GeoIP_update_database, is called instead, and I suspect that routine may also be old & broken. If I dummy up the test on line 123 eg ($account_id == 0), I'll at least get to the point where I'm missing the PerlIO::Gzip library. (Which is an entirely separate issue on my end.)

$ ./geoipupdate-pureperl.pl -v -f geoip.conf -d .
Opened License file geoip.conf
Read in license key 000000000000
Edition IDs GeoLite2-City
Send request http://updates.maxmind.com/app/update_getfilename?product_id=GeoLite2-City
MD5 sum of database ./GeoLite2-City.mmdb is 00000000000000000000000000000000
Send request http://updates.maxmind.com/app/update_getfilename?product_id=GeoLite2-City
client ip address: X.Y.Z.16
md5sum of ip address and license key is XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Send request http://updates.maxmind.com/app/update_secure?db_md5=00000000000000000000000000000000&challenge_md5=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&user_id=0&edition_id=GeoLite2-City
Downloading gzipped GeoIP Database...
Unknown PerlIO layer "gzip" at ./geoipupdate-pureperl.pl line 260, <$fh> line 11.