kern_mib.c (86145) | kern_mib.c (86183) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Karels at Berkeley Software Design, Inc. 7 * 8 * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD --- 23 unchanged lines hidden (view full) --- 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 | 1/*- 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Mike Karels at Berkeley Software Design, Inc. 7 * 8 * Quite extensively rewritten by Poul-Henning Kamp of the FreeBSD --- 23 unchanged lines hidden (view full) --- 32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 * 39 * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 |
40 * $FreeBSD: head/sys/kern/kern_mib.c 86145 2001-11-06 20:09:33Z rwatson $ | 40 * $FreeBSD: head/sys/kern/kern_mib.c 86183 2001-11-08 02:13:18Z rwatson $ |
41 */ 42 43#include "opt_global.h" 44 45#include <sys/param.h> 46#include <sys/kernel.h> 47#include <sys/systm.h> 48#include <sys/sysctl.h> --- 101 unchanged lines hidden (view full) --- 150 151char hostname[MAXHOSTNAMELEN]; 152 153static int 154sysctl_hostname(SYSCTL_HANDLER_ARGS) 155{ 156 int error; 157 | 41 */ 42 43#include "opt_global.h" 44 45#include <sys/param.h> 46#include <sys/kernel.h> 47#include <sys/systm.h> 48#include <sys/sysctl.h> --- 101 unchanged lines hidden (view full) --- 150 151char hostname[MAXHOSTNAMELEN]; 152 153static int 154sysctl_hostname(SYSCTL_HANDLER_ARGS) 155{ 156 int error; 157 |
158 if (jailed(req->p->p_ucred)) { | 158 if (jailed(req->td->td_proc->p_ucred)) { |
159 if (!jail_set_hostname_allowed && req->newptr) 160 return(EPERM); 161 error = sysctl_handle_string(oidp, | 159 if (!jail_set_hostname_allowed && req->newptr) 160 return(EPERM); 161 error = sysctl_handle_string(oidp, |
162 req->p->p_ucred->cr_prison->pr_host, 163 sizeof req->p->p_ucred->cr_prison->pr_host, req); | 162 req->td->td_proc->p_ucred->cr_prison->pr_host, 163 sizeof req->td->td_proc->p_ucred->cr_prison->pr_host, req); |
164 } else 165 error = sysctl_handle_string(oidp, 166 hostname, sizeof hostname, req); 167 return (error); 168} 169 170SYSCTL_PROC(_kern, KERN_HOSTNAME, hostname, 171 CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_PRISON, --- 9 unchanged lines hidden (view full) --- 181int securelevel = -1; 182 183static int 184sysctl_kern_securelvl(SYSCTL_HANDLER_ARGS) 185{ 186 struct prison *pr; 187 int error, level; 188 | 164 } else 165 error = sysctl_handle_string(oidp, 166 hostname, sizeof hostname, req); 167 return (error); 168} 169 170SYSCTL_PROC(_kern, KERN_HOSTNAME, hostname, 171 CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_PRISON, --- 9 unchanged lines hidden (view full) --- 181int securelevel = -1; 182 183static int 184sysctl_kern_securelvl(SYSCTL_HANDLER_ARGS) 185{ 186 struct prison *pr; 187 int error, level; 188 |
189 pr = req->p->p_ucred->cr_prison; | 189 pr = req->td->td_proc->p_ucred->cr_prison; |
190 191 /* 192 * If the process is in jail, return the maximum of the global and 193 * local levels; otherwise, return the global level. 194 */ 195 if (pr != NULL) 196 level = imax(securelevel, pr->pr_securelevel); 197 else --- 104 unchanged lines hidden --- | 190 191 /* 192 * If the process is in jail, return the maximum of the global and 193 * local levels; otherwise, return the global level. 194 */ 195 if (pr != NULL) 196 level = imax(securelevel, pr->pr_securelevel); 197 else --- 104 unchanged lines hidden --- |