Bug 10952 - samba-tool dns serverinfo <server> is broken for IPv6 - also in mixed IPv4/IPv6 environments
Summary: samba-tool dns serverinfo <server> is broken for IPv6 - also in mixed IPv4/IP...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.0
Classification: Unclassified
Component: DCE-RPCs and pipes (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-23 03:04 UTC by Guenter Kukkukk
Modified: 2014-12-07 19:24 UTC (History)
2 users (show)

See Also:


Attachments
found this obvious one during testing (930 bytes, patch)
2014-11-23 03:44 UTC, Guenter Kukkukk
no flags Details
fix python related output (2.13 KB, patch)
2014-11-23 03:50 UTC, Guenter Kukkukk
no flags Details
fix all the missing C-related pieces (11.58 KB, patch)
2014-11-23 03:54 UTC, Guenter Kukkukk
no flags Details
patches for samba-4.2 (15.06 KB, patch)
2014-11-26 08:37 UTC, Amitay Isaacs
kukks: review+
Details
patches for samba-4.1 (15.06 KB, patch)
2014-11-26 08:37 UTC, Amitay Isaacs
kukks: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guenter Kukkukk 2014-11-23 03:04:43 UTC

    
Comment 1 Guenter Kukkukk 2014-11-23 03:37:10 UTC
Wrong output of IP-addresses when
   samba-tool dns serverinfo <some-server>
is used - and IPv6 only or a mixture of IPv4 and IPv6 is around.

The internal C-implementation of dns serverinfo
is limited to only support IPv4 atm - which then also affects
python tools like "samba-tool dns serverinfo <someserver>".

I've already prepared fixes and will post them here.

Cheers, Günter
Comment 2 Guenter Kukkukk 2014-11-23 03:44:25 UTC
Created attachment 10449 [details]
found this obvious one during testing

i add this obvious enum typo here - is not worth
a separate bug
Comment 3 Guenter Kukkukk 2014-11-23 03:50:31 UTC
Created attachment 10450 [details]
fix python related output
Comment 4 Guenter Kukkukk 2014-11-23 03:54:13 UTC
Created attachment 10451 [details]
fix all the missing C-related pieces
Comment 5 Guenter Kukkukk 2014-11-24 01:29:35 UTC
Just for documentation purpose, i add 2 examples of wrong output.
Both C and python are affected.
At the bottom 2 fixed examples.

In a mixed IPv6 / IPv4 environment wrong output of IPv4:

samba-tool dns serverinfo li4771-131
  dwVersion                   : 0xece0205
  fBootMethod                 : DNS_BOOT_METHOD_DIRECTORY
  fAdminConfigured            : FALSE
  fAllowUpdate                : TRUE
  fDsAvailable                : TRUE
  pszServerName               : LI4771-131.addlz.kukkukk.com
  pszDsContainer              : CN=MicrosoftDNS,DC=DomainDnsZones,DC=addlz,DC=kukkukk,DC=com
  aipServerAddrs              : ['255.255.255.255 (53)', '255.255.255.255 (53)', '255.255.255.255 (53)', '255.255.255.255 (53)']
  aipListenAddrs              : ['255.255.255.255 (53)', '255.255.255.255 (53)', '255.255.255.255 (53)', '255.255.255.255 (53)']
  aipForwarders               : []
--------------------

In the following sample the IPv6 addresses are displayed wrong:

samba-tool dns serverinfo li131
  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              : ['00:00:00:00:00:00:00:00 (0)', '127.0.0.1 (0)', '192.168.200.72 (0)', '00:00:fd4d:e013:bb96:a6c:00:00 (0)']
  aipListenAddrs              : ['00:00:00:00:00:00:00:00 (0)', '127.0.0.1 (0)', '192.168.200.72 (0)', '00:00:fd4d:e013:bb96:a6c:00:00 (0)']
  aipForwarders               : []
-------

The attached patches fix this:

samba-tool dns serverinfo li131 --client-version=w2k
  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              : ['127.0.0.1', '192.168.200.72']
  aipListenAddrs              : ['127.0.0.1', '192.168.200.72']

-----------------------

  samba-tool dns serverinfo li131 --client-version=longhorn
  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              : ['::1', '127.0.0.1', '192.168.200.72', 'fd4d:e013:bb96:a60c::48']
  aipListenAddrs              : ['::1', '127.0.0.1', '192.168.200.72', 'fd4d:e013:bb96:a60c::48']
  aipForwarders               : []

Cheers,  Günter
Comment 6 Guenter Kukkukk 2014-11-26 04:01:04 UTC
Comment on attachment 10449 [details]
found this obvious one during testing

 From 4bda589c8e68cd66ca3b0ea9496cb1b11febcae6 Mon Sep 17 00:00:00 2001
From: Guenter Kukkukk <linux@kukkukk.com>
Date: Fri, 21 Nov 2014 03:40:17 +0100
Subject: [PATCH 1/3] samba-tool: Fix enum values in dns.py

DNS_ZONE_UPDATE_SECURE was used twice, DNS_ZONE_UPDATE_UNSECURE was missing.

Signed-off-by: Guenter Kukkukk <linux@kukkukk.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
---
 python/samba/netcmd/dns.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/samba/netcmd/dns.py b/python/samba/netcmd/dns.py
index de0c94d..775be9e 100644
--- a/python/samba/netcmd/dns.py
+++ b/python/samba/netcmd/dns.py
@@ -89,7 +89,7 @@ def zone_type_string(zone_type):
 
 
 def zone_update_string(zone_update):
-    enum_defs = [ 'DNS_ZONE_UPDATE_OFF', 'DNS_ZONE_UPDATE_SECURE',
+    enum_defs = [ 'DNS_ZONE_UPDATE_OFF', 'DNS_ZONE_UPDATE_UNSECURE',
                     'DNS_ZONE_UPDATE_SECURE' ]
     return enum_string(dnsp, enum_defs, zone_update)
Comment 7 Amitay Isaacs 2014-11-26 08:37:30 UTC
Created attachment 10461 [details]
patches for samba-4.2
Comment 8 Amitay Isaacs 2014-11-26 08:37:58 UTC
Created attachment 10462 [details]
patches for samba-4.1
Comment 9 Amitay Isaacs 2014-11-27 11:13:15 UTC
Hi Karolin,

Please push the patches to 4.1/4.2.

Amitay.
Comment 10 Karolin Seeger 2014-12-03 20:04:47 UTC
(In reply to Amitay Isaacs from comment #9)
Pushed to autobuild-v4-[1|2]-test.
Comment 11 Karolin Seeger 2014-12-07 19:24:27 UTC
(In reply to Karolin Seeger from comment #10)
Pushed to both branches.
Closing out bug report.

Thanks!