⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 securitypropertyowner.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 3 页
字号:
/**    Update planned value of the specified property to the specified value.*/void SecurityPropertyOwner::updatePlannedValue(    const String& name,    const String& value){    struct ConfigProperty* configProperty = _lookupConfigProperty(name);    configProperty->plannedValue = value;}/**    Checks to see if the given value is valid or not.*/Boolean SecurityPropertyOwner::isValid(    const String& name,    const String& value) const{    Boolean retVal = false;    //    // Validate the specified value    //    if (String::equalNoCase(_enableAuthentication->propertyName, name))    {        if (String::equal(value, "true") || String::equal(value, "false"))        {            retVal = true;        }    }    else if (String::equalNoCase(                 _enableNamespaceAuthorization->propertyName, name))    {        if (String::equal(value, "true") || String::equal(value, "false"))        {            retVal = true;        }    }    else if (String::equalNoCase(_httpAuthType->propertyName, name))    {#ifdef PEGASUS_OS_OS400        if (String::equal(value, "Basic")#else        if (String::equal(value, "Basic") || String::equal(value, "Digest")#endif#ifdef PEGASUS_KERBEROS_AUTHENTICATION            || String::equal(value, "Kerberos")#endif        )        {            retVal = true;        }    }    else if (String::equalNoCase(_passwordFilePath->propertyName, name))    {        String fileName(value);        //        // Check if the file path is empty        //        if (fileName == String::EMPTY)        {            return false;        }        fileName = ConfigManager::getHomedPath(fileName);        //        // Check if the file path is a directory        //        FileSystem::translateSlashes(fileName);        if (FileSystem::isDirectory(fileName))        {            return false;        }        //        // Check if the file exists and is writable        //        if (FileSystem::exists(fileName))        {            if (!FileSystem::canWrite(fileName))            {                return false;            }            else            {                return true;            }        }        else        {            //            // Check if directory is writable            //            Uint32 pos = fileName.reverseFind('/');            if (pos != PEG_NOT_FOUND)            {                String dirName = fileName.subString(0,pos);                if (!FileSystem::isDirectory(dirName))                {                    return false;                }                if (!FileSystem::canWrite(dirName) )                {                    return false;                }                else                {                    return true;                }            }            else            {                String currentDir;                //                // Check if there is permission to write in the                // current working directory                //                FileSystem::getCurrentDirectory(currentDir);                if (!FileSystem::canWrite(currentDir))                {                    return false;                }                else                {                    return true;                }            }        }    }    else if (String::equalNoCase(_certificateFilePath->propertyName, name) ||             String::equalNoCase(_keyFilePath->propertyName, name))    {        //        // Check if the file path is empty        //        if (value == String::EMPTY)        {            return false;        }        String fileName = ConfigManager::getHomedPath(value);        //        // Check if the file path is a directory        //        FileSystem::translateSlashes(fileName);        if (FileSystem::isDirectory(fileName))        {            return false;        }        //        // Check if the file exists and is readable and is not empty.        //        if (FileSystem::exists(fileName) && FileSystem::canRead(fileName))        {            Uint32 size;            if (FileSystem::getFileSize(fileName, size))            {                if (size > 0)                {                    return true;                }            }        }         return false;    }    else if (String::equalNoCase(_trustStore->propertyName, name)#ifdef PEGASUS_ENABLE_SSL_CRL_VERIFICATION             || String::equalNoCase(_crlStore->propertyName, name)#endif    )    {        //        // Allow the file path to be empty        //        if (value == String::EMPTY)        {            return true;        }        String fileName = ConfigManager::getHomedPath(value);        //        // Check if the file path is a directory        //        FileSystem::translateSlashes(fileName);        if (FileSystem::isDirectory(fileName))        {            //            // Truststore can be a directory, congruent with OpenSSL standards            // Check if the directoy has read and write permissions            //            if (FileSystem::canRead(fileName) && FileSystem::canWrite(fileName))            {                return true;            }        }        //        // Check if the file exists and is readable        //        else if (FileSystem::exists(fileName) && FileSystem::canRead(fileName))        {            return true;        }        return false;    }    else if (String::equalNoCase(                 _sslClientVerificationMode->propertyName, name))    {        if (String::equal(value, "disabled") ||            String::equal(value, "required") ||            String::equal(value, "optional"))        {            retVal = true;        }    }    else if (String::equalNoCase(_sslTrustStoreUserName->propertyName, name))    {        if (System::isSystemUser((const char*)value.getCString()))        {            return true;        }    }    else if (String::equalNoCase(                 _enableRemotePrivilegedUserAccess->propertyName, name))    {        if (String::equal(value, "true") || String::equal(value, "false"))        {            retVal = true;        }    }    else if (String::equalNoCase(                 _enableSubscriptionsForNonprivilegedUsers->propertyName, name))    {        if (String::equal(value, "true") || String::equal(value, "false"))        {            retVal = true;        }    }#ifdef PEGASUS_ENABLE_USERGROUP_AUTHORIZATION    else if (String::equalNoCase(_authorizedUserGroups->propertyName, name))    {        retVal = true;    }#endif#ifdef PEGASUS_KERBEROS_AUTHENTICATION    else if (String::equalNoCase(_kerberosServiceName->propertyName, name))    {        String serviceName(value);        //        // Check if the service name is empty        //        if (serviceName == String::EMPTY || serviceName== "")        {            retVal =  false;        }        else        {           retVal =  true;        }    }#endif    else    {        throw UnrecognizedConfigProperty(name);    }    return retVal;}/**    Checks to see if the specified property is dynamic or not.*/Boolean SecurityPropertyOwner::isDynamic(const String& name) const{    struct ConfigProperty* configProperty =_lookupConfigProperty(name);    return (configProperty->dynamic == IS_DYNAMIC);}PEGASUS_NAMESPACE_END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -