diff options
author | Mark Spruiell <mes@zeroc.com> | 2002-10-12 00:13:40 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2002-10-12 00:13:40 +0000 |
commit | 17173387a237b2da8f61780d269e25a78f317cf5 (patch) | |
tree | 732320c904414575b4e64383dd6f9235bc571c6b /cpp/src/Ice/ObjectAdapterI.cpp | |
parent | bug fix (diff) | |
download | ice-17173387a237b2da8f61780d269e25a78f317cf5.tar.bz2 ice-17173387a237b2da8f61780d269e25a78f317cf5.tar.xz ice-17173387a237b2da8f61780d269e25a78f317cf5.zip |
validate identities
Diffstat (limited to 'cpp/src/Ice/ObjectAdapterI.cpp')
-rw-r--r-- | cpp/src/Ice/ObjectAdapterI.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index 7ac6e051fe8..2fde6a7d55a 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -180,6 +180,8 @@ Ice::ObjectAdapterI::add(const ObjectPtr& object, const Identity& ident) throw ex; } + checkIdentity(ident); + _activeServantMapHint = _activeServantMap.insert(_activeServantMapHint, make_pair(ident, object)); return newProxy(ident); @@ -217,6 +219,8 @@ Ice::ObjectAdapterI::remove(const Identity& ident) throw ex; } + checkIdentity(ident); + _activeServantMap.erase(ident); _activeServantMapHint = _activeServantMap.end(); } @@ -320,6 +324,8 @@ Ice::ObjectAdapterI::findServantLocator(const string& prefix) ObjectPtr Ice::ObjectAdapterI::identityToServant(const Identity& ident) { + checkIdentity(ident); + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); if(_activeServantMapHint != _activeServantMap.end()) @@ -352,6 +358,8 @@ Ice::ObjectAdapterI::proxyToServant(const ObjectPrx& proxy) ObjectPrx Ice::ObjectAdapterI::createProxy(const Identity& ident) { + checkIdentity(ident); + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); if(!_instance) @@ -367,6 +375,8 @@ Ice::ObjectAdapterI::createProxy(const Identity& ident) ObjectPrx Ice::ObjectAdapterI::createDirectProxy(const Identity& ident) { + checkIdentity(ident); + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); if(!_instance) @@ -382,6 +392,8 @@ Ice::ObjectAdapterI::createDirectProxy(const Identity& ident) ObjectPrx Ice::ObjectAdapterI::createReverseProxy(const Identity& ident) { + checkIdentity(ident); + IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); if(!_instance) @@ -650,6 +662,17 @@ Ice::ObjectAdapterI::newDirectProxy(const Identity& ident) const } +void +Ice::ObjectAdapterI::checkIdentity(const Identity& ident) +{ + if(ident.name.size() == 0) + { + IllegalIdentityException e(__FILE__, __LINE__); + e.id = ident; + throw e; + } +} + bool Ice::ObjectAdapterI::isLocal(const ObjectPrx& proxy) const { |