Bug 828 - date overflow with scp -p
Summary: date overflow with scp -p
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: scp (show other bugs)
Version: 3.7.1p2
Hardware: ix86 Linux
: P3 minor
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords: patch
Depends on:
Blocks: V_4_8
  Show dependency treegraph
 
Reported: 2004-04-01 08:25 AEST by throw_away_2002
Modified: 2008-03-31 15:20 AEDT (History)
2 users (show)

See Also:


Attachments
Truncate pre-epoch timestamps in scp, add debugging (891 bytes, patch)
2004-04-01 12:15 AEST, Darren Tucker
djm: ok+
Details | Diff
equivalent change for rcp (749 bytes, patch)
2007-05-20 16:23 AEST, Darren Tucker
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description throw_away_2002 2004-04-01 08:25:02 AEST
(noticed same behavior with openssh 3.8p1 via Cygwin on W2K
and openssh 3.7.1p2 on a Linux machine - both cases copying
files FROM a Linux machine running 3.7.1p2)

Attempted to copy a file from a Linux machine with a (legal)
pre-1970 date (don't ask me WHY I have files with those
dates :) ) using scp -p to preserve the date.

In both cases the file arrived intact, but had a date in
January 2038 (which I recognized as the highest possible
32-bit value).
Comment 1 Darren Tucker 2004-04-01 12:15:14 AEST
Created attachment 588 [details]
Truncate pre-epoch timestamps in scp, add debugging

Does the rcp/scp protocol even permit times before the epoch?  If not, the best
we can do is truncate the date to the epoch as per the attached patch.

I added a bit more detail in the debugging:
$ ./scp -vp /mnt/tmp/file localhost:/tmp/
[...]
File mtime -100000 atime 1080785365
Sending file timestamps: T0 0 1080785365 0
Sending file modes: C0664 2323 file
Comment 2 Damien Miller 2007-05-17 20:11:41 AEST
Comment on attachment 588 [details]
Truncate pre-epoch timestamps in scp, add debugging

Please make sure rcp gets this too when you commit
Comment 3 Darren Tucker 2007-05-20 16:23:59 AEST
Created attachment 1294 [details]
equivalent change for rcp

This is the equivalent change to rcp.  I'm not 100% sure it's right because the format is signed in rcp rather than unsigned in scp and rcp uses stb.st_atimespec.tv_sec rather than stb.st_mtime.
Comment 4 Darren Tucker 2008-01-01 01:58:57 AEDT
Target 4.8
Comment 5 Darren Tucker 2008-01-01 20:13:59 AEDT
This has been committed and will be in 4.8.  Thanks.
Comment 6 Damien Miller 2008-03-31 15:20:05 AEDT
Fix shipped in 4.9/4.9p1 release.