Beispiel #1
0
void
ns_geoip_init(void) {
#ifndef HAVE_GEOIP
	return;
#else
	GeoIP_cleanup();
	if (ns_g_geoip == NULL)
		ns_g_geoip = &geoip_table;
#endif
}
Beispiel #2
0
void
dns_geoip_shutdown(void) {
#ifdef HAVE_GEOIP
	GeoIP_cleanup();
#ifdef ISC_PLATFORM_USETHREADS
	if (state_mctx != NULL)
		isc_mem_detach(&state_mctx);
#endif
#else
	return;
#endif
}
Beispiel #3
0
/* {{{ geoip_change_custom_directory() helper function
 */
static void geoip_change_custom_directory(char *value)
{
#if LIBGEOIP_VERSION >= 1004007
	GeoIP_cleanup();
#else
	int i;
	if (GeoIPDBFileName != NULL) {
		for (i = 0; i < NUM_DB_TYPES; i++) {
			if (GeoIPDBFileName[i]) {
				free(GeoIPDBFileName[i]);
			}
		}
		free(GeoIPDBFileName);
		GeoIPDBFileName = NULL;
	}
#endif

	GeoIP_setup_custom_directory(value);
	GeoIP_db_avail(GEOIP_COUNTRY_EDITION);
}