Changeset 58383 in vbox
- Timestamp:
- Oct 23, 2015 9:24:16 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 103617
- Location:
- trunk/src/VBox/Main
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Makefile.kmk
r58368 r58383 346 346 VBoxSVC_SOURCES = \ 347 347 $(VBoxAPIWrap_0_OUTDIR)/VBoxAPI.d \ 348 src-all/AuthLibrary.cpp \ 348 349 src-all/DisplayPNGUtil.cpp \ 349 350 src-all/DisplayResampleImage.cpp \ … … 652 653 $(if $(VBOX_WITH_EXTPACK),VBOX_WITH_EXTPACK,) \ 653 654 $(if $(VBOX_WITH_PCI_PASSTHROUGH),VBOX_WITH_PCI_PASSTHROUGH,) \ 655 $(if $(VBOX_WITH_VRDEAUTH_IN_VBOXSVC),VBOX_WITH_VRDEAUTH_IN_VBOXSVC,) \ 654 656 $(if $(VBOX_WITH_VPX),VBOX_WITH_VPX,) 655 657 ifdef VBOX_WITH_CRHGSMI … … 726 728 VBoxC_SOURCES = \ 727 729 $(VBoxAPIWrap_0_OUTDIR)/VBoxAPI.d \ 728 src-all/AuthLibrary.cpp \729 730 src-all/DisplayPNGUtil.cpp \ 730 731 src-all/DisplayResampleImage.cpp \ … … 813 814 src-client/EbmlWriter.cpp \ 814 815 src-client/VideoRec.cpp 816 endif 817 ifndef VBOX_WITH_VRDEAUTH_IN_VBOXSVC 818 VBoxC_SOURCES += \ 819 src-all/AuthLibrary.cpp 815 820 endif 816 821 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r58134 r58383 3601 3601 <interface 3602 3602 name="IInternalMachineControl" extends="$unknown" 3603 uuid=" ec36f437-ad4d-4512-94dd-f4c568143aa7"3603 uuid="cdbc59df-4f4d-4cf2-809c-917601355afc" 3604 3604 internal="yes" 3605 3605 wsmap="suppress" … … 3923 3923 <param name="vmNetTx" type="unsigned long" dir="in"> 3924 3924 <desc>Network transmit rate for VM.</desc> 3925 </param> 3926 </method> 3927 3928 <method name="authenticateExternal"> 3929 <desc> 3930 Verify credentials using the external auth library. 3931 </desc> 3932 <param name="authParams" type="wstring" dir="in" safearray="yes"> 3933 <desc> 3934 The auth parameters, credentials, etc. 3935 </desc> 3936 </param> 3937 <param name="result" type="wstring" dir="out"> 3938 <desc> 3939 The authentification result. 3940 </desc> 3925 3941 </param> 3926 3942 </method> -
trunk/src/VBox/Main/include/ConsoleImpl.h
r58004 r58383 979 979 980 980 friend struct VMTask; 981 friend class ConsoleVRDPServer; 981 982 }; 982 983 -
trunk/src/VBox/Main/include/ConsoleVRDPServer.h
r58368 r58383 245 245 #endif /* VBOX_WITH_USB */ 246 246 247 #ifndef VBOX_WITH_VRDEAUTH_IN_VBOXSVC 247 248 /* External authentication library context. The library is loaded in the 248 249 * Authenticate method and unloaded at the object destructor. 249 250 */ 250 251 AUTHLIBRARYCONTEXT mAuthLibCtx; 252 #endif 251 253 252 254 uint32_t volatile mu32AudioInputClientId; -
trunk/src/VBox/Main/include/MachineImpl.h
r57832 r58383 19 19 #define ____H_MACHINEIMPL 20 20 21 #include "AuthLibrary.h" 21 22 #include "VirtualBoxBase.h" 22 23 #include "SnapshotImpl.h" … … 1260 1261 ULONG aVmNetRx, 1261 1262 ULONG aVmNetTx); 1263 HRESULT authenticateExternal(const std::vector<com::Utf8Str> &aAuthParams, 1264 com::Utf8Str &aResult); 1262 1265 }; 1263 1266 … … 1408 1411 ULONG aVmNetRx, 1409 1412 ULONG aVmNetTx); 1413 HRESULT authenticateExternal(const std::vector<com::Utf8Str> &aAuthParams, 1414 com::Utf8Str &aResult); 1410 1415 1411 1416 … … 1510 1515 1511 1516 int miNATNetworksStarted; 1517 1518 AUTHLIBRARYCONTEXT mAuthLibCtx; 1512 1519 }; 1513 1520 -
trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
r58368 r58383 1362 1362 mVRDPBindPort = -1; 1363 1363 1364 #ifndef VBOX_WITH_VRDEAUTH_IN_VBOXSVC 1364 1365 RT_ZERO(mAuthLibCtx); 1366 #endif 1365 1367 1366 1368 mu32AudioInputClientId = 0; … … 3004 3006 } 3005 3007 3008 #ifndef VBOX_WITH_VRDEAUTH_IN_VBOXSVC 3006 3009 AuthLibUnload(&mAuthLibCtx); 3010 #endif 3007 3011 } 3008 3012 … … 3124 3128 3125 3129 AuthResult ConsoleVRDPServer::Authenticate(const Guid &uuid, AuthGuestJudgement guestJudgement, 3126 3127 3130 const char *pszUser, const char *pszPassword, const char *pszDomain, 3131 uint32_t u32ClientId) 3128 3132 { 3129 3133 LogFlowFunc(("uuid = %RTuuid, guestJudgement = %d, pszUser = %s, pszPassword = %s, pszDomain = %s, u32ClientId = %d\n", 3130 3134 uuid.raw(), guestJudgement, pszUser, pszPassword, pszDomain, u32ClientId)); 3131 3135 3136 AuthResult result = AuthResultAccessDenied; 3137 3138 #ifdef VBOX_WITH_VRDEAUTH_IN_VBOXSVC 3139 try 3140 { 3141 /* Init auth parameters. Order is important. */ 3142 SafeArray<BSTR> authParams; 3143 Bstr("VRDEAUTH" ).detachTo(authParams.appendedRaw()); 3144 Bstr(uuid.toUtf16() ).detachTo(authParams.appendedRaw()); 3145 BstrFmt("%u", guestJudgement).detachTo(authParams.appendedRaw()); 3146 Bstr(pszUser ).detachTo(authParams.appendedRaw()); 3147 Bstr(pszPassword ).detachTo(authParams.appendedRaw()); 3148 Bstr(pszDomain ).detachTo(authParams.appendedRaw()); 3149 BstrFmt("%u", u32ClientId).detachTo(authParams.appendedRaw()); 3150 3151 Bstr authResult; 3152 HRESULT hr = mConsole->mControl->AuthenticateExternal(ComSafeArrayAsInParam(authParams), 3153 authResult.asOutParam()); 3154 LogFlowFunc(("%Rhrc [%ls]\n", hr, authResult.raw())); 3155 3156 size_t cbPassword = RTUtf16Len((PRTUTF16)authParams[4]) * sizeof(RTUTF16); 3157 if (cbPassword) 3158 RTMemWipeThoroughly(authParams[4], cbPassword, 10 /* cPasses */); 3159 3160 if (SUCCEEDED(hr) && authResult == "granted") 3161 result = AuthResultAccessGranted; 3162 } 3163 catch (std::bad_alloc) 3164 { 3165 } 3166 #else 3132 3167 /* 3133 3168 * Called only from VRDP input thread. So thread safety is not required. … … 3155 3190 } 3156 3191 3157 AuthResult result = AuthLibAuthenticate(&mAuthLibCtx, 3158 uuid.raw(), guestJudgement, 3159 pszUser, pszPassword, pszDomain, 3160 u32ClientId); 3192 result = AuthLibAuthenticate(&mAuthLibCtx, 3193 uuid.raw(), guestJudgement, 3194 pszUser, pszPassword, pszDomain, 3195 u32ClientId); 3196 #endif /* !VBOX_WITH_VRDEAUTH_IN_VBOXSVC */ 3161 3197 3162 3198 switch (result) … … 3186 3222 uuid.raw(), u32ClientId)); 3187 3223 3224 #ifdef VBOX_WITH_VRDEAUTH_IN_VBOXSVC 3225 try 3226 { 3227 /* Init auth parameters. Order is important. */ 3228 SafeArray<BSTR> authParams; 3229 Bstr("VRDEAUTHDISCONNECT").detachTo(authParams.appendedRaw()); 3230 Bstr(uuid.toUtf16() ).detachTo(authParams.appendedRaw()); 3231 BstrFmt("%u", u32ClientId).detachTo(authParams.appendedRaw()); 3232 3233 Bstr authResult; 3234 HRESULT hr = mConsole->mControl->AuthenticateExternal(ComSafeArrayAsInParam(authParams), 3235 authResult.asOutParam()); 3236 LogFlowFunc(("%Rhrc [%ls]\n", hr, authResult.raw())); NOREF(hr); 3237 } 3238 catch (std::bad_alloc) 3239 { 3240 } 3241 #else 3188 3242 AuthLibDisconnect(&mAuthLibCtx, uuid.raw(), u32ClientId); 3243 #endif /* !VBOX_WITH_VRDEAUTH_IN_VBOXSVC */ 3189 3244 } 3190 3245 -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r58132 r58383 12332 12332 HRESULT rc = S_OK; 12333 12333 12334 RT_ZERO(mAuthLibCtx); 12335 12334 12336 /* create the machine client token */ 12335 12337 try … … 12679 12681 unconst(mParent) = NULL; 12680 12682 unconst(mPeer) = NULL; 12683 12684 AuthLibUnload(&mAuthLibCtx); 12681 12685 12682 12686 LogFlowThisFuncLeave(); … … 13549 13553 } 13550 13554 13555 HRESULT SessionMachine::authenticateExternal(const std::vector<com::Utf8Str> &aAuthParams, 13556 com::Utf8Str &aResult) 13557 { 13558 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 13559 13560 HRESULT hr = S_OK; 13561 13562 if (aAuthParams[0] == "VRDEAUTH" && aAuthParams.size() == 7) 13563 { 13564 enum VRDEAuthParams 13565 { 13566 parmUuid = 1, 13567 parmGuestJudgement, 13568 parmUser, 13569 parmPassword, 13570 parmDomain, 13571 parmClientId 13572 }; 13573 13574 AuthResult result = AuthResultAccessDenied; 13575 13576 if (!mAuthLibCtx.hAuthLibrary) 13577 { 13578 /* Load the external authentication library. */ 13579 Bstr authLibrary; 13580 mVRDEServer->COMGETTER(AuthLibrary)(authLibrary.asOutParam()); 13581 13582 Utf8Str filename = authLibrary; 13583 13584 int rc = AuthLibLoad(&mAuthLibCtx, filename.c_str()); 13585 if (RT_FAILURE(rc)) 13586 { 13587 hr = setError(E_FAIL, 13588 tr("Could not load the external authentication library '%s' (%Rrc)"), 13589 filename.c_str(), rc); 13590 } 13591 } 13592 13593 if (SUCCEEDED(hr)) 13594 { 13595 Guid uuid(aAuthParams[parmUuid]); 13596 AuthGuestJudgement guestJudgement = (AuthGuestJudgement)aAuthParams[parmGuestJudgement].toUInt32(); 13597 uint32_t u32ClientId = aAuthParams[parmClientId].toUInt32(); 13598 13599 result = AuthLibAuthenticate(&mAuthLibCtx, 13600 uuid.raw(), guestJudgement, 13601 aAuthParams[parmUser].c_str(), 13602 aAuthParams[parmPassword].c_str(), 13603 aAuthParams[parmDomain].c_str(), 13604 u32ClientId); 13605 } 13606 13607 /* Hack: aAuthParams[parmPassword] is const but the code believes in writable memory. */ 13608 size_t cbPassword = aAuthParams[parmPassword].length(); 13609 if (cbPassword) 13610 { 13611 RTMemWipeThoroughly((void *)aAuthParams[parmPassword].c_str(), cbPassword, 10 /* cPasses */); 13612 memset((void *)aAuthParams[parmPassword].c_str(), 'x', cbPassword); 13613 } 13614 13615 if (result == AuthResultAccessGranted) 13616 aResult = "granted"; 13617 else 13618 aResult = "denied"; 13619 13620 LogRel(("AUTH: VRDE authentification for user '%s' result '%s'\n", 13621 aAuthParams[parmUser].c_str(), aResult.c_str())); 13622 } 13623 else if (aAuthParams[0] == "VRDEAUTHDISCONNECT" && aAuthParams.size() == 3) 13624 { 13625 enum VRDEAuthDisconnectParams 13626 { 13627 parmUuid = 1, 13628 parmClientId 13629 }; 13630 13631 Guid uuid(aAuthParams[parmUuid]); 13632 uint32_t u32ClientId = 0; 13633 AuthLibDisconnect(&mAuthLibCtx, uuid.raw(), u32ClientId); 13634 } 13635 else 13636 { 13637 hr = E_INVALIDARG; 13638 } 13639 13640 return hr; 13641 } 13642 13551 13643 // public methods only for internal purposes 13552 13644 ///////////////////////////////////////////////////////////////////////////// … … 14779 14871 } 14780 14872 14873 HRESULT Machine::authenticateExternal(const std::vector<com::Utf8Str> &aAuthParams, 14874 com::Utf8Str &aResult) 14875 { 14876 NOREF(aAuthParams); 14877 NOREF(aResult); 14878 ReturnComNotImplemented(); 14879 } 14880 14781 14881 HRESULT Machine::applyDefaults(const com::Utf8Str &aFlags) 14782 14882 {
Note:
See TracChangeset
for help on using the changeset viewer.