summaryrefslogtreecommitdiffstats
path: root/source/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-06-24 23:27:00 +0000
committerJeremy Allison <jra@samba.org>2004-06-24 23:27:00 +0000
commit7c17c64f944007d75c5226905e3730131f905df2 (patch)
treebcc22cab7e3429f3489e4b489d9331c65372d7ec /source/lib
parenta780e9b979b41b9d9be360c0d850c6d693c6d33e (diff)
downloadsamba-7c17c64f944007d75c5226905e3730131f905df2.tar.gz
samba-7c17c64f944007d75c5226905e3730131f905df2.tar.xz
samba-7c17c64f944007d75c5226905e3730131f905df2.zip
r1248: Fix from Nick Wellnhofer <wellnhofer@aevum.de> to prevent
lp_interfaces() list from being corrupted. Jeremy.
Diffstat (limited to 'source/lib')
-rw-r--r--source/lib/interface.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/lib/interface.c b/source/lib/interface.c
index 4d8010e31bc..adf9ca34381 100644
--- a/source/lib/interface.c
+++ b/source/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++;
}
}