[Libreoffice-commits] online.git: loolwsd/Capabilities.hpp loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Tue Jan 5 11:30:21 PST 2016
loolwsd/Capabilities.hpp | 15 +++++++++++----
loolwsd/LOOLWSD.cpp | 4 ----
loolwsd/LOOLWSD.hpp | 5 -----
3 files changed, 11 insertions(+), 13 deletions(-)
New commits:
commit 82c455ef94d8e101720cce95c5bb787c0f33b2a3
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Tue Jan 5 12:41:57 2016 -0500
loolwsd: dropCapability now works with --enable-debug
Change-Id: I1a852b0cb4fe0b08fcc00f2f7ab15eea3d36801b
Reviewed-on: https://gerrit.libreoffice.org/21133
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/Capabilities.hpp b/loolwsd/Capabilities.hpp
index d50018f..cb7e300 100644
--- a/loolwsd/Capabilities.hpp
+++ b/loolwsd/Capabilities.hpp
@@ -16,6 +16,13 @@
#include "Util.hpp"
+#if ENABLE_DEBUG
+#include <sys/types.h>
+#include <pwd.h>
+
+static int uid = 0;
+#endif
+
static
void dropCapability(
#ifdef __linux
@@ -75,15 +82,15 @@ void dropCapability(
#endif
// Running under sudo, probably because being debugged? Let's drop super-user rights.
- if (LOOLWSD::uid == 0)
+ if (uid == 0)
{
struct passwd *nobody = getpwnam("nobody");
if (nobody)
- LOOLWSD::uid = nobody->pw_uid;
+ uid = nobody->pw_uid;
else
- LOOLWSD::uid = 65534;
+ uid = 65534;
}
- if (setuid(LOOLWSD::uid) != 0)
+ if (setuid(uid) != 0)
{
Log::error("setuid() failed.");
}
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 4bee0e5..cf4658e 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -42,7 +42,6 @@ DEALINGS IN THE SOFTWARE.
#include <errno.h>
#include <locale.h>
-#include <pwd.h>
#include <unistd.h>
#ifdef __linux
@@ -623,9 +622,6 @@ Poco::NamedMutex LOOLWSD::NamedMutexLOOL("loolwsd");
int LOOLWSD::NumPreSpawnedChildren = 10;
bool LOOLWSD::doTest = false;
-#if ENABLE_DEBUG
-int LOOLWSD::uid = 0;
-#endif
const std::string LOOLWSD::CHILD_URI = "/loolws/child/";
const std::string LOOLWSD::PIDLOG = "/tmp/loolwsd.pid";
const std::string LOOLWSD::LOKIT_PIDLOG = "/tmp/lokit.pid";
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index d97addd..907620a 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -76,11 +76,6 @@ private:
void startupBroker(int nBroker);
int createBroker();
-
-#if ENABLE_DEBUG
-public:
- static int uid;
-#endif
};
#endif
More information about the Libreoffice-commits
mailing list