Module Name: src
Committed By: riastradh
Date: Sat Jul 29 02:31:22 UTC 2017
Modified Files:
src/sys/compat/linux/common: linux_time.c
Log Message:
Put suser check in the right function: settimeofday, not gettimeofday.
While here, remove wrong comment.
Noted by kre@.
To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/compat/linux/common/linux_time.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/compat/linux/common/linux_time.c
diff -u src/sys/compat/linux/common/linux_time.c:1.38 src/sys/compat/linux/common/linux_time.c:1.39
--- src/sys/compat/linux/common/linux_time.c:1.38 Sat Jul 29 01:14:59 2017
+++ src/sys/compat/linux/common/linux_time.c Sat Jul 29 02:31:22 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_time.c,v 1.38 2017/07/29 01:14:59 riastradh Exp $ */
+/* $NetBSD: linux_time.c,v 1.39 2017/07/29 02:31:22 riastradh Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.38 2017/07/29 01:14:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.39 2017/07/29 02:31:22 riastradh Exp $");
#include <sys/param.h>
#include <sys/ucred.h>
@@ -79,9 +79,6 @@ linux_sys_gettimeofday(struct lwp *l, co
}
if (SCARG(uap, tzp)) {
- if (kauth_authorize_generic(kauth_cred_get(),
- KAUTH_GENERIC_ISSUSER, NULL) != 0)
- return (EPERM);
error = copyout(&linux_sys_tz, SCARG(uap, tzp), sizeof(linux_sys_tz));
if (error)
return (error);
@@ -105,11 +102,10 @@ linux_sys_settimeofday(struct lwp *l, co
return (error);
}
- /*
- * If user is not the superuser, we returned
- * after the sys_settimeofday() call.
- */
if (SCARG(uap, tzp)) {
+ if (kauth_authorize_generic(kauth_cred_get(),
+ KAUTH_GENERIC_ISSUSER, NULL) != 0)
+ return (EPERM);
error = copyin(SCARG(uap, tzp), &linux_sys_tz, sizeof(linux_sys_tz));
if (error)
return (error);