From 660d5d8e58defa9478a1e42901d3e12008a4ee7a Mon Sep 17 00:00:00 2001 From: chrisparker126 Date: Mon, 25 Apr 2011 09:58:19 +0000 Subject: [PATCH] attempt at fixing leak sources in channel messages git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4168 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/services/p3distrib.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libretroshare/src/services/p3distrib.cc b/libretroshare/src/services/p3distrib.cc index a03b5b9b0..d92ec1656 100644 --- a/libretroshare/src/services/p3distrib.cc +++ b/libretroshare/src/services/p3distrib.cc @@ -2004,6 +2004,9 @@ void p3GroupDistrib::locked_publishPendingMsgs() resave = true; } + // prevent sending original source of message to peers + (*it)->PeerId(mOwnId); + if(!store->SendItem(*it)) /* deletes it */ { ok &= false; @@ -2077,6 +2080,7 @@ void p3GroupDistrib::publishDistribGroups() std::string tmpname = out.str(); std::string filename = path + "/" + tmpname; std::string filenametmp = path + "/" + tmpname + ".tmp"; + std::string tempPeerId; // to store actual id temporarily BinInterface *bio = new BinFileInterface(filenametmp.c_str(), BIN_FLAGS_WRITEABLE | BIN_FLAGS_HASH_DATA); pqistore *store = createStore(bio, mOwnId, BIN_FLAGS_NO_DELETE | BIN_FLAGS_WRITEABLE); @@ -2102,7 +2106,10 @@ void p3GroupDistrib::publishDistribGroups() if (grp) { /* store in Cache File */ + tempPeerId = grp->PeerId(); + grp->PeerId(mOwnId); // prevent sending original source to users store->SendItem(grp); /* no delete */ + grp->PeerId(tempPeerId); grp->grpFlags &= (~RS_DISTRIB_UPDATE); // if this is an update, ensure flag is removed after publication }