summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2001-09-26 19:53:57 +0000
committerrwatson <rwatson@FreeBSD.org>2001-09-26 19:53:57 +0000
commitfdf54f85412fc6d3bf9d01baa77b65a0d6a4b22f (patch)
tree22c214f894d971a43bcd02311a2b83b920031cdd
parent1d311f9352f5ace8fdfb23fe20bfe53c9ea99761 (diff)
downloadFreeBSD-src-fdf54f85412fc6d3bf9d01baa77b65a0d6a4b22f.zip
FreeBSD-src-fdf54f85412fc6d3bf9d01baa77b65a0d6a4b22f.tar.gz
o Modify static settime() to accept the proc * for the process requesting
a time change, and callers so that they provide td->td_proc. o Modify settime() to use securevel_gt() for securelevel checking. Obtained from: TrustedBSD Project
-rw-r--r--sys/kern/kern_time.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 17e3a46..bca540f 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -66,7 +66,7 @@ struct timezone tz;
static int nanosleep1 __P((struct thread *td, struct timespec *rqt,
struct timespec *rmt));
-static int settime __P((struct timeval *));
+static int settime __P((struct proc *, struct timeval *));
static void timevalfix __P((struct timeval *));
static void no_lease_updatetime __P((int));
@@ -79,7 +79,8 @@ no_lease_updatetime(deltat)
void (*lease_updatetime) __P((int)) = no_lease_updatetime;
static int
-settime(tv)
+settime(p, tv)
+ struct proc *p;
struct timeval *tv;
{
struct timeval delta, tv1, tv2;
@@ -103,7 +104,7 @@ settime(tv)
* than one second, nor more than once per second. This allows
* a miscreant to make the clock march double-time, but no worse.
*/
- if (securelevel > 1) {
+ if (securelevel_gt(p->p_ucred, 1) != 0) {
if (delta.tv_sec < 0 || delta.tv_usec < 0) {
/*
* Update maxtime to latest time we've seen.
@@ -200,7 +201,7 @@ clock_settime(td, uap)
}
/* XXX Don't convert nsec->usec and back */
TIMESPEC_TO_TIMEVAL(&atv, &ats);
- error = settime(&atv);
+ error = settime(td->td_proc, &atv);
done2:
mtx_unlock(&Giant);
return (error);
@@ -390,7 +391,7 @@ settimeofday(td, uap)
(error = copyin((caddr_t)uap->tzp, (caddr_t)&atz, sizeof(atz)))) {
goto done2;
}
- if (uap->tv && (error = settime(&atv)))
+ if (uap->tv && (error = settime(td->td_proc, &atv)))
goto done2;
if (uap->tzp)
tz = atz;
OpenPOWER on IntegriCloud