diff options
-rw-r--r-- | bin/date/date.1 | 6 | ||||
-rw-r--r-- | bin/date/date.c | 14 | ||||
-rw-r--r-- | distrib/special/Makefile | 4 | ||||
-rw-r--r-- | distrib/special/date/Makefile | 9 |
4 files changed, 28 insertions, 5 deletions
diff --git a/bin/date/date.1 b/bin/date/date.1 index 85166a82451..56e32d15850 100644 --- a/bin/date/date.1 +++ b/bin/date/date.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: date.1,v 1.49 2009/02/08 17:15:09 jmc Exp $ +.\" $OpenBSD: date.1,v 1.50 2010/03/31 17:51:21 deraadt Exp $ .\" $NetBSD: date.1,v 1.12 1996/03/12 04:32:37 phil Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 @@ -33,7 +33,7 @@ .\" .\" @(#)date.1 8.3 (Berkeley) 4/28/95 .\" -.Dd $Mdocdate: February 8 2009 $ +.Dd $Mdocdate: March 31 2010 $ .Dt DATE 1 .Os .Sh NAME @@ -64,6 +64,8 @@ Otherwise, depending on the options specified, will set the date and time or print it in a user-defined way. .Pp Only the superuser may set the date. +Changing the system date has some risks as described in +.Xr settimeofday 2 . .Pp The options are as follows: .Bl -tag -width Ds diff --git a/bin/date/date.c b/bin/date/date.c index e58029c6868..1f6ce05872b 100644 --- a/bin/date/date.c +++ b/bin/date/date.c @@ -1,4 +1,4 @@ -/* $OpenBSD: date.c,v 1.32 2009/10/27 23:59:21 deraadt Exp $ */ +/* $OpenBSD: date.c,v 1.33 2010/03/31 17:51:21 deraadt Exp $ */ /* $NetBSD: date.c,v 1.11 1995/09/07 06:21:05 jtc Exp $ */ /* @@ -226,12 +226,16 @@ setthetime(char *p) if (adjtime(&tv, NULL) == -1) errx(1, "adjtime"); } else { +#ifndef SMALL logwtmp("|", "date", ""); +#endif tv.tv_sec = tval; tv.tv_usec = 0; if (settimeofday(&tv, NULL)) err(1, "settimeofday"); +#ifndef SMALL logwtmp("{", "date", ""); +#endif } } @@ -240,6 +244,14 @@ setthetime(char *p) syslog(LOG_AUTH | LOG_NOTICE, "date set by %s", p); } +#ifdef SMALL +int +netsettime(tval) +{ + return (2); +} +#endif + static void badformat(void) { diff --git a/distrib/special/Makefile b/distrib/special/Makefile index 88de4f011b7..c7707951d11 100644 --- a/distrib/special/Makefile +++ b/distrib/special/Makefile @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile,v 1.21 2009/10/28 05:17:55 deraadt Exp $ +# $OpenBSD: Makefile,v 1.22 2010/03/31 17:51:24 deraadt Exp $ SUBDIR= libstubs \ - ccdconfig dd dhclient dmesg ed ftp grep gzip ifconfig init \ + ccdconfig date dd dhclient dmesg ed ftp grep gzip ifconfig init \ kbd less more mt newfs pppd restore rsh sha256 sysctl install: diff --git a/distrib/special/date/Makefile b/distrib/special/date/Makefile new file mode 100644 index 00000000000..c8ec3651357 --- /dev/null +++ b/distrib/special/date/Makefile @@ -0,0 +1,9 @@ +# $OpenBSD: Makefile,v 1.1 2010/03/31 17:51:24 deraadt Exp $ + +PROG= date + +SRCS= date.c +CFLAGS+=-DSMALL +.PATH: ${.CURDIR}/../../../bin/date + +.include <bsd.prog.mk> |