* Return the correct hostname (domainname, et al) for the passed credential. */
| 3107 | * Return the correct hostname (domainname, et al) for the passed credential. |
| 3108 | */ |
| 3109 | void |
| 3110 | getcredhostname(struct ucred *cred, char *buf, size_t size) |
| 3111 | { |
| 3112 | struct prison *pr; |
| 3113 | |
| 3114 | /* |
| 3115 | * A NULL credential can be used to shortcut to the physical |
| 3116 | * system's hostname. |
| 3117 | */ |
| 3118 | pr = (cred != NULL) ? cred->cr_prison : &prison0; |
| 3119 | mtx_lock(&pr->pr_mtx); |
| 3120 | strlcpy(buf, pr->pr_hostname, size); |
| 3121 | mtx_unlock(&pr->pr_mtx); |
| 3122 | } |
| 3123 | |
| 3124 | void |
| 3125 | getcreddomainname(struct ucred *cred, char *buf, size_t size) |
no test coverage detected