diff options
Diffstat (limited to 'sys/kern/kern_jail.c')
-rw-r--r-- | sys/kern/kern_jail.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 62d65fa..ac5b732 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -241,10 +241,19 @@ jailed(cred) /* * Return the correct hostname for the passed credential. */ -const char * -getcredhostname(cred) +void +getcredhostname(cred, buf, size) struct ucred *cred; + char *buf; + size_t size; { - return (jailed(cred) ? cred->cr_prison->pr_host : hostname); + if (jailed(cred)) { + mtx_lock(&cred->cr_prison->pr_mtx); + strncpy(buf, cred->cr_prison->pr_host, size); + mtx_unlock(&cred->cr_prison->pr_mtx); + } + else + strncpy(buf, hostname, size); + buf[size - 1] = '\0'; } |