Changeset 68099 in vbox
- Timestamp:
- Jul 24, 2017 2:32:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxCredProv/VBoxCredProvCredential.cpp
r68098 r68099 516 516 if (RT_SUCCESS(rc)) 517 517 { 518 VBoxCredProvVerbose(0, "VBoxCredProvCredential::RetrieveCredentials: Received credentials for user '%ls'\n", pwszUser); 519 518 520 /* 519 521 * In case we got a "display name" (e.g. "John Doe") … … 521 523 * to translate the data first ... 522 524 */ 523 PWSTR pwszAcount; 524 if (TranslateAccountName(pwszUser, &pwszAcount)) 525 { 526 VBoxCredProvVerbose(0, "VBoxCredProvCredential::RetrieveCredentials: Translated account name %ls -> %ls\n", 527 pwszUser, pwszAcount); 525 PWSTR pwszExtractedName = NULL; 526 if ( TranslateAccountName(pwszUser, &pwszExtractedName) 527 && pwszExtractedName) 528 { 529 VBoxCredProvVerbose(0, "VBoxCredProvCredential::RetrieveCredentials: Translated account name '%ls' -> '%ls'\n", 530 pwszUser, pwszExtractedName); 528 531 529 532 RTMemWipeThoroughly(pwszUser, (RTUtf16Len(pwszUser) + 1) * sizeof(RTUTF16), 3 /* Passes */); 530 533 RTUtf16Free(pwszUser); 531 534 532 pwszUser = pwszAcount; 535 pwszUser = RTUtf16Dup(pwszExtractedName); 536 537 CoTaskMemFree(pwszExtractedName); 538 pwszExtractedName = NULL; 533 539 } 534 540 else … … 539 545 * ([email protected] -> jdoe in domain my-domain.sub.net.com.) 540 546 */ 541 PWSTR pwsz Domain;542 if (ExtractAccoutData(pwszUser, &pwsz Acount, &pwszDomain))547 PWSTR pwszExtractedDomain = NULL; 548 if (ExtractAccoutData(pwszUser, &pwszExtractedName, &pwszExtractedDomain)) 543 549 { 544 550 /* Update user name. */ 545 if (pwsz User)551 if (pwszExtractedName) 546 552 { 547 RTMemWipeThoroughly(pwszUser, (RTUtf16Len(pwszUser) + 1) * sizeof(RTUTF16), 3 /* Passes */); 548 RTUtf16Free(pwszUser); 553 if (pwszUser) 554 { 555 RTMemWipeThoroughly(pwszUser, (RTUtf16Len(pwszUser) + 1) * sizeof(RTUTF16), 3 /* Passes */); 556 RTUtf16Free(pwszUser); 557 } 558 559 pwszUser = RTUtf16Dup(pwszExtractedName); 560 561 CoTaskMemFree(pwszExtractedName); 562 pwszExtractedName = NULL; 549 563 } 550 pwszUser = pwszAcount;551 564 552 565 /* Update domain. */ 553 if (pwsz Domain)566 if (pwszExtractedDomain) 554 567 { 555 RTMemWipeThoroughly(pwszDomain, (RTUtf16Len(pwszDomain) + 1) * sizeof(RTUTF16), 3 /* Passes */); 556 RTUtf16Free(pwszDomain); 568 if (pwszDomain) 569 { 570 RTMemWipeThoroughly(pwszDomain, (RTUtf16Len(pwszDomain) + 1) * sizeof(RTUTF16), 3 /* Passes */); 571 RTUtf16Free(pwszDomain); 572 } 573 574 pwszDomain = RTUtf16Dup(pwszExtractedDomain); 575 576 CoTaskMemFree(pwszExtractedDomain); 577 pwszExtractedDomain = NULL; 557 578 } 558 pwszDomain = pwszDomain; 559 560 VBoxCredProvVerbose(0, "VBoxCredProvCredential::RetrieveCredentials: Extracted account data pwszAccount=%ls, pwszDomain=%ls\n", 561 pwszUser, pwszDomain); 579 580 VBoxCredProvVerbose(0, "VBoxCredProvCredential::RetrieveCredentials: Extracted account name '%ls' + domain '%ls'\n", 581 pwszUser ? pwszUser : L"<NULL>", pwszDomain ? pwszDomain : L"<NULL>"); 562 582 } 563 583 } … … 574 594 setField(VBOXCREDPROV_FIELDID_DOMAINNAME, pwszDomain, true /* fNotifyUI */); 575 595 } 596 597 VBoxCredProvVerbose(0, "VBoxCredProvCredential::RetrieveCredentials: Wiping ...\n"); 576 598 577 599 VbglR3CredentialsDestroyUtf16(pwszUser, pwszPassword, pwszDomain, 3 /* cPasses */); … … 697 719 /** 698 720 * Searches the account name based on a display (real) name (e.g. "John Doe" -> "jdoe"). 699 * Result "ppwszAccoutName" needs to be freed with CoTaskMemFree! 721 * 722 * @return TRUE if translation of the account name was successful, FALSE if not. 723 * @param pwszDisplayName Display name to extract account name from. 724 * @param ppwszAccoutName Where to store the extracted account name on success. 725 * Needs to be free'd with CoTaskMemFree(). 700 726 */ 701 727 BOOL VBoxCredProvCredential::TranslateAccountName(PWSTR pwszDisplayName, PWSTR *ppwszAccoutName) … … 814 840 * 815 841 * This might be a principal or FQDN string. 842 * 843 * @return TRUE if extraction of the account name was successful, FALSE if not. 844 * @param pwszAccountData (Raw) account data string to extract data from. 845 * @param ppwszAccoutName Where to store the extracted account name on success. 846 * Needs to be free'd with CoTaskMemFree(). 847 * @param ppwszDomain Where to store the extracted domain name on success. 848 * Needs to be free'd with CoTaskMemFree(). 816 849 */ 817 850 BOOL VBoxCredProvCredential::ExtractAccoutData(PWSTR pwszAccountData, PWSTR *ppwszAccoutName, PWSTR *ppwszDomain)
Note:
See TracChangeset
for help on using the changeset viewer.