[Samba] samba-tool dns serverinfo
Günter Kukkukk
linux at kukkukk.com
Wed Nov 12 22:07:43 MST 2014
Am 13.11.2014 um 04:49 schrieb Günter Kukkukk:
> Am 12.11.2014 um 23:58 schrieb Günter Kukkukk:
> SNIP - dropped a lot here
>
> to get rid of
> uncaught exception - 'i' format requires -2147483648 <= number <= 2147483647
> in
>
>>
>>
>> pszDsContainer : CN=MicrosoftDNS,DC=DomainDnsZones,DC=addlz,DC=kukkukk,DC=com
>> ERROR(<class 'struct.error'>): uncaught exception - 'i' format requires -2147483648 <= number <= 2147483647
>> File "/usr/local/samba/lib64/python2.7/site-packages/samba/netcmd/__init__.py", line 175, in _run
>> return self.run(*args, **kwargs)
>> File "/usr/local/samba/lib64/python2.7/site-packages/samba/netcmd/dns.py", line 709, in run
>> print_serverinfo(self.outf, typeid, res)
>> File "/usr/local/samba/lib64/python2.7/site-packages/samba/netcmd/dns.py", line 202, in print_serverinfo
>> ip4_array_string(serverinfo.aipServerAddrs))
>> File "/usr/local/samba/lib64/python2.7/site-packages/samba/netcmd/dns.py", line 129, in ip4_array_string
>> addr = '%s' % inet_ntoa(pack('i', array.AddrArray[i]))
>
> a simple python format specifier had to be changed from
> "i" signed int to
> "I" unsigned int
>
> The problem behind this is, that an IP of 255.255.255.255 (0xffffffff) would
> be treated as invalid signed int here!
>
> So with some cleanup to also use inet_ntop(), an intermediate patch
> would be:
>
> diff --git a/python/samba/netcmd/dns.py b/python/samba/netcmd/dns.py
> index e26ddd1..3e48e97 100644
> --- a/python/samba/netcmd/dns.py
> +++ b/python/samba/netcmd/dns.py
> @@ -129,7 +129,7 @@ def ip4_array_string(array):
> if not array:
> return ret
> for i in xrange(array.AddrCount):
> - addr = '%s' % inet_ntoa(pack('i', array.AddrArray[i]))
> + addr = inet_ntop(AF_INET, pack('I', array.AddrArray[i]))
> ret.append(addr)
> return ret
> -------------
>
> This leads to a *new* - now not failing - output:
> samba-tool dns serverinfo li131 --client-version=dotnet
> dwVersion : 0xece0205
> fBootMethod : DNS_BOOT_METHOD_DIRECTORY
> fAdminConfigured : FALSE
> fAllowUpdate : TRUE
> fDsAvailable : TRUE
> pszServerName : LI131.addlz.kukkukk.com
> pszDsContainer : CN=MicrosoftDNS,DC=DomainDnsZones,DC=addlz,DC=kukkukk,DC=com
> aipServerAddrs : ['255.255.255.255', '127.0.0.1', '192.168.200.72', '255.255.255.255']
> aipListenAddrs : ['255.255.255.255', '127.0.0.1', '192.168.200.72', '255.255.255.255']
> aipForwarders : []
>
> Not bad now! :-)
> The very first passed IP '255.255.255.255' was the culprit to bail out here very early.
>
> BUT - why is samba passing such IP addresses here?
>
> Some other (C-) function - which collects the IPs from the interface list - must
> be doing wrong. Probably IPv6 is not handled correctly there.
>
> So i'll look further into that...
>
> Cheers, Günter
>
ok, at least found the culprit for all this strange behavior ....
./source4/rpc_server/dnsserver/dnsdata.c
Here are the missing pieces .... !!!
O_o that looks not really easy - i always had problems regarding the
interface list samba identifies - and actually uses then.
smb.conf options
interfaces = .....
bind interfaces only = ....
Must have a really DEEPER look at that current API.
Btw - Microsoft servers allow to *dynamically* change the bound addresses.
Cheers, Günter
--
More information about the samba
mailing list