Crash in IBDNS.Server.Catalog if request sent to server without zones loaded
Suppose one has defined a virtual server in the configuration file, but no zone is served by that server.
Then, any request sent to it should (normally) result in an empty response with RCODE REFUSED.
Instead, a crash happens (here, the server is called no-zones
and an NS query for ./IN
was sent to it):
** (exit) exited in: GenServer.call(IBDNS.Server.Catalog, {:processing_and_defects, :query, "no-zones", IBDNS.Name.root(), :in}, 5000)
** (EXIT) an exception was raised:
** (KeyError) key "no-zones" not found in: %{"testing" => %{chaos: IBDNS.Catalog.new(%{"chaos.test" => IBDNS.DNSTestCase.Zones.Test}), in: IBDNS.Catalog.new(%{"crash.test" => IBDNS.DNSTestCase.Zones.Test, "inconsistent-data.test" => IBDNS.Zone.FileDatabase, "test" => IBDNS.Zone.FileDatabase})}, "testing-2" => %{in: IBDNS.Catalog.new(%{"inconsistent-data.test" => IBDNS.Zone.FileDatabase, "test" => IBDNS.Zone.FileDatabase})}}
(erts 13.0.4) :erlang.map_get("no-zones", %{"testing" => %{chaos: IBDNS.Catalog.new(%{"chaos.test" => IBDNS.DNSTestCase.Zones.Test}), in: IBDNS.Catalog.new(%{"crash.test" => IBDNS.DNSTestCase.Zones.Test, "inconsistent-data.test" => IBDNS.Zone.FileDatabase, "test" => IBDNS.Zone.FileDatabase})}, "testing-2" => %{in: IBDNS.Catalog.new(%{"inconsistent-data.test" => IBDNS.Zone.FileDatabase, "test" => IBDNS.Zone.FileDatabase})}})
(ibdns 0.3.3) lib/ibdns/server/catalog.ex:136: IBDNS.Server.Catalog.find_zone_module/4
(ibdns 0.3.3) lib/ibdns/server/catalog.ex:72: IBDNS.Server.Catalog.handle_call/3
(stdlib 4.0.1) gen_server.erl:1146: :gen_server.try_handle_call/4
(stdlib 4.0.1) gen_server.erl:1175: :gen_server.handle_msg/6
(stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Repeatedly sending queries to a server configured this way could end up causing it to shutdown completely.