You've already forked linux-packaging-mono
Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
@ -80,7 +80,11 @@ namespace System.ServiceModel
|
||||
try
|
||||
{
|
||||
downlevelName = windowsIdentity.Name;
|
||||
upnName = GetUpnFromDownlevelName(downlevelName);
|
||||
|
||||
if (this.IsMachineJoinedToDomain())
|
||||
{
|
||||
upnName = GetUpnFromDownlevelName(downlevelName);
|
||||
}
|
||||
}
|
||||
#pragma warning suppress 56500 // covered by FxCOP
|
||||
catch (Exception e)
|
||||
@ -89,13 +93,34 @@ namespace System.ServiceModel
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
DiagnosticUtility.TraceHandledException(e, TraceEventType.Warning);
|
||||
}
|
||||
|
||||
// if the AD cannot be queried for the fully qualified domain name,
|
||||
// fall back to the downlevel UPN name
|
||||
return upnName ?? downlevelName;
|
||||
}
|
||||
|
||||
bool IsMachineJoinedToDomain()
|
||||
{
|
||||
IntPtr pDomainControllerInfo = IntPtr.Zero;
|
||||
|
||||
try
|
||||
{
|
||||
int result = SafeNativeMethods.DsGetDcName(null, null, IntPtr.Zero, null, (uint)DSFlags.DS_DIRECTORY_SERVICE_REQUIRED, out pDomainControllerInfo);
|
||||
|
||||
return result != (int)Win32Error.ERROR_NO_SUCH_DOMAIN;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (pDomainControllerInfo != IntPtr.Zero)
|
||||
{
|
||||
SafeNativeMethods.NetApiBufferFree(pDomainControllerInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Duplicate code from SecurityImpersonationBehavior
|
||||
string GetUpnFromDownlevelName(string downlevelName)
|
||||
{
|
||||
@ -108,6 +133,7 @@ namespace System.ServiceModel
|
||||
{
|
||||
throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new InvalidOperationException(SR.GetString(SR.DownlevelNameCannotMapToUpn, downlevelName)));
|
||||
}
|
||||
|
||||
string shortDomainName = downlevelName.Substring(0, delimiterPos + 1);
|
||||
string userName = downlevelName.Substring(delimiterPos + 1);
|
||||
string fullDomainName;
|
||||
|
Reference in New Issue
Block a user