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

Function lomac_system_check_sysctl

freebsd/security/mac_lomac/mac_lomac.c:2199–2225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2197}
2198
2199static int
2200lomac_system_check_sysctl(struct ucred *cred, struct sysctl_oid *oidp,
2201 void *arg1, int arg2, struct sysctl_req *req)
2202{
2203 struct mac_lomac *subj;
2204
2205 if (!lomac_enabled)
2206 return (0);
2207
2208 subj = SLOT(cred->cr_label);
2209
2210 /*
2211 * Treat sysctl variables without CTLFLAG_ANYBODY flag as lomac/high,
2212 * but also require privilege to change them.
2213 */
2214 if (req->newptr != NULL && (oidp->oid_kind & CTLFLAG_ANYBODY) == 0) {
2215#ifdef notdef
2216 if (!lomac_subject_dominate_high(subj))
2217 return (EACCES);
2218#endif
2219
2220 if (lomac_subject_privileged(subj))
2221 return (EPERM);
2222 }
2223
2224 return (0);
2225}
2226
2227static void
2228lomac_thread_userret(struct thread *td)

Callers

nothing calls this directly

Calls 1

lomac_subject_privilegedFunction · 0.85

Tested by

no test coverage detected