/usr/share/doc/libgeoip-dev/examples/test-geoip-invalid-file.c is in libgeoip-dev 1.6.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include "GeoIP.h"
int main()
{
GeoIP *gi = GeoIP_open(SRCDIR "/README.md", GEOIP_MEMORY_CACHE);
/* We don't detect invalid files at load, unfortunately. */
if (gi == NULL) {
fprintf(stderr, "Error opening database\n");
return 1;
}
const char *country = GeoIP_country_code_by_addr(gi, "24.24.24.24");
if (country != NULL) {
fprintf(
stderr,
"Received a non-NULL value on an invalid database from GeoIP_country_code_by_addr\n");
return 1;
}
country = GeoIP_country_code_by_addr_v6(gi, "24.24.24.24");
if (country != NULL) {
fprintf(
stderr,
"Received a non-NULL value on an invalid database from GeoIP_country_code_by_addr_v6\n");
return 1;
}
return 0;
}
|