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

Function cap_ioctl_limit_check

freebsd/kern/sys_capability.c:390–416  ·  view source on GitHub ↗

* Check if the current ioctls list can be replaced by the new one. */

Source from the content-addressed store, hash-verified

388 * Check if the current ioctls list can be replaced by the new one.
389 */
390static int
391cap_ioctl_limit_check(struct filedescent *fdep, const u_long *cmds,
392 size_t ncmds)
393{
394 u_long *ocmds;
395 ssize_t oncmds;
396 u_long i;
397 long j;
398
399 oncmds = fdep->fde_nioctls;
400 if (oncmds == -1)
401 return (0);
402 if (oncmds < (ssize_t)ncmds)
403 return (ENOTCAPABLE);
404
405 ocmds = fdep->fde_ioctls;
406 for (i = 0; i < ncmds; i++) {
407 for (j = 0; j < oncmds; j++) {
408 if (cmds[i] == ocmds[j])
409 break;
410 }
411 if (j == oncmds)
412 return (ENOTCAPABLE);
413 }
414
415 return (0);
416}
417
418int
419kern_cap_ioctls_limit(struct thread *td, int fd, u_long *cmds, size_t ncmds)

Callers 1

kern_cap_ioctls_limitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected