Bug 432526 - Vsftpd file locking does not work
Summary: Vsftpd file locking does not work
Keywords:
Status: CLOSED DUPLICATE of bug 240553
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: vsftpd
Version: 5.3
Hardware: All
OS: Linux
low
high
Target Milestone: rc
: ---
Assignee: Martin Nagy
QA Contact:
URL: http://bashcurescancer.com/a-bug-in-v...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-02-12 16:28 UTC by Brock Noland
Modified: 2016-07-26 23:46 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-02-12 17:50:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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 ***


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