mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 16:39:29 -05:00
fixed accepting connection attempts from unknown peers using short invite system
This commit is contained in:
parent
536c0852d4
commit
8d121a1038
File diff suppressed because it is too large
Load Diff
@ -56,7 +56,7 @@ class RsFeedItem;
|
|||||||
class FeedNotify;
|
class FeedNotify;
|
||||||
class FeedItem;
|
class FeedItem;
|
||||||
|
|
||||||
class NewsFeed : public RsAutoUpdatePage, public FeedHolder
|
class NewsFeed : public MainPage,public FeedHolder
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -81,8 +81,6 @@ public:
|
|||||||
static void testFeeds(uint notifyFlags);
|
static void testFeeds(uint notifyFlags);
|
||||||
static void testFeed(FeedNotify *feedNotify);
|
static void testFeed(FeedNotify *feedNotify);
|
||||||
|
|
||||||
virtual void updateDisplay();
|
|
||||||
|
|
||||||
void handleEvent(std::shared_ptr<const RsEvent> event); // get events from libretroshare
|
void handleEvent(std::shared_ptr<const RsEvent> event); // get events from libretroshare
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -91,9 +89,6 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
void processSettings(bool load);
|
void processSettings(bool load);
|
||||||
|
|
||||||
/* TokenResponse */
|
|
||||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void feedoptions();
|
void feedoptions();
|
||||||
void sortChanged(int index);
|
void sortChanged(int index);
|
||||||
@ -119,10 +114,6 @@ private:
|
|||||||
void addFeedItemBlogMsg(const RsFeedItem &fi);
|
void addFeedItemBlogMsg(const RsFeedItem &fi);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// void addFeedItemChatNew(const RsFeedItem &fi, bool addWithoutCheck);
|
|
||||||
// void addFeedItemMessage(const RsFeedItem &fi);
|
|
||||||
// void addFeedItemFilesNew(const RsFeedItem &fi);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* UI - from Designer */
|
/* UI - from Designer */
|
||||||
Ui::NewsFeed *ui;
|
Ui::NewsFeed *ui;
|
||||||
|
@ -337,14 +337,38 @@ void ConnectFriendWizard::setCertificate(const QString &certificate, bool friend
|
|||||||
|
|
||||||
void ConnectFriendWizard::setGpgId(const RsPgpId &gpgId, const RsPeerId &sslId, bool friendRequest)
|
void ConnectFriendWizard::setGpgId(const RsPgpId &gpgId, const RsPeerId &sslId, bool friendRequest)
|
||||||
{
|
{
|
||||||
if (!rsPeers->getGPGDetails(gpgId, peerDetails)) {
|
if(sslId == rsPeers->getOwnId())
|
||||||
setField("errorMessage", tr("Cannot get peer details of PGP key %1").arg(QString::fromStdString(gpgId.toStdString())));
|
{
|
||||||
|
setField("errorMessage", tr("This is your own certificate! You would not want to make friend with yourself. Wouldn't you?") ) ;
|
||||||
setStartId(Page_ErrorMessage);
|
setStartId(Page_ErrorMessage);
|
||||||
return;
|
error = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!rsPeers->getGPGDetails(gpgId, peerDetails))
|
||||||
|
{
|
||||||
|
mIsShortInvite = true;
|
||||||
|
|
||||||
|
peerDetails.id = sslId;
|
||||||
|
peerDetails.gpg_id = gpgId;
|
||||||
|
peerDetails.skip_pgp_signature_validation = true;
|
||||||
|
|
||||||
|
mCertificate.clear();
|
||||||
|
|
||||||
|
setStartId(Page_Conclusion);
|
||||||
|
|
||||||
|
if (friendRequest){
|
||||||
|
ui->cp_Label->show();
|
||||||
|
ui->requestinfolabel->show();
|
||||||
|
setTitleText(ui->ConclusionPage, tr("Friend request"));
|
||||||
|
ui->ConclusionPage->setSubTitle(tr("Details about the request"));
|
||||||
|
setButtonText(QWizard::FinishButton , tr("Accept"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* Set ssl id when available */
|
/* Set ssl id when available */
|
||||||
peerDetails.id = sslId;
|
peerDetails.id = sslId;
|
||||||
|
mIsShortInvite = false;
|
||||||
|
|
||||||
//setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion);
|
//setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion);
|
||||||
setStartId(Page_Conclusion);
|
setStartId(Page_Conclusion);
|
||||||
@ -355,6 +379,7 @@ void ConnectFriendWizard::setGpgId(const RsPgpId &gpgId, const RsPeerId &sslId,
|
|||||||
ui->ConclusionPage->setSubTitle(tr("Details about the request"));
|
ui->ConclusionPage->setSubTitle(tr("Details about the request"));
|
||||||
setButtonText(QWizard::FinishButton , tr("Accept"));
|
setButtonText(QWizard::FinishButton , tr("Accept"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectFriendWizard::~ConnectFriendWizard()
|
ConnectFriendWizard::~ConnectFriendWizard()
|
||||||
@ -507,7 +532,7 @@ void ConnectFriendWizard::initializePage(int id)
|
|||||||
ui->cp_Label->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str()));
|
ui->cp_Label->setText(tr("You have a friend request from") + " " + QString::fromUtf8(peerDetails.name.c_str()));
|
||||||
ui->nameEdit->setText(QString::fromUtf8(peerDetails.name.c_str()));
|
ui->nameEdit->setText(QString::fromUtf8(peerDetails.name.c_str()));
|
||||||
ui->trustEdit->setText(trustString);
|
ui->trustEdit->setText(trustString);
|
||||||
ui->emailEdit->setText(QString::fromUtf8(peerDetails.email.c_str()));
|
ui->profileIdEdit->setText(QString::fromStdString(peerDetails.gpg_id.toStdString()));
|
||||||
QString loc = QString::fromUtf8(peerDetails.location.c_str());
|
QString loc = QString::fromUtf8(peerDetails.location.c_str());
|
||||||
if (!loc.isEmpty())
|
if (!loc.isEmpty())
|
||||||
{
|
{
|
||||||
@ -540,12 +565,19 @@ void ConnectFriendWizard::initializePage(int id)
|
|||||||
ui->ipLabel->setPixmap(QPixmap(":/images/anonymous_128_blue.png").scaledToHeight(S*2,Qt::SmoothTransformation));
|
ui->ipLabel->setPixmap(QPixmap(":/images/anonymous_128_blue.png").scaledToHeight(S*2,Qt::SmoothTransformation));
|
||||||
ui->ipLabel->setToolTip("This is a Hidden node - you need tor/i2p proxy to connect");
|
ui->ipLabel->setToolTip("This is a Hidden node - you need tor/i2p proxy to connect");
|
||||||
}
|
}
|
||||||
|
if(mIsShortInvite)
|
||||||
if(peerDetails.email.empty())
|
|
||||||
{
|
{
|
||||||
ui->emailLabel->hide(); // is it ever used?
|
ui->nameEdit->setText(tr("[Unknown]"));
|
||||||
ui->emailEdit->hide();
|
ui->addKeyToKeyring_CB->setChecked(false);
|
||||||
|
ui->addKeyToKeyring_CB->setEnabled(false);
|
||||||
|
ui->signersEdit->hide();
|
||||||
|
ui->signersLabel->hide();
|
||||||
|
ui->signGPGCheckBox->setChecked(false);
|
||||||
|
ui->signGPGCheckBox->setEnabled(false);
|
||||||
|
ui->acceptNoSignGPGCheckBox->setChecked(true);
|
||||||
|
ui->acceptNoSignGPGCheckBox->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->ipEdit->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
ui->ipEdit->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>1139</width>
|
||||||
<height>437</height>
|
<height>1171</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -480,14 +480,14 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="emailLabel">
|
<widget class="QLabel" name="profileIdLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Email:</string>
|
<string>Profile ID:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="emailEdit">
|
<widget class="QLabel" name="profileIdEdit">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string notr="true">Email</string>
|
<string notr="true">Email</string>
|
||||||
</property>
|
</property>
|
||||||
@ -794,8 +794,8 @@
|
|||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../icons.qrc"/>
|
<include location="../icons.qrc"/>
|
||||||
|
<include location="../images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -174,29 +174,34 @@ void SecurityItem::updateItem()
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!RsAutoUpdatePage::eventsLocked()) {
|
if(!RsAutoUpdatePage::eventsLocked())
|
||||||
RsPeerDetails details;
|
|
||||||
/* first try sslid */
|
|
||||||
if (!rsPeers->getPeerDetails(mSslId, details))
|
|
||||||
{
|
{
|
||||||
/* then gpgid */
|
RsPeerDetails details;
|
||||||
if(!rsPeers->getGPGDetails(mGpgId, details))
|
/* first try sslid */;
|
||||||
|
if (!rsPeers->getPeerDetails(mSslId, details) && !rsPeers->getGPGDetails(mGpgId, details))
|
||||||
{
|
{
|
||||||
/* it is very likely that we will end up here for some of the
|
/* it is very likely that we will end up here for some of the
|
||||||
* Unknown peer cases.... so allow them here
|
* Unknown peer cases.... so allow them here
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* set peer name */
|
/* set peer name */
|
||||||
peerNameLabel->setText(QString("%1 (%2)").arg(tr("Unknown Peer"), QString::fromUtf8(mSslCn.c_str())));
|
peerNameLabel->setText(tr("A unknown peer"));
|
||||||
|
|
||||||
nameLabel->setText(QString::fromUtf8(mSslCn.c_str()) + " (" + QString::fromStdString(mGpgId.toStdString()) + ")");
|
nameLabel->setText(tr("Unknown") + " (" + tr("Profile ID: ") + QString::fromStdString(mGpgId.toStdString()) + ")");
|
||||||
idLabel->setText(QString::fromStdString(mSslId.toStdString()));
|
idLabel->setText(QString::fromStdString(mSslId.toStdString()));
|
||||||
|
|
||||||
statusLabel->setText(tr("Unknown Peer"));
|
statusLabel->hide();
|
||||||
trustLabel->setText(tr("Unknown Peer"));
|
typeLabel->hide();
|
||||||
locLabel->setText(tr("Unknown Peer"));
|
|
||||||
ipLabel->setText(QString::fromStdString(mIP)) ; //tr("Unknown Peer"));
|
trustLabel->hide();
|
||||||
connLabel->setText(tr("Unknown Peer"));
|
trustLeftLabel->hide();
|
||||||
|
|
||||||
|
locLabel->hide();
|
||||||
|
locLeftLabel->hide();
|
||||||
|
|
||||||
|
ipLabel->setText(QString::fromStdString(mIP)) ;
|
||||||
|
connLabel->hide();
|
||||||
|
connLeftLabel->hide();
|
||||||
|
|
||||||
chatButton->hide();
|
chatButton->hide();
|
||||||
//quickmsgButton->hide();
|
//quickmsgButton->hide();
|
||||||
@ -206,9 +211,11 @@ void SecurityItem::updateItem()
|
|||||||
removeFriendButton->hide();
|
removeFriendButton->hide();
|
||||||
peerDetailsButton->setEnabled(false);
|
peerDetailsButton->setEnabled(false);
|
||||||
|
|
||||||
|
friendRequesttoolButton->show();
|
||||||
|
requestLabel->show();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* set peer name */
|
/* set peer name */
|
||||||
peerNameLabel->setText(QString::fromUtf8(details.name.c_str()));
|
peerNameLabel->setText(QString::fromUtf8(details.name.c_str()));
|
||||||
@ -344,6 +351,7 @@ void SecurityItem::friendRequest()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ConnectFriendWizard *connectFriendWizard = new ConnectFriendWizard;
|
ConnectFriendWizard *connectFriendWizard = new ConnectFriendWizard;
|
||||||
|
|
||||||
connectFriendWizard->setAttribute(Qt::WA_DeleteOnClose, true);
|
connectFriendWizard->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
connectFriendWizard->setGpgId(mGpgId, mSslId, true);
|
connectFriendWizard->setGpgId(mGpgId, mSslId, true);
|
||||||
connectFriendWizard->show();
|
connectFriendWizard->show();
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>763</width>
|
<width>1196</width>
|
||||||
<height>246</height>
|
<height>491</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout">
|
<layout class="QGridLayout">
|
||||||
@ -354,7 +354,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="nameLeftLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>75</weight>
|
<weight>75</weight>
|
||||||
@ -367,7 +367,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="idLeftLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>75</weight>
|
<weight>75</weight>
|
||||||
@ -380,7 +380,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="trustLeftLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -399,7 +399,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="locLeftLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>75</weight>
|
<weight>75</weight>
|
||||||
@ -412,7 +412,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QLabel" name="ipLeftLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>75</weight>
|
<weight>75</weight>
|
||||||
@ -425,7 +425,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_9">
|
<widget class="QLabel" name="connLeftLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>75</weight>
|
<weight>75</weight>
|
||||||
@ -578,8 +578,8 @@
|
|||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
|
||||||
<include location="../icons.qrc"/>
|
<include location="../icons.qrc"/>
|
||||||
|
<include location="../images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
Reference in New Issue
Block a user