]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Prevent users from opening the same LMDB twice 15777/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 27 Jun 2025 14:37:46 +0000 (16:37 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 2 Jul 2025 14:09:31 +0000 (16:09 +0200)
commit947f768b5267dafeb55709b4659449c957e9b3a1
treefc0fdcf6e0a085d3cb90ff6379b86af080afcae1
parent92e5c645f2fb8e700020c7eecd054e502f767acf
dnsdist: Prevent users from opening the same LMDB twice

As noted by Peter: "LMBD requires that database is opened
exactly once per process. Opening multiple times breaks file
locks silently, which leads to corrupting the database."

While I don't expect users to actually do that, we already have
a nice helper function to prevent this mistake in the lmdb-safe
code base, so let's use it.

Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
(cherry picked from commit 0cfa000e3f7a47c96a3129d5ef27ce13022707f6)
pdns/dnsdistdist/dnsdist-kvs.cc
pdns/dnsdistdist/dnsdist-kvs.hh