version 1.127, 2004/08/26 09:14:08
|
version 1.128, 2004/09/15 13:03:47
|
|
|
/*------------------------------------------------------------------------------ | /*------------------------------------------------------------------------------ |
Checks whether a hostname points to the local CIMOM | Checks whether a hostname points to the local CIMOM |
------------------------------------------------------------------------------*/ | ------------------------------------------------------------------------------*/ |
static Boolean isLocalCIMOMHostAndPort( const String& hostname ) |
static Boolean isLocalCIMOM( const String& hostname ) |
{ | { |
PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::isLocalCIMOMHostAndPort"); |
PEG_METHOD_ENTER(TRC_REPOSITORY, "CIMRepository::isLocalCIMOM"); |
| |
// First do a brute force check for equality of the strings | // First do a brute force check for equality of the strings |
if( String::equalNoCase(hostname,System::getHostName())) | if( String::equalNoCase(hostname,System::getHostName())) |
|
|
return true; | return true; |
} | } |
| |
String hn = hostname; |
|
|
|
// ------------------------------------------------------------------------ | // ------------------------------------------------------------------------ |
// Match the port numbers |
// Strip of the port numbers |
// ------------------------------------------------------------------------ | // ------------------------------------------------------------------------ |
String port, localPort, localSPort; |
String hn = hostname; |
| |
Uint32 index = hostname.find(':'); | Uint32 index = hostname.find(':'); |
if ( index != PEG_NOT_FOUND ) | if ( index != PEG_NOT_FOUND ) |
{ | { |
port = hostname.subString(index+1); |
|
hn = hostname.subString(0,index); | hn = hostname.subString(0,index); |
|
|
ConfigManager *cfgMgr = ConfigManager::getInstance(); |
|
|
|
localPort = cfgMgr->getCurrentValue("httpPort"); |
|
localSPort = cfgMgr->getCurrentValue("httpsPort"); |
|
|
|
if (!String::equal(port,localPort) && |
|
!String::equal(port,localSPort) ) |
|
{ |
|
PEG_METHOD_EXIT(); |
|
return false; |
|
} |
|
} | } |
| |
// ------------------------------------------------------------------------ | // ------------------------------------------------------------------------ |
|
|
// Fix for bugzilla 667: | // Fix for bugzilla 667: |
// Strip off the hostname if it is the same as the local host | // Strip off the hostname if it is the same as the local host |
if ((fromRef.getHost() != String::EMPTY) && | if ((fromRef.getHost() != String::EMPTY) && |
(isLocalCIMOMHostAndPort(fromRef.getHost()))) |
(isLocalCIMOM(fromRef.getHost()))) |
{ | { |
PEG_TRACE_STRING(TRC_REPOSITORY, Tracer::LEVEL4, "_createAssocInstEntries() - Stripping of local hostName from fromRef"); | PEG_TRACE_STRING(TRC_REPOSITORY, Tracer::LEVEL4, "_createAssocInstEntries() - Stripping of local hostName from fromRef"); |
fromRef.setHost(String::EMPTY); | fromRef.setHost(String::EMPTY); |
|
|
| |
// Strip off the hostname if it is the same as the local host | // Strip off the hostname if it is the same as the local host |
if ((toRef.getHost() != String::EMPTY) && | if ((toRef.getHost() != String::EMPTY) && |
(isLocalCIMOMHostAndPort(toRef.getHost()))) |
(isLocalCIMOM(toRef.getHost()))) |
{ | { |
PEG_TRACE_STRING(TRC_REPOSITORY, Tracer::LEVEL4, "_createAssocInstEntries() - Stripping of local hostName from toRef"); | PEG_TRACE_STRING(TRC_REPOSITORY, Tracer::LEVEL4, "_createAssocInstEntries() - Stripping of local hostName from toRef"); |
toRef.setHost(String::EMPTY); | toRef.setHost(String::EMPTY); |