samba-tool dns: Don't use "localhost" to connect to local host
authorKai Blin <kai@samba.org>
Wed, 14 Nov 2012 10:32:06 +0000 (11:32 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 16 Nov 2012 12:18:14 +0000 (13:18 +0100)
Calling "samba-tool dns <cmd> localhost" provokes a stacktrace.

This just makes 'samba-tool dns <cmd> localhost' work and doesn't fix
the underlying issue, but I don't see it causing any harm (unless you
don't have an ipv4 localhost, I guess).

Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Nov 16 13:18:14 CET 2012 on sn-devel-104

source4/scripting/python/samba/netcmd/dns.py

index 8bd3249ae231a175949f7ba5cf777bfe33f1ff33..c00d17ad7273c1919ab99378277d1377a01b6dbc 100644 (file)
@@ -31,6 +31,8 @@ from samba.dcerpc import dnsp, dnsserver
 
 
 def dns_connect(server, lp, creds):
+    if server.lower() == 'localhost':
+        server = '127.0.0.1'
     binding_str = "ncacn_ip_tcp:%s[sign]" % server
     dns_conn = dnsserver.dnsserver(binding_str, lp, creds)
     return dns_conn