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

@ -94,12 +94,13 @@
#define CERTIFICATE_GPG_CHECKSUM "gpgchecksum"
#define CERTIFICATE_LOCATION "location"
#define CERTIFICATE_NAME "name"
#define CERTIFICATE_EXT_IPPORT "extipp"
#define CERTIFICATE_LOC_IPPORT "locipp"
#define CERTIFICATE_DYNDNS "dyndns"
#define PRIVATE_CHAT_TIME_STAMP "time_stamp"
#define PRIVATE_CHAT_STRING "encrypted_data"
#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"
#define PRIVATE_CHAT_GPG_ID "gpgid"
#define PUBLIC_MSG_TIME_STAMP "time_stamp"
@ -294,12 +295,13 @@ void RetroShareLink::fromUrl(const QUrl& url)
if (url.host() == HOST_CERTIFICATE) {
_type = TYPE_CERTIFICATE;
_SSLid = urlQuery.queryItemValue(CERTIFICATE_SSLID);
_name = urlQuery.queryItemValue(CERTIFICATE_NAME);
_location = urlQuery.queryItemValue(CERTIFICATE_LOCATION);
_GPGBase64String = urlQuery.queryItemValue(CERTIFICATE_GPG_BASE64);
_GPGid = urlQuery.queryItemValue(CERTIFICATE_GPG_ID);
_GPGBase64CheckSum = urlQuery.queryItemValue(CERTIFICATE_GPG_CHECKSUM);
_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);
_ext_ip_port = urlQuery.queryItemValue(CERTIFICATE_EXT_IPPORT);
_loc_ip_port = urlQuery.queryItemValue(CERTIFICATE_LOC_IPPORT);
_dyndns_name = urlQuery.queryItemValue(CERTIFICATE_DYNDNS);
@ -427,21 +429,24 @@ bool RetroShareLink::createCertificate(const RsPeerId& ssl_id)
// _ext_ip_port.clear();
// _loc_ip_port.clear();
// }
// else
// {
_SSLid = QString::fromStdString(ssl_id.toStdString()) ;
_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) + ";" ;
// 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) + ";" ;
_dyndns_name = QString::fromStdString(detail.dyndns);
//}
_name = QString::fromUtf8(detail.name.c_str()) ;
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 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;
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;
std::cerr << "Found External IP+Port = " << _ext_ip_port.toStdString() << std::endl;
std::cerr << "Found Location = " << _location.toStdString() << std::endl;
std::cerr << "Found DNS = " << _dyndns_name.toStdString() << std::endl;
@ -864,12 +869,13 @@ QString RetroShareLink::toString() const
urlQuery.addQueryItem(CERTIFICATE_GPG_ID, _GPGid);
urlQuery.addQueryItem(CERTIFICATE_GPG_BASE64, _GPGBase64String);
urlQuery.addQueryItem(CERTIFICATE_GPG_CHECKSUM, _GPGBase64CheckSum);
if (!_location.isEmpty()) {
urlQuery.addQueryItem(CERTIFICATE_LOCATION, encodeItem(_location));
}
urlQuery.addQueryItem(CERTIFICATE_NAME, encodeItem(_name));
if (!_loc_ip_port.isEmpty()) {
urlQuery.addQueryItem(CERTIFICATE_LOC_IPPORT, encodeItem(_loc_ip_port));
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));
}
if (!_ext_ip_port.isEmpty()) {
urlQuery.addQueryItem(CERTIFICATE_EXT_IPPORT, encodeItem(_ext_ip_port));
@ -1207,42 +1213,44 @@ static void processList(const QStringList &list, const QString &textSingular, co
{
#ifdef DEBUG_RSLINK
std::cerr << " RetroShareLink::process certificate." << std::endl;
#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 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" ;
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;
ConnectFriendWizard connectFriendWizard;
connectFriendWizard.setCertificate(RS_Certificate, (link.subType() == RSLINK_SUBTYPE_CERTIFICATE_USER_REQUEST) ? true : false);
connectFriendWizard.exec();
needNotifySuccess = false;
}
#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 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" ;
//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 << link.radix().toStdString() << std::endl;
ConnectFriendWizard connectFriendWizard;
// 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;
}
break ;
case TYPE_PUBLIC_MSG:

View File

@ -99,12 +99,13 @@ class RetroShareLink
const QString& SSLId() const { return _SSLid ; }
const QString& GPGId() const { return _GPGid ; }
const QString& localIPAndPort() const { return _loc_ip_port ; }
const QString& externalIPAndPort() const { return _ext_ip_port ; }
const QString& dyndns() const { return _dyndns_name ; }
const QString& location() const { return _location ; }
time_t timeStamp() const { return _time_stamp ; }
const QString& encryptedPrivateChatInfo() const { return _encrypted_chat_info ; }
QString title() const;
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;
unsigned int subType() const { return _subType; }
void setSubType(unsigned int subType) { _subType = subType; }
@ -156,12 +157,13 @@ class RetroShareLink
QString _GPGBase64String ; // GPG Cert
QString _GPGBase64CheckSum ; // GPG Cert
QString _location ; // location
QString _ext_ip_port ;
QString _loc_ip_port ;
QString _dyndns_name ;
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.
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.
unsigned int _subType; // for general use as sub type for _type (RSLINK_SUBTYPE_...)
};