[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#538138: Acknowledgement (ftplib3: not IPv6 enabled)



This patch should implement IPv6 functionality.

diff -uNrBbd ftplib-3.1-1.org/CHANGES ftplib-3.1-1.new/CHANGES
--- ftplib-3.1-1.org/CHANGES	2000-09-16 18:22:16.000000000 +0200
+++ ftplib-3.1-1.new/CHANGES	2009-07-23 15:45:08.000000000 +0200
@@ -1,3 +1,5 @@
+2009/7/23, IPv6 support by folkert@vanheusden.com
+
 The obligatory revision history...
 
 Changes from V3.1 to V3.1-1
diff -uNrBbd ftplib-3.1-1.org/linux/ftplib.c ftplib-3.1-1.new/linux/ftplib.c
--- ftplib-3.1-1.org/linux/ftplib.c	2001-02-02 17:29:45.000000000 +0100
+++ ftplib-3.1-1.new/linux/ftplib.c	2009-07-23 15:30:26.000000000 +0200
@@ -384,7 +384,7 @@
 GLOBALDEF int FtpConnect(const char *host, netbuf **nControl)
 {
     int sControl;
-    struct sockaddr_in sin;
+    struct sockaddr_in6 sin;
     struct hostent *phe;
     struct servent *pse;
     int on=1;
@@ -393,9 +393,9 @@
     char *pnum;
 
     memset(&sin,0,sizeof(sin));
-    sin.sin_family = AF_INET;
+    sin.sin6_family = AF_INET6;
     lhost = strdup(host);
-    pnum = strchr(lhost,':');
+    pnum = strchr(lhost,' ');
     if (pnum == NULL)
     {
 #if defined(VMS)
@@ -406,31 +406,32 @@
 	    perror("getservbyname");
 	    return 0;
     	}
-    	sin.sin_port = pse->s_port;
+    	sin.sin6_port = htons(pse->s_port);
 #endif
     }
     else
     {
 	*pnum++ = '\0';
 	if (isdigit(*pnum))
-	    sin.sin_port = htons(atoi(pnum));
+	    sin.sin6_port = htons(atoi(pnum));
 	else
 	{
 	    pse = getservbyname(pnum,"tcp");
-	    sin.sin_port = pse->s_port;
+	    sin.sin6_port = pse->s_port;
 	}
     }
-    if ((sin.sin_addr.s_addr = inet_addr(lhost)) == -1)
+    if (inet_pton(AF_INET6, lhost, &sin.sin6_addr) == 0)
     {
     	if ((phe = gethostbyname(lhost)) == NULL)
     	{
 	    perror("gethostbyname");
 	    return 0;
     	}
-    	memcpy((char *)&sin.sin_addr, phe->h_addr, phe->h_length);
+    	memcpy((char *)&sin.sin6_addr, phe->h_addr, phe->h_length);
+        sin.sin6_family = phe->h_addrtype;
     }
     free(lhost);
-    sControl = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
+    sControl = socket(sin.sin6_family, SOCK_STREAM, IPPROTO_TCP);
     if (sControl == -1)
     {
 	perror("socket");

On Thu, Jul 23, 2009 at 12:54:04PM +0000, Debian Bug Tracking System wrote:
> 
> Thank you for filing a new Bug report with Debian.
> 
> This is an automatically generated reply to let you know your message
> has been received.
> 
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
> 
> Your message has been sent to the package maintainer(s):
>  Debian QA Group <packages@qa.debian.org>
> 
> If you wish to submit further information on this problem, please
> send it to 538138@bugs.debian.org, as before.
> 
> Please do not send mail to owner@bugs.debian.org unless you wish
> to report a problem with the Bug-tracking system.
> 
> 
> -- 
> 538138: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=538138
> Debian Bug Tracking System
> Contact owner@bugs.debian.org with problems


Folkert van Heusden

-- 

Multitail - gibkaja utilita po sledovaniju log-fajlov i vyvoda
kommand. Fil'trovanie, raskra?ivanie, slijanie, vizual'noe sravnenie,
i t.d.  http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com

Attachment: ftplib-3.1-1.patch_ipv6.bz2
Description: Binary data


Reply to: