From 0ce97f77e02acd2de15970270834a7011ce6cb38 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 30 Oct 2008 13:45:25 +0000 Subject: Use our Curl_addrinfo definition even when an addrinfo struct is available. Use a wrapper function to call system's getaddrinfo(). --- lib/curl_addrinfo.c | 332 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 332 insertions(+) create mode 100644 lib/curl_addrinfo.c (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c new file mode 100644 index 000000000..75c36dceb --- /dev/null +++ b/lib/curl_addrinfo.c @@ -0,0 +1,332 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + * $Id$ + ***************************************************************************/ + +#include "setup.h" + +#include + +#ifdef NEED_MALLOC_H +# include +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#ifdef VMS +# include +# include +# include +#endif + +#if defined(NETWARE) && defined(__NOVELL_LIBC__) +# undef in_addr_t +# define in_addr_t unsigned long +#endif + +#include "curl_addrinfo.h" + +#define _MPRINTF_REPLACE /* use our functions only */ +#include + +#include "memory.h" +/* The last #include file should be: */ +#include "memdebug.h" + + +/* + * Curl_freeaddrinfo() + * + * This is used to free a linked list of Curl_addrinfo structs along + * with all its associated allocated storage. This function should be + * called once for each successful call to Curl_getaddrinfo_ex() or to + * any function call which actually allocates a Curl_addrinfo struct. + */ + +void +Curl_freeaddrinfo(Curl_addrinfo *cahead) +{ + Curl_addrinfo *ca, *canext; + + for(ca = cahead; ca != NULL; ca = canext) { + + if(ca->ai_addr) + free(ca->ai_addr); + + if(ca->ai_canonname) + free(ca->ai_canonname); + + canext = ca->ai_next; + + free(ca); + } +} + + +#ifdef HAVE_GETADDRINFO +/* + * Curl_getaddrinfo_ex() + * + * This is a warapper function around system's getaddrinfo(), with + * the only difference that instead of returning a linked list of + * addrinfo structs this one returns a linked list of Curl_addrinfo + * ones. The memory allocated by this function *MUST* be free'd with + * Curl_freeaddrinfo(). For each successful call to this function + * there must be an associated call later to Curl_freeaddrinfo(). + * + * There should be no single call to system's getaddrinfo() in the + * whole library, any such call should be 'routed' through this one. + */ + +int +Curl_getaddrinfo_ex(const char *nodename, + const char *servname, + const struct addrinfo *hints, + Curl_addrinfo **result) +{ + const struct addrinfo *ainext; + const struct addrinfo *ai; + struct addrinfo *aihead; + Curl_addrinfo *cafirst = NULL; + Curl_addrinfo *calast = NULL; + Curl_addrinfo *ca; + int error; + + *result = NULL; /* assume failure */ + + error = getaddrinfo(nodename, servname, hints, &aihead); + if(error) + return error; + + for(ai = aihead; ai != NULL; ai = ainext) { + + if((ca = malloc(sizeof(Curl_addrinfo))) == NULL) { + error = EAI_MEMORY; + break; + } + + /* copy each structure member individually, member ordering, */ + /* size, or padding might be different for each structure. */ + + ca->ai_flags = ai->ai_flags; + ca->ai_family = ai->ai_family; + ca->ai_socktype = ai->ai_socktype; + ca->ai_protocol = ai->ai_protocol; + ca->ai_addrlen = 0; + ca->ai_addr = NULL; + ca->ai_canonname = NULL; + ca->ai_next = NULL; + + if((ai->ai_addrlen > 0) && (ai->ai_addr != NULL)) { + ca->ai_addrlen = ai->ai_addrlen; + if((ca->ai_addr = malloc(ca->ai_addrlen)) == NULL) { + error = EAI_MEMORY; + free(ca); + break; + } + memcpy(ca->ai_addr, ai->ai_addr, ca->ai_addrlen); + } + + if(ai->ai_canonname != NULL) { + if((ca->ai_canonname = strdup(ai->ai_canonname)) == NULL) { + error = EAI_MEMORY; + if(ca->ai_addr) + free(ca->ai_addr); + free(ca); + break; + } + } + + /* if the return list is empty, this becomes the first element */ + if(!cafirst) + cafirst = ca; + + /* add this element last in the return list */ + if(calast) + calast->ai_next = ca; + calast = ca; + + /* fetch next element fom the addrinfo list */ + ainext = ai->ai_next; + } + + /* destroy the addrinfo list */ + if(aihead) + freeaddrinfo(aihead); + + /* if we failed, also destroy the Curl_addrinfo list */ + if(error) { + Curl_freeaddrinfo(cafirst); + cafirst = NULL; + } + + *result = cafirst; + + return error; /* This is not a CURLcode */ +} +#endif /* HAVE_GETADDRINFO */ + + +/* + * Curl_he2ai() + * + * This function returns a pointer to the first element of a newly allocated + * Curl_addrinfo struct linked list filled with the data of a given hostent. + * Curl_addrinfo is meant to work like the addrinfo struct does for a IPv6 + * stack, but usable also for IPv4, all hosts and environments. + * + * The memory allocated by this function *MUST* be free'd later on calling + * Curl_freeaddrinfo(). For each successful call to this function there + * must be an associated call later to Curl_freeaddrinfo(). + * + * Curl_addrinfo defined in "lib/curl_addrinfo.h" + * + * struct Curl_addrinfo { + * int ai_flags; + * int ai_family; + * int ai_socktype; + * int ai_protocol; + * socklen_t ai_addrlen; * Follow rfc3493 struct addrinfo * + * char *ai_canonname; + * struct sockaddr *ai_addr; + * struct Curl_addrinfo *ai_next; + * }; + * typedef struct Curl_addrinfo Curl_addrinfo; + * + * hostent defined in + * + * struct hostent { + * char *h_name; + * char **h_aliases; + * int h_addrtype; + * int h_length; + * char **h_addr_list; + * }; + * + * for backward compatibility: + * + * #define h_addr h_addr_list[0] + */ + +Curl_addrinfo * +Curl_he2ai(const struct hostent *he, int port) +{ + Curl_addrinfo *ai; + Curl_addrinfo *prevai = NULL; + Curl_addrinfo *firstai = NULL; + struct sockaddr_in *addr; +#ifdef ENABLE_IPV6 + struct sockaddr_in6 *addr6; +#endif + CURLcode result = CURLE_OK; + int i; + char *curr; + + if(!he) + /* no input == no output! */ + return NULL; + + for(i=0; (curr = he->h_addr_list[i]) != NULL; i++) { + + int ss_size; +#ifdef ENABLE_IPV6 + if (he->h_addrtype == AF_INET6) + ss_size = sizeof (struct sockaddr_in6); + else +#endif + ss_size = sizeof (struct sockaddr_in); + + if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL) { + result = CURLE_OUT_OF_MEMORY; + break; + } + if((ai->ai_canonname = strdup(he->h_name)) == NULL) { + result = CURLE_OUT_OF_MEMORY; + free(ai); + break; + } + if((ai->ai_addr = calloc(1, ss_size)) == NULL) { + result = CURLE_OUT_OF_MEMORY; + free(ai->ai_canonname); + free(ai); + break; + } + + if(!firstai) + /* store the pointer we want to return from this function */ + firstai = ai; + + if(prevai) + /* make the previous entry point to this */ + prevai->ai_next = ai; + + ai->ai_family = he->h_addrtype; + + /* we return all names as STREAM, so when using this address for TFTP + the type must be ignored and conn->socktype be used instead! */ + ai->ai_socktype = SOCK_STREAM; + + ai->ai_addrlen = ss_size; + + /* leave the rest of the struct filled with zero */ + + switch (ai->ai_family) { + case AF_INET: + addr = (struct sockaddr_in *)ai->ai_addr; /* storage area for this info */ + + memcpy(&addr->sin_addr, curr, sizeof(struct in_addr)); + addr->sin_family = (unsigned short)(he->h_addrtype); + addr->sin_port = htons((unsigned short)port); + break; + +#ifdef ENABLE_IPV6 + case AF_INET6: + addr6 = (struct sockaddr_in6 *)ai->ai_addr; /* storage area for this info */ + + memcpy(&addr6->sin6_addr, curr, sizeof(struct in6_addr)); + addr6->sin6_family = (unsigned short)(he->h_addrtype); + addr6->sin6_port = htons((unsigned short)port); + break; +#endif + } + + prevai = ai; + } + + if(result != CURLE_OK) { + /* Use parenthesis to prevent memdebug from replacing this */ + Curl_freeaddrinfo(firstai); + firstai = NULL; + } + + return firstai; +} + -- cgit v1.2.1 From 005bf19acf3c3fa15bc7e06ffa446a780bff9a66 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 30 Oct 2008 15:13:22 +0000 Subject: remove bogus comment --- lib/curl_addrinfo.c | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 75c36dceb..ce6780c4c 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -322,7 +322,6 @@ Curl_he2ai(const struct hostent *he, int port) } if(result != CURLE_OK) { - /* Use parenthesis to prevent memdebug from replacing this */ Curl_freeaddrinfo(firstai); firstai = NULL; } -- cgit v1.2.1 From c2c800d8639b1f34a89548e6c26e6d805036dfdc Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 30 Oct 2008 19:02:23 +0000 Subject: Move curl_dofreeaddrinfo() and curl_dofreeaddrinfo() implementation from lib/hostip6.c to lib/curl_addrinfo.c and prototypes from lib/hostip.h to lib/curl_addrinfo.h --- lib/curl_addrinfo.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index ce6780c4c..1e281347b 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -329,3 +329,57 @@ Curl_he2ai(const struct hostent *he, int port) return firstai; } + +#if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO) +/* + * curl_dofreeaddrinfo() + * + * This is Strictly for memory tracing and are using the same style as the + * family otherwise present in memdebug.c. I put these ones here since they + * require a bunch of structs I didn't wanna include in memdebug.c + */ + +void +curl_dofreeaddrinfo(struct addrinfo *freethis, + int line, const char *source) +{ + (freeaddrinfo)(freethis); + if(logfile) + fprintf(logfile, "ADDR %s:%d freeaddrinfo(%p)\n", + source, line, (void *)freethis); +} +#endif /* defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO) */ + + +#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) +/* + * curl_dogetaddrinfo() + * + * This is Strictly for memory tracing and are using the same style as the + * family otherwise present in memdebug.c. I put these ones here since they + * require a bunch of structs I didn't wanna include in memdebug.c + */ + +int +curl_dogetaddrinfo(const char *hostname, + const char *service, + const struct addrinfo *hints, + struct addrinfo **result, + int line, const char *source) +{ + int res=(getaddrinfo)(hostname, service, hints, result); + if(0 == res) { + /* success */ + if(logfile) + fprintf(logfile, "ADDR %s:%d getaddrinfo() = %p\n", + source, line, (void *)*result); + } + else { + if(logfile) + fprintf(logfile, "ADDR %s:%d getaddrinfo() failed\n", + source, line); + } + return res; +} +#endif /* defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) */ + -- cgit v1.2.1 From 0433252e50fda8941c97fd1e0f3fde8ad9f8a1ba Mon Sep 17 00:00:00 2001 From: Gisle Vanem Date: Sat, 1 Nov 2008 14:51:37 +0000 Subject: Fix typos. --- lib/curl_addrinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 1e281347b..8c538b821 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -95,7 +95,7 @@ Curl_freeaddrinfo(Curl_addrinfo *cahead) /* * Curl_getaddrinfo_ex() * - * This is a warapper function around system's getaddrinfo(), with + * This is a wrapper function around system's getaddrinfo(), with * the only difference that instead of returning a linked list of * addrinfo structs this one returns a linked list of Curl_addrinfo * ones. The memory allocated by this function *MUST* be free'd with @@ -334,7 +334,7 @@ Curl_he2ai(const struct hostent *he, int port) /* * curl_dofreeaddrinfo() * - * This is Strictly for memory tracing and are using the same style as the + * This is strictly for memory tracing and are using the same style as the * family otherwise present in memdebug.c. I put these ones here since they * require a bunch of structs I didn't wanna include in memdebug.c */ @@ -355,7 +355,7 @@ curl_dofreeaddrinfo(struct addrinfo *freethis, /* * curl_dogetaddrinfo() * - * This is Strictly for memory tracing and are using the same style as the + * This is strictly for memory tracing and are using the same style as the * family otherwise present in memdebug.c. I put these ones here since they * require a bunch of structs I didn't wanna include in memdebug.c */ -- cgit v1.2.1 From a0ef686c542bee30be0b20cd4d3243bec6b4f059 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 6 Nov 2008 17:19:56 +0000 Subject: Merged existing IPv4 and IPv6 Curl_ip2addr functions into a single one which now also takes a protocol address family argument. --- lib/curl_addrinfo.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 100 insertions(+), 3 deletions(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 8c538b821..826eae8ce 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -190,7 +190,8 @@ Curl_getaddrinfo_ex(const char *nodename, *result = cafirst; - return error; /* This is not a CURLcode */ + /* This is not a CURLcode */ + return error; } #endif /* HAVE_GETADDRINFO */ @@ -254,6 +255,8 @@ Curl_he2ai(const struct hostent *he, int port) /* no input == no output! */ return NULL; + DEBUGASSERT((he->h_name != NULL) && (he->h_addr_list != NULL)); + for(i=0; (curr = he->h_addr_list[i]) != NULL; i++) { int ss_size; @@ -300,7 +303,7 @@ Curl_he2ai(const struct hostent *he, int port) switch (ai->ai_family) { case AF_INET: - addr = (struct sockaddr_in *)ai->ai_addr; /* storage area for this info */ + addr = (void *)ai->ai_addr; /* storage area for this info */ memcpy(&addr->sin_addr, curr, sizeof(struct in_addr)); addr->sin_family = (unsigned short)(he->h_addrtype); @@ -309,7 +312,7 @@ Curl_he2ai(const struct hostent *he, int port) #ifdef ENABLE_IPV6 case AF_INET6: - addr6 = (struct sockaddr_in6 *)ai->ai_addr; /* storage area for this info */ + addr6 = (void *)ai->ai_addr; /* storage area for this info */ memcpy(&addr6->sin6_addr, curr, sizeof(struct in6_addr)); addr6->sin6_family = (unsigned short)(he->h_addrtype); @@ -330,6 +333,100 @@ Curl_he2ai(const struct hostent *he, int port) } +struct namebuff { + struct hostent hostentry; + union { + struct in_addr ina4; +#ifdef ENABLE_IPV6 + struct in6_addr ina6; +#endif + } addrentry; + char *h_addr_list[2]; +}; + + +/* + * Curl_ip2addr() + * + * This function takes an internet address, in binary form, as input parameter + * along with its address family and the string version of the address, and it + * returns a Curl_addrinfo chain filled in correctly with information for the + * given address/host + */ + +Curl_addrinfo * +Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port) +{ + Curl_addrinfo *ai; + +#if defined(VMS) && \ + defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64) +#pragma pointer_size save +#pragma pointer_size short +#pragma message disable PTRMISMATCH +#endif + + struct hostent *h; + struct namebuff *buf; + char *addrentry; + char *hoststr; + int addrsize; + + DEBUGASSERT(inaddr && hostname); + + buf = malloc(sizeof(struct namebuff)); + if(!buf) + return NULL; + + hoststr = strdup(hostname); + if(!hoststr) { + free(buf); + return NULL; + } + + switch(af) { + case AF_INET: + addrsize = sizeof(struct in_addr); + addrentry = (void *)&buf->addrentry.ina4; + memcpy(addrentry, inaddr, sizeof(struct in_addr)); + break; +#ifdef ENABLE_IPV6 + case AF_INET6: + addrsize = sizeof(struct in6_addr); + addrentry = (void *)&buf->addrentry.ina6; + memcpy(addrentry, inaddr, sizeof(struct in6_addr)); + break; +#endif + default: + free(hoststr); + free(buf); + return NULL; + } + + h = &buf->hostentry; + h->h_name = hoststr; + h->h_aliases = NULL; + h->h_addrtype = (short)af; + h->h_length = (short)addrsize; + h->h_addr_list = &buf->h_addr_list[0]; + h->h_addr_list[0] = addrentry; + h->h_addr_list[1] = NULL; /* terminate list of entries */ + +#if defined(VMS) && \ + defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64) +#pragma pointer_size restore +#pragma message enable PTRMISMATCH +#endif + + ai = Curl_he2ai(h, port); + + free(hoststr); + free(buf); + + return ai; +} + + #if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO) /* * curl_dofreeaddrinfo() -- cgit v1.2.1 From c621546bd608d5f836d165c2a33ff3d37e2e21e5 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 13 Apr 2009 07:18:39 +0000 Subject: fix compiler warning: implicit conversion shortens 64-bit value into a 32-bit value --- lib/curl_addrinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 826eae8ce..f75145722 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -370,7 +370,7 @@ Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port) struct namebuff *buf; char *addrentry; char *hoststr; - int addrsize; + size_t addrsize; DEBUGASSERT(inaddr && hostname); -- cgit v1.2.1 From c382c550e7d8ad54d2c35b0fea9d0eef09ff3a25 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 14 Apr 2009 12:53:53 +0000 Subject: fix compiler warning: implicit conversion shortens 64-bit value into a 32-bit value --- lib/curl_addrinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index f75145722..19f73c48c 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -259,7 +259,7 @@ Curl_he2ai(const struct hostent *he, int port) for(i=0; (curr = he->h_addr_list[i]) != NULL; i++) { - int ss_size; + size_t ss_size; #ifdef ENABLE_IPV6 if (he->h_addrtype == AF_INET6) ss_size = sizeof (struct sockaddr_in6); @@ -297,7 +297,7 @@ Curl_he2ai(const struct hostent *he, int port) the type must be ignored and conn->socktype be used instead! */ ai->ai_socktype = SOCK_STREAM; - ai->ai_addrlen = ss_size; + ai->ai_addrlen = (int)ss_size; /* leave the rest of the struct filled with zero */ -- cgit v1.2.1 From 41fd08bb0d7d81d607aa5886188bfb03a439f1f3 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 16 Apr 2009 08:31:09 +0000 Subject: attempt to workaround icc 9.1 optimizer induced problem --- lib/curl_addrinfo.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 19f73c48c..515ddcfd2 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -74,7 +74,12 @@ void Curl_freeaddrinfo(Curl_addrinfo *cahead) { +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) + volatile Curl_addrinfo * volatile ca; + volatile Curl_addrinfo * volatile canext; +#else Curl_addrinfo *ca, *canext; +#endif for(ca = cahead; ca != NULL; ca = canext) { -- cgit v1.2.1 From ce7b5655954393e4d1d2ff64bafa0ba28cae336d Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 17 Apr 2009 07:30:25 +0000 Subject: further narrow the use of the icc 9.1 optimizer workaround --- lib/curl_addrinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 515ddcfd2..d5a6bc712 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -74,7 +74,9 @@ void Curl_freeaddrinfo(Curl_addrinfo *cahead) { -#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ + defined(__unix__) && defined(__i386__) + /* workaround icc 9.1 optimizer issue */ volatile Curl_addrinfo * volatile ca; volatile Curl_addrinfo * volatile canext; #else -- cgit v1.2.1 From 9770899a4bfb27ea73d0b0ee4be857ea1e47c4fd Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 21 Apr 2009 10:26:58 +0000 Subject: Moved potential inclusion of system's malloc.h and memory.h header files to setup_once.h. Inclusion of each header file is based on the definition of NEED_MALLOC_H and NEED_MEMORY_H respectively. --- lib/curl_addrinfo.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index d5a6bc712..f88ea2a93 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -25,9 +25,6 @@ #include -#ifdef NEED_MALLOC_H -# include -#endif #ifdef HAVE_SYS_SOCKET_H # include #endif -- cgit v1.2.1 From 33a3753c3f41d546ebf3350685eb7201d25783f4 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 21 Apr 2009 11:46:16 +0000 Subject: libcurl's memory.h renamed to curl_memory.h --- lib/curl_addrinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index f88ea2a93..8c85f8865 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -54,7 +54,7 @@ #define _MPRINTF_REPLACE /* use our functions only */ #include -#include "memory.h" +#include "curl_memory.h" /* The last #include file should be: */ #include "memdebug.h" -- cgit v1.2.1 From bc5677a47b242cea075e6761bd744116f8c3f710 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 22 Apr 2009 15:03:05 +0000 Subject: Disable optimizations when compiling function Curl_freeaddrinfo() with icc 9.1 on unix IA32. Previous 'volatile' variables workaround proved useful, but it triggered the following warning: warning #167: argument of type "volatile Curl_addrinfo *" is incompatible with parameter of type "void *" --- lib/curl_addrinfo.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 8c85f8865..4e1eb4c26 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -68,17 +68,15 @@ * any function call which actually allocates a Curl_addrinfo struct. */ +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ + defined(__unix__) && defined(__i386__) +# pragma optimize("", off) +#endif + void Curl_freeaddrinfo(Curl_addrinfo *cahead) { -#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ - defined(__unix__) && defined(__i386__) - /* workaround icc 9.1 optimizer issue */ - volatile Curl_addrinfo * volatile ca; - volatile Curl_addrinfo * volatile canext; -#else Curl_addrinfo *ca, *canext; -#endif for(ca = cahead; ca != NULL; ca = canext) { @@ -94,6 +92,10 @@ Curl_freeaddrinfo(Curl_addrinfo *cahead) } } +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ + defined(__unix__) && defined(__i386__) +# pragma optimize("", on) +#endif #ifdef HAVE_GETADDRINFO /* -- cgit v1.2.1 From 2236a247d9bedc6e79c73b47d37a5794300029ce Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 23 Apr 2009 11:09:20 +0000 Subject: Try another variation of the 'volatile' variables icc 9.1 on unix IA32 workaround. The #pragma optimize("", off) attempt did not fix the problem and SIGSEGV's in Curl_freeaddrinfo() were back. --- lib/curl_addrinfo.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 4e1eb4c26..14b2a438b 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -68,15 +68,17 @@ * any function call which actually allocates a Curl_addrinfo struct. */ -#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ - defined(__unix__) && defined(__i386__) -# pragma optimize("", off) -#endif - void Curl_freeaddrinfo(Curl_addrinfo *cahead) { +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ + defined(__unix__) && defined(__i386__) + /* workaround icc 9.1 optimizer issue */ + volatile Curl_addrinfo * volatile canext; + Curl_addrinfo *ca; +#else Curl_addrinfo *ca, *canext; +#endif for(ca = cahead; ca != NULL; ca = canext) { @@ -92,10 +94,6 @@ Curl_freeaddrinfo(Curl_addrinfo *cahead) } } -#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ - defined(__unix__) && defined(__i386__) -# pragma optimize("", on) -#endif #ifdef HAVE_GETADDRINFO /* -- cgit v1.2.1 From 651b4b9efacfb3742682b8f1d8c97feb3255e2db Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 24 Apr 2009 10:38:12 +0000 Subject: Try a simpler variation of the 'volatile' variables icc 9.1 on unix IA32 workaround. Previous workaround proved useful, but triggered the following warning: warning #556: a value of type "volatile Curl_addrinfo *" cannot be assigned to an entity of type "Curl_addrinfo *" --- lib/curl_addrinfo.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 14b2a438b..9d56e6a2f 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -68,18 +68,20 @@ * any function call which actually allocates a Curl_addrinfo struct. */ -void -Curl_freeaddrinfo(Curl_addrinfo *cahead) -{ #if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ defined(__unix__) && defined(__i386__) /* workaround icc 9.1 optimizer issue */ - volatile Curl_addrinfo * volatile canext; - Curl_addrinfo *ca; +# define vqualifier volatile #else - Curl_addrinfo *ca, *canext; +# define vqualifier #endif +void +Curl_freeaddrinfo(Curl_addrinfo *cahead) +{ + Curl_addrinfo *vqualifier canext; + Curl_addrinfo *ca; + for(ca = cahead; ca != NULL; ca = canext) { if(ca->ai_addr) -- cgit v1.2.1 From c0d929bed98d261becbeb43547685adc9daae686 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sat, 25 Apr 2009 10:24:11 +0000 Subject: Further narrow the use of the icc 9.1 optimizer workaround. Previous workaround proved useful, and finally did not trigger any warning! --- lib/curl_addrinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 9d56e6a2f..a9db3d75f 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -69,7 +69,7 @@ */ #if defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 910) && \ - defined(__unix__) && defined(__i386__) + defined(__OPTIMIZE__) && defined(__unix__) && defined(__i386__) /* workaround icc 9.1 optimizer issue */ # define vqualifier volatile #else -- cgit v1.2.1 From 9137e717b04644592b9b527839470337fdd9f44d Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sat, 2 May 2009 02:37:32 +0000 Subject: Use build-time configured curl_socklen_t instead of socklen_t --- lib/curl_addrinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index a9db3d75f..24ba4fa20 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -221,7 +221,7 @@ Curl_getaddrinfo_ex(const char *nodename, * int ai_family; * int ai_socktype; * int ai_protocol; - * socklen_t ai_addrlen; * Follow rfc3493 struct addrinfo * + * curl_socklen_t ai_addrlen; * Follow rfc3493 struct addrinfo * * char *ai_canonname; * struct sockaddr *ai_addr; * struct Curl_addrinfo *ai_next; -- cgit v1.2.1 From a85271ce0a6f60fa09b95a7fa2c9b3946b4ea2f2 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sun, 10 May 2009 10:24:53 +0000 Subject: Fix type cast --- lib/curl_addrinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 24ba4fa20..963335111 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -303,7 +303,7 @@ Curl_he2ai(const struct hostent *he, int port) the type must be ignored and conn->socktype be used instead! */ ai->ai_socktype = SOCK_STREAM; - ai->ai_addrlen = (int)ss_size; + ai->ai_addrlen = (curl_socklen_t)ss_size; /* leave the rest of the struct filled with zero */ -- cgit v1.2.1 From 3184a91ec86b2f35f16a8e11e2daa03fac8e91b6 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 30 Dec 2009 17:59:56 +0000 Subject: VMS specific preprocessor symbol checking adjustments --- lib/curl_addrinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 963335111..a5d26165c 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -38,7 +38,7 @@ # include #endif -#ifdef VMS +#ifdef __VMS # include # include # include @@ -365,7 +365,7 @@ Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port) { Curl_addrinfo *ai; -#if defined(VMS) && \ +#if defined(__VMS) && \ defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64) #pragma pointer_size save #pragma pointer_size short @@ -418,7 +418,7 @@ Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port) h->h_addr_list[0] = addrentry; h->h_addr_list[1] = NULL; /* terminate list of entries */ -#if defined(VMS) && \ +#if defined(__VMS) && \ defined(__INITIAL_POINTER_SIZE) && (__INITIAL_POINTER_SIZE == 64) #pragma pointer_size restore #pragma message enable PTRMISMATCH -- cgit v1.2.1 From ccfe279117f197d2b3d0bb17bc754209024836a2 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 18 Jan 2010 20:22:04 +0000 Subject: Constantine Sapuntzakis enhancements to make memory tracking log file writing of messages atomic, on systems where an fwrite of a memory buffer is atomic. --- lib/curl_addrinfo.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index a5d26165c..07dc1e7f0 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -447,9 +447,8 @@ curl_dofreeaddrinfo(struct addrinfo *freethis, int line, const char *source) { (freeaddrinfo)(freethis); - if(logfile) - fprintf(logfile, "ADDR %s:%d freeaddrinfo(%p)\n", - source, line, (void *)freethis); + curl_memlog("ADDR %s:%d freeaddrinfo(%p)\n", + source, line, (void *)freethis); } #endif /* defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO) */ @@ -471,17 +470,13 @@ curl_dogetaddrinfo(const char *hostname, int line, const char *source) { int res=(getaddrinfo)(hostname, service, hints, result); - if(0 == res) { + if(0 == res) /* success */ - if(logfile) - fprintf(logfile, "ADDR %s:%d getaddrinfo() = %p\n", - source, line, (void *)*result); - } - else { - if(logfile) - fprintf(logfile, "ADDR %s:%d getaddrinfo() failed\n", - source, line); - } + curl_memlog("ADDR %s:%d getaddrinfo() = %p\n", + source, line, (void *)*result); + else + curl_memlog("ADDR %s:%d getaddrinfo() failed\n", + source, line); return res; } #endif /* defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) */ -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- lib/curl_addrinfo.c | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 07dc1e7f0..c38a1ed25 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -18,7 +18,6 @@ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * - * $Id$ ***************************************************************************/ #include "setup.h" -- cgit v1.2.1 From 2f0c1185776f3483cb042c699dc52f5a4662079e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 30 Jul 2010 23:19:08 +0200 Subject: warning: silence a win64 compiler warning conversion from 'size_t' to 'curl_socklen_t', possible loss of data Reported by: Adam Light --- lib/curl_addrinfo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index c38a1ed25..5098fa431 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -151,7 +151,10 @@ Curl_getaddrinfo_ex(const char *nodename, ca->ai_next = NULL; if((ai->ai_addrlen > 0) && (ai->ai_addr != NULL)) { - ca->ai_addrlen = ai->ai_addrlen; + /* typecast below avoid warning on at least win64: + conversion from 'size_t' to 'curl_socklen_t', possible loss of data + */ + ca->ai_addrlen = (curl_socklen_t)ai->ai_addrlen; if((ca->ai_addr = malloc(ca->ai_addrlen)) == NULL) { error = EAI_MEMORY; free(ca); -- cgit v1.2.1 From 1b24b89cca3c06e36b69969af8edeeaca659515b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 5 Nov 2010 22:31:40 +0100 Subject: CURLOPT_RESOLVE: added CURLOPT_RESOLVE is a new option that sends along a curl_slist with name:port:address sets that will populate the DNS cache with entries so that request can be "fooled" to use another host than what otherwise would've been used. Previously we've encouraged the use of Host: for that when dealing with HTTP, but this new feature has the added bonus that it allows the name from the URL to be used for TLS SNI and server certificate name checks as well. This is a first change. Surely more will follow to make it decent. --- lib/curl_addrinfo.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 5098fa431..cfb858c6b 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -49,6 +49,7 @@ #endif #include "curl_addrinfo.h" +#include "inet_pton.h" #define _MPRINTF_REPLACE /* use our functions only */ #include @@ -434,6 +435,26 @@ Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port) return ai; } +/* + * Given an IPv4 or IPv6 dotted string address, this converts it to a proper + * allocated Curl_addrinfo struct and returns it. + */ +Curl_addrinfo *Curl_str2addr(char *address, int port) +{ + struct in_addr in; + if(Curl_inet_pton(AF_INET, address, &in) > 0) + /* This is a dotted IP address 123.123.123.123-style */ + return Curl_ip2addr(AF_INET, &in, address, port); +#ifdef ENABLE_IPV6 + else { + struct in6_addr in6; + if(Curl_inet_pton(AF_INET6, address, &in6) > 0) + /* This is a dotted IPv6 address ::1-style */ + return Curl_ip2addr(AF_INET6, &in6, address, port); + } +#endif + return NULL; /* bad input format */ +} #if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO) /* -- cgit v1.2.1 From 6fe18add714d3d56d4ba24f2a2463fca125c0a1b Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 23 Nov 2010 21:38:20 +0100 Subject: Curl_getaddrinfo_ex: sanitize function results. Ensure that spurious results from system's getaddrinfo() ares not propagated by Curl_getaddrinfo_ex() into the library. Also ensure that the ai_addrlen member of Curl_getaddrinfo_ex()'s output linked list of Curl_addrinfo structures has appropriate family-specific address size. --- lib/curl_addrinfo.c | 50 +++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index cfb858c6b..7fb816f3a 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -118,12 +118,12 @@ Curl_getaddrinfo_ex(const char *nodename, const struct addrinfo *hints, Curl_addrinfo **result) { - const struct addrinfo *ainext; const struct addrinfo *ai; struct addrinfo *aihead; Curl_addrinfo *cafirst = NULL; Curl_addrinfo *calast = NULL; Curl_addrinfo *ca; + size_t ss_size; int error; *result = NULL; /* assume failure */ @@ -132,7 +132,28 @@ Curl_getaddrinfo_ex(const char *nodename, if(error) return error; - for(ai = aihead; ai != NULL; ai = ainext) { + /* traverse the addrinfo list */ + + for(ai = aihead; ai != NULL; ai = ai->ai_next) { + + /* ignore elements with unsupported address family, */ + /* settle family-specific sockaddr structure size. */ + if(ai->ai_family == AF_INET) + ss_size = sizeof(struct sockaddr_in); +#ifdef ENABLE_IPV6 + else if(ai->ai_family == AF_INET6) + ss_size = sizeof(struct sockaddr_in6); +#endif + else + continue; + + /* ignore elements without required address info */ + if((ai->ai_addr == NULL) || !(ai->ai_addrlen > 0)) + continue; + + /* ignore elements with bogus address size */ + if((size_t)ai->ai_addrlen < ss_size) + continue; if((ca = malloc(sizeof(Curl_addrinfo))) == NULL) { error = EAI_MEMORY; @@ -140,35 +161,28 @@ Curl_getaddrinfo_ex(const char *nodename, } /* copy each structure member individually, member ordering, */ - /* size, or padding might be different for each structure. */ + /* size, or padding might be different for each platform. */ ca->ai_flags = ai->ai_flags; ca->ai_family = ai->ai_family; ca->ai_socktype = ai->ai_socktype; ca->ai_protocol = ai->ai_protocol; - ca->ai_addrlen = 0; + ca->ai_addrlen = (curl_socklen_t)ss_size; ca->ai_addr = NULL; ca->ai_canonname = NULL; ca->ai_next = NULL; - if((ai->ai_addrlen > 0) && (ai->ai_addr != NULL)) { - /* typecast below avoid warning on at least win64: - conversion from 'size_t' to 'curl_socklen_t', possible loss of data - */ - ca->ai_addrlen = (curl_socklen_t)ai->ai_addrlen; - if((ca->ai_addr = malloc(ca->ai_addrlen)) == NULL) { - error = EAI_MEMORY; - free(ca); - break; - } - memcpy(ca->ai_addr, ai->ai_addr, ca->ai_addrlen); + if((ca->ai_addr = malloc(ss_size)) == NULL) { + error = EAI_MEMORY; + free(ca); + break; } + memcpy(ca->ai_addr, ai->ai_addr, ss_size); if(ai->ai_canonname != NULL) { if((ca->ai_canonname = strdup(ai->ai_canonname)) == NULL) { error = EAI_MEMORY; - if(ca->ai_addr) - free(ca->ai_addr); + free(ca->ai_addr); free(ca); break; } @@ -183,8 +197,6 @@ Curl_getaddrinfo_ex(const char *nodename, calast->ai_next = ca; calast = ca; - /* fetch next element fom the addrinfo list */ - ainext = ai->ai_next; } /* destroy the addrinfo list */ -- cgit v1.2.1 From 1d75d308169fe1c4ffd55c04a1a947530115b8cc Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 24 Nov 2010 04:36:57 +0100 Subject: Curl_getaddrinfo_ex: sanitize function results follow-up. --- lib/curl_addrinfo.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 7fb816f3a..6feccf2d0 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -208,6 +208,18 @@ Curl_getaddrinfo_ex(const char *nodename, Curl_freeaddrinfo(cafirst); cafirst = NULL; } + else if(!cafirst) { +#ifdef EAI_NONAME + /* rfc3493 conformant */ + error = EAI_NONAME; +#else + /* rfc3493 obsoleted */ + error = EAI_NODATA; +#endif +#ifdef USE_WINSOCK + SET_SOCKERRNO(error); +#endif + } *result = cafirst; -- cgit v1.2.1 From 210278d9a1424365721e76f7934dbff06ccf9a60 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Tue, 19 Apr 2011 15:55:37 +0200 Subject: In lib/, change 'wanna' to 'want to'. Found with codespell. --- lib/curl_addrinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 6feccf2d0..8489204bd 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -486,7 +486,7 @@ Curl_addrinfo *Curl_str2addr(char *address, int port) * * This is strictly for memory tracing and are using the same style as the * family otherwise present in memdebug.c. I put these ones here since they - * require a bunch of structs I didn't wanna include in memdebug.c + * require a bunch of structs I didn't want to include in memdebug.c */ void @@ -506,7 +506,7 @@ curl_dofreeaddrinfo(struct addrinfo *freethis, * * This is strictly for memory tracing and are using the same style as the * family otherwise present in memdebug.c. I put these ones here since they - * require a bunch of structs I didn't wanna include in memdebug.c + * require a bunch of structs I didn't want to include in memdebug.c */ int -- cgit v1.2.1 From b903186fa0189ff241d756d25d07fdfe9885ae49 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 20 Apr 2011 15:17:42 +0200 Subject: source cleanup: unify look, style and indent levels By the use of a the new lib/checksrc.pl script that checks that our basic source style rules are followed. --- lib/curl_addrinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 8489204bd..023a00678 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2010, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -294,7 +294,7 @@ Curl_he2ai(const struct hostent *he, int port) size_t ss_size; #ifdef ENABLE_IPV6 - if (he->h_addrtype == AF_INET6) + if(he->h_addrtype == AF_INET6) ss_size = sizeof (struct sockaddr_in6); else #endif -- cgit v1.2.1 From 3c9ff41a1fef4b03571f5a7f905e5016cae55208 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 26 May 2011 15:44:53 +0200 Subject: compiler warning: fix Fix compiler warning: conversion may lose significant bits --- lib/curl_addrinfo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 023a00678..074bf17dc 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -50,6 +50,7 @@ #include "curl_addrinfo.h" #include "inet_pton.h" +#include "warnless.h" #define _MPRINTF_REPLACE /* use our functions only */ #include -- cgit v1.2.1 From f1586cb4775681810afd8e6626e7842d459f3b85 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 26 Jul 2011 17:23:27 +0200 Subject: stdio.h, stdlib.h, string.h, stdarg.h and ctype.h inclusion done in setup_once.h --- lib/curl_addrinfo.c | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/curl_addrinfo.c') diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c index 074bf17dc..bae403f95 100644 --- a/lib/curl_addrinfo.c +++ b/lib/curl_addrinfo.c @@ -40,7 +40,6 @@ #ifdef __VMS # include # include -# include #endif #if defined(NETWARE) && defined(__NOVELL_LIBC__) -- cgit v1.2.1