1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-30 19:42:05 +03:00

s4:provision - use the new "interface_ips" python call to detect the right host IPv4 address

Inform the user when there are more possibilities (so he can check for the
right address and otherwise he is able to do an immediate reprovision) and no
possibility at all (then we fall back to the loopback address "127.0.0.1" - this
is thought for testing purposes).

I think this should be enough for closing bug #5484.
This commit is contained in:
Matthias Dieter Wallnöfer
2010-03-04 10:29:33 +01:00
parent 8a8c2de29f
commit af6f59468a

View File

@ -1182,14 +1182,14 @@ def provision(setup_dir, message, session_info,
paths.bind_gid = bind_gid paths.bind_gid = bind_gid
if hostip is None: if hostip is None:
try: hostips = glue.interface_ips(lp)
for ip in socket.getaddrinfo(names.hostname, None, socket.AF_INET, socket.AI_CANONNAME, socket.IPPROTO_IP): if len(hostips) == 0:
if hostip is None: message("No external IPv4 address has been found: I use the loopback.")
hostip = ip[-1][0] hostip = '127.0.0.1'
if hostip.startswith('127.0.0.') and (not ip[-1][0].startswith('127.0.0.')): else:
hostip = ip[-1][0] hostip = hostips[0]
except socket.gaierror, (socket.EAI_NODATA, msg): if len(hostips) > 1:
hostip = None message("More than one IPv4 address found: I use " + hostip + ".")
if hostip6 is None: if hostip6 is None:
try: try: