Deleted Added
full compact
kern_jail.c (179881) kern_jail.c (180291)
1/*-
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 */
9
10#include <sys/cdefs.h>
1/*-
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 */
9
10#include <sys/cdefs.h>
11__FBSDID("$FreeBSD: head/sys/kern/kern_jail.c 179881 2008-06-19 21:41:57Z delphij $");
11__FBSDID("$FreeBSD: head/sys/kern/kern_jail.c 180291 2008-07-05 13:10:10Z rwatson $");
12
13#include "opt_mac.h"
14
15#include <sys/param.h>
16#include <sys/types.h>
17#include <sys/kernel.h>
18#include <sys/systm.h>
19#include <sys/errno.h>

--- 450 unchanged lines hidden (view full) ---

470void
471getcredhostname(struct ucred *cred, char *buf, size_t size)
472{
473
474 if (jailed(cred)) {
475 mtx_lock(&cred->cr_prison->pr_mtx);
476 strlcpy(buf, cred->cr_prison->pr_host, size);
477 mtx_unlock(&cred->cr_prison->pr_mtx);
12
13#include "opt_mac.h"
14
15#include <sys/param.h>
16#include <sys/types.h>
17#include <sys/kernel.h>
18#include <sys/systm.h>
19#include <sys/errno.h>

--- 450 unchanged lines hidden (view full) ---

470void
471getcredhostname(struct ucred *cred, char *buf, size_t size)
472{
473
474 if (jailed(cred)) {
475 mtx_lock(&cred->cr_prison->pr_mtx);
476 strlcpy(buf, cred->cr_prison->pr_host, size);
477 mtx_unlock(&cred->cr_prison->pr_mtx);
478 } else
478 } else {
479 mtx_lock(&hostname_mtx);
479 strlcpy(buf, hostname, size);
480 strlcpy(buf, hostname, size);
481 mtx_unlock(&hostname_mtx);
482 }
480}
481
482/*
483 * Determine whether the subject represented by cred can "see"
484 * status of a mount point.
485 * Returns: 0 for permitted, ENOENT otherwise.
486 * XXX: This function should be called cr_canseemount() and should be
487 * placed in kern_prot.c.

--- 505 unchanged lines hidden ---
483}
484
485/*
486 * Determine whether the subject represented by cred can "see"
487 * status of a mount point.
488 * Returns: 0 for permitted, ENOENT otherwise.
489 * XXX: This function should be called cr_canseemount() and should be
490 * placed in kern_prot.c.

--- 505 unchanged lines hidden ---