summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-06-24 23:27:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:03 -0500
commitaf5750d3ba908225a79f55f2b0de1092e5ad6734 (patch)
tree0f784dd37883ac84b8784ac3913a638a6fe7904d
parent6106de34e56cf6a3b4655f799c88ab1c349ae4a9 (diff)
downloadsamba-af5750d3ba908225a79f55f2b0de1092e5ad6734.tar.gz
samba-af5750d3ba908225a79f55f2b0de1092e5ad6734.tar.bz2
samba-af5750d3ba908225a79f55f2b0de1092e5ad6734.zip
r1248: Fix from Nick Wellnhofer <wellnhofer@aevum.de> to prevent
lp_interfaces() list from being corrupted. Jeremy. (This used to be commit c892545960a9c3206b5a1f73e98ea924c802c17c)
-rw-r--r--source3/lib/interface.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source3/lib/interface.c b/source3/lib/interface.c
index 4d8010e31b..adf9ca3438 100644
--- a/source3/lib/interface.c
+++ b/source3/lib/interface.c
@@ -94,7 +94,7 @@ This handles the following different forms:
4) ip/mask
5) bcast/mask
****************************************************************************/
-static void interpret_interface(const char *token)
+static void interpret_interface(char *token)
{
struct in_addr ip, nmask;
char *p;
@@ -130,9 +130,9 @@ static void interpret_interface(const char *token)
}
/* parse it into an IP address/netmasklength pair */
- *p++ = 0;
-
+ *p = 0;
ip = *interpret_addr2(token);
+ *p++ = '/';
if (strlen(p) > 2) {
nmask = *interpret_addr2(p);
@@ -207,7 +207,11 @@ void load_interfaces(void)
if (ptr) {
while (*ptr) {
- interpret_interface(*ptr);
+ char *ptr_cpy = strdup(*ptr);
+ if (ptr_cpy) {
+ interpret_interface(ptr_cpy);
+ free(ptr_cpy);
+ }
ptr++;
}
}