summaryrefslogtreecommitdiffstats
path: root/tdesu
diff options
context:
space:
mode:
Diffstat (limited to 'tdesu')
-rw-r--r--tdesu/CMakeLists.txt3
-rw-r--r--tdesu/Mainpage.dox1
-rw-r--r--tdesu/client.cpp26
-rw-r--r--tdesu/client.h2
-rw-r--r--tdesu/defaults.h2
-rw-r--r--tdesu/kcookie.cpp10
-rw-r--r--tdesu/kcookie.h6
-rw-r--r--tdesu/process.cpp5
-rw-r--r--tdesu/process.h2
-rw-r--r--tdesu/ssh.cpp4
-rw-r--r--tdesu/ssh.h2
-rw-r--r--tdesu/stub.cpp4
-rw-r--r--tdesu/stub.h4
-rw-r--r--tdesu/su.cpp4
-rw-r--r--tdesu/su.h2
-rw-r--r--tdesu/tdesu_pty.cpp12
-rw-r--r--tdesu/tdesu_pty.h2
-rw-r--r--tdesu/tdesu_stub.c6
18 files changed, 60 insertions, 37 deletions
diff --git a/tdesu/CMakeLists.txt b/tdesu/CMakeLists.txt
index 8dcf012bd..de84adb4e 100644
--- a/tdesu/CMakeLists.txt
+++ b/tdesu/CMakeLists.txt
@@ -42,7 +42,8 @@ set( ${target}_SRCS
tde_add_library( ${target} SHARED
SOURCES ${${target}_SRCS}
VERSION 14.0.0
- LINK tdecore-shared ${LIB_UTIL}
+ LINK tdecore-shared
+ LINK_PRIVATE ${LIB_UTIL}
DESTINATION ${LIB_INSTALL_DIR}
)
diff --git a/tdesu/Mainpage.dox b/tdesu/Mainpage.dox
index d472c772d..1e9067e09 100644
--- a/tdesu/Mainpage.dox
+++ b/tdesu/Mainpage.dox
@@ -18,4 +18,3 @@ Adriaan de Groot \<groot@kde.org\>
// DOXYGEN_REFERENCES = tdecore
// DOXYGEN_SET_PROJECT_NAME = Trinitysu
-// vim:ts=4:sw=4:expandtab:filetype=doxygen
diff --git a/tdesu/client.cpp b/tdesu/client.cpp
index c82137cae..54ba1dc00 100644
--- a/tdesu/client.cpp
+++ b/tdesu/client.cpp
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
@@ -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/client.h b/tdesu/client.h
index 7f7a7aa9f..3a9411f6d 100644
--- a/tdesu/client.h
+++ b/tdesu/client.h
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
diff --git a/tdesu/defaults.h b/tdesu/defaults.h
index 7fd724e2e..07d3d096f 100644
--- a/tdesu/defaults.h
+++ b/tdesu/defaults.h
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
diff --git a/tdesu/kcookie.cpp b/tdesu/kcookie.cpp
index f5a2d547c..de3d3ad58 100644
--- a/tdesu/kcookie.cpp
+++ b/tdesu/kcookie.cpp
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
@@ -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 4f63ebdb7..9c93be2a2 100644
--- a/tdesu/kcookie.h
+++ b/tdesu/kcookie.h
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
@@ -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 0fded3184..3cbea8ec6 100644
--- a/tdesu/process.cpp
+++ b/tdesu/process.cpp
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
@@ -50,7 +50,7 @@
#include <tdeconfig.h>
#include <kdebug.h>
-#include <kstandarddirs.h>
+#include <tdestandarddirs.h>
#include "process.h"
#include "tdesu_pty.h"
@@ -359,6 +359,7 @@ int PtyProcess::exec(const TQCString &command, const QCStringList &args)
putenv(const_cast<TQCString&>(*it).data());
}
unsetenv("TDE_FULL_SESSION");
+ unsetenv("XDG_RUNTIME_DIR");
// set temporarily LC_ALL to C, for su (to be able to parse "Password:")
const char* old_lc_all = getenv( "LC_ALL" );
diff --git a/tdesu/process.h b/tdesu/process.h
index 941021d9a..ae7741a2a 100644
--- a/tdesu/process.h
+++ b/tdesu/process.h
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
diff --git a/tdesu/ssh.cpp b/tdesu/ssh.cpp
index c23ca459b..1f543579c 100644
--- a/tdesu/ssh.cpp
+++ b/tdesu/ssh.cpp
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
@@ -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/ssh.h b/tdesu/ssh.h
index d4e91688b..ce6f096ae 100644
--- a/tdesu/ssh.h
+++ b/tdesu/ssh.h
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
diff --git a/tdesu/stub.cpp b/tdesu/stub.cpp
index 4cd5864de..cc4222358 100644
--- a/tdesu/stub.cpp
+++ b/tdesu/stub.cpp
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
@@ -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 af4e624ea..e4d2bed4b 100644
--- a/tdesu/stub.h
+++ b/tdesu/stub.h
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
@@ -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 e29288ab9..b46d0ae0b 100644
--- a/tdesu/su.cpp
+++ b/tdesu/su.cpp
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
@@ -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/su.h b/tdesu/su.h
index ff1891067..c6a4965d2 100644
--- a/tdesu/su.h
+++ b/tdesu/su.h
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
diff --git a/tdesu/tdesu_pty.cpp b/tdesu/tdesu_pty.cpp
index 207c0a3e2..c4139dd35 100644
--- a/tdesu/tdesu_pty.cpp
+++ b/tdesu/tdesu_pty.cpp
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
@@ -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 :(
@@ -94,10 +94,14 @@ PTY::~PTY()
int PTY::getpt()
{
-#if defined(HAVE_GETPT) && defined(HAVE_PTSNAME)
+#if (defined(HAVE_GETPT) || defined(HAVE_POSIX_OPENPT)) && defined(HAVE_PTSNAME)
// 1: UNIX98: preferred way
+#ifdef HAVE_GETPT
ptyfd = ::getpt();
+#elif defined(HAVE_POSIX_OPENPT)
+ ptyfd = ::posix_openpt(O_RDWR);
+#endif
ttyname = ::ptsname(ptyfd);
return ptyfd;
diff --git a/tdesu/tdesu_pty.h b/tdesu/tdesu_pty.h
index fb9617015..817e3c6ca 100644
--- a/tdesu/tdesu_pty.h
+++ b/tdesu/tdesu_pty.h
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
diff --git a/tdesu/tdesu_stub.c b/tdesu/tdesu_stub.c
index f8054a313..8ef79907e 100644
--- a/tdesu/tdesu_stub.c
+++ b/tdesu/tdesu_stub.c
@@ -1,4 +1,4 @@
-/* vi: ts=8 sts=4 sw=4
+/*
*
* $Id$
*
@@ -367,9 +367,9 @@ int main()
close(fd);
xsetenv("ICEAUTHORITY", iceauthority);
- fout = popen("iceauth >/dev/null 2>&1", "w");
+ fout = popen(ICEAUTH_COMMAND " >/dev/null 2>&1", "w");
if (!fout) {
- perror("tdesu_stub: popen iceauth");
+ perror("tdesu_stub: popen " ICEAUTH_COMMAND);
exit(1);
}
for (i=0; host[i]; i++)