moved helper daemonization

add abillity to own users org.netctlgui.helper service
This commit is contained in:
arcan1s
2014-08-12 00:23:11 +04:00
parent 80f6ccf1d1
commit 3e0ae6d4cc
8 changed files with 24 additions and 34 deletions

View File

@ -2,18 +2,14 @@
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- only root can own the service -->
<policy user="root">
<allow own="org.netctlgui.helper"/>
</policy>
<!-- allow everything to users of the group "network" -->
<policy group="network">
<allow own="org.netctlgui.helper"/>
<allow send_destination="org.netctlgui.helper"/>
<allow receive_sender="org.netctlgui.helper"/>
</policy>
<policy user="root">
<allow own="org.netctlgui.helper"/>
<allow send_destination="org.netctlgui.helper"/>
<allow receive_sender="org.netctlgui.helper"/>
</policy>

View File

@ -79,17 +79,14 @@ int main(int argc, char *argv[])
(args[QString("version")].toBool()) ||
(args[QString("error")].toBool()))
args[QString("nodaemon")] = true;
// heck euid
// check euid
if (geteuid() != 0) {
cout << QCoreApplication::translate("NetctlHelper", "The helper is running with EUID %1. Some functions will not be available.")
cout << QCoreApplication::translate("NetctlHelper", "The helper is running with EUID %1. Functions will not be available.")
.arg(QString::number(geteuid())).toUtf8().data() << endl;
cout << QCoreApplication::translate("NetctlHelper", "See security notes for more details.")
.toUtf8().data() << endl;
}
// detach from console
if (!args[QString("nodaemon")].toBool())
daemon(0, 0);
#if QT_VERSION >= 0x050000
QCoreApplication::setSetuidAllowed(true);
#endif

View File

@ -36,6 +36,8 @@ NetctlHelper::NetctlHelper(QObject *parent, QMap<QString, QVariant> args)
debug(args[QString("debug")].toBool())
{
updateConfiguration();
if (!args[QString("nodaemon")].toBool())
daemon(0, 0);
}