ReplicaSessionPrx InternalRegistryI::registerReplica(const InternalReplicaInfoPtr& info, const InternalRegistryPrx& prx, const Ice::Current& current) { const Ice::LoggerPtr logger = _database->getTraceLevels()->logger; try { ReplicaSessionIPtr s = new ReplicaSessionI(_database, _wellKnownObjects, info, prx, _replicaSessionTimeout); _reaper->add(new SessionReapable<ReplicaSessionI>(logger, s), _replicaSessionTimeout); return s->getProxy(); } catch(const Ice::ObjectAdapterDeactivatedException&) { throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); } }
ReplicaSessionPrx InternalRegistryI::registerReplica(const InternalReplicaInfoPtr& info, const InternalRegistryPrx& prx, const Ice::Current& current) { const TraceLevelsPtr traceLevels = _database->getTraceLevels(); const Ice::LoggerPtr logger = traceLevels->logger; if(!info || !prx) { return 0; } if(_requireReplicaCertCN) { try { IceSSL::ConnectionInfoPtr sslConnInfo = IceSSL::ConnectionInfoPtr::dynamicCast(current.con->getInfo()); if(sslConnInfo) { if (sslConnInfo->certs.empty() || !sslConnInfo->certs[0]->getSubjectDN().match("CN=" + info->name)) { if(traceLevels->replica > 0) { Ice::Trace out(logger, traceLevels->replicaCat); out << "certificate CN doesn't match replica name `" << info->name << "'"; } throw PermissionDeniedException("certificate CN doesn't match replica name `" + info->name + "'"); } } else { if(traceLevels->replica > 0) { Ice::Trace out(logger, traceLevels->replicaCat); out << "replica certificate for `" << info->name << "' is required to connect to this registry"; } throw PermissionDeniedException("replica certificate is required to connect to this registry"); } } catch(const PermissionDeniedException&) { throw; } catch(const IceUtil::Exception&) { if(traceLevels->replica > 0) { Ice::Trace out(logger, traceLevels->replicaCat); out << "unexpected exception while verifying certificate for replica `" << info->name << "'"; } throw PermissionDeniedException("unable to verify certificate for replica `" + info->name + "'"); } } try { ReplicaSessionIPtr s = new ReplicaSessionI(_database, _wellKnownObjects, info, prx, _replicaSessionTimeout); _reaper->add(new SessionReapable<ReplicaSessionI>(logger, s), _replicaSessionTimeout); return s->getProxy(); } catch(const Ice::ObjectAdapterDeactivatedException&) { throw Ice::ObjectNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); } }