<<< Date Index >>>     <<< Thread Index >>>

sasl2 and ipv6



I just tried cvs-mutt of yesterday, among other things,
--with-sasl2 --enable-imap. Connecting to the imap server is fine with
  set use_ipv6=no
but otherwise I get
  mutt: Bad IPLOCALPORT value
This is coming from the sasl library. I'm still trying to find out why...
I got an error from getnameinfo at one stage - patch included to help
future debugging efforts..
(Oh - I think it is mutt rather than the server as I can connect to it
over ipv6 with a different client)

Cheers,

Patrick
(PS user question: with new as opposed to version 1.3 mutt, replies don't
appear even with set include=yes..)
Index: mutt_sasl.c
===================================================================
RCS file: /home/roessler/cvs/mutt/mutt_sasl.c,v
retrieving revision 3.4
diff -u -r3.4 mutt_sasl.c
--- mutt_sasl.c 11 Sep 2003 16:59:54 -0000      3.4
+++ mutt_sasl.c 3 Nov 2003 13:41:00 -0000
@@ -32,6 +32,47 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 
+static int getnameinfo_err(int ret)
+{
+  int err;
+  switch(ret)
+  {
+     case EAI_AGAIN:
+       dprint (1, (debugfile, "The name could not be resolved at this time.  
Future attempts may succeed.\n"));
+       err=SASL_TRYAGAIN;
+       break;
+     case EAI_BADFLAGS:
+       dprint (1, (debugfile, "The flags had an invalid value.\n"));
+       err=SASL_BADPARAM;
+       break;
+     case EAI_FAIL:
+       dprint (1, (debugfile, "A non-recoverable error occurred.\n"));
+       err=SASL_FAIL;
+       break;
+     case EAI_FAMILY:
+       dprint (1, (debugfile, "The address family was not recognized or the 
address length was invalid for the specified family.\n"));
+       err=SASL_BADPROT;
+       break;
+     case EAI_MEMORY:
+       dprint (1, (debugfile, "There was a memory allocation failure.\n"));
+       err=SASL_NOMEM;
+       break;
+     case EAI_NONAME:
+       dprint (1, (debugfile, "The name does not resolve for the supplied 
parameters.  NI_NAMEREQD is set and the host's name cannot be located, or both 
nodename and servname were null.\n"));
+       err=SASL_FAIL; /* no real equivalent */
+       break;
+     case EAI_SYSTEM:
+       dprint (1, (debugfile, "A system error occurred.  The error code can be 
found in errno(%d,%s)).\n",errno,strerror(errno)));
+       err=SASL_FAIL; /* no real equivalent */
+       break;
+     default:
+       dprint (1, (debugfile, "Unknown error %d\n",ret));
+       err=SASL_FAIL; /* no real equivalent */
+       break;
+  }
+  return err;
+}
+
 /* arbitrary. SASL will probably use a smaller buffer anyway. OTOH it's
  * been a while since I've had access to an SASL server which negotiated
  * a protection buffer. */ 
@@ -64,15 +105,18 @@
 static int iptostring(const struct sockaddr *addr, socklen_t addrlen,
                      char *out, unsigned outlen) {
     char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV];
+    int ret;
     
     if(!addr || !out) return SASL_BADPARAM;
 
-    getnameinfo(addr, addrlen, hbuf, sizeof(hbuf), pbuf, sizeof(pbuf),
-                NI_NUMERICHOST |
+    ret=getnameinfo(addr, addrlen, hbuf, sizeof(hbuf), pbuf, sizeof(pbuf),
+                   NI_NUMERICHOST |
 #ifdef NI_WITHSCOPEID
-               NI_WITHSCOPEID |
+                  NI_WITHSCOPEID |
 #endif
-               NI_NUMERICSERV);
+                  NI_NUMERICSERV);
+    if(ret)
+      return getnameinfo_err(ret);
 
     if(outlen < strlen(hbuf) + strlen(pbuf) + 2)
         return SASL_BUFOVER;