summaryrefslogtreecommitdiffstats
path: root/dcop/dcopclient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dcop/dcopclient.cpp')
-rw-r--r--dcop/dcopclient.cpp51
1 files changed, 33 insertions, 18 deletions
diff --git a/dcop/dcopclient.cpp b/dcop/dcopclient.cpp
index 5523365c8..1533b802c 100644
--- a/dcop/dcopclient.cpp
+++ b/dcop/dcopclient.cpp
@@ -50,6 +50,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <stdlib.h>
#include <assert.h>
#include <string.h>
+#ifdef HAVE_UCRED_H
+#include <ucred.h>
+#endif /* HAVE_UCRED_H */
#include <tqguardedptr.h>
#include <tqtextstream.h>
@@ -59,13 +62,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <tqsocketnotifier.h>
#include <tqregexp.h>
-#include <tqucomextra_p.h>
+#include <private/tqucomextra_p.h>
#include <dcopglobal.h>
#include <dcopclient.h>
#include <dcopobject.h>
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined TQ_WS_X11 && ! defined K_WS_QTONLY
#include <X11/Xmd.h>
#endif
extern "C" {
@@ -212,7 +215,7 @@ TQCString DCOPClient::iceauthPath()
{
#if defined(ICEAUTH_PATH)
if (
-# if defined(Q_WS_WIN)
+# if defined(TQ_WS_WIN)
access(ICEAUTH_PATH, 0) == 0
# else
access(ICEAUTH_PATH, X_OK) == 0
@@ -263,9 +266,9 @@ static TQCString dcopServerFile(const TQCString &hostname, bool old)
fprintf(stderr, "Aborting. $HOME is not set.\n");
exit(1);
}
-#ifdef Q_WS_X11
+#ifdef TQ_WS_X11
TQCString disp = getenv("DISPLAY");
-#elif defined(Q_WS_QWS)
+#elif defined(TQ_WS_QWS)
TQCString disp = getenv("QWS_DISPLAY");
#else
TQCString disp;
@@ -331,10 +334,10 @@ void DCOPClient::handleAsyncReply(ReplyStruct *replyStruct)
{
if (replyStruct->replyObject)
{
- TQObject::connect(this, TQT_SIGNAL(callBack(int, const TQCString&, const TQByteArray &)),
+ TQObject::connect(this, TQ_SIGNAL(callBack(int, const TQCString&, const TQByteArray &)),
replyStruct->replyObject, replyStruct->replySlot);
emit callBack(replyStruct->replyId, *(replyStruct->replyType), *(replyStruct->replyData));
- TQObject::disconnect(this, TQT_SIGNAL(callBack(int, const TQCString&, const TQByteArray &)),
+ TQObject::disconnect(this, TQ_SIGNAL(callBack(int, const TQCString&, const TQByteArray &)),
replyStruct->replyObject, replyStruct->replySlot);
}
delete replyStruct;
@@ -622,8 +625,8 @@ DCOPClient::DCOPClient()
d->qt_bridge_enabled = true;
d->transactionList = 0L;
d->transactionId = 0;
- TQObject::connect( &d->postMessageTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( processPostedMessagesInternal() ) );
- TQObject::connect( &d->eventLoopTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( eventLoopTimeout() ) );
+ TQObject::connect( &d->postMessageTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( processPostedMessagesInternal() ) );
+ TQObject::connect( &d->eventLoopTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( eventLoopTimeout() ) );
if ( !mainClient() )
setMainClient( this );
@@ -690,14 +693,14 @@ void DCOPClient::bindToApp()
delete d->notifier;
d->notifier = new TQSocketNotifier(socket(),
TQSocketNotifier::Read, 0, 0);
- TQObject::connect(d->notifier, TQT_SIGNAL(activated(int)),
- TQT_SLOT(processSocketData(int)));
+ TQObject::connect(d->notifier, TQ_SIGNAL(activated(int)),
+ TQ_SLOT(processSocketData(int)));
}
}
void DCOPClient::suspend()
{
-#ifdef Q_WS_WIN //TODO: remove (win32 ports sometimes do not create notifiers)
+#ifdef TQ_WS_WIN //TODO: remove (win32 ports sometimes do not create notifiers)
if (!d->notifier)
return;
#endif
@@ -707,7 +710,7 @@ void DCOPClient::suspend()
void DCOPClient::resume()
{
-#ifdef Q_WS_WIN //TODO: remove
+#ifdef TQ_WS_WIN //TODO: remove
if (!d->notifier)
return;
#endif
@@ -717,14 +720,14 @@ void DCOPClient::resume()
bool DCOPClient::isSuspended() const
{
-#if defined(Q_WS_WIN) || defined(Q_WS_MAC) //TODO: REMOVE
+#if defined(TQ_WS_WIN) || defined(TQ_WS_MAC) //TODO: REMOVE
if (!d->notifier)
return false;
#endif
return !d->notifier->isEnabled();
}
-#if defined(SO_PEERCRED) || defined(LOCAL_PEEREID)
+#if defined(SO_PEERCRED) || defined(LOCAL_PEEREID) || defined(HAVE_GETPEERUCRED)
#define USE_PEER_IS_US
// Check whether the remote end is owned by the same user.
static bool peerIsUs(int sockfd)
@@ -745,6 +748,18 @@ static bool peerIsUs(int sockfd)
if (getsockopt(sockfd, 0, LOCAL_PEEREID, &cred, &siz) != 0 || siz != sizeof(cred))
return false;
return (cred.unp_euid == geteuid());
+#elif defined(HAVE_GETPEERUCRED)
+ ucred_t *cred = nullptr;
+ uint_t peer_uid;
+
+ if (getpeerucred(sockfd, &cred) != 0) {
+ if (cred != nullptr)
+ ucred_free(cred);
+ return false;
+ }
+ peer_uid = ucred_geteuid(cred);
+ ucred_free(cred);
+ return (peer_uid == getuid());
#endif
}
#else
@@ -806,7 +821,7 @@ bool DCOPClient::attachInternal( bool registerAsAnonymous )
emit attachFailed(TQString::fromLatin1( "Could not read network connection list.\n" )+TQFile::decodeName(fName));
return false;
}
- int size = TQMIN( (qint64)1024, f.size() ); // protection against a huge file
+ int size = TQMIN( (long)1024, f.size() ); // protection against a huge file
TQCString contents( size+1 );
if ( f.readBlock( contents.data(), size ) != size )
{
@@ -1497,7 +1512,7 @@ static bool receiveQtObject( const TQCString &objId, const TQCString &fun, const
TQStrList lst = o->metaObject()->slotNames( true );
int i = 0;
for ( TQPtrListIterator<char> it( lst ); it.current(); ++it ) {
- if ( o->metaObject()->slot( i++, true )->tqt_mo_access != TQMetaData::Public )
+ if ( o->metaObject()->slot( i++, true )->access != TQMetaData::Public )
continue;
TQCString slot = it.current();
if ( slot.contains( "()" ) ) {
@@ -1841,7 +1856,7 @@ int DCOPClient::callAsync(const TQCString &remApp, const TQCString &remObjId,
if (replyStruct->transactionId == 0)
{
// Call is finished already
- TQTimer::singleShot(0, this, TQT_SLOT(asyncReplyReady()));
+ TQTimer::singleShot(0, this, TQ_SLOT(asyncReplyReady()));
d->asyncReplyQueue.append(replyStruct);
}