The branch, v3-2-test has been updated via 11a977aa0757801fb0fa805b123e7bc75c8be447 (commit) via de01c503f4d16b8c3c0ad75225cf0b1822fd8c7f (commit) via e56977ea459b3615d33237d19ed8e7ad8b509853 (commit) via b81d8bc43cd7167a5cd4b18c26ba3eecf75043eb (commit) via 45150075677451b48ce56ebdce96aca1ed13fa80 (commit) via fa120f7c50d0084e7d887811e5fa59ae3bcfe53e (commit) via f1d434a132e424f2fdce59d51a7c398988c1474d (commit) from d04a8a6cdcc505e0244882a9abb7174eadbf81a7 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log ----------------------------------------------------------------- commit 11a977aa0757801fb0fa805b123e7bc75c8be447 Author: metze <[EMAIL PROTECTED]> Date: Thu Oct 25 09:16:11 2007 +0000 [libreplace] define AI_NUMERICSERV as it's used in getaddrinfo.c metze git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/[EMAIL PROTECTED] 0c0555d6-39d7-0310-84fc-f1cc0bd64818 commit de01c503f4d16b8c3c0ad75225cf0b1822fd8c7f Author: metze <[EMAIL PROTECTED]> Date: Thu Oct 25 08:43:00 2007 +0000 [libreplace] move and fix getaddrinfo configure checks - move getaddrinfo check into getaddrinfo.m4 - add getaddrinfo.o to LIBREPLACEOBJ so that we really build the replacements metze git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/[EMAIL PROTECTED] 0c0555d6-39d7-0310-84fc-f1cc0bd64818 commit e56977ea459b3615d33237d19ed8e7ad8b509853 Author: metze <[EMAIL PROTECTED]> Date: Thu Oct 25 06:53:38 2007 +0000 - include getaddrinfo.h after we have defined struct addrinfo - use rep_ instead of pg_ as prefix in getaddrinfo.[ch] - define HAVE_<name> macros when we replace functions metze git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/[EMAIL PROTECTED] 0c0555d6-39d7-0310-84fc-f1cc0bd64818 commit b81d8bc43cd7167a5cd4b18c26ba3eecf75043eb Author: metze <[EMAIL PROTECTED]> Date: Wed Oct 24 13:01:03 2007 +0000 [libreplace] if we replace types define the HAVE_<type> macro this is needed as heimdal's roken.h also tries to replace the types metze git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/[EMAIL PROTECTED] 0c0555d6-39d7-0310-84fc-f1cc0bd64818 commit 45150075677451b48ce56ebdce96aca1ed13fa80 Author: metze <[EMAIL PROTECTED]> Date: Wed Oct 24 12:57:57 2007 +0000 [libreplace] move definition of struct addrinfo so that it can use socklen_t metze git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/[EMAIL PROTECTED] 0c0555d6-39d7-0310-84fc-f1cc0bd64818 commit fa120f7c50d0084e7d887811e5fa59ae3bcfe53e Author: metze <[EMAIL PROTECTED]> Date: Wed Oct 24 12:55:40 2007 +0000 [libreplace] move define of a constant to near to the others metze git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/[EMAIL PROTECTED] 0c0555d6-39d7-0310-84fc-f1cc0bd64818 commit f1d434a132e424f2fdce59d51a7c398988c1474d Author: metze <[EMAIL PROTECTED]> Date: Wed Oct 24 12:53:34 2007 +0000 [libreplace] include socket_wrapper.h after we have typedef'ed socklen_t metze git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/[EMAIL PROTECTED] 0c0555d6-39d7-0310-84fc-f1cc0bd64818 ----------------------------------------------------------------------- Summary of changes: source/lib/replace/getaddrinfo.c | 8 ++-- source/lib/replace/getaddrinfo.h | 23 ++++++++---- source/lib/replace/getaddrinfo.m4 | 32 ++++++++++++++++ source/lib/replace/libreplace.m4 | 31 +--------------- source/lib/replace/system/network.h | 69 +++++++++++++++++++++-------------- 5 files changed, 93 insertions(+), 70 deletions(-) create mode 100644 source/lib/replace/getaddrinfo.m4 Changeset truncated at 500 lines: diff --git a/source/lib/replace/getaddrinfo.c b/source/lib/replace/getaddrinfo.c index 0bff746..063bacd 100644 --- a/source/lib/replace/getaddrinfo.c +++ b/source/lib/replace/getaddrinfo.c @@ -253,7 +253,7 @@ static int getaddr_info_name(const char *node, * Bugs: - servname can only be a number, not text. */ -int getaddrinfo(const char *node, +int rep_getaddrinfo(const char *node, const char *service, const struct addrinfo * hintp, struct addrinfo ** res) @@ -315,7 +315,7 @@ int getaddrinfo(const char *node, } -void freeaddrinfo(struct addrinfo *res) +void rep_freeaddrinfo(struct addrinfo *res) { struct addrinfo *next = NULL; @@ -332,7 +332,7 @@ void freeaddrinfo(struct addrinfo *res) } -const char *gai_strerror(int errcode) +const char *rep_gai_strerror(int errcode) { #ifdef HAVE_HSTRERROR int hcode; @@ -468,7 +468,7 @@ static int getservicenameinfo(const struct sockaddr *sa, * * Bugs: - No IPv6 support. */ -int getnameinfo(const struct sockaddr *sa, socklen_t salen, +int rep_getnameinfo(const struct sockaddr *sa, socklen_t salen, char *node, size_t nodelen, char *service, size_t servicelen, int flags) { diff --git a/source/lib/replace/getaddrinfo.h b/source/lib/replace/getaddrinfo.h index 47a62eb..dddd699 100644 --- a/source/lib/replace/getaddrinfo.h +++ b/source/lib/replace/getaddrinfo.h @@ -37,6 +37,9 @@ TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * 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. * + +in lib/replace we use rep_xxx() + * This code will also work on platforms where struct addrinfo is defined * in the system headers but no getaddrinfo() can be located. * @@ -53,28 +56,32 @@ TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. #ifdef getaddrinfo #undef getaddrinfo #endif -#define getaddrinfo pg_getaddrinfo +#define getaddrinfo rep_getaddrinfo +#define HAVE_GETADDRINFO #ifdef freeaddrinfo #undef freeaddrinfo #endif -#define freeaddrinfo pg_freeaddrinfo +#define freeaddrinfo rep_freeaddrinfo +#define HAVE_FREEADDRINFO #ifdef gai_strerror #undef gai_strerror #endif -#define gai_strerror pg_gai_strerror +#define gai_strerror rep_gai_strerror +#define HAVE_GAI_STRERROR #ifdef getnameinfo #undef getnameinfo #endif -#define getnameinfo pg_getnameinfo +#define getnameinfo rep_getnameinfo +#define HAVE_GETNAMEINFO -extern int getaddrinfo(const char *node, const char *service, +extern int rep_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, +extern void rep_freeaddrinfo(struct addrinfo * res); +extern const char *rep_gai_strerror(int errcode); +extern int rep_getnameinfo(const struct sockaddr * sa, socklen_t salen, char *node, size_t nodelen, char *service, size_t servicelen, int flags); #endif /* HAVE_GETADDRINFO */ diff --git a/source/lib/replace/getaddrinfo.m4 b/source/lib/replace/getaddrinfo.m4 new file mode 100644 index 0000000..92620aa --- /dev/null +++ b/source/lib/replace/getaddrinfo.m4 @@ -0,0 +1,32 @@ +dnl test for getaddrinfo/getnameinfo +AC_CACHE_CHECK([for getaddrinfo],libreplace_cv_HAVE_GETADDRINFO,[ +AC_TRY_COMPILE([ +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +#include <sys/socket.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); + +], +libreplace_cv_HAVE_GETADDRINFO=yes,libreplace_cv_HAVE_GETADDRINFO=no)]) +if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then + AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo]) + AC_DEFINE(HAVE_GETNAMEINFO,1,[Whether the system has getnameinfo]) + AC_DEFINE(HAVE_FREEADDRINFO,1,[Whether the system has freeaddrinfo]) + AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether the system has gai_strerror]) +else + LIBREPLACEOBJ="${LIBREPLACEOBJ} getaddrinfo.o" +fi diff --git a/source/lib/replace/libreplace.m4 b/source/lib/replace/libreplace.m4 index 26b4c36..dd7dbf4 100644 --- a/source/lib/replace/libreplace.m4 +++ b/source/lib/replace/libreplace.m4 @@ -152,36 +152,6 @@ AC_HAVE_TYPE([struct sockaddr_in6], [ #include <netinet/in.h> ]) -dnl test for getaddrinfo/getnameinfo -AC_CACHE_CHECK([for getaddrinfo],samba_cv_HAVE_GETADDRINFO,[ -AC_TRY_COMPILE([ -#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> -#endif -#include <sys/socket.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]) - AC_DEFINE(HAVE_FREEADDRINFO,1,[Whether the system has freeaddrinfo]) - AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether the system has gai_strerror]) -fi - AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror) AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename) AC_CHECK_FUNCS(waitpid strlcpy strlcat initgroups memmove strdup) @@ -358,6 +328,7 @@ m4_include(win32.m4) m4_include(timegm.m4) m4_include(inet_ntop.m4) m4_include(inet_pton.m4) +m4_include(getaddrinfo.m4) m4_include(repdir.m4) AC_CHECK_FUNCS([syslog memset memcpy],,[AC_MSG_ERROR([Required function not found])]) diff --git a/source/lib/replace/system/network.h b/source/lib/replace/system/network.h index 61de2b7..c7b499a 100644 --- a/source/lib/replace/system/network.h +++ b/source/lib/replace/system/network.h @@ -78,13 +78,6 @@ #include <sys/ioctl.h> #endif -#ifdef SOCKET_WRAPPER -#ifndef SOCKET_WRAPPER_NOT_REPLACE -#define SOCKET_WRAPPER_REPLACE -#endif -#include "lib/socket_wrapper/socket_wrapper.h" -#endif - #ifdef REPLACE_INET_NTOA /* define is in "replace.h" */ char *rep_inet_ntoa(struct in_addr ip); @@ -100,10 +93,6 @@ int rep_inet_pton(int af, const char *src, void *dst); const char *rep_inet_ntop(int af, const void *src, char *dst, socklen_t size); #endif -#if !defined(HAVE_GETADDRINFO) -#include "getaddrinfo.h" -#endif - /* * Some systems have getaddrinfo but not the * defines needed to use it. @@ -147,6 +136,17 @@ const char *rep_inet_ntop(int af, const void *src, char *dst, socklen_t size); #define AI_ADDRCONFIG 0x0020 #endif +#ifndef AI_NUMERICSERV +/* + * logic copied from AI_NUMERICHOST + */ +#if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO) +#define AI_NUMERICSERV 0 +#else +#define AI_NUMERICSERV 0x0400 +#endif +#endif + #ifndef NI_NUMERICHOST #define NI_NUMERICHOST 1 #endif @@ -176,21 +176,6 @@ const char *rep_inet_ntop(int af, const void *src, char *dst, socklen_t size); #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 */ - /* * glibc on linux doesn't seem to have MSG_WAITALL * defined. I think the kernel has it though.. @@ -219,15 +204,22 @@ struct addrinfo #define INET6_ADDRSTRLEN 46 #endif +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 256 +#endif + #ifndef HAVE_SOCKLEN_T +#define HAVE_SOCKLEN_T typedef int socklen_t; #endif #ifndef HAVE_SA_FAMILY_T +#define HAVE_SA_FAMILY_T typedef unsigned short int sa_family_t; #endif #ifndef HAVE_STRUCT_SOCKADDR_STORAGE +#define HAVE_STRUCT_SOCKADDR_STORAGE #ifdef HAVE_STRUCT_SOCKADDR_IN6 #define sockaddr_storage sockaddr_in6 #define ss_family sin6_family @@ -237,8 +229,29 @@ typedef unsigned short int sa_family_t; #endif #endif -#ifndef HOST_NAME_MAX -#define HOST_NAME_MAX 256 +#ifndef HAVE_STRUCT_ADDRINFO +#define HAVE_STRUCT_ADDRINFO +struct addrinfo { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + socklen_t ai_addrlen; + struct sockaddr *ai_addr; + char *ai_canonname; + struct addrinfo *ai_next; +}; +#endif /* HAVE_STRUCT_ADDRINFO */ + +#if !defined(HAVE_GETADDRINFO) +#include "getaddrinfo.h" +#endif + +#ifdef SOCKET_WRAPPER +#ifndef SOCKET_WRAPPER_NOT_REPLACE +#define SOCKET_WRAPPER_REPLACE +#endif +#include "lib/socket_wrapper/socket_wrapper.h" #endif #endif -- Samba Shared Repository