From 29ae250646a14a8b26fd540f6bf29fdedd92a198 Mon Sep 17 00:00:00 2001 From: hunbernd Date: Tue, 8 Oct 2019 22:25:45 +0200 Subject: [PATCH 1/6] Added missing dependencies --- build_scripts/Windows-msys2/build/build.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/Windows-msys2/build/build.bat b/build_scripts/Windows-msys2/build/build.bat index 97d6e5853..d15e5babc 100644 --- a/build_scripts/Windows-msys2/build/build.bat +++ b/build_scripts/Windows-msys2/build/build.bat @@ -18,7 +18,7 @@ if errorlevel 2 exit /B 2 if errorlevel 1 goto error_env :: Install needed things -%EnvMSYS2Cmd% "pacman --noconfirm --needed -S make git mingw-w64-%RsMSYS2Architecture%-toolchain mingw-w64-%RsMSYS2Architecture%-qt5 mingw-w64-%RsMSYS2Architecture%-miniupnpc mingw-w64-%RsMSYS2Architecture%-sqlcipher mingw-w64-%RsMSYS2Architecture%-libmicrohttpd mingw-w64-%RsMSYS2Architecture%-xapian-core" +%EnvMSYS2Cmd% "pacman --noconfirm --needed -S make git mingw-w64-%RsMSYS2Architecture%-toolchain mingw-w64-%RsMSYS2Architecture%-qt5 mingw-w64-%RsMSYS2Architecture%-miniupnpc mingw-w64-%RsMSYS2Architecture%-sqlcipher mingw-w64-%RsMSYS2Architecture%-libmicrohttpd mingw-w64-%RsMSYS2Architecture%-xapian-core mingw-w64-%RsMSYS2Architecture%-cmake mingw-w64-%RsMSYS2Architecture%-rapidjson" :: Plugins if "%ParamPlugins%"=="1" %EnvMSYS2Cmd% "pacman --noconfirm --needed -S mingw-w64-%RsMSYS2Architecture%-speex mingw-w64-%RsMSYS2Architecture%-speexdsp mingw-w64-%RsMSYS2Architecture%-curl mingw-w64-%RsMSYS2Architecture%-libxslt mingw-w64-%RsMSYS2Architecture%-opencv mingw-w64-%RsMSYS2Architecture%-ffmpeg" From 8c804ed6012e6bb1be3fbeefa8640253b265f79a Mon Sep 17 00:00:00 2001 From: hunbernd Date: Tue, 8 Oct 2019 23:14:27 +0200 Subject: [PATCH 2/6] Deploy retroshare-service Deploy dependencies needed by imageformat dlls --- build_scripts/Windows-msys2/build/pack.bat | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build_scripts/Windows-msys2/build/pack.bat b/build_scripts/Windows-msys2/build/pack.bat index 5be0ac56e..e8c9761bc 100644 --- a/build_scripts/Windows-msys2/build/pack.bat +++ b/build_scripts/Windows-msys2/build/pack.bat @@ -99,6 +99,7 @@ copy nul "%RsDeployPath%\portable" %Quite% echo copy binaries copy "%RsBuildPath%\retroshare-gui\src\%RsBuildConfig%\RetroShare*.exe" "%RsDeployPath%" %Quite% copy "%RsBuildPath%\retroshare-nogui\src\%RsBuildConfig%\retroshare*-nogui.exe" "%RsDeployPath%" %Quite% +copy "%RsBuildPath%\retroshare-service\src\%RsBuildConfig%\retroshare*-service.exe" "%RsDeployPath%" %Quite% echo copy extensions for /D %%D in ("%RsBuildPath%\plugins\*") do ( @@ -127,6 +128,9 @@ if exist "%QtSharePath%\plugins\styles\qwindowsvistastyle.dll" ( copy "%QtSharePath%\plugins\imageformats\*.dll" "%RsDeployPath%\imageformats" %Quite% del /Q "%RsDeployPath%\imageformats\*d?.dll" %Quite% +for %%D in ("%RsDeployPath%\imageformats\*.dll") do ( + call :copy_dependencies "%%D" "%RsDeployPath%" +) echo copy qss xcopy /S "%SourcePath%\retroshare-gui\src\qss" "%RsDeployPath%\qss" %Quite% From 93bfbb6edea5c0b52d72da0c7032977e72292845 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 9 Oct 2019 01:55:31 +0200 Subject: [PATCH 3/6] Fix addSslOnlyFriend when adding with already known PGP If the PGP key is available add as full friend. Without this change when the PGP key of a non-friend is available the SSL-id is added in peer list but the PGP-id is not added as PGP friend, at same time skip_pgp_signature_validation is false, because we have the full PGP, so the connection attempt is refused, when it should be verified with PGP and accepted. --- libretroshare/src/pqi/p3peermgr.cc | 42 ++++++++++++++---------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc index b7902e181..e871e4ddd 100644 --- a/libretroshare/src/pqi/p3peermgr.cc +++ b/libretroshare/src/pqi/p3peermgr.cc @@ -1074,26 +1074,22 @@ bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg bool p3PeerMgrIMPL::addSslOnlyFriend( const RsPeerId& sslId, const RsPgpId& pgp_id, const RsPeerDetails& dt ) { - if(sslId.isNull()) + constexpr auto fname = __PRETTY_FUNCTION__; + const auto failure = [&](const std::string& err) { - RsErr() << __PRETTY_FUNCTION__ << " Cannot add a null " - << "ID as SSL-only friend " << std::endl; + RsErr() << fname << " " << err << std::endl; return false; - } + }; + + if(sslId.isNull()) + return failure("Cannot add a null ID as SSL-only friend"); if(pgp_id.isNull()) - { - RsErr() << __PRETTY_FUNCTION__ << " Cannot add as SSL-only friend a " - << "peer with null PGP" << std::endl; - return false; - } + return failure( " Cannot add as SSL-only friend a peer with null PGP"); if(sslId == getOwnId()) - { - RsErr() << __PRETTY_FUNCTION__ << " Cannot add yourself as SSL-only " - << "friend (id=" << sslId << ")" << std::endl; - return false; - } + return failure( "Cannot add yourself as SSL-only friend id:" + + sslId.toStdString() ); bool alreadySslFriend = false; peerState pstate; @@ -1116,13 +1112,10 @@ bool p3PeerMgrIMPL::addSslOnlyFriend( * PGP id we already know, to avoid nasty tricks with malevolently forged * short invites.*/ if(alreadySslFriend && pstate.gpg_id != pgp_id) - { - RsErr() << __PRETTY_FUNCTION__ << " Cannot SSL-only friend for " - << "a pre-existing friend with mismatching PGP-id " - << "known: " << pstate.gpg_id << " new: " << pgp_id - << std::endl; - return false; - } + return failure( "Cannot SSL-only friend for a pre-existing friend with " + "mismatching PGP-id known: " + + pstate.gpg_id.toStdString() + " new: " + + pgp_id.toStdString() ); /* It is very important to be expecially carefull setting * pstate.skip_pgp_signature_validation to true because this effectively @@ -1137,8 +1130,11 @@ bool p3PeerMgrIMPL::addSslOnlyFriend( * connection closed. * Instead if pstate.skip_pgp_signature_validation would have been * superficially set to true the PGP signature verification would have been - * skipped and the attacker connection would be accepted. */ - if(!AuthGPG::getAuthGPG()->isPgpPubKeyAvailable(pgp_id)) + * skipped and the attacker connection would be accepted. + * If the PGP key is available add it as full friend. */ + if(AuthGPG::getAuthGPG()->isPgpPubKeyAvailable(pgp_id)) + AuthGPG::getAuthGPG()->AllowConnection(pgp_id, true); + else pstate.skip_pgp_signature_validation = true; pstate.gpg_id = pgp_id; From 55d26b400b1fbda6cc4b8cf2af88fec7b485c5f0 Mon Sep 17 00:00:00 2001 From: defnax Date: Wed, 9 Oct 2019 19:26:43 +0200 Subject: [PATCH 4/6] added Comment button to Comment Dialog added comment button to CommentDialog --- .../src/gui/gxs/GxsCommentDialog.cpp | 2 ++ .../src/gui/gxs/GxsCommentDialog.ui | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp b/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp index 57fc7031b..f9b8b1dbc 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp @@ -19,6 +19,7 @@ *******************************************************************************/ #include "gui/gxs/GxsCommentDialog.h" +#include "gui/gxs/GxsCommentTreeWidget.h" #include "ui_GxsCommentDialog.h" #include @@ -50,6 +51,7 @@ GxsCommentDialog::GxsCommentDialog(QWidget *parent, RsTokenService *token_servic connect(ui->idChooser, SIGNAL(currentIndexChanged( int )), this, SLOT(voterSelectionChanged( int ))); connect(ui->idChooser, SIGNAL(idsLoaded()), this, SLOT(idChooserReady())); + connect(ui->commentButton, SIGNAL(clicked()), ui->treeWidget, SLOT(makeComment())); connect(ui->sortBox, SIGNAL(currentIndexChanged(int)), this, SLOT(sortComments(int))); // default sort method "HOT". diff --git a/retroshare-gui/src/gui/gxs/GxsCommentDialog.ui b/retroshare-gui/src/gui/gxs/GxsCommentDialog.ui index 6bf6b1112..c349c6eb7 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentDialog.ui +++ b/retroshare-gui/src/gui/gxs/GxsCommentDialog.ui @@ -40,6 +40,32 @@ + + + + + 0 + 0 + + + + Comment + + + + :/icons/png/comment.png:/icons/png/comment.png + + + + 20 + 20 + + + + Qt::ToolButtonTextBesideIcon + + + From db06e6e87f4fd051cb56c33e75c9eb08ea0474a9 Mon Sep 17 00:00:00 2001 From: defnax Date: Fri, 11 Oct 2019 12:26:00 +0200 Subject: [PATCH 5/6] fix retroshare ipc Patch by Cy It fixes a bug, where the IPC client process sets up the shared memory, then immediately deletes the shared memory, then notifies the main GUI that the shared memory has been set up. Then the main GUI reports an error because there is no shared memory, and can't open the link that used to be in the now deleted shared memory. So basically "$ retroshare retroshare://..." does nothing, even if the main GUI is running. At least that's what was happening for me. --- retroshare-gui/src/rshare.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/retroshare-gui/src/rshare.cpp b/retroshare-gui/src/rshare.cpp index 872273613..3898a899a 100644 --- a/retroshare-gui/src/rshare.cpp +++ b/retroshare-gui/src/rshare.cpp @@ -241,6 +241,11 @@ Rshare::Rshare(QStringList args, int &argc, char **argv, const QString &dir) localServer= new QLocalServer(); QObject::connect(localServer, SIGNAL(newConnection()), this, SLOT(slotConnectionEstablished())); updateLocalServer(); + // clear out any old arguments (race condition?) + QSharedMemory newArgs; + newArgs.setKey(QString(TARGET) + "_newArgs"); + if(newArgs.attach(QSharedMemory::ReadWrite)) + newArgs.detach(); } } @@ -325,20 +330,27 @@ Rshare::~Rshare() */ void Rshare::slotConnectionEstablished() { - QLocalSocket *socket = localServer->nextPendingConnection(); - socket->close(); - delete socket; - QSharedMemory newArgs; newArgs.setKey(QString(TARGET) + "_newArgs"); + QLocalSocket *socket = localServer->nextPendingConnection(); + if (!newArgs.attach()) { - std::cerr << "(EE) Rshare::slotConnectionEstablished() Unable to attach to shared memory segment." - << newArgs.errorString().toStdString() << std::endl; + /* this is not an error. It just means we were notified to check + newArgs, but none had been set yet. + TODO: implement separate ping/take messages + std::cerr << "(EE) Rshare::slotConnectionEstablished() Unable to attach to shared memory segment." + << newArgs.errorString().toStdString() << std::endl; + */ + socket->close(); + delete socket; return; } + socket->close(); + delete socket; + QBuffer buffer; QDataStream in(&buffer); QStringList args; From 9a616fd0dd19e6a296f68af7db75e866739f128d Mon Sep 17 00:00:00 2001 From: defnax Date: Fri, 11 Oct 2019 17:34:17 +0200 Subject: [PATCH 6/6] Display the lobby name on the rs link Display the lobby name on the rs link --- retroshare-gui/src/gui/Identity/IdDialog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index d5b6b799b..5d8c45804 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -2019,7 +2019,9 @@ QString IdDialog::createUsageString(const RsIdentityUsage& u) const case RsIdentityUsage::CHAT_LOBBY_MSG_VALIDATION: // Chat lobby msgs are signed, so each time one comes, or a chat lobby event comes, a signature verificaiton happens. { ChatId id = ChatId(ChatLobbyId(u.mAdditionalId)); - RetroShareLink l = RetroShareLink::createChatRoom(id, QString::fromStdString(id.toStdString())); + ChatLobbyInfo linfo ; + rsMsgs->getChatLobbyInfo(ChatLobbyId(u.mAdditionalId),linfo); + RetroShareLink l = RetroShareLink::createChatRoom(id, QString::fromUtf8(linfo.lobby_name.c_str())); return tr("Message in chat room %1").arg(l.toHtml()) ; } case RsIdentityUsage::GLOBAL_ROUTER_SIGNATURE_CHECK: // Global router message validation