summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Christian <andrew.christian@nokia.com>2012-02-08 10:59:44 -0500
committerChris Craig <ext-chris.craig@nokia.com>2012-02-10 04:00:21 +0100
commitd33cd2c25f6062d51eba713126bbe881021f693b (patch)
tree2765539ec0a1c7e10fae4521213755c9ea4a906c /src
parent1b55e397a94ad39adaaf21276a74605ea999ab1a (diff)
Updating UID and GID control.
* Removed uid() and gid() functions from process frontend/backend because these values must be calculated from the /proc filesystem. * Fixed bug in processinfo that incorrectly set group id. * Updated test suite so that you can specify UID/GID to run child processes as. Use TEST_UID=NUM and TEST_GID=num as environment variables and then execute the test suite with CAP_SETUID (normally accomplished by running as root) Change-Id: Ib1c10521bddec19afe7eae1422ffa1f24985756c Reviewed-by: Chris Craig <ext-chris.craig@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/processbackend.cpp19
-rw-r--r--src/core/processbackend.h2
-rw-r--r--src/core/processfrontend.cpp30
-rw-r--r--src/core/processfrontend.h4
-rw-r--r--src/core/processinfo.cpp2
-rw-r--r--src/core/unixprocessbackend.cpp2
6 files changed, 2 insertions, 57 deletions
diff --git a/src/core/processbackend.cpp b/src/core/processbackend.cpp
index ab220a5..301b5c5 100644
--- a/src/core/processbackend.cpp
+++ b/src/core/processbackend.cpp
@@ -166,25 +166,6 @@ QString ProcessBackend::errorString() const
return QString();
}
-
-/*!
- Return the process UID
-*/
-
-qint64 ProcessBackend::uid() const
-{
- return 0;
-}
-
-/*!
- Return the process GID
-*/
-
-qint64 ProcessBackend::gid() const
-{
- return 0;
-}
-
/*!
Returns the PID of this process. If the process has not started up yet properly, its PID will be 0.
*/
diff --git a/src/core/processbackend.h b/src/core/processbackend.h
index 77f05a3..eb87fa7 100644
--- a/src/core/processbackend.h
+++ b/src/core/processbackend.h
@@ -65,8 +65,6 @@ public:
virtual QString errorString() const;
- virtual qint64 uid() const;
- virtual qint64 gid() const;
virtual Q_PID pid() const;
virtual qint32 actualPriority() const;
diff --git a/src/core/processfrontend.cpp b/src/core/processfrontend.cpp
index 896d17a..5876f39 100644
--- a/src/core/processfrontend.cpp
+++ b/src/core/processfrontend.cpp
@@ -91,16 +91,6 @@ QT_BEGIN_NAMESPACE_PROCESSMANAGER
*/
/*!
- \property ProcessFrontend::uid
- \brief the user id (uid) of the process.
-*/
-
-/*!
- \property ProcessFrontend::gid
- \brief the group id (gid) of the process.
-*/
-
-/*!
\property ProcessFrontend::pid
\brief the process id (PID) of the process.
@@ -233,26 +223,6 @@ QString ProcessFrontend::workingDirectory() const
}
/*!
- Return the process UID
-*/
-
-qint64 ProcessFrontend::uid() const
-{
- Q_ASSERT(m_backend);
- return m_backend->uid();
-}
-
-/*!
- Return the process GID
-*/
-
-qint64 ProcessFrontend::gid() const
-{
- Q_ASSERT(m_backend);
- return m_backend->gid();
-}
-
-/*!
Returns the PID of this process. If the process has not started up yet properly, its PID will be 0.
*/
Q_PID ProcessFrontend::pid() const
diff --git a/src/core/processfrontend.h b/src/core/processfrontend.h
index 644d414..542bbd9 100644
--- a/src/core/processfrontend.h
+++ b/src/core/processfrontend.h
@@ -60,8 +60,6 @@ class Q_ADDON_PROCESSMANAGER_EXPORT ProcessFrontend : public QObject
Q_PROPERTY(QStringList arguments READ arguments CONSTANT)
Q_PROPERTY(QVariantMap environment READ environment CONSTANT)
Q_PROPERTY(QString workingDirectory READ workingDirectory CONSTANT)
- Q_PROPERTY(qint64 uid READ uid NOTIFY started)
- Q_PROPERTY(qint64 gid READ gid NOTIFY started)
Q_PROPERTY(qint64 pid READ pid NOTIFY started)
Q_PROPERTY(qint64 startTime READ startTime NOTIFY started)
@@ -81,8 +79,6 @@ public:
QVariantMap environment() const;
QString workingDirectory() const;
- qint64 uid() const;
- qint64 gid() const;
Q_PID pid() const;
qint32 priority() const;
diff --git a/src/core/processinfo.cpp b/src/core/processinfo.cpp
index 1f16954..4b60ee9 100644
--- a/src/core/processinfo.cpp
+++ b/src/core/processinfo.cpp
@@ -294,7 +294,7 @@ void ProcessInfo::setUid(qint64 newUid)
qint64 ProcessInfo::gid() const
{
- return m_info.value(ProcessInfoConstants::Priority).toLongLong();
+ return m_info.value(ProcessInfoConstants::Gid).toLongLong();
}
/*!
diff --git a/src/core/unixprocessbackend.cpp b/src/core/unixprocessbackend.cpp
index 48b4cc8..286b486 100644
--- a/src/core/unixprocessbackend.cpp
+++ b/src/core/unixprocessbackend.cpp
@@ -94,7 +94,7 @@ Q_PID UnixProcessBackend::pid() const
{
if (m_process)
return m_process->pid();
- return 0;
+ return ProcessBackend::pid();
}
/*!