Subject: Re: Automatically renaming files for anonymous users.

From: Ian Willis <[email-masked]>
Date: Thu, 22 Jul 99 18:13:02 BST

wu-ftpd will upload a file to a unique name (by appending .n) when the
client uses the STOU (Store Unique) command rather than the usual STOR.

Changing your customers script to use STOU in place of STOR would solve
the problem, on the standard BSD ftp client the sunique command toggles
between STOR and STOU.

Ian Willis
SCO Internet Engineering Group, Watford, England

| From: Gregory A Lundberg <[email-masked]>
| Date: Thu, 22 Jul 1999 12:20:59 -0400
| To: Mike Handley <[email-masked]>
| Cc: WU-FTPD Discussion List <[email-masked]>
| Subject: Re: Automatically renaming files for anonymous users.
| 
| On Thu, Jul 22, 1999 at 11:04:13AM -0400, Mike Handley wrote:
| 
| > 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?
| 
| 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

---

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

> -----Original Message-----
> From: Ian Willis [mailto:[email-masked]]
> Sent: Thursday, July 22, 1999 2:13 PM
> To: [email-masked]
> Cc: [email-masked]
> Subject: Re: Automatically renaming files for anonymous users.
> 
> 

Is there a way to set sunique/runique on by default??

Thanks for all your help.

Mike

---

From: Ian Willis <[email-masked]>
Date: Thu, 22 Jul 99 19:55:52 BST

Mike Handley wrote:

| Is there a way to set sunique/runique on by default??

sunique/runique are ftp client commands so will only work if your
customers script is calling a BSD style ftp client. Assuming it is,
you can create a macro named init which will be automatically executed
as the last step in the ftp login process. This is done by creating the
file .netrc in the users home directory containing:

default
macdef init
sunique
runique

(where the runique line is followed by a blank line). To make the
init macro only be executed when connecting to a particular machine,
replace the default line with:

machine remote_machine_name

You should ensure the .netrc file is owned by the user and is only
readable or writable by them, see the systems ftp or netrc manual page
for details.

Ian Willis