]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Prevent Lua bindings for backend from crashing on empty backend 15774/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 20 Jun 2025 12:06:22 +0000 (14:06 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 2 Jul 2025 13:59:43 +0000 (15:59 +0200)
commit8e0e3a8306cc393fa18094332d660857170ba0f8
tree3a151d1b472945fe12f6c59c10559c75a7c17b99
parent92e5c645f2fb8e700020c7eecd054e502f767acf
dnsdist: Prevent Lua bindings for backend from crashing on empty backend

We currently return an empty `std::shared_ptr` when the backend is not
set (self-answered response, for example), and unfortunately LuaWrapper
is not smart enough to make that equivalent to `nil`, so testing whether
the backend is valid from Lua is not possible. While I would prefer to
fix that, this fix prevents us from crashing when calling the bindings
associated to a backend with an empty shared pointer.

Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
(cherry picked from commit a12bea636790a3be73516a2a24af1a8351c016c5)
pdns/dnsdistdist/dnsdist-lua-bindings.cc