Bug 175

Summary: BTS#285053 sudo keeps complaining about timestamp being too far in the future
Product: Sudo Reporter: Chad C. Walstrom <chewie>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: normal    
Version: 1.6.8   
Hardware: Sun   
OS: Linux   
URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=285053

Description Chad C. Walstrom 2005-04-08 11:06:26 MDT
We've had a problem in the Debian sparc packages for sudo for some time now. 
I'm not sure why it wasn't forwarded to your bug tracking system until now.  I
am not the maintainer, simply an end-user of the package for Debian GNU/Linux on
the sparc64 platform.

This problem isn't horrible, but inconvenient.  Occassionally, sudo requires me
to re-enter my password claiming that the timestamp is too far in the future. 
The Debian BTS report #285053 has much more detail available on the problem. 
I'm assuming that there's an integer overflow somewhere (though I haven't taken
a look at the code to find it just yet).

Sean Finny had this to say:

so i did a little printf'ing in the source code that might be helpful:

lambic[~]09:47:17$ sudo uptime
now: 1109947640; sb.st_mtime: 1109898802; def_timestamp_timeout: 15
 09:47:26 up 7 days, 13:24,  1 user,  load average: 0.02, 0.05, 0.01

lambic[~]09:47:26$ sudo uptime
now: 1109947647; sb.st_mtime: 1879617552; def_timestamp_timeout: 15
sb.st_mtime: 1879617552; now + 60 * def_timestamp_timeout * 2: 1109949447
sudo: timestamp too far in the future: Jul 24 15:59:12 2029

notice that 1879617552 is in fact Jul 24 15:59:12 2029.  so, either stat
is on crack, or something's being overwritten somewhere.


	sean
Comment 1 Todd C. Miller 2005-04-08 12:13:02 MDT
Can you tell me whether this only happens after a "sudo -k" or whether it happens after normal sudo use 
as well?  I don't see any obvious bug in sudo, though if configure is not properly detecting that Linux has 
struct timespec (HAVE_TIMESPEC) that might cause problems.
Comment 2 Chad C. Walstrom 2005-04-08 12:22:44 MDT
It actually happens for me any time I use sudo.  I rarely use "sudo -k".  For
example:

[12:07:45] chewie@ydalir (506)$ sudo ls
Password:
Mail                          gnats-user_4.1.0-0_sparc.deb
archives                      gnats_4.1.0-0.diff.gz
bin                           gnats_4.1.0-0.dsc
clamsmtp-1.3                  gnats_4.1.0-0_sparc.changes
clamsmtp_1.3-1.diff.gz        gnats_4.1.0-0_sparc.deb
clamsmtp_1.3-1.dsc            gnats_4.1.0.orig.tar.gz
clamsmtp_1.3-1_sparc.changes  gnu-gnats-databases.tar.gz
clamsmtp_1.3-1_sparc.deb      log
clamsmtp_1.3.orig.tar.gz      mail
gnats-4.1.0                   public_html
[13:21:33] chewie@ydalir (507)$ sudo ls
sudo: timestamp too far in the future: Jul 24 14:59:12 2029

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

Password:
Comment 3 Chad C. Walstrom 2005-04-08 12:26:23 MDT
Here's the buildd log for sudo on sparc:

http://buildd.debian.org/fetch.php?&pkg=sudo&ver=1.6.8p7-1&arch=sparc&stamp=1111909341&file=log&as=raw
Comment 4 Todd C. Miller 2005-04-08 13:04:24 MDT
Sounds like there is a bug in the debian utimes() then.  sudo calls utimes() with a NULL pointer to update 
the times on the timestamp file.  The only time it passes a non-NULL value is for "sudo -k".  As a 
workaround you may be able to just force sudo to use utime() instead by setting ac_cv_func_utimes=no in 
your environment before running configure.  It is also possible that Debia Bug#202243 is relevant here 
but that should have been fixed a long time ago.
Comment 5 Olivier Bornet 2005-06-08 04:09:14 MDT
The workaround with ac_cv_func_utimes=no does the job for me. I have
re-generated my own package for sudo, just doing something like:

    apt-get source sudo
    cd sudo-1.6.8p7
    export ac_cv_func_utimes=no
    fakeroot dpkg-buildpackage
    sudo dpkg --install ../sudo_1.6.8p7-1.1_sparc.deb

And this is OK after.

HTH.

Olivier
Comment 6 Todd C. Miller 2007-06-19 12:44:28 MDT
Marking as resolved since this was determined to be a kernel or glibc problem.