MFp4 @229487:
Revoke all capability rights from STDIN and allow only for write to STDOUT and STDERR. All those descriptors are redirected to /dev/null. Reviewed by: brooks Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
4c7a48b7a9
commit
a6f38228d4
@ -2379,6 +2379,13 @@ go_daemon(void)
|
||||
close(nullfd);
|
||||
nullfd = -1;
|
||||
}
|
||||
|
||||
if (cap_rights_limit(STDIN_FILENO, CAP_NONE) < 0 && errno != ENOSYS)
|
||||
error("can't limit stdin: %m");
|
||||
if (cap_rights_limit(STDOUT_FILENO, CAP_WRITE) < 0 && errno != ENOSYS)
|
||||
error("can't limit stdout: %m");
|
||||
if (cap_rights_limit(STDERR_FILENO, CAP_WRITE) < 0 && errno != ENOSYS)
|
||||
error("can't limit stderr: %m");
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user