Subject: File Locking Suggestion

From: [email-masked] (Schoolfield W. R. (Bill))
Date: Tue, 5 Nov 96 13:56:10 CST

Hi:

At my company we routinely receive very large files
at our ftp site (running wuftpd) from vendors over the
internet. 

Here's our problem: 

We have a script under the control of
cron that executes periodically. The script's job is to
retrieve any deposited files, perform logging and other
file processing.

We very often run into problems when we try to "get" a
file that is still being "put" (The script detects this
situation by comparing the local file size against the 
file size on the ftp server-BUT NOT before a very large
transfer is attempted).

I have solved this problem by using file locking (lockf 
calls). I lock files being "put" and I check files for a
lock before a "get". 

The changes are minor; only one source file is changed
(wftpd.c).

My questions are this:

	Is this a OK thing to do? Is it general enough? 
	Where might it fail?

and if the answer is yes...

	Who do I submit these changes (ideas) to?

Thanks for those who reply. 

Bill  

----------------------------------------------------------------------------
| Bill Schoolfield                               [email-masked] |
| Union Pacific Resources                                     817-877-6790 |
| P.O. Box 7                                                               |
| Fort Worth, TX 76101                                                     |
----------------------------------------------------------------------------

---

From: Alain Magloire <[email-masked]>
Date: Wed, 6 Nov 1996 11:48:25 -0500 (EST)

[ deleted ]

> Thanks for those who reply. 

Ho !! not at all _AU CONTRAIRE_
This will break the monotony of the usual "_put_-a_and_RTFM" answers.
After all, this is a place for general discussions and
bouncing new ideas ;-)

Where you can submit the patches ? ... I don't know
But according to ``koos V.D.H'' it's

KVDH>"[email-masked]"
KVDH>"For as far as I know, wu-ftpd is not an official project of academ.com.
KVDH>Therefore things like release dates don't mean much."

Usually I don't care for new versions. If someone has a new
idea|patch and it can be of use. I implemente it on my side.

Now for the locking scheme. Altought I think it will
be of seldom use to me. I'm curious about those issues.

1-
  Security: I'll never move around blindly files that anybody
could put in my Ftp server. So to do a cron jobs like the one
you have, .. send bad vibes to my spine as a sys adm.

2-
  What kind of lock do you use: advisory|mandatory ?

3-
 if mandatory. What do you do about deadlocks ?
   -How to prevent malicious attacks: a user putting a lock on the
    file
   -Runaway process still having the lock
   -You'll be suprise of how many broken implementations of Mandatory
    locks ;)

4-
 if advisory. then what's the point really. All process
 must implement the scheme... not transparent. In fact
 the use of "overwrite no" should suffice.

5-
 is it {,non}blocking ?

6-
 what about those who share ~ftp across machines ?

7-
 and if your cron job is running on an other machine
 then ftpd ? I guess you must have some lock deamon
 to share locks :(

8-
 protability issue ? lockf() is not on all platform
 some use fcntl() to perform locking.

9-
  Well that's enough ;-)

10-
  I'm still very curious to see the code

--
bonne journe'e, alain

---

From: [email-masked]
Date: Fri, 8 Nov 1996 15:36:19 -0700 (MST)

I'm a rookie in this discussion and I was curious if anyone 
has had any problems with mget in 2.4.2(b11)?  The command
seems to do nothing when I try to get a group of files.

Also, has anyone had any problems sending data via passv ftp?
I have not been able to successfully use pasv to transfer files
from my site to another.  However, it works fine when trying to retrieve
data from another site.

Any help would be greatly appreciated.

Thanks
-- 
Percy Chan    	                 email: [email-masked]
                                 phone: (208)333-7216 
                                   fax: (208)345-9359
--------------------------------------------------------------
Hitachi Computer Products (America), Inc.       /\ \|/  
Boise Technology Center                        /  \-O- /\
960 Broadway Ave. Suite 500                   /    \|\/  \
Boise, ID  83706                             /      \/    \   
==============================================================

---

From: Bob Luckin <[email-masked]>
Date: Fri, 8 Nov 96 22:01:42 CST

Percy,

> from my site to another.  However, it works fine when trying to retrieve

If your OS is Solaris 2, it could be a problem with the permissions on the file
   ~/ftp/dev/tcp

On Solaris 2 machines (at least) the ftpd needs world rights to write to it,
otherwise it won't allow a passive connection from an anonymous user.

Try checking the permissions on this file, and run "chmod 666" if
necessary.

For more information on this problem, have a look at the FAQ located at
   http://www.hvu.nl/~koos/wu-ftpd-faq.html
That's what helped me to solve the problem when I came across it...

Good luck !

Cheers, Bob

--
Bob Luckin
Texas Instruments            EDA Systems Group
P O Box 650311, MS 3937      [email-masked]
Dallas, TX 75265   U.S.A.    Tel: (972) 917 5081    Fax: (972) 917 7966