* Copy a ucred's contents from a template. Does not block. */
| 2096 | * Copy a ucred's contents from a template. Does not block. |
| 2097 | */ |
| 2098 | void |
| 2099 | crcopy(struct ucred *dest, struct ucred *src) |
| 2100 | { |
| 2101 | |
| 2102 | KASSERT(dest->cr_ref == 1, ("crcopy of shared ucred")); |
| 2103 | bcopy(&src->cr_startcopy, &dest->cr_startcopy, |
| 2104 | (unsigned)((caddr_t)&src->cr_endcopy - |
| 2105 | (caddr_t)&src->cr_startcopy)); |
| 2106 | crsetgroups(dest, src->cr_ngroups, src->cr_groups); |
| 2107 | uihold(dest->cr_uidinfo); |
| 2108 | uihold(dest->cr_ruidinfo); |
| 2109 | prison_hold(dest->cr_prison); |
| 2110 | loginclass_hold(dest->cr_loginclass); |
| 2111 | #ifdef AUDIT |
| 2112 | audit_cred_copy(src, dest); |
| 2113 | #endif |
| 2114 | #ifdef MAC |
| 2115 | mac_cred_copy(src, dest); |
| 2116 | #endif |
| 2117 | } |
| 2118 | |
| 2119 | /* |
| 2120 | * Dup cred struct to a new held one. |
no test coverage detected