diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-11 22:23:34 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:49:37 +0100 |
commit | fc88ba4a7efe36b0db6a39f58eb5af2c8cba9b9c (patch) | |
tree | 10d481e5e07564f83af8ee8d0000f4578c34aa52 /source4/lib/socket/interface.c | |
parent | c64c571591170478eead416216523c21e29a19ec (diff) | |
download | samba-fc88ba4a7efe36b0db6a39f58eb5af2c8cba9b9c.tar.gz samba-fc88ba4a7efe36b0db6a39f58eb5af2c8cba9b9c.tar.bz2 samba-fc88ba4a7efe36b0db6a39f58eb5af2c8cba9b9c.zip |
r26406: Make a copy to prevent modification of the loadparm configuration.
(This used to be commit c0f2775fd8bd88aad3497d59a7857d7a8a0978c5)
Diffstat (limited to 'source4/lib/socket/interface.c')
-rw-r--r-- | source4/lib/socket/interface.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c index 241fcbff5e..c327f02bbd 100644 --- a/source4/lib/socket/interface.c +++ b/source4/lib/socket/interface.c @@ -118,6 +118,7 @@ static void interpret_interface(TALLOC_CTX *mem_ctx, { struct in_addr ip, nmask; char *p; + char *address; int i, added=0; ip.s_addr = 0; @@ -154,10 +155,13 @@ static void interpret_interface(TALLOC_CTX *mem_ctx, return; } + address = talloc_strdup(mem_ctx, token); + p = strchr_m(address,'/'); + /* parse it into an IP address/netmasklength pair */ *p++ = 0; - ip.s_addr = interpret_addr2(token).s_addr; + ip.s_addr = interpret_addr2(address).s_addr; if (strlen(p) > 2) { nmask.s_addr = interpret_addr2(p).s_addr; @@ -172,14 +176,17 @@ static void interpret_interface(TALLOC_CTX *mem_ctx, if (same_net(ip, probed_ifaces[i].ip, nmask)) { add_interface(mem_ctx, probed_ifaces[i].ip, nmask, local_interfaces); + talloc_free(address); return; } } - DEBUG(2,("Can't determine ip for broadcast address %s\n", token)); + DEBUG(2,("Can't determine ip for broadcast address %s\n", address)); + talloc_free(address); return; } add_interface(mem_ctx, ip, nmask, local_interfaces); + talloc_free(address); } |