Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 432526

Summary: Vsftpd file locking does not work
Product: Red Hat Enterprise Linux 5 Reporter: Brock Noland <brockn>
Component: vsftpdAssignee: Martin Nagy <mnagy>
Status: CLOSED DUPLICATE QA Contact:
Severity: high Docs Contact:
Priority: low    
Version: 5.3CC: hripps
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://bashcurescancer.com/a-bug-in-vsftpd-and-using-ftp-on-the-command-line.html
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-02-12 17:50:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Brock Noland 2008-02-12 16:28:28 UTC
Description of problem:

Vsftpd added file locking 2.0.3. However, the implementation is not working and
corrupts files.

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

2.0.5-10.el5

How reproducible:

Start two FTP sessions writing to the same file. After the upload, the file will
be corrupt.

Steps to Reproduce:

(In two different terminals)

$ date; curl -s -T bigfile --user noland:password
ftp://localhost/vsftpd-file-locking; date
Mon Jan 14 19:06:51 CST 2008
Mon Jan 14 19:07:20 CST 2008

$ date; curl -s -T bigfile --user noland:password
ftp://localhost/vsftpd-file-locking; date
Mon Jan 14 19:06:52 CST 2008
Mon Jan 14 19:07:50 CST 2008


Actual results:

$ ls -l vsftpd-file-locking bigfile
-rw-r--r-- 1 noland users  512000000 2008-01-14 18:17 bigfile
-rw-r--r-- 1 noland users 1019576320 2008-01-14 19:07 vsftpd-file-locking  

Expected results:

vsftpd-file-locking should be an exact copy of bigfile.

Additional info:

I fixed the behavior with the following change sysutil.c.

  vsf_sysutil_create_overwrite_file(const char* p_filename)
  {
  //  return open(p_filename, O_CREAT | O_TRUNC | O_WRONLY |
  //                          O_APPEND | O_NONBLOCK,
  //              tunable_file_open_mode);
    return open(p_filename, O_CREAT | O_TRUNC | O_WRONLY |
                            O_NONBLOCK,
                tunable_file_open_mode);
  }

Comment 1 Brock Noland 2008-02-12 16:34:47 UTC
Woops, just saw 240553.

Comment 2 Martin Nagy 2008-02-12 17:50:37 UTC

*** This bug has been marked as a duplicate of 240553 ***