}
}
if (!greylist_db_need_cleanup(config, awl_db) || config->max_age <= 0) {
- info("no cleanup needed");
+ info("%s loaded: no cleanup needed", path);
res->db = awl_db;
return &res->db;
} else {
}
++old_count;
} while (tcbdbcurnext(cur));
- now = time(0);
tcbdbput(tmp_db, "@@cleanup@@", strlen("@@cleanup@@"), &now, sizeof(now));
}
tcxstrdel(key);
/** Cleanup successful, replace the old database with the new one.
*/
if (trashable) {
- info("database cleanup finished: database was corrupted, create a new one");
+ info("%s cleanup: database was corrupted, create a new one", path);
unlink(path);
} else if (replace) {
- info("database cleanup finished: before %u entries, after %d entries",
- old_count, new_count);
+ info("%s cleanup: done in %us, before %u, after %u entries",
+ path, (uint32_t)(time(0) - now), old_count, new_count);
unlink(path);
if (rename(tmppath, path) != 0) {
UNIXERR("rename");
}
} else {
unlink(tmppath);
- info("database cleanup finished: nothing to do, %u entries", new_count);
+ info("%s cleanup: done in %us, nothing to do, %u entries",
+ path, (uint32_t)(time(0) - now), old_count);
}
}
return NULL;
}
+ info("%s loaded", path);
res->db = awl_db;
return &res->db;
}
if (config->client_awl) {
snprintf(path, sizeof(path), "%s/%swhitelist.db", directory, prefix);
- info("loading auto-whitelist database");
config->awl_db = greylist_db_get(config, path,
sizeof(struct awl_entry),
(db_entry_checker_t)(greylist_check_awlentry));
}
snprintf(path, sizeof(path), "%s/%sgreylist.db", directory, prefix);
- info("loading greylist database");
config->obj_db = greylist_db_get(config, path,
sizeof(struct obj_entry),
(db_entry_checker_t)(greylist_check_object));
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;
}
if (filter_running > 0) {
return true;
}
+ log_state = "refreshing ";
+ info("reloading configuration");
bool ret = config_reload(mconfig);
+ log_state = "";
foreach (client_t **server, busy) {
client_io_ro(*server);
}}
const char *p, *end;
char line[BUFSIZ];
uint32_t count = 0;
+ time_t now = time(0);
if (!file_map_open(&map, file, false)) {
return false;
--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);
}
strlist_resource_t *res = resource_get("strlist", file);
res = p_new(strlist_resource_t, 1);
resource_set("strlist", file, res, (resource_destructor_t)strlist_resource_wipe);
} else if (res->trie2 != NULL) {
- err("A file (%s) cannot be used as a rbldns zone file and a strlist file at the same time",
- file);
+ err("%s not loaded: the file is already used as a rbldns zone file", file);
resource_release("strlist", file);
file_map_close(&map);
return false;
local->reverse = reverse;
local->partial = partial;
if (res->size == map.st.st_size && res->mtime == map.st.st_mtime) {
- info("strlist %s up to date", file);
+ info("%s loaded: already up-to-date", file);
file_map_close(&map);
return true;
}
eol = end;
}
if (eol - p >= BUFSIZ) {
- err("unreasonnable long line");
+ err("%s not loaded: unreasonnable long line", file);
file_map_close(&map);
trie_delete(&res->trie1);
strlist_local_wipe(local);
}
file_map_close(&map);
trie_compile(res->trie1, lock);
- info("%s loaded, %u entries", file, count);
+ info("%s loaded: done in %us, %u entries", file, (uint32_t)(time(0) - now), count);
return true;
}
file_map_t map;
const char *p, *end;
char line[BUFSIZ];
+ time_t now = time(0);
if (!file_map_open(&map, file, false)) {
return false;
--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);
}
res = p_new(strlist_resource_t, 1);
resource_set("strlist", file, res, (resource_destructor_t)strlist_resource_wipe);
} else if (res->trie2 == NULL) {
- err("A file (%s) cannot be used as a rbldns zone file and a strlist file at the same time",
- file);
+ err("%s not loaded: the file is already used as a strlist-file parameter", file);
resource_release("strlist", file);
file_map_close(&map);
return false;
domain_count = 0;
if (map.st.st_size == res->size && map.st.st_mtime == res->mtime) {
- info("rbldns %s up to date", file);
+ info("%s loaded: already up-to-date", file);
file_map_close(&map);
return true;
}
eol = end;
}
if (eol - p >= BUFSIZ) {
- err("unreasonnable long line");
+ err("%s not loaded: unreasonnable long line", file);
file_map_close(&map);
trie_delete(&res->trie1);
trie_delete(&res->trie2);
} else {
trie_delete(&res->trie2);
}
- info("rhbl %s loaded, %u hosts, %u domains", file, host_count, domain_count);
if (res->trie1 == NULL && res->trie2 == NULL) {
+ err("%s not loaded: no data found", file);
strlist_local_wipe(hosts);
return false;
}
+ info("%s loaded: done in %us, %u hosts, %u domains", file,
+ (uint32_t)(time(0) - now), host_count, domain_count);
return true;
}