The Samba-Bugzilla – Attachment 15204 Details for
Bug 13965
samba-tool dns uses strings, not bytes for inet_ntop
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for 4.10
4-10.patch (text/plain), 4.74 KB, created by
Douglas Bagnall
on 2019-05-29 14:54:36 UTC
(
hide
)
Description:
patch for 4.10
Filename:
MIME Type:
Creator:
Douglas Bagnall
Created:
2019-05-29 14:54:36 UTC
Size:
4.74 KB
patch
obsolete
>From 22d3b4a2bc51d34c21e47f65d64e674f3c70bad0 Mon Sep 17 00:00:00 2001 >From: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> >Date: Wed, 29 May 2019 13:38:12 +1200 >Subject: [PATCH 1/2] tests/samba-tool: test dns serverinfo/zoneinfo > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13965 > >Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> >Reviewed-by: Noel Power <npower@samba.org> >--- > python/samba/tests/samba_tool/dnscmd.py | 26 ++++++++++++++++++++++++++ > selftest/knownfail.d/sambatool-dns | 1 + > 2 files changed, 27 insertions(+) > create mode 100644 selftest/knownfail.d/sambatool-dns > >diff --git a/python/samba/tests/samba_tool/dnscmd.py b/python/samba/tests/samba_tool/dnscmd.py >index 5e882972f46..e1459fee9ac 100644 >--- a/python/samba/tests/samba_tool/dnscmd.py >+++ b/python/samba/tests/samba_tool/dnscmd.py >@@ -883,3 +883,29 @@ class DnsCmdTestCase(SambaToolCmdTest): > print(msg) > self.fail("Failed to accept valid commands. %d total failures." > "Errors above." % num_failures) >+ >+ def test_serverinfo(self): >+ for v in ['w2k', 'dotnet', 'longhorn']: >+ result, out, err = self.runsubcmd("dns", >+ "serverinfo", >+ "--client-version", v, >+ os.environ["SERVER"], >+ self.creds_string) >+ self.assertCmdSuccess(result, >+ out, >+ err, >+ "Failed to print serverinfo with " >+ "client version %s" % v) >+ self.assertTrue(out != '') >+ >+ def test_zoneinfo(self): >+ result, out, err = self.runsubcmd("dns", >+ "zoneinfo", >+ os.environ["SERVER"], >+ self.zone, >+ self.creds_string) >+ self.assertCmdSuccess(result, >+ out, >+ err, >+ "Failed to print zoneinfo") >+ self.assertTrue(out != '') >diff --git a/selftest/knownfail.d/sambatool-dns b/selftest/knownfail.d/sambatool-dns >new file mode 100644 >index 00000000000..382d740aa7c >--- /dev/null >+++ b/selftest/knownfail.d/sambatool-dns >@@ -0,0 +1 @@ >+samba.tests.samba_tool.dnscmd.samba.tests.samba_tool.dnscmd.DnsCmdTestCase.test_serverinfo >-- >2.11.0 > > >From a57548e736b23c6a86d79039f3ca6be4e53ffe17 Mon Sep 17 00:00:00 2001 >From: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> >Date: Fri, 24 May 2019 09:58:12 +1200 >Subject: [PATCH 2/2] samba-tool dns: use bytes for inet_ntop > >From Python's point of view, array.AddrArray is a list of byte-valued >integers. In Python 3 we can convert directly using the likes of > > bytes(array.AddrArray[i].MaxSa[8:24]) > >but in 4.10 we need to support both, so we use struct. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13965 > >Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> >Reviewed-by: Noel Power <npower@samba.org> > >Autobuild-User(master): Noel Power <npower@samba.org> >Autobuild-Date(master): Wed May 29 11:29:17 UTC 2019 on sn-devel-184 >--- > python/samba/netcmd/dns.py | 5 +++-- > selftest/knownfail.d/sambatool-dns | 1 - > 2 files changed, 3 insertions(+), 3 deletions(-) > delete mode 100644 selftest/knownfail.d/sambatool-dns > >diff --git a/python/samba/netcmd/dns.py b/python/samba/netcmd/dns.py >index b7459a71acd..d9fda0b93cd 100644 >--- a/python/samba/netcmd/dns.py >+++ b/python/samba/netcmd/dns.py >@@ -26,6 +26,7 @@ from socket import inet_ntop > from socket import AF_INET > from socket import AF_INET6 > import shlex >+import struct > > from samba import remove_dc > from samba.samdb import SamDB >@@ -153,10 +154,10 @@ def dns_addr_array_string(array): > return ret > for i in range(array.AddrCount): > if array.AddrArray[i].MaxSa[0] == 0x02: >- x = "".join([chr(b) for b in array.AddrArray[i].MaxSa])[4:8] >+ x = struct.pack('4B', *array.AddrArray[i].MaxSa[4:8]) > addr = inet_ntop(AF_INET, x) > elif array.AddrArray[i].MaxSa[0] == 0x17: >- x = "".join([chr(b) for b in array.AddrArray[i].MaxSa])[8:24] >+ x = struct.pack('16B', *array.AddrArray[i].MaxSa[8:24]) > addr = inet_ntop(AF_INET6, x) > else: > addr = 'UNKNOWN' >diff --git a/selftest/knownfail.d/sambatool-dns b/selftest/knownfail.d/sambatool-dns >deleted file mode 100644 >index 382d740aa7c..00000000000 >--- a/selftest/knownfail.d/sambatool-dns >+++ /dev/null >@@ -1 +0,0 @@ >-samba.tests.samba_tool.dnscmd.samba.tests.samba_tool.dnscmd.DnsCmdTestCase.test_serverinfo >-- >2.11.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
npower
:
review+
dbagnall
:
ci-passed+
Actions:
View
Attachments on
bug 13965
:
15188
|
15197
| 15204