summaryrefslogtreecommitdiffstats
path: root/tdesu
diff options
context:
space:
mode:
Diffstat (limited to 'tdesu')
-rw-r--r--tdesu/client.cpp24
-rw-r--r--tdesu/kcookie.cpp8
-rw-r--r--tdesu/kcookie.h4
-rw-r--r--tdesu/process.cpp2
-rw-r--r--tdesu/ssh.cpp2
-rw-r--r--tdesu/stub.cpp2
-rw-r--r--tdesu/stub.h2
-rw-r--r--tdesu/su.cpp2
-rw-r--r--tdesu/tdesu_pty.cpp4
9 files changed, 34 insertions, 16 deletions
diff --git a/tdesu/client.cpp b/tdesu/client.cpp
index fe5733ee7..54ba1dc00 100644
--- a/tdesu/client.cpp
+++ b/tdesu/client.cpp
@@ -19,6 +19,9 @@
#include <pwd.h>
#include <errno.h>
#include <string.h>
+#ifdef HAVE_UCRED_H
+#include <ucred.h>
+#endif /* HAVE_UCRED_H */
#include <sys/types.h>
#include <sys/socket.h>
@@ -31,7 +34,7 @@
#include <tqregexp.h>
#include <kdebug.h>
-#include <kstandarddirs.h>
+#include <tdestandarddirs.h>
#include <tdeapplication.h>
#include <kde_file.h>
@@ -50,7 +53,7 @@ public:
TDEsuClient::TDEsuClient()
{
sockfd = -1;
-#ifdef Q_WS_X11
+#ifdef TQ_WS_X11
TQCString display(getenv("DISPLAY"));
if (display.isEmpty())
{
@@ -146,6 +149,21 @@ int TDEsuClient::connect()
return -1;
}
# endif
+#elif defined(HAVE_GETPEERUCRED)
+ ucred_t *cred = nullptr;
+
+ if (getpeerucred(sockfd, &cred) == 0) {
+ uid_t peer_uid = ucred_geteuid(cred);
+
+ ucred_free(cred);
+ if (peer_uid != getuid()) {
+ kdWarning(900) << "socket not owned by me! socket uid = " << peer_uid << endl;
+ close(sockfd); sockfd = -1;
+ return -1;
+ }
+ }
+ if (cred != nullptr)
+ ucred_free(cred);
#else
struct ucred cred;
socklen_t siz = sizeof(cred);
@@ -429,7 +447,7 @@ int TDEsuClient::startServer()
// connections.
// We start it via tdeinit to make sure that it doesn't inherit
// any fd's from the parent process.
- int ret = kapp->tdeinitExecWait(d->daemon);
+ int ret = tdeApp->tdeinitExecWait(d->daemon);
connect();
return ret;
}
diff --git a/tdesu/kcookie.cpp b/tdesu/kcookie.cpp
index 63013dae0..de3d3ad58 100644
--- a/tdesu/kcookie.cpp
+++ b/tdesu/kcookie.cpp
@@ -27,13 +27,13 @@
#include <dcopclient.h>
#include <kdebug.h>
-#include <kprocess.h>
+#include <tdeprocess.h>
#include "kcookie.h"
KCookie::KCookie()
{
-#ifdef Q_WS_X11
+#ifdef TQ_WS_X11
getXCookie();
#endif
setDcopTransport("local");
@@ -85,7 +85,7 @@ void KCookie::getXCookie()
char buf[1024];
FILE *f;
-#ifdef Q_WS_X11
+#ifdef TQ_WS_X11
m_Display = getenv("DISPLAY");
#else
m_Display = getenv("QWS_DISPLAY");
@@ -95,7 +95,7 @@ void KCookie::getXCookie()
kdError(900) << k_lineinfo << "$DISPLAY is not set.\n";
return;
}
-#ifdef Q_WS_X11 // No need to mess with X Auth stuff
+#ifdef TQ_WS_X11 // No need to mess with X Auth stuff
TQCString disp = m_Display;
if (!memcmp(disp.data(), "localhost:", 10))
disp.remove(0, 9);
diff --git a/tdesu/kcookie.h b/tdesu/kcookie.h
index eb097a2a2..9c93be2a2 100644
--- a/tdesu/kcookie.h
+++ b/tdesu/kcookie.h
@@ -34,7 +34,7 @@ public:
*/
TQCString display() { return m_Display; }
-#ifdef Q_WS_X11
+#ifdef TQ_WS_X11
/**
* Returns the X11 magic cookie, if available.
*/
@@ -74,7 +74,7 @@ private:
bool m_bHaveICECookies;
TQCString m_Display;
-#ifdef Q_WS_X11
+#ifdef TQ_WS_X11
TQCString m_DisplayAuth;
#endif
TQCString m_DCOPSrv;
diff --git a/tdesu/process.cpp b/tdesu/process.cpp
index 1d56128da..3cbea8ec6 100644
--- a/tdesu/process.cpp
+++ b/tdesu/process.cpp
@@ -50,7 +50,7 @@
#include <tdeconfig.h>
#include <kdebug.h>
-#include <kstandarddirs.h>
+#include <tdestandarddirs.h>
#include "process.h"
#include "tdesu_pty.h"
diff --git a/tdesu/ssh.cpp b/tdesu/ssh.cpp
index e75f33d69..1f543579c 100644
--- a/tdesu/ssh.cpp
+++ b/tdesu/ssh.cpp
@@ -33,7 +33,7 @@
#include <kdebug.h>
#include <tdelocale.h>
-#include <kstandarddirs.h>
+#include <tdestandarddirs.h>
#include "ssh.h"
#include "kcookie.h"
diff --git a/tdesu/stub.cpp b/tdesu/stub.cpp
index 721dceddb..cc4222358 100644
--- a/tdesu/stub.cpp
+++ b/tdesu/stub.cpp
@@ -95,7 +95,7 @@ int StubProcess::ConverseStub(int check)
} else if (line == "display") {
writeLine(display());
} else if (line == "display_auth") {
-#ifdef Q_WS_X11
+#ifdef TQ_WS_X11
writeLine(displayAuth());
#else
writeLine("");
diff --git a/tdesu/stub.h b/tdesu/stub.h
index f4216d7f4..e4d2bed4b 100644
--- a/tdesu/stub.h
+++ b/tdesu/stub.h
@@ -98,7 +98,7 @@ protected:
* desired. By default, it returns the value returned by KCookie.
*/
virtual TQCString display() { return m_pCookie->display(); }
-#ifdef Q_WS_X11
+#ifdef TQ_WS_X11
/**
* See display.
*/
diff --git a/tdesu/su.cpp b/tdesu/su.cpp
index 778d99da0..b46d0ae0b 100644
--- a/tdesu/su.cpp
+++ b/tdesu/su.cpp
@@ -36,7 +36,7 @@
#include <tdeconfig.h>
#include <kdebug.h>
#include <tdelocale.h>
-#include <kstandarddirs.h>
+#include <tdestandarddirs.h>
#include "su.h"
#include "kcookie.h"
diff --git a/tdesu/tdesu_pty.cpp b/tdesu/tdesu_pty.cpp
index 4736ac1eb..c4139dd35 100644
--- a/tdesu/tdesu_pty.cpp
+++ b/tdesu/tdesu_pty.cpp
@@ -33,7 +33,7 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
-#if defined(__osf__) || defined(__CYGWIN__)
+#if defined(__CYGWIN__)
#include <pty.h>
#endif
@@ -41,7 +41,7 @@
#include <tqcstring.h>
#include <kdebug.h>
-#include <kstandarddirs.h>
+#include <tdestandarddirs.h>
#include "tdesu_pty.h"
// stdlib.h is meant to declare the prototypes but doesn't :(