From 54c7f8b81a644f8cc3b75b6408557d55881642be Mon Sep 17 00:00:00 2001 From: joss17 Date: Wed, 13 Jan 2010 21:32:05 +0000 Subject: [PATCH] implement the remove friend for gpg key, and improve the tranfer of ip address from a dummy peer to a normal peer git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2024 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/authssl.cc | 14 +++++++----- libretroshare/src/rsserver/p3peers.cc | 7 +++++- retroshare-gui/src/gui/NetworkDialog.cpp | 8 +------ .../src/gui/connect/ConfCertDialog.cpp | 22 ++++++++++++++++++- .../src/gui/connect/ConfCertDialog.h | 2 ++ .../src/gui/connect/ConfCertDialog.ui | 2 +- 6 files changed, 40 insertions(+), 15 deletions(-) diff --git a/libretroshare/src/pqi/authssl.cc b/libretroshare/src/pqi/authssl.cc index d4e9567c8..c7cfd0469 100644 --- a/libretroshare/src/pqi/authssl.cc +++ b/libretroshare/src/pqi/authssl.cc @@ -2186,13 +2186,9 @@ int AuthSSL::VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx) std::string certId; getX509id(X509_STORE_CTX_get_current_cert(ctx), certId); if (!mConnMgr->isFriend(certId)) { - //we've got a new ssl id, let's add it as a friend - mConnMgr->addFriend(certId, getX509CNString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->issuer)); + //we've got a new ssl id preverify_ok = false; } - //set location - mConnMgr->setLocation(certId, getX509LocString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->subject)); - //is the connection was initiated by us, then it was for a specific peer id wich is stored is in the context //check that the peerid in the context is the same as the cert one @@ -2207,12 +2203,20 @@ int AuthSSL::VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx) //tranfer the ip address to the new peer peerConnectState detail; if (mConnMgr->getFriendNetStatus(peer_id_in_context, detail)) { + mConnMgr->addFriend(certId, getX509CNString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->issuer)); mConnMgr->setAddressList(certId, detail.getIpAddressList()); } } else { fprintf(stderr, "AuthSSL::VerifyX509Callback peer id in context is the same as cert, continung connection."); } } + + //just to be sure + mConnMgr->addFriend(certId, getX509CNString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->issuer)); + + //set location + mConnMgr->setLocation(certId, getX509LocString(X509_STORE_CTX_get_current_cert(ctx)->cert_info->subject)); + } if (preverify_ok) { diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc index bc9bfd8df..b1d1b993a 100644 --- a/libretroshare/src/rsserver/p3peers.cc +++ b/libretroshare/src/rsserver/p3peers.cc @@ -621,8 +621,13 @@ bool p3Peers::removeFriend(std::string id) std::cerr << "p3Peers::removeFriend() " << id; std::cerr << std::endl; #endif + //will remove if it's a gpg id + AuthGPG::getAuthGPG()->setAcceptToConnectGPGCertificate(id, false); + + //will remove if it's a ssl id + mConnMgr->removeFriend(id); + return true; - return mConnMgr->removeFriend(id); } /* Network Stuff */ diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp index 2d3fd3e36..c58e4d42a 100644 --- a/retroshare-gui/src/gui/NetworkDialog.cpp +++ b/retroshare-gui/src/gui/NetworkDialog.cpp @@ -257,13 +257,7 @@ void NetworkDialog::deleteCert() void NetworkDialog::makeFriend() { - QTreeWidgetItem *wi = getCurrentNeighbour(); - std::string authId = wi->text(4).toStdString() ; - - rsPeers->signGPGCertificate(authId); - rsPeers->addDummyFriend(authId); - - insertConnect() ; + ConfCertDialog::showTrust(getCurrentNeighbour()->text(4).toStdString()); } /** Shows Peer Information/Auth Dialog */ diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp index d24f47c8d..994dd8a8b 100644 --- a/retroshare-gui/src/gui/connect/ConfCertDialog.cpp +++ b/retroshare-gui/src/gui/connect/ConfCertDialog.cpp @@ -58,7 +58,15 @@ void ConfCertDialog::show(const std::string& peer_id) /* set the Id */ instance()->loadId(peer_id); - instance()->show(); + instance()->show(); +} + +void ConfCertDialog::showTrust(const std::string& peer_id) +{ + /* set the Id */ + + instance()->loadId(peer_id); + instance()->showTrust(); } @@ -69,6 +77,18 @@ void ConfCertDialog::show() { //loadSettings(); + ui.stabWidget->setCurrentIndex(0); + if(!this->isVisible()) { + QDialog::show(); + + } +} + +void +ConfCertDialog::showTrust() +{ + //loadSettings(); + ui.stabWidget->setCurrentIndex(1); if(!this->isVisible()) { QDialog::show(); diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.h b/retroshare-gui/src/gui/connect/ConfCertDialog.h index c4330f675..059c94bbf 100644 --- a/retroshare-gui/src/gui/connect/ConfCertDialog.h +++ b/retroshare-gui/src/gui/connect/ConfCertDialog.h @@ -33,6 +33,7 @@ class ConfCertDialog : public QDialog public: static void show(const std::string& id) ; + static void showTrust(const std::string& id) ; static ConfCertDialog *instance() ; signals: @@ -58,6 +59,7 @@ void setInfo(std::string name, private slots: /** Overloaded QWidget.show */ void show(); + void showTrust(); protected: void closeEvent (QCloseEvent * event); diff --git a/retroshare-gui/src/gui/connect/ConfCertDialog.ui b/retroshare-gui/src/gui/connect/ConfCertDialog.ui index 1e07bfffd..6c5101ba0 100644 --- a/retroshare-gui/src/gui/connect/ConfCertDialog.ui +++ b/retroshare-gui/src/gui/connect/ConfCertDialog.ui @@ -21,7 +21,7 @@ - 1 + 0