The internal DNS server misses the code to handle MX queries, but supports MX updates.
Created attachment 8314 [details] Implement MX query support
Should this one be included in the final release or does the first bugfix release make more sense?
Comment on attachment 8314 [details] Implement MX query support It fails autobuild with: [1407/1555 in 1h10m10s] samba.tests.dns(fl2003dc) UNEXPECTED(failure): samba.tests.dns.TestDNSUpdates.test_update_add_mx_record REASON: _StringException: Content-Type: text/x-traceback;charset=utf8,language=python traceback 127 Traceback (most recent call last): File "/memdisk/mat/a/b899184/samba/bin/python/samba/tests/dns.py", line 553, in test_update_add_mx_record self.assertEqual(response.answers[0].rdata.exchange, 'mail.%s' % self.get_dns_domain()) MismatchError: '@\xc74\x02' != 'mail.samba2003.example.com' 0 FAILED (1 failures, 0 errors and 0 unexpected successes in 0 testsuites) A summary with detailed information can be found in: ./bin/ab/summary ERROR: test failed with exit code 1
I still don't understand what's going on there. No garbage in that piece of memory on my system. :(
Created attachment 8767 [details] Fix for dns tests
With the attached patch (Fix for dns tests) all the DNS tests now pass.
Here on a 32Bit system, it's _not_ fixed! (i'm using Amitay's recent patch) I'm not sure whether 32 vs 64 Bit plays a role here. Kai has added some ndrdump/hexdump features - see latest commits in: https://git.samba.org/?p=kai/samba.git;a=shortlog;h=refs/heads/master When using it, i get: make test TESTS=samba.tests.dns .... samba: EOF on stdin - terminating dns_name_packet: struct dns_name_packet id : 0x2a06 (10758) operation : 0x2800 (10240) 0x00: DNS_RCODE (0) 0: DNS_FLAG_BROADCAST 0: DNS_FLAG_RECURSION_AVAIL 0: DNS_FLAG_RECURSION_DESIRED 0: DNS_FLAG_TRUNCATION 0: DNS_FLAG_AUTHORITATIVE 0x05: DNS_OPCODE (5) 0: DNS_FLAG_REPLY qdcount : 0x0001 (1) ancount : 0x0000 (0) nscount : 0x0001 (1) arcount : 0x0000 (0) questions: ARRAY(1) questions: struct dns_name_question name : 'samba2003.example.com' question_type : DNS_QTYPE_SOA (0x6) question_class : DNS_QCLASS_IN (0x1) answers: ARRAY(0) nsrecs: ARRAY(1) nsrecs: struct dns_res_rec name : 'samba2003.example.com' rr_type : DNS_QTYPE_MX (0xF) rr_class : DNS_QCLASS_IN (0x1) ttl : 0x00000384 (900) length : 0xffff (65535) rdata : union dns_rdata(case 0xF) mx_record: struct dns_mx_record preference : 0x000a (10) exchange : '' unexpected : DATA_BLOB length=0 additional: ARRAY(0) 0000 2A 06 28 00 00 01 00 00 *.(..... 0008 00 01 00 00 09 73 61 6D .....sam 0010 62 61 32 30 30 33 07 65 ba2003.e 0018 78 61 6D 70 6C 65 03 63 xample.c 0020 6F 6D 00 00 06 00 01 C0 om...... 0028 0C 00 0F 00 01 00 00 03 ........ 0030 84 00 05 00 0A 01 03 00 ........ 0000 2A 06 A8 00 00 01 00 00 *....... 0008 00 01 00 00 09 73 61 6D .....sam 0010 62 61 32 30 30 33 07 65 ba2003.e 0018 78 61 6D 70 6C 65 03 63 xample.c 0020 6F 6D 00 00 06 00 01 C0 om...... 0028 0C 00 0F 00 01 00 00 03 ........ 0030 84 00 05 00 0A 01 03 00 ........ dns_name_packet: struct dns_name_packet id : 0x2a06 (10758) operation : 0xa800 (43008) 0x00: DNS_RCODE (0) 0: DNS_FLAG_BROADCAST 0: DNS_FLAG_RECURSION_AVAIL 0: DNS_FLAG_RECURSION_DESIRED 0: DNS_FLAG_TRUNCATION 0: DNS_FLAG_AUTHORITATIVE 0x05: DNS_OPCODE (5) 1: DNS_FLAG_REPLY qdcount : 0x0001 (1) ancount : 0x0000 (0) nscount : 0x0001 (1) arcount : 0x0000 (0) questions: ARRAY(1) questions: struct dns_name_question name : 'samba2003.example.com' question_type : DNS_QTYPE_SOA (0x6) question_class : DNS_QCLASS_IN (0x1) answers: ARRAY(0) nsrecs: ARRAY(1) nsrecs: struct dns_res_rec name : 'samba2003.example.com' rr_type : DNS_QTYPE_MX (0xF) rr_class : DNS_QCLASS_IN (0x1) ttl : 0x00000384 (900) length : 0x0005 (5) rdata : union dns_rdata(case 0xF) mx_record: struct dns_mx_record preference : 0x000a (10) exchange : '' unexpected : DATA_BLOB length=0 additional: ARRAY(0) ........ Traceback (most recent call last): File "/home/gk/samba/master/bin/python/samba/tests/dns.py", line 583, in test_update_add_mx_record self.assertEqual(ans.rdata.exchange, 'mail.%s.' % self.get_dns_domain()) MismatchError: '\x03' != 'mail.samba2003.example.com.' ----- The "exchange" string is just random here... Is it an IDL/ndr problem? (using 32 vs 64 Bit) ? I'll also dig deeper.... Cheers, Günter (btw - i've modified dns.py - so line numbers cannot match ..)
(In reply to comment #6) > With the attached patch (Fix for dns tests) all the DNS tests now pass. I'm not quite sure how that actually fixes the "garbage in memory" problem. I've never seen a test fail because None was returned from the dns_transaction_udp() function.
Sorry, that was a false alarm. Apparently it's the debug statements which I added, that made the test work. Go figure! :) And worst thing is if I remove any of those statements the tests fail. (Of course I haven't tried all permutations, but it's definitely weird.) --- a/python/samba/tests/dns.py +++ b/python/samba/tests/dns.py @@ -547,6 +547,10 @@ class TestDNSUpdates(DNSTest): self.finish_name_packet(p, questions) response = self.dns_transaction_udp(p) + print response + print dir(response) + print response.answers + print dir(response.answers) self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK) self.assertEqual(response.ancount, 1) self.assertEqual(response.answers[0].rdata.preference, 10) I have had some problems when working with python NDR generated code. Specially when trying to set string values for C strings from python. As soon as the python variable went out of scope, the memory got corrupted. May be it's a similar issue. I had to maintain a copy of the string as long as the C structure was in use.
Amitay, your comment in our 2nd dns.py (here more samba-tool related): - python/samba/netcmd/dns.py .... # # Always create a copy of strings when creating DNS_RPC_RECORDs # to overcome the bug in pidl generated python bindings. # .... should have already "ring some bells" to other developers. Here python code is implementing some "kind of workaround", not solving the real problem ... Back to - python/samba/tests/dns.py when adding some debug info: .... r.rdata = dns.mx_record() r.rdata.preference = 10 r.rdata.exchange = 'mail.%s.' % self.get_dns_domain() print 'GK0: "%s"' % r.rdata.exchange updates.append(r) print 'GK1: "%s"' % r.rdata.exchange p.nscount = len(updates) p.nsrecs = updates print 'GK2: "%s"' % r.rdata.exchange print ndr.ndr_print(p) print 'GK3: "%s"' % r.rdata.exchange response = self.dns_transaction_udp(p, dump=True) .... result: GK0: "mail.samba2003.example.com." GK1: "mail.samba2003.example.com." GK2: "mail.samba2003.example.com." dns_name_packet: struct dns_name_packet id : 0x8c31 (35889) .... snip nsrecs: ARRAY(1) nsrecs: struct dns_res_rec name : 'samba2003.example.com' rr_type : DNS_QTYPE_MX (0xF) rr_class : DNS_QCLASS_IN (0x1) ttl : 0x00000384 (900) length : 0xffff (65535) rdata : union dns_rdata(case 0xF) mx_record: struct dns_mx_record preference : 0x000a (10) exchange : '' unexpected : DATA_BLOB length=0 additional: ARRAY(0) GK3: "" <--- already corrupted here! .... librpc/ndr/ndr_dns.* might play some role here. ... or some related python bindings ? I'm still debugging this one... Cheers, Günter
All I can say is "that the python string used here looks like random", any new python (debug) statement just changes it.... Jelmer noted, that https://bugzilla.samba.org/show_bug.cgi?id=7902 might be related here. The MX query fix is out since December 2012, but due to this not working testcase it isn't applied. What can we do here ? Cheers, Günter
Created attachment 8903 [details] Updated patch adding MX support, for v4-0-test Here's the updated patch that still fixes the issue and also passes the test
Karolin, please pick this for next release.
Pushed to autobuild-v4-0-test.
Pushed to v4-0-test. Closing out bug report. Thanks!
*** Bug 9958 has been marked as a duplicate of this bug. ***