summaryrefslogtreecommitdiffstats
path: root/dcop
diff options
context:
space:
mode:
authorOBATA Akio <[email protected]>2020-08-09 17:34:23 +0900
committerSlávek Banko <[email protected]>2020-08-31 11:51:46 +0200
commitf17a911197bdfc46089418ddae00f35ada87b314 (patch)
tree11ab414a354e2f69a10e83a53597b1977656b620 /dcop
parent928f3ce5fabcf1794a1843be442f366844d2b74c (diff)
downloadtdelibs-f17a911197bdfc46089418ddae00f35ada87b314.tar.gz
tdelibs-f17a911197bdfc46089418ddae00f35ada87b314.zip
Add a knob to use fixed path `iceauth` tool
`system()` and `popen()` may unsafe unless using absolute command path. Rely on PATH environment variable set by users may result in unwanted tool. Signed-off-by: OBATA Akio <[email protected]> Signed-off-by: Slávek Banko <[email protected]> (cherry picked from commit ac8c8ca54aaed1466255161a3d727dcfade4a7d9)
Diffstat (limited to 'dcop')
-rw-r--r--dcop/dcopclient.cpp17
-rw-r--r--dcop/dcopserver_shutdown.c2
2 files changed, 16 insertions, 3 deletions
diff --git a/dcop/dcopclient.cpp b/dcop/dcopclient.cpp
index 5dff084af..e2650885f 100644
--- a/dcop/dcopclient.cpp
+++ b/dcop/dcopclient.cpp
@@ -213,13 +213,26 @@ public:
TQCString DCOPClient::iceauthPath()
{
-#ifdef Q_OS_WIN32
+#if defined(ICEAUTH_PATH)
+ if (
+# if defined(Q_WS_WIN)
+ access(ICEAUTH_PATH, 0) == 0
+# else
+ access(ICEAUTH_PATH, X_OK) == 0
+# endif
+ )
+ {
+ return TQCString(ICEAUTH_PATH);
+ }
+
+#elif defined(Q_OS_WIN32)
char szPath[512];
char * pszFilePart;
int ret;
ret = SearchPathA(NULL,"iceauth.exe",NULL,sizeof(szPath)/sizeof(szPath[0]),szPath,&pszFilePart);
if(ret != 0)
return TQCString(szPath);
+
#else
TQCString path = ::getenv("PATH");
if (path.isEmpty())
@@ -233,9 +246,9 @@ TQCString DCOPClient::iceauthPath()
{
return fPath;
}
-
fPath = strtok(NULL, ":\b");
}
+
#endif
return 0;
}
diff --git a/dcop/dcopserver_shutdown.c b/dcop/dcopserver_shutdown.c
index fb25a86fa..af75c6d5a 100644
--- a/dcop/dcopserver_shutdown.c
+++ b/dcop/dcopserver_shutdown.c
@@ -151,7 +151,7 @@ static void cleanupDCOPsocket(char *buffer)
if (socket_file)
unlink(socket_file);
- snprintf(cmd, BUFFER_SIZE, "iceauth remove netid='%s'", buffer);
+ snprintf(cmd, BUFFER_SIZE, ICEAUTH_COMMAND " remove netid='%s'", buffer);
system(cmd);
}