summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1997-12-18 11:05:00 +0000
committerJeremy Allison <jra@samba.org>1997-12-18 11:05:00 +0000
commitb80b6ea3b43a880bb392b8ef8caaff0f11bb80ef (patch)
tree380bd80321e53b2823df2f5d557d4ad9c3d57dc8
parentefa661cb17d0a474403fc3589f716dc7d98502ff (diff)
downloadsamba-b80b6ea3b43a880bb392b8ef8caaff0f11bb80ef.tar.gz
samba-b80b6ea3b43a880bb392b8ef8caaff0f11bb80ef.tar.bz2
samba-b80b6ea3b43a880bb392b8ef8caaff0f11bb80ef.zip
kanji.h: Fixed problems with re-definitions of strchr and others on AIX.
nmbd_nameregister.c: Applied fix found by "Eloy A. Paris" <eparis@ven.ra.rockwell.com> (don't re-use lists after you have freed them :-). Jeremy. (This used to be commit bcfcc39a2752de0fb35b419d005bb1a86fd15fea)
-rw-r--r--source3/include/kanji.h24
-rw-r--r--source3/nmbd/nmbd_nameregister.c6
2 files changed, 28 insertions, 2 deletions
diff --git a/source3/include/kanji.h b/source3/include/kanji.h
index 528680d88a..5e8173ee14 100644
--- a/source3/include/kanji.h
+++ b/source3/include/kanji.h
@@ -108,6 +108,30 @@
extern char *(*_dos_to_unix)(char *str, BOOL overwrite);
extern char *(*_unix_to_dos)(char *str, BOOL overwrite);
+/*
+ * The following is needed for AIX systems that have
+ * their own #defines for strchr, strrchr, strstr
+ * and strtok.
+ */
+
+#ifdef strchr
+#undef strchr
+#endif /* strchr */
+
+#ifdef strrchr
+#undef strrchr
+#endif /* strrchr */
+
+#ifdef strstr
+#undef strstr
+#endif /* strstr */
+
+#ifdef strtok
+#undef strtok
+#endif /* strtok */
+
+/* Ensure we use our definitions. */
+
#define strchr sj_strchr
#define strrchr sj_strrchr
#define strstr sj_strstr
diff --git a/source3/nmbd/nmbd_nameregister.c b/source3/nmbd/nmbd_nameregister.c
index 603daaa531..cdaef1a767 100644
--- a/source3/nmbd/nmbd_nameregister.c
+++ b/source3/nmbd/nmbd_nameregister.c
@@ -283,8 +283,6 @@ static BOOL multihomed_register_name( struct nmb_name *nmbname, uint16 nb_flags,
add_name_to_subnet(unicast_subnet, nmbname->name, nmbname->name_type,
nb_flags, lp_max_ttl(), SELF_NAME, num_ips, ip_list);
- free((char *)ip_list);
-
/* Now try and register the name, num_ips times. On the last time use
the given success and fail functions. */
@@ -302,10 +300,14 @@ static BOOL multihomed_register_name( struct nmb_name *nmbname, uint16 nb_flags,
{
DEBUG(0,("multihomed_register_name: Failed to send packet trying to \
register name %s IP %s\n", namestr(nmbname), inet_ntoa(ip_list[i]) ));
+
+ free((char *)ip_list);
return True;
}
}
+ free((char *)ip_list);
+
return False;
}