From 5e5a7b5af4c537813e45deb1cb0ff0a8ba8299f5 Mon Sep 17 00:00:00 2001 From: taaaki Date: Sun, 4 Aug 2013 20:21:19 +0000 Subject: [PATCH] Prevent TDM from being run as root user on Linux - see issue #3195 git-svn-id: https://svn.thedarkmod.com/svn/darkmod_src/trunk@5837 49c82d7f-2e2a-0410-a16f-ae8f201b507f --- sys/linux/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/linux/main.cpp b/sys/linux/main.cpp index 2239d706b..d12c7d0bf 100644 --- a/sys/linux/main.cpp +++ b/sys/linux/main.cpp @@ -591,6 +591,12 @@ int main(int argc, const char **argv) { Sys_Printf( "memory consistency checking enabled\n" ); #endif + // do not allow TDM to be run as root + if ( getuid() == 0 ) { + Sys_Printf( "The Dark Mod should not be run as root.\n" ); + Posix_Exit( EXIT_FAILURE ); + } + Posix_EarlyInit( ); if ( argc > 1 ) {