Changeset 40066 in vbox
- Timestamp:
- Feb 10, 2012 2:52:47 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 76200
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/settings.h
r38873 r40066 1057 1057 void readStorageControllers(const xml::ElementNode &elmStorageControllers, Storage &strg); 1058 1058 void readDVDAndFloppies_pre1_9(const xml::ElementNode &elmHardware, Storage &strg); 1059 void readTeleporter(const xml::ElementNode *pElmTeleporter, MachineUserData *pUserData); 1059 1060 void readSnapshot(const xml::ElementNode &elmSnapshot, Snapshot &snap); 1060 1061 void convertOldOSType_pre1_5(com::Utf8Str &str); -
trunk/src/VBox/Main/Makefile.kmk
r39955 r40066 286 286 src-all/EventImpl.cpp \ 287 287 src-all/Global.cpp \ 288 src-all/HashedPw.cpp \ 288 289 src-all/Logging.cpp \ 289 290 src-all/PciDeviceAttachmentImpl.cpp \ … … 638 639 src-all/EventImpl.cpp \ 639 640 src-all/Global.cpp \ 641 src-all/HashedPw.cpp \ 640 642 src-all/Logging.cpp \ 641 643 src-all/PciDeviceAttachmentImpl.cpp \ -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r39882 r40066 4169 4169 very basic measure to prevent simple hacks and operators accidentally 4170 4170 beaming a virtual machine to the wrong place. 4171 4172 Note that you SET a plain text password while reading back a HASHED 4173 password. Setting a hashed password is currently not supported. 4171 4174 </desc> 4172 4175 </attribute> -
trunk/src/VBox/Main/src-all/Global.cpp
r40041 r40066 1 1 /* $Id$ */ 2 2 /** @file 3 *4 3 * VirtualBox COM global definitions 5 4 * … … 8 7 9 8 /* 10 * Copyright (C) 2008-201 1Oracle Corporation9 * Copyright (C) 2008-2012 Oracle Corporation 11 10 * 12 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 537 536 } 538 537 539 540 538 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/src-client/ConsoleImplTeleporter.cpp
r36041 r40066 26 26 #include "AutoCaller.h" 27 27 #include "Logging.h" 28 #include "HashedPw.h" 28 29 29 30 #include <iprt/asm.h> … … 932 933 CheckComArgOutPointerValid(aProgress); 933 934 CheckComArgStrNotEmptyOrNull(aHostname); 934 CheckComArgStrNotEmptyOrNull(a Hostname);935 CheckComArgStrNotEmptyOrNull(aPassword); 935 936 CheckComArgExprMsg(aPort, aPort > 0 && aPort <= 65535, ("is %u", aPort)); 936 937 CheckComArgExprMsg(aMaxDowntime, aMaxDowntime > 0, ("is %u", aMaxDowntime)); 938 939 Utf8Str strPassword(aPassword); 940 if (!strPassword.isEmpty()) 941 { 942 if (VBoxIsPasswordHashed(&strPassword)) 943 return setError(E_INVALIDARG, tr("The specified password resembles a hashed password, expected plain text")); 944 VBoxHashPassword(&strPassword); 945 } 937 946 938 947 AutoCaller autoCaller(this); … … 971 980 972 981 TeleporterStateSrc *pState = new TeleporterStateSrc(this, mpUVM, ptrProgress, mMachineState); 973 pState->mstrPassword = aPassword;982 pState->mstrPassword = strPassword; 974 983 pState->mstrHostname = aHostname; 975 984 pState->muPort = aPort; -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r39926 r40066 60 60 61 61 #include "AutoCaller.h" 62 #include "HashedPw.h" 62 63 #include "Performance.h" 63 64 … … 70 71 #include <iprt/cpp/utils.h> 71 72 #include <iprt/cpp/xml.h> /* xml::XmlFileWriter::s_psz*Suff. */ 73 #include <iprt/sha.h> 72 74 #include <iprt/string.h> 73 75 … … 2696 2698 2697 2699 AutoCaller autoCaller(this); 2698 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2699 2700 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2701 2702 mUserData->s.strTeleporterPassword.cloneTo(aPassword); 2703 2704 return S_OK; 2700 HRESULT hrc = autoCaller.rc(); 2701 if (SUCCEEDED(hrc)) 2702 { 2703 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2704 mUserData->s.strTeleporterPassword.cloneTo(aPassword); 2705 } 2706 2707 return hrc; 2705 2708 } 2706 2709 2707 2710 STDMETHODIMP Machine::COMSETTER(TeleporterPassword)(IN_BSTR aPassword) 2708 2711 { 2709 AutoCaller autoCaller(this); 2710 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2711 2712 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2713 2714 HRESULT rc = checkStateDependency(MutableStateDep); 2715 if (FAILED(rc)) return rc; 2716 2717 setModified(IsModified_MachineData); 2718 mUserData.backup(); 2719 mUserData->s.strTeleporterPassword = aPassword; 2720 2721 return S_OK; 2712 /* 2713 * Hash the password first. 2714 */ 2715 Utf8Str strPassword(aPassword); 2716 if (!strPassword.isEmpty()) 2717 { 2718 if (VBoxIsPasswordHashed(&strPassword)) 2719 return setError(E_INVALIDARG, tr("Cannot set an already hashed password, only plain text password please")); 2720 VBoxHashPassword(&strPassword); 2721 } 2722 2723 /* 2724 * Do the update. 2725 */ 2726 AutoCaller autoCaller(this); 2727 HRESULT hrc = autoCaller.rc(); 2728 if (SUCCEEDED(hrc)) 2729 { 2730 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2731 hrc = checkStateDependency(MutableStateDep); 2732 if (SUCCEEDED(hrc)) 2733 { 2734 setModified(IsModified_MachineData); 2735 mUserData.backup(); 2736 mUserData->s.strTeleporterPassword = strPassword; 2737 } 2738 } 2739 2740 return hrc; 2722 2741 } 2723 2742 -
trunk/src/VBox/Main/xml/Settings.cpp
r38893 r40066 52 52 53 53 /* 54 * Copyright (C) 2007-201 1Oracle Corporation54 * Copyright (C) 2007-2012 Oracle Corporation 55 55 * 56 56 * This file is part of VirtualBox Open Source Edition (OSE), as … … 77 77 78 78 #include "Logging.h" 79 #include "HashedPw.h" 79 80 80 81 using namespace com; … … 3143 3144 3144 3145 /** 3146 * Called for reading the <Teleporter> element under <Machine>. 3147 */ 3148 void MachineConfigFile::readTeleporter(const xml::ElementNode *pElmTeleporter, 3149 MachineUserData *pUserData) 3150 { 3151 pElmTeleporter->getAttributeValue("enabled", pUserData->fTeleporterEnabled); 3152 pElmTeleporter->getAttributeValue("port", pUserData->uTeleporterPort); 3153 pElmTeleporter->getAttributeValue("address", pUserData->strTeleporterAddress); 3154 pElmTeleporter->getAttributeValue("password", pUserData->strTeleporterPassword); 3155 3156 if ( pUserData->strTeleporterPassword.isNotEmpty() 3157 && !VBoxIsPasswordHashed(&pUserData->strTeleporterPassword)) 3158 VBoxHashPassword(&pUserData->strTeleporterPassword); 3159 } 3160 3161 /** 3145 3162 * Called initially for the <Snapshot> element under <Machine>, if present, 3146 3163 * to store the snapshot's data into the given Snapshot structure (which is … … 3341 3358 machineUserData.strDescription = pelmMachineChild->getValue(); 3342 3359 else if (pelmMachineChild->nameEquals("Teleporter")) 3343 { 3344 pelmMachineChild->getAttributeValue("enabled", machineUserData.fTeleporterEnabled); 3345 pelmMachineChild->getAttributeValue("port", machineUserData.uTeleporterPort); 3346 pelmMachineChild->getAttributeValue("address", machineUserData.strTeleporterAddress); 3347 pelmMachineChild->getAttributeValue("password", machineUserData.strTeleporterPassword); 3348 } 3360 readTeleporter(pelmMachineChild, &machineUserData); 3349 3361 else if (pelmMachineChild->nameEquals("FaultTolerance")) 3350 3362 {
Note:
See TracChangeset
for help on using the changeset viewer.