MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (const gunichar2 *path, MonoError *error) { gboolean ret = FALSE; /* no one, but the user, should have access to the directory */ ret = IsProtected (path, (S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH)); return (MonoBoolean)ret; }
string CEntityInfo::getRenameCommand(symbolPtr* pSym,string newname) { string command; string selectTag = prepareQuery(etag(pSym)); string permissionCode = "1"; if(IsPublic(pSym)) permissionCode = "0"; else if(IsProtected(pSym)) permissionCode = "2"; else if(IsPrivate(pSym)) permissionCode = "3"; switch(pSym->get_kind()) { case DD_MODULE: command="Impact:ChangeFilename " + selectTag + " {" + newname + "}"; break; case DD_INTERFACE: case DD_CLASS: command = "Impact:ChangeClassname " + selectTag + " {" + newname + "}"; break; case DD_ENUM: case DD_UNION: command = "Impact:ChangeUnionEnumStructName " + selectTag + " {" + newname + "}"; break; case DD_FIELD: command = "Impact:ChangeFieldName " + selectTag + " {" + newname + "} " + permissionCode; break; case DD_FUNC_DECL: command = "Impact:ChangeFunctionName " + selectTag + " {" + newname + "}"; break; case DD_TYPEDEF: command = "Impact:ChangeTypedefName " + selectTag + " {" + newname + "}"; break; case DD_MACRO: command = "Impact:ChangeMacroName " + selectTag + " {" + newname + "}"; break; case DD_TEMPLATE: command = "Impact:ChangeTemplateName " + selectTag + " {" + newname + "}"; break; case DD_VAR_DECL: command = "Impact:ChangeVariableName " + selectTag + " {" + newname + "}"; break; case DD_PACKAGE: command ="Impact:RenamePackage " + selectTag + " { " + newname + "}"; } return command; }
MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (MonoString *path) { gboolean ret = FALSE; /* no one, but the user, should have access to the directory */ #ifdef HOST_WIN32 ret = IsUserProtected (mono_string_chars (path)); #else ret = IsProtected (path, (S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH)); #endif return ret; }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // TBool CAiwImagePrintIf::IsPrintingSupportedL( const TDesC& aFileName ) { //1. check: Mimetype should be correct (JPEG) FLOG(_L("[CAiwImagePrintIf] IsPrintingSupported TBool 1")); TBool printable = CheckMIMETypeL( KJpegFileType, aFileName ); if (printable) { //2. check: file should not be protected printable = !IsProtected( aFileName ); } FTRACE(FPrint(_L("[CAiwImagePrintIf] IsPrintingSupportedL TBool printable is %d"), printable )); return printable; }
MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected (MonoString *path) { gboolean ret = FALSE; MONO_ARCH_SAVE_REGS; /* no one, but the owner, should have write access to the directory */ #ifdef HOST_WIN32 ret = IsMachineProtected (mono_string_chars (path)); #else ret = IsProtected (path, (S_IWGRP | S_IWOTH)); #endif return ret; }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // TBool CAiwImagePrintIf::IsPrintingSupported( const CAiwGenericParamList& aInParamList ) { TInt index(0); FLOG(_L("[CAiwImagePrintIf] IsPrintingSupported ")); const TAiwGenericParam* param = aInParamList.FindFirst( index, EGenericParamMIMEType ); TBool printable( EFalse ); if ( index == KErrNotFound ) { index = 0; const TAiwGenericParam* param = aInParamList.FindFirst(index, EGenericParamFile, EVariantTypeDesC); //Check if there is any printable images available. At least image must be //JPEG and it also must be unprotected to be printable. while ( index != KErrNotFound && !printable) { FLOG(_L("[CAiwImagePrintIf] IsPrintingSupported 3")); TRAP_IGNORE( printable = IsPrintingSupportedL( param->Value().AsDes() )); param = aInParamList.FindNext(index, EGenericParamFile, EVariantTypeDesC); } FTRACE(FPrint(_L("[CAiwImagePrintIf] IsPrintingSupported printable is %d"), printable )); return printable; } while ( index != KErrNotFound && !printable ) { if ( param->Value().TypeId() == EVariantTypeDesC && param->Value().AsDes() == KJpegFileType16 ) { // MIME-type parameter follows filename parameter in parameter list. // Because of that previous item in list is used. if (index > 0) { FLOG(_L("[CAiwImagePrintIf] IsPrintingSupported 5")); printable = !IsProtected( aInParamList[index-1].Value().AsDes() ); } } if ( !printable ) { param = aInParamList.FindNext(index, EGenericParamMIMEType); } } FTRACE(FPrint(_L("[CAiwImagePrintIf] IsPrintingSupported 2 printable is %d"), printable )); return printable; }
devEthernet::devEthernet(const std::string& newName /* = "" */, const CE_DLL* newDLLPtr /* = 0 */): CE_Device(newName, newDLLPtr), _ifaceName(""), _ifaceNameSetting(CEcfg::instance()->getOrAddString(cfgKey("ifaceName"), _ifaceName)), _vendor(""), _model(""), _packetSocket(ACE_INVALID_HANDLE), _netlinkSocket(0), _snapLen(CEcfg::instance()->getOrAddInt(cfgKey("snapLen"), 0)), _activateOnLoad(CEcfg::instance()->getOrAddBool(cfgKey("activateOnLoad"), true)), _noArpSetting(CEcfg::instance()->getOrAddBool(cfgKey("flagNoARP"), false)), _promiscSetting(CEcfg::instance()->getOrAddBool(cfgKey("flagPromisc"), false)) { CEcfg::instance()->getOrAddString(cfgKey("devType")) = "Ethernet"; if ( strcmp(_ifaceNameSetting.c_str(), "") == 0) { MOD_INFO("Getting interface name from Device name (%s).", newName.c_str()); setIfaceName(newName); } else { MOD_INFO("Getting interface name from config file (%s).", _ifaceNameSetting.c_str()); _ifaceName = static_cast<const char*>(_ifaceNameSetting); } if ( ! _ifaceName.empty() ) { if ( isProtected() ) throw IsProtected("Device " + getIfaceName() + " is marked 'protected' and cannot be managed by the CE."); // IOCtlFailed is thrown if there's an error try { _ioctl(SIOCGIFFLAGS, _savedFlags, "Error getting flags for interface " + getIfaceName() + " via SIOCGIFFLAGS: "); } catch (...) { MOD_ERROR("Could not read flags to restore later."); } try { if (getActivateOnLoad()) activate(); } catch (...) { MOD_ERROR("Unable to activate at this time."); } if ( CEcfg::instance()->exists(cfgKey("MTU")) ) setMTU(static_cast<unsigned int>(CEcfg::instance()->get(cfgKey("MTU")))); } if ( getSnapLen() == 0 ) { MOD_DEBUG("Automatically setting snapLen."); setSnapLen(static_cast<int>(getMTU() + 30)); MOD_DEBUG("SnapLen set to %d.", getSnapLen()); } MOD_DEBUG("Connecting netlink socket."); _netlinkSocket = Linux::nl_socket_alloc(); if (Linux::nl_connect(_netlinkSocket, NETLINK_ROUTE) < 0) { ND_ERROR("[%s] Unable to connect netlink socket: %s\n", nl_geterror(errno)); Linux::nl_socket_free(_netlinkSocket); } MOD_DEBUG("Ethernet constructor complete."); }
void devEthernet::checkProtection(const std::string& action) { if ( isProtected() ) { throw IsProtected("Cannot " + action + " protected interface " + getIfaceName() + "."); } }
bool CEntityInfo::IsPublic(symbolPtr* pSym) { return !(IsProtected(pSym) || IsPrivate(pSym)); }