Example #1
0
QString NativeAdaptor::changeClientActionShortcut(const QDBusObjectPath &path, const QString &shortcut)
{
    QPair<QString, qulonglong> result;
    emit onChangeClientActionShortcut(result, path, shortcut, calledFromDBus() ? message().service() : QString());
    QString usedShortcut = result.first;
    return usedShortcut;
}
Example #2
0
QString NativeAdaptor::addClientAction(const QString &shortcut, const QDBusObjectPath &path, const QString &description, qulonglong &id)
{
    QPair<QString, qulonglong> result;
    emit onAddClientAction(result, shortcut, path, description, calledFromDBus() ? message().service() : QString());
    QString usedShortcut = result.first;
    id = result.second;
    return usedShortcut;
}
Example #3
0
bool DeviceLock::isPrivileged()
{
    pid_t pid = -1;
    if (!calledFromDBus()) {
        // Local function calls are always privileged
        return true;
    }
    // Get the PID of the calling process
    pid = connection().interface()->servicePid(message().service());
    // The /proc/<pid> directory is owned by EUID:EGID of the process
    QFileInfo info(QString("/proc/%1").arg(pid));
    if (info.group() != "privileged" && info.group() != "disk" && info.owner() != "root") {
        return false;
    }
    return true;
}
Example #4
0
bool ShutdownScreen::isPrivileged()
{
    if (!calledFromDBus()) {
        // Local function calls are always privileged
        return true;
    }

    // Get the PID of the calling process
    pid_t pid = connection().interface()->servicePid(message().service());

    // The /proc/<pid> directory is owned by EUID:EGID of the process
    QFileInfo info(QString("/proc/%1").arg(pid));
    if (info.group() != "privileged" && info.owner() != "root") {
        sendErrorReply(QDBusError::AccessDenied,
                QString("PID %1 is not in privileged group").arg(pid));
        return false;
    }

    return true;
}
Example #5
0
VariantMapList
CollectionDBusHandler::MprisQuery( const QString &xmlQuery )
{
    if( !calledFromDBus() )
        return VariantMapList();

    Collections::QueryMaker* qm = XmlQueryReader::getQueryMaker( xmlQuery, XmlQueryReader::IgnoreReturnValues );

    //probably invalid XML
    if( !qm )
    {
        debug() << "Invalid XML query: " << xmlQuery;
        sendErrorReply( QDBusError::InvalidArgs, "Invalid XML: " + xmlQuery );
        return VariantMapList();
    }

    setDelayedReply( true );

    new DBusQueryHelper( this, qm, connection(), message(), true );

    return VariantMapList();
}
Example #6
0
bool NativeAdaptor::isClientActionEnabled(const QDBusObjectPath &path)
{
    bool enabled;
    emit onIsClientActionEnabled(enabled, path, calledFromDBus() ? message().service() : QString());
    return enabled;
}
Example #7
0
bool NativeAdaptor::enableClientAction(const QDBusObjectPath &path, bool enabled)
{
    bool result;
    emit onEnableClientAction(result, path, enabled, calledFromDBus() ? message().service() : QString());
    return result;
}
Example #8
0
bool NativeAdaptor::deactivateClientAction(const QDBusObjectPath &path)
{
    bool result;
    emit onDeactivateClientAction(result, path, calledFromDBus() ? message().service() : QString());
    return result;
}
Example #9
0
bool NativeAdaptor::modifyClientAction(const QDBusObjectPath &path, const QString &description)
{
    qulonglong result;
    emit onModifyClientAction(result, path, description, calledFromDBus() ? message().service() : QString());
    return result;
}