From 80bf2f7a39ed0867872bed2426b05c62210657b6 Mon Sep 17 00:00:00 2001 From: drbob Date: Sun, 24 Mar 2013 19:21:30 +0000 Subject: [PATCH] Reviewed and corrected authenPolicies. Made authenPolicies + Identity mandatory for all services. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6279 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/gxs/rsgenexchange.h | 5 ++-- libretroshare/src/gxs/rsgixs.h | 4 +-- libretroshare/src/rsserver/rsinit.cc | 24 ++-------------- libretroshare/src/services/p3gxschannels.cc | 8 ++++-- libretroshare/src/services/p3gxscircles.cc | 30 +++++++------------- libretroshare/src/services/p3gxsforums.cc | 11 ++++--- libretroshare/src/services/p3idservice.cc | 20 ++++++++++++- libretroshare/src/services/p3idservice.h | 2 +- libretroshare/src/services/p3photoservice.cc | 24 ++++++++++++++-- libretroshare/src/services/p3photoservice.h | 5 ++-- libretroshare/src/services/p3posted.cc | 18 +++--------- libretroshare/src/services/p3wiki.cc | 17 +++-------- libretroshare/src/services/p3wire.cc | 27 ++++++++++++++++-- libretroshare/src/services/p3wire.h | 6 ++-- 14 files changed, 109 insertions(+), 92 deletions(-) diff --git a/libretroshare/src/gxs/rsgenexchange.h b/libretroshare/src/gxs/rsgenexchange.h index f97065ae1..cbbd839f7 100644 --- a/libretroshare/src/gxs/rsgenexchange.h +++ b/libretroshare/src/gxs/rsgenexchange.h @@ -123,12 +123,11 @@ public: * @param serviceSerialiser The users service needs this \n * in order for gen exchange to deal with its data types * @param mServType This should be service type used by the serialiser - * @param gixs This is used for verification of msgs and groups received by Gen Exchange using identities, set to NULL if \n - * identity verification is not wanted + * @param gixs This is used for verification of msgs and groups received by Gen Exchange using identities. * @param authenPolicy This determines the authentication used for verfying authorship of msgs and groups */ RsGenExchange(RsGeneralDataService* gds, RsNetworkExchangeService* ns, - RsSerialType* serviceSerialiser, uint16_t mServType, RsGixs* gixs = NULL, uint32_t authenPolicy = 0, + RsSerialType* serviceSerialiser, uint16_t mServType, RsGixs* gixs, uint32_t authenPolicy, uint32_t messageStorePeriod = DEFAULT_MSG_STORE_PERIOD); virtual ~RsGenExchange(); diff --git a/libretroshare/src/gxs/rsgixs.h b/libretroshare/src/gxs/rsgixs.h index 6a3d91372..599fb1e3d 100644 --- a/libretroshare/src/gxs/rsgixs.h +++ b/libretroshare/src/gxs/rsgixs.h @@ -186,8 +186,8 @@ class RsGxsIdExchange: public RsGixs { public: - RsGxsIdExchange(RsGeneralDataService* gds, RsNetworkExchangeService* ns, RsSerialType* serviceSerialiser, uint16_t mServType) - :RsGenExchange(gds,ns,serviceSerialiser,mServType, this) { return; } + RsGxsIdExchange(RsGeneralDataService* gds, RsNetworkExchangeService* ns, RsSerialType* serviceSerialiser, uint16_t mServType, uint32_t authenPolicy) + :RsGenExchange(gds,ns,serviceSerialiser,mServType, this, authenPolicy) { return; } virtual ~RsGxsIdExchange() { return; } }; diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 45c6a23e0..45cf2069f 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -2329,25 +2329,6 @@ int RsServer::StartupRetroShare() /**** Photo service ****/ - // create photo authentication policy - uint32_t photoAuthenPolicy = 0; - - uint8_t flag = 0; - - flag = GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN; - RsGenExchange::setAuthenPolicyFlag(flag, photoAuthenPolicy, - RsGenExchange::RESTRICTED_GRP_BITS); - -// Re-enable later, photo not using gixs yet - flag = GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN; // should be GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN for comments - RsGenExchange::setAuthenPolicyFlag(flag, photoAuthenPolicy, - RsGenExchange::RESTRICTED_GRP_BITS); - - flag = GXS_SERV::GRP_OPTION_AUTHEN_AUTHOR_SIGN; - RsGenExchange::setAuthenPolicyFlag(flag, photoAuthenPolicy, - RsGenExchange::GRP_OPTION_BITS); - - RsGeneralDataService* photo_ds = new RsDataService(currGxsDir + "/", "photoV2_db", RS_SERVICE_GXSV1_TYPE_PHOTO, NULL); @@ -2355,9 +2336,8 @@ int RsServer::StartupRetroShare() photo_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing #endif - // init gxs services - mPhoto = new p3PhotoService(photo_ds, NULL, mGxsIdService, photoAuthenPolicy); + mPhoto = new p3PhotoService(photo_ds, NULL, mGxsIdService); // create GXS photo service RsGxsNetService* photo_ns = new RsGxsNetService( @@ -2409,7 +2389,7 @@ int RsServer::StartupRetroShare() wire_ds->resetDataStore(); //TODO: remove, new service data per RS session, for testing #endif - mWire = new p3Wire(wire_ds, NULL); + mWire = new p3Wire(wire_ds, NULL, mGxsIdService); // create GXS photo service RsGxsNetService* wire_ns = new RsGxsNetService( diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index 2e4231664..bf1f9a829 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -84,13 +84,15 @@ uint32_t p3GxsChannels::channelsAuthenPolicy() uint32_t flag = 0; flag = GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); flag |= GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN; - //flag |= GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN; - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); + flag = 0; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::GRP_OPTION_BITS); + return policy; } diff --git a/libretroshare/src/services/p3gxscircles.cc b/libretroshare/src/services/p3gxscircles.cc index 306127102..4f32c8908 100644 --- a/libretroshare/src/services/p3gxscircles.cc +++ b/libretroshare/src/services/p3gxscircles.cc @@ -134,28 +134,18 @@ uint32_t p3GxsCircles::circleAuthenPolicy() uint32_t policy = 0; uint8_t flag = 0; - flag = GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN; - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); - flag = GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN; - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); + //flag = GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN; + //flag = GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN; + //flag = GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN; + //flag = GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); - flag = GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN; - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); - - flag = GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); - - flag = GXS_SERV::GRP_OPTION_AUTHEN_AUTHOR_SIGN; - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::GRP_OPTION_BITS); + flag = 0; + //flag = GXS_SERV::GRP_OPTION_AUTHEN_AUTHOR_SIGN; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::GRP_OPTION_BITS); return policy; } diff --git a/libretroshare/src/services/p3gxsforums.cc b/libretroshare/src/services/p3gxsforums.cc index d8b3665ca..7e80bb58b 100644 --- a/libretroshare/src/services/p3gxsforums.cc +++ b/libretroshare/src/services/p3gxsforums.cc @@ -64,13 +64,16 @@ p3GxsForums::p3GxsForums(RsGeneralDataService *gds, RsNetworkExchangeService *ne uint32_t p3GxsForums::forumsAuthenPolicy() { uint32_t policy = 0; - uint32_t flag = GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN | - GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; - - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); + uint32_t flag = GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); + + flag |= GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); + flag = 0; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::GRP_OPTION_BITS); + return policy; } diff --git a/libretroshare/src/services/p3idservice.cc b/libretroshare/src/services/p3idservice.cc index c99302f3a..a3883c65a 100644 --- a/libretroshare/src/services/p3idservice.cc +++ b/libretroshare/src/services/p3idservice.cc @@ -124,7 +124,7 @@ RsIdentity *rsIdentity = NULL; /********************************************************************************/ p3IdService::p3IdService(RsGeneralDataService *gds, RsNetworkExchangeService *nes) - : RsGxsIdExchange(gds, nes, new RsGxsIdSerialiser(), RS_SERVICE_GXSV1_TYPE_GXSID), + : RsGxsIdExchange(gds, nes, new RsGxsIdSerialiser(), RS_SERVICE_GXSV1_TYPE_GXSID, idAuthenPolicy()), RsIdentity(this), GxsTokenQueue(this), RsTickEvent(), mIdMtx("p3IdService"), mPublicKeyCache(DEFAULT_MEM_CACHE_SIZE, "GxsIdPublicKeyCache"), mPrivateKeyCache(DEFAULT_MEM_CACHE_SIZE, "GxsIdPrivateKeyCache") @@ -149,6 +149,24 @@ p3IdService::p3IdService(RsGeneralDataService *gds, RsNetworkExchangeService *ne } +uint32_t p3IdService::idAuthenPolicy() +{ + uint32_t policy = 0; + uint8_t flag = 0; + + // Messages are send reputations. normally not by ID holder - so need signatures. + flag = GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); + + // No ID required. + flag = 0; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::GRP_OPTION_BITS); + + return policy; +} + void p3IdService::service_tick() { diff --git a/libretroshare/src/services/p3idservice.h b/libretroshare/src/services/p3idservice.h index 21ac75bf0..f1a396416 100644 --- a/libretroshare/src/services/p3idservice.h +++ b/libretroshare/src/services/p3idservice.h @@ -160,7 +160,7 @@ class p3IdService: public RsGxsIdExchange, public RsIdentity, { public: p3IdService(RsGeneralDataService* gds, RsNetworkExchangeService* nes); - +static uint32_t idAuthenPolicy(); virtual void service_tick(); // needed for background processing. diff --git a/libretroshare/src/services/p3photoservice.cc b/libretroshare/src/services/p3photoservice.cc index 373db8b28..f6cfaed5a 100644 --- a/libretroshare/src/services/p3photoservice.cc +++ b/libretroshare/src/services/p3photoservice.cc @@ -86,9 +86,8 @@ std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album) return out; } -p3PhotoService::p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs, - uint32_t authenPolicy) - : RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_GXSV1_TYPE_PHOTO, gixs, authenPolicy), +p3PhotoService::p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs) + : RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_GXSV1_TYPE_PHOTO, gixs, photoAuthenPolicy()), mPhotoMutex(std::string("Photo Mutex")) { @@ -113,6 +112,25 @@ p3PhotoService::p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeServi } + +uint32_t p3PhotoService::photoAuthenPolicy() +{ + uint32_t policy = 0; + uint8_t flag = 0; + + flag = GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); + + flag |= GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); + + flag = GXS_SERV::GRP_OPTION_AUTHEN_AUTHOR_SIGN; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::GRP_OPTION_BITS); + + return policy; +} + bool p3PhotoService::updated() { RsStackMutex stack(mPhotoMutex); diff --git a/libretroshare/src/services/p3photoservice.h b/libretroshare/src/services/p3photoservice.h index 728fc7402..5140fdac0 100644 --- a/libretroshare/src/services/p3photoservice.h +++ b/libretroshare/src/services/p3photoservice.h @@ -33,8 +33,9 @@ class p3PhotoService : public RsPhoto, public RsGenExchange { public: - p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs, - uint32_t authenPolicy); + p3PhotoService(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs* gixs); + +static uint32_t photoAuthenPolicy(); public: diff --git a/libretroshare/src/services/p3posted.cc b/libretroshare/src/services/p3posted.cc index 754f09179..40be57010 100644 --- a/libretroshare/src/services/p3posted.cc +++ b/libretroshare/src/services/p3posted.cc @@ -72,25 +72,15 @@ uint32_t p3Posted::postedAuthenPolicy() uint32_t policy = 0; uint32_t flag = 0; - flag = GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN; - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); + flag = GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); - flag = GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN; - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); + flag |= GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN; RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); - flag = GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN; - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); - - flag = GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); - RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); + flag = 0; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::GRP_OPTION_BITS); return policy; } diff --git a/libretroshare/src/services/p3wiki.cc b/libretroshare/src/services/p3wiki.cc index 154275aef..c2bf4d060 100644 --- a/libretroshare/src/services/p3wiki.cc +++ b/libretroshare/src/services/p3wiki.cc @@ -65,22 +65,13 @@ uint32_t p3Wiki::wikiAuthenPolicy() flag = GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); + + flag |= GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN; RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); - flag = GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN; - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); - - // Root signatures are not required, as root publish signatures are. - flag = GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN; - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); - - //flag = GXS_SERV::GRP_OPTION_AUTHEN_AUTHOR_SIGN; - //RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::GRP_OPTION_BITS); + flag = 0; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::GRP_OPTION_BITS); return policy; } diff --git a/libretroshare/src/services/p3wire.cc b/libretroshare/src/services/p3wire.cc index 722ee7866..b04dc1ec9 100644 --- a/libretroshare/src/services/p3wire.cc +++ b/libretroshare/src/services/p3wire.cc @@ -35,12 +35,35 @@ RsWire *rsWire = NULL; -p3Wire::p3Wire(RsGeneralDataService* gds, RsNetworkExchangeService* nes) - :RsGenExchange(gds, nes, new RsGxsWireSerialiser(), RS_SERVICE_GXSV1_TYPE_WIRE), RsWire(this), mWireMtx("WireMtx") +p3Wire::p3Wire(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs *gixs) + :RsGenExchange(gds, nes, new RsGxsWireSerialiser(), RS_SERVICE_GXSV1_TYPE_WIRE, gixs, wireAuthenPolicy()), + RsWire(this), mWireMtx("WireMtx") { } + +uint32_t p3Wire::wireAuthenPolicy() +{ + uint32_t policy = 0; + uint8_t flag = 0; + + // Edits generally need an authors signature. + + flag = GXS_SERV::MSG_AUTHEN_ROOT_PUBLISH_SIGN | GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PUBLIC_GRP_BITS); + + flag |= GXS_SERV::MSG_AUTHEN_ROOT_AUTHOR_SIGN; + flag |= GXS_SERV::MSG_AUTHEN_CHILD_PUBLISH_SIGN; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::RESTRICTED_GRP_BITS); + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::PRIVATE_GRP_BITS); + + flag = 0; + RsGenExchange::setAuthenPolicyFlag(flag, policy, RsGenExchange::GRP_OPTION_BITS); + + return policy; +} + void p3Wire::service_tick() { return; diff --git a/libretroshare/src/services/p3wire.h b/libretroshare/src/services/p3wire.h index 8d93961e8..051d3d6c5 100644 --- a/libretroshare/src/services/p3wire.h +++ b/libretroshare/src/services/p3wire.h @@ -33,15 +33,17 @@ #include /* - * Wiki Service + * Wire Service * * */ + class p3Wire: public RsGenExchange, public RsWire { public: - p3Wire(RsGeneralDataService* gds, RsNetworkExchangeService* nes); + p3Wire(RsGeneralDataService* gds, RsNetworkExchangeService* nes, RsGixs *gixs); +static uint32_t wireAuthenPolicy(); protected: