The Samba-Bugzilla – Attachment 10450 Details for
Bug 10952
samba-tool dns serverinfo <server> is broken for IPv6 - also in mixed IPv4/IPv6 environments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
fix python related output
0002-fix-the-display-of-IPv4-and-IPv6-address-strings-in-.patch (text/plain), 2.13 KB, created by
Guenter Kukkukk
on 2014-11-23 03:50:31 UTC
(
hide
)
Description:
fix python related output
Filename:
MIME Type:
Creator:
Guenter Kukkukk
Created:
2014-11-23 03:50:31 UTC
Size:
2.13 KB
patch
obsolete
>From cc6d2927c12603fcda7e9bc47305b9ba690123f7 Mon Sep 17 00:00:00 2001 >From: Guenter Kukkukk <linux@kukkukk.com> >Date: Fri, 21 Nov 2014 03:55:25 +0100 >Subject: [PATCH 2/3] fix the display of IPv4 and IPv6 address-strings in > "samba-tool dns serverinfo <some_server>" > >Avoid hardcoded IP-strings, use standard python IP functions. > >I have removed the display of the port number. >MS-DNSP 2.2.3.2.2.1 DNS_ADDR: (from May 15, 2014) >Port Number (2bytes): Senders MUST set this to zero, and receivers MUST ignore >it. > >Signed-off-by: Guenter Kukkukk <linux@kukkukk.com> >--- > python/samba/netcmd/dns.py | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > >diff --git a/python/samba/netcmd/dns.py b/python/samba/netcmd/dns.py >index f46110a..3e48e97 100644 >--- a/python/samba/netcmd/dns.py >+++ b/python/samba/netcmd/dns.py >@@ -19,6 +19,9 @@ > import samba.getopt as options > from struct import pack > from socket import inet_ntoa >+from socket import inet_ntop >+from socket import AF_INET >+from socket import AF_INET6 > import shlex > > from samba.netcmd import ( >@@ -126,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 > >@@ -137,11 +140,11 @@ def dns_addr_array_string(array): > return ret > for i in xrange(array.AddrCount): > if array.AddrArray[i].MaxSa[0] == 0x02: >- addr = '%d.%d.%d.%d (%d)' % \ >- tuple(array.AddrArray[i].MaxSa[4:8] + [array.AddrArray[i].MaxSa[3]]) >+ x = "".join([chr(b) for b in array.AddrArray[i].MaxSa])[4:8] >+ addr = inet_ntop(AF_INET, x) > elif array.AddrArray[i].MaxSa[0] == 0x17: >- addr = '%x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x:%x%x (%d)' % \ >- tuple(array.AddrArray[i].MaxSa[4:20] + [array.AddrArray[i].MaxSa[3]]) >+ x = "".join([chr(b) for b in array.AddrArray[i].MaxSa])[8:24] >+ addr = inet_ntop(AF_INET6, x) > else: > addr = 'UNKNOWN' > ret.append(addr) >-- >1.8.4.5 >
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
Actions:
View
Attachments on
bug 10952
:
10449
|
10450
|
10451
|
10461
|
10462