aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2003-08-23 15:45:57 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2003-08-23 15:45:57 +0000
commitc89d555c6cfb459972575368ffc1339e2672ca1e (patch)
tree12dbb7efe0ee4f28d5705080857e8bed45b6cb89 /sys
parentc69db88340f9a7659ab4faa7fd328a3fb858b72e (diff)
downloadsrc-c89d555c6cfb459972575368ffc1339e2672ca1e.tar.gz
src-c89d555c6cfb459972575368ffc1339e2672ca1e.zip
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.
Notes
Notes: svn path=/head/; revision=119364
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 f3d81544c184..47988da5c8b0 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);
}
/*