Added Patch thx to Phenom for the fix:

Make rework certificate link.(Paste my certificate link) and click by other. Fix_CertificateLink_v0.6_7312.patch

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7340 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2014-05-06 19:04:57 +00:00
parent bcb3dee381
commit 1f90872894
2 changed files with 88 additions and 78 deletions

View File

@ -97,6 +97,7 @@
#define CERTIFICATE_EXT_IPPORT "extipp"
#define CERTIFICATE_LOC_IPPORT "locipp"
#define CERTIFICATE_DYNDNS "dyndns"
#define CERTIFICATE_RADIX "radix"
#define PRIVATE_CHAT_TIME_STAMP "time_stamp"
#define PRIVATE_CHAT_STRING "encrypted_data"
@ -297,6 +298,7 @@ void RetroShareLink::fromUrl(const QUrl& url)
_SSLid = urlQuery.queryItemValue(CERTIFICATE_SSLID);
_name = urlQuery.queryItemValue(CERTIFICATE_NAME);
_location = urlQuery.queryItemValue(CERTIFICATE_LOCATION);
_radix = urlQuery.queryItemValue(CERTIFICATE_RADIX);
_GPGBase64String = urlQuery.queryItemValue(CERTIFICATE_GPG_BASE64);
_GPGid = urlQuery.queryItemValue(CERTIFICATE_GPG_ID);
_GPGBase64CheckSum = urlQuery.queryItemValue(CERTIFICATE_GPG_CHECKSUM);
@ -430,6 +432,8 @@ bool RetroShareLink::createCertificate(const RsPeerId& ssl_id)
// else
// {
_SSLid = QString::fromStdString(ssl_id.toStdString()) ;
_radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id,false).c_str());
_radix.replace("\n","");
_location = QString::fromUtf8(detail.location.c_str()) ;
_ext_ip_port = QString::fromStdString(detail.extAddr) + ":" + QString::number(detail.extPort) + ";" ;
_loc_ip_port = QString::fromStdString(detail.localAddr) + ":" + QString::number(detail.localPort) + ";" ;
@ -439,6 +443,7 @@ bool RetroShareLink::createCertificate(const RsPeerId& ssl_id)
std::cerr << "Found gpg base 64 string = " << _GPGBase64String.toStdString() << std::endl;
std::cerr << "Found gpg base 64 checksum = " << _GPGBase64CheckSum.toStdString() << std::endl;
std::cerr << "Found radix = " << _radix.toStdString() << std::endl;
std::cerr << "Found SSLId = " << _SSLid.toStdString() << std::endl;
std::cerr << "Found GPGId = " << _GPGid.toStdString() << std::endl;
std::cerr << "Found Local IP+Port = " << _loc_ip_port.toStdString() << std::endl;
@ -867,6 +872,7 @@ QString RetroShareLink::toString() const
if (!_location.isEmpty()) {
urlQuery.addQueryItem(CERTIFICATE_LOCATION, encodeItem(_location));
}
urlQuery.addQueryItem(CERTIFICATE_RADIX, _radix);
urlQuery.addQueryItem(CERTIFICATE_NAME, encodeItem(_name));
if (!_loc_ip_port.isEmpty()) {
urlQuery.addQueryItem(CERTIFICATE_LOC_IPPORT, encodeItem(_loc_ip_port));
@ -1210,36 +1216,38 @@ static void processList(const QStringList &list, const QString &textSingular, co
#endif
needNotifySuccess = true;
QString RS_Certificate ;
RS_Certificate += "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" ;
RS_Certificate += "Version: Retroshare Generated cert.\n" ;
RS_Certificate += "\n" ;
//QString RS_Certificate ;
//RS_Certificate += "-----BEGIN PGP PUBLIC KEY BLOCK-----\n" ;
//RS_Certificate += "Version: Retroshare Generated cert.\n" ;
//RS_Certificate += "\n" ;
QString radix = link.GPGRadix64Key() ;
//QString radix = link.GPGRadix64Key() ;
while(radix.size() > 64)
{
RS_Certificate += radix.left(64) + "\n" ;
radix = radix.right(radix.size() - 64) ;
}
RS_Certificate += radix.left(64) + "\n" ;
RS_Certificate += "=" + link.GPGBase64CheckSum() + "\n" ;
RS_Certificate += "-----END PGP PUBLIC KEY BLOCK-----\n" ;
RS_Certificate += "--SSLID--" + link.SSLId() + ";--LOCATION--" + link.location() + ";\n" ;
//while(radix.size() > 64)
//{
// RS_Certificate += radix.left(64) + "\n" ;
// radix = radix.right(radix.size() - 64) ;
//}
//RS_Certificate += radix.left(64) + "\n" ;
//RS_Certificate += "=" + link.GPGBase64CheckSum() + "\n" ;
//RS_Certificate += "-----END PGP PUBLIC KEY BLOCK-----\n" ;
//RS_Certificate += "--SSLID--" + link.SSLId() + ";--LOCATION--" + link.location() + ";\n" ;
if(!link.externalIPAndPort().isNull())
RS_Certificate += "--EXT--" + link.externalIPAndPort() + ";" ;
if(!link.localIPAndPort().isNull())
RS_Certificate += "--LOCAL--" + link.localIPAndPort() + ";" ;
if(!link.dyndns().isNull())
RS_Certificate += "--DYNDNS--" + link.dyndns() + ";" ;
RS_Certificate += "\n" ;
//if(!link.externalIPAndPort().isNull())
// RS_Certificate += "--EXT--" + link.externalIPAndPort() + ";" ;
//if(!link.localIPAndPort().isNull())
// RS_Certificate += "--LOCAL--" + link.localIPAndPort() + ";" ;
//if(!link.dyndns().isNull())
// RS_Certificate += "--DYNDNS--" + link.dyndns() + ";" ;
//RS_Certificate += "\n" ;
std::cerr << "Usign this certificate:" << std::endl;
std::cerr << RS_Certificate.toStdString() << std::endl;
//std::cerr << RS_Certificate.toStdString() << std::endl;
std::cerr << link.radix().toStdString() << std::endl;
ConnectFriendWizard connectFriendWizard;
connectFriendWizard.setCertificate(RS_Certificate, (link.subType() == RSLINK_SUBTYPE_CERTIFICATE_USER_REQUEST) ? true : false);
// connectFriendWizard.setCertificate(RS_Certificate, (link.subType() == RSLINK_SUBTYPE_CERTIFICATE_USER_REQUEST) ? true : false);
connectFriendWizard.setCertificate(link.radix(), (link.subType() == RSLINK_SUBTYPE_CERTIFICATE_USER_REQUEST) ? true : false);
connectFriendWizard.exec();
needNotifySuccess = false;
}

View File

@ -102,6 +102,7 @@ class RetroShareLink
const QString& externalIPAndPort() const { return _ext_ip_port ; }
const QString& dyndns() const { return _dyndns_name ; }
const QString& location() const { return _location ; }
const QString& radix() const { return _radix ; }
time_t timeStamp() const { return _time_stamp ; }
const QString& encryptedPrivateChatInfo() const { return _encrypted_chat_info ; }
QString title() const;
@ -159,6 +160,7 @@ class RetroShareLink
QString _ext_ip_port ;
QString _loc_ip_port ;
QString _dyndns_name ;
QString _radix ;
QString _encrypted_chat_info ; // encrypted data string for the recipient of a chat invite
time_t _time_stamp ; // time stamp at which the link will expire.