summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2003-08-23 15:45:57 +0000
committertjr <tjr@FreeBSD.org>2003-08-23 15:45:57 +0000
commit8958714bb8409f154b6e7a7d33e2191f9bedfb44 (patch)
tree12dbb7efe0ee4f28d5705080857e8bed45b6cb89 /sys
parent52c7b39fff984b2b70621f84eea067d8afbdd2cb (diff)
downloadFreeBSD-src-8958714bb8409f154b6e7a7d33e2191f9bedfb44.zip
FreeBSD-src-8958714bb8409f154b6e7a7d33e2191f9bedfb44.tar.gz
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.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_xxx.c7
1 files 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);
}
/*
OpenPOWER on IntegriCloud