diff options
author | Robert Watson <rwatson@FreeBSD.org> | 2000-02-12 13:41:56 +0000 |
---|---|---|
committer | Robert Watson <rwatson@FreeBSD.org> | 2000-02-12 13:41:56 +0000 |
commit | 83f1e257e02a6766b65484799ad21d82c4a5c4da (patch) | |
tree | a0e3c99d1a970554405c16312b38e21b776efc4c /sys | |
parent | be3448f6ad4c7fdbdc6d7c7f2dc832c8d824163e (diff) | |
download | src-83f1e257e02a6766b65484799ad21d82c4a5c4da.tar.gz src-83f1e257e02a6766b65484799ad21d82c4a5c4da.zip |
Yet-another-update: rename ``kern.prison'' to a new sysctl root entry,
``jail'', and move the set_hostname_allowed sysctl there, as well as
fixing a bug in the sysctl that resulted in jails being over-limited
(preventing them from reading as well as writing the hostname). Also,
correct some formatting issues, courtesy bde :-).
Reviewed by: phk
Approved by: jkh
Notes
Notes:
svn path=/head/; revision=57163
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_jail.c | 9 | ||||
-rw-r--r-- | sys/kern/kern_mib.c | 10 | ||||
-rw-r--r-- | sys/sys/jail.h | 2 |
3 files changed, 11 insertions, 10 deletions
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 266cd5e7f1a7..90c9aa81a7d7 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -20,11 +20,20 @@ #include <sys/proc.h> #include <sys/jail.h> #include <sys/socket.h> +#include <sys/sysctl.h> #include <net/if.h> #include <netinet/in.h> MALLOC_DEFINE(M_PRISON, "prison", "Prison structures"); +SYSCTL_NODE(, OID_AUTO, jail, CTLFLAG_RW, 0, + "Jail rules"); + +int jail_set_hostname_allowed = 1; +SYSCTL_INT(_jail, OID_AUTO, set_hostname_allowed, CTLFLAG_RW, + &jail_set_hostname_allowed, 0, + "Processes in jail can set their hostnames"); + int jail(p, uap) struct proc *p; diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index 84ca34ae136a..2d5217c55958 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -77,9 +77,6 @@ SYSCTL_NODE(, CTL_P1003_1B, p1003_1b, CTLFLAG_RW, 0, SYSCTL_NODE(, OID_AUTO, compat, CTLFLAG_RW, 0, "Compatibility code"); -SYSCTL_NODE(_kern, OID_AUTO, prison, CTLFLAG_RW, 0, - "Prison rules"); - SYSCTL_STRING(_kern, KERN_OSRELEASE, osrelease, CTLFLAG_RD, osrelease, 0, "Operating system type"); @@ -145,11 +142,6 @@ static char machine_arch[] = MACHINE_ARCH; SYSCTL_STRING(_hw, HW_MACHINE_ARCH, machine_arch, CTLFLAG_RD, machine_arch, 0, "System architecture"); -static int prison_set_hostname_allowed = 1; -SYSCTL_INT(_kern_prison, OID_AUTO, set_hostname_allowed, CTLFLAG_RW, - &prison_set_hostname_allowed, 0, - "Processes in prison can set their hostnames"); - char hostname[MAXHOSTNAMELEN]; static int @@ -158,7 +150,7 @@ sysctl_hostname SYSCTL_HANDLER_ARGS int error; if (req->p->p_prison) { - if (!prison_set_hostname_allowed) + if (!jail_set_hostname_allowed && req->newptr) return(EPERM); error = sysctl_handle_string(oidp, req->p->p_prison->pr_host, diff --git a/sys/sys/jail.h b/sys/sys/jail.h index e946c7a462b6..a9e98611d4e5 100644 --- a/sys/sys/jail.h +++ b/sys/sys/jail.h @@ -46,7 +46,7 @@ struct prison { /* * Sysctl-set variables that determine global jail policy */ -extern int prison_set_hostname_allowed; +extern int jail_set_hostname_allowed; #endif /* !_KERNEL */ #endif /* !_SYS_JAIL_H_ */ |