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;
}
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;
}
Beispiel #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;
}
Beispiel #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;
}
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();
}
bool NativeAdaptor::isClientActionEnabled(const QDBusObjectPath &path)
{
    bool enabled;
    emit onIsClientActionEnabled(enabled, path, calledFromDBus() ? message().service() : QString());
    return enabled;
}
bool NativeAdaptor::enableClientAction(const QDBusObjectPath &path, bool enabled)
{
    bool result;
    emit onEnableClientAction(result, path, enabled, calledFromDBus() ? message().service() : QString());
    return result;
}
bool NativeAdaptor::deactivateClientAction(const QDBusObjectPath &path)
{
    bool result;
    emit onDeactivateClientAction(result, path, calledFromDBus() ? message().service() : QString());
    return result;
}
bool NativeAdaptor::modifyClientAction(const QDBusObjectPath &path, const QString &description)
{
    qulonglong result;
    emit onModifyClientAction(result, path, description, calledFromDBus() ? message().service() : QString());
    return result;
}