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

Function cr_canseeinpcb

freebsd/netinet/in_prot.c:58–78  ·  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

56 * Returns: 0 for permitted, ENOENT otherwise.
57 */
58int
59cr_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}

Callers 6

udp_pcblistFunction · 0.70
udp_getcredFunction · 0.70
tcp_pcblistFunction · 0.70
tcp_getcredFunction · 0.70
tcp6_getcredFunction · 0.70
rip_pcblistFunction · 0.70

Calls 4

prison_checkFunction · 0.85
mac_inpcb_check_visibleFunction · 0.85
cr_canseeotheruidsFunction · 0.85
cr_canseeothergidsFunction · 0.85

Tested by

no test coverage detected