diff options
Diffstat (limited to 'src/ext/Util/ca/scauser.cpp')
-rw-r--r-- | src/ext/Util/ca/scauser.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ext/Util/ca/scauser.cpp b/src/ext/Util/ca/scauser.cpp index dc5bebba..b643a842 100644 --- a/src/ext/Util/ca/scauser.cpp +++ b/src/ext/Util/ca/scauser.cpp | |||
@@ -533,13 +533,16 @@ HRESULT ScaUserExecute( | |||
533 | // MSDN says, if we get the above error code, try again with the "DS_FORCE_REDISCOVERY" flag | 533 | // MSDN says, if we get the above error code, try again with the "DS_FORCE_REDISCOVERY" flag |
534 | er = ::DsGetDcNameW(NULL, wzDomain, NULL, NULL, DS_FORCE_REDISCOVERY, &pDomainControllerInfo); | 534 | er = ::DsGetDcNameW(NULL, wzDomain, NULL, NULL, DS_FORCE_REDISCOVERY, &pDomainControllerInfo); |
535 | } | 535 | } |
536 | if (ERROR_SUCCESS == er) | 536 | if (ERROR_SUCCESS == er && pDomainControllerInfo->DomainControllerName) |
537 | { | 537 | { |
538 | if (2 <= wcslen(pDomainControllerInfo->DomainControllerName)) | 538 | // If the \\ prefix on the queried domain was present, skip it. |
539 | if ('\\' == *pDomainControllerInfo->DomainControllerName && '\\' == *pDomainControllerInfo->DomainControllerName + 1) | ||
539 | { | 540 | { |
540 | wzDomain = pDomainControllerInfo->DomainControllerName + 2; // Add 2 so that we don't get the \\ prefix. | 541 | wzDomain = pDomainControllerInfo->DomainControllerName + 2; |
541 | // Pass the entire string if it is too short | 542 | } |
542 | // to have a \\ prefix. | 543 | else |
544 | { | ||
545 | wzDomain = pDomainControllerInfo->DomainControllerName; | ||
543 | } | 546 | } |
544 | } | 547 | } |
545 | } | 548 | } |
@@ -672,7 +675,7 @@ HRESULT ScaUserExecute( | |||
672 | // CustomAction. | 675 | // CustomAction. |
673 | hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RemoveUser"), pwzActionData, COST_USER_DELETE); | 676 | hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RemoveUser"), pwzActionData, COST_USER_DELETE); |
674 | ExitOnFailure(hr, "failed to schedule RemoveUser"); | 677 | ExitOnFailure(hr, "failed to schedule RemoveUser"); |
675 | } | 678 | } |
676 | 679 | ||
677 | ReleaseNullStr(pwzScriptKey); | 680 | ReleaseNullStr(pwzScriptKey); |
678 | ReleaseNullStr(pwzActionData); | 681 | ReleaseNullStr(pwzActionData); |