stream-service: move CAP_CHOWN check from plugins to service constructor
A plugin service can be a TCP socket now, so it does not make much sense to strictly check for CAP_CHOWN.
This commit is contained in:
@@ -98,12 +98,6 @@ plugin_t *duplicheck_plugin_create()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!lib->caps->check(lib->caps, CAP_CHOWN))
|
||||
{ /* required to chown(2) notify socket */
|
||||
DBG1(DBG_CFG, "duplicheck plugin requires CAP_CHOWN capability");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.plugin = {
|
||||
|
||||
@@ -92,12 +92,6 @@ plugin_t *error_notify_plugin_create()
|
||||
{
|
||||
private_error_notify_plugin_t *this;
|
||||
|
||||
if (!lib->caps->check(lib->caps, CAP_CHOWN))
|
||||
{ /* required to chown(2) notify socket */
|
||||
DBG1(DBG_CFG, "error-notify plugin requires CAP_CHOWN capability");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.plugin = {
|
||||
|
||||
@@ -269,12 +269,6 @@ plugin_t *load_tester_plugin_create()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!lib->caps->check(lib->caps, CAP_CHOWN))
|
||||
{ /* required to chown(2) control socket */
|
||||
DBG1(DBG_CFG, "load-tester plugin requires CAP_CHOWN capability");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.plugin = {
|
||||
@@ -304,4 +298,3 @@ plugin_t *load_tester_plugin_create()
|
||||
}
|
||||
return &this->public.plugin;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,12 +92,6 @@ plugin_t *lookip_plugin_create()
|
||||
{
|
||||
private_lookip_plugin_t *this;
|
||||
|
||||
if (!lib->caps->check(lib->caps, CAP_CHOWN))
|
||||
{ /* required to chown(2) control socket */
|
||||
DBG1(DBG_CFG, "lookip plugin requires CAP_CHOWN capability");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.plugin = {
|
||||
|
||||
@@ -51,12 +51,13 @@ static bool register_stroke(private_stroke_plugin_t *this,
|
||||
if (reg)
|
||||
{
|
||||
this->socket = stroke_socket_create();
|
||||
return this->socket != NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
DESTROY_IF(this->socket);
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
METHOD(plugin_t, get_features, int,
|
||||
@@ -91,12 +92,6 @@ plugin_t *stroke_plugin_create()
|
||||
{
|
||||
private_stroke_plugin_t *this;
|
||||
|
||||
if (!lib->caps->check(lib->caps, CAP_CHOWN))
|
||||
{ /* required to chown(2) stroke socket */
|
||||
DBG1(DBG_CFG, "stroke plugin requires CAP_CHOWN capability");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.plugin = {
|
||||
@@ -110,4 +105,3 @@ plugin_t *stroke_plugin_create()
|
||||
|
||||
return &this->public.plugin;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,12 +92,6 @@ plugin_t *whitelist_plugin_create()
|
||||
{
|
||||
private_whitelist_plugin_t *this;
|
||||
|
||||
if (!lib->caps->check(lib->caps, CAP_CHOWN))
|
||||
{ /* required to chown(2) control socket */
|
||||
DBG1(DBG_CFG, "whitelist plugin requires CAP_CHOWN capability");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
INIT(this,
|
||||
.public = {
|
||||
.plugin = {
|
||||
|
||||
@@ -251,6 +251,11 @@ stream_service_t *stream_service_create_unix(char *uri, int backlog)
|
||||
DBG1(DBG_NET, "invalid stream URI: '%s'", uri);
|
||||
return NULL;
|
||||
}
|
||||
if (!lib->caps->check(lib->caps, CAP_CHOWN))
|
||||
{ /* required to chown(2) service socket */
|
||||
DBG1(DBG_NET, "socket '%s' requires CAP_CHOWN capability", uri);
|
||||
return NULL;
|
||||
}
|
||||
fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (fd == -1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user