From 60349baf9dd6a088b281df505a8668eff525632e Mon Sep 17 00:00:00 2001 From: drbob Date: Sun, 9 Aug 2009 13:06:24 +0000 Subject: [PATCH] * Fixed certificate saving bug. (authssl.cc) * added cert->issuer to external interface (rspeers.h) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1501 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/pqi/authssl.cc | 19 ++++++++++++++----- libretroshare/src/rsiface/rspeers.h | 2 ++ libretroshare/src/rsserver/p3peers.cc | 2 ++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/pqi/authssl.cc b/libretroshare/src/pqi/authssl.cc index 0f3106a5e..5eae87485 100644 --- a/libretroshare/src/pqi/authssl.cc +++ b/libretroshare/src/pqi/authssl.cc @@ -1632,6 +1632,10 @@ bool AuthSSL::ProcessX509(X509 *x509, std::string &id) if (!cert->authed) { cert->authed = valid; + + /* resave newly authed certificate */ + mToSaveCerts = true; + #ifdef AUTHSSL_DEBUG std::cerr << "AuthSSL::ProcessX509() "; std::cerr << "Updating Unauthed duplicate: "; @@ -2166,9 +2170,10 @@ std::string getX509AuthCode(X509 *x509) return out.str(); } -// other fns +// filename of certificate. (SSL Only) std::string getCertName(X509 *x509) { + std::string name = getX509NameString(x509->cert_info->subject); // strip out bad chars. for(int i = 0; i < (signed) name.length(); i++) @@ -2182,10 +2187,6 @@ std::string getCertName(X509 *x509) return name; } -#if 0 -#endif - - /********** SSL ERROR STUFF ******************************************/ int printSSLError(SSL *ssl, int retval, int err, unsigned long err2, @@ -2322,12 +2323,20 @@ bool AuthSSL::saveCertificates() { X509 *x509 = it->second->certificate; std::string hash; +#if PQI_SSLONLY std::string neighfile = neighdir + getCertName(x509) + ".pqi"; +#else + std::string neighfile = neighdir + (it->first) + ".pqi"; +#endif if (saveX509ToFile(x509, neighfile, hash)) { conftxt += "CERT "; +#if PQI_SSLONLY conftxt += getCertName(x509); +#else + conftxt += (it->first); +#endif conftxt += "\n"; conftxt += hash; conftxt += "\n"; diff --git a/libretroshare/src/rsiface/rspeers.h b/libretroshare/src/rsiface/rspeers.h index d8a9dd58c..ca7d5cf12 100644 --- a/libretroshare/src/rsiface/rspeers.h +++ b/libretroshare/src/rsiface/rspeers.h @@ -78,6 +78,8 @@ class RsPeerDetails std::string location; std::string org; + std::string issuer; + std::string fpr; /* pgp fingerprint */ std::string authcode; std::list signers; diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc index e3eb2dc83..8122fbc6a 100644 --- a/libretroshare/src/rsserver/p3peers.cc +++ b/libretroshare/src/rsserver/p3peers.cc @@ -302,6 +302,8 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d) d.org = authDetail.org; d.signers = authDetail.signers; + d.issuer = authDetail.issuer; + d.ownsign = authDetail.ownsign; d.trusted = authDetail.trusted;