summaryrefslogtreecommitdiffstats
path: root/win32utils/GeoIP.diff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 18:37:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 18:37:14 +0000
commitea648e70a989cca190cd7403fe892fd2dcc290b4 (patch)
treee2b6b1c647da68b0d4d66082835e256eb30970e8 /win32utils/GeoIP.diff
parentInitial commit. (diff)
downloadbind9-ea648e70a989cca190cd7403fe892fd2dcc290b4.tar.xz
bind9-ea648e70a989cca190cd7403fe892fd2dcc290b4.zip
Adding upstream version 1:9.11.5.P4+dfsg.upstream/1%9.11.5.P4+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'win32utils/GeoIP.diff')
-rw-r--r--win32utils/GeoIP.diff345
1 files changed, 345 insertions, 0 deletions
diff --git a/win32utils/GeoIP.diff b/win32utils/GeoIP.diff
new file mode 100644
index 0000000..bc9b6bc
--- /dev/null
+++ b/win32utils/GeoIP.diff
@@ -0,0 +1,345 @@
+diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIP.c dev/GeoIP-1.5.1/libGeoIP/GeoIP.c
+--- dists/GeoIP-1.5.1/libGeoIP/GeoIP.c 2013-03-23 03:26:09.000000000 +0100
++++ dev/GeoIP-1.5.1/libGeoIP/GeoIP.c 2013-07-19 16:56:58.000000000 +0200
+@@ -19,6 +19,7 @@
+ */
+
+ #include "GeoIP.h"
++#include "GeoIP_internal.h"
+
+ static geoipv6_t IPV6_NULL;
+
+@@ -44,6 +45,10 @@
+ #include <stdint.h> /* For uint32_t */
+ #endif
+
++#if defined(_WIN32)
++#include "pread.h"
++#endif
++
+ #ifdef _UNUSED
+ #elif defined(__GNUC__)
+ #define _UNUSED __attribute__ ((unused))
+diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIP.h dev/GeoIP-1.5.1/libGeoIP/GeoIP.h
+--- dists/GeoIP-1.5.1/libGeoIP/GeoIP.h 2013-03-23 03:26:09.000000000 +0100
++++ dev/GeoIP-1.5.1/libGeoIP/GeoIP.h 2013-07-19 16:53:33.000000000 +0200
+@@ -154,31 +154,33 @@
+ GEOIP_CORPORATE_SPEED = 3,
+ } GeoIPNetspeedValues;
+
++#ifdef GEOIP_EXPORTS
++#define GEOIP_API __declspec(dllexport)
++#define GEOIP_DATA __declspec(dllexport)
++#else
++#define GEOIP_DATA __declspec(dllimport)
++#define GEOIP_API
++#endif /* GEOIP_EXPORTS */
++
+ extern char **GeoIPDBFileName;
+-extern const char * GeoIPDBDescription[NUM_DB_TYPES];
+-extern const char *GeoIPCountryDBFileName;
+-extern const char *GeoIPRegionDBFileName;
+-extern const char *GeoIPCityDBFileName;
+-extern const char *GeoIPOrgDBFileName;
+-extern const char *GeoIPISPDBFileName;
+-extern const char *GeoIPLocationADBFileName;
+-extern const char *GeoIPAccuracyRadiusFileName;
+-extern const char *GeoIPCityConfidenceFileName;
++extern GEOIP_DATA const char * GeoIPDBDescription[NUM_DB_TYPES];
++extern GEOIP_DATA const char *GeoIPCountryDBFileName;
++extern GEOIP_DATA const char *GeoIPRegionDBFileName;
++extern GEOIP_DATA const char *GeoIPCityDBFileName;
++extern GEOIP_DATA const char *GeoIPOrgDBFileName;
++extern GEOIP_DATA const char *GeoIPISPDBFileName;
++extern GEOIP_DATA const char *GeoIPLocationADBFileName;
++extern GEOIP_DATA const char *GeoIPAccuracyRadiusFileName;
++extern GEOIP_DATA const char *GeoIPCityConfidenceFileName;
+ extern char * GeoIP_custom_directory;
+
+ /* Warning: do not use those arrays as doing so may break your
+ * program with newer GeoIP versions */
+-extern const char GeoIP_country_code[255][3];
+-extern const char GeoIP_country_code3[255][4];
+-extern const char * GeoIP_country_name[255];
+-extern const char * GeoIP_utf8_country_name[255];
+-extern const char GeoIP_country_continent[255][3];
+-
+-#ifdef DLL
+-#define GEOIP_API __declspec(dllexport)
+-#else
+-#define GEOIP_API
+-#endif /* DLL */
++extern GEOIP_DATA const char GeoIP_country_code[255][3];
++extern GEOIP_DATA const char GeoIP_country_code3[255][4];
++extern GEOIP_DATA const char * GeoIP_country_name[255];
++extern GEOIP_DATA const char * GeoIP_utf8_country_name[255];
++extern GEOIP_DATA const char GeoIP_country_continent[255][3];
+
+ GEOIP_API void GeoIP_setup_custom_directory(char *dir);
+ GEOIP_API GeoIP* GeoIP_open_type (int type, int flags);
+diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.c dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.c
+--- dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.c 2013-03-23 03:26:09.000000000 +0100
++++ dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.c 2013-07-19 15:41:05.000000000 +0200
+@@ -35,6 +35,10 @@
+ #include <stdint.h> /* For uint32_t */
+ #endif
+
++#if defined(_WIN32)
++#include "pread.h"
++#endif
++
+ #ifndef HAVE_PREAD
+ #define pread(fd, buf, count, offset) \
+ ( \
+diff -ruN dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.h dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.h
+--- dists/GeoIP-1.5.1/libGeoIP/GeoIPCity.h 2013-03-23 03:26:09.000000000 +0100
++++ dev/GeoIP-1.5.1/libGeoIP/GeoIPCity.h 2013-07-19 16:23:58.000000000 +0200
+@@ -48,22 +48,22 @@
+ int netmask;
+ } GeoIPRecord;
+
+-GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum);
+-GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr);
+-GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host);
+-
+-GeoIPRecord * GeoIP_record_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
+-GeoIPRecord * GeoIP_record_by_addr_v6 (GeoIP* gi, const char *addr);
+-GeoIPRecord * GeoIP_record_by_name_v6 (GeoIP* gi, const char *host);
++GEOIP_API GeoIPRecord * GeoIP_record_by_ipnum (GeoIP* gi, unsigned long ipnum);
++GEOIP_API GeoIPRecord * GeoIP_record_by_addr (GeoIP* gi, const char *addr);
++GEOIP_API GeoIPRecord * GeoIP_record_by_name (GeoIP* gi, const char *host);
++
++GEOIP_API GeoIPRecord * GeoIP_record_by_ipnum_v6 (GeoIP* gi, geoipv6_t ipnum);
++GEOIP_API GeoIPRecord * GeoIP_record_by_addr_v6 (GeoIP* gi, const char *addr);
++GEOIP_API GeoIPRecord * GeoIP_record_by_name_v6 (GeoIP* gi, const char *host);
+
+-int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr);
+-int GeoIP_record_id_by_addr_v6 (GeoIP* gi, const char *addr);
++GEOIP_API int GeoIP_record_id_by_addr (GeoIP* gi, const char *addr);
++GEOIP_API int GeoIP_record_id_by_addr_v6 (GeoIP* gi, const char *addr);
+
+-int GeoIP_init_record_iter (GeoIP* gi);
++GEOIP_API int GeoIP_init_record_iter (GeoIP* gi);
+ /* returns 0 on success, 1 on failure */
+-int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter);
++GEOIP_API int GeoIP_next_record (GeoIP* gi, GeoIPRecord **gir, int *record_iter);
+
+-void GeoIPRecord_delete (GeoIPRecord *gir);
++GEOIP_API void GeoIPRecord_delete (GeoIPRecord *gir);
+
+ /* NULL on failure otherwise a malloced string in utf8 */
+ /* char * GeoIP_iso_8859_1__utf8(const char *); */
+diff -ruN dists/GeoIP-1.5.1/libGeoIP/Makefile.vc dev/GeoIP-1.5.1/libGeoIP/Makefile.vc
+--- dists/GeoIP-1.5.1/libGeoIP/Makefile.vc 2013-03-23 03:26:09.000000000 +0100
++++ dev/GeoIP-1.5.1/libGeoIP/Makefile.vc 2013-07-19 16:47:45.000000000 +0200
+@@ -1,29 +1,42 @@
+ #NMAKE makefile for Windows developers.
+-#Produces a static library (GeoIP.lib).
++##Produces a static library (GeoIP.lib).
++#Produces a DLL (GeoIP.dll) and library (GeoIP.lib).
+
+ COMPILER=cl
+
+-CFLAGS=-DWIN32 -MD -nologo
++CFLAGS=-DWIN32 -DGEOIP_EXPORTS -MD -nologo
+
+ GEOIPINC = -I..\libGeoIP
+
+-CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DGEOIPDATADIR=\"$(GEOIPDATADIR)\"
++CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DGEOIPDATADIR=\"$(GEOIPDATADIR)\" -DPACKAGE_VERSION=\"1.5.1\"
+
+-OBJS=GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj
++LINKER=link
++
++LDFLAGS=/DLL /nologo /subsystem:console
++
++LD1 = $(LINKER) $(LDFLAGS)
++
++OBJS=GeoIP.obj GeoIPCity.obj GeoIP_depreciated.obj regionName.obj md5.obj timeZone.obj pread.obj
+
+-EXTRA_LIBS= advapi32.lib wsock32.lib
++EXTRA_LIBS= ws2_32.lib
+
+ AR=lib
+
+-GeoIP.lib: GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj
+- $(AR) -nologo $(OBJS) $(EXTRA_LIBS) /OUT:GeoIP.lib
++#GeoIP.lib: GeoIP.obj GeoIPCity.obj regionName.obj md5.obj timeZone.obj pread.obj
++# $(AR) -nologo $(OBJS) $(EXTRA_LIBS) /OUT:GeoIP.lib
+
++GeoIP.dll GeoIP.lib: $(OBJS)
++ $(LD1) $(OBJS) $(EXTRA_LIBS) /out:GeoIP.dll /implib:GeoIP.lib
++
+ GeoIP.obj: GeoIP.c
+ $(CC1) -c GeoIP.c $(GEOIPINC)
+
+ GeoIPCity.obj: GeoIPCity.c
+ $(CC1) -c GeoIPCity.c $(GEOIPINC)
+
++GeoIP_depreciated.obj: GeoIP_depreciated.c
++ $(CC1) -c GeoIP_depreciated.c $(GEOIPINC)
++
+ regionName.obj: regionName.c
+ $(CC1) -c regionName.c $(GEOIPINC)
+
+@@ -32,3 +45,6 @@
+
+ timeZone.obj: timeZone.c
+ $(CC1) -c timeZone.c $(GEOIPINC)
++
++pread.obj: pread.c
++ $(CC1) -c pread.c $(GEOIPINC)
+diff -ruN dists/GeoIP-1.5.1/libGeoIP/pread.c dev/GeoIP-1.5.1/libGeoIP/pread.c
+--- dists/GeoIP-1.5.1/libGeoIP/pread.c 1970-01-01 01:00:00.000000000 +0100
++++ dev/GeoIP-1.5.1/libGeoIP/pread.c 2013-07-19 15:37:44.000000000 +0200
+@@ -0,0 +1,73 @@
++/*
++ * Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
++ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
++ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
++ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
++ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
++ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
++ * PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#include <windows.h>
++#include <io.h>
++
++#include "pread.h"
++
++CRITICAL_SECTION preadsc;
++
++#ifdef _WIN64
++int pread(int fd, void *buf, unsigned int nbyte, __int64 offset)
++{
++ int cc = -1;
++ __int64 prev = (__int64)-1L;
++
++ EnterCriticalSection(&preadsc);
++ prev = _lseeki64(fd, 0L, SEEK_CUR);
++ if (prev == (__int64)-1L)
++ goto done;
++ if (_lseeki64(fd, offset, SEEK_SET) != offset)
++ goto done;
++ cc = _read(fd, buf, nbyte);
++
++done:
++ if (prev != (__int64)-1L)
++ (void)_lseeki64(fd, prev, SEEK_SET);
++ LeaveCriticalSection(&preadsc);
++
++ return cc;
++}
++#else
++int pread(int fd, void *buf, unsigned int nbyte, long offset)
++{
++ int cc = -1;
++ long prev = -1L;
++
++ EnterCriticalSection(&preadsc);
++ prev = _lseek(fd, 0L, SEEK_CUR);
++ if (prev == -1L)
++ goto done;
++ if (_lseek(fd, offset, SEEK_SET) != offset)
++ goto done;
++ cc = _read(fd, buf, nbyte);
++
++done:
++ if (prev != -1L)
++ (void)_lseek(fd, prev, SEEK_SET);
++ LeaveCriticalSection(&preadsc);
++
++ return cc;
++}
++#endif
++
++BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved )
++{
++ if (fdwReason == DLL_PROCESS_ATTACH)
++ InitializeCriticalSection(&preadsc);
++ return TRUE;
++}
+diff -ruN dists/GeoIP-1.5.1/libGeoIP/pread.h dev/GeoIP-1.5.1/libGeoIP/pread.h
+--- dists/GeoIP-1.5.1/libGeoIP/pread.h 1970-01-01 01:00:00.000000000 +0100
++++ dev/GeoIP-1.5.1/libGeoIP/pread.h 2013-07-19 15:39:01.000000000 +0200
+@@ -0,0 +1,29 @@
++/*
++ * Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC")
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
++ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
++ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
++ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
++ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
++ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
++ * PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#ifdef _WIN64
++typedef __int64 ssize_t;
++
++int pread(int fd, void *buf, unsigned int nbyte, __int64 offset);
++#else
++typedef int ssize_t;
++
++int pread(int fd, void *buf, unsigned int nbyte, long offset);
++#endif
++
++#define HAVE_PREAD
++
++extern CRITICAL_SECTION preadsc;
+diff -ruN dists/GeoIP-1.5.1/libGeoIP/regionName.c dev/GeoIP-1.5.1/libGeoIP/regionName.c
+--- dists/GeoIP-1.5.1/libGeoIP/regionName.c 2013-03-23 03:26:09.000000000 +0100
++++ dev/GeoIP-1.5.1/libGeoIP/regionName.c 2013-07-19 16:37:56.000000000 +0200
+@@ -1,3 +1,5 @@
++#include "GeoIP.h"
++
+ #include <string.h>
+ #include <stdio.h>
+
+diff -ruN dists/GeoIP-1.5.1/libGeoIP/timeZone.c dev/GeoIP-1.5.1/libGeoIP/timeZone.c
+--- dists/GeoIP-1.5.1/libGeoIP/timeZone.c 2013-03-23 03:26:09.000000000 +0100
++++ dev/GeoIP-1.5.1/libGeoIP/timeZone.c 2013-07-19 17:22:44.000000000 +0200
+@@ -1,4 +1,7 @@
++#include "GeoIP.h"
++
+ #include <string.h>
++
+ const char* GeoIP_time_zone_by_country_and_region(const char * country,const char * region) {
+ const char* timezone = NULL;
+ if (country == NULL) {
+diff -ruN dists/GeoIP-1.5.1/test/Makefile.vc dev/GeoIP-1.5.1/test/Makefile.vc
+--- dists/GeoIP-1.5.1/test/Makefile.vc 2013-03-23 03:26:09.000000000 +0100
++++ dev/GeoIP-1.5.1/test/Makefile.vc 2013-07-19 16:48:55.000000000 +0200
+@@ -9,7 +9,7 @@
+
+ GEOIPINC = -I..\libGeoIP
+
+-CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC)
++CC1 = $(COMPILER) $(CFLAGS) $(GEOIPINC) -DSRCDIR=\"../\"
+
+ GEOIPLIB = ..\libGeoIP\GeoIP.lib
+
+diff -ruN dists/GeoIP-1.5.1/test/benchmark.c dev/GeoIP-1.5.1/test/benchmark.c
+--- dists/GeoIP-1.5.1/test/benchmark.c 2013-03-23 03:26:09.000000000 +0100
++++ dev/GeoIP-1.5.1/test/benchmark.c 2013-07-19 16:26:23.000000000 +0200
+@@ -81,7 +81,7 @@
+ void testgeoiporg(int flags, const char *msg, int numlookups)
+ {
+ GeoIP *i = NULL;
+- GeoIPRegion *i3 = NULL;
++ char *i3 = NULL;
+ int i4 = 0;
+ int i2 = 0;
+ double t = 0;