├── SharpLdapRelayScan ├── .gitignore ├── Novell │ ├── Extensions │ │ ├── LdapBackupResponse.cs │ │ ├── RefreshLdapServerRequest.cs │ │ ├── BackupRestoreConstants.cs │ │ ├── GetBindDNRequest.cs │ │ └── SchemaSyncRequest.cs │ ├── Rfc2251 │ │ ├── RfcRelativeLdapDN.cs │ │ ├── RfcMatchingRuleId.cs │ │ ├── RfcLdapOID.cs │ │ ├── RfcRequest.cs │ │ ├── RfcAssertionValue.cs │ │ ├── RfcAttributeValue.cs │ │ ├── RfcLdapURL.cs │ │ ├── RfcAttributeDescription.cs │ │ ├── RfcResponse.cs │ │ ├── RfcLdapString.cs │ │ ├── RfcAttributeList.cs │ │ ├── RfcLdapDN.cs │ │ ├── RfcAttributeTypeAndValues.cs │ │ ├── RfcSubstringFilter.cs │ │ ├── RfcSaslCredentials.cs │ │ ├── RfcReferral.cs │ │ ├── RfcSearchResultReference.cs │ │ ├── RfcAttributeDescriptionList.cs │ │ ├── RfcAuthenticationChoice.cs │ │ ├── RfcAttributeValueAssertion.cs │ │ ├── RfcUnbindRequest.cs │ │ ├── RfcAbandonRequest.cs │ │ ├── RfcMessageID.cs │ │ ├── RfcModifyDNResponse.cs │ │ ├── RfcAddResponse.cs │ │ ├── RfcSearchResultDone.cs │ │ ├── RfcDelResponse.cs │ │ ├── RfcModifyResponse.cs │ │ ├── RfcCompareResponse.cs │ │ ├── RfcDelRequest.cs │ │ └── RfcSearchResultEntry.cs │ ├── Utilclass │ │ ├── TokenTypes.cs │ │ ├── CharacterTypes.cs │ │ ├── ArrayEnumeration.cs │ │ ├── AttributeQualifier.cs │ │ ├── EnumeratedIterator.cs │ │ ├── ReferralInfo.cs │ │ └── ExtResponseFactory.cs │ ├── LdapReferralHandler.cs │ ├── LdapUnbindRequest.cs │ ├── Events │ │ ├── BaseEventArgs.cs │ │ ├── SearchReferralEventArgs.cs │ │ ├── DirectoryExceptionEventArgs.cs │ │ ├── LdapEventConstants.cs │ │ ├── DirectoryEventArgs.cs │ │ ├── Edir │ │ │ ├── EdirEventArgs.cs │ │ │ ├── EventData │ │ │ │ ├── ReferralAddress.cs │ │ │ │ ├── BaseEdirEventData.cs │ │ │ │ ├── NetworkAddressEventData.cs │ │ │ │ ├── DSETimeStamp.cs │ │ │ │ └── ConnectionStateEventData.cs │ │ │ ├── EdirEventSpecifier.cs │ │ │ └── MonitorEventResponse.cs │ │ └── LdapEventArgs.cs │ ├── LdapUnsolicitedNotificationListener.cs │ ├── LdapAbandonRequest.cs │ ├── Asn1 │ │ ├── Asn1Numeric.cs │ │ └── Asn1Null.cs │ ├── LdapDeleteRequest.cs │ ├── LdapAuthHandler.cs │ ├── LdapResponseQueue.cs │ ├── LdapSearchResultReference.cs │ ├── LdapSearchQueue.cs │ ├── Controls │ │ └── LdapPagedResultsResponse.cs │ └── LdapAuthProvider.cs ├── packages.config ├── App.config ├── Utils │ ├── BinTools.cs │ └── ReflectionHelper.cs ├── Security │ └── State.cs ├── Properties │ └── AssemblyInfo.cs └── NTLMSSP │ └── Messages │ └── NtlmNegotiate.cs └── SharpLdapRelayScan.sln /SharpLdapRelayScan/.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ 3 | .vs/ 4 | LdapBindingScan/ -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Extensions/LdapBackupResponse.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klezVirus/SharpLdapRelayScan/HEAD/SharpLdapRelayScan/Novell/Extensions/LdapBackupResponse.cs -------------------------------------------------------------------------------- /SharpLdapRelayScan/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Utils/BinTools.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SharpLdapRelayScan.Utils 4 | { 5 | public static class BinTools 6 | { 7 | public static byte[] Combine(byte[] first, byte[] second) 8 | { 9 | byte[] ret = new byte[first.Length + second.Length]; 10 | Buffer.BlockCopy(first, 0, ret, 0, first.Length); 11 | Buffer.BlockCopy(second, 0, ret, first.Length, second.Length); 12 | return ret; 13 | } 14 | 15 | // create a subset from a range of indices 16 | public static T[] RangeSubset(this T[] array, int startIndex, int length) 17 | { 18 | T[] subset = new T[length]; 19 | Array.Copy(array, startIndex, subset, 0, length); 20 | return subset; 21 | } 22 | 23 | // create a subset from a specific list of indices 24 | public static T[] Subset(this T[] array, params int[] indices) 25 | { 26 | T[] subset = new T[indices.Length]; 27 | for (int i = 0; i < indices.Length; i++) 28 | { 29 | subset[i] = array[indices[i]]; 30 | } 31 | return subset; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Security/State.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SharpLdapRelayScan 4 | { 5 | /// 6 | /// Status of authenticated session 7 | /// 8 | internal class State 9 | { 10 | internal State() 11 | { 12 | Credentials = new Common.SecurityHandle(0); 13 | Context = new Common.SecurityHandle(0); 14 | 15 | LastSeen = DateTime.Now; 16 | } 17 | 18 | /// 19 | /// Credentials used to validate NTLM hashes 20 | /// 21 | internal Common.SecurityHandle Credentials; 22 | 23 | /// 24 | /// Context will be used to validate HTLM hashes 25 | /// 26 | internal Common.SecurityHandle Context; 27 | 28 | /// 29 | /// Timestamp needed to calculate validity of the authenticated session 30 | /// 31 | internal DateTime LastSeen; 32 | 33 | internal void ResetHandles() 34 | { 35 | Credentials.Reset(); 36 | Context.Reset(); 37 | } 38 | 39 | internal void UpdatePresence() 40 | { 41 | LastSeen = DateTime.Now; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /SharpLdapRelayScan/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("SharpLdapRelayScan")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("SharpLdapRelayScan")] 12 | [assembly: AssemblyCopyright("Copyright © klezVirus 2022")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("a93ee706-a71c-4cc1-bf37-f26c27825b68")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcRelativeLdapDN.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcRelativeLdapDN.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap.Rfc2251 33 | { 34 | 35 | /* 36 | * Represents an Ldap Relative DN. 37 | */ 38 | public class RfcRelativeLdapDN : RfcLdapString 39 | { 40 | 41 | /// 42 | public RfcRelativeLdapDN(System.String s) : base(s) 43 | { 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Utilclass/TokenTypes.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc., www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Utilclass.TokenType.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using System; 33 | 34 | namespace Novell.Directory.Ldap.Utilclass 35 | { 36 | 37 | /// 38 | /// Specifies the types of Tokens. 39 | /// 40 | [Serializable] 41 | public enum TokenTypes 42 | { 43 | EOL = '\n', 44 | EOF = -1, 45 | NUMBER = -2, 46 | WORD = -3, 47 | REAL = -4, 48 | STRING = -5 49 | } 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/LdapReferralHandler.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.LdapReferralHandler.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap 33 | { 34 | 35 | /// 36 | /// Shared ancestor to the two types of referral objects - LdapBindHandler and 37 | /// LdapAuthHandler. 38 | /// 39 | /// 40 | /// 41 | /// 42 | /// 43 | /// 44 | /// 45 | public interface LdapReferralHandler 46 | { 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Utilclass/CharacterTypes.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc., www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Utilclass.CharacterTypes.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using System; 33 | 34 | namespace Novell.Directory.Ldap.Utilclass 35 | { 36 | 37 | /// 38 | /// Specifies the types of Characters. 39 | /// 40 | // [Flags] 41 | [Serializable] 42 | [CLSCompliantAttribute(false)] 43 | public enum CharacterTypes : sbyte 44 | { 45 | WHITESPACE = 1, 46 | NUMERIC = 2, 47 | ALPHABETIC = 4, 48 | STRINGQUOTE = 8, 49 | COMMENTCHAR = 16 50 | } 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcMatchingRuleId.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcMatchingRuleId.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap.Rfc2251 33 | { 34 | 35 | /// Represents an Ldap Matching Rule ID. 36 | /// 37 | ///
38 |     /// MatchingRuleId ::= LdapString
39 |     /// 
40 | ///
41 | public class RfcMatchingRuleId : RfcLdapString 42 | { 43 | 44 | /// Constructs a MatchingRuleId from a String. 45 | public RfcMatchingRuleId(System.String s) : base(s) 46 | { 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcLdapOID.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcLdapOID.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /* 39 | * Represents an LdapOID. 40 | */ 41 | public class RfcLdapOID : Asn1OctetString 42 | { 43 | /// 44 | public RfcLdapOID(System.String s) : base(s) 45 | { 46 | } 47 | 48 | /// 49 | [CLSCompliantAttribute(false)] 50 | public RfcLdapOID(sbyte[] s) : base(s) 51 | { 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcRequest.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcRequest.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap.Rfc2251 33 | { 34 | 35 | /// This interface represents Protocol Operations that are requests from a 36 | /// client. 37 | /// 38 | public interface RfcRequest 39 | { 40 | /// Builds a new request using the data from the this object. 41 | RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool reference); 42 | 43 | /// Builds a new request using the data from the this object. 44 | System.String getRequestDN(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcAssertionValue.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcAssertionValue.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | 33 | using Novell.Directory.Ldap.Asn1; 34 | using System; 35 | 36 | namespace Novell.Directory.Ldap.Rfc2251 37 | { 38 | 39 | /// Represents the Ldap Assertion Value. 40 | /// 41 | ///
42 |     /// AssertionValue ::= OCTET STRING
43 |     /// 
44 | ///
45 | public class RfcAssertionValue : Asn1OctetString 46 | { 47 | 48 | /// 49 | [CLSCompliantAttribute(false)] 50 | public RfcAssertionValue(sbyte[] value_Renamed) : base(value_Renamed) 51 | { 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SharpLdapRelayScan.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31515.178 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpLdapRelayScan", "SharpLdapRelayScan\SharpLdapRelayScan.csproj", "{A93EE706-A71C-4CC1-BF37-F26C27825B68}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{370ADE88-8CE6-41C6-BF79-C9499C80764F}" 9 | ProjectSection(SolutionItems) = preProject 10 | readme.md = readme.md 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Debug|x64 = Debug|x64 17 | Debug|x86 = Debug|x86 18 | Release|Any CPU = Release|Any CPU 19 | Release|x64 = Release|x64 20 | Release|x86 = Release|x86 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {A93EE706-A71C-4CC1-BF37-F26C27825B68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {A93EE706-A71C-4CC1-BF37-F26C27825B68}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {A93EE706-A71C-4CC1-BF37-F26C27825B68}.Debug|x64.ActiveCfg = Debug|x64 26 | {A93EE706-A71C-4CC1-BF37-F26C27825B68}.Debug|x64.Build.0 = Debug|x64 27 | {A93EE706-A71C-4CC1-BF37-F26C27825B68}.Debug|x86.ActiveCfg = Debug|Any CPU 28 | {A93EE706-A71C-4CC1-BF37-F26C27825B68}.Debug|x86.Build.0 = Debug|Any CPU 29 | {A93EE706-A71C-4CC1-BF37-F26C27825B68}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {A93EE706-A71C-4CC1-BF37-F26C27825B68}.Release|Any CPU.Build.0 = Release|Any CPU 31 | {A93EE706-A71C-4CC1-BF37-F26C27825B68}.Release|x64.ActiveCfg = Release|x64 32 | {A93EE706-A71C-4CC1-BF37-F26C27825B68}.Release|x64.Build.0 = Release|x64 33 | {A93EE706-A71C-4CC1-BF37-F26C27825B68}.Release|x86.ActiveCfg = Release|Any CPU 34 | {A93EE706-A71C-4CC1-BF37-F26C27825B68}.Release|x86.Build.0 = Release|Any CPU 35 | EndGlobalSection 36 | GlobalSection(SolutionProperties) = preSolution 37 | HideSolutionNode = FALSE 38 | EndGlobalSection 39 | GlobalSection(ExtensibilityGlobals) = postSolution 40 | SolutionGuid = {17E672D2-39EE-4883-88D3-4FF7BAE18834} 41 | EndGlobalSection 42 | EndGlobal 43 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcAttributeValue.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcAttributeValue.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /* 39 | * Represents an Ldap Attribute Value. 40 | */ 41 | public class RfcAttributeValue : Asn1OctetString 42 | { 43 | 44 | /// 45 | public RfcAttributeValue(System.String value_Renamed) : base(value_Renamed) 46 | { 47 | } 48 | 49 | /// 50 | [CLSCompliantAttribute(false)] 51 | public RfcAttributeValue(sbyte[] value_Renamed) : base(value_Renamed) 52 | { 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcLdapURL.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcLdapURL.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap.Rfc2251 33 | { 34 | 35 | /// Represents an Ldap URL. 36 | /// 37 | ///
38 |     /// LdapURL ::= LdapString -- limited to characters permitted in URLs
39 |     /// 
40 | ///
41 | public class RfcLdapURL : RfcLdapString 42 | { 43 | 44 | //************************************************************************* 45 | // Constructor for RfcLdapURL 46 | //************************************************************************* 47 | 48 | /// 49 | public RfcLdapURL(System.String s) : base(s) 50 | { 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcAttributeDescription.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcAttributeDescription.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /* 39 | * Represents the Ldap Attribute Description. 40 | */ 41 | public class RfcAttributeDescription : RfcLdapString 42 | { 43 | 44 | /// 45 | public RfcAttributeDescription(System.String s) : base(s) 46 | { 47 | } 48 | 49 | /// 50 | [CLSCompliantAttribute(false)] 51 | public RfcAttributeDescription(Asn1Decoder dec, System.IO.Stream in_Renamed, int len) : base(dec, in_Renamed, len) 52 | { 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcResponse.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcResponse.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | 34 | namespace Novell.Directory.Ldap.Rfc2251 35 | { 36 | 37 | /// This interface represents RfcLdapMessages that contain a response from a 38 | /// server. 39 | /// 40 | /// If the protocol operation of the RfcLdapMessage is of this type, 41 | /// it contains at least an RfcLdapResult. 42 | /// 43 | public interface RfcResponse 44 | { 45 | 46 | /// 47 | Asn1Enumerated getResultCode(); 48 | 49 | /// 50 | RfcLdapDN getMatchedDN(); 51 | 52 | /// 53 | RfcLdapString getErrorMessage(); 54 | 55 | /// 56 | RfcReferral getReferral(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcLdapString.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcLdapString.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represnts an Ldap String. 39 | public class RfcLdapString : Asn1OctetString 40 | { 41 | 42 | /// 43 | public RfcLdapString(System.String s) : base(s) 44 | { 45 | } 46 | 47 | /// 48 | [CLSCompliantAttribute(false)] 49 | public RfcLdapString(sbyte[] ba) : base(ba) 50 | { 51 | } 52 | 53 | /// 54 | [CLSCompliantAttribute(false)] 55 | public RfcLdapString(Asn1Decoder dec, System.IO.Stream in_Renamed, int len) : base(dec, in_Renamed, len) 56 | { 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcAttributeList.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcAttributeList.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | 34 | namespace Novell.Directory.Ldap.Rfc2251 35 | { 36 | 37 | /// Represents an Ldap Attribute List. 38 | /// 39 | ///
40 |     /// AttributeList ::= SEQUENCE OF SEQUENCE {
41 |     /// type    AttributeDescription,
42 |     /// vals    SET OF AttributeValue }
43 |     /// 
44 | ///
45 | public class RfcAttributeList : Asn1SequenceOf 46 | { 47 | 48 | //************************************************************************* 49 | // Constructor for AttributeList 50 | //************************************************************************* 51 | public RfcAttributeList(int size) : base(size) 52 | { 53 | return; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/LdapUnbindRequest.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.LdapUnbindRequest.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Rfc2251; 33 | 34 | namespace Novell.Directory.Ldap 35 | { 36 | 37 | /// Represents an Ldap Unbind Request. 38 | /// 39 | /// 40 | /// 41 | /// 42 | /* 43 | * UnbindRequest ::= [APPLICATION 2] NULL 44 | */ 45 | public class LdapUnbindRequest : LdapMessage 46 | { 47 | /// Constructs an Ldap Unbind Request. 48 | /// 49 | /// 50 | /// Any controls that apply to the unbind request 51 | /// 52 | public LdapUnbindRequest(LdapControl[] cont) : base(LdapMessage.UNBIND_REQUEST, new RfcUnbindRequest(), cont) 53 | { 54 | return; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcLdapDN.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcLdapDN.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using System; 33 | 34 | namespace Novell.Directory.Ldap.Rfc2251 35 | { 36 | 37 | /// Represents an Ldap DN. 38 | /// 39 | ///
40 |     /// LdapDN ::= LdapString
41 |     /// 
42 | ///
43 | public class RfcLdapDN : RfcLdapString 44 | { 45 | 46 | //************************************************************************* 47 | // Constructors for RfcLdapDN 48 | //************************************************************************* 49 | 50 | /// 51 | public RfcLdapDN(System.String s) : base(s) 52 | { 53 | } 54 | 55 | /// 56 | [CLSCompliantAttribute(false)] 57 | public RfcLdapDN(sbyte[] s) : base(s) 58 | { 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/BaseEventArgs.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.BaseEventArgs.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using System; 33 | 34 | namespace Novell.Directory.Ldap.Events 35 | { 36 | /// 37 | /// This is the base class for other EventArgs representing exception 38 | /// and normal events. 39 | /// 40 | /// 41 | /// 42 | public class BaseEventArgs : EventArgs 43 | { 44 | protected LdapMessage ldap_message; 45 | public LdapMessage ContianedEventInformation 46 | { 47 | get 48 | { 49 | return ldap_message; 50 | } 51 | } 52 | 53 | public BaseEventArgs(LdapMessage message) 54 | { 55 | ldap_message = message; 56 | } 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/SearchReferralEventArgs.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.SearchReferralEventArgs.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | 33 | namespace Novell.Directory.Ldap.Events 34 | { 35 | /// 36 | /// This class represents the EventArgs corresponding to 37 | /// LdapSearchResultReference notification sent by Ldap Server. 38 | /// 39 | public class SearchReferralEventArgs : LdapEventArgs 40 | { 41 | public SearchReferralEventArgs(LdapMessage sourceMessage, 42 | EventClassifiers aClassification, 43 | LdapEventType aType) 44 | : base(sourceMessage, EventClassifiers.CLASSIFICATION_LDAP_PSEARCH, 45 | LdapEventType.LDAP_PSEARCH_ANY) // TODO: why type is ANY..? 46 | { 47 | } 48 | 49 | public string[] getUrls() 50 | { 51 | return ((LdapSearchResultReference)ldap_message).Referrals; 52 | } 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/DirectoryExceptionEventArgs.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.DirectoryExceptionEventArgs.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap.Events 33 | { 34 | /// 35 | /// This class gives the EventArgs for Directory exceptions. 36 | /// 37 | /// 38 | /// 39 | public class DirectoryExceptionEventArgs : BaseEventArgs 40 | { 41 | protected LdapException ldap_exception_object; 42 | public LdapException LdapExceptionObject 43 | { 44 | get 45 | { 46 | return ldap_exception_object; 47 | } 48 | } 49 | 50 | public DirectoryExceptionEventArgs(LdapMessage message, LdapException ldapException) 51 | : base(message) 52 | { 53 | ldap_exception_object = ldapException; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/LdapUnsolicitedNotificationListener.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.LdapUnsolicitedNotificationListener.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap 33 | { 34 | 35 | /// 36 | /// An object that implements this interface can be notified when 37 | /// unsolicited messages arrive from the server. A client registers the 38 | /// object with LdapConnection.AddUnsolicitedNotificationListener. 39 | /// 40 | /// 41 | public interface LdapUnsolicitedNotificationListener 42 | { 43 | 44 | /// The method is called when an unsolicited message arrives from a 45 | /// server, if the object has registered with LdapCo 46 | /// LdapConnection.AddUnsolicitedNotificationListener. 47 | /// 48 | /// 49 | /// An unsolicited message received from the server. 50 | /// 51 | /// 52 | void messageReceived(LdapExtendedResponse msg); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/LdapEventConstants.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.LdapEventConstants.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Controls; 33 | 34 | namespace Novell.Directory.Ldap.Events 35 | { 36 | 37 | /// 38 | /// Event Classifiers 39 | /// 40 | public enum EventClassifiers 41 | { 42 | CLASSIFICATION_UNKNOWN = -1, 43 | CLASSIFICATION_LDAP_PSEARCH = 0, 44 | CLASSIFICATION_EDIR_EVENT = 1 45 | } 46 | 47 | /// 48 | /// Types of Ldap Events 49 | /// 50 | public enum LdapEventType 51 | { 52 | TYPE_UNKNOWN = LdapEventSource.EVENT_TYPE_UNKNOWN, 53 | LDAP_PSEARCH_ADD = LdapPersistSearchControl.ADD, 54 | LDAP_PSEARCH_DELETE = LdapPersistSearchControl.DELETE, 55 | LDAP_PSEARCH_MODIFY = LdapPersistSearchControl.MODIFY, 56 | LDAP_PSEARCH_MODDN = LdapPersistSearchControl.MODDN, 57 | LDAP_PSEARCH_ANY = LDAP_PSEARCH_ADD | LDAP_PSEARCH_DELETE | LDAP_PSEARCH_MODIFY | LDAP_PSEARCH_MODDN 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Extensions/RefreshLdapServerRequest.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Extensions.RefreshLdapServerRequest.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap.Extensions 33 | { 34 | 35 | /// 36 | /// Reloads the Ldap server. 37 | /// 38 | /// The refreshLdapServerRequest extension uses the following OID: 39 | /// 2.16.840.1.113719.1.27.100.9 40 | /// 41 | /// The requestValue is set to null. 42 | /// 43 | public class RefreshLdapServerRequest : LdapExtendedOperation 44 | { 45 | 46 | /// 47 | /// Constructs an extended operation object for reloading the Ldap server. 48 | /// 49 | /// The constructor sets the OID. 50 | /// 51 | /// 52 | /// LdapException A general exception which includes an error 53 | /// message and an Ldap error code. 54 | /// 55 | public RefreshLdapServerRequest() : base(ReplicationConstants.REFRESH_SERVER_REQ, null) 56 | { 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/LdapAbandonRequest.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.LdapAbandonRequest.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Rfc2251; 33 | 34 | namespace Novell.Directory.Ldap 35 | { 36 | 37 | /// Represents an Ldap Abandon Request 38 | /// 39 | /// 40 | /// 41 | /// 42 | /* 43 | * AbandonRequest ::= [APPLICATION 16] MessageID 44 | */ 45 | public class LdapAbandonRequest : LdapMessage 46 | { 47 | /// Construct an Ldap Abandon Request. 48 | /// 49 | /// 50 | /// The ID of the operation to abandon. 51 | /// 52 | /// 53 | /// Any controls that apply to the abandon request 54 | /// or null if none. 55 | /// 56 | public LdapAbandonRequest(int id, LdapControl[] cont) : base(LdapMessage.ABANDON_REQUEST, new RfcAbandonRequest(id), cont) 57 | { 58 | return; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcAttributeTypeAndValues.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcAttributeTypeAndValues.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | 34 | namespace Novell.Directory.Ldap.Rfc2251 35 | { 36 | 37 | /// Represents and Ldap Attribute Type and Values. 38 | /// 39 | ///
40 |     /// AttributeTypeAndValues ::= SEQUENCE {
41 |     /// type    AttributeDescription,
42 |     /// vals    SET OF AttributeValue }
43 |     /// 
44 | ///
45 | public class RfcAttributeTypeAndValues : Asn1Sequence 46 | { 47 | 48 | //************************************************************************* 49 | // Constructor for AttributeTypeAndValues 50 | //************************************************************************* 51 | 52 | /// 53 | public RfcAttributeTypeAndValues(RfcAttributeDescription type, Asn1SetOf vals) : base(2) 54 | { 55 | add(type); 56 | add(vals); 57 | return; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/DirectoryEventArgs.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.DirectoryEventArgs.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | 33 | namespace Novell.Directory.Ldap.Events 34 | { 35 | /// 36 | /// This is the base class for other EventArgs corresponding to 37 | /// Ldap and Edir events. 38 | /// 39 | /// 40 | /// 41 | public class DirectoryEventArgs : BaseEventArgs 42 | { 43 | protected EventClassifiers eClassification; 44 | public EventClassifiers EventClassification 45 | { 46 | get 47 | { 48 | return eClassification; 49 | } 50 | set 51 | { 52 | eClassification = value; 53 | } 54 | } 55 | 56 | public DirectoryEventArgs(LdapMessage sourceMessage, 57 | EventClassifiers aClassification) 58 | : base(sourceMessage) 59 | { 60 | eClassification = aClassification; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcSubstringFilter.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcSubstringFilter.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | 34 | namespace Novell.Directory.Ldap.Rfc2251 35 | { 36 | 37 | /// Represents an Ldap Substring Filter. 38 | /// 39 | ///
40 |     /// SubstringFilter ::= SEQUENCE {
41 |     /// type            AttributeDescription,
42 |     /// -- at least one must be present
43 |     /// substrings      SEQUENCE OF CHOICE {
44 |     /// initial [0] LdapString,
45 |     /// any     [1] LdapString,
46 |     /// final   [2] LdapString } }
47 |     /// 
48 | ///
49 | public class RfcSubstringFilter : Asn1Sequence 50 | { 51 | 52 | //************************************************************************* 53 | // Constructors for SubstringFilter 54 | //************************************************************************* 55 | 56 | /// 57 | public RfcSubstringFilter(RfcAttributeDescription type, Asn1SequenceOf substrings) : base(2) 58 | { 59 | add(type); 60 | add(substrings); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Extensions/BackupRestoreConstants.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2006 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Extensions.BackupRestoreConstants.cs 25 | // 26 | // Author: 27 | // Palaniappan N (NPalaniappan@novell.com) 28 | // 29 | // (C) 2006 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using System; 33 | 34 | namespace Novell.Directory.Ldap.Extensions 35 | { 36 | public class BackupRestoreConstants 37 | { 38 | 39 | /** 40 | * A constant for eDirectory LDAP Based Backup Request OID. 41 | */ 42 | public const String NLDAP_LDAP_BACKUP_REQUEST = "2.16.840.1.113719.1.27.100.96"; 43 | 44 | /** 45 | * A constant for eDirectory LDAP Based Backup Response OID. 46 | */ 47 | public const String NLDAP_LDAP_BACKUP_RESPONSE = "2.16.840.1.113719.1.27.100.97"; 48 | 49 | /** 50 | * A constant for eDirectory LDAP Based Restore Request OID. 51 | */ 52 | public const String NLDAP_LDAP_RESTORE_REQUEST = "2.16.840.1.113719.1.27.100.98"; 53 | 54 | 55 | /** 56 | * A constant for eDirectory LDAP Based Restore Response OID. 57 | */ 58 | public const String NLDAP_LDAP_RESTORE_RESPONSE = "2.16.840.1.113719.1.27.100.99"; 59 | 60 | /** 61 | * Default constructor 62 | */ 63 | public BackupRestoreConstants() : base() 64 | { 65 | return; 66 | } 67 | 68 | } 69 | } -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcSaslCredentials.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcSaslCredentials.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | 34 | namespace Novell.Directory.Ldap.Rfc2251 35 | { 36 | 37 | /// Represents Ldap Sasl Credentials. 38 | /// 39 | ///
40 |     /// SaslCredentials ::= SEQUENCE {
41 |     /// mechanism               LdapString,
42 |     /// credentials             OCTET STRING OPTIONAL }
43 |     /// 
44 | ///
45 | public class RfcSaslCredentials : Asn1Sequence 46 | { 47 | 48 | //************************************************************************* 49 | // Constructors for SaslCredentials 50 | //************************************************************************* 51 | 52 | /// 53 | public RfcSaslCredentials(RfcLdapString mechanism) : this(mechanism, null) 54 | { 55 | } 56 | 57 | /// 58 | public RfcSaslCredentials(RfcLdapString mechanism, Asn1OctetString credentials) : base(2) 59 | { 60 | add(mechanism); 61 | if (credentials != null) 62 | add(credentials); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/Edir/EdirEventArgs.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.Edir.EdirEventArgs.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap.Events.Edir 33 | { 34 | /// 35 | /// This class represents the EventArgs for Edir events in general. 36 | /// 37 | public class EdirEventArgs : DirectoryEventArgs 38 | { 39 | /// 40 | /// This property gives the contained event information in the form 41 | /// of an IntermediateResponse if the contained information is of correct 42 | /// type. In case the type of contained information is incorrect, null is returned. 43 | /// 44 | public EdirEventIntermediateResponse IntermediateResponse 45 | { 46 | get 47 | { 48 | if (ldap_message is EdirEventIntermediateResponse) 49 | return (EdirEventIntermediateResponse)ldap_message; 50 | else 51 | return null; 52 | } 53 | } 54 | 55 | public EdirEventArgs(LdapMessage sourceMessage, 56 | EventClassifiers aClassification) 57 | : base(sourceMessage, aClassification) 58 | { 59 | } 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/Edir/EventData/ReferralAddress.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.Edir.EventData.ReferralAddress.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | 34 | namespace Novell.Directory.Ldap.Events.Edir.EventData 35 | { 36 | /// 37 | /// This class represents the data for Address(IP/IPX/IPV6 etc) datastructure for 38 | /// Edir Events Notification. 39 | /// 40 | public class ReferralAddress 41 | { 42 | protected int address_type; 43 | public int AddressType 44 | { 45 | get 46 | { 47 | return address_type; 48 | } 49 | } 50 | 51 | protected string strAddress; 52 | public string Address 53 | { 54 | get 55 | { 56 | return strAddress; 57 | } 58 | } 59 | 60 | /// 61 | /// Returns a string representation of the object. 62 | /// 63 | public ReferralAddress(Asn1Sequence dseObject) 64 | { 65 | address_type = ((Asn1Integer)dseObject.get_Renamed(0)).intValue(); 66 | strAddress = ((Asn1OctetString)dseObject.get_Renamed(1)).stringValue(); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Utils/ReflectionHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace SharpLdapRelayScan 5 | { 6 | // https://stackoverflow.com/questions/1565734/is-it-possible-to-set-private-property-via-reflection 7 | public static class ReflectionHelper 8 | { 9 | 10 | public static T GetPrivatePropertyValue(this object obj, string propName) 11 | { 12 | if (obj == null) throw new ArgumentNullException("obj"); 13 | PropertyInfo pi = obj.GetType().GetProperty(propName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); 14 | if (pi == null) throw new ArgumentOutOfRangeException("propName", string.Format("Property {0} was not found in Type {1}", propName, obj.GetType().FullName)); 15 | return (T)pi.GetValue(obj, null); 16 | } 17 | 18 | public static T GetPrivateFieldValue(this object obj, string propName) 19 | { 20 | if (obj == null) throw new ArgumentNullException("obj"); 21 | Type t = obj.GetType(); 22 | FieldInfo fi = null; 23 | while (fi == null && t != null) 24 | { 25 | fi = t.GetField(propName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); 26 | t = t.BaseType; 27 | } 28 | if (fi == null) throw new ArgumentOutOfRangeException("propName", string.Format("Field {0} was not found in Type {1}", propName, obj.GetType().FullName)); 29 | return (T)fi.GetValue(obj); 30 | } 31 | 32 | public static void SetPrivatePropertyValue(this object obj, string propName, T val) 33 | { 34 | Type t = obj.GetType(); 35 | if (t.GetProperty(propName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance) == null) 36 | throw new ArgumentOutOfRangeException("propName", string.Format("Property {0} was not found in Type {1}", propName, obj.GetType().FullName)); 37 | t.InvokeMember(propName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.SetProperty | BindingFlags.Instance, null, obj, new object[] { val }); 38 | } 39 | 40 | public static void SetPrivateFieldValue(this object obj, string propName, T val) 41 | { 42 | if (obj == null) throw new ArgumentNullException("obj"); 43 | Type t = obj.GetType(); 44 | FieldInfo fi = null; 45 | while (fi == null && t != null) 46 | { 47 | fi = t.GetField(propName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); 48 | t = t.BaseType; 49 | } 50 | if (fi == null) throw new ArgumentOutOfRangeException("propName", string.Format("Field {0} was not found in Type {1}", propName, obj.GetType().FullName)); 51 | fi.SetValue(obj, val); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcReferral.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcReferral.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents an Ldap Referral. 39 | /// 40 | ///
41 |     /// Referral ::= SEQUENCE OF LdapURL
42 |     /// 
43 | ///
44 | public class RfcReferral : Asn1SequenceOf 45 | { 46 | 47 | //************************************************************************* 48 | // Constructor for Referral 49 | //************************************************************************* 50 | 51 | /// The only time a Referral object is constructed, is when we are 52 | /// decoding an RfcLdapResult or COMPONENTS OF RfcLdapResult. 53 | /// 54 | [CLSCompliantAttribute(false)] 55 | public RfcReferral(Asn1Decoder dec, System.IO.Stream in_Renamed, int len) : base(dec, in_Renamed, len) 56 | { 57 | 58 | //convert from Asn1OctetString to RfcLdapURL here (then look at 59 | // LdapResponse.getReferrals()) 60 | } 61 | 62 | //************************************************************************* 63 | // Accessors 64 | //************************************************************************* 65 | 66 | // inherited from SequenceOf 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/Edir/EdirEventSpecifier.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.Edir.EdirEventSpecifier.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | 33 | namespace Novell.Directory.Ldap.Events.Edir 34 | { 35 | /// 36 | /// This class denotes the mechanism to specify the event of interest. 37 | /// 38 | public class EdirEventSpecifier 39 | { 40 | private EdirEventType event_type; 41 | public EdirEventType EventType 42 | { 43 | get 44 | { 45 | return event_type; 46 | } 47 | } 48 | 49 | private EdirEventResultType event_result_type; 50 | public EdirEventResultType EventResultType 51 | { 52 | get 53 | { 54 | return event_result_type; 55 | } 56 | } 57 | 58 | private string event_filter; 59 | public string EventFilter 60 | { 61 | get 62 | { 63 | return event_filter; 64 | } 65 | } 66 | 67 | public EdirEventSpecifier(EdirEventType eventType, EdirEventResultType eventResultType) : 68 | this(eventType, eventResultType, null) 69 | { 70 | } 71 | 72 | public EdirEventSpecifier(EdirEventType eventType, EdirEventResultType eventResultType, string filter) 73 | { 74 | event_type = eventType; 75 | event_result_type = eventResultType; 76 | event_filter = filter; 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Asn1/Asn1Numeric.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Asn1.Asn1Numeric.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using System; 33 | 34 | namespace Novell.Directory.Ldap.Asn1 35 | { 36 | 37 | /// This abstract class is the base class 38 | /// for all Asn1 numeric (integral) types. These include 39 | /// Asn1Integer and Asn1Enumerated. 40 | /// 41 | [CLSCompliantAttribute(true)] 42 | public abstract class Asn1Numeric : Asn1Object 43 | { 44 | 45 | private System.Int64 content; 46 | 47 | internal Asn1Numeric(Asn1Identifier id, int value_Renamed) : base(id) 48 | { 49 | content = (System.Int64)value_Renamed; 50 | return; 51 | } 52 | 53 | internal Asn1Numeric(Asn1Identifier id, long value_Renamed) : base(id) 54 | { 55 | content = (System.Int64)value_Renamed; 56 | return; 57 | } 58 | 59 | /* internal Asn1Numeric(Asn1Identifier id, System.Int64 value_Renamed):base(id) 60 | { 61 | content = value_Renamed; 62 | return ; 63 | } 64 | */ 65 | /// Returns the content of this Asn1Numeric object as an int. 66 | public int intValue() 67 | { 68 | return (int)content; 69 | } 70 | 71 | /// Returns the content of this Asn1Numeric object as a long. 72 | public long longValue() 73 | { 74 | return (long)content; 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/Edir/EventData/BaseEdirEventData.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.Edir.EventData.BaseEdirEventData.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System.IO; 34 | 35 | namespace Novell.Directory.Ldap.Events.Edir.EventData 36 | { 37 | /// 38 | /// This is the base class for all types of data classes associated 39 | /// with an event. 40 | /// 41 | public class BaseEdirEventData 42 | { 43 | protected MemoryStream decodedData = null; 44 | protected LBERDecoder decoder = null; 45 | 46 | protected EdirEventDataType event_data_type; 47 | 48 | /// 49 | /// The value for this attribute allows the caller to identify the 50 | /// type of the data object. 51 | /// 52 | public EdirEventDataType EventDataType 53 | { 54 | get 55 | { 56 | return event_data_type; 57 | } 58 | } 59 | 60 | public BaseEdirEventData(EdirEventDataType eventDataType, Asn1Object message) 61 | { 62 | event_data_type = eventDataType; 63 | 64 | byte[] byteData = SupportClass.ToByteArray(((Asn1OctetString)message).byteValue()); 65 | decodedData = new MemoryStream(byteData); 66 | decoder = new LBERDecoder(); 67 | } 68 | 69 | protected void DataInitDone() 70 | { 71 | // We dont want the unnecessary memory to remain occupied if 72 | // this object is retained by the caller 73 | decodedData = null; 74 | decoder = null; 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcSearchResultReference.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcSearchResultReference.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents an Ldap Search Result Reference. 39 | /// 40 | ///
41 |     /// SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LdapURL
42 |     /// 
43 | ///
44 | public class RfcSearchResultReference : Asn1SequenceOf 45 | { 46 | 47 | //************************************************************************* 48 | // Constructors for SearchResultReference 49 | //************************************************************************* 50 | 51 | /// The only time a client will create a SearchResultReference is when it is 52 | /// decoding it from an InputStream 53 | /// 54 | [CLSCompliantAttribute(false)] 55 | public RfcSearchResultReference(Asn1Decoder dec, System.IO.Stream in_Renamed, int len) : base(dec, in_Renamed, len) 56 | { 57 | return; 58 | } 59 | 60 | //************************************************************************* 61 | // Accessors 62 | //************************************************************************* 63 | 64 | /// Override getIdentifier to return an application-wide id. 65 | public override Asn1Identifier getIdentifier() 66 | { 67 | return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.SEARCH_RESULT_REFERENCE); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/LdapEventArgs.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.LdapEventArgs.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | 33 | using System.Text; 34 | 35 | namespace Novell.Directory.Ldap.Events 36 | { 37 | /// 38 | /// This class represents the EventArgs for Ldap events in general. 39 | /// This is also the base class for more specific Ldap events. 40 | /// 41 | /// 42 | /// 43 | public class LdapEventArgs : DirectoryEventArgs 44 | { 45 | protected LdapEventType eType; 46 | public LdapEventType EventType 47 | { 48 | get 49 | { 50 | return eType; 51 | } 52 | set 53 | { 54 | eType = value; 55 | } 56 | } 57 | 58 | public LdapEventArgs( 59 | LdapMessage sourceMessage, 60 | EventClassifiers aClassification, 61 | LdapEventType aType) 62 | : base(sourceMessage, aClassification) 63 | { 64 | eType = aType; 65 | } 66 | 67 | public override string ToString() 68 | { 69 | StringBuilder buf = new StringBuilder(); 70 | buf.Append("["); 71 | buf.AppendFormat("{0}:", GetType()); 72 | buf.AppendFormat("(Classification={0})", eClassification); 73 | buf.AppendFormat("(Type={0})", eType); 74 | buf.AppendFormat("(EventInformation:{0})", ldap_message); 75 | buf.Append("]"); 76 | 77 | return buf.ToString(); 78 | } 79 | } // end of class LdapEventArgs 80 | } 81 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Utilclass/ArrayEnumeration.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Utilclass.ArrayEnumeration.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap.Utilclass 33 | { 34 | 35 | public class ArrayEnumeration : System.Collections.IEnumerator 36 | { 37 | private System.Object tempAuxObj; 38 | public virtual bool MoveNext() 39 | { 40 | bool result = hasMoreElements(); 41 | if (result) 42 | { 43 | tempAuxObj = nextElement(); 44 | } 45 | return result; 46 | } 47 | public virtual void Reset() 48 | { 49 | tempAuxObj = null; 50 | } 51 | public virtual System.Object Current 52 | { 53 | get 54 | { 55 | return tempAuxObj; 56 | } 57 | 58 | } 59 | private System.Object[] eArray; 60 | private int index = 0; 61 | /// Constructor to create the Enumeration 62 | /// 63 | /// 64 | /// the array to use for the Enumeration 65 | /// 66 | public ArrayEnumeration(System.Object[] eArray) 67 | { 68 | this.eArray = eArray; 69 | } 70 | 71 | public bool hasMoreElements() 72 | { 73 | if (eArray == null) 74 | return false; 75 | return (index < eArray.Length); 76 | } 77 | 78 | public System.Object nextElement() 79 | { 80 | if ((eArray == null) || (index >= eArray.Length)) 81 | { 82 | throw new System.ArgumentOutOfRangeException(); 83 | } 84 | return eArray[index++]; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcAttributeDescriptionList.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcAttributeDescriptionList.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | 34 | namespace Novell.Directory.Ldap.Rfc2251 35 | { 36 | 37 | /// 38 | /// The AttributeDescriptionList is used to list attributes to be returned in 39 | /// a search request. 40 | /// 41 | ///
42 |     /// AttributeDescriptionList ::= SEQUENCE OF
43 |     /// AttributeDescription
44 |     /// 
45 | /// 46 | ///
47 | /// 48 | /// 49 | /// 50 | /// 51 | /// 52 | /// 53 | public class RfcAttributeDescriptionList : Asn1SequenceOf 54 | { 55 | /// 56 | public RfcAttributeDescriptionList(int size) : base(size) 57 | { 58 | return; 59 | } 60 | 61 | /// Convenience constructor. This constructor will construct an 62 | /// AttributeDescriptionList using the supplied array of Strings. 63 | /// 64 | public RfcAttributeDescriptionList(System.String[] attrs) : base(attrs == null ? 0 : attrs.Length) 65 | { 66 | 67 | if (attrs != null) 68 | { 69 | for (int i = 0; i < attrs.Length; i++) 70 | { 71 | add(new RfcAttributeDescription(attrs[i])); 72 | } 73 | } 74 | return; 75 | } 76 | 77 | /* 78 | * Override add() to only accept types of AttributeDescription 79 | * 80 | * @exception Asn1InvalidTypeException 81 | */ 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/Edir/EventData/NetworkAddressEventData.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.Edir.EventData.NetworkAddressEventData.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System.Text; 34 | 35 | namespace Novell.Directory.Ldap.Events.Edir.EventData 36 | { 37 | /// 38 | /// This class represents the data for Network Address Events. 39 | /// 40 | public class NetworkAddressEventData : BaseEdirEventData 41 | { 42 | protected int nType; 43 | public int ValueType 44 | { 45 | get 46 | { 47 | return nType; 48 | } 49 | } 50 | 51 | protected string strData; 52 | public string Data 53 | { 54 | get 55 | { 56 | return strData; 57 | } 58 | } 59 | 60 | public NetworkAddressEventData(EdirEventDataType eventDataType, Asn1Object message) 61 | : base(eventDataType, message) 62 | { 63 | int[] length = new int[1]; 64 | 65 | nType = ((Asn1Integer)decoder.decode(decodedData, length)).intValue(); 66 | strData = ((Asn1OctetString)decoder.decode(decodedData, length)).stringValue(); 67 | 68 | DataInitDone(); 69 | } 70 | 71 | /// 72 | /// Returns a string representation of the object. 73 | /// 74 | public override string ToString() 75 | { 76 | StringBuilder buf = new StringBuilder(); 77 | buf.Append("[NetworkAddress"); 78 | buf.AppendFormat("(type={0})", nType); 79 | buf.AppendFormat("(Data={0})", strData); 80 | buf.Append("]"); 81 | 82 | return buf.ToString(); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/LdapDeleteRequest.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.LdapDeleteRequest.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Rfc2251; 33 | 34 | namespace Novell.Directory.Ldap 35 | { 36 | 37 | /// Represents a request to delete an entry. 38 | /// 39 | /// 40 | /// 41 | /// 42 | /* 43 | * DelRequest ::= [APPLICATION 10] LdapDN 44 | */ 45 | public class LdapDeleteRequest : LdapMessage 46 | { 47 | /// Returns of the dn of the entry to delete from the directory 48 | /// 49 | /// 50 | /// the dn of the entry to delete 51 | /// 52 | virtual public System.String DN 53 | { 54 | get 55 | { 56 | return Asn1Object.RequestDN; 57 | } 58 | 59 | } 60 | /// Constructs a request to delete an entry from the directory 61 | /// 62 | /// 63 | /// the dn of the entry to delete. 64 | /// 65 | /// 66 | /// Any controls that apply to the abandon request 67 | /// or null if none. 68 | /// 69 | public LdapDeleteRequest(System.String dn, LdapControl[] cont) : base(LdapMessage.DEL_REQUEST, new RfcDelRequest(dn), cont) 70 | { 71 | return; 72 | } 73 | 74 | /// Return an Asn1 representation of this delete request 75 | /// 76 | /// #return an Asn1 representation of this object 77 | /// 78 | public override System.String ToString() 79 | { 80 | return Asn1Object.ToString(); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/LdapAuthHandler.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.LdapAuthHandler.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap 33 | { 34 | 35 | /// 36 | /// Used to provide credentials for authentication when processing a 37 | /// referral. 38 | /// 39 | /// A programmer desiring to supply authentication credentials 40 | /// to the API when automatically following referrals MUST 41 | /// implement this interface. If LdapAuthHandler or LdapBindHandler are not 42 | /// implemented, automatically followed referrals will use anonymous 43 | /// authentication. Referral URLs of any type other than Ldap (i.e. a 44 | /// referral URL other than ldap://something) are not chased automatically 45 | /// by the API on automatic following. 46 | /// 47 | /// 48 | /// 49 | /// 50 | /// 51 | /// 52 | /// 53 | public interface LdapAuthHandler : LdapReferralHandler 54 | { 55 | 56 | /// Returns an object which can provide credentials for authenticating to 57 | /// a server at the specified host and port. 58 | /// 59 | /// 60 | /// Contains a host name or the IP address (in dotted string 61 | /// format) of a host running an Ldap server. 62 | /// 63 | /// 64 | /// Contains the TCP or UDP port number of the host. 65 | /// 66 | /// 67 | /// An object with authentication credentials to the specified 68 | /// host and port. 69 | /// 70 | LdapAuthProvider getAuthProvider(System.String host, int port); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcAuthenticationChoice.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcAuthenticationChoice.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents an Ldap Authentication Choice. 39 | /// 40 | ///
41 |     /// AuthenticationChoice ::= CHOICE {
42 |     /// simple                  [0] OCTET STRING,
43 |     /// -- 1 and 2 reserved
44 |     /// sasl                    [3] SaslCredentials }
45 |     /// 
46 | ///
47 | public class RfcAuthenticationChoice : Asn1Choice 48 | { 49 | 50 | //************************************************************************* 51 | // Constructors for AuthenticationChoice 52 | //************************************************************************* 53 | 54 | /// 55 | public RfcAuthenticationChoice(Asn1Tagged choice) : base(choice) 56 | { 57 | } 58 | 59 | [CLSCompliantAttribute(false)] 60 | public RfcAuthenticationChoice(System.String mechanism, sbyte[] credentials) : base(new Asn1Tagged(new Asn1Identifier(Asn1Identifier.CONTEXT, true, 3), new RfcSaslCredentials(new RfcLdapString(mechanism), credentials != null ? new Asn1OctetString(credentials) : null), false)) 61 | { // implicit tagging 62 | } 63 | 64 | //************************************************************************* 65 | // Mutators 66 | //************************************************************************* 67 | 68 | //************************************************************************* 69 | // Accessors 70 | //************************************************************************* 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/Edir/EventData/DSETimeStamp.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.Edir.EventData.DSETimeStamp.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System.Text; 34 | 35 | namespace Novell.Directory.Ldap.Events.Edir 36 | { 37 | /// 38 | /// The class represents the Timestamp datastructure for Edir events 39 | /// Notification. 40 | /// 41 | public class DSETimeStamp 42 | { 43 | protected int nSeconds; 44 | public int Seconds 45 | { 46 | get 47 | { 48 | return nSeconds; 49 | } 50 | } 51 | 52 | protected int replica_number; 53 | public int ReplicaNumber 54 | { 55 | get 56 | { 57 | return replica_number; 58 | } 59 | } 60 | 61 | protected int nEvent; 62 | public int Event 63 | { 64 | get 65 | { 66 | return nEvent; 67 | } 68 | } 69 | 70 | public DSETimeStamp(Asn1Sequence dseObject) 71 | { 72 | nSeconds = ((Asn1Integer)dseObject.get_Renamed(0)).intValue(); 73 | replica_number = ((Asn1Integer)dseObject.get_Renamed(1)).intValue(); 74 | nEvent = ((Asn1Integer)dseObject.get_Renamed(2)).intValue(); 75 | } 76 | 77 | /// 78 | /// Returns a string representation of the object. 79 | /// 80 | public override string ToString() 81 | { 82 | StringBuilder buf = new StringBuilder(); 83 | 84 | buf.AppendFormat("[TimeStamp (seconds={0})", nSeconds); 85 | buf.AppendFormat("(replicaNumber={0})", replica_number); 86 | buf.AppendFormat("(event={0})", nEvent); 87 | buf.Append("]"); 88 | 89 | return buf.ToString(); 90 | } 91 | } 92 | } 93 | 94 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcAttributeValueAssertion.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcAttributeValueAssertion.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents an Ldap Attribute Value Assertion. 39 | /// 40 | ///
41 |     /// AttributeValueAssertion ::= SEQUENCE {
42 |     /// attributeDesc   AttributeDescription,
43 |     /// assertionValue  AssertionValue }
44 |     /// 
45 | ///
46 | public class RfcAttributeValueAssertion : Asn1Sequence 47 | { 48 | /// Returns the attribute description. 49 | /// 50 | /// 51 | /// the attribute description 52 | /// 53 | virtual public System.String AttributeDescription 54 | { 55 | get 56 | { 57 | return ((RfcAttributeDescription)get_Renamed(0)).stringValue(); 58 | } 59 | 60 | } 61 | /// Returns the assertion value. 62 | /// 63 | /// 64 | /// the assertion value. 65 | /// 66 | [CLSCompliantAttribute(false)] 67 | virtual public sbyte[] AssertionValue 68 | { 69 | get 70 | { 71 | return ((RfcAssertionValue)get_Renamed(1)).byteValue(); 72 | } 73 | 74 | } 75 | 76 | /// Creates an Attribute Value Assertion. 77 | /// 78 | /// 79 | /// The assertion description 80 | /// 81 | /// 82 | /// The assertion value 83 | /// 84 | public RfcAttributeValueAssertion(RfcAttributeDescription ad, RfcAssertionValue av) : base(2) 85 | { 86 | add(ad); 87 | add(av); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/LdapResponseQueue.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.LdapResponseQueue.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap 33 | { 34 | 35 | /// A mechanism for processing asynchronous messages received from a server. 36 | /// It represents the message queue associated with a particular asynchronous 37 | /// Ldap operation or operations. 38 | /// 39 | public class LdapResponseQueue : LdapMessageQueue 40 | { 41 | /// Constructs a response queue using the specified message agent 42 | /// 43 | /// 44 | /// The message agent to associate with this queue 45 | /// 46 | /* package */ 47 | internal LdapResponseQueue(MessageAgent agent) : base("LdapResponseQueue", agent) 48 | { 49 | return; 50 | } 51 | 52 | /// Merges two message queues. It appends the current and 53 | /// future contents from another queue to this one. 54 | /// 55 | /// After the operation, queue2.getMessageIDs() 56 | /// returns an empty array, and its outstanding responses 57 | /// have been removed and appended to this queue. 58 | /// 59 | /// 60 | /// The queue that is merged from. Following 61 | /// the merge, this queue object will no 62 | /// longer receive any data, and calls made 63 | /// to its methods will fail with a RuntimeException. 64 | /// The queue can be reactivated by using it in an 65 | /// Ldap request, after which it will receive responses 66 | /// for that request.. 67 | /// 68 | public virtual void merge(LdapMessageQueue queue2) 69 | { 70 | LdapResponseQueue q = (LdapResponseQueue)queue2; 71 | agent.merge(q.MessageAgent); 72 | 73 | return; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcUnbindRequest.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcUnbindRequest.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using Novell.Directory.Ldap.Utilclass; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents the Ldap Unbind request. 39 | /// 40 | ///
41 |     /// UnbindRequest ::= [APPLICATION 2] NULL
42 |     /// 
43 | ///
44 | public class RfcUnbindRequest : Asn1Null, RfcRequest 45 | { 46 | 47 | //************************************************************************* 48 | // Constructor for UnbindRequest 49 | //************************************************************************* 50 | 51 | /// Construct an RfCUnbind Request 52 | public RfcUnbindRequest() : base() 53 | { 54 | return; 55 | } 56 | 57 | //************************************************************************* 58 | // Accessors 59 | //************************************************************************* 60 | 61 | /// Override getIdentifier to return an application-wide id. 62 | ///
63 |         /// ID = CLASS: APPLICATION, FORM: PRIMITIVE, TAG: 2. (0x42)
64 |         /// 
65 | ///
66 | public override Asn1Identifier getIdentifier() 67 | { 68 | return new Asn1Identifier(Asn1Identifier.APPLICATION, false, LdapMessage.UNBIND_REQUEST); 69 | } 70 | 71 | public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request) 72 | { 73 | throw new LdapException(ExceptionMessages.NO_DUP_REQUEST, new System.Object[] { "unbind" }, LdapException.Ldap_NOT_SUPPORTED, (System.String)null); 74 | } 75 | 76 | public System.String getRequestDN() 77 | { 78 | return null; 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/LdapSearchResultReference.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.LdapSearchResultReference.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using Novell.Directory.Ldap.Rfc2251; 34 | 35 | namespace Novell.Directory.Ldap 36 | { 37 | 38 | /// 39 | /// Encapsulates a continuation reference from an asynchronous search operation. 40 | /// 41 | /// 42 | public class LdapSearchResultReference : LdapMessage 43 | { 44 | /// Returns any URLs in the object. 45 | /// 46 | /// 47 | /// The URLs. 48 | /// 49 | virtual public System.String[] Referrals 50 | { 51 | get 52 | { 53 | Asn1Object[] references = ((RfcSearchResultReference)message.Response).toArray(); 54 | srefs = new System.String[references.Length]; 55 | for (int i = 0; i < references.Length; i++) 56 | { 57 | srefs[i] = ((Asn1OctetString)(references[i])).stringValue(); 58 | } 59 | return (srefs); 60 | } 61 | 62 | } 63 | 64 | private System.String[] srefs; 65 | private static System.Object nameLock; // protect agentNum 66 | private static int refNum = 0; // Debug, LdapConnection number 67 | private System.String name; // String name for debug 68 | /*package*/ /// Constructs an LdapSearchResultReference object. 69 | /// 70 | /// 71 | /// The LdapMessage with a search reference. 72 | /// 73 | internal LdapSearchResultReference(RfcLdapMessage message) : base(message) 74 | { 75 | return; 76 | } 77 | static LdapSearchResultReference() 78 | { 79 | nameLock = new System.Object(); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcAbandonRequest.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcAbandonRequest.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using Novell.Directory.Ldap.Utilclass; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents the Ldap Abandon Request. 39 | /// 40 | ///
41 |     /// AbandonRequest ::= [APPLICATION 16] MessageID
42 |     /// 
43 | ///
44 | class RfcAbandonRequest : RfcMessageID, RfcRequest 45 | { 46 | 47 | //************************************************************************* 48 | // Constructor for AbandonRequest 49 | //************************************************************************* 50 | 51 | /// Constructs an RfcAbandonRequest 52 | public RfcAbandonRequest(int msgId) : base(msgId) 53 | { 54 | return; 55 | } 56 | 57 | //************************************************************************* 58 | // Accessors 59 | //************************************************************************* 60 | 61 | /// Override getIdentifier to return an application-wide id. 62 | ///
63 |         /// ID = CLASS: APPLICATION, FORM: CONSTRUCTED, TAG: 16. (0x50)
64 |         /// 
65 | ///
66 | public override Asn1Identifier getIdentifier() 67 | { 68 | return new Asn1Identifier(Asn1Identifier.APPLICATION, false, LdapMessage.ABANDON_REQUEST); 69 | } 70 | 71 | public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool reference) 72 | { 73 | throw new LdapException(ExceptionMessages.NO_DUP_REQUEST, new System.Object[] { "Abandon" }, LdapException.Ldap_NOT_SUPPORTED, (System.String)null); 74 | } 75 | public System.String getRequestDN() 76 | { 77 | return null; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/LdapSearchQueue.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.LdapSearchQueue.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap 33 | { 34 | 35 | /// A mechanism for queuing asynchronous search results 36 | /// received from a server. 37 | /// 38 | /// 39 | /// 40 | /// 41 | /// 42 | /// 43 | public class LdapSearchQueue : LdapMessageQueue 44 | { 45 | /// Constructs a response queue using a specific client queue 46 | /// 47 | /// 48 | /// The message agent to associate with this queue 49 | /// 50 | /* package */ 51 | internal LdapSearchQueue(MessageAgent agent) : base("LdapSearchQueue", agent) 52 | { 53 | return; 54 | } 55 | /// Merges two message queues. It appends the current and 56 | /// future contents from another queue to this one. 57 | /// 58 | /// After the operation, queue2.getMessageIDs() 59 | /// returns an empty array, and its outstanding responses 60 | /// have been removed and appended to this queue. 61 | /// 62 | /// 63 | /// The queue that is merged from. Following 64 | /// the merge, this queue object will no 65 | /// longer receive any data, and calls made 66 | /// to its methods will fail with a RuntimeException. 67 | /// The queue can be reactivated by using it in an 68 | /// Ldap request, after which it will receive responses 69 | /// for that request.. 70 | /// 71 | public virtual void merge(LdapMessageQueue queue2) 72 | { 73 | 74 | LdapSearchQueue q = (LdapSearchQueue)queue2; 75 | agent.merge(q.MessageAgent); 76 | 77 | return; 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Utilclass/AttributeQualifier.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Utilclass.AttributeQualifier.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap.Utilclass 33 | { 34 | 35 | /// Encapsulates a qualifier in a Schema definition. Definitions that are not 36 | /// in rfc2252. Begins with 'X-' 37 | /// 38 | public class AttributeQualifier 39 | { 40 | virtual public System.String Name 41 | { 42 | /* 43 | public void addValue( String value ) 44 | { 45 | values.add( value ); 46 | return; 47 | } 48 | */ 49 | 50 | get 51 | { 52 | return name; 53 | } 54 | 55 | } 56 | virtual public System.String[] Values 57 | { 58 | get 59 | { 60 | System.String[] strValues = null; 61 | if (values.Count > 0) 62 | { 63 | strValues = new System.String[values.Count]; 64 | for (int i = 0; i < values.Count; i++) 65 | { 66 | strValues[i] = ((System.String)values[i]); 67 | } 68 | } 69 | return strValues; 70 | } 71 | 72 | } 73 | internal System.String name; 74 | internal System.Collections.ArrayList values; 75 | 76 | public AttributeQualifier(System.String name, System.String[] value_Renamed) 77 | { 78 | if ((System.Object)name == null || value_Renamed == null) 79 | { 80 | throw new System.ArgumentException("A null name or value " + "was passed in for a schema definition qualifier"); 81 | } 82 | this.name = name; 83 | values = new System.Collections.ArrayList(5); 84 | for (int i = 0; i < value_Renamed.Length; i++) 85 | { 86 | values.Add(value_Renamed[i]); 87 | } 88 | return; 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Utilclass/EnumeratedIterator.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Utilclass.EnumeratedIterator.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap.Utilclass 33 | { 34 | /// wrappers a class of type Iterator and makes it act as an Enumerator. This 35 | /// is used when the API requires enumerations be used but we may be using 36 | /// JDK1.2 collections, which return iterators instead of enumerators. Used by 37 | /// LdapSchema and LdapSchemaElement 38 | /// 39 | /// 40 | /// 41 | /// 42 | /// 43 | /// 44 | 45 | public class EnumeratedIterator : System.Collections.IEnumerator 46 | { 47 | private System.Object tempAuxObj; 48 | public virtual bool MoveNext() 49 | { 50 | bool result = hasMoreElements(); 51 | if (result) 52 | { 53 | tempAuxObj = nextElement(); 54 | } 55 | return result; 56 | } 57 | public virtual void Reset() 58 | { 59 | tempAuxObj = null; 60 | } 61 | public virtual System.Object Current 62 | { 63 | get 64 | { 65 | return tempAuxObj; 66 | } 67 | 68 | } 69 | private System.Collections.IEnumerator i; 70 | 71 | public EnumeratedIterator(System.Collections.IEnumerator iterator) 72 | { 73 | i = iterator; 74 | return; 75 | } 76 | 77 | /// Enumeration method that maps to Iterator.hasNext() 78 | public bool hasMoreElements() 79 | { 80 | return i.MoveNext(); 81 | } 82 | 83 | /// Enumeration method that maps to Iterator.next() 84 | public System.Object nextElement() 85 | { 86 | return i.Current; 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Asn1/Asn1Null.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Asn1.Asn1Null.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using System; 33 | 34 | namespace Novell.Directory.Ldap.Asn1 35 | { 36 | 37 | /// This class represents the ASN.1 NULL type. 38 | [CLSCompliantAttribute(true)] 39 | public class Asn1Null : Asn1Object 40 | { 41 | 42 | /// ASN.1 NULL tag definition. 43 | public const int TAG = 0x05; 44 | 45 | /// ID is added for Optimization. 46 | /// ID needs only be one Value for every instance, 47 | /// thus we create it only once. 48 | /// 49 | public static readonly Asn1Identifier ID = new Asn1Identifier(Asn1Identifier.UNIVERSAL, false, TAG); 50 | /* Constructor for Asn1Null 51 | */ 52 | 53 | /// Call this constructor to construct a new Asn1Null 54 | /// object. 55 | /// 56 | public Asn1Null() : base(ID) 57 | { 58 | return; 59 | } 60 | 61 | /* Asn1Object implementation 62 | */ 63 | 64 | /// Call this method to encode the current instance into the 65 | /// specified output stream using the specified encoder object. 66 | /// 67 | /// 68 | /// Encoder object to use when encoding self. 69 | /// 70 | /// 71 | /// The output stream onto which the encoded byte 72 | /// stream is written. 73 | /// 74 | public override void encode(Asn1Encoder enc, System.IO.Stream out_Renamed) 75 | { 76 | enc.encode(this, out_Renamed); 77 | return; 78 | } 79 | 80 | /* Asn1Null specific methods 81 | */ 82 | 83 | /// Return a String representation of this Asn1Null object. 84 | public override System.String ToString() 85 | { 86 | return base.ToString() + "NULL: \"\""; 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Extensions/GetBindDNRequest.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Extensions.GetBindDNRequest.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | namespace Novell.Directory.Ldap.Extensions 33 | { 34 | 35 | /// Returns the distingusihed name of the object your are logged in as. 36 | /// 37 | /// To use this class, you must create an instance of the 38 | /// class and then call the extendedOperation method with this 39 | /// object as the required LdapExtendedOperation parameter. 40 | /// 41 | /// The returned LdapExtendedResponse object can then be converted to 42 | /// a GetBindDNResponse object with the ExtendedREsponseFactory 43 | /// class. This object contains methods for retrieving the distinguished 44 | /// name. 45 | /// 46 | /// The GetBindDNRequest extension uses the following OID: 47 | /// 2.16.840.1.113719.1.27.100.31 48 | /// 49 | /// The request value has a value of null. 50 | /// 51 | /// 52 | public class GetBindDNRequest : LdapExtendedOperation 53 | { 54 | 55 | static GetBindDNRequest() 56 | { 57 | /* 58 | * Register the extendedresponse class which is returned by the 59 | * server in response to a ListReplicasRequest 60 | */ 61 | try 62 | { 63 | LdapExtendedResponse.register(ReplicationConstants.GET_IDENTITY_NAME_RES, System.Type.GetType("Novell.Directory.Ldap.Extensions.GetBindDNResponse")); 64 | } 65 | catch (System.Exception e) 66 | { 67 | System.Console.Error.WriteLine("Could not register Extended Response -" + " Class not found"); 68 | } 69 | } 70 | 71 | /// Constructs an extended operation object for retrieving the bind dn. 72 | /// 73 | /// 74 | /// LdapException A general exception which includes an error 75 | /// message and an Ldap error code. 76 | /// 77 | 78 | public GetBindDNRequest() : base(ReplicationConstants.GET_IDENTITY_NAME_REQ, null) 79 | { 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/Edir/MonitorEventResponse.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.Edir.MonitorEventResponse.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using Novell.Directory.Ldap.Rfc2251; 34 | 35 | namespace Novell.Directory.Ldap.Events.Edir 36 | { 37 | /// 38 | /// This object represents the ExtendedResponse returned when Event 39 | /// Registeration fails. This Extended Response structure is generated for 40 | /// requests send as MonitorEventRequest. 41 | /// 42 | public class MonitorEventResponse : LdapExtendedResponse 43 | { 44 | protected EdirEventSpecifier[] specifier_list; 45 | public EdirEventSpecifier[] SpecifierList 46 | { 47 | get 48 | { 49 | return specifier_list; 50 | } 51 | } 52 | 53 | public MonitorEventResponse(RfcLdapMessage message) 54 | : base(message) 55 | { 56 | sbyte[] returnedValue = Value; 57 | 58 | if (null == returnedValue) 59 | { 60 | throw new LdapException(LdapException.resultCodeToString(ResultCode), 61 | ResultCode, 62 | null); 63 | } 64 | 65 | LBERDecoder decoder = new LBERDecoder(); 66 | 67 | Asn1Sequence sequence = (Asn1Sequence)decoder.decode(returnedValue); 68 | 69 | int length = ((Asn1Integer)sequence.get_Renamed(0)).intValue(); 70 | Asn1Set sequenceSet = (Asn1Set)sequence.get_Renamed(1); 71 | specifier_list = new EdirEventSpecifier[length]; 72 | 73 | for (int i = 0; i < length; i++) 74 | { 75 | Asn1Sequence eventspecifiersequence = 76 | (Asn1Sequence)sequenceSet.get_Renamed(i); 77 | int classfication = 78 | ((Asn1Integer)eventspecifiersequence.get_Renamed(0)).intValue(); 79 | int enumtype = 80 | ((Asn1Enumerated)eventspecifiersequence.get_Renamed(1)).intValue(); 81 | specifier_list[i] = 82 | new EdirEventSpecifier((EdirEventType)classfication, (EdirEventResultType)enumtype); 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcMessageID.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcMessageID.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | 34 | namespace Novell.Directory.Ldap.Rfc2251 35 | { 36 | 37 | /// Represents an Ldap Message ID. 38 | /// 39 | ///
40 |     /// MessageID ::= INTEGER (0 .. maxInt)
41 |     /// 
42 |     /// maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
43 |     /// 
44 |     /// Note: The creation of a MessageID should be hidden within the creation of
45 |     /// an RfcLdapMessage. The MessageID needs to be in sequence, and has an
46 |     /// upper and lower limit. There is never a case when a user should be
47 |     /// able to specify the MessageID for an RfcLdapMessage. The MessageID()
48 |     /// class should be package protected. (So the MessageID value isn't
49 |     /// arbitrarily run up.)
50 |     /// 
51 | ///
52 | class RfcMessageID : Asn1Integer 53 | { 54 | /// Increments the message number atomically 55 | /// 56 | /// 57 | /// the new message number 58 | /// 59 | private static int MessageID 60 | { 61 | get 62 | { 63 | lock (lock_Renamed) 64 | { 65 | return (messageID < System.Int32.MaxValue) ? ++messageID : (messageID = 1); 66 | } 67 | } 68 | 69 | } 70 | 71 | private static int messageID = 0; 72 | private static System.Object lock_Renamed; 73 | 74 | /// Creates a MessageID with an auto incremented Asn1Integer value. 75 | /// 76 | /// Bounds: (0 .. 2,147,483,647) (2^^31 - 1 or Integer.MAX_VALUE) 77 | /// 78 | /// MessageID zero is never used in this implementation. Always 79 | /// start the messages with one. 80 | /// 81 | protected internal RfcMessageID() : base(MessageID) 82 | { 83 | } 84 | 85 | /// Creates a MessageID with a specified int value. 86 | protected internal RfcMessageID(int i) : base(i) 87 | { 88 | } 89 | static RfcMessageID() 90 | { 91 | lock_Renamed = new System.Object(); 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Utilclass/ReferralInfo.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Utilclass.ReferralInfo.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | using System; 32 | 33 | namespace Novell.Directory.Ldap.Utilclass 34 | { 35 | 36 | /// This class encapsulates the combination of LdapReferral URL and 37 | /// the connection opened to service this URL 38 | /// 39 | [Serializable] 40 | public class ReferralInfo 41 | { 42 | /// Returns the referral URL 43 | /// 44 | /// 45 | /// the Referral URL 46 | /// 47 | virtual public LdapUrl ReferralUrl 48 | { 49 | get 50 | { 51 | return referralUrl; 52 | } 53 | 54 | } 55 | /// Returns the referral Connection 56 | /// 57 | /// 58 | /// the Referral Connection 59 | /// 60 | virtual public LdapConnection ReferralConnection 61 | { 62 | get 63 | { 64 | return conn; 65 | } 66 | 67 | } 68 | /// Returns the referral list 69 | /// 70 | /// 71 | /// the Referral list 72 | /// 73 | virtual public System.String[] ReferralList 74 | { 75 | get 76 | { 77 | return referralList; 78 | } 79 | 80 | } 81 | // private DirectoryEntry conn; 82 | private LdapConnection conn; 83 | private LdapUrl referralUrl; 84 | private System.String[] referralList; 85 | 86 | /// Construct the ReferralInfo class 87 | /// 88 | /// 89 | /// The DirectoryEntry opened to process this referral 90 | /// 91 | /// 92 | /// The URL string associated with this connection 93 | /// 94 | public ReferralInfo(LdapConnection lc, System.String[] refList, LdapUrl refUrl) 95 | { 96 | conn = lc; 97 | referralUrl = refUrl; 98 | referralList = refList; 99 | return; 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcModifyDNResponse.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcModifyDNResponse.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents an Ldap Modify DN Request. 39 | /// 40 | ///
41 |     /// ModifyDNResponse ::= [APPLICATION 13] LdapResult
42 |     /// 
43 | ///
44 | public class RfcModifyDNResponse : RfcLdapResult 45 | { 46 | 47 | //************************************************************************* 48 | // Constructor for ModifyDNResponse 49 | //************************************************************************* 50 | 51 | /// Create a ModifyDNResponse by decoding it from an InputStream 52 | [CLSCompliantAttribute(false)] 53 | public RfcModifyDNResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len) : base(dec, in_Renamed, len) 54 | { 55 | } 56 | 57 | /// Constructs an RfcModifyDNResponse from parameters. 58 | /// 59 | /// 60 | /// the result code of the operation 61 | /// 62 | /// 63 | /// the matched DN returned from the server 64 | /// 65 | /// 66 | /// the diagnostic message returned from the server 67 | /// 68 | /// 69 | /// the referral(s) returned by the server 70 | /// 71 | public RfcModifyDNResponse(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral) : base(resultCode, matchedDN, errorMessage, referral) 72 | { 73 | return; 74 | } 75 | 76 | //************************************************************************* 77 | // Accessors 78 | //************************************************************************* 79 | 80 | /// Override getIdentifier to return an application-wide id. 81 | public override Asn1Identifier getIdentifier() 82 | { 83 | return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.MODIFY_RDN_RESPONSE); 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcAddResponse.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcAddResponse.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents the Ldap Add Response. 39 | /// 40 | ///
41 |     /// AddResponse ::= [APPLICATION 9] LdapResult
42 |     /// 
43 | ///
44 | public class RfcAddResponse : RfcLdapResult 45 | { 46 | 47 | //************************************************************************* 48 | // Constructors for AddResponse 49 | //************************************************************************* 50 | 51 | /// The only time a client will create a AddResponse is when it is 52 | /// decoding it from an InputStream 53 | /// 54 | [CLSCompliantAttribute(false)] 55 | public RfcAddResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len) : base(dec, in_Renamed, len) 56 | { 57 | } 58 | 59 | /// Constructs an RfcAddResponse from parameters. 60 | /// 61 | /// 62 | /// the result code of the operation 63 | /// 64 | /// 65 | /// the matched DN returned from the server 66 | /// 67 | /// 68 | /// the diagnostic message returned from the server 69 | /// 70 | /// 71 | /// the referral(s) returned by the server 72 | /// 73 | public RfcAddResponse(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral) : base(resultCode, matchedDN, errorMessage, referral) 74 | { 75 | return; 76 | } 77 | 78 | //************************************************************************* 79 | // Accessors 80 | //************************************************************************* 81 | 82 | /// Override getIdentifier to return an application-wide id. 83 | public override Asn1Identifier getIdentifier() 84 | { 85 | return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.ADD_RESPONSE); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcSearchResultDone.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcSearchResultDone.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents an Ldap Search Result Done Response. 39 | /// 40 | ///
41 |     /// SearchResultDone ::= [APPLICATION 5] LdapResult
42 |     /// 
43 | ///
44 | public class RfcSearchResultDone : RfcLdapResult 45 | { 46 | 47 | //************************************************************************* 48 | // Constructors for SearchResultDone 49 | //************************************************************************* 50 | 51 | /// Decode a search result done from the input stream. 52 | [CLSCompliantAttribute(false)] 53 | public RfcSearchResultDone(Asn1Decoder dec, System.IO.Stream in_Renamed, int len) : base(dec, in_Renamed, len) 54 | { 55 | return; 56 | } 57 | 58 | /// Constructs an RfcSearchResultDone from parameters. 59 | /// 60 | /// 61 | /// the result code of the operation 62 | /// 63 | /// 64 | /// the matched DN returned from the server 65 | /// 66 | /// 67 | /// the diagnostic message returned from the server 68 | /// 69 | /// 70 | /// the referral(s) returned by the server 71 | /// 72 | public RfcSearchResultDone(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral) : base(resultCode, matchedDN, errorMessage, referral) 73 | { 74 | return; 75 | } 76 | 77 | //************************************************************************* 78 | // Accessors 79 | //************************************************************************* 80 | 81 | /// Override getIdentifier to return an application-wide id. 82 | public override Asn1Identifier getIdentifier() 83 | { 84 | return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.SEARCH_RESULT); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcDelResponse.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcDelResponse.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents and Ldap Delete Response. 39 | /// 40 | ///
41 |     /// DelResponse ::= [APPLICATION 11] LdapResult
42 |     /// 
43 | ///
44 | public class RfcDelResponse : RfcLdapResult 45 | { 46 | 47 | //************************************************************************* 48 | // Constructors for DelResponse 49 | //************************************************************************* 50 | 51 | /// The only time a client will create a DelResponse is when it is 52 | /// decoding it from an InputStream 53 | /// 54 | [CLSCompliantAttribute(false)] 55 | public RfcDelResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len) : base(dec, in_Renamed, len) 56 | { 57 | } 58 | 59 | /// Constructs an RfcDelResponse from parameters. 60 | /// 61 | /// 62 | /// the result code of the operation 63 | /// 64 | /// 65 | /// the matched DN returned from the server 66 | /// 67 | /// 68 | /// the diagnostic message returned from the server 69 | /// 70 | /// 71 | /// the referral(s) returned by the server 72 | /// 73 | public RfcDelResponse(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral) : base(resultCode, matchedDN, errorMessage, referral) 74 | { 75 | return; 76 | } 77 | 78 | //************************************************************************* 79 | // Accessors 80 | //************************************************************************* 81 | 82 | /// Override getIdentifier to return an application-wide id. 83 | public override Asn1Identifier getIdentifier() 84 | { 85 | return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.DEL_RESPONSE); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcModifyResponse.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcModifyResponse.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents an Ldap Modify Response. 39 | /// 40 | ///
41 |     /// ModifyResponse ::= [APPLICATION 7] LdapResult
42 |     /// 
43 | ///
44 | public class RfcModifyResponse : RfcLdapResult 45 | { 46 | 47 | //************************************************************************* 48 | // Constructor for ModifyResponse 49 | //************************************************************************* 50 | 51 | /// The only time a client will create a ModifyResponse is when it is 52 | /// decoding it from an InputStream 53 | /// 54 | [CLSCompliantAttribute(false)] 55 | public RfcModifyResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len) : base(dec, in_Renamed, len) 56 | { 57 | } 58 | 59 | /// Constructs an RfcModifyResponse from parameters. 60 | /// 61 | /// 62 | /// the result code of the operation 63 | /// 64 | /// 65 | /// the matched DN returned from the server 66 | /// 67 | /// 68 | /// the diagnostic message returned from the server 69 | /// 70 | /// 71 | /// the referral(s) returned by the server 72 | /// 73 | public RfcModifyResponse(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral) : base(resultCode, matchedDN, errorMessage, referral) 74 | { 75 | return; 76 | } 77 | 78 | //************************************************************************* 79 | // Accessors 80 | //************************************************************************* 81 | 82 | /// Override getIdentifier to return an application-wide id. 83 | public override Asn1Identifier getIdentifier() 84 | { 85 | return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.MODIFY_RESPONSE); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcCompareResponse.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcCompareResponse.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents and Ldap Compare Response. 39 | /// 40 | ///
41 |     /// CompareResponse ::= [APPLICATION 15] LdapResult
42 |     /// 
43 | ///
44 | public class RfcCompareResponse : RfcLdapResult 45 | { 46 | 47 | //************************************************************************* 48 | // Constructor for CompareResponse 49 | //************************************************************************* 50 | 51 | /// The only time a client will create a CompareResponse is when it is 52 | /// decoding it from an InputStream 53 | /// 54 | [CLSCompliantAttribute(false)] 55 | public RfcCompareResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len) : base(dec, in_Renamed, len) 56 | { 57 | } 58 | 59 | /// Constructs an RfcCompareResponse from parameters. 60 | /// 61 | /// 62 | /// the result code of the operation 63 | /// 64 | /// 65 | /// the matched DN returned from the server 66 | /// 67 | /// 68 | /// the diagnostic message returned from the server 69 | /// 70 | /// 71 | /// the referral(s) returned by the server 72 | /// 73 | public RfcCompareResponse(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral) : base(resultCode, matchedDN, errorMessage, referral) 74 | { 75 | return; 76 | } 77 | 78 | //************************************************************************* 79 | // Accessors 80 | //************************************************************************* 81 | 82 | /// Override getIdentifier to return an application-wide id. 83 | public override Asn1Identifier getIdentifier() 84 | { 85 | return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.COMPARE_RESPONSE); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Controls/LdapPagedResultsResponse.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2014 VQ Communications Ltd. www.vqcomms.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Controls.LdapPagedResultsResponse.cs 25 | // 26 | // Author: 27 | // Igor Shmukler 28 | // 29 | // (C) 2014 VQ Communications Ltd. (http://www.vqcomms.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Controls 36 | { 37 | public class LdapPagedResultsResponse : LdapControl 38 | { 39 | virtual public int Size 40 | { 41 | get 42 | { 43 | return m_size; 44 | } 45 | 46 | } 47 | 48 | virtual public System.String Cookie 49 | { 50 | get 51 | { 52 | return m_cookie; 53 | } 54 | 55 | } 56 | 57 | /* The parsed fields are stored in these private variables */ 58 | private int m_size; 59 | private System.String m_cookie; 60 | 61 | [CLSCompliantAttribute(false)] 62 | public LdapPagedResultsResponse(System.String oid, bool critical, sbyte[] values) : base(oid, critical, values) 63 | { 64 | 65 | /* Create a decoder object */ 66 | LBERDecoder decoder = new LBERDecoder(); 67 | if (decoder == null) 68 | throw new System.IO.IOException("Decoding error"); 69 | 70 | /* We should get back an ASN.1 Sequence object */ 71 | Asn1Object asnObj = decoder.decode(values); 72 | if ((asnObj == null) || (!(asnObj is Asn1Sequence))) 73 | throw new System.IO.IOException("Decoding error"); 74 | 75 | /* 76 | * Get the 1st element which should be an integer containing the 77 | * size (RFC 2696). 78 | */ 79 | Asn1Object asn1Size = ((Asn1Sequence)asnObj).get_Renamed(0); 80 | if ((asn1Size != null) && (asn1Size is Asn1Integer)) 81 | m_size = ((Asn1Integer)asn1Size).intValue(); 82 | else 83 | throw new System.IO.IOException("Decoding error"); 84 | 85 | /* 86 | * Get the 2nd element which should be an octet string containing the 87 | * cookie (RFC 2696). 88 | */ 89 | Asn1Object asn1Cookie = ((Asn1Sequence)asnObj).get_Renamed(1); 90 | if ((asn1Cookie != null) && (asn1Cookie is Asn1OctetString)) 91 | m_cookie = ((Asn1OctetString)asn1Cookie).stringValue(); 92 | else 93 | throw new System.IO.IOException("Decoding error"); 94 | 95 | return; 96 | } 97 | } 98 | } -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Utilclass/ExtResponseFactory.cs: -------------------------------------------------------------------------------- 1 | using Novell.Directory.Ldap.Rfc2251; 2 | 3 | 4 | namespace Novell.Directory.Ldap.Utilclass 5 | { 6 | 7 | /// 8 | /// Takes an LdapExtendedResponse and returns an object 9 | /// (that implements the base class ParsedExtendedResponse) 10 | /// based on the OID. 11 | /// 12 | ///

You can then call methods defined in the child 13 | /// class to parse the contents of the response. The methods available 14 | /// depend on the child class. All child classes inherit from the 15 | /// ParsedExtendedResponse.

16 | /// 17 | ///
18 | public class ExtResponseFactory 19 | { 20 | 21 | /// Used to Convert an RfcLdapMessage object to the appropriate 22 | /// LdapExtendedResponse object depending on the operation being performed. 23 | /// 24 | /// 25 | /// The LdapExtendedReponse object as returned by the 26 | /// extendedOperation method in the LdapConnection object. 27 | /// 28 | /// An object of base class LdapExtendedResponse. The actual child 29 | /// class of this returned object depends on the operation being 30 | /// performed. 31 | /// 32 | 33 | static public LdapExtendedResponse convertToExtendedResponse(RfcLdapMessage inResponse) 34 | { 35 | 36 | LdapExtendedResponse tempResponse = new LdapExtendedResponse(inResponse); 37 | // Get the oid stored in the Extended response 38 | System.String inOID = tempResponse.ID; 39 | 40 | RespExtensionSet regExtResponses = LdapExtendedResponse.RegisteredResponses; 41 | try 42 | { 43 | System.Type extRespClass = regExtResponses.findResponseExtension(inOID); 44 | if (extRespClass == null) 45 | { 46 | return tempResponse; 47 | } 48 | System.Type[] argsClass = new System.Type[] { typeof(RfcLdapMessage) }; 49 | System.Object[] args = new System.Object[] { inResponse }; 50 | System.Exception ex; 51 | try 52 | { 53 | System.Reflection.ConstructorInfo extConstructor = extRespClass.GetConstructor(argsClass); 54 | try 55 | { 56 | System.Object resp = null; 57 | resp = extConstructor.Invoke(args); 58 | return (LdapExtendedResponse)resp; 59 | } 60 | catch (System.UnauthorizedAccessException e) 61 | { 62 | ex = e; 63 | } 64 | catch (System.Reflection.TargetInvocationException e) 65 | { 66 | ex = e; 67 | } 68 | catch (System.Exception e) 69 | { 70 | // Could not create the ResponseControl object 71 | // All possible exceptions are ignored. We fall through 72 | // and create a default LdapControl object 73 | ex = e; 74 | } 75 | } 76 | catch (System.MethodAccessException e) 77 | { 78 | // bad class was specified, fall through and return a 79 | // default LdapExtendedResponse object 80 | ex = e; 81 | } 82 | } 83 | catch (System.FieldAccessException e) 84 | { 85 | } 86 | // If we get here we did not have a registered extendedresponse 87 | // for this oid. Return a default LdapExtendedResponse object. 88 | return tempResponse; 89 | } 90 | } 91 | } -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcDelRequest.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcDelRequest.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents an Ldap Delete Request. 39 | /// 40 | ///
41 |     /// DelRequest ::= [APPLICATION 10] LdapDN
42 |     /// 
43 | ///
44 | public class RfcDelRequest : RfcLdapDN, RfcRequest 45 | { 46 | 47 | //************************************************************************* 48 | // Constructor for DelRequest 49 | //************************************************************************* 50 | 51 | /// Constructs an Ldapv3 delete request protocol operation. 52 | /// 53 | /// 54 | /// The Distinguished Name of the entry to delete. 55 | /// 56 | public RfcDelRequest(System.String dn) : base(dn) 57 | { 58 | } 59 | 60 | /// Constructs an Ldapv3 delete request protocol operation. 61 | /// 62 | /// 63 | /// The Distinguished Name of the entry to delete. 64 | /// 65 | [CLSCompliantAttribute(false)] 66 | public RfcDelRequest(sbyte[] dn) : base(dn) 67 | { 68 | } 69 | 70 | /// Override getIdentifier() to return the appropriate application-wide id 71 | /// representing this delete request. The getIdentifier() method is called 72 | /// when this object is encoded. 73 | /// 74 | /// Identifier = CLASS: APPLICATION, FORM: CONSTRUCTED, TAG: 10 75 | /// 76 | public override Asn1Identifier getIdentifier() 77 | { 78 | return new Asn1Identifier(Asn1Identifier.APPLICATION, false, LdapMessage.DEL_REQUEST); 79 | } 80 | 81 | public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request) 82 | { 83 | if ((System.Object)base_Renamed == null) 84 | { 85 | return new RfcDelRequest(byteValue()); 86 | } 87 | else 88 | { 89 | return new RfcDelRequest(base_Renamed); 90 | } 91 | } 92 | public System.String getRequestDN() 93 | { 94 | return base.stringValue(); 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Rfc2251/RfcSearchResultEntry.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Rfc2251.RfcSearchResultEntry.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System; 34 | 35 | namespace Novell.Directory.Ldap.Rfc2251 36 | { 37 | 38 | /// Represents an Ldap Search Result Entry. 39 | /// 40 | ///
41 |     /// SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
42 |     /// objectName      LdapDN,
43 |     /// attributes      PartialAttributeList }
44 |     /// 
45 | ///
46 | public class RfcSearchResultEntry : Asn1Sequence 47 | { 48 | /// 49 | virtual public Asn1OctetString ObjectName 50 | { 51 | get 52 | { 53 | return (Asn1OctetString)get_Renamed(0); 54 | } 55 | 56 | } 57 | /// 58 | virtual public Asn1Sequence Attributes 59 | { 60 | get 61 | { 62 | return (Asn1Sequence)get_Renamed(1); 63 | } 64 | 65 | } 66 | 67 | //************************************************************************* 68 | // Constructors for SearchResultEntry 69 | //************************************************************************* 70 | 71 | /// The only time a client will create a SearchResultEntry is when it is 72 | /// decoding it from an InputStream 73 | /// 74 | [CLSCompliantAttribute(false)] 75 | public RfcSearchResultEntry(Asn1Decoder dec, System.IO.Stream in_Renamed, int len) : base(dec, in_Renamed, len) 76 | { 77 | 78 | // Decode objectName 79 | // set(0, new RfcLdapDN(((Asn1OctetString)get(0)).stringValue())); 80 | 81 | // Create PartitalAttributeList. This does not need to be decoded, only 82 | // typecast. 83 | // set(1, new PartitalAttributeList()); 84 | return; 85 | } 86 | 87 | //************************************************************************* 88 | // Accessors 89 | //************************************************************************* 90 | 91 | /// Override getIdentifier to return an application-wide id. 92 | public override Asn1Identifier getIdentifier() 93 | { 94 | return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.SEARCH_RESPONSE); 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Extensions/SchemaSyncRequest.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Extensions.SchemaSyncRequest.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using Novell.Directory.Ldap.Utilclass; 34 | 35 | namespace Novell.Directory.Ldap.Extensions 36 | { 37 | 38 | /// 39 | /// Synchronizes the schema. 40 | /// 41 | /// The requestSchemaSyncRequest extension uses the following OID: 42 | /// 2.16.840.1.113719.1.27.100.27 43 | /// 44 | /// The requestValue has the following format: 45 | /// 46 | /// requestValue ::= 47 | /// serverName LdapDN 48 | /// delay INTEGER 49 | /// 50 | public class SchemaSyncRequest : LdapExtendedOperation 51 | { 52 | 53 | /// Constructs an extended operation object for synchronizing the schema. 54 | /// 55 | /// 56 | /// The distinguished name of the server which will start 57 | /// the synchronization. 58 | /// 59 | /// 60 | /// The time, in seconds, to delay before the synchronization 61 | /// should start. 62 | /// 63 | /// 64 | /// LdapException A general exception which includes an error message 65 | /// and an Ldap error code. 66 | /// 67 | public SchemaSyncRequest(System.String serverName, int delay) : base(ReplicationConstants.SCHEMA_SYNC_REQ, null) 68 | { 69 | 70 | try 71 | { 72 | 73 | if ((System.Object)serverName == null) 74 | throw new System.ArgumentException(ExceptionMessages.PARAM_ERROR); 75 | 76 | System.IO.MemoryStream encodedData = new System.IO.MemoryStream(); 77 | LBEREncoder encoder = new LBEREncoder(); 78 | 79 | Asn1OctetString asn1_serverName = new Asn1OctetString(serverName); 80 | Asn1Integer asn1_delay = new Asn1Integer(delay); 81 | 82 | asn1_serverName.encode(encoder, encodedData); 83 | asn1_delay.encode(encoder, encodedData); 84 | 85 | setValue(SupportClass.ToSByteArray(encodedData.ToArray())); 86 | } 87 | catch (System.IO.IOException ioe) 88 | { 89 | throw new LdapException(ExceptionMessages.ENCODING_ERROR, LdapException.ENCODING_ERROR, (System.String)null); 90 | } 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/LdapAuthProvider.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.LdapAuthProvider.cs 25 | // 26 | // Author: 27 | // Sunil Kumar (Sunilk@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using System; 33 | namespace Novell.Directory.Ldap 34 | { 35 | 36 | /// An implementation of LdapAuthHandler must be able to provide an 37 | /// LdapAuthProvider object at the time of a referral. The class 38 | /// encapsulates information that is used by the client for authentication 39 | /// when following referrals automatically. 40 | /// 41 | /// 42 | /// 43 | /// 44 | /// 45 | /// 46 | public class LdapAuthProvider 47 | { 48 | /// Returns the distinguished name to be used for authentication on 49 | /// automatic referral following. 50 | /// 51 | /// 52 | /// The distinguished name from the object. 53 | /// 54 | virtual public System.String DN 55 | { 56 | get 57 | { 58 | return dn; 59 | } 60 | 61 | } 62 | /// Returns the password to be used for authentication on automatic 63 | /// referral following. 64 | /// 65 | /// 66 | /// The byte[] value (UTF-8) of the password from the object. 67 | /// 68 | [CLSCompliantAttribute(false)] 69 | virtual public sbyte[] Password 70 | { 71 | get 72 | { 73 | return password; 74 | } 75 | 76 | } 77 | 78 | private System.String dn; 79 | private sbyte[] password; 80 | 81 | /// Constructs information that is used by the client for authentication 82 | /// when following referrals automatically. 83 | /// 84 | /// 85 | /// The distinguished name to use when authenticating to 86 | /// a server. 87 | /// 88 | /// 89 | /// The password to use when authenticating to a server. 90 | /// 91 | [CLSCompliantAttribute(false)] 92 | public LdapAuthProvider(System.String dn, sbyte[] password) 93 | { 94 | this.dn = dn; 95 | this.password = password; 96 | return; 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/NTLMSSP/Messages/NtlmNegotiate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SharpLdapRelayScan.NTLMSSP.Structs; 6 | using Version = SharpLdapRelayScan.NTLMSSP.Structs.Version; 7 | 8 | namespace SharpLdapRelayScan.NTLMSSP.Messages 9 | { 10 | public class NtlmNegotiate 11 | { 12 | 13 | private byte[] payload; 14 | private string signature; 15 | private int messageType; 16 | private NegotiateFlags flags; 17 | private NtlmFields domain; 18 | private NtlmFields workstationame; 19 | private Version version; 20 | 21 | 22 | public NtlmNegotiate() 23 | { 24 | this.signature = "NTLMSSP\0"; 25 | this.messageType = 1; 26 | this.flags = NegotiateFlags.FLAG_NEGOTIATE_NONE; 27 | this.version = new Version(); 28 | this.workstationame = new NtlmFields(); 29 | this.domain = new NtlmFields(); 30 | this.payload = new byte[] { }; 31 | } 32 | 33 | public static NtlmNegotiate Construct(NegotiateFlags flags, string domain = null, string workstation = null) 34 | { 35 | 36 | NtlmNegotiate nego = new NtlmNegotiate(); 37 | if (flags != NegotiateFlags.FLAG_NEGOTIATE_NONE) 38 | { 39 | nego.flags = flags; 40 | } 41 | 42 | IEnumerable payload = new byte[] { }; 43 | uint payload_offset = 32; 44 | byte[] tempData; 45 | 46 | if ((flags & NegotiateFlags.FLAG_NEGOTIATE_VERSION) == flags && nego.version == null) 47 | { 48 | Console.WriteLine("Negotiate Version Flag Set but Version not provided, removing flag"); 49 | flags -= NegotiateFlags.FLAG_NEGOTIATE_VERSION; 50 | } 51 | else 52 | { 53 | payload = payload.Concat(nego.version.ToBytes()); 54 | payload_offset += 8; 55 | } 56 | if ((flags & NegotiateFlags.FLAG_NEGOTIATE_OEM_DOMAIN_SUPPLIED) == flags && !string.IsNullOrEmpty(domain)) 57 | { 58 | // UTF-16LE 59 | tempData = Encoding.Unicode.GetBytes(domain); 60 | nego.domain.length = (ushort)tempData.Length; 61 | nego.domain.offset = payload_offset; 62 | payload = payload.Concat(tempData); 63 | payload_offset += (uint)tempData.Length; 64 | 65 | } 66 | 67 | if ((flags & NegotiateFlags.FLAG_NEGOTIATE_OEM_WORKSTATION_SUPPLIED) == flags && !string.IsNullOrEmpty(workstation)) 68 | { 69 | // UTF-16LE 70 | tempData = Encoding.Unicode.GetBytes(workstation); 71 | nego.workstationame.length = (ushort)tempData.Length; 72 | nego.workstationame.offset = payload_offset; 73 | payload = payload.Concat(tempData); 74 | payload_offset += (uint)tempData.Length; 75 | 76 | } 77 | 78 | // Finally updates payload 79 | nego.payload = payload.ToArray(); 80 | 81 | return nego; 82 | 83 | } 84 | 85 | public byte[] ToBytes() 86 | { 87 | 88 | IEnumerable bytes = new byte[] { }; 89 | byte[] tempData = new byte[] { }; 90 | 91 | // Signature 92 | tempData = Encoding.UTF8.GetBytes(this.signature); 93 | bytes = bytes.Concat(tempData); 94 | // Message Type 95 | bytes = bytes.Concat(BitConverter.GetBytes(this.messageType)); 96 | // Flags 97 | bytes = bytes.Concat(BitConverter.GetBytes((uint)this.flags)); 98 | // Domain Fields 99 | bytes = bytes.Concat(this.domain.ToBytes()); 100 | // Workstation 101 | bytes = bytes.Concat(this.workstationame.ToBytes()); 102 | // Payload 103 | bytes = bytes.Concat(this.payload); 104 | 105 | return bytes.ToArray(); 106 | 107 | } 108 | 109 | } 110 | 111 | } 112 | -------------------------------------------------------------------------------- /SharpLdapRelayScan/Novell/Events/Edir/EventData/ConnectionStateEventData.cs: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * The MIT License 3 | * Copyright (c) 2003 Novell Inc. www.novell.com 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the Software), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | *******************************************************************************/ 23 | // 24 | // Novell.Directory.Ldap.Events.Edir.EventData.ConnectionStateEventData.cs 25 | // 26 | // Author: 27 | // Anil Bhatia (banil@novell.com) 28 | // 29 | // (C) 2003 Novell, Inc (http://www.novell.com) 30 | // 31 | 32 | using Novell.Directory.Ldap.Asn1; 33 | using System.Text; 34 | 35 | namespace Novell.Directory.Ldap.Events.Edir.EventData 36 | { 37 | /// 38 | /// This class represents the data for Connection State Events. 39 | /// 40 | public class ConnectionStateEventData : BaseEdirEventData 41 | { 42 | protected string strConnectionDN; 43 | public string ConnectionDN 44 | { 45 | get 46 | { 47 | return strConnectionDN; 48 | } 49 | } 50 | 51 | protected int old_flags; 52 | public int OldFlags 53 | { 54 | get 55 | { 56 | return old_flags; 57 | } 58 | } 59 | 60 | protected int new_flags; 61 | public int NewFlags 62 | { 63 | get 64 | { 65 | return new_flags; 66 | } 67 | } 68 | 69 | protected string source_module; 70 | public string SourceModule 71 | { 72 | get 73 | { 74 | return source_module; 75 | } 76 | } 77 | 78 | public ConnectionStateEventData(EdirEventDataType eventDataType, Asn1Object message) 79 | : base(eventDataType, message) 80 | { 81 | int[] length = new int[1]; 82 | 83 | strConnectionDN = ((Asn1OctetString)decoder.decode(decodedData, length)).stringValue(); 84 | old_flags = ((Asn1Integer)decoder.decode(decodedData, length)).intValue(); 85 | new_flags = ((Asn1Integer)decoder.decode(decodedData, length)).intValue(); 86 | source_module = ((Asn1OctetString)decoder.decode(decodedData, length)).stringValue(); 87 | 88 | DataInitDone(); 89 | } 90 | 91 | /// 92 | /// Returns a string representation of the object. 93 | /// 94 | public override string ToString() 95 | { 96 | StringBuilder buf = new StringBuilder(); 97 | buf.Append("[ConnectionStateEvent"); 98 | buf.AppendFormat("(ConnectionDN={0})", strConnectionDN); 99 | buf.AppendFormat("(oldFlags={0})", old_flags); 100 | buf.AppendFormat("(newFlags={0})", new_flags); 101 | buf.AppendFormat("(SourceModule={0})", source_module); 102 | buf.Append("]"); 103 | 104 | return buf.ToString(); 105 | } 106 | } 107 | } 108 | --------------------------------------------------------------------------------