From 8958714bb8409f154b6e7a7d33e2191f9bedfb44 Mon Sep 17 00:00:00 2001 From: tjr Date: Sat, 23 Aug 2003 15:45:57 +0000 Subject: Fix a logic error in osethostid() that was introduced in rev. 1.34: allow hostid to be set when suser() returns 0, not when it returns an error. This would have allowed non-root users to set the host ID. --- sys/kern/kern_xxx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c index f3d8154..47988da 100644 --- a/sys/kern/kern_xxx.c +++ b/sys/kern/kern_xxx.c @@ -144,11 +144,12 @@ osethostid(td, uap) { int error; - mtx_lock(&Giant); if ((error = suser(td))) - hostid = uap->hostid; + return (error); + mtx_lock(&Giant); + hostid = uap->hostid; mtx_unlock(&Giant); - return (error); + return (0); } /* -- cgit v1.1