summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorrobert <robert@FreeBSD.org>2002-02-27 14:58:32 +0000
committerrobert <robert@FreeBSD.org>2002-02-27 14:58:32 +0000
commit1adc111a4d822285509235f8eb5eb6624194a312 (patch)
tree03463c1a4203938ff7b63daabed5f27203663e0f /sys
parent3fbc1dd14e9cf087bcc655375585683f3252e81d (diff)
downloadFreeBSD-src-1adc111a4d822285509235f8eb5eb6624194a312.zip
FreeBSD-src-1adc111a4d822285509235f8eb5eb6624194a312.tar.gz
Add a function which returns the correct hostname for a given
credential. Reviewed by: phk
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_jail.c11
-rw-r--r--sys/sys/jail.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index 0ae8d3f..62d65fa 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -237,3 +237,14 @@ jailed(cred)
return (cred->cr_prison != NULL);
}
+
+/*
+ * Return the correct hostname for the passed credential.
+ */
+const char *
+getcredhostname(cred)
+ struct ucred *cred;
+{
+
+ return (jailed(cred) ? cred->cr_prison->pr_host : hostname);
+}
diff --git a/sys/sys/jail.h b/sys/sys/jail.h
index 6becd8b..f9f7b81 100644
--- a/sys/sys/jail.h
+++ b/sys/sys/jail.h
@@ -68,6 +68,7 @@ extern int jail_sysvipc_allowed;
struct ucred;
struct sockaddr;
int jailed __P((struct ucred *cred));
+const char *getcredhostname __P((struct ucred *cred));
int prison_check __P((struct ucred *cred1, struct ucred *cred2));
void prison_free __P((struct prison *pr));
u_int32_t prison_getip __P((struct ucred *cred));
OpenPOWER on IntegriCloud