Detection of identical file doesn't work for localhost:

Gert Doering gert at greenie.muc.de
Tue Jan 30 20:06:28 EST 2001


Hi,

On Tue, Jan 30, 2001 at 08:27:49AM +0100, Christian Kurz wrote:
> I had to notice that scp is able to detect if a file is copied to itself
> if you use "scp foo /path/to/foo" or "scp foo .". If you type in "scp
> foo localhost:/path/to/foo" it will still overwrite the old version of
> foo. Is it possible to change this behaviour of scp? 
> 
> I only had a quick glance at scp.c and I'm also not a C coder, only
> learning C right now, so please give me some hints if I'm wrong. You use
> the function "colon" in 984 to check if you should to a remote copy or a
> local copy. I think it would be possible to add a check to it to see if
> the name of the remote host will be localhost and then also use the
> function "tolocal" for doing a local copy instead of calling "toremote".
> What do you guys think? Would you please add this feature?

I don't think it's reasonable.  If a user want to shoot into his own foot,
he will always be able to do this.

If you trap "localhost", people will use 127.0.0.1, or the real name of
the machine, or one of its ethernet IP addresses, etc.

(Why on earth would anybody do an "scp localhost:..." in the first place?)

gert
-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             gert at greenie.muc.de
fax: +49-89-35655025                        gert.doering at physik.tu-muenchen.de





More information about the openssh-unix-dev mailing list