]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Prevent users from opening the same LMDB twice 15738/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 27 Jun 2025 14:37:46 +0000 (16:37 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 27 Jun 2025 14:37:46 +0000 (16:37 +0200)
commit0cfa000e3f7a47c96a3129d5ef27ce13022707f6
tree21c2a88b8f8d8f1e45e697c28dd3bdb69d15cac5
parenta44ba546fcaac31496ce67dcbf580e1b5804d4e0
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>
pdns/dnsdistdist/dnsdist-kvs.cc
pdns/dnsdistdist/dnsdist-kvs.hh