=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sudo/Attic/check.c,v retrieving revision 1.5 retrieving revision 1.5.4.1 diff -c -r1.5 -r1.5.4.1 *** src/usr.bin/sudo/Attic/check.c 2001/03/30 13:56:57 1.5 --- src/usr.bin/sudo/Attic/check.c 2002/01/18 16:14:44 1.5.4.1 *************** *** 1,5 **** /* ! * Copyright (c) 1994-1996,1998-1999 Todd C. Miller * All rights reserved. * * Redistribution and use in source and binary forms, with or without --- 1,5 ---- /* ! * Copyright (c) 1993-1996,1998-2001 Todd C. Miller * All rights reserved. * * Redistribution and use in source and binary forms, with or without *************** *** 34,67 **** #include "config.h" #include #ifdef STDC_HEADERS ! #include #endif /* STDC_HEADERS */ - #ifdef HAVE_UNISTD_H - #include - #endif /* HAVE_UNISTD_H */ #ifdef HAVE_STRING_H ! #include #endif /* HAVE_STRING_H */ ! #ifdef HAVE_STRINGS_H ! #include ! #endif /* HAVE_STRINGS_H */ #include #include #include #include - #include - #include - #include - #include #include #include #include "sudo.h" #ifndef lint ! static const char rcsid[] = "$Sudo: check.c,v 1.194 2000/02/15 23:36:03 millert Exp $"; #endif /* lint */ /* Status codes for timestamp_status() */ --- 34,73 ---- #include "config.h" + #include + #include + #include + #include #include #ifdef STDC_HEADERS ! # include ! # include ! #else ! # ifdef HAVE_STDLIB_H ! # include ! # endif #endif /* STDC_HEADERS */ #ifdef HAVE_STRING_H ! # include ! #else ! # ifdef HAVE_STRINGS_H ! # include ! # endif #endif /* HAVE_STRING_H */ ! #ifdef HAVE_UNISTD_H ! # include ! #endif /* HAVE_UNISTD_H */ #include #include #include #include #include #include #include "sudo.h" #ifndef lint ! static const char rcsid[] = "$Sudo: check.c,v 1.202 2001/12/14 19:52:47 millert Exp $"; #endif /* lint */ /* Status codes for timestamp_status() */ *************** *** 226,235 **** struct group *grp; char **gr_mem; ! if (!def_str(I_EXEMPT_GRP)) return(FALSE); ! if (!(grp = getgrnam(def_str(I_EXEMPT_GRP)))) return(FALSE); if (user_gid == grp->gr_gid) --- 232,241 ---- struct group *grp; char **gr_mem; ! if (!def_str(I_EXEMPT_GROUP)) return(FALSE); ! if (!(grp = getgrnam(def_str(I_EXEMPT_GROUP)))) return(FALSE); if (user_gid == grp->gr_gid) *************** *** 424,447 **** * If the file/dir exists, check its mtime. */ if (status == TS_OLD) { ! now = time(NULL); ! if (def_ival(I_TS_TIMEOUT) && ! now - sb.st_mtime < 60 * def_ival(I_TS_TIMEOUT)) { ! /* ! * Check for bogus time on the stampfile. The clock may ! * have been set back or someone could be trying to spoof us. ! */ ! if (sb.st_mtime > now + 60 * def_ival(I_TS_TIMEOUT) * 2) { ! log_error(NO_EXIT, ! "timestamp too far in the future: %20.20s", ! 4 + ctime(&sb.st_mtime)); ! if (timestampfile) ! (void) unlink(timestampfile); ! else ! (void) rmdir(timestampdir); ! status = TS_MISSING; ! } else ! status = TS_CURRENT; } } --- 430,458 ---- * If the file/dir exists, check its mtime. */ if (status == TS_OLD) { ! /* Negative timeouts only expire manually (sudo -k). */ ! if (def_ival(I_TIMESTAMP_TIMEOUT) < 0 && sb.st_mtime != 0) ! status = TS_CURRENT; ! else { ! now = time(NULL); ! if (def_ival(I_TIMESTAMP_TIMEOUT) && ! now - sb.st_mtime < 60 * def_ival(I_TIMESTAMP_TIMEOUT)) { ! /* ! * Check for bogus time on the stampfile. The clock may ! * have been set back or someone could be trying to spoof us. ! */ ! if (sb.st_mtime > now + 60 * def_ival(I_TIMESTAMP_TIMEOUT) * 2) { ! log_error(NO_EXIT, ! "timestamp too far in the future: %20.20s", ! 4 + ctime(&sb.st_mtime)); ! if (timestampfile) ! (void) unlink(timestampfile); ! else ! (void) rmdir(timestampdir); ! status = TS_MISSING; ! } else ! status = TS_CURRENT; ! } } }