Changeset 94784 in vbox
- Timestamp:
- May 2, 2022 1:35:10 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r94782 r94784 3608 3608 ComPtr<IUnknown> unk = mData->mSession.mDirectControl; 3609 3609 NOREF(unk); 3610 3611 #ifdef VBOX_WITH_FULL_VM_ENCRYPTION 3612 if (aLockType == LockType_VM) 3613 { 3614 /* get the console from the direct session */ 3615 ComPtr<IConsole> console; 3616 rc = pSessionControl->COMGETTER(RemoteConsole)(console.asOutParam()); 3617 ComAssertComRC(rc); 3618 /* send passswords to console */ 3619 for (SecretKeyStore::SecretKeyMap::iterator it = mData->mpKeyStore->begin(); 3620 it != mData->mpKeyStore->end(); 3621 ++it) 3622 { 3623 SecretKey *pKey = it->second; 3624 pKey->retain(); 3625 console->AddEncryptionPassword(Bstr(it->first).raw(), 3626 Bstr((const char*)pKey->getKeyBuffer()).raw(), 3627 TRUE); 3628 pKey->release(); 3629 } 3630 3631 } 3632 #endif 3610 3633 } 3611 3634 … … 6871 6894 aData.resize(cbData); 6872 6895 6873 RTFILE LogFile; 6874 int vrc = RTFileOpen(&LogFile, log.c_str(), 6875 RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE); 6896 int vrc = VINF_SUCCESS; 6897 RTVFSIOSTREAM hVfsIosLog = NIL_RTVFSIOSTREAM; 6898 6899 #ifdef VBOX_WITH_FULL_VM_ENCRYPTION 6900 if (mData->mstrLogKeyId.isNotEmpty() && mData->mstrLogKeyStore.isNotEmpty()) 6901 { 6902 PCVBOXCRYPTOIF pCryptoIf = NULL; 6903 rc = i_getVirtualBox()->i_retainCryptoIf(&pCryptoIf); 6904 if (SUCCEEDED(rc)) 6905 { 6906 alock.acquire(); 6907 6908 SecretKey *pKey = NULL; 6909 vrc = mData->mpKeyStore->retainSecretKey(mData->mstrLogKeyId, &pKey); 6910 alock.release(); 6911 6912 if (RT_SUCCESS(vrc)) 6913 { 6914 vrc = RTVfsIoStrmOpenNormal(log.c_str(), RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE, &hVfsIosLog); 6915 if (RT_SUCCESS(vrc)) 6916 { 6917 RTVFSIOSTREAM hVfsIosLogDec = NIL_RTVFSIOSTREAM; 6918 vrc = pCryptoIf->pfnCryptoIoStrmFromVfsIoStrmDecrypt(hVfsIosLog, mData->mstrLogKeyStore.c_str(), 6919 (const char *)pKey->getKeyBuffer(), &hVfsIosLogDec); 6920 if (RT_SUCCESS(vrc)) 6921 { 6922 RTVfsIoStrmRelease(hVfsIosLog); 6923 hVfsIosLog = hVfsIosLogDec; 6924 } 6925 } 6926 6927 pKey->release(); 6928 } 6929 6930 i_getVirtualBox()->i_releaseCryptoIf(pCryptoIf); 6931 } 6932 } 6933 else 6934 vrc = RTVfsIoStrmOpenNormal(log.c_str(), RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE, &hVfsIosLog); 6935 #else 6936 vrc = RTVfsIoStrmOpenNormal(log.c_str(), RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE, &hVfsIosLog); 6937 #endif 6876 6938 if (RT_SUCCESS(vrc)) 6877 6939 { 6878 vrc = RTFileReadAt(LogFile, aOffset, cbData ? &aData.front() : NULL, cbData, &cbData); 6940 vrc = RTVfsIoStrmReadAt(hVfsIosLog, aOffset, 6941 cbData ? &aData.front() : NULL, cbData, 6942 true /*fBlocking*/, &cbData); 6879 6943 if (RT_SUCCESS(vrc)) 6880 6944 aData.resize(cbData); … … 6883 6947 tr("Could not read log file '%s' (%Rrc)"), 6884 6948 log.c_str(), vrc); 6885 RTFileClose(LogFile); 6949 6950 RTVfsIoStrmRelease(hVfsIosLog); 6886 6951 } 6887 6952 else
Note:
See TracChangeset
for help on using the changeset viewer.