Hello, I'm using the internal DNS server and when running the command 'samba-tool dns serverinfo dc1 -U administrator' I get the following output. @dc1:~# samba-tool dns serverinfo dc1.domain.local -U administrator Password for [DOMAIN\administrator]: dwVersion : 0xece0205 fBootMethod : DNS_BOOT_METHOD_DIRECTORY fAdminConfigured : FALSE fAllowUpdate : TRUE fDsAvailable : TRUE pszServerName : DC1.domain.local pszDsContainer : CN=MicrosoftDNS,DC=DomainDnsZones,DC=domain,DC=local ERROR(<class 'TypeError'>): uncaught exception - a bytes-like object is required, not 'str' File "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/__init__.py", line 185, in _run return self.run(*args, **kwargs) File "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/dns.py", line 564, in run print_serverinfo(self.outf, typeid, res) File "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/dns.py", line 225, in print_serverinfo dns_addr_array_string(serverinfo.aipServerAddrs)) File "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/dns.py", line 157, in dns_addr_array_string addr = inet_ntop(AF_INET, x) I'm not experiencing any DNS issues so I believe this may be a bug with the move to python3 Am I correct? Ubuntu 16.04, samba 4.10.3. Thanks. -James
Douglas Bagnall
2019-May-23 22:25 UTC
[Samba] samba-tool dns serverinfo command throws error
hi James,> @dc1:~# samba-tool dns serverinfo dc1.domain.local -U administrator > Password for [DOMAIN\administrator]: > dwVersion : 0xece0205 > fBootMethod : DNS_BOOT_METHOD_DIRECTORY > fAdminConfigured : FALSE > fAllowUpdate : TRUE > fDsAvailable : TRUE > pszServerName : DC1.domain.local > pszDsContainer : > CN=MicrosoftDNS,DC=DomainDnsZones,DC=domain,DC=local > ERROR(<class 'TypeError'>): uncaught exception - a bytes-like object is > required, not 'str' > File > "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/__init__.py", > line 185, in _run > return self.run(*args, **kwargs) > File > "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/dns.py", line > 564, in run > print_serverinfo(self.outf, typeid, res) > File > "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/dns.py", line > 225, in print_serverinfo > dns_addr_array_string(serverinfo.aipServerAddrs)) > File > "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/dns.py", line > 157, in dns_addr_array_string > addr = inet_ntop(AF_INET, x) > > I'm not experiencing any DNS issues so I believe this may be a bug with > the move to python3 Am I correct?Yes, you are very likely correct. Does the attached patch help? If you can confirm this at https://bugzilla.samba.org/show_bug.cgi?id=13965 it can get into the next 4.10 release. Douglas -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-samba-tool-dns-use-bytes-for-inet_ntop.patch Type: text/x-patch Size: 1363 bytes Desc: not available URL: <http://lists.samba.org/pipermail/samba/attachments/20190524/ded8cd93/0001-samba-tool-dns-use-bytes-for-inet_ntop.bin>
On 5/23/2019 6:25 PM, Douglas Bagnall wrote:> hi James, > >> @dc1:~# samba-tool dns serverinfo dc1.domain.local -U administrator >> Password for [DOMAIN\administrator]: >> dwVersion : 0xece0205 >> fBootMethod : DNS_BOOT_METHOD_DIRECTORY >> fAdminConfigured : FALSE >> fAllowUpdate : TRUE >> fDsAvailable : TRUE >> pszServerName : DC1.domain.local >> pszDsContainer : >> CN=MicrosoftDNS,DC=DomainDnsZones,DC=domain,DC=local >> ERROR(<class 'TypeError'>): uncaught exception - a bytes-like object is >> required, not 'str' >> File >> "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/__init__.py", >> line 185, in _run >> return self.run(*args, **kwargs) >> File >> "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/dns.py", line >> 564, in run >> print_serverinfo(self.outf, typeid, res) >> File >> "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/dns.py", line >> 225, in print_serverinfo >> dns_addr_array_string(serverinfo.aipServerAddrs)) >> File >> "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/dns.py", line >> 157, in dns_addr_array_string >> addr = inet_ntop(AF_INET, x) >> >> I'm not experiencing any DNS issues so I believe this may be a bug with >> the move to python3 Am I correct? > Yes, you are very likely correct. > > Does the attached patch help? > > If you can confirm this at > https://bugzilla.samba.org/show_bug.cgi?id=13965 > it can get into the next 4.10 release. > > DouglasDouglas, Now I get the following error with the patch applied. samba-tool dns serverinfo dc2 -U administrator Password for [DOMAIN\administrator]: dwVersion : 0xece0205 fBootMethod : DNS_BOOT_METHOD_DIRECTORY fAdminConfigured : FALSE fAllowUpdate : TRUE fDsAvailable : TRUE pszServerName : DC2.domain.local pszDsContainer : CN=MicrosoftDNS,DC=DomainDnsZones,DC=domain,DC=local ERROR(<class 'TypeError'>): uncaught exception - string argument without an encoding File "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/__init__.py", line 185, in _run return self.run(*args, **kwargs) File "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/dns.py", line 567, in run print_serverinfo(self.outf, typeid, res) File "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/dns.py", line 228, in print_serverinfo dns_addr_array_string(serverinfo.aipServerAddrs)) File "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/dns.py", line 159, in dns_addr_array_string x = b"".join(bytes(chr(b)) for b in array.AddrArray[i].MaxSa)[4:8] File "/usr/local/samba/lib/python3.5/site-packages/samba/netcmd/dns.py", line 159, in <genexpr> x = b"".join(bytes(chr(b)) for b in array.AddrArray[i].MaxSa)[4:8]