Package: ipopd
Severity: normal
Tags: patch

Hi,

  When connecting via ipv6 on the pop3s port ipop3d doesn't notice that it 
  should start the SSL negotiation instead of normal pop3 stuff.

  This is because uw-imap doesn't know how to get a port out of an IPV6
  sockaddr_*. Fixed in attached patch

  Sjoerd

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (101, 
'experimental')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.15-1-powerpc
Locale: LANG=C, [EMAIL PROTECTED] (charmap=ISO-8859-15)
--- uw-imap-2002edebian1/src/osdep/unix/tcp_unix.c	2002-10-31 21:04:41.000000000 +0100
+++ uw-imap-2002edebian1.ipv6/src/osdep/unix/tcp_unix.c	2006-01-16 16:18:24.000000000 +0100
@@ -810,14 +810,17 @@
 char *tcp_serverhost ()
 {
   if (!myServerHost) {
-    struct sockaddr_in sin;
-    int sinlen = sizeof (struct sockaddr_in);
+    struct sockaddr_storage sin;
+    int sinlen = sizeof (struct sockaddr_storage);
 				/* get stdin's name */
     if (getsockname (0,(struct sockaddr *) &sin,(void *) &sinlen) ||
-	(sin.sin_family != AF_INET)) myServerHost = cpystr (mylocalhost ());
-    else {
-      myServerHost = tcp_name (&sin,NIL);
-      myServerPort = ntohs (sin.sin_port);
+	(sin.ss_family != AF_INET && sin.ss_family != AF_INET6)) myServerHost = cpystr (mylocalhost ());
+    else if (sin.ss_family == AF_INET6) {
+      myServerHost = cpystr (mylocalhost ());
+      myServerPort = ntohs (((struct sockaddr_in6 *)&sin)->sin6_port);
+    } else { /* AF_INET */
+      myServerHost = tcp_name ((struct sockaddr_in *)&sin,NIL);
+      myServerPort = ntohs (((struct sockaddr_in *)&sin)->sin_port);
     }
   }
   return myServerHost;

Reply via email to