Subject: Automatically renaming files for anonymous users.

From: Mike Handley <[email-masked]>
Date: Thu, 22 Jul 1999 11:04:13 -0400

Hi All,
  I have a customer ftping the same file name off of serveral differents
workstations to the server.   
For some reason, the script he is using will not allow him to specify a
different name.  
All the files are being ftp'ed in anonymously to an /incoming directory.
Is there a way to have wu-ftp automatically rename the file to filename1 if
filename already exists?

TIA
MH

**************************************************
Mike Handley	
LightSpeed Technologies Inc.                    Mail:
[email-masked]
					   Phone: 570-714-5078
***************************************************

---

From: Gregory A Lundberg <[email-masked]>
Date: Thu, 22 Jul 1999 12:20:59 -0400

On Thu, Jul 22, 1999 at 11:04:13AM -0400, Mike Handley wrote:

> workstations to the server.   For some reason, the script he is using
> will not allow him to specify a different name.  All the files are being
> ftp'ed in anonymously to an /incoming directory.  Is there a way to have
> wu-ftp automatically rename the file to filename1 if filename already
> exists?

Nope.  Happy hacking.  Look in src/ftpd.c; search for upl_check to get into
the right area.  just above you'll see the following line:

    if (!overwrite && exists) {

If this is true, the daemon currently isues a message and refuses the
upload.  You'll want to delay this until after upl_check() has been called
and given its permission for the upload.  Then, just before opening the
file, you'll want to rename it.

You probably should do a little checking in the (!overwrite && exists)
section.  I'd add an ftpaccess clause which gives directories and/or names
which this should be done for (take a look at the noretrieve logic ..
something similar for automatically renaming is what I'm thinking).

-- 

Gregory A Lundberg              WU-FTPD Development Group
1441 Elmdale Drive              [email-masked]
Kettering, OH 45409-1615 USA    1-800-809-2195