[SCM] Samba Shared Repository - branch v3-2-test updated -
release-3-2-0pre2-300-ga4f22d6
Stefan Metzmacher
metze at samba.org
Tue Mar 18 15:46:07 GMT 2008
The branch, v3-2-test has been updated
via a4f22d6e2b3fc198327deabf4a724cd476e4144c (commit)
via a1d24f110b3edff636174e017eb56ba5b10df590 (commit)
via edcf2712bcdedabbfdd9ee8b9a18f46126930636 (commit)
via f69e51f56f111d9bd5db69e191f45567aacf8c3d (commit)
via f27d5e0cf80c49d81091a385cbfd0801b5483825 (commit)
via b141fce01dd40b25cce52852cd93f0f907c3b008 (commit)
via 7854ed24a57162fa7569d8f36633f3c156067b0b (commit)
via 2dee62ed12910a4d22381677bcf884dca0d999ea (commit)
from af12b24c4f5e3b77d482a011b62a5a3e13be7d67 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit a4f22d6e2b3fc198327deabf4a724cd476e4144c
Author: Michael Adam <obnox at samba.org>
Date: Tue Mar 18 16:31:15 2008 +0100
libreplace: remove duplicate entry of inet_ntoa from README.
Michael
(cherry picked from commit 98ee8c84300757d778733a458c6ca3e6022b40ea)
commit a1d24f110b3edff636174e017eb56ba5b10df590
Author: Michael Adam <obnox at samba.org>
Date: Tue Mar 18 13:10:22 2008 +0100
libreplace: remove trailing white spaces.
Michael
(cherry picked from commit 1f9ca7eed965904f67cf78fbac007432b8a057fd)
commit edcf2712bcdedabbfdd9ee8b9a18f46126930636
Author: Michael Adam <obnox at samba.org>
Date: Tue Mar 18 12:16:47 2008 +0100
libreplace: replace inet_ntoa() when it is missing
...not only replace it when it is broken.
This moves the defintion of rep_inet_ntoa from replace.c
to inet_ntoa.c and adds configure checks for existence
of inet_ntoa(). Checks are moved to an include file of its own.
NOTE: The original rep_inet_ntoa in replace.c was wrapped
into a "#ifndef WITH_PTHREADS" but the prototype in replace.h
and the define in system/network.h were not. I removed that
ifndef since the inet_ntoa() function is usually not thread safe
anyways, since it returns a pointer to a static buffer.
So whoever calls inet_ntoa() should be aware that it is not
thread safe anyways.
Michael
(cherry picked from commit 974c0c45ad42644348e0b55454715b12158f1028)
commit f69e51f56f111d9bd5db69e191f45567aacf8c3d
Author: Michael Adam <obnox at samba.org>
Date: Fri Mar 14 15:53:38 2008 +0100
libreplace: put inet_aton.c under LGPL instead of GPL.
Michael
(cherry picked from commit cca5d6626fe395f08fd4c8b2344e4e43646cb987)
commit f27d5e0cf80c49d81091a385cbfd0801b5483825
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Mar 18 15:01:34 2008 +0100
libreplace: remove unused SOCKET_LIBS and NSL_LIBS
metze
(cherry picked from commit 62bb177a6e4a3e1f949b78c7cd7583f2e1271739)
commit b141fce01dd40b25cce52852cd93f0f907c3b008
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Mar 18 14:55:05 2008 +0100
libreplace: for samba4 create LIBREPLACE_NETWORK as EXT_LIB
metze
(cherry picked from commit 79037c31334e271a718fcac234148038814b591e)
commit 7854ed24a57162fa7569d8f36633f3c156067b0b
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Mar 18 14:53:59 2008 +0100
libreplace: use LIBREPLACE_NETWORK_LIBS within some configure checks
...instead of using SOCKET_LIBS and NSL_LIBS.
metze
(cherry picked from commit cef2e8d748756f61c248ad6660e85dd1ac36308a)
commit 2dee62ed12910a4d22381677bcf884dca0d999ea
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Mar 18 14:52:36 2008 +0100
libreplace: combine SOCKET_LIBS and NSL_LIBS to LIBREPLACE_NETWORK_LIBS
But keep the old ones untill the callers are fixed.
metze
(cherry picked from commit e7115dcc8a0a4f420de7a901e3a21d4f35a6fcf9)
-----------------------------------------------------------------------
Summary of changes:
source/lib/replace/README | 1 -
source/lib/replace/configure.ac | 2 +-
source/lib/replace/getifaddrs.m4 | 4 +-
source/lib/replace/inet_aton.c | 22 +++++++++++--------
source/lib/replace/inet_ntoa.c | 39 +++++++++++++++++++++++++++++++++++
source/lib/replace/inet_ntoa.m4 | 19 +++++++++++++++++
source/lib/replace/libreplace.m4 | 19 +----------------
source/lib/replace/replace.c | 14 ------------
source/lib/replace/replace.h | 2 +-
source/lib/replace/samba.m4 | 3 ++
source/lib/replace/socket.m4 | 15 ++++++-------
source/lib/replace/system/network.h | 2 +-
12 files changed, 87 insertions(+), 55 deletions(-)
create mode 100644 source/lib/replace/inet_ntoa.c
create mode 100644 source/lib/replace/inet_ntoa.m4
Changeset truncated at 500 lines:
diff --git a/source/lib/replace/README b/source/lib/replace/README
index aae1ccb..43f7b08 100644
--- a/source/lib/replace/README
+++ b/source/lib/replace/README
@@ -15,7 +15,6 @@ rename
initgroups
memmove
strdup
-inet_ntoa
setlinebuf
vsyslog
timegm
diff --git a/source/lib/replace/configure.ac b/source/lib/replace/configure.ac
index 298f5a6..02dc08b 100644
--- a/source/lib/replace/configure.ac
+++ b/source/lib/replace/configure.ac
@@ -21,7 +21,7 @@ if test "$ac_cv_prog_gcc" = yes; then
CFLAGS="$CFLAGS -Wno-format-y2k"
fi
-LIBS="$SOCKET_LIBS $NSL_LIBS"
+LIBS="${LIBREPLACE_NETWORK_LIBS}"
AC_SUBST(LIBS)
AC_SUBST(LDFLAGS)
diff --git a/source/lib/replace/getifaddrs.m4 b/source/lib/replace/getifaddrs.m4
index f4cf4e4..927bc67 100644
--- a/source/lib/replace/getifaddrs.m4
+++ b/source/lib/replace/getifaddrs.m4
@@ -34,10 +34,10 @@ fi
##################
# look for a method of finding the list of network interfaces
#
-# This tests need LIBS="$NSL_LIBS $SOCKET_LIBS"
+# This tests need LIBS="${LIBREPLACE_NETWORK_LIBS}"
#
old_LIBS=$LIBS
-LIBS="$NSL_LIBS $SOCKET_LIBS"
+LIBS="${LIBREPLACE_NETWORK_LIBS}"
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$libreplacedir"
iface=no;
diff --git a/source/lib/replace/inet_aton.c b/source/lib/replace/inet_aton.c
index 3eb58f0..c6b3bb1 100644
--- a/source/lib/replace/inet_aton.c
+++ b/source/lib/replace/inet_aton.c
@@ -3,18 +3,22 @@
* replacement functions
* Copyright (C) Michael Adam <obnox at samba.org> 2008
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * ** NOTE! The following LGPL license applies to the replace
+ * ** library. This does NOT imply that all of Samba is released
+ * ** under the LGPL
*
- * This program is distributed in the hope that it will be useful,
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "replace.h"
diff --git a/source/lib/replace/inet_ntoa.c b/source/lib/replace/inet_ntoa.c
new file mode 100644
index 0000000..e3b80eb
--- /dev/null
+++ b/source/lib/replace/inet_ntoa.c
@@ -0,0 +1,39 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * replacement routines for broken systems
+ * Copyright (C) Andrew Tridgell 2003
+ * Copyright (C) Michael Adam 2008
+ *
+ * ** NOTE! The following LGPL license applies to the replace
+ * ** library. This does NOT imply that all of Samba is released
+ * ** under the LGPL
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "replace.h"
+#include "system/network.h"
+
+/**
+ * NOTE: this is not thread safe, but it can't be, either
+ * since it returns a pointer to static memory.
+ */
+char *rep_inet_ntoa(struct in_addr ip)
+{
+ uint8_t *p = (uint8_t *)&ip.s_addr;
+ static char buf[18];
+ slprintf(buf, 17, "%d.%d.%d.%d",
+ (int)p[0], (int)p[1], (int)p[2], (int)p[3]);
+ return buf;
+}
diff --git a/source/lib/replace/inet_ntoa.m4 b/source/lib/replace/inet_ntoa.m4
new file mode 100644
index 0000000..5aaa935
--- /dev/null
+++ b/source/lib/replace/inet_ntoa.m4
@@ -0,0 +1,19 @@
+AC_CHECK_FUNCS(inet_ntoa,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} inet_ntoa.o"])
+
+AC_CACHE_CHECK([for broken inet_ntoa],libreplace_cv_REPLACE_INET_NTOA,[
+AC_TRY_RUN([
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+main() { struct in_addr ip; ip.s_addr = 0x12345678;
+if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
+ strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
+exit(1);}],
+ libreplace_cv_REPLACE_INET_NTOA=yes,libreplace_cv_REPLACE_INET_NTOA=no,libreplace_cv_REPLACE_INET_NTOA=cross)])
+if test x"$libreplace_cv_REPLACE_INET_NTOA" = x"yes"; then
+ AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
+fi
diff --git a/source/lib/replace/libreplace.m4 b/source/lib/replace/libreplace.m4
index e6e7198..3da2a90 100644
--- a/source/lib/replace/libreplace.m4
+++ b/source/lib/replace/libreplace.m4
@@ -120,24 +120,6 @@ if test x"$libreplace_cv_USABLE_NET_IF_H" = x"yes";then
AC_DEFINE(HAVE_NET_IF_H, 1, usability of net/if.h)
fi
-AC_CACHE_CHECK([for broken inet_ntoa],libreplace_cv_REPLACE_INET_NTOA,[
-AC_TRY_RUN([
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-main() { struct in_addr ip; ip.s_addr = 0x12345678;
-if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
- strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
-exit(1);}],
- libreplace_cv_REPLACE_INET_NTOA=yes,libreplace_cv_REPLACE_INET_NTOA=no,libreplace_cv_REPLACE_INET_NTOA=cross)])
-if test x"$libreplace_cv_REPLACE_INET_NTOA" = x"yes"; then
- AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
-fi
-
AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])
AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
@@ -348,6 +330,7 @@ m4_include(socket.m4)
m4_include(inet_ntop.m4)
m4_include(inet_pton.m4)
m4_include(inet_aton.m4)
+m4_include(inet_ntoa.m4)
m4_include(getaddrinfo.m4)
m4_include(repdir.m4)
m4_include(getifaddrs.m4)
diff --git a/source/lib/replace/replace.c b/source/lib/replace/replace.c
index b2a240e..c16bded 100644
--- a/source/lib/replace/replace.c
+++ b/source/lib/replace/replace.c
@@ -295,20 +295,6 @@ char *rep_strdup(const char *s)
}
#endif /* HAVE_STRDUP */
-#ifndef WITH_PTHREADS
-/* REWRITE: not thread safe */
-#ifdef REPLACE_INET_NTOA
-char *rep_inet_ntoa(struct in_addr ip)
-{
- uint8_t *p = (uint8_t *)&ip.s_addr;
- static char buf[18];
- slprintf(buf, 17, "%d.%d.%d.%d",
- (int)p[0], (int)p[1], (int)p[2], (int)p[3]);
- return buf;
-}
-#endif /* REPLACE_INET_NTOA */
-#endif
-
#ifndef HAVE_SETLINEBUF
void rep_setlinebuf(FILE *stream)
{
diff --git a/source/lib/replace/replace.h b/source/lib/replace/replace.h
index 00c8230..383536d 100644
--- a/source/lib/replace/replace.h
+++ b/source/lib/replace/replace.h
@@ -325,7 +325,7 @@ ssize_t rep_pread(int __fd, void *__buf, size_t __nbytes, off_t __offset);
ssize_t rep_pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset);
#endif
-#ifdef REPLACE_INET_NTOA
+#if !defined(HAVE_INET_NTOA) || defined(REPLACE_INET_NTOA)
#define inet_ntoa rep_inet_ntoa
/* prototype is in "system/network.h" */
#endif
diff --git a/source/lib/replace/samba.m4 b/source/lib/replace/samba.m4
index a2e04f5..e62c3d3 100644
--- a/source/lib/replace/samba.m4
+++ b/source/lib/replace/samba.m4
@@ -3,6 +3,9 @@ AC_LIBREPLACE_BROKEN_CHECKS
SMB_EXT_LIB(LIBREPLACE_EXT, [${LIBDL}])
SMB_ENABLE(LIBREPLACE_EXT)
+SMB_EXT_LIB(LIBREPLACE_NETWORK, [${LIBREPLACE_NETWORK_LIBS}])
+SMB_ENABLE(LIBREPLACE_NETWORK)
+
# remove leading ./
LIBREPLACE_DIR=`echo ${libreplacedir} |sed -e 's/^\.\///g'`
diff --git a/source/lib/replace/socket.m4 b/source/lib/replace/socket.m4
index c0c8f93..984f81f 100644
--- a/source/lib/replace/socket.m4
+++ b/source/lib/replace/socket.m4
@@ -7,10 +7,10 @@ dnl only looks in /etc/hosts), so we only look for -lsocket if we need
dnl it.
AC_CHECK_FUNCS(connect)
if test x"$ac_cv_func_connect" = x"no"; then
- AC_CHECK_LIB_EXT(nsl_s, SOCKET_LIBS, connect)
- AC_CHECK_LIB_EXT(nsl, SOCKET_LIBS, connect)
- AC_CHECK_LIB_EXT(socket, SOCKET_LIBS, connect)
- AC_CHECK_LIB_EXT(inet, SOCKET_LIBS, connect)
+ AC_CHECK_LIB_EXT(nsl_s, LIBREPLACE_NETWORK_LIBS, connect)
+ AC_CHECK_LIB_EXT(nsl, LIBREPLACE_NETWORK_LIBS, connect)
+ AC_CHECK_LIB_EXT(socket, LIBREPLACE_NETWORK_LIBS, connect)
+ AC_CHECK_LIB_EXT(inet, LIBREPLACE_NETWORK_LIBS, connect)
dnl We can't just call AC_CHECK_FUNCS(connect) here,
dnl because the value has been cached.
if test x"$ac_cv_lib_ext_nsl_s_connect" = x"yes" ||
@@ -24,9 +24,9 @@ fi
AC_CHECK_FUNCS(gethostbyname)
if test x"$ac_cv_func_gethostbyname" = x"no"; then
- AC_CHECK_LIB_EXT(nsl_s, NSL_LIBS, gethostbyname)
- AC_CHECK_LIB_EXT(nsl, NSL_LIBS, gethostbyname)
- AC_CHECK_LIB_EXT(socket, NSL_LIBS, gethostbyname)
+ AC_CHECK_LIB_EXT(nsl_s, LIBREPLACE_NETWORK_LIBS, gethostbyname)
+ AC_CHECK_LIB_EXT(nsl, LIBREPLACE_NETWORK_LIBS, gethostbyname)
+ AC_CHECK_LIB_EXT(socket, LIBREPLACE_NETWORK_LIBS, gethostbyname)
dnl We can't just call AC_CHECK_FUNCS(gethostbyname) here,
dnl because the value has been cached.
if test x"$ac_cv_lib_ext_nsl_s_gethostbyname" = x"yes" ||
@@ -37,4 +37,3 @@ if test x"$ac_cv_func_gethostbyname" = x"no"; then
[Whether the system has gethostbyname()])
fi
fi
-
diff --git a/source/lib/replace/system/network.h b/source/lib/replace/system/network.h
index e9e7702..f943a7f 100644
--- a/source/lib/replace/system/network.h
+++ b/source/lib/replace/system/network.h
@@ -88,7 +88,7 @@
typedef int socklen_t;
#endif
-#ifdef REPLACE_INET_NTOA
+#if !defined (HAVE_INET_NTOA) || defined(REPLACE_INET_NTOA)
/* define is in "replace.h" */
char *rep_inet_ntoa(struct in_addr ip);
#endif
--
Samba Shared Repository
More information about the samba-cvs
mailing list