Beispiel #1
0
    def test_update_add_null_padded_txt_record(self):
        "test adding records works"
        prefix, txt = 'pad1textrec', ['"This is a test"', '', '']
        p = self.make_txt_update(prefix, txt)
        response = self.dns_transaction_udp(p)
        self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
        self.check_query_txt(prefix, txt)
        self.assertIsNotNone(dns_record_match(self.rpc_conn, self.server_ip,
                             self.get_dns_domain(),
                             "%s.%s" % (prefix, self.get_dns_domain()),
                             dnsp.DNS_TYPE_TXT, '"\\"This is a test\\"" "" ""'))

        prefix, txt = 'pad2textrec', ['"This is a test"', '', '', 'more text']
        p = self.make_txt_update(prefix, txt)
        response = self.dns_transaction_udp(p)
        self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
        self.check_query_txt(prefix, txt)
        self.assertIsNotNone(dns_record_match(self.rpc_conn, self.server_ip,
                             self.get_dns_domain(),
                             "%s.%s" % (prefix, self.get_dns_domain()),
                             dnsp.DNS_TYPE_TXT, '"\\"This is a test\\"" "" "" "more text"'))

        prefix, txt = 'pad3textrec', ['', '', '"This is a test"']
        p = self.make_txt_update(prefix, txt)
        response = self.dns_transaction_udp(p)
        self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
        self.check_query_txt(prefix, txt)
        self.assertIsNotNone(dns_record_match(self.rpc_conn, self.server_ip,
                             self.get_dns_domain(),
                             "%s.%s" % (prefix, self.get_dns_domain()),
                             dnsp.DNS_TYPE_TXT, '"" "" "\\"This is a test\\""'))
Beispiel #2
0
 def test_update_add_empty_txt_records(self):
     "test adding two txt records works"
     prefix, txt = 'emptytextrec', []
     p = self.make_txt_update(prefix, txt)
     response = self.dns_transaction_udp(p)
     self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
     self.check_query_txt(prefix, txt)
     self.assertIsNotNone(dns_record_match(self.rpc_conn, self.server_ip,
                          self.get_dns_domain(),
                          "%s.%s" % (prefix, self.get_dns_domain()),
                          dnsp.DNS_TYPE_TXT, ''))
Beispiel #3
0
    def test_update_add_null_char_txt_record(self):
        "test adding records works"
        prefix, txt = 'nulltextrec', ['NULL\x00BYTE']
        p = self.make_txt_update(prefix, txt)
        response = self.dns_transaction_udp(p)
        self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
        self.check_query_txt(prefix, ['NULL'])
        self.assertIsNotNone(dns_record_match(self.rpc_conn, self.server_ip,
                             self.get_dns_domain(),
                             "%s.%s" % (prefix, self.get_dns_domain()),
                             dnsp.DNS_TYPE_TXT, '"NULL"'))

        prefix, txt = 'nulltextrec2', ['NULL\x00BYTE', 'NULL\x00BYTE']
        p = self.make_txt_update(prefix, txt)
        response = self.dns_transaction_udp(p)
        self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
        self.check_query_txt(prefix, ['NULL', 'NULL'])
        self.assertIsNotNone(dns_record_match(self.rpc_conn, self.server_ip,
                             self.get_dns_domain(),
                             "%s.%s" % (prefix, self.get_dns_domain()),
                             dnsp.DNS_TYPE_TXT, '"NULL" "NULL"'))
Beispiel #4
0
 def test_update_add_empty_txt_records(self):
     "test adding two txt records works"
     prefix, txt = 'emptytextrec', []
     p = self.make_txt_update(prefix, txt)
     response = self.dns_transaction_udp(p)
     self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
     self.check_query_txt(prefix, txt)
     self.assertIsNotNone(
         dns_record_match(self.rpc_conn, self.server_ip,
                          self.get_dns_domain(),
                          "%s.%s" % (prefix, self.get_dns_domain()),
                          dnsp.DNS_TYPE_TXT, ''))
Beispiel #5
0
 def test_update_add_two_txt_records(self):
     "test adding two txt records works"
     prefix, txt = 'textrec2', ['"This is a test"',
                                '"and this is a test, too"']
     p = self.make_txt_update(prefix, txt)
     response = self.dns_transaction_udp(p)
     self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
     self.check_query_txt(prefix, txt)
     self.assertIsNotNone(dns_record_match(self.rpc_conn, self.server_ip,
                          self.get_dns_domain(),
                          "%s.%s" % (prefix, self.get_dns_domain()),
                          dnsp.DNS_TYPE_TXT, '"\\"This is a test\\""' +
                          ' "\\"and this is a test, too\\""'))
Beispiel #6
0
 def test_update_add_two_txt_records(self):
     "test adding two txt records works"
     prefix, txt = 'textrec2', [
         '"This is a test"', '"and this is a test, too"'
     ]
     p = self.make_txt_update(prefix, txt)
     response = self.dns_transaction_udp(p)
     self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
     self.check_query_txt(prefix, txt)
     self.assertIsNotNone(
         dns_record_match(
             self.rpc_conn, self.server_ip, self.get_dns_domain(),
             "%s.%s" % (prefix, self.get_dns_domain()), dnsp.DNS_TYPE_TXT,
             '"\\"This is a test\\""' + ' "\\"and this is a test, too\\""'))
Beispiel #7
0
    def test_update_add_null_char_txt_record(self):
        "test adding records works"
        prefix, txt = 'nulltextrec', ['NULL\x00BYTE']
        p = self.make_txt_update(prefix, txt)
        response = self.dns_transaction_udp(p)
        self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
        self.check_query_txt(prefix, ['NULL'])
        self.assertIsNotNone(
            dns_record_match(self.rpc_conn, self.server_ip,
                             self.get_dns_domain(),
                             "%s.%s" % (prefix, self.get_dns_domain()),
                             dnsp.DNS_TYPE_TXT, '"NULL"'))

        prefix, txt = 'nulltextrec2', ['NULL\x00BYTE', 'NULL\x00BYTE']
        p = self.make_txt_update(prefix, txt)
        response = self.dns_transaction_udp(p)
        self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
        self.check_query_txt(prefix, ['NULL', 'NULL'])
        self.assertIsNotNone(
            dns_record_match(self.rpc_conn, self.server_ip,
                             self.get_dns_domain(),
                             "%s.%s" % (prefix, self.get_dns_domain()),
                             dnsp.DNS_TYPE_TXT, '"NULL" "NULL"'))
Beispiel #8
0
    def test_update_add_null_padded_txt_record(self):
        "test adding records works"
        prefix, txt = 'pad1textrec', ['"This is a test"', '', '']
        p = self.make_txt_update(prefix, txt)
        response = self.dns_transaction_udp(p)
        self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
        self.check_query_txt(prefix, txt)
        self.assertIsNotNone(
            dns_record_match(self.rpc_conn, self.server_ip,
                             self.get_dns_domain(),
                             "%s.%s" % (prefix, self.get_dns_domain()),
                             dnsp.DNS_TYPE_TXT,
                             '"\\"This is a test\\"" "" ""'))

        prefix, txt = 'pad2textrec', ['"This is a test"', '', '', 'more text']
        p = self.make_txt_update(prefix, txt)
        response = self.dns_transaction_udp(p)
        self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
        self.check_query_txt(prefix, txt)
        self.assertIsNotNone(
            dns_record_match(self.rpc_conn, self.server_ip,
                             self.get_dns_domain(),
                             "%s.%s" % (prefix, self.get_dns_domain()),
                             dnsp.DNS_TYPE_TXT,
                             '"\\"This is a test\\"" "" "" "more text"'))

        prefix, txt = 'pad3textrec', ['', '', '"This is a test"']
        p = self.make_txt_update(prefix, txt)
        response = self.dns_transaction_udp(p)
        self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
        self.check_query_txt(prefix, txt)
        self.assertIsNotNone(
            dns_record_match(self.rpc_conn, self.server_ip,
                             self.get_dns_domain(),
                             "%s.%s" % (prefix, self.get_dns_domain()),
                             dnsp.DNS_TYPE_TXT,
                             '"" "" "\\"This is a test\\""'))