capabilities: Ensure required capabilities are actually held by the process/user

This commit is contained in:
Tobias Brunner
2013-06-25 17:16:32 +02:00
parent a650242643
commit 2e21bac19a
5 changed files with 77 additions and 10 deletions
+6 -2
View File
@@ -591,8 +591,6 @@ private_daemon_t *daemon_create(const char *name)
this->public.shunts = shunt_manager_create();
this->kernel_handler = kernel_handler_create();
this->public.caps->keep(this->public.caps, CAP_NET_ADMIN);
return this;
}
@@ -628,6 +626,12 @@ bool libcharon_init(const char *name)
this = daemon_create(name);
if (!this->public.caps->keep(this->public.caps, CAP_NET_ADMIN))
{
dbg(DBG_DMN, 1, "libcharon requires CAP_NET_ADMIN capability");
return FALSE;
}
/* for uncritical pseudo random numbers */
srandom(time(NULL) + getpid());