Package: python-geoip
Version: 1.2.0-1
Severity: normal
Tags: patch

Hi,

when running record_by_name() on a wrong DB a SystemError is raised:

>>> import GeoIP
>>> gi = GeoIP.new(GeoIP.GEOIP_MEMORY_CACHE)
>>> print gi.record_by_name("heise.de")
Invalid database type GeoIP Country Edition, expected GeoIP City Edition, Rev 1
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
SystemError: error return without exception set

I think the culprit is here (in py_GeoIP.c)
  gir = GeoIP_record_by_name(GeoIP->gi, name);
  if (gir == NULL) {
    return NULL;
  }

This should instead be:
  gir = GeoIP_record_by_name(GeoIP->gi, name);
  if (gir == NULL) {
    Py_INCREF(Py_None);
    return Py_None;
  }

And the same bug applies to record_by_addr()


Regards,
   Bastian

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.11-ck1-treasure1
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages python-geoip depends on:
ii  libc6                       2.3.2.ds1-20 GNU C Library: Shared libraries an
ii  libgeoip1                   1.3.8-1      A non-DNS IP-to-country resolver l
ii  python                      2.3.5-1      An interactive high-level object-o

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to