MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cr_canseesocket

Function cr_canseesocket

freebsd/kern/kern_prot.c:1777–1796  ·  view source on GitHub ↗

- * Determine whether the subject represented by cred can "see" a socket. * Returns: 0 for permitted, ENOENT otherwise. */

Source from the content-addressed store, hash-verified

1775 * Returns: 0 for permitted, ENOENT otherwise.
1776 */
1777int
1778cr_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.

Callers 3

sctp_getcredFunction · 0.50
sctp6_getcredFunction · 0.50
udp6_getcredFunction · 0.50

Calls 4

prison_checkFunction · 0.85
mac_socket_check_visibleFunction · 0.85
cr_canseeotheruidsFunction · 0.85
cr_canseeothergidsFunction · 0.85

Tested by

no test coverage detected