Home | History | Annotate | Line # | Download | only in rpz
      1 #!/usr/bin/python3
      2 
      3 # Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      4 #
      5 # SPDX-License-Identifier: MPL-2.0
      6 #
      7 # This Source Code Form is subject to the terms of the Mozilla Public
      8 # License, v. 2.0.  If a copy of the MPL was not distributed with this
      9 # file, you can obtain one at https://mozilla.org/MPL/2.0/.
     10 #
     11 # See the COPYRIGHT file distributed with this work for additional
     12 # information regarding copyright ownership.
     13 
     14 from isctest.instance import NamedInstance
     15 
     16 
     17 def test_rpz_out_of_zone_owner_name(ns3: NamedInstance) -> None:
     18     """
     19     ns3 loads a policy zone holding "com.", whose two labels are fewer than
     20     the three of the "outofzone.tld2." origin that gets stripped from an
     21     owner name to build the trigger name.  That used to underflow an
     22     unsigned label count and fail an assertion, taking named down as the
     23     policy zone was loaded - so reaching this test at all is most of the
     24     check.
     25     """
     26     assert 'invalid rpz owner name "com"; not within the policy zone' in ns3.log
     27 
     28     # Only the record above was dropped; the rest of the zone still loads.
     29     assert (
     30         "rpz: outofzone.tld2: adding node never-queried.example.outofzone.tld2"
     31         in ns3.log
     32     )
     33