svn commit: samba r25557 - in branches/SAMBA_3_2: . source source/lib/replace source/lib/replace/system

jelmer at samba.org jelmer at samba.org
Sat Oct 6 23:07:37 GMT 2007


Author: jelmer
Date: 2007-10-06 23:07:33 +0000 (Sat, 06 Oct 2007)
New Revision: 25557

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25557

Log:
merge libreplace fixes from samba4
Added:
   branches/SAMBA_3_2/source/lib/replace/getaddrinfo.h
Removed:
   branches/SAMBA_3_2/source/lib/replace/system/getaddrinfo.h
Modified:
   branches/SAMBA_3_2/
   branches/SAMBA_3_2/source/configure.in
   branches/SAMBA_3_2/source/lib/replace/README
   branches/SAMBA_3_2/source/lib/replace/libreplace.m4
   branches/SAMBA_3_2/source/lib/replace/replace.h


Changeset:

Property changes on: branches/SAMBA_3_2
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:file-ids
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_3_2/source/configure.in
===================================================================
--- branches/SAMBA_3_2/source/configure.in	2007-10-06 22:58:15 UTC (rev 25556)
+++ branches/SAMBA_3_2/source/configure.in	2007-10-06 23:07:33 UTC (rev 25557)
@@ -3222,44 +3222,6 @@
     AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6,1,[Whether the system has struct sockaddr_in6])
 fi
 
-dnl test for struct addrinfo
-AC_CACHE_CHECK([for struct addrinfo],samba_cv_HAVE_STRUCT_ADDRINFO,[
-AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>],
-[
-struct addrinfo ai;
-],
-samba_cv_HAVE_STRUCT_ADDRINFO=yes,samba_cv_HAVE_STRUCT_ADDRINFO=no)])
-if test x"$samba_cv_HAVE_STRUCT_ADDRINFO" = x"yes"; then
-    AC_DEFINE(HAVE_STRUCT_ADDRINFO,1,[Whether the system has struct addrinfo])
-fi
-
-dnl test for getaddrinfo/getnameinfo
-AC_CACHE_CHECK([for getaddrinfo],samba_cv_HAVE_GETADDRINFO,[
-AC_TRY_COMPILE([
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netdb.h>],
-[
-struct sockaddr sa;
-struct addrinfo *ai = NULL;
-int ret = getaddrinfo(NULL, NULL, NULL, &ai);
-if (ret != 0) {
-	const char *es = gai_strerror(ret);
-}
-freeaddrinfo(ai);
-ret = getnameinfo(&sa, sizeof(sa),
-		NULL, 0,
-		NULL, 0, 0);
-
-],
-samba_cv_HAVE_GETADDRINFO=yes,samba_cv_HAVE_GETADDRINFO=no)])
-if test x"$samba_cv_HAVE_GETADDRINFO" = x"yes"; then
-    AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo and getnameinfo])
-fi
-
 ################################################
 # look for a method of setting the effective uid
 seteuid=no;

Modified: branches/SAMBA_3_2/source/lib/replace/README
===================================================================
--- branches/SAMBA_3_2/source/lib/replace/README	2007-10-06 22:58:15 UTC (rev 25556)
+++ branches/SAMBA_3_2/source/lib/replace/README	2007-10-06 23:07:33 UTC (rev 25557)
@@ -50,10 +50,16 @@
 getpass
 readline (the library)
 inet_ntoa
+inet_ntop
+inet_pton
 strtoll
 strtoull
 socketpair
 strptime
+getaddrinfo
+freeaddrinfo
+getnameinfo
+gai_strerror
 
 Types:
 bool

Added: branches/SAMBA_3_2/source/lib/replace/getaddrinfo.h
===================================================================
--- branches/SAMBA_3_2/source/lib/replace/getaddrinfo.h	2007-10-06 22:58:15 UTC (rev 25556)
+++ branches/SAMBA_3_2/source/lib/replace/getaddrinfo.h	2007-10-06 23:07:33 UTC (rev 25557)
@@ -0,0 +1,158 @@
+/*
+PostgreSQL Database Management System
+(formerly known as Postgres, then as Postgres95)
+
+Portions Copyright (c) 1996-2005, The PostgreSQL Global Development Group
+
+Portions Copyright (c) 1994, The Regents of the University of California
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose, without fee, and without a written agreement
+is hereby granted, provided that the above copyright notice and this paragraph
+and the following two paragraphs appear in all copies.
+
+IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
+LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
+EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
+TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+*/
+
+/*-------------------------------------------------------------------------
+ *
+ * getaddrinfo.h
+ *	  Support getaddrinfo() on platforms that don't have it.
+ *
+ * Note: we use our own routines on platforms that don't HAVE_STRUCT_ADDRINFO,
+ * whether or not the library routine getaddrinfo() can be found.  This
+ * policy is needed because on some platforms a manually installed libbind.a
+ * may provide getaddrinfo(), yet the system headers may not provide the
+ * struct definitions needed to call it.  To avoid conflict with the libbind
+ * definition in such cases, we rename our routines to pg_xxx() via macros.
+ *
+ * This code will also work on platforms where struct addrinfo is defined
+ * in the system headers but no getaddrinfo() can be located.
+ *
+ * Copyright (c) 2003-2007, PostgreSQL Global Development Group
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef GETADDRINFO_H
+#define GETADDRINFO_H
+
+
+/* Various macros that ought to be in <netdb.h>, but might not be */
+
+#ifndef EAI_FAIL
+#define EAI_BADFLAGS	(-1)
+#define EAI_NONAME		(-2)
+#define EAI_AGAIN		(-3)
+#define EAI_FAIL		(-4)
+#define EAI_FAMILY		(-6)
+#define EAI_SOCKTYPE	(-7)
+#define EAI_SERVICE		(-8)
+#define EAI_MEMORY		(-10)
+#define EAI_SYSTEM		(-11)
+#endif   /* !EAI_FAIL */
+
+#ifndef AI_PASSIVE
+#define AI_PASSIVE		0x0001
+#endif
+
+#ifndef AI_NUMERICHOST
+/*
+ * some platforms don't support AI_NUMERICHOST; define as zero if using
+ * the system version of getaddrinfo...
+ */
+#if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO)
+#define AI_NUMERICHOST	0
+#else
+#define AI_NUMERICHOST	0x0004
+#endif
+#endif
+
+#ifndef NI_NUMERICHOST
+#define NI_NUMERICHOST	1
+#endif
+
+#ifndef NI_NUMERICSERV
+#define NI_NUMERICSERV	2
+#endif
+
+#ifndef NI_NOFQDN
+#define NI_NOFQDN	4
+#endif
+
+#ifndef NI_NAMEREQD
+#define NI_NAMEREQD 	8
+#endif
+
+#ifndef NI_DGRAM
+#define NI_DGRAM	16
+#endif
+
+
+#ifndef NI_MAXHOST
+#define NI_MAXHOST	1025
+#endif
+
+#ifndef NI_MAXSERV
+#define NI_MAXSERV	32
+#endif
+
+#ifndef HAVE_STRUCT_ADDRINFO
+
+struct addrinfo
+{
+	int			ai_flags;
+	int			ai_family;
+	int			ai_socktype;
+	int			ai_protocol;
+	size_t		ai_addrlen;
+	struct sockaddr *ai_addr;
+	char	   *ai_canonname;
+	struct addrinfo *ai_next;
+};
+#endif   /* HAVE_STRUCT_ADDRINFO */
+
+
+#ifndef HAVE_GETADDRINFO
+
+/* Rename private copies per comments above */
+#ifdef getaddrinfo
+#undef getaddrinfo
+#endif
+#define getaddrinfo pg_getaddrinfo
+
+#ifdef freeaddrinfo
+#undef freeaddrinfo
+#endif
+#define freeaddrinfo pg_freeaddrinfo
+
+#ifdef gai_strerror
+#undef gai_strerror
+#endif
+#define gai_strerror pg_gai_strerror
+
+#ifdef getnameinfo
+#undef getnameinfo
+#endif
+#define getnameinfo pg_getnameinfo
+
+extern int getaddrinfo(const char *node, const char *service,
+			const struct addrinfo * hints, struct addrinfo ** res);
+extern void freeaddrinfo(struct addrinfo * res);
+extern const char *gai_strerror(int errcode);
+extern int getnameinfo(const struct sockaddr * sa, socklen_t salen,
+			char *node, size_t nodelen,
+			char *service, size_t servicelen, int flags);
+#endif   /* HAVE_GETADDRINFO */
+
+#endif   /* GETADDRINFO_H */

Modified: branches/SAMBA_3_2/source/lib/replace/libreplace.m4
===================================================================
--- branches/SAMBA_3_2/source/lib/replace/libreplace.m4	2007-10-06 22:58:15 UTC (rev 25556)
+++ branches/SAMBA_3_2/source/lib/replace/libreplace.m4	2007-10-06 23:07:33 UTC (rev 25557)
@@ -137,6 +137,45 @@
     AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
 fi
 
+dnl test for struct addrinfo
+AC_CACHE_CHECK([for struct addrinfo],samba_cv_HAVE_STRUCT_ADDRINFO,[
+AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>],
+[
+struct addrinfo ai;
+],
+samba_cv_HAVE_STRUCT_ADDRINFO=yes,samba_cv_HAVE_STRUCT_ADDRINFO=no)])
+if test x"$samba_cv_HAVE_STRUCT_ADDRINFO" = x"yes"; then
+    AC_DEFINE(HAVE_STRUCT_ADDRINFO,1,[Whether the system has struct addrinfo])
+fi
+
+dnl test for getaddrinfo/getnameinfo
+AC_CACHE_CHECK([for getaddrinfo],samba_cv_HAVE_GETADDRINFO,[
+AC_TRY_COMPILE([
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netdb.h>],
+[
+struct sockaddr sa;
+struct addrinfo *ai = NULL;
+int ret = getaddrinfo(NULL, NULL, NULL, &ai);
+if (ret != 0) {
+	const char *es = gai_strerror(ret);
+}
+freeaddrinfo(ai);
+ret = getnameinfo(&sa, sizeof(sa),
+		NULL, 0,
+		NULL, 0, 0);
+
+],
+samba_cv_HAVE_GETADDRINFO=yes,samba_cv_HAVE_GETADDRINFO=no)])
+if test x"$samba_cv_HAVE_GETADDRINFO" = x"yes"; then
+    AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo and getnameinfo])
+fi
+
+
 dnl Provided by replace.c:
 AC_TRY_COMPILE([
 #include <sys/types.h>

Modified: branches/SAMBA_3_2/source/lib/replace/replace.h
===================================================================
--- branches/SAMBA_3_2/source/lib/replace/replace.h	2007-10-06 22:58:15 UTC (rev 25556)
+++ branches/SAMBA_3_2/source/lib/replace/replace.h	2007-10-06 23:07:33 UTC (rev 25557)
@@ -330,22 +330,17 @@
 ssize_t rep_pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset);
 #endif
 
-#include "system/network.h"
-
 #ifndef HAVE_INET_PTON
 int rep_inet_pton(int af, const char *src, void *dst);
 #define inet_pton rep_inet_pton
 #endif
 
 #ifndef HAVE_INET_NTOP
+#include "system/network.h"
 const char *rep_inet_ntop(int af, const void *src, char *dst, socklen_t size);
 #define inet_ntop rep_inet_ntop
 #endif
 
-#if !defined(HAVE_GETADDRINFO)
-#include "system/getaddrinfo.h"
-#endif
-
 #ifdef HAVE_LIMITS_H
 #include <limits.h>
 #endif

Deleted: branches/SAMBA_3_2/source/lib/replace/system/getaddrinfo.h
===================================================================
--- branches/SAMBA_3_2/source/lib/replace/system/getaddrinfo.h	2007-10-06 22:58:15 UTC (rev 25556)
+++ branches/SAMBA_3_2/source/lib/replace/system/getaddrinfo.h	2007-10-06 23:07:33 UTC (rev 25557)
@@ -1,158 +0,0 @@
-/*
-PostgreSQL Database Management System
-(formerly known as Postgres, then as Postgres95)
-
-Portions Copyright (c) 1996-2005, The PostgreSQL Global Development Group
-
-Portions Copyright (c) 1994, The Regents of the University of California
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose, without fee, and without a written agreement
-is hereby granted, provided that the above copyright notice and this paragraph
-and the following two paragraphs appear in all copies.
-
-IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
-DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
-LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
-EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
-TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-
-*/
-
-/*-------------------------------------------------------------------------
- *
- * getaddrinfo.h
- *	  Support getaddrinfo() on platforms that don't have it.
- *
- * Note: we use our own routines on platforms that don't HAVE_STRUCT_ADDRINFO,
- * whether or not the library routine getaddrinfo() can be found.  This
- * policy is needed because on some platforms a manually installed libbind.a
- * may provide getaddrinfo(), yet the system headers may not provide the
- * struct definitions needed to call it.  To avoid conflict with the libbind
- * definition in such cases, we rename our routines to pg_xxx() via macros.
- *
- * This code will also work on platforms where struct addrinfo is defined
- * in the system headers but no getaddrinfo() can be located.
- *
- * Copyright (c) 2003-2007, PostgreSQL Global Development Group
- *
- *-------------------------------------------------------------------------
- */
-#ifndef GETADDRINFO_H
-#define GETADDRINFO_H
-
-
-/* Various macros that ought to be in <netdb.h>, but might not be */
-
-#ifndef EAI_FAIL
-#define EAI_BADFLAGS	(-1)
-#define EAI_NONAME		(-2)
-#define EAI_AGAIN		(-3)
-#define EAI_FAIL		(-4)
-#define EAI_FAMILY		(-6)
-#define EAI_SOCKTYPE	(-7)
-#define EAI_SERVICE		(-8)
-#define EAI_MEMORY		(-10)
-#define EAI_SYSTEM		(-11)
-#endif   /* !EAI_FAIL */
-
-#ifndef AI_PASSIVE
-#define AI_PASSIVE		0x0001
-#endif
-
-#ifndef AI_NUMERICHOST
-/*
- * some platforms don't support AI_NUMERICHOST; define as zero if using
- * the system version of getaddrinfo...
- */
-#if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO)
-#define AI_NUMERICHOST	0
-#else
-#define AI_NUMERICHOST	0x0004
-#endif
-#endif
-
-#ifndef NI_NUMERICHOST
-#define NI_NUMERICHOST	1
-#endif
-
-#ifndef NI_NUMERICSERV
-#define NI_NUMERICSERV	2
-#endif
-
-#ifndef NI_NOFQDN
-#define NI_NOFQDN	4
-#endif
-
-#ifndef NI_NAMEREQD
-#define NI_NAMEREQD 	8
-#endif
-
-#ifndef NI_DGRAM
-#define NI_DGRAM	16
-#endif
-
-
-#ifndef NI_MAXHOST
-#define NI_MAXHOST	1025
-#endif
-
-#ifndef NI_MAXSERV
-#define NI_MAXSERV	32
-#endif
-
-#ifndef HAVE_STRUCT_ADDRINFO
-
-struct addrinfo
-{
-	int			ai_flags;
-	int			ai_family;
-	int			ai_socktype;
-	int			ai_protocol;
-	size_t		ai_addrlen;
-	struct sockaddr *ai_addr;
-	char	   *ai_canonname;
-	struct addrinfo *ai_next;
-};
-#endif   /* HAVE_STRUCT_ADDRINFO */
-
-
-#ifndef HAVE_GETADDRINFO
-
-/* Rename private copies per comments above */
-#ifdef getaddrinfo
-#undef getaddrinfo
-#endif
-#define getaddrinfo pg_getaddrinfo
-
-#ifdef freeaddrinfo
-#undef freeaddrinfo
-#endif
-#define freeaddrinfo pg_freeaddrinfo
-
-#ifdef gai_strerror
-#undef gai_strerror
-#endif
-#define gai_strerror pg_gai_strerror
-
-#ifdef getnameinfo
-#undef getnameinfo
-#endif
-#define getnameinfo pg_getnameinfo
-
-extern int getaddrinfo(const char *node, const char *service,
-			const struct addrinfo * hints, struct addrinfo ** res);
-extern void freeaddrinfo(struct addrinfo * res);
-extern const char *gai_strerror(int errcode);
-extern int getnameinfo(const struct sockaddr * sa, socklen_t salen,
-			char *node, size_t nodelen,
-			char *service, size_t servicelen, int flags);
-#endif   /* HAVE_GETADDRINFO */
-
-#endif   /* GETADDRINFO_H */



More information about the samba-cvs mailing list