upgrade to linux 2.6.10-1.12_FC2
[linux-2.6.git] / kernel / time.c
index 87d441c..b6d01cf 100644 (file)
@@ -31,6 +31,9 @@
 #include <linux/timex.h>
 #include <linux/errno.h>
 #include <linux/smp_lock.h>
+#include <linux/syscalls.h>
+#include <linux/security.h>
+
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
 
@@ -77,13 +80,17 @@ asmlinkage long sys_time(int __user * tloc)
 asmlinkage long sys_stime(time_t __user *tptr)
 {
        struct timespec tv;
+       int err;
 
-       if (!capable(CAP_SYS_TIME))
-               return -EPERM;
        if (get_user(tv.tv_sec, tptr))
                return -EFAULT;
 
        tv.tv_nsec = 0;
+
+       err = security_settime(&tv, NULL);
+       if (err)
+               return err;
+
        do_settimeofday(&tv);
        return 0;
 }
@@ -145,10 +152,12 @@ inline static void warp_clock(void)
 int do_sys_settimeofday(struct timespec *tv, struct timezone *tz)
 {
        static int firsttime = 1;
+       int error = 0;
+
+       error = security_settime(tv, tz);
+       if (error)
+               return error;
 
-       if (!capable(CAP_SYS_TIME))
-               return -EPERM;
-               
        if (tz) {
                /* SMP safe, global irq locking makes it work. */
                sys_tz = *tz;
@@ -478,8 +487,6 @@ int do_settimeofday (struct timespec *tv)
        return 0;
 }
 
-EXPORT_SYMBOL(do_settimeofday);
-
 void do_gettimeofday (struct timeval *tv)
 {
        unsigned long seq, nsec, usec, sec, offset;