Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 158234 - ftp can't connect to servers in passive mode
Summary: ftp can't connect to servers in passive mode
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: ftp
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jiri Ryska
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks: FC4Blocker
TreeView+ depends on / blocked
 
Reported: 2005-05-19 19:26 UTC by Nalin Dahyabhai
Modified: 2007-11-30 22:11 UTC (History)
4 users (show)

Fixed In Version: 0.17-26
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-05-24 20:21:30 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
patch to existing patch to call connect() with correct values (deleted)
2005-05-19 19:26 UTC, Nalin Dahyabhai
no flags Details | Diff

Description Nalin Dahyabhai 2005-05-19 19:26:20 UTC
Description of problem:
When connecting to the data port on a server in passive mode, the ftp client can
get EINVAL when it calls connect().

Version-Release number of selected component (if applicable):
ftp-0.17-25

How reproducible:
Always

Steps to Reproduce:
1. Connect to an FTP server using its IPv4 address.  Anonymous is fine.
2. Attempt to use the "ls" command.
  
Actual results:
227 Entering Passive Mode (172,16,58,2,201,63)
ftp: connect: Invalid argument

Expected results:
Successful data transfer.

Additional info:
At line 729 of netkit-ftp.usagi-ipv6.patch, ftp passes the size of a union of a
struct sockaddr_in and a sockaddr_in6 to the connect() call as the socket
address length, and is rejected.
I don't know if this is a recent change in either glibc or the kernel, but fwiw
I'm using glibc-2.3.5-6 on kernel-2.6.11-1.1315_FC4smp.
Attaching a patch for the patch to pass the size of the right address structure.

Comment 1 Nalin Dahyabhai 2005-05-19 19:26:20 UTC
Created attachment 114576 [details]
patch to existing patch to call connect() with correct values

Comment 2 Miloslav Trmač 2005-05-21 10:07:47 UTC
I can't reproduce this, neither using ftp nor with a minimal test program.
(looking at strace of ftp, libc uses sizeof(struct sockaddr_in6) when connecting
to AF_INET too).

glibc-2.3.5-6
kernel-2.6.11-1.1276_FC4 and kernel-2.6.11-1.1323_FC4


Comment 3 Warren Togami 2005-05-23 03:18:25 UTC
ping glibc guys, possible glibc involvement?

Comment 4 Jakub Jelinek 2005-05-23 07:36:06 UTC
There is none.  glibc's connect/accept/listen and other socket calls are either
straight syscalls, or trivial wrappers around socketcall syscall.
So whether connect succeeds or fails is solely kernel's decision.

Comment 5 Joe Orton 2005-05-23 15:11:15 UTC
Confirmed here with current Raw Hide.  Simple repro is:

# service vsftpd start
# /usr/bin/ftp localhost
...
ftp> ls
227 Entering Passive Mode (172,16,18,217,117,95)
ftp: connect: Invalid argument

confirmed also that it works fine after applying Nalin's patch, which is clearly
doing the Right Thing.

Comment 6 Miloslav Trmač 2005-05-24 20:21:30 UTC
Reproduced - this check is only in SELinux (and only for TCP).
Fixed in ftp-0.17-26, thanks!


Note You need to log in before you can comment on or make changes to this bug.