mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
Remove PGP fingerprint from broadcast discovery
Sending PGP fingerprint trough broadcast discovery is misleading in terms of security, as those packets cannot be trusted for PGP fingerprint verification, removing it reduce packet size and reduce the risc of wrong usage of untrusted information
This commit is contained in:
parent
427503df0d
commit
f2fb0d7cfc
@ -46,19 +46,17 @@ extern std::shared_ptr<RsBroadcastDiscovery> rsBroadcastDiscovery;
|
|||||||
|
|
||||||
struct RsBroadcastDiscoveryResult : RsSerializable
|
struct RsBroadcastDiscoveryResult : RsSerializable
|
||||||
{
|
{
|
||||||
PGPFingerprintType mPgpFingerprint;
|
|
||||||
RsPeerId mSslId;
|
RsPeerId mSslId;
|
||||||
std::string mProfileName;
|
std::string mProfileName;
|
||||||
RsUrl locator;
|
RsUrl mLocator;
|
||||||
|
|
||||||
/// @see RsSerializable
|
/// @see RsSerializable
|
||||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||||
RsGenericSerializer::SerializeContext& ctx) override
|
RsGenericSerializer::SerializeContext& ctx) override
|
||||||
{
|
{
|
||||||
RS_SERIAL_PROCESS(mPgpFingerprint);
|
|
||||||
RS_SERIAL_PROCESS(mSslId);
|
RS_SERIAL_PROCESS(mSslId);
|
||||||
RS_SERIAL_PROCESS(mProfileName);
|
RS_SERIAL_PROCESS(mProfileName);
|
||||||
RS_SERIAL_PROCESS(locator);
|
RS_SERIAL_PROCESS(mLocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
RsBroadcastDiscoveryResult() = default;
|
RsBroadcastDiscoveryResult() = default;
|
||||||
|
@ -40,7 +40,6 @@ struct BroadcastDiscoveryPack : RsSerializable
|
|||||||
{
|
{
|
||||||
BroadcastDiscoveryPack() : mLocalPort(0) {}
|
BroadcastDiscoveryPack() : mLocalPort(0) {}
|
||||||
|
|
||||||
RsPgpFingerprint mPgpFingerprint;
|
|
||||||
RsPeerId mSslId;
|
RsPeerId mSslId;
|
||||||
uint16_t mLocalPort;
|
uint16_t mLocalPort;
|
||||||
std::string mProfileName;
|
std::string mProfileName;
|
||||||
@ -48,7 +47,6 @@ struct BroadcastDiscoveryPack : RsSerializable
|
|||||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||||
RsGenericSerializer::SerializeContext& ctx ) override
|
RsGenericSerializer::SerializeContext& ctx ) override
|
||||||
{
|
{
|
||||||
RS_SERIAL_PROCESS(mPgpFingerprint);
|
|
||||||
RS_SERIAL_PROCESS(mSslId);
|
RS_SERIAL_PROCESS(mSslId);
|
||||||
RS_SERIAL_PROCESS(mLocalPort);
|
RS_SERIAL_PROCESS(mLocalPort);
|
||||||
RS_SERIAL_PROCESS(mProfileName);
|
RS_SERIAL_PROCESS(mProfileName);
|
||||||
@ -57,7 +55,6 @@ struct BroadcastDiscoveryPack : RsSerializable
|
|||||||
static BroadcastDiscoveryPack fromPeerDetails(const RsPeerDetails& pd)
|
static BroadcastDiscoveryPack fromPeerDetails(const RsPeerDetails& pd)
|
||||||
{
|
{
|
||||||
BroadcastDiscoveryPack bdp;
|
BroadcastDiscoveryPack bdp;
|
||||||
bdp.mPgpFingerprint = pd.fpr;
|
|
||||||
bdp.mSslId = pd.id;
|
bdp.mSslId = pd.id;
|
||||||
bdp.mLocalPort = pd.localPort;
|
bdp.mLocalPort = pd.localPort;
|
||||||
bdp.mProfileName = pd.name;
|
bdp.mProfileName = pd.name;
|
||||||
@ -163,12 +160,12 @@ void BroadcastDiscoveryService::data_tick()
|
|||||||
createResult(pp.first, pp.second);
|
createResult(pp.first, pp.second);
|
||||||
|
|
||||||
const bool isFriend = mRsPeers.isFriend(rbdr.mSslId);
|
const bool isFriend = mRsPeers.isFriend(rbdr.mSslId);
|
||||||
if( isFriend && rbdr.locator.hasPort() &&
|
if( isFriend && rbdr.mLocator.hasPort() &&
|
||||||
!mRsPeers.isOnline(rbdr.mSslId) )
|
!mRsPeers.isOnline(rbdr.mSslId) )
|
||||||
{
|
{
|
||||||
mRsPeers.setLocalAddress(
|
mRsPeers.setLocalAddress(
|
||||||
rbdr.mSslId, rbdr.locator.host(),
|
rbdr.mSslId, rbdr.mLocator.host(),
|
||||||
rbdr.locator.port() );
|
rbdr.mLocator.port() );
|
||||||
mRsPeers.connectAttempt(rbdr.mSslId);
|
mRsPeers.connectAttempt(rbdr.mSslId);
|
||||||
}
|
}
|
||||||
else if(!isFriend)
|
else if(!isFriend)
|
||||||
@ -199,10 +196,9 @@ RsBroadcastDiscoveryResult BroadcastDiscoveryService::createResult(
|
|||||||
BroadcastDiscoveryPack::fromSerializedString(uData);
|
BroadcastDiscoveryPack::fromSerializedString(uData);
|
||||||
|
|
||||||
RsBroadcastDiscoveryResult rbdr;
|
RsBroadcastDiscoveryResult rbdr;
|
||||||
rbdr.mPgpFingerprint = bdp.mPgpFingerprint;
|
|
||||||
rbdr.mSslId = bdp.mSslId;
|
rbdr.mSslId = bdp.mSslId;
|
||||||
rbdr.mProfileName = bdp.mProfileName;
|
rbdr.mProfileName = bdp.mProfileName;
|
||||||
rbdr.locator.
|
rbdr.mLocator.
|
||||||
setScheme("ipv4").
|
setScheme("ipv4").
|
||||||
setHost(UDC::IpToString(ipp.ip())).
|
setHost(UDC::IpToString(ipp.ip())).
|
||||||
setPort(bdp.mLocalPort);
|
setPort(bdp.mLocalPort);
|
||||||
|
Loading…
Reference in New Issue
Block a user