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
This commit is contained in:
joss17 2010-01-13 21:32:05 +00:00
parent 018b84a1e1
commit 54c7f8b81a
6 changed files with 40 additions and 15 deletions

View File

@ -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) {

View File

@ -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 */

View File

@ -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 */

View File

@ -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();

View File

@ -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);

View File

@ -21,7 +21,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="stabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">