You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -2,6 +2,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.DirectoryServices.Protocols.Tests", "tests\System.DirectoryServices.Protocols.Tests.csproj", "{6638C675-CD62-408F-AB3B-AAFD8A906A96}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{135980AC-4583-44EC-894E-CB3B1A481920} = {135980AC-4583-44EC-894E-CB3B1A481920}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.DirectoryServices.Protocols", "src\System.DirectoryServices.Protocols.csproj", "{135980AC-4583-44EC-894E-CB3B1A481920}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{7DEA4539-9A0D-4801-B229-3824710EBCEE} = {7DEA4539-9A0D-4801-B229-3824710EBCEE}
|
||||
@@ -9,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.DirectoryServices.Pr
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.DirectoryServices.Protocols", "ref\System.DirectoryServices.Protocols.csproj", "{7DEA4539-9A0D-4801-B229-3824710EBCEE}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}"
|
||||
@@ -19,6 +26,10 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6638C675-CD62-408F-AB3B-AAFD8A906A96}.Debug|Any CPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU
|
||||
{6638C675-CD62-408F-AB3B-AAFD8A906A96}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU
|
||||
{6638C675-CD62-408F-AB3B-AAFD8A906A96}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU
|
||||
{6638C675-CD62-408F-AB3B-AAFD8A906A96}.Release|Any CPU.Build.0 = netstandard-Windows_NT-Release|Any CPU
|
||||
{135980AC-4583-44EC-894E-CB3B1A481920}.Debug|Any CPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU
|
||||
{135980AC-4583-44EC-894E-CB3B1A481920}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU
|
||||
{135980AC-4583-44EC-894E-CB3B1A481920}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU
|
||||
@@ -32,6 +43,7 @@ Global
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{6638C675-CD62-408F-AB3B-AAFD8A906A96} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
|
||||
{135980AC-4583-44EC-894E-CB3B1A481920} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD}
|
||||
{7DEA4539-9A0D-4801-B229-3824710EBCEE} = {2E666815-2EDB-464B-9DF6-380BF4789AD4}
|
||||
EndGlobalSection
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<PropertyGroup>
|
||||
<!-- this assembly is inbox in desktop, do not version it unless you
|
||||
plan on shipping a new desktop version out of band. Instead add API
|
||||
to a different assembly. -->
|
||||
<AssemblyVersion>4.0.0.0</AssemblyVersion>
|
||||
<AssemblyKey>MSFT</AssemblyKey>
|
||||
<!-- disable package until https://github.com/dotnet/corefx/issues/18090 is addressed -->
|
||||
<ShouldCreatePackage>false</ShouldCreatePackage>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -38,8 +38,7 @@ namespace System.DirectoryServices.Protocols {
|
||||
public BerConversionException(string message) { }
|
||||
public BerConversionException(string message, System.Exception inner) { }
|
||||
}
|
||||
public sealed partial class BerConverter {
|
||||
internal BerConverter() { }
|
||||
public static partial class BerConverter {
|
||||
public static object[] Decode(string format, byte[] value) { return default(object[]); }
|
||||
public static byte[] Encode(string format, params object[] value) { return default(byte[]); }
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<Compile Include="System.DirectoryServices.Protocols.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\System.DirectoryServices\ref\System.DirectoryServices.csproj" />
|
||||
<ProjectReference Include="..\..\System.Security.Principal.Windows\ref\System.Security.Principal.Windows.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
<Compile Include="FxCopBaseline.AnyOS.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetsWindows)' == 'true'">
|
||||
<Compile Include="System\DirectoryServices\Protocols\externdll.cs" />
|
||||
<Compile Include="System\DirectoryServices\Protocols\common\AuthTypes.cs" />
|
||||
<Compile Include="System\DirectoryServices\Protocols\common\BerConverter.cs" />
|
||||
<Compile Include="System\DirectoryServices\Protocols\common\DereferenceAlias.cs" />
|
||||
@@ -46,7 +45,6 @@
|
||||
<Compile Include="System\DirectoryServices\Protocols\ldap\LdapSessionOptions.cs" />
|
||||
<Compile Include="System\DirectoryServices\Protocols\ldap\SafeHandles.cs" />
|
||||
<Compile Include="System\DirectoryServices\Protocols\ldap\Wldap32UnsafeMethods.cs" />
|
||||
<ProjectReference Include="..\..\System.DirectoryServices\ref\System.DirectoryServices.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Security.AccessControl" />
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace System
|
||||
{
|
||||
internal static class ExternDll
|
||||
{
|
||||
#if FEATURE_PAL && !SILVERLIGHT
|
||||
|
||||
#if !PLATFORM_UNIX
|
||||
internal const String DLLPREFIX = "";
|
||||
internal const String DLLSUFFIX = ".dll";
|
||||
#else // !PLATFORM_UNIX
|
||||
#if __APPLE__
|
||||
internal const String DLLPREFIX = "lib";
|
||||
internal const String DLLSUFFIX = ".dylib";
|
||||
#elif _AIX
|
||||
internal const String DLLPREFIX = "lib";
|
||||
internal const String DLLSUFFIX = ".a";
|
||||
#elif __hppa__ || IA64
|
||||
internal const String DLLPREFIX = "lib";
|
||||
internal const String DLLSUFFIX = ".sl";
|
||||
#else
|
||||
internal const String DLLPREFIX = "lib";
|
||||
internal const String DLLSUFFIX = ".so";
|
||||
#endif
|
||||
#endif // !PLATFORM_UNIX
|
||||
|
||||
public const string Kernel32 = DLLPREFIX + "rotor_pal" + DLLSUFFIX;
|
||||
public const string User32 = DLLPREFIX + "rotor_pal" + DLLSUFFIX;
|
||||
public const string Mscoree = DLLPREFIX + "sscoree" + DLLSUFFIX;
|
||||
|
||||
#elif FEATURE_PAL && SILVERLIGHT
|
||||
|
||||
public const string Kernel32 = "coreclr";
|
||||
public const string User32 = "coreclr";
|
||||
|
||||
#else
|
||||
public const string Activeds = "activeds.dll";
|
||||
public const string Advapi32 = "advapi32.dll";
|
||||
public const string Comctl32 = "comctl32.dll";
|
||||
public const string Comdlg32 = "comdlg32.dll";
|
||||
public const string Gdi32 = "gdi32.dll";
|
||||
public const string Gdiplus = "gdiplus.dll";
|
||||
public const string Hhctrl = "hhctrl.ocx";
|
||||
public const string Imm32 = "imm32.dll";
|
||||
public const string Kernel32 = "kernel32.dll";
|
||||
public const string Loadperf = "Loadperf.dll";
|
||||
public const string Mscoree = "mscoree.dll";
|
||||
public const string Clr = "clr.dll";
|
||||
public const string Msi = "msi.dll";
|
||||
public const string Mqrt = "mqrt.dll";
|
||||
public const string Ntdll = "ntdll.dll";
|
||||
public const string Ole32 = "ole32.dll";
|
||||
public const string Oleacc = "oleacc.dll";
|
||||
public const string Oleaut32 = "oleaut32.dll";
|
||||
public const string Olepro32 = "olepro32.dll";
|
||||
public const string PerfCounter = "perfcounter.dll";
|
||||
public const string Powrprof = "Powrprof.dll";
|
||||
public const string Psapi = "psapi.dll";
|
||||
public const string Shell32 = "shell32.dll";
|
||||
public const string User32 = "user32.dll";
|
||||
public const string Uxtheme = "uxtheme.dll";
|
||||
public const string WinMM = "winmm.dll";
|
||||
public const string Winspool = "winspool.drv";
|
||||
public const string Wtsapi32 = "wtsapi32.dll";
|
||||
public const string Version = "version.dll";
|
||||
public const string Vsassert = "vsassert.dll";
|
||||
public const string Fxassert = "Fxassert.dll";
|
||||
public const string Shlwapi = "shlwapi.dll";
|
||||
public const string Crypt32 = "crypt32.dll";
|
||||
|
||||
// system.data specific
|
||||
internal const string Odbc32 = "odbc32.dll";
|
||||
internal const string SNI = "System.Data.dll";
|
||||
|
||||
// system.data.oracleclient specific
|
||||
internal const string OciDll = "oci.dll";
|
||||
internal const string OraMtsDll = "oramts.dll";
|
||||
#endif //!FEATURE_PAL
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
|
||||
namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
using System;
|
||||
|
||||
public enum AuthType
|
||||
{
|
||||
Anonymous = 0,
|
||||
|
||||
@@ -2,19 +2,16 @@
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
|
||||
namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
|
||||
public sealed class BerConverter
|
||||
public static class BerConverter
|
||||
{
|
||||
private BerConverter() { }
|
||||
|
||||
public static byte[] Encode(string format, params object[] value)
|
||||
{
|
||||
if (format == null)
|
||||
@@ -217,7 +214,7 @@ namespace System.DirectoryServices.Protocols
|
||||
|
||||
// get the binary value back
|
||||
berval binaryValue = new berval();
|
||||
IntPtr flattenptr = (IntPtr)0;
|
||||
IntPtr flattenptr = IntPtr.Zero;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -231,7 +228,7 @@ namespace System.DirectoryServices.Protocols
|
||||
throw new BerConversionException();
|
||||
}
|
||||
|
||||
if (flattenptr != (IntPtr)0)
|
||||
if (flattenptr != IntPtr.Zero)
|
||||
{
|
||||
Marshal.PtrToStructure(flattenptr, binaryValue);
|
||||
}
|
||||
@@ -249,7 +246,7 @@ namespace System.DirectoryServices.Protocols
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (flattenptr != (IntPtr)0)
|
||||
if (flattenptr != IntPtr.Zero)
|
||||
Wldap32.ber_bvfree(flattenptr);
|
||||
}
|
||||
|
||||
@@ -284,7 +281,7 @@ namespace System.DirectoryServices.Protocols
|
||||
if (value == null)
|
||||
{
|
||||
berValue.bv_len = 0;
|
||||
berValue.bv_val = (IntPtr)0;
|
||||
berValue.bv_val = IntPtr.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -299,7 +296,7 @@ namespace System.DirectoryServices.Protocols
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (berValue.bv_val != (IntPtr)0)
|
||||
if (berValue.bv_val != IntPtr.Zero)
|
||||
Marshal.FreeHGlobal(berValue.bv_val);
|
||||
}
|
||||
|
||||
@@ -366,14 +363,14 @@ namespace System.DirectoryServices.Protocols
|
||||
else if (fmt == 'B')
|
||||
{
|
||||
// return a bitstring and its length
|
||||
IntPtr ptrResult = (IntPtr)0;
|
||||
IntPtr ptrResult = IntPtr.Zero;
|
||||
int length = 0;
|
||||
error = Wldap32.ber_scanf_bitstring(berElement, "B", ref ptrResult, ref length);
|
||||
|
||||
if (error == 0)
|
||||
{
|
||||
byte[] byteArray = null;
|
||||
if (ptrResult != (IntPtr)0)
|
||||
if (ptrResult != IntPtr.Zero)
|
||||
{
|
||||
byteArray = new byte[length];
|
||||
Marshal.Copy(ptrResult, byteArray, 0, length);
|
||||
@@ -462,7 +459,7 @@ namespace System.DirectoryServices.Protocols
|
||||
}
|
||||
else
|
||||
{
|
||||
error = Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), new HGlobalMemHandle((IntPtr)0), 0);
|
||||
error = Wldap32.ber_printf_bytearray(berElement, new string(fmt, 1), new HGlobalMemHandle(IntPtr.Zero), 0);
|
||||
}
|
||||
|
||||
return error;
|
||||
@@ -471,7 +468,7 @@ namespace System.DirectoryServices.Protocols
|
||||
private static byte[] DecodingByteArrayHelper(BerSafeHandle berElement, char fmt, ref int error)
|
||||
{
|
||||
error = 0;
|
||||
IntPtr result = (IntPtr)0;
|
||||
IntPtr result = IntPtr.Zero;
|
||||
berval binaryValue = new berval();
|
||||
byte[] byteArray = null;
|
||||
|
||||
@@ -483,7 +480,7 @@ namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
if (error == 0)
|
||||
{
|
||||
if (result != (IntPtr)0)
|
||||
if (result != IntPtr.Zero)
|
||||
{
|
||||
Marshal.PtrToStructure(result, binaryValue);
|
||||
|
||||
@@ -496,7 +493,7 @@ namespace System.DirectoryServices.Protocols
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (result != (IntPtr)0)
|
||||
if (result != IntPtr.Zero)
|
||||
Wldap32.ber_bvfree(result);
|
||||
}
|
||||
|
||||
@@ -505,8 +502,8 @@ namespace System.DirectoryServices.Protocols
|
||||
|
||||
private static int EncodingMultiByteArrayHelper(BerSafeHandle berElement, byte[][] tempValue, char fmt)
|
||||
{
|
||||
IntPtr berValArray = (IntPtr)0;
|
||||
IntPtr tempPtr = (IntPtr)0;
|
||||
IntPtr berValArray = IntPtr.Zero;
|
||||
IntPtr tempPtr = IntPtr.Zero;
|
||||
SafeBerval[] managedBerVal = null;
|
||||
int error = 0;
|
||||
|
||||
@@ -529,7 +526,7 @@ namespace System.DirectoryServices.Protocols
|
||||
if (byteArray == null)
|
||||
{
|
||||
managedBerVal[i].bv_len = 0;
|
||||
managedBerVal[i].bv_val = (IntPtr)0;
|
||||
managedBerVal[i].bv_val = IntPtr.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -547,7 +544,7 @@ namespace System.DirectoryServices.Protocols
|
||||
}
|
||||
|
||||
tempPtr = (IntPtr)((long)berValArray + IntPtr.Size * i);
|
||||
Marshal.WriteIntPtr(tempPtr, (IntPtr)0);
|
||||
Marshal.WriteIntPtr(tempPtr, IntPtr.Zero);
|
||||
}
|
||||
|
||||
error = Wldap32.ber_printf_berarray(berElement, new string(fmt, 1), berValArray);
|
||||
@@ -556,12 +553,12 @@ namespace System.DirectoryServices.Protocols
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (berValArray != (IntPtr)0)
|
||||
if (berValArray != IntPtr.Zero)
|
||||
{
|
||||
for (int i = 0; i < tempValue.Length; i++)
|
||||
{
|
||||
IntPtr ptr = Marshal.ReadIntPtr(berValArray, IntPtr.Size * i);
|
||||
if (ptr != (IntPtr)0)
|
||||
if (ptr != IntPtr.Zero)
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
}
|
||||
Marshal.FreeHGlobal(berValArray);
|
||||
@@ -575,10 +572,10 @@ namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
error = 0;
|
||||
// several berval
|
||||
IntPtr ptrResult = (IntPtr)0;
|
||||
IntPtr ptrResult = IntPtr.Zero;
|
||||
int i = 0;
|
||||
ArrayList binaryList = new ArrayList();
|
||||
IntPtr tempPtr = (IntPtr)0;
|
||||
IntPtr tempPtr = IntPtr.Zero;
|
||||
byte[][] result = null;
|
||||
|
||||
try
|
||||
@@ -587,10 +584,10 @@ namespace System.DirectoryServices.Protocols
|
||||
|
||||
if (error == 0)
|
||||
{
|
||||
if (ptrResult != (IntPtr)0)
|
||||
if (ptrResult != IntPtr.Zero)
|
||||
{
|
||||
tempPtr = Marshal.ReadIntPtr(ptrResult);
|
||||
while (tempPtr != (IntPtr)0)
|
||||
while (tempPtr != IntPtr.Zero)
|
||||
{
|
||||
berval ber = new berval();
|
||||
Marshal.PtrToStructure(tempPtr, ber);
|
||||
@@ -616,7 +613,7 @@ namespace System.DirectoryServices.Protocols
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (ptrResult != (IntPtr)0)
|
||||
if (ptrResult != IntPtr.Zero)
|
||||
{
|
||||
Wldap32.ber_bvecfree(ptrResult);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,60 +2,36 @@
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
using System;
|
||||
using System.DirectoryServices;
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Security.Permissions;
|
||||
|
||||
public abstract class DirectoryConnection
|
||||
{
|
||||
//
|
||||
// Private/protected
|
||||
//
|
||||
internal NetworkCredential directoryCredential = null;
|
||||
internal X509CertificateCollection certificatesCollection = null;
|
||||
internal TimeSpan connectionTimeOut = new TimeSpan(0, 0, 30);
|
||||
internal DirectoryIdentifier directoryIdentifier = null;
|
||||
internal NetworkCredential _directoryCredential;
|
||||
private X509CertificateCollection _certificatesCollection;
|
||||
internal TimeSpan _connectionTimeOut = new TimeSpan(0, 0, 30);
|
||||
internal DirectoryIdentifier _directoryIdentifier;
|
||||
|
||||
protected DirectoryConnection()
|
||||
{
|
||||
certificatesCollection = new X509CertificateCollection();
|
||||
}
|
||||
protected DirectoryConnection() => _certificatesCollection = new X509CertificateCollection();
|
||||
|
||||
public virtual DirectoryIdentifier Directory
|
||||
{
|
||||
get
|
||||
{
|
||||
return directoryIdentifier;
|
||||
}
|
||||
}
|
||||
public virtual DirectoryIdentifier Directory => _directoryIdentifier;
|
||||
|
||||
public X509CertificateCollection ClientCertificates
|
||||
{
|
||||
get
|
||||
{
|
||||
return certificatesCollection;
|
||||
}
|
||||
}
|
||||
public X509CertificateCollection ClientCertificates => _certificatesCollection;
|
||||
|
||||
public virtual TimeSpan Timeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return connectionTimeOut;
|
||||
}
|
||||
get => _connectionTimeOut;
|
||||
set
|
||||
{
|
||||
if (value < TimeSpan.Zero)
|
||||
{
|
||||
throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, SR.NoNegativeTime), "value");
|
||||
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, SR.NoNegativeTime), nameof(value));
|
||||
}
|
||||
|
||||
connectionTimeOut = value;
|
||||
_connectionTimeOut = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,15 +39,12 @@ namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
set
|
||||
{
|
||||
directoryCredential = (value != null) ? new NetworkCredential(value.UserName, value.Password, value.Domain) : null;
|
||||
_directoryCredential = (value != null) ? new NetworkCredential(value.UserName, value.Password, value.Domain) : null;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract DirectoryResponse SendRequest(DirectoryRequest request);
|
||||
|
||||
internal NetworkCredential GetCredential()
|
||||
{
|
||||
return directoryCredential;
|
||||
}
|
||||
internal NetworkCredential GetCredential() => _directoryCredential;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,12 +2,12 @@
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Security.Permissions;
|
||||
|
||||
[Serializable]
|
||||
public class DirectoryException : Exception
|
||||
{
|
||||
@@ -32,11 +32,7 @@ namespace System.DirectoryServices.Protocols
|
||||
[Serializable]
|
||||
public class DirectoryOperationException : DirectoryException, ISerializable
|
||||
{
|
||||
internal DirectoryResponse response = null;
|
||||
protected DirectoryOperationException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
protected DirectoryOperationException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||
|
||||
public DirectoryOperationException() : base() { }
|
||||
|
||||
@@ -44,29 +40,23 @@ namespace System.DirectoryServices.Protocols
|
||||
|
||||
public DirectoryOperationException(string message, Exception inner) : base(message, inner) { }
|
||||
|
||||
public DirectoryOperationException(DirectoryResponse response) : base(String.Format(CultureInfo.CurrentCulture, SR.DefaultOperationsError))
|
||||
public DirectoryOperationException(DirectoryResponse response) : base(SR.DefaultOperationsError)
|
||||
{
|
||||
this.response = response;
|
||||
Response = response;
|
||||
}
|
||||
|
||||
public DirectoryOperationException(DirectoryResponse response, string message) : base(message)
|
||||
{
|
||||
this.response = response;
|
||||
Response = response;
|
||||
}
|
||||
|
||||
public DirectoryOperationException(DirectoryResponse response, string message, Exception inner) : base(message, inner)
|
||||
{
|
||||
this.response = response;
|
||||
Response = response;
|
||||
}
|
||||
|
||||
public DirectoryResponse Response
|
||||
{
|
||||
get
|
||||
{
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
public DirectoryResponse Response { get; internal set; }
|
||||
|
||||
public override void GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
{
|
||||
base.GetObjectData(serializationInfo, streamingContext);
|
||||
@@ -76,12 +66,9 @@ namespace System.DirectoryServices.Protocols
|
||||
[Serializable]
|
||||
public class BerConversionException : DirectoryException
|
||||
{
|
||||
protected BerConversionException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
protected BerConversionException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
||||
|
||||
public BerConversionException() : base(String.Format(CultureInfo.CurrentCulture, SR.BerConversionError))
|
||||
public BerConversionException() : base(SR.BerConversionError)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
|
||||
namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
using System;
|
||||
|
||||
public abstract class DirectoryIdentifier
|
||||
{
|
||||
protected DirectoryIdentifier()
|
||||
|
||||
@@ -4,12 +4,9 @@
|
||||
|
||||
namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
using System;
|
||||
using System.Xml;
|
||||
|
||||
public abstract class DirectoryOperation
|
||||
{
|
||||
internal string directoryRequestID = null;
|
||||
internal string _directoryRequestID;
|
||||
|
||||
protected DirectoryOperation() { }
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,104 +4,64 @@
|
||||
|
||||
namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
|
||||
public abstract class DirectoryResponse : DirectoryOperation
|
||||
{
|
||||
internal string dn = null;
|
||||
internal DirectoryControl[] directoryControls = null;
|
||||
internal ResultCode result = (ResultCode)(-1);
|
||||
internal string directoryMessage = null;
|
||||
internal Uri[] directoryReferral = null;
|
||||
|
||||
private string _requestID = null;
|
||||
private DirectoryControl[] _directoryControls;
|
||||
internal Uri[] _directoryReferral;
|
||||
|
||||
internal DirectoryResponse(string dn, DirectoryControl[] controls, ResultCode result, string message, Uri[] referral)
|
||||
{
|
||||
this.dn = dn;
|
||||
this.directoryControls = controls;
|
||||
this.result = result;
|
||||
this.directoryMessage = message;
|
||||
this.directoryReferral = referral;
|
||||
MatchedDN = dn;
|
||||
_directoryControls = controls;
|
||||
ResultCode = result;
|
||||
ErrorMessage = message;
|
||||
_directoryReferral = referral;
|
||||
}
|
||||
|
||||
public string RequestId
|
||||
{
|
||||
get
|
||||
{
|
||||
return _requestID;
|
||||
}
|
||||
}
|
||||
public string RequestId { get; }
|
||||
|
||||
public virtual string MatchedDN
|
||||
{
|
||||
get
|
||||
{
|
||||
return dn;
|
||||
}
|
||||
}
|
||||
public virtual string MatchedDN { get; }
|
||||
|
||||
public virtual DirectoryControl[] Controls
|
||||
{
|
||||
get
|
||||
{
|
||||
if (directoryControls == null)
|
||||
return new DirectoryControl[0];
|
||||
else
|
||||
if (_directoryControls == null)
|
||||
{
|
||||
DirectoryControl[] tempControls = new DirectoryControl[directoryControls.Length];
|
||||
for (int i = 0; i < directoryControls.Length; i++)
|
||||
tempControls[i] = new DirectoryControl(directoryControls[i].Type, directoryControls[i].GetValue(), directoryControls[i].IsCritical, directoryControls[i].ServerSide);
|
||||
|
||||
DirectoryControl.TransformControls(tempControls);
|
||||
|
||||
return tempControls;
|
||||
return Array.Empty<DirectoryControl>();
|
||||
}
|
||||
|
||||
DirectoryControl[] tempControls = new DirectoryControl[_directoryControls.Length];
|
||||
for (int i = 0; i < _directoryControls.Length; i++)
|
||||
{
|
||||
tempControls[i] = new DirectoryControl(_directoryControls[i].Type, _directoryControls[i].GetValue(), _directoryControls[i].IsCritical, _directoryControls[i].ServerSide);
|
||||
}
|
||||
DirectoryControl.TransformControls(tempControls);
|
||||
return tempControls;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ResultCode ResultCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
public virtual ResultCode ResultCode { get; }
|
||||
|
||||
public virtual string ErrorMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
return directoryMessage;
|
||||
}
|
||||
}
|
||||
public virtual string ErrorMessage { get; }
|
||||
|
||||
public virtual Uri[] Referral
|
||||
{
|
||||
get
|
||||
{
|
||||
if (directoryReferral == null)
|
||||
return new Uri[0];
|
||||
else
|
||||
if (_directoryReferral == null)
|
||||
{
|
||||
Uri[] tempReferral = new Uri[directoryReferral.Length];
|
||||
for (int i = 0; i < directoryReferral.Length; i++)
|
||||
{
|
||||
tempReferral[i] = new Uri(directoryReferral[i].AbsoluteUri);
|
||||
}
|
||||
return tempReferral;
|
||||
return Array.Empty<Uri>();
|
||||
}
|
||||
|
||||
Uri[] tempReferral = new Uri[_directoryReferral.Length];
|
||||
for (int i = 0; i < _directoryReferral.Length; i++)
|
||||
{
|
||||
tempReferral[i] = new Uri(_directoryReferral[i].AbsoluteUri);
|
||||
}
|
||||
return tempReferral;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Private/protected
|
||||
//
|
||||
}
|
||||
|
||||
public class DeleteResponse : DirectoryResponse
|
||||
@@ -109,77 +69,51 @@ namespace System.DirectoryServices.Protocols
|
||||
internal DeleteResponse(string dn, DirectoryControl[] controls, ResultCode result, string message, Uri[] referral) : base(dn, controls, result, message, referral) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The AddResponse class for representing <addResponse>
|
||||
/// </summary>
|
||||
public class AddResponse : DirectoryResponse
|
||||
{
|
||||
internal AddResponse(string dn, DirectoryControl[] controls, ResultCode result, string message, Uri[] referral) : base(dn, controls, result, message, referral) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The ModifyResponse class for representing <modifyResponse>
|
||||
/// </summary>
|
||||
public class ModifyResponse : DirectoryResponse
|
||||
{
|
||||
internal ModifyResponse(string dn, DirectoryControl[] controls, ResultCode result, string message, Uri[] referral) : base(dn, controls, result, message, referral) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The ModifyDnResponse class for representing <modDNResponse>
|
||||
/// </summary>
|
||||
public class ModifyDNResponse : DirectoryResponse
|
||||
{
|
||||
internal ModifyDNResponse(string dn, DirectoryControl[] controls, ResultCode result, string message, Uri[] referral) : base(dn, controls, result, message, referral) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The CompareResponse class for representing <compareResponse>
|
||||
/// </summary>
|
||||
public class CompareResponse : DirectoryResponse
|
||||
{
|
||||
internal CompareResponse(string dn, DirectoryControl[] controls, ResultCode result, string message, Uri[] referral) : base(dn, controls, result, message, referral) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The ExtendedResponse class for representing <extendedResponse>
|
||||
/// </summary>
|
||||
public class ExtendedResponse : DirectoryResponse
|
||||
{
|
||||
internal string name = null;
|
||||
internal byte[] value = null;
|
||||
private byte[] _value;
|
||||
|
||||
internal ExtendedResponse(string dn, DirectoryControl[] controls, ResultCode result, string message, Uri[] referral) : base(dn, controls, result, message, referral) { }
|
||||
|
||||
//
|
||||
// Public
|
||||
//
|
||||
|
||||
// Properties
|
||||
public string ResponseName
|
||||
{
|
||||
get
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
public string ResponseName { get; internal set; }
|
||||
|
||||
public byte[] ResponseValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (value == null)
|
||||
return new byte[0];
|
||||
else
|
||||
if (_value == null)
|
||||
{
|
||||
byte[] tmpValue = new byte[value.Length];
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
{
|
||||
tmpValue[i] = value[i];
|
||||
}
|
||||
return tmpValue;
|
||||
return Array.Empty<byte>();
|
||||
}
|
||||
|
||||
byte[] tmpValue = new byte[_value.Length];
|
||||
for (int i = 0; i < _value.Length; i++)
|
||||
{
|
||||
tmpValue[i] = _value[i];
|
||||
}
|
||||
return tmpValue;
|
||||
}
|
||||
internal set => _value = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,95 +124,16 @@ namespace System.DirectoryServices.Protocols
|
||||
internal bool searchDone = false;
|
||||
internal SearchResponse(string dn, DirectoryControl[] controls, ResultCode result, string message, Uri[] referral) : base(dn, controls, result, message, referral) { }
|
||||
|
||||
public override string MatchedDN
|
||||
{
|
||||
get
|
||||
{
|
||||
return dn;
|
||||
}
|
||||
}
|
||||
|
||||
public override DirectoryControl[] Controls
|
||||
{
|
||||
get
|
||||
{
|
||||
DirectoryControl[] controls = null;
|
||||
|
||||
if (directoryControls == null)
|
||||
return new DirectoryControl[0];
|
||||
else
|
||||
{
|
||||
controls = new DirectoryControl[directoryControls.Length];
|
||||
for (int i = 0; i < directoryControls.Length; i++)
|
||||
{
|
||||
controls[i] = new DirectoryControl(directoryControls[i].Type, directoryControls[i].GetValue(), directoryControls[i].IsCritical, directoryControls[i].ServerSide);
|
||||
}
|
||||
}
|
||||
|
||||
DirectoryControl.TransformControls(controls);
|
||||
|
||||
return controls;
|
||||
}
|
||||
}
|
||||
|
||||
public override ResultCode ResultCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ErrorMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
return directoryMessage;
|
||||
}
|
||||
}
|
||||
|
||||
public override Uri[] Referral
|
||||
{
|
||||
get
|
||||
{
|
||||
if (directoryReferral == null)
|
||||
return new Uri[0];
|
||||
else
|
||||
{
|
||||
Uri[] tempReferral = new Uri[directoryReferral.Length];
|
||||
for (int i = 0; i < directoryReferral.Length; i++)
|
||||
{
|
||||
tempReferral[i] = new Uri(directoryReferral[i].AbsoluteUri);
|
||||
}
|
||||
return tempReferral;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SearchResultReferenceCollection References
|
||||
{
|
||||
get
|
||||
{
|
||||
return _referenceCollection;
|
||||
}
|
||||
get => _referenceCollection;
|
||||
internal set => _referenceCollection = value;
|
||||
}
|
||||
|
||||
public SearchResultEntryCollection Entries
|
||||
{
|
||||
get
|
||||
{
|
||||
return _entryCollection;
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetReferences(SearchResultReferenceCollection col)
|
||||
{
|
||||
_referenceCollection = col;
|
||||
}
|
||||
|
||||
internal void SetEntries(SearchResultEntryCollection col)
|
||||
{
|
||||
_entryCollection = col;
|
||||
get => _entryCollection;
|
||||
internal set => _entryCollection = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,41 +2,22 @@
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections;
|
||||
|
||||
namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
public class PartialResultsCollection : ReadOnlyCollectionBase
|
||||
{
|
||||
internal PartialResultsCollection() { }
|
||||
|
||||
public object this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return InnerList[index];
|
||||
}
|
||||
}
|
||||
public object this[int index] => InnerList[index];
|
||||
|
||||
internal int Add(object value)
|
||||
{
|
||||
return InnerList.Add(value);
|
||||
}
|
||||
internal int Add(object value) => InnerList.Add(value);
|
||||
|
||||
public bool Contains(object value)
|
||||
{
|
||||
return InnerList.Contains(value);
|
||||
}
|
||||
public bool Contains(object value) => InnerList.Contains(value);
|
||||
|
||||
public int IndexOf(object value)
|
||||
{
|
||||
return InnerList.IndexOf(value);
|
||||
}
|
||||
public int IndexOf(object value) => InnerList.IndexOf(value);
|
||||
|
||||
public void CopyTo(object[] values, int index)
|
||||
{
|
||||
InnerList.CopyTo(values, index);
|
||||
}
|
||||
public void CopyTo(object[] values, int index) => InnerList.CopyTo(values, index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,3 @@ namespace System.DirectoryServices.Protocols
|
||||
All = Subordinate | External
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
||||
public enum ResultCode
|
||||
{
|
||||
Success = 0,
|
||||
@@ -57,60 +55,57 @@ namespace System.DirectoryServices.Protocols
|
||||
|
||||
internal class OperationErrorMappings
|
||||
{
|
||||
private static Hashtable s_resultCodeHash = null;
|
||||
|
||||
static OperationErrorMappings()
|
||||
private static readonly Dictionary<ResultCode, string> s_resultCodeMapping = new Dictionary<ResultCode, string>(capacity: 43)
|
||||
{
|
||||
s_resultCodeHash = new Hashtable();
|
||||
{ ResultCode.Success, SR.LDAP_SUCCESS },
|
||||
{ ResultCode.OperationsError, SR.LDAP_OPERATIONS_ERROR },
|
||||
{ ResultCode.ProtocolError, SR.LDAP_PROTOCOL_ERROR },
|
||||
{ ResultCode.TimeLimitExceeded, SR.LDAP_TIMELIMIT_EXCEEDED },
|
||||
{ ResultCode.SizeLimitExceeded, SR.LDAP_SIZELIMIT_EXCEEDED },
|
||||
{ ResultCode.CompareFalse, SR.LDAP_COMPARE_FALSE },
|
||||
{ ResultCode.CompareTrue, SR.LDAP_COMPARE_TRUE },
|
||||
{ ResultCode.AuthMethodNotSupported, SR.LDAP_AUTH_METHOD_NOT_SUPPORTED },
|
||||
{ ResultCode.StrongAuthRequired, SR.LDAP_STRONG_AUTH_REQUIRED },
|
||||
{ ResultCode.ReferralV2, SR.LDAP_PARTIAL_RESULTS },
|
||||
{ ResultCode.Referral, SR.LDAP_REFERRAL },
|
||||
{ ResultCode.AdminLimitExceeded, SR.LDAP_ADMIN_LIMIT_EXCEEDED },
|
||||
{ ResultCode.UnavailableCriticalExtension, SR.LDAP_UNAVAILABLE_CRIT_EXTENSION },
|
||||
{ ResultCode.ConfidentialityRequired, SR.LDAP_CONFIDENTIALITY_REQUIRED },
|
||||
{ ResultCode.SaslBindInProgress, SR.LDAP_SASL_BIND_IN_PROGRESS },
|
||||
{ ResultCode.NoSuchAttribute, SR.LDAP_NO_SUCH_ATTRIBUTE },
|
||||
{ ResultCode.UndefinedAttributeType, SR.LDAP_UNDEFINED_TYPE },
|
||||
{ ResultCode.InappropriateMatching, SR.LDAP_INAPPROPRIATE_MATCHING },
|
||||
{ ResultCode.ConstraintViolation, SR.LDAP_CONSTRAINT_VIOLATION },
|
||||
{ ResultCode.AttributeOrValueExists, SR.LDAP_ATTRIBUTE_OR_VALUE_EXISTS },
|
||||
{ ResultCode.InvalidAttributeSyntax, SR.LDAP_INVALID_SYNTAX },
|
||||
{ ResultCode.NoSuchObject, SR.LDAP_NO_SUCH_OBJECT },
|
||||
{ ResultCode.AliasProblem, SR.LDAP_ALIAS_PROBLEM },
|
||||
{ ResultCode.InvalidDNSyntax, SR.LDAP_INVALID_DN_SYNTAX },
|
||||
{ ResultCode.AliasDereferencingProblem, SR.LDAP_ALIAS_DEREF_PROBLEM },
|
||||
{ ResultCode.InappropriateAuthentication, SR.LDAP_INAPPROPRIATE_AUTH },
|
||||
{ ResultCode.InsufficientAccessRights, SR.LDAP_INSUFFICIENT_RIGHTS },
|
||||
{ ResultCode.Busy, SR.LDAP_BUSY },
|
||||
{ ResultCode.Unavailable, SR.LDAP_UNAVAILABLE },
|
||||
{ ResultCode.UnwillingToPerform, SR.LDAP_UNWILLING_TO_PERFORM },
|
||||
{ ResultCode.LoopDetect, SR.LDAP_LOOP_DETECT },
|
||||
{ ResultCode.SortControlMissing, SR.LDAP_SORT_CONTROL_MISSING },
|
||||
{ ResultCode.OffsetRangeError, SR.LDAP_OFFSET_RANGE_ERROR },
|
||||
{ ResultCode.NamingViolation, SR.LDAP_NAMING_VIOLATION },
|
||||
{ ResultCode.ObjectClassViolation, SR.LDAP_OBJECT_CLASS_VIOLATION },
|
||||
{ ResultCode.NotAllowedOnNonLeaf, SR.LDAP_NOT_ALLOWED_ON_NONLEAF },
|
||||
{ ResultCode.NotAllowedOnRdn, SR.LDAP_NOT_ALLOWED_ON_RDN },
|
||||
{ ResultCode.EntryAlreadyExists, SR.LDAP_ALREADY_EXISTS },
|
||||
{ ResultCode.ObjectClassModificationsProhibited, SR.LDAP_NO_OBJECT_CLASS_MODS },
|
||||
{ ResultCode.ResultsTooLarge, SR.LDAP_RESULTS_TOO_LARGE },
|
||||
{ ResultCode.AffectsMultipleDsas, SR.LDAP_AFFECTS_MULTIPLE_DSAS },
|
||||
{ ResultCode.VirtualListViewError, SR.LDAP_VIRTUAL_LIST_VIEW_ERROR },
|
||||
{ ResultCode.Other, SR.LDAP_OTHER }
|
||||
};
|
||||
|
||||
s_resultCodeHash.Add(ResultCode.Success, String.Format(CultureInfo.CurrentCulture, SR.LDAP_SUCCESS));
|
||||
s_resultCodeHash.Add(ResultCode.OperationsError, String.Format(CultureInfo.CurrentCulture, SR.LDAP_OPERATIONS_ERROR));
|
||||
s_resultCodeHash.Add(ResultCode.ProtocolError, String.Format(CultureInfo.CurrentCulture, SR.LDAP_PROTOCOL_ERROR));
|
||||
s_resultCodeHash.Add(ResultCode.TimeLimitExceeded, String.Format(CultureInfo.CurrentCulture, SR.LDAP_TIMELIMIT_EXCEEDED));
|
||||
s_resultCodeHash.Add(ResultCode.SizeLimitExceeded, String.Format(CultureInfo.CurrentCulture, SR.LDAP_SIZELIMIT_EXCEEDED));
|
||||
s_resultCodeHash.Add(ResultCode.CompareFalse, String.Format(CultureInfo.CurrentCulture, SR.LDAP_COMPARE_FALSE));
|
||||
s_resultCodeHash.Add(ResultCode.CompareTrue, String.Format(CultureInfo.CurrentCulture, SR.LDAP_COMPARE_TRUE));
|
||||
s_resultCodeHash.Add(ResultCode.AuthMethodNotSupported, String.Format(CultureInfo.CurrentCulture, SR.LDAP_AUTH_METHOD_NOT_SUPPORTED));
|
||||
s_resultCodeHash.Add(ResultCode.StrongAuthRequired, String.Format(CultureInfo.CurrentCulture, SR.LDAP_STRONG_AUTH_REQUIRED));
|
||||
s_resultCodeHash.Add(ResultCode.ReferralV2, String.Format(CultureInfo.CurrentCulture, SR.LDAP_PARTIAL_RESULTS));
|
||||
s_resultCodeHash.Add(ResultCode.Referral, String.Format(CultureInfo.CurrentCulture, SR.LDAP_REFERRAL));
|
||||
s_resultCodeHash.Add(ResultCode.AdminLimitExceeded, String.Format(CultureInfo.CurrentCulture, SR.LDAP_ADMIN_LIMIT_EXCEEDED));
|
||||
s_resultCodeHash.Add(ResultCode.UnavailableCriticalExtension, String.Format(CultureInfo.CurrentCulture, SR.LDAP_UNAVAILABLE_CRIT_EXTENSION));
|
||||
s_resultCodeHash.Add(ResultCode.ConfidentialityRequired, String.Format(CultureInfo.CurrentCulture, SR.LDAP_CONFIDENTIALITY_REQUIRED));
|
||||
s_resultCodeHash.Add(ResultCode.SaslBindInProgress, String.Format(CultureInfo.CurrentCulture, SR.LDAP_SASL_BIND_IN_PROGRESS));
|
||||
s_resultCodeHash.Add(ResultCode.NoSuchAttribute, String.Format(CultureInfo.CurrentCulture, SR.LDAP_NO_SUCH_ATTRIBUTE));
|
||||
s_resultCodeHash.Add(ResultCode.UndefinedAttributeType, String.Format(CultureInfo.CurrentCulture, SR.LDAP_UNDEFINED_TYPE));
|
||||
s_resultCodeHash.Add(ResultCode.InappropriateMatching, String.Format(CultureInfo.CurrentCulture, SR.LDAP_INAPPROPRIATE_MATCHING));
|
||||
s_resultCodeHash.Add(ResultCode.ConstraintViolation, String.Format(CultureInfo.CurrentCulture, SR.LDAP_CONSTRAINT_VIOLATION));
|
||||
s_resultCodeHash.Add(ResultCode.AttributeOrValueExists, String.Format(CultureInfo.CurrentCulture, SR.LDAP_ATTRIBUTE_OR_VALUE_EXISTS));
|
||||
s_resultCodeHash.Add(ResultCode.InvalidAttributeSyntax, String.Format(CultureInfo.CurrentCulture, SR.LDAP_INVALID_SYNTAX));
|
||||
s_resultCodeHash.Add(ResultCode.NoSuchObject, String.Format(CultureInfo.CurrentCulture, SR.LDAP_NO_SUCH_OBJECT));
|
||||
s_resultCodeHash.Add(ResultCode.AliasProblem, String.Format(CultureInfo.CurrentCulture, SR.LDAP_ALIAS_PROBLEM));
|
||||
s_resultCodeHash.Add(ResultCode.InvalidDNSyntax, String.Format(CultureInfo.CurrentCulture, SR.LDAP_INVALID_DN_SYNTAX));
|
||||
s_resultCodeHash.Add(ResultCode.AliasDereferencingProblem, String.Format(CultureInfo.CurrentCulture, SR.LDAP_ALIAS_DEREF_PROBLEM));
|
||||
s_resultCodeHash.Add(ResultCode.InappropriateAuthentication, String.Format(CultureInfo.CurrentCulture, SR.LDAP_INAPPROPRIATE_AUTH));
|
||||
s_resultCodeHash.Add(ResultCode.InsufficientAccessRights, String.Format(CultureInfo.CurrentCulture, SR.LDAP_INSUFFICIENT_RIGHTS));
|
||||
s_resultCodeHash.Add(ResultCode.Busy, String.Format(CultureInfo.CurrentCulture, SR.LDAP_BUSY));
|
||||
s_resultCodeHash.Add(ResultCode.Unavailable, String.Format(CultureInfo.CurrentCulture, SR.LDAP_UNAVAILABLE));
|
||||
s_resultCodeHash.Add(ResultCode.UnwillingToPerform, String.Format(CultureInfo.CurrentCulture, SR.LDAP_UNWILLING_TO_PERFORM));
|
||||
s_resultCodeHash.Add(ResultCode.LoopDetect, String.Format(CultureInfo.CurrentCulture, SR.LDAP_LOOP_DETECT));
|
||||
s_resultCodeHash.Add(ResultCode.SortControlMissing, String.Format(CultureInfo.CurrentCulture, SR.LDAP_SORT_CONTROL_MISSING));
|
||||
s_resultCodeHash.Add(ResultCode.OffsetRangeError, String.Format(CultureInfo.CurrentCulture, SR.LDAP_OFFSET_RANGE_ERROR));
|
||||
s_resultCodeHash.Add(ResultCode.NamingViolation, String.Format(CultureInfo.CurrentCulture, SR.LDAP_NAMING_VIOLATION));
|
||||
s_resultCodeHash.Add(ResultCode.ObjectClassViolation, String.Format(CultureInfo.CurrentCulture, SR.LDAP_OBJECT_CLASS_VIOLATION));
|
||||
s_resultCodeHash.Add(ResultCode.NotAllowedOnNonLeaf, String.Format(CultureInfo.CurrentCulture, SR.LDAP_NOT_ALLOWED_ON_NONLEAF));
|
||||
s_resultCodeHash.Add(ResultCode.NotAllowedOnRdn, String.Format(CultureInfo.CurrentCulture, SR.LDAP_NOT_ALLOWED_ON_RDN));
|
||||
s_resultCodeHash.Add(ResultCode.EntryAlreadyExists, String.Format(CultureInfo.CurrentCulture, SR.LDAP_ALREADY_EXISTS));
|
||||
s_resultCodeHash.Add(ResultCode.ObjectClassModificationsProhibited, String.Format(CultureInfo.CurrentCulture, SR.LDAP_NO_OBJECT_CLASS_MODS));
|
||||
s_resultCodeHash.Add(ResultCode.ResultsTooLarge, String.Format(CultureInfo.CurrentCulture, SR.LDAP_RESULTS_TOO_LARGE));
|
||||
s_resultCodeHash.Add(ResultCode.AffectsMultipleDsas, String.Format(CultureInfo.CurrentCulture, SR.LDAP_AFFECTS_MULTIPLE_DSAS));
|
||||
s_resultCodeHash.Add(ResultCode.VirtualListViewError, String.Format(CultureInfo.CurrentCulture, SR.LDAP_VIRTUAL_LIST_VIEW_ERROR));
|
||||
s_resultCodeHash.Add(ResultCode.Other, String.Format(CultureInfo.CurrentCulture, SR.LDAP_OTHER));
|
||||
}
|
||||
|
||||
static public string MapResultCode(int errorCode)
|
||||
public static string MapResultCode(int errorCode)
|
||||
{
|
||||
return (string)s_resultCodeHash[(ResultCode)errorCode];
|
||||
s_resultCodeMapping.TryGetValue((ResultCode)errorCode, out string errorMessage);
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,40 +2,32 @@
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections;
|
||||
|
||||
namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
|
||||
public class SearchResultReference
|
||||
{
|
||||
private Uri[] _resultReferences = null;
|
||||
private DirectoryControl[] _resultControls = null;
|
||||
private Uri[] _resultReferences;
|
||||
private DirectoryControl[] _resultControls;
|
||||
|
||||
internal SearchResultReference(Uri[] uris)
|
||||
{
|
||||
_resultReferences = uris;
|
||||
}
|
||||
internal SearchResultReference(Uri[] uris) => _resultReferences = uris;
|
||||
|
||||
public Uri[] Reference
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_resultReferences == null)
|
||||
return new Uri[0];
|
||||
else
|
||||
{
|
||||
Uri[] tempUri = new Uri[_resultReferences.Length];
|
||||
for (int i = 0; i < _resultReferences.Length; i++)
|
||||
{
|
||||
tempUri[i] = new Uri(_resultReferences[i].AbsoluteUri);
|
||||
}
|
||||
return tempUri;
|
||||
return Array.Empty<Uri>();
|
||||
}
|
||||
|
||||
Uri[] tempUri = new Uri[_resultReferences.Length];
|
||||
for (int i = 0; i < _resultReferences.Length; i++)
|
||||
{
|
||||
tempUri[i] = new Uri(_resultReferences[i].AbsoluteUri);
|
||||
}
|
||||
return tempUri;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,21 +35,17 @@ namespace System.DirectoryServices.Protocols
|
||||
{
|
||||
get
|
||||
{
|
||||
DirectoryControl[] controls = null;
|
||||
|
||||
if (_resultControls == null)
|
||||
return new DirectoryControl[0];
|
||||
else
|
||||
{
|
||||
controls = new DirectoryControl[_resultControls.Length];
|
||||
for (int i = 0; i < _resultControls.Length; i++)
|
||||
{
|
||||
controls[i] = new DirectoryControl(_resultControls[i].Type, _resultControls[i].GetValue(), _resultControls[i].IsCritical, _resultControls[i].ServerSide);
|
||||
}
|
||||
return Array.Empty<DirectoryControl>();
|
||||
}
|
||||
|
||||
DirectoryControl[] controls = new DirectoryControl[_resultControls.Length];
|
||||
for (int i = 0; i < _resultControls.Length; i++)
|
||||
{
|
||||
controls[i] = new DirectoryControl(_resultControls[i].Type, _resultControls[i].GetValue(), _resultControls[i].IsCritical, _resultControls[i].ServerSide);
|
||||
}
|
||||
DirectoryControl.TransformControls(controls);
|
||||
|
||||
return controls;
|
||||
}
|
||||
}
|
||||
@@ -65,96 +53,51 @@ namespace System.DirectoryServices.Protocols
|
||||
|
||||
public class SearchResultReferenceCollection : ReadOnlyCollectionBase
|
||||
{
|
||||
internal SearchResultReferenceCollection()
|
||||
{
|
||||
}
|
||||
internal SearchResultReferenceCollection() { }
|
||||
|
||||
public SearchResultReference this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return (SearchResultReference)InnerList[index];
|
||||
}
|
||||
}
|
||||
public SearchResultReference this[int index] => (SearchResultReference)InnerList[index];
|
||||
|
||||
internal int Add(SearchResultReference reference)
|
||||
{
|
||||
return InnerList.Add(reference);
|
||||
}
|
||||
internal int Add(SearchResultReference reference) => InnerList.Add(reference);
|
||||
|
||||
public bool Contains(SearchResultReference value)
|
||||
{
|
||||
return InnerList.Contains(value);
|
||||
}
|
||||
public bool Contains(SearchResultReference value) => InnerList.Contains(value);
|
||||
|
||||
public int IndexOf(SearchResultReference value)
|
||||
{
|
||||
return InnerList.IndexOf(value);
|
||||
}
|
||||
public int IndexOf(SearchResultReference value) => InnerList.IndexOf(value);
|
||||
|
||||
public void CopyTo(SearchResultReference[] values, int index)
|
||||
{
|
||||
InnerList.CopyTo(values, index);
|
||||
}
|
||||
public void CopyTo(SearchResultReference[] values, int index) => InnerList.CopyTo(values, index);
|
||||
|
||||
internal void Clear()
|
||||
{
|
||||
InnerList.Clear();
|
||||
}
|
||||
internal void Clear() => InnerList.Clear();
|
||||
}
|
||||
|
||||
public class SearchResultEntry
|
||||
{
|
||||
private string _distinguishedName = null;
|
||||
private SearchResultAttributeCollection _attributes = new SearchResultAttributeCollection();
|
||||
private DirectoryControl[] _resultControls = null;
|
||||
|
||||
internal SearchResultEntry(string dn, SearchResultAttributeCollection attrs)
|
||||
internal SearchResultEntry(string dn) => DistinguishedName = dn;
|
||||
|
||||
internal SearchResultEntry(string dn, SearchResultAttributeCollection attrs) : this(dn)
|
||||
{
|
||||
_distinguishedName = dn;
|
||||
_attributes = attrs;
|
||||
Attributes = attrs;
|
||||
}
|
||||
|
||||
internal SearchResultEntry(string dn)
|
||||
{
|
||||
_distinguishedName = dn;
|
||||
}
|
||||
public string DistinguishedName { get; internal set; }
|
||||
|
||||
public string DistinguishedName
|
||||
{
|
||||
get
|
||||
{
|
||||
return _distinguishedName;
|
||||
}
|
||||
}
|
||||
|
||||
public SearchResultAttributeCollection Attributes
|
||||
{
|
||||
get
|
||||
{
|
||||
return _attributes;
|
||||
}
|
||||
}
|
||||
public SearchResultAttributeCollection Attributes { get; }
|
||||
|
||||
public DirectoryControl[] Controls
|
||||
{
|
||||
get
|
||||
{
|
||||
DirectoryControl[] controls = null;
|
||||
|
||||
if (_resultControls == null)
|
||||
return new DirectoryControl[0];
|
||||
else
|
||||
{
|
||||
controls = new DirectoryControl[_resultControls.Length];
|
||||
for (int i = 0; i < _resultControls.Length; i++)
|
||||
{
|
||||
controls[i] = new DirectoryControl(_resultControls[i].Type, _resultControls[i].GetValue(), _resultControls[i].IsCritical, _resultControls[i].ServerSide);
|
||||
}
|
||||
return Array.Empty<DirectoryControl>();
|
||||
}
|
||||
|
||||
DirectoryControl[] controls = new DirectoryControl[_resultControls.Length];
|
||||
for (int i = 0; i < _resultControls.Length; i++)
|
||||
{
|
||||
controls[i] = new DirectoryControl(_resultControls[i].Type, _resultControls[i].GetValue(), _resultControls[i].IsCritical, _resultControls[i].ServerSide);
|
||||
}
|
||||
DirectoryControl.TransformControls(controls);
|
||||
|
||||
return controls;
|
||||
}
|
||||
}
|
||||
@@ -162,42 +105,18 @@ namespace System.DirectoryServices.Protocols
|
||||
|
||||
public class SearchResultEntryCollection : ReadOnlyCollectionBase
|
||||
{
|
||||
internal SearchResultEntryCollection()
|
||||
{
|
||||
}
|
||||
internal SearchResultEntryCollection() { }
|
||||
|
||||
public SearchResultEntry this[int index]
|
||||
{
|
||||
get
|
||||
{
|
||||
return (SearchResultEntry)InnerList[index];
|
||||
}
|
||||
}
|
||||
public SearchResultEntry this[int index] => (SearchResultEntry)InnerList[index];
|
||||
|
||||
internal int Add(SearchResultEntry entry)
|
||||
{
|
||||
return InnerList.Add(entry);
|
||||
}
|
||||
internal int Add(SearchResultEntry entry) => InnerList.Add(entry);
|
||||
|
||||
public bool Contains(SearchResultEntry value)
|
||||
{
|
||||
return InnerList.Contains(value);
|
||||
}
|
||||
public bool Contains(SearchResultEntry value) => InnerList.Contains(value);
|
||||
|
||||
public int IndexOf(SearchResultEntry value)
|
||||
{
|
||||
return InnerList.IndexOf(value);
|
||||
}
|
||||
public int IndexOf(SearchResultEntry value) => InnerList.IndexOf(value);
|
||||
|
||||
public void CopyTo(SearchResultEntry[] values, int index)
|
||||
{
|
||||
InnerList.CopyTo(values, index);
|
||||
}
|
||||
public void CopyTo(SearchResultEntry[] values, int index) => InnerList.CopyTo(values, index);
|
||||
|
||||
internal void Clear()
|
||||
{
|
||||
InnerList.Clear();
|
||||
}
|
||||
internal void Clear() => InnerList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user