/* products derived from this software without specific prior written */
/* permission. */
/* */
-/* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND */
-/* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE */
-/* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
-/* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS */
-/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR */
-/* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF */
-/* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS */
-/* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */
-/* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) */
-/* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF */
-/* THE POSSIBILITY OF SUCH DAMAGE. */
+/* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS */
+/* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
+/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
+/* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY */
+/* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL */
+/* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS */
+/* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */
+/* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, */
+/* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN */
+/* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
+/* POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/* Copyright (c) 2006-2008 the Authors */
+/* see AUTHORS and source files for details */
/******************************************************************************/
/*
file_map_t map;
const char *p, *end;
uint32_t ips = 0;
+ time_t now = time(0);
if (!file_map_open(&map, file, false)) {
return NULL;
rbldb_resource_t *res = resource_get("iplist", file);
if (res == NULL) {
- debug("No resource found");
res = p_new(rbldb_resource_t, 1);
resource_set("iplist", file, res, (resource_destructor_t)rbldb_resource_wipe);
}
db->filename = m_strdup(file);
db->ips = res->ips;
if (map.st.st_size == res->size && map.st.st_mtime == res->mtime) {
- info("rbl %s up to date", file);
+ info("%s loaded: already up-to-date", file);
file_map_close(&map);
return db;
}
- debug("mtime %d/%d, size %d/%d", (int)map.st.st_mtime, (int)res->mtime, (int)map.st.st_size, (int)res->size);
res->size = map.st.st_size;
res->mtime = map.st.st_mtime;
--end;
}
if (end != map.end) {
- warn("file %s miss a final \\n, ignoring last line",
- file);
+ warn("%s: final \\n missing, ignoring last line", file);
}
while (p < end) {
}
}
- info("rbl %s loaded, %d IPs", file, ips);
+ info("%s loaded: done in %us, %u IPs", file, (uint32_t)(time(0) - now), ips);
return db;
}
const iplist_filter_t *data = filter->data;
bool error = true;
- if (parse_ipv4(query->client_address, &end, &ip) != 0) {
- if (strchr(query->client_address, ':')) {
+ if (parse_ipv4(query->client_address.str, &end, &ip) != 0) {
+ if (strchr(query->client_address.str, ':')) {
/* iplist only works on IPv4 */
return HTK_FAIL;
}
warn("invalid client address: %s, expected ipv4",
- query->client_address);
+ query->client_address.str);
return HTK_ERROR;
}
for (uint32_t i = 0 ; i < data->rbls.len ; ++i) {