head 1.2; access; symbols pkgsrc-2013Q2:1.2.0.12 pkgsrc-2013Q2-base:1.2 pkgsrc-2012Q4:1.2.0.10 pkgsrc-2012Q4-base:1.2 pkgsrc-2011Q4:1.2.0.8 pkgsrc-2011Q4-base:1.2 pkgsrc-2011Q2:1.2.0.6 pkgsrc-2011Q2-base:1.2 pkgsrc-2009Q4:1.2.0.4 pkgsrc-2009Q4-base:1.2 pkgsrc-2008Q4:1.2.0.2 pkgsrc-2008Q4-base:1.2 pkgsrc-2008Q3:1.1.0.10 pkgsrc-2008Q3-base:1.1 cube-native-xorg:1.1.0.8 cube-native-xorg-base:1.1 pkgsrc-2008Q2:1.1.0.6 pkgsrc-2008Q2-base:1.1 cwrapper:1.1.0.4 pkgsrc-2008Q1:1.1.0.2 pkgsrc-2008Q1-base:1.1; locks; strict; comment @# @; 1.2 date 2008.10.05.22.42.36; author smb; state dead; branches; next 1.1; 1.1 date 2008.01.25.18.26.32; author smb; state Exp; branches; next ; desc @@ 1.2 log @Update to 0.56: >> libetpan 0.55/0.56 released. better support for client certificates >> libetpan 0.53/0.54 released. IPv6 issue gmail issues mingw32 build @ text @$NetBSD: patch-af,v 1.1 2008/01/25 18:26:32 smb Exp $ --- src/data-types/connect.c.orig 2007-08-06 17:32:30.000000000 -0400 +++ src/data-types/connect.c 2008-01-25 13:15:13.000000000 -0500 @@@@ -88,6 +88,21 @@@@ return 0; } +#ifdef HAVE_IPV6 +static int verify_sock_errors(int s) +{ + uint len; + int val; + len = sizeof(val); + if (getsockopt(s, SOL_SOCKET, SO_ERROR, &val, &len) < 0) { + return -1; + } else if (val != 0) { + return -1; + } + return 0; +} +#endif + static int wait_connect(int s, int r) { fd_set fds; @@@@ -206,6 +221,7 @@@@ for (ai = res; ai != NULL; ai = ai->ai_next) { s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); + if (s == -1) continue; @@@@ -239,9 +255,23 @@@@ r = connect(s, ai->ai_addr, ai->ai_addrlen); r = wait_connect(s, r); + + if (r != -1) { + r = verify_sock_errors(s); + } + if (r == -1) { + if (ai->ai_next) { +#ifdef WIN32 + closesocket(s); +#else + close(s); +#endif + continue; + } else { goto close_socket; } + } /* if we're here, we're good */ break; } @@@@ -252,7 +282,6 @@@@ if (ai == NULL) goto err; #endif - return s; close_socket: @ 1.1 log @FIx a bug where the remote IMAP server has a AAAA record but there's no IPv6 connectivity from the client to that site. Prior to this fix, the fallback to IPv4 wasn't working properly. (The fix should be in the next release of libetpan.) @ text @d1 1 a1 1 $NetBSD$ @