* Check if a new BINDMULTI socket is allowed to be created. * * ni points to the new inp. * oi points to the exisitng inp. * * This checks whether the existing inp also has BINDMULTI and * whether the credentials match. */
| 967 | * whether the credentials match. |
| 968 | */ |
| 969 | int |
| 970 | in_pcbbind_check_bindmulti(const struct inpcb *ni, const struct inpcb *oi) |
| 971 | { |
| 972 | /* Check permissions match */ |
| 973 | if ((ni->inp_flags2 & INP_BINDMULTI) && |
| 974 | (ni->inp_cred->cr_uid != |
| 975 | oi->inp_cred->cr_uid)) |
| 976 | return (0); |
| 977 | |
| 978 | /* Check the existing inp has BINDMULTI set */ |
| 979 | if ((ni->inp_flags2 & INP_BINDMULTI) && |
| 980 | ((oi->inp_flags2 & INP_BINDMULTI) == 0)) |
| 981 | return (0); |
| 982 | |
| 983 | /* |
| 984 | * We're okay - either INP_BINDMULTI isn't set on ni, or |
| 985 | * it is and it matches the checks. |
| 986 | */ |
| 987 | return (1); |
| 988 | } |
| 989 | |
| 990 | #ifdef INET |
| 991 | /* |
no outgoing calls
no test coverage detected