|
|
|
@ -590,69 +590,76 @@ int runDCOP( QCStringList args, UserList users, Session session,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( users.count() > 1 || ( users.count() == 1 &&
|
|
|
|
|
( getenv( "ICEAUTHORITY" ) == 0 || getenv( "DISPLAY" ) == 0 ) ) )
|
|
|
|
|
if ((users.count() > 1) || ((users.count() == 1) &&
|
|
|
|
|
((getenv("ICEAUTHORITY") == 0) || (getenv("DISPLAY") == 0))))
|
|
|
|
|
{
|
|
|
|
|
// Check for ICE authority file and if the file can be read by us
|
|
|
|
|
TQString iceFileBase = "ICEauthority";
|
|
|
|
|
TQString iceFile;
|
|
|
|
|
TQFileInfo fi;
|
|
|
|
|
// Check for ICE authority file and if the file can be read by us
|
|
|
|
|
TQString iceFileBase = "ICEauthority";
|
|
|
|
|
TQString iceFile;
|
|
|
|
|
TQFileInfo fi;
|
|
|
|
|
|
|
|
|
|
if (getenv("XDG_RUNTIME_DIR") != 0 )
|
|
|
|
|
{
|
|
|
|
|
TQFileInfo xdgRuntime(getenv("XDG_RUNTIME_DIR"));
|
|
|
|
|
passwd* pstruct = getpwnam(it.key().local8Bit());
|
|
|
|
|
if (pstruct)
|
|
|
|
|
TQString xdgRuntimeDir = TQString::fromLocal8Bit(getenv("XDG_RUNTIME_DIR"));
|
|
|
|
|
if (xdgRuntimeDir.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
iceFile = TQString("%1/%2/%3").arg(xdgRuntime.dirPath()).arg(pstruct->pw_uid).arg(iceFileBase);
|
|
|
|
|
fi.setFile(iceFile);
|
|
|
|
|
xdgRuntimeDir = "/run/user/<uid>";
|
|
|
|
|
}
|
|
|
|
|
if (!pstruct || !fi.exists())
|
|
|
|
|
if (!xdgRuntimeDir.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
iceFile = TQString::null;
|
|
|
|
|
TQFileInfo xdgRuntime(xdgRuntimeDir);
|
|
|
|
|
passwd* pstruct = getpwnam(it.key().local8Bit());
|
|
|
|
|
if (pstruct)
|
|
|
|
|
{
|
|
|
|
|
iceFile = TQString("%1/%2/%3").arg(xdgRuntime.dirPath()).arg(pstruct->pw_uid).arg(iceFileBase);
|
|
|
|
|
fi.setFile(iceFile);
|
|
|
|
|
}
|
|
|
|
|
if (!pstruct || !fi.exists())
|
|
|
|
|
{
|
|
|
|
|
iceFile = TQString::null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (iceFile.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
iceFile = TQString("%1/.%2").arg(it.data()).arg(iceFileBase);
|
|
|
|
|
fi.setFile(iceFile);
|
|
|
|
|
}
|
|
|
|
|
if( iceFile.isEmpty() )
|
|
|
|
|
{
|
|
|
|
|
cerr_ << "WARNING: Cannot determine home directory for user "
|
|
|
|
|
<< it.key() << "!" << endl
|
|
|
|
|
<< "Please check permissions or set the $ICEAUTHORITY variable manually before" << endl
|
|
|
|
|
<< "calling dcop." << endl;
|
|
|
|
|
}
|
|
|
|
|
else if( fi.exists() )
|
|
|
|
|
{
|
|
|
|
|
if( fi.isReadable() )
|
|
|
|
|
if (iceFile.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
char *envStr = strdup( ( "ICEAUTHORITY=" + iceFile ).ascii() );
|
|
|
|
|
putenv( envStr );
|
|
|
|
|
//cerr_ << "ice: " << envStr << endl;
|
|
|
|
|
iceFile = TQString("%1/.%2").arg(it.data()).arg(iceFileBase);
|
|
|
|
|
fi.setFile(iceFile);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (iceFile.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
cerr_ << "WARNING: ICE authority file " << iceFile
|
|
|
|
|
<< "is not readable by you!" << endl
|
|
|
|
|
<< "Please check permissions or set the $ICEAUTHORITY variable manually before" << endl
|
|
|
|
|
<< "calling dcop." << endl;
|
|
|
|
|
cerr_ << "WARNING: Cannot determine home directory for user "
|
|
|
|
|
<< it.key() << "!" << endl
|
|
|
|
|
<< "Please check permissions or set the $ICEAUTHORITY variable manually before" << endl
|
|
|
|
|
<< "calling dcop." << endl;
|
|
|
|
|
}
|
|
|
|
|
else if (fi.exists())
|
|
|
|
|
{
|
|
|
|
|
if (fi.isReadable())
|
|
|
|
|
{
|
|
|
|
|
char *envStr = strdup(("ICEAUTHORITY=" + iceFile).local8Bit());
|
|
|
|
|
putenv(envStr);
|
|
|
|
|
//cerr_ << "ice: " << envStr << endl;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cerr_ << "WARNING: ICE authority file " << iceFile
|
|
|
|
|
<< "is not readable by you!" << endl
|
|
|
|
|
<< "Please check permissions or set the $ICEAUTHORITY variable manually before" << endl
|
|
|
|
|
<< "calling dcop." << endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if( users.count() > 1 )
|
|
|
|
|
continue;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cerr_ << "WARNING: Cannot find ICE authority file "
|
|
|
|
|
<< iceFile << "!" << endl
|
|
|
|
|
<< "Please check permissions or set the $ICEAUTHORITY"
|
|
|
|
|
<< " variable manually before" << endl
|
|
|
|
|
<< "calling dcop." << endl;
|
|
|
|
|
if (users.count() > 1)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cerr_ << "WARNING: Cannot find ICE authority file "
|
|
|
|
|
<< iceFile << "!" << endl
|
|
|
|
|
<< "Please check permissions or set the $ICEAUTHORITY"
|
|
|
|
|
<< " variable manually before" << endl
|
|
|
|
|
<< "calling dcop." << endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Main loop
|
|
|
|
|