Skip to content

Commit

Permalink
Fixed possible race condition on geoip_license
Browse files Browse the repository at this point in the history
  • Loading branch information
badzong committed Mar 1, 2015
1 parent deceb6f commit 4128568
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/modules/geoip.c
Expand Up @@ -14,13 +14,6 @@ geoip_query(milter_stage_t stage, char *name, var_t *attrs)
char *hostaddr;
const char *country_code;

if(!geoip_license)
{
log_error("This product includes GeoLite data created by "
"MaxMind, available from http://www.maxmind.com.");
geoip_license = 1;
}

hostaddr = vtable_get(attrs, "hostaddr_str");
if (hostaddr == NULL)
{
Expand All @@ -34,6 +27,13 @@ geoip_query(milter_stage_t stage, char *name, var_t *attrs)
return -1;
}

if(!geoip_license)
{
log_error("This product includes GeoLite data created by "
"MaxMind, available from http://www.maxmind.com.");
geoip_license = 1;
}

country_code = GeoIP_country_code_by_addr(geoip_handle, hostaddr);

pthread_mutex_unlock(&geoip_mutex);
Expand Down

0 comments on commit 4128568

Please sign in to comment.