1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-29 10:56:37 +02:00

Various small UnrealDB fixes

This commit is contained in:
Bram Matthys
2021-05-04 08:36:45 +02:00
parent 576f8b1aae
commit 282162b4aa
2 changed files with 7 additions and 1 deletions
+1
View File
@@ -522,6 +522,7 @@ int reputation_load_db_new(UnrealDB *db)
e->score = score;
e->last_seen = last_seen;
add_reputation_entry(e);
safe_free(ip);
}
unrealdb_close(db);
#ifdef BENCHMARK
+6 -1
View File
@@ -234,7 +234,7 @@ UnrealDB *unrealdb_open(const char *filename, UnrealDBMode mode, char *secret_bl
secr = find_secret(secret_block);
if (!secr)
{
unrealdb_set_error(c, UNREALDB_ERROR_SECRET, "Secret block '%s' not found or invalid", secr->name);
unrealdb_set_error(c, UNREALDB_ERROR_SECRET, "Secret block '%s' not found or invalid", secret_block);
goto unrealdb_open_fail;
}
@@ -379,6 +379,11 @@ UnrealDB *unrealdb_open(const char *filename, UnrealDBMode mode, char *secret_bl
unrealdb_set_error(c, UNREALDB_ERROR_HEADER, "Header contains unknown cipher 0x%x", (int)c->config->cipher);
goto unrealdb_open_fail;
}
if (c->config->keylen > 1024)
{
unrealdb_set_error(c, UNREALDB_ERROR_HEADER, "Header is corrupt (keylen=%d)", (int)c->config->keylen);
goto unrealdb_open_fail; /* Something must be wrong, this makes no sense. */
}
c->config->key = safe_alloc_sensitive(c->config->keylen);
dbcache = find_secret_cache(secr, c->config);