(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 |
--------------------------------------------------------------------------------