Bug 432526 - Vsftpd file locking does not work
Vsftpd file locking does not work
Status: CLOSED DUPLICATE of bug 240553
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: vsftpd (Show other bugs)
5.3
All Linux
low Severity high
: rc
: ---
Assigned To: Martin Nagy
http://bashcurescancer.com/a-bug-in-v...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-02-12 11:28 EST by Brock Noland
Modified: 2016-07-26 19:46 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-02-12 12:50:37 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Brock Noland 2008-02-12 11:28:28 EST
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 11:34:47 EST
Woops, just saw 240553.
Comment 2 Martin Nagy 2008-02-12 12:50:37 EST

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

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