- * Determine whether the subject represented by cred can "see" a socket. * Returns: 0 for permitted, ENOENT otherwise. */
| 1775 | * Returns: 0 for permitted, ENOENT otherwise. |
| 1776 | */ |
| 1777 | int |
| 1778 | cr_canseesocket(struct ucred *cred, struct socket *so) |
| 1779 | { |
| 1780 | int error; |
| 1781 | |
| 1782 | error = prison_check(cred, so->so_cred); |
| 1783 | if (error) |
| 1784 | return (ENOENT); |
| 1785 | #ifdef MAC |
| 1786 | error = mac_socket_check_visible(cred, so); |
| 1787 | if (error) |
| 1788 | return (error); |
| 1789 | #endif |
| 1790 | if (cr_canseeotheruids(cred, so->so_cred)) |
| 1791 | return (ENOENT); |
| 1792 | if (cr_canseeothergids(cred, so->so_cred)) |
| 1793 | return (ENOENT); |
| 1794 | |
| 1795 | return (0); |
| 1796 | } |
| 1797 | |
| 1798 | /*- |
| 1799 | * Determine whether td can wait for the exit of p. |
no test coverage detected