- * Determine whether the subject represented by cred can "see" a socket. * Returns: 0 for permitted, ENOENT otherwise. */
| 56 | * Returns: 0 for permitted, ENOENT otherwise. |
| 57 | */ |
| 58 | int |
| 59 | cr_canseeinpcb(struct ucred *cred, struct inpcb *inp) |
| 60 | { |
| 61 | int error; |
| 62 | |
| 63 | error = prison_check(cred, inp->inp_cred); |
| 64 | if (error) |
| 65 | return (ENOENT); |
| 66 | #ifdef MAC |
| 67 | INP_LOCK_ASSERT(inp); |
| 68 | error = mac_inpcb_check_visible(cred, inp); |
| 69 | if (error) |
| 70 | return (error); |
| 71 | #endif |
| 72 | if (cr_canseeotheruids(cred, inp->inp_cred)) |
| 73 | return (ENOENT); |
| 74 | if (cr_canseeothergids(cred, inp->inp_cred)) |
| 75 | return (ENOENT); |
| 76 | |
| 77 | return (0); |
| 78 | } |
no test coverage detected