* Default parameters for jail(2) compatibility. For historical reasons, * the sysctl names have varying similarity to the parameter names. Prisons * just see their own parameters, and can't change them. */
| 3842 | * just see their own parameters, and can't change them. |
| 3843 | */ |
| 3844 | static int |
| 3845 | sysctl_jail_default_allow(SYSCTL_HANDLER_ARGS) |
| 3846 | { |
| 3847 | int error, i; |
| 3848 | |
| 3849 | /* Get the current flag value, and convert it to a boolean. */ |
| 3850 | if (req->td->td_ucred->cr_prison == &prison0) { |
| 3851 | mtx_lock(&prison0.pr_mtx); |
| 3852 | i = (jail_default_allow & arg2) != 0; |
| 3853 | mtx_unlock(&prison0.pr_mtx); |
| 3854 | } else |
| 3855 | i = prison_allow(req->td->td_ucred, arg2); |
| 3856 | |
| 3857 | if (arg1 != NULL) |
| 3858 | i = !i; |
| 3859 | error = sysctl_handle_int(oidp, &i, 0, req); |
| 3860 | if (error || !req->newptr) |
| 3861 | return (error); |
| 3862 | i = i ? arg2 : 0; |
| 3863 | if (arg1 != NULL) |
| 3864 | i ^= arg2; |
| 3865 | /* |
| 3866 | * The sysctls don't have CTLFLAGS_PRISON, so assume prison0 |
| 3867 | * for writing. |
| 3868 | */ |
| 3869 | mtx_lock(&prison0.pr_mtx); |
| 3870 | jail_default_allow = (jail_default_allow & ~arg2) | i; |
| 3871 | mtx_unlock(&prison0.pr_mtx); |
| 3872 | return (0); |
| 3873 | } |
| 3874 | |
| 3875 | SYSCTL_PROC(_security_jail, OID_AUTO, set_hostname_allowed, |
| 3876 | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, |
nothing calls this directly
no test coverage detected