├── Mono.Security.dll
├── Novell.Directory.LDAP
├── Novell.Directory.Ldap.Extensions
│ ├── LdapBackupResponse.cs
│ ├── RefreshLdapServerRequest.cs
│ ├── BackupRestoreConstants.cs
│ └── GetBindDNRequest.cs
├── Novell.Directory.Ldap.Utilclass
│ ├── ResultCodeMessages.txt
│ ├── TokenTypes.cs
│ ├── CharacterTypes.cs
│ ├── ArrayEnumeration.cs
│ ├── AttributeQualifier.cs
│ ├── EnumeratedIterator.cs
│ ├── ExtResponseFactory.cs
│ └── ReferralInfo.cs
├── Novell.Directory.Ldap.Rfc2251
│ ├── RfcRelativeLdapDN.cs
│ ├── RfcLdapOID.cs
│ ├── RfcMatchingRuleId.cs
│ ├── RfcAssertionValue.cs
│ ├── RfcAttributeValue.cs
│ ├── RfcRequest.cs
│ ├── RfcAttributeDescription.cs
│ ├── RfcLdapURL.cs
│ ├── RfcLdapString.cs
│ ├── RfcLdapDN.cs
│ ├── RfcAttributeList.cs
│ ├── RfcResponse.cs
│ ├── RfcAttributeTypeAndValues.cs
│ ├── RfcSubstringFilter.cs
│ ├── RfcSaslCredentials.cs
│ ├── RfcReferral.cs
│ ├── RfcSearchResultReference.cs
│ ├── RfcAttributeDescriptionList.cs
│ ├── RfcAuthenticationChoice.cs
│ ├── RfcAttributeValueAssertion.cs
│ ├── RfcUnbindRequest.cs
│ ├── RfcAbandonRequest.cs
│ ├── RfcMessageID.cs
│ ├── RfcModifyDNResponse.cs
│ ├── RfcAddResponse.cs
│ ├── RfcDelResponse.cs
│ ├── RfcSearchResultDone.cs
│ ├── RfcDelRequest.cs
│ └── RfcModifyResponse.cs
├── Novell.Directory.Ldap
│ ├── LdapReferralHandler.cs
│ ├── LdapUnbindRequest.cs
│ ├── LdapUnsolicitedNotificationListener.cs
│ ├── LdapAbandonRequest.cs
│ ├── LdapDeleteRequest.cs
│ ├── LdapSearchResultReference.cs
│ ├── LdapAuthHandler.cs
│ ├── LdapResponseQueue.cs
│ ├── LdapSearchQueue.cs
│ └── LdapAuthProvider.cs
├── Novell.Directory.Ldap.Events
│ ├── BaseEventArgs.cs
│ ├── SearchReferralEventArgs.cs
│ ├── DirectoryExceptionEventArgs.cs
│ ├── LdapEventConstants.cs
│ ├── DirectoryEventArgs.cs
│ ├── Novell.Directory.Ldap.Events.Edir
│ │ ├── EdirEventArgs.cs
│ │ ├── Novell.Directory.Ldap.Events.Edir.EventData
│ │ │ ├── ReferralAddress.cs
│ │ │ ├── BaseEdirEventData.cs
│ │ │ ├── NetworkAddressEventData.cs
│ │ │ └── DSETimeStamp.cs
│ │ ├── EdirEventSpecifier.cs
│ │ └── MonitorEventResponse.cs
│ └── LdapEventArgs.cs
└── Novell.Directory.Ldap.Asn1
│ ├── Asn1Numeric.cs
│ └── Asn1Null.cs
├── LICENSE
├── README.markdown
├── Samples
├── Bind.cs
├── DelEntry.cs
├── SecureBind.cs
├── StartTLS.cs
├── RenameEntry.cs
└── ModifyEntry.cs
├── Samples.Extensions
├── RefreshLDAPServer.cs
├── SplitPartition.cs
├── MergePartitions.cs
└── AddReplica.cs
└── .gitignore
/Mono.Security.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kurrent-io/csharp-ldap/HEAD/Mono.Security.dll
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Extensions/LdapBackupResponse.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kurrent-io/csharp-ldap/HEAD/Novell.Directory.LDAP/Novell.Directory.Ldap.Extensions/LdapBackupResponse.cs
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 | Copyright (c) 2003 Novell Inc.
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5 |
6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 |
--------------------------------------------------------------------------------
/README.markdown:
--------------------------------------------------------------------------------
1 | ## Novell.Directory.LDAP
2 |
3 | This is a GitHub mirror of the `Novell.Directory.LDAP` library which is primarily hosted by Novell directly (original [here](http://www.novell.com/developer/ndk/ldap_libraries_for_c_sharp.html)).
4 |
5 | This mirror hosts the sources for v2.1.11 for convenience, since it is otherwise necessary to use FTP to obtain the source code.
6 |
7 | Minor modifications have been made to the build script to output XML documentation files with more appropriate names.
8 |
9 | `Mono.Security.dll` is also included, taken unmodified from the v2.10 Windows binary release of Mono. The sources for this binary are available [here](https://github.com/mono/mono/tree/mono-2-10).
10 |
11 | It is necessary to include the `Mono.Security.dll` assembly when running on .NET on Windows.
12 |
13 | It is thought that this mirror is acceptable under the MIT license (intact in the LICENSE file) under which both `Novell.Directory.LDAP` and `Mono.Security.dll` are released.
14 |
15 | ### Building (Windows/.NET)
16 |
17 | From a Developer Command Prompt:
18 |
19 | ```
20 | > build.bat
21 | ```
22 |
23 | ### Building (Linux/Mono)
24 |
25 | From a shell with mono available on `PATH`:
26 |
27 | ```
28 | $ build.sh
29 | ```
30 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Utilclass/ResultCodeMessages.txt:
--------------------------------------------------------------------------------
1 | 0=Success
2 | 1=Operations Error
3 | 2=Protocol Error
4 | 3=Timelimit Exceeded
5 | 4=Sizelimit Exceeded
6 | 5=Compare False
7 | 6=Compare True
8 | 7=Authentication Method Not Supported
9 | 8=Strong Authentication Required
10 | 9=Partial Results
11 | 10=Referral
12 | 11=Administrative Limit Exceeded
13 | 12=Unavailable Critical Extension
14 | 13=Confidentiality Required
15 | 14=SASL Bind In Progress
16 | 16=No Such Attribute
17 | 17=Undefined Attribute Type
18 | 18=Inappropriate Matching
19 | 19=Constraint Violation
20 | 20=Attribute Or Value Exists
21 | 21=Invalid Attribute Syntax
22 | 32=No Such Object
23 | 33=Alias Problem
24 | 34=Invalid DN Syntax
25 | 35=Is Leaf
26 | 36=Alias Dereferencing Problem
27 | 48=Inappropriate Authentication
28 | 49=Invalid Credentials
29 | 50=Insufficient Access Rights
30 | 51=Busy
31 | 52=Unavailable
32 | 53=Unwilling To Perform
33 | 54=Loop Detect
34 | 64=Naming Violation
35 | 65=Object Class Violation
36 | 66=Not Allowed On Non-leaf
37 | 67=Not Allowed On RDN
38 | 68=Entry Already Exists
39 | 69=Object Class Modifications Prohibited
40 | 71=Affects Multiple DSAs
41 | 80=Other
42 | 81=Server Down
43 | 82=Local Error
44 | 83=Encoding Error
45 | 84=Decoding Error
46 | 85=Ldap Timeout
47 | 86=Authentication Unknown
48 | 87=Filter Error
49 | 88=User Cancelled
50 | 89=Parameter Error
51 | 90=No Memory
52 | 91=Connect Error
53 | 92=Ldap Not Supported
54 | 93=Control Not Found
55 | 94=No Results Returned
56 | 95=More Results To Return
57 | 96=Client Loop
58 | 97=Referral Limit Exceeded
59 | 112=TLS not supported
60 | 113=SSL handshake failed
61 | 114=SSL Provider not found
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcRelativeLdapDN.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcRelativeLdapDN.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 |
34 | namespace Novell.Directory.Ldap.Rfc2251
35 | {
36 |
37 | /*
38 | * Represents an Ldap Relative DN.
39 | */
40 | public class RfcRelativeLdapDN:RfcLdapString
41 | {
42 |
43 | ///
44 | public RfcRelativeLdapDN(System.String s):base(s)
45 | {
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Utilclass/TokenTypes.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc., www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Utilclass.TokenType.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 |
34 | namespace Novell.Directory.Ldap.Utilclass
35 | {
36 |
37 | ///
38 | /// Specifies the types of Tokens.
39 | ///
40 | [Serializable]
41 | public enum TokenTypes
42 | {
43 | EOL = '\n',
44 | EOF = -1,
45 | NUMBER = -2,
46 | WORD = -3,
47 | REAL = -4,
48 | STRING = -5
49 | }
50 |
51 | }
52 |
53 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Utilclass/CharacterTypes.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc., www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Utilclass.CharacterTypes.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 |
34 | namespace Novell.Directory.Ldap.Utilclass
35 | {
36 |
37 | ///
38 | /// Specifies the types of Characters.
39 | ///
40 | // [Flags]
41 | [Serializable]
42 | [CLSCompliantAttribute(false)]
43 | public enum CharacterTypes:sbyte
44 | {
45 | WHITESPACE = 1,
46 | NUMERIC = 2,
47 | ALPHABETIC = 4,
48 | STRINGQUOTE = 8,
49 | COMMENTCHAR = 16
50 | }
51 |
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap/LdapReferralHandler.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.LdapReferralHandler.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 |
34 | namespace Novell.Directory.Ldap
35 | {
36 |
37 | ///
38 | /// Shared ancestor to the two types of referral objects - LdapBindHandler and
39 | /// LdapAuthHandler.
40 | ///
41 | ///
42 | ///
43 | ///
44 | ///
45 | ///
46 | ///
47 | public interface LdapReferralHandler
48 | {
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcLdapOID.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcLdapOID.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 | using Novell.Directory.Ldap.Asn1;
34 |
35 | namespace Novell.Directory.Ldap.Rfc2251
36 | {
37 |
38 | /*
39 | * Represents an LdapOID.
40 | */
41 | public class RfcLdapOID:Asn1OctetString
42 | {
43 | ///
44 | public RfcLdapOID(System.String s):base(s)
45 | {
46 | }
47 |
48 | ///
49 | [CLSCompliantAttribute(false)]
50 | public RfcLdapOID(sbyte[] s):base(s)
51 | {
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcMatchingRuleId.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcMatchingRuleId.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 |
34 | namespace Novell.Directory.Ldap.Rfc2251
35 | {
36 |
37 | /// Represents an Ldap Matching Rule ID.
38 | ///
39 | ///
40 | /// MatchingRuleId ::= LdapString
41 | ///
42 | ///
43 | public class RfcMatchingRuleId:RfcLdapString
44 | {
45 |
46 | /// Constructs a MatchingRuleId from a String.
47 | public RfcMatchingRuleId(System.String s):base(s)
48 | {
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcAssertionValue.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcAssertionValue.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 |
33 | using System;
34 | using Novell.Directory.Ldap.Asn1;
35 |
36 | namespace Novell.Directory.Ldap.Rfc2251
37 | {
38 |
39 | /// Represents the Ldap Assertion Value.
40 | ///
41 | ///
42 | /// AssertionValue ::= OCTET STRING
43 | ///
44 | ///
45 | public class RfcAssertionValue:Asn1OctetString
46 | {
47 |
48 | ///
49 | [CLSCompliantAttribute(false)]
50 | public RfcAssertionValue(sbyte[] value_Renamed):base(value_Renamed)
51 | {
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcAttributeValue.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcAttributeValue.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 | using Novell.Directory.Ldap.Asn1;
34 |
35 | namespace Novell.Directory.Ldap.Rfc2251
36 | {
37 |
38 | /*
39 | * Represents an Ldap Attribute Value.
40 | */
41 | public class RfcAttributeValue:Asn1OctetString
42 | {
43 |
44 | ///
45 | public RfcAttributeValue(System.String value_Renamed):base(value_Renamed)
46 | {
47 | }
48 |
49 | ///
50 | [CLSCompliantAttribute(false)]
51 | public RfcAttributeValue(sbyte[] value_Renamed):base(value_Renamed)
52 | {
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcRequest.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcRequest.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 |
34 |
35 | namespace Novell.Directory.Ldap.Rfc2251
36 | {
37 |
38 | /// This interface represents Protocol Operations that are requests from a
39 | /// client.
40 | ///
41 | public interface RfcRequest
42 | {
43 | /// Builds a new request using the data from the this object.
44 | RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool reference);
45 |
46 | /// Builds a new request using the data from the this object.
47 | System.String getRequestDN();
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcAttributeDescription.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcAttributeDescription.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 | using Novell.Directory.Ldap.Asn1;
34 |
35 | namespace Novell.Directory.Ldap.Rfc2251
36 | {
37 |
38 | /*
39 | * Represents the Ldap Attribute Description.
40 | */
41 | public class RfcAttributeDescription:RfcLdapString
42 | {
43 |
44 | ///
45 | public RfcAttributeDescription(System.String s):base(s)
46 | {
47 | }
48 |
49 | ///
50 | [CLSCompliantAttribute(false)]
51 | public RfcAttributeDescription(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
52 | {
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcLdapURL.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcLdapURL.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 |
34 | namespace Novell.Directory.Ldap.Rfc2251
35 | {
36 |
37 | /// Represents an Ldap URL.
38 | ///
39 | ///
40 | /// LdapURL ::= LdapString -- limited to characters permitted in URLs
41 | ///
42 | ///
43 | public class RfcLdapURL:RfcLdapString
44 | {
45 |
46 | //*************************************************************************
47 | // Constructor for RfcLdapURL
48 | //*************************************************************************
49 |
50 | ///
51 | public RfcLdapURL(System.String s):base(s)
52 | {
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcLdapString.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcLdapString.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 | using Novell.Directory.Ldap.Asn1;
34 |
35 | namespace Novell.Directory.Ldap.Rfc2251
36 | {
37 |
38 | /// Represnts an Ldap String.
39 | public class RfcLdapString:Asn1OctetString
40 | {
41 |
42 | ///
43 | public RfcLdapString(System.String s):base(s)
44 | {
45 | }
46 |
47 | ///
48 | [CLSCompliantAttribute(false)]
49 | public RfcLdapString(sbyte[] ba):base(ba)
50 | {
51 | }
52 |
53 | ///
54 | [CLSCompliantAttribute(false)]
55 | public RfcLdapString(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
56 | {
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcLdapDN.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcLdapDN.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 |
34 | namespace Novell.Directory.Ldap.Rfc2251
35 | {
36 |
37 | /// Represents an Ldap DN.
38 | ///
39 | ///
40 | /// LdapDN ::= LdapString
41 | ///
42 | ///
43 | public class RfcLdapDN:RfcLdapString
44 | {
45 |
46 | //*************************************************************************
47 | // Constructors for RfcLdapDN
48 | //*************************************************************************
49 |
50 | ///
51 | public RfcLdapDN(System.String s):base(s)
52 | {
53 | }
54 |
55 | ///
56 | [CLSCompliantAttribute(false)]
57 | public RfcLdapDN(sbyte[] s):base(s)
58 | {
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap/LdapUnbindRequest.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.LdapUnbindRequest.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 | using Novell.Directory.Ldap.Rfc2251;
34 |
35 | namespace Novell.Directory.Ldap
36 | {
37 |
38 | /// Represents an Ldap Unbind Request.
39 | ///
40 | ///
41 | ///
42 | ///
43 | /*
44 | * UnbindRequest ::= [APPLICATION 2] NULL
45 | */
46 | public class LdapUnbindRequest:LdapMessage
47 | {
48 | /// Constructs an Ldap Unbind Request.
49 | ///
50 | ///
51 | /// Any controls that apply to the unbind request
52 | ///
53 | public LdapUnbindRequest(LdapControl[] cont):base(LdapMessage.UNBIND_REQUEST, new RfcUnbindRequest(), cont)
54 | {
55 | return ;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcAttributeList.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcAttributeList.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 | using Novell.Directory.Ldap.Asn1;
34 |
35 | namespace Novell.Directory.Ldap.Rfc2251
36 | {
37 |
38 | /// Represents an Ldap Attribute List.
39 | ///
40 | ///
41 | /// AttributeList ::= SEQUENCE OF SEQUENCE {
42 | /// type AttributeDescription,
43 | /// vals SET OF AttributeValue }
44 | ///
45 | ///
46 | public class RfcAttributeList:Asn1SequenceOf
47 | {
48 |
49 | //*************************************************************************
50 | // Constructor for AttributeList
51 | //*************************************************************************
52 | public RfcAttributeList(int size):base(size)
53 | {
54 | return ;
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Events/BaseEventArgs.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Events.BaseEventArgs.cs
25 | //
26 | // Author:
27 | // Anil Bhatia (banil@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 |
34 | namespace Novell.Directory.Ldap.Events
35 | {
36 | ///
37 | /// This is the base class for other EventArgs representing exception
38 | /// and normal events.
39 | ///
40 | ///
41 | ///
42 | public class BaseEventArgs : EventArgs
43 | {
44 | protected LdapMessage ldap_message;
45 | public LdapMessage ContianedEventInformation
46 | {
47 | get
48 | {
49 | return ldap_message;
50 | }
51 | }
52 |
53 | public BaseEventArgs(LdapMessage message)
54 | {
55 | ldap_message = message;
56 | }
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcResponse.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcResponse.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 | using Novell.Directory.Ldap.Asn1;
34 |
35 | namespace Novell.Directory.Ldap.Rfc2251
36 | {
37 |
38 | /// This interface represents RfcLdapMessages that contain a response from a
39 | /// server.
40 | ///
41 | /// If the protocol operation of the RfcLdapMessage is of this type,
42 | /// it contains at least an RfcLdapResult.
43 | ///
44 | public interface RfcResponse
45 | {
46 |
47 | ///
48 | Asn1Enumerated getResultCode();
49 |
50 | ///
51 | RfcLdapDN getMatchedDN();
52 |
53 | ///
54 | RfcLdapString getErrorMessage();
55 |
56 | ///
57 | RfcReferral getReferral();
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Events/SearchReferralEventArgs.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Events.SearchReferralEventArgs.cs
25 | //
26 | // Author:
27 | // Anil Bhatia (banil@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 |
33 | namespace Novell.Directory.Ldap.Events
34 | {
35 | ///
36 | /// This class represents the EventArgs corresponding to
37 | /// LdapSearchResultReference notification sent by Ldap Server.
38 | ///
39 | public class SearchReferralEventArgs : LdapEventArgs
40 | {
41 | public SearchReferralEventArgs(LdapMessage sourceMessage,
42 | EventClassifiers aClassification,
43 | LdapEventType aType)
44 | : base(sourceMessage, EventClassifiers.CLASSIFICATION_LDAP_PSEARCH,
45 | LdapEventType.LDAP_PSEARCH_ANY) // TODO: why type is ANY..?
46 | {
47 | }
48 |
49 | public string[] getUrls() {
50 | return ((LdapSearchResultReference) ldap_message).Referrals;
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Events/DirectoryExceptionEventArgs.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Events.DirectoryExceptionEventArgs.cs
25 | //
26 | // Author:
27 | // Anil Bhatia (banil@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 |
33 | using System;
34 |
35 | namespace Novell.Directory.Ldap.Events
36 | {
37 | ///
38 | /// This class gives the EventArgs for Directory exceptions.
39 | ///
40 | ///
41 | ///
42 | public class DirectoryExceptionEventArgs : BaseEventArgs
43 | {
44 | protected LdapException ldap_exception_object;
45 | public LdapException LdapExceptionObject
46 | {
47 | get
48 | {
49 | return ldap_exception_object;
50 | }
51 | }
52 |
53 | public DirectoryExceptionEventArgs(LdapMessage message, LdapException ldapException)
54 | : base(message)
55 | {
56 | ldap_exception_object = ldapException;
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap/LdapUnsolicitedNotificationListener.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.LdapUnsolicitedNotificationListener.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 |
34 | namespace Novell.Directory.Ldap
35 | {
36 |
37 | ///
38 | /// An object that implements this interface can be notified when
39 | /// unsolicited messages arrive from the server. A client registers the
40 | /// object with LdapConnection.AddUnsolicitedNotificationListener.
41 | ///
42 | ///
43 | public interface LdapUnsolicitedNotificationListener
44 | {
45 |
46 | /// The method is called when an unsolicited message arrives from a
47 | /// server, if the object has registered with LdapCo
48 | /// LdapConnection.AddUnsolicitedNotificationListener.
49 | ///
50 | ///
51 | /// An unsolicited message received from the server.
52 | ///
53 | ///
54 | void messageReceived(LdapExtendedResponse msg);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap/LdapAbandonRequest.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.LdapAbandonRequest.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 | using Novell.Directory.Ldap.Rfc2251;
34 |
35 | namespace Novell.Directory.Ldap
36 | {
37 |
38 | /// Represents an Ldap Abandon Request
39 | ///
40 | ///
41 | ///
42 | ///
43 | /*
44 | * AbandonRequest ::= [APPLICATION 16] MessageID
45 | */
46 | public class LdapAbandonRequest:LdapMessage
47 | {
48 | /// Construct an Ldap Abandon Request.
49 | ///
50 | ///
51 | /// The ID of the operation to abandon.
52 | ///
53 | ///
54 | /// Any controls that apply to the abandon request
55 | /// or null if none.
56 | ///
57 | public LdapAbandonRequest(int id, LdapControl[] cont):base(LdapMessage.ABANDON_REQUEST, new RfcAbandonRequest(id), cont)
58 | {
59 | return ;
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Events/LdapEventConstants.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Events.LdapEventConstants.cs
25 | //
26 | // Author:
27 | // Anil Bhatia (banil@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using Novell.Directory.Ldap.Controls;
33 |
34 | namespace Novell.Directory.Ldap.Events
35 | {
36 |
37 | ///
38 | /// Event Classifiers
39 | ///
40 | public enum EventClassifiers
41 | {
42 | CLASSIFICATION_UNKNOWN = -1,
43 | CLASSIFICATION_LDAP_PSEARCH = 0,
44 | CLASSIFICATION_EDIR_EVENT = 1
45 | }
46 |
47 | ///
48 | /// Types of Ldap Events
49 | ///
50 | public enum LdapEventType
51 | {
52 | TYPE_UNKNOWN = LdapEventSource.EVENT_TYPE_UNKNOWN,
53 | LDAP_PSEARCH_ADD = LdapPersistSearchControl.ADD,
54 | LDAP_PSEARCH_DELETE = LdapPersistSearchControl.DELETE,
55 | LDAP_PSEARCH_MODIFY = LdapPersistSearchControl.MODIFY,
56 | LDAP_PSEARCH_MODDN = LdapPersistSearchControl.MODDN,
57 | LDAP_PSEARCH_ANY = LDAP_PSEARCH_ADD | LDAP_PSEARCH_DELETE | LDAP_PSEARCH_MODIFY | LDAP_PSEARCH_MODDN
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcAttributeTypeAndValues.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcAttributeTypeAndValues.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 | using Novell.Directory.Ldap.Asn1;
34 |
35 | namespace Novell.Directory.Ldap.Rfc2251
36 | {
37 |
38 | /// Represents and Ldap Attribute Type and Values.
39 | ///
40 | ///
41 | /// AttributeTypeAndValues ::= SEQUENCE {
42 | /// type AttributeDescription,
43 | /// vals SET OF AttributeValue }
44 | ///
45 | ///
46 | public class RfcAttributeTypeAndValues:Asn1Sequence
47 | {
48 |
49 | //*************************************************************************
50 | // Constructor for AttributeTypeAndValues
51 | //*************************************************************************
52 |
53 | ///
54 | public RfcAttributeTypeAndValues(RfcAttributeDescription type, Asn1SetOf vals):base(2)
55 | {
56 | add(type);
57 | add(vals);
58 | return ;
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Events/DirectoryEventArgs.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Events.DirectoryEventArgs.cs
25 | //
26 | // Author:
27 | // Anil Bhatia (banil@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 |
33 | namespace Novell.Directory.Ldap.Events
34 | {
35 | ///
36 | /// This is the base class for other EventArgs corresponding to
37 | /// Ldap and Edir events.
38 | ///
39 | ///
40 | ///
41 | public class DirectoryEventArgs : BaseEventArgs
42 | {
43 | protected EventClassifiers eClassification;
44 | public EventClassifiers EventClassification
45 | {
46 | get
47 | {
48 | return eClassification;
49 | }
50 | set
51 | {
52 | eClassification = value;
53 | }
54 | }
55 |
56 | public DirectoryEventArgs(LdapMessage sourceMessage,
57 | EventClassifiers aClassification)
58 | : base(sourceMessage)
59 | {
60 | eClassification = aClassification;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Extensions/RefreshLdapServerRequest.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Extensions.RefreshLdapServerRequest.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 | using Novell.Directory.Ldap;
34 | using Novell.Directory.Ldap.Asn1;
35 | using Novell.Directory.Ldap.Utilclass;
36 |
37 | namespace Novell.Directory.Ldap.Extensions
38 | {
39 |
40 | ///
41 | /// Reloads the Ldap server.
42 | ///
43 | /// The refreshLdapServerRequest extension uses the following OID:
44 | /// 2.16.840.1.113719.1.27.100.9
45 | ///
46 | /// The requestValue is set to null.
47 | ///
48 | public class RefreshLdapServerRequest:LdapExtendedOperation
49 | {
50 |
51 | ///
52 | /// Constructs an extended operation object for reloading the Ldap server.
53 | ///
54 | /// The constructor sets the OID.
55 | ///
56 | ///
57 | /// LdapException A general exception which includes an error
58 | /// message and an Ldap error code.
59 | ///
60 | public RefreshLdapServerRequest():base(ReplicationConstants.REFRESH_SERVER_REQ, null)
61 | {
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcSubstringFilter.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcSubstringFilter.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 | using Novell.Directory.Ldap.Asn1;
34 |
35 | namespace Novell.Directory.Ldap.Rfc2251
36 | {
37 |
38 | /// Represents an Ldap Substring Filter.
39 | ///
40 | ///
41 | /// SubstringFilter ::= SEQUENCE {
42 | /// type AttributeDescription,
43 | /// -- at least one must be present
44 | /// substrings SEQUENCE OF CHOICE {
45 | /// initial [0] LdapString,
46 | /// any [1] LdapString,
47 | /// final [2] LdapString } }
48 | ///
49 | ///
50 | public class RfcSubstringFilter:Asn1Sequence
51 | {
52 |
53 | //*************************************************************************
54 | // Constructors for SubstringFilter
55 | //*************************************************************************
56 |
57 | ///
58 | public RfcSubstringFilter(RfcAttributeDescription type, Asn1SequenceOf substrings):base(2)
59 | {
60 | add(type);
61 | add(substrings);
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Rfc2251/RfcSaslCredentials.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Rfc2251.RfcSaslCredentials.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 | using Novell.Directory.Ldap.Asn1;
34 |
35 | namespace Novell.Directory.Ldap.Rfc2251
36 | {
37 |
38 | /// Represents Ldap Sasl Credentials.
39 | ///
40 | ///
41 | /// SaslCredentials ::= SEQUENCE {
42 | /// mechanism LdapString,
43 | /// credentials OCTET STRING OPTIONAL }
44 | ///
45 | ///
46 | public class RfcSaslCredentials:Asn1Sequence
47 | {
48 |
49 | //*************************************************************************
50 | // Constructors for SaslCredentials
51 | //*************************************************************************
52 |
53 | ///
54 | public RfcSaslCredentials(RfcLdapString mechanism):this(mechanism, null)
55 | {
56 | }
57 |
58 | ///
59 | public RfcSaslCredentials(RfcLdapString mechanism, Asn1OctetString credentials):base(2)
60 | {
61 | add(mechanism);
62 | if (credentials != null)
63 | add(credentials);
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Events/Novell.Directory.Ldap.Events.Edir/EdirEventArgs.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Events.Edir.EdirEventArgs.cs
25 | //
26 | // Author:
27 | // Anil Bhatia (banil@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 |
34 | namespace Novell.Directory.Ldap.Events.Edir
35 | {
36 | ///
37 | /// This class represents the EventArgs for Edir events in general.
38 | ///
39 | public class EdirEventArgs : DirectoryEventArgs
40 | {
41 | ///
42 | /// This property gives the contained event information in the form
43 | /// of an IntermediateResponse if the contained information is of correct
44 | /// type. In case the type of contained information is incorrect, null is returned.
45 | ///
46 | public EdirEventIntermediateResponse IntermediateResponse
47 | {
48 | get
49 | {
50 | if (ldap_message is EdirEventIntermediateResponse)
51 | return (EdirEventIntermediateResponse)ldap_message;
52 | else
53 | return null;
54 | }
55 | }
56 |
57 | public EdirEventArgs(LdapMessage sourceMessage,
58 | EventClassifiers aClassification)
59 | : base(sourceMessage, aClassification)
60 | {
61 | }
62 |
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Extensions/BackupRestoreConstants.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2006 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Extensions.BackupRestoreConstants.cs
25 | //
26 | // Author:
27 | // Palaniappan N (NPalaniappan@novell.com)
28 | //
29 | // (C) 2006 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using System;
33 |
34 | namespace Novell.Directory.Ldap.Extensions
35 | {
36 | public class BackupRestoreConstants
37 | {
38 |
39 | /**
40 | * A constant for eDirectory LDAP Based Backup Request OID.
41 | */
42 | public const String NLDAP_LDAP_BACKUP_REQUEST = "2.16.840.1.113719.1.27.100.96";
43 |
44 | /**
45 | * A constant for eDirectory LDAP Based Backup Response OID.
46 | */
47 | public const String NLDAP_LDAP_BACKUP_RESPONSE = "2.16.840.1.113719.1.27.100.97";
48 |
49 | /**
50 | * A constant for eDirectory LDAP Based Restore Request OID.
51 | */
52 | public const String NLDAP_LDAP_RESTORE_REQUEST = "2.16.840.1.113719.1.27.100.98";
53 |
54 |
55 | /**
56 | * A constant for eDirectory LDAP Based Restore Response OID.
57 | */
58 | public const String NLDAP_LDAP_RESTORE_RESPONSE = "2.16.840.1.113719.1.27.100.99";
59 |
60 | /**
61 | * Default constructor
62 | */
63 | public BackupRestoreConstants():base()
64 | {
65 | return;
66 | }
67 |
68 | }
69 | }
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Events/Novell.Directory.Ldap.Events.Edir/Novell.Directory.Ldap.Events.Edir.EventData/ReferralAddress.cs:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * The MIT License
3 | * Copyright (c) 2003 Novell Inc. www.novell.com
4 | *
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
6 | * of this software and associated documentation files (the Software), to deal
7 | * in the Software without restriction, including without limitation the rights
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | * copies of the Software, and to permit persons to whom the Software is
10 | * furnished to do so, subject to the following conditions:
11 | *
12 | * The above copyright notice and this permission notice shall be included in
13 | * all copies or substantial portions of the Software.
14 | *
15 | * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | * SOFTWARE.
22 | *******************************************************************************/
23 | //
24 | // Novell.Directory.Ldap.Events.Edir.EventData.ReferralAddress.cs
25 | //
26 | // Author:
27 | // Anil Bhatia (banil@novell.com)
28 | //
29 | // (C) 2003 Novell, Inc (http://www.novell.com)
30 | //
31 |
32 | using Novell.Directory.Ldap.Asn1;
33 |
34 | namespace Novell.Directory.Ldap.Events.Edir.EventData
35 | {
36 | ///
37 | /// This class represents the data for Address(IP/IPX/IPV6 etc) datastructure for
38 | /// Edir Events Notification.
39 | ///
40 | public class ReferralAddress
41 | {
42 | protected int address_type;
43 | public int AddressType
44 | {
45 | get
46 | {
47 | return address_type;
48 | }
49 | }
50 |
51 | protected string strAddress;
52 | public string Address
53 | {
54 | get
55 | {
56 | return strAddress;
57 | }
58 | }
59 |
60 | ///
61 | /// Returns a string representation of the object.
62 | ///
63 | public ReferralAddress(Asn1Sequence dseObject)
64 | {
65 | address_type = ((Asn1Integer) dseObject.get_Renamed(0)).intValue();
66 | strAddress = ((Asn1OctetString) dseObject.get_Renamed(1)).stringValue();
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/Samples/Bind.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 | // Samples.Bind.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 | using Novell.Directory.Ldap;
33 |
34 | namespace Samples
35 | {
36 | class Bind
37 | {
38 |
39 |
40 |
41 | static void Main(string[] args)
42 | {
43 |
44 | if ( args.Length != 4)
45 | {
46 | Console.WriteLine("Usage: mono Bind " + " ");
47 | Console.WriteLine("Example: mono Bind Acme.com 389" + " \"cn=admin,o=Acme\"" + " secret ");
48 | return;
49 | }
50 |
51 | string ldapHost = args[0];
52 | int ldapPort = System.Convert.ToInt32(args[1]);
53 | String loginDN = args[2];
54 | String password = args[3];
55 | try
56 | {
57 | LdapConnection conn= new LdapConnection();
58 | Console.WriteLine("Connecting to:" + ldapHost);
59 | conn.Connect(ldapHost,ldapPort);
60 | conn.Bind(loginDN,password);
61 | Console.WriteLine(" Bind Successfull");
62 | conn.Disconnect();
63 | }
64 | catch(LdapException e)
65 | {
66 | Console.WriteLine("Error:" + e.LdapErrorMessage);
67 | return;
68 | }
69 | catch(Exception e)
70 | {
71 | Console.WriteLine("Error:" + e.Message);
72 | return;
73 | }
74 | }
75 | }
76 | }
77 |
78 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap.Asn1;
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 |
--------------------------------------------------------------------------------
/Samples/DelEntry.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 | // Samples.DelEntry.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 | using Novell.Directory.Ldap;
33 |
34 | namespace Samples
35 | {
36 | class DelEntry
37 | {
38 |
39 |
40 |
41 | static void Main(string[] args)
42 | {
43 |
44 | if ( args.Length != 5)
45 | {
46 | Console.WriteLine("Usage: mono DelEntry " + " ");
47 | Console.WriteLine("Example: mono DelEntry Acme.com 389" + " \"cn=admin,o=Acme\"" + " secret \"cn=cjhones,o=acme\"");
48 | return;
49 | }
50 |
51 | string ldapHost = args[0];
52 | int ldapPort = System.Convert.ToInt32(args[1]);
53 | String loginDN = args[2];
54 | String password = args[3];
55 | String dn = args[4];
56 |
57 | try
58 | {
59 | Console.WriteLine("Connecting to:" + ldapHost);
60 | LdapConnection conn= new LdapConnection();
61 | conn.Connect(ldapHost,ldapPort);
62 | conn.Bind(loginDN,password);
63 | conn.Delete(dn);
64 | Console.WriteLine(" Entry: " + dn + " Deleted Successfully");
65 | conn.Disconnect();
66 | }
67 | catch(LdapException e)
68 | {
69 | Console.WriteLine("Error:" + e.LdapErrorMessage);
70 | return;
71 | }
72 | catch(Exception e)
73 | {
74 | Console.WriteLine("Error:" + e.Message);
75 | return;
76 | }
77 | }
78 | }
79 | }
80 |
81 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Events/Novell.Directory.Ldap.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 |
--------------------------------------------------------------------------------
/Samples/SecureBind.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 | // Samples.SecureBind.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2004 Novell, Inc (http://www.novell.com)
30 | //
31 | using System;
32 | using Novell.Directory.Ldap;
33 | using Novell.Directory.Ldap.Utilclass;
34 |
35 | namespace Samples
36 | {
37 | class SecureBind
38 | {
39 |
40 | SecureBind(){}
41 |
42 | static void Main(string[] args)
43 | {
44 |
45 | if ( args.Length != 4)
46 | {
47 | Console.WriteLine("Usage: mono SecureBind " + " \n");
48 | Console.WriteLine("Example: mono SecureBind Acme.com 636" + " \"cn=admin,o=Acme\"" + " secret \n");
49 | Console.WriteLine("Import the server Trusted Root Certificate in Mono trust store using certmgr.exe utility e.g.\n");
50 | Console.WriteLine("certmgr -add -c Trust /home/exports/TrustedRootCert.cer\n");
51 | return;
52 | }
53 |
54 | string ldapHost = args[0];
55 | int ldapPort = System.Convert.ToInt32(args[1]);
56 | String loginDN = args[2];
57 | String password = args[3];
58 | LdapConnection conn=null;
59 | try
60 | {
61 | conn= new LdapConnection();
62 | conn.SecureSocketLayer=true;
63 | Console.WriteLine("Connecting to:" + ldapHost);
64 | conn.Connect(ldapHost,ldapPort);
65 | conn.Bind(loginDN,password);
66 | Console.WriteLine(" SSL Bind Successfull");
67 | }
68 | catch(Exception e)
69 | {
70 | Console.WriteLine("Error:" + e.Message);
71 | }
72 | conn.Disconnect();
73 | }
74 | }
75 | }
76 |
77 |
78 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 | using System;
33 |
34 | namespace Novell.Directory.Ldap.Utilclass
35 | {
36 |
37 | public class ArrayEnumeration : System.Collections.IEnumerator
38 | {
39 | private System.Object tempAuxObj;
40 | public virtual bool MoveNext()
41 | {
42 | bool result = hasMoreElements();
43 | if (result)
44 | {
45 | tempAuxObj = nextElement();
46 | }
47 | return result;
48 | }
49 | public virtual void Reset()
50 | {
51 | tempAuxObj = null;
52 | }
53 | public virtual System.Object Current
54 | {
55 | get
56 | {
57 | return tempAuxObj;
58 | }
59 |
60 | }
61 | private System.Object[] eArray;
62 | private int index = 0;
63 | /// Constructor to create the Enumeration
64 | ///
65 | ///
66 | /// the array to use for the Enumeration
67 | ///
68 | public ArrayEnumeration(System.Object[] eArray)
69 | {
70 | this.eArray = eArray;
71 | }
72 |
73 | public bool hasMoreElements()
74 | {
75 | if (eArray == null)
76 | return false;
77 | return (index < eArray.Length);
78 | }
79 |
80 | public System.Object nextElement()
81 | {
82 | if ((eArray == null) || (index >= eArray.Length))
83 | {
84 | throw new System.ArgumentOutOfRangeException();
85 | }
86 | return eArray[index++];
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/Samples/StartTLS.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 | // Samples.StartTLS.cs
25 | //
26 | // Author:
27 | // Sunil Kumar (Sunilk@novell.com)
28 | //
29 | // (C) 2004 Novell, Inc (http://www.novell.com)
30 | //
31 | using System;
32 | using Novell.Directory.Ldap;
33 | using Novell.Directory.Ldap.Utilclass;
34 |
35 | namespace Samples
36 | {
37 | class SecureBind
38 | {
39 |
40 | SecureBind(){}
41 |
42 | static void Main(string[] args)
43 | {
44 |
45 | if ( args.Length != 4)
46 | {
47 | Console.WriteLine("Usage: mono StartTLS " + " ");
48 | Console.WriteLine("Example: mono StartTLS Acme.com 389" + " \"cn=admin,o=Acme\"" + " secret \n");
49 | Console.WriteLine("Import the server Trusted Root Certificate in Mono trust store using certmgr.exe utility e.g.\n");
50 | Console.WriteLine("certmgr -add -c Trust /home/exports/TrustedRootCert.cer\n");
51 |
52 | return;
53 | }
54 |
55 | string ldapHost = args[0];
56 | int ldapPort = System.Convert.ToInt32(args[1]);
57 | String loginDN = args[2];
58 | String password = args[3];
59 | try
60 | {
61 | LdapConnection conn= new LdapConnection();
62 | Console.WriteLine("Connecting to:" + ldapHost);
63 | conn.Connect(ldapHost,ldapPort);
64 | conn.startTLS();
65 | conn.Bind(loginDN,password);
66 | Console.WriteLine("TLS Bind Completed Successfull");
67 | conn.stopTLS();
68 | Console.WriteLine("Stop TLS Completed Successfull");
69 | conn.Disconnect();
70 | }
71 | catch(Exception e)
72 | {
73 | Console.WriteLine("Error:" + e.Message);
74 | }
75 | }
76 | }
77 | }
78 |
79 |
80 |
--------------------------------------------------------------------------------
/Samples.Extensions/RefreshLDAPServer.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 | // Samples.Extensions.RefreshLDAPServer.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 | using Novell.Directory.Ldap;
34 | using Novell.Directory.Ldap.Extensions;
35 |
36 | namespace Samples.Extensions
37 | {
38 | class RefreshLdapServer
39 | {
40 | static void Main(string[] args)
41 | {
42 |
43 | if ( args.Length != 4)
44 | {
45 | Console.WriteLine("Usage: mono RefreshLdapServer " + " ");
46 | Console.WriteLine("Example: mono RefreshLdapServer Acme.com 389" + " \"cn=admin,o=Acme\"" + " secret ");
47 | return;
48 | }
49 |
50 | string ldapHost = args[0];
51 | int ldapPort = System.Convert.ToInt32(args[1]);
52 | String loginDN = args[2];
53 | String password = args[3];
54 |
55 | try
56 | {
57 | LdapConnection conn= new LdapConnection();
58 | Console.WriteLine("Connecting to:" + ldapHost);
59 | conn.Connect(ldapHost,ldapPort);
60 | conn.Bind(loginDN,password);
61 | LdapExtendedOperation request = new RefreshLdapServerRequest();
62 | LdapExtendedResponse response = conn.ExtendedOperation(request);
63 | if ( response.ResultCode == LdapException.SUCCESS )
64 | {
65 | Console.WriteLine("Refresh Ldap Server Request succeeded\n");
66 | }
67 | conn.Disconnect();
68 | }
69 | catch(LdapException e)
70 | {
71 | Console.WriteLine("Error:" + e.LdapErrorMessage);
72 | return;
73 | }
74 | catch(Exception e)
75 | {
76 | Console.WriteLine("Error:" + e.Message);
77 | return;
78 | }
79 | }
80 | }
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Events/Novell.Directory.Ldap.Events.Edir/Novell.Directory.Ldap.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 System.IO;
33 | using Novell.Directory.Ldap.Asn1;
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 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap;
34 | using Novell.Directory.Ldap.Asn1;
35 |
36 | namespace Novell.Directory.Ldap.Rfc2251
37 | {
38 |
39 | /// Represents an Ldap Search Result Reference.
40 | ///
41 | ///
42 | /// SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LdapURL
43 | ///
44 | ///
45 | public class RfcSearchResultReference:Asn1SequenceOf
46 | {
47 |
48 | //*************************************************************************
49 | // Constructors for SearchResultReference
50 | //*************************************************************************
51 |
52 | /// The only time a client will create a SearchResultReference is when it is
53 | /// decoding it from an InputStream
54 | ///
55 | [CLSCompliantAttribute(false)]
56 | public RfcSearchResultReference(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
57 | {
58 | return ;
59 | }
60 |
61 | //*************************************************************************
62 | // Accessors
63 | //*************************************************************************
64 |
65 | /// Override getIdentifier to return an application-wide id.
66 | public override Asn1Identifier getIdentifier()
67 | {
68 | return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.SEARCH_RESULT_REFERENCE);
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap.Asn1;
34 |
35 | namespace Novell.Directory.Ldap.Rfc2251
36 | {
37 |
38 | ///
39 | /// The AttributeDescriptionList is used to list attributes to be returned in
40 | /// a search request.
41 | ///
42 | ///
43 | /// AttributeDescriptionList ::= SEQUENCE OF
44 | /// AttributeDescription
45 | ///
46 | ///
47 | ///
48 | ///
49 | ///
50 | ///
51 | ///
52 | ///
53 | ///
54 | public class RfcAttributeDescriptionList:Asn1SequenceOf
55 | {
56 | ///
57 | public RfcAttributeDescriptionList(int size):base(size)
58 | {
59 | return ;
60 | }
61 |
62 | /// Convenience constructor. This constructor will construct an
63 | /// AttributeDescriptionList using the supplied array of Strings.
64 | ///
65 | public RfcAttributeDescriptionList(System.String[] attrs):base(attrs == null?0:attrs.Length)
66 | {
67 |
68 | if (attrs != null)
69 | {
70 | for (int i = 0; i < attrs.Length; i++)
71 | {
72 | add(new RfcAttributeDescription(attrs[i]));
73 | }
74 | }
75 | return ;
76 | }
77 |
78 | /*
79 | * Override add() to only accept types of AttributeDescription
80 | *
81 | * @exception Asn1InvalidTypeException
82 | */
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap/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 System;
33 | using Novell.Directory.Ldap.Rfc2251;
34 |
35 | namespace Novell.Directory.Ldap
36 | {
37 |
38 | /// Represents a request to delete an entry.
39 | ///
40 | ///
41 | ///
42 | ///
43 | /*
44 | * DelRequest ::= [APPLICATION 10] LdapDN
45 | */
46 | public class LdapDeleteRequest:LdapMessage
47 | {
48 | /// Returns of the dn of the entry to delete from the directory
49 | ///
50 | ///
51 | /// the dn of the entry to delete
52 | ///
53 | virtual public System.String DN
54 | {
55 | get
56 | {
57 | return Asn1Object.RequestDN;
58 | }
59 |
60 | }
61 | /// Constructs a request to delete an entry from the directory
62 | ///
63 | ///
64 | /// the dn of the entry to delete.
65 | ///
66 | ///
67 | /// Any controls that apply to the abandon request
68 | /// or null if none.
69 | ///
70 | public LdapDeleteRequest(System.String dn, LdapControl[] cont):base(LdapMessage.DEL_REQUEST, new RfcDelRequest(dn), cont)
71 | {
72 | return ;
73 | }
74 |
75 | /// Return an Asn1 representation of this delete request
76 | ///
77 | /// #return an Asn1 representation of this object
78 | ///
79 | public override System.String ToString()
80 | {
81 | return Asn1Object.ToString();
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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;
34 | using System.Text;
35 |
36 | using Novell.Directory.Ldap.Controls;
37 |
38 | namespace Novell.Directory.Ldap.Events
39 | {
40 | ///
41 | /// This class represents the EventArgs for Ldap events in general.
42 | /// This is also the base class for more specific Ldap events.
43 | ///
44 | ///
45 | ///
46 | public class LdapEventArgs : DirectoryEventArgs
47 | {
48 | protected LdapEventType eType;
49 | public LdapEventType EventType
50 | {
51 | get
52 | {
53 | return eType;
54 | }
55 | set
56 | {
57 | eType = value;
58 | }
59 | }
60 |
61 | public LdapEventArgs(
62 | LdapMessage sourceMessage,
63 | EventClassifiers aClassification,
64 | LdapEventType aType)
65 | : base(sourceMessage, aClassification)
66 | {
67 | eType = aType;
68 | }
69 |
70 | public override string ToString()
71 | {
72 | StringBuilder buf = new StringBuilder();
73 | buf.Append("[");
74 | buf.AppendFormat("{0}:", GetType());
75 | buf.AppendFormat("(Classification={0})", eClassification);
76 | buf.AppendFormat("(Type={0})", eType);
77 | buf.AppendFormat("(EventInformation:{0})", ldap_message);
78 | buf.Append("]");
79 |
80 | return buf.ToString();
81 | }
82 | } // end of class LdapEventArgs
83 | }
84 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | winbuild/packages/*
2 | winbuild/output/*
3 | winbuild/logs/*
4 | winbuild/storage/*
5 | winbuild/TestRunResult.xml
6 | lib/eventstore/*
7 | lib/eventstore2/*
8 | lib/eventstore-net-*.zip
9 | lib/eventstore_license.txt
10 | lib/firebird*
11 | lib/firebird*.zip
12 | lib/packages/*
13 | src/packages/*
14 | *.log
15 | src/NDependOut*
16 |
17 | #################
18 | ## Eclipse
19 | #################
20 |
21 | *.pydevproject
22 | .project
23 | .metadata
24 | bin/
25 | tmp/
26 | *.tmp
27 | *.bak
28 | *.swp
29 | *~.nib
30 | local.properties
31 | .classpath
32 | .settings/
33 | .loadpath
34 |
35 | # External tool builders
36 | .externalToolBuilders/
37 |
38 | # Locally stored "Eclipse launch configurations"
39 | *.launch
40 |
41 | # CDT-specific
42 | .cproject
43 |
44 | # PDT-specific
45 | .buildpath
46 |
47 |
48 | #################
49 | ## Visual Studio
50 | #################
51 |
52 | ## Ignore Visual Studio temporary files, build results, and
53 | ## files generated by popular Visual Studio add-ons.
54 |
55 | # User-specific files
56 | *.suo
57 | *.user
58 | *.sln.docstates
59 |
60 | # Build results
61 | [Dd]ebug/
62 | [Rr]elease/
63 | *_i.c
64 | *_p.c
65 | *.ilk
66 | *.meta
67 | *.obj
68 | *.pch
69 | *.pdb
70 | *.pgc
71 | *.pgd
72 | *.rsp
73 | *.sbr
74 | *.tlb
75 | *.tli
76 | *.tlh
77 | *.tmp
78 | *.vspscc
79 | .builds
80 | *.dotCover
81 | *.ncrunchsolution
82 |
83 | ## If you have NuGet Package Restore enabled, uncomment this
84 | packages/
85 |
86 | # Visual C++ cache files
87 | ipch/
88 | *.aps
89 | *.ncb
90 | *.opensdf
91 | *.sdf
92 |
93 | # Visual Studio profiler
94 | *.psess
95 | *.vsp
96 |
97 | # ReSharper is a .NET coding add-in
98 | _ReSharper*
99 |
100 | # Installshield output folder
101 | [Ee]xpress
102 |
103 | # DocProject is a documentation generator add-in
104 | DocProject/buildhelp/
105 | DocProject/Help/*.HxT
106 | DocProject/Help/*.HxC
107 | DocProject/Help/*.hhc
108 | DocProject/Help/*.hhk
109 | DocProject/Help/*.hhp
110 | DocProject/Help/Html2
111 | DocProject/Help/html
112 |
113 | # Click-Once directory
114 | publish
115 |
116 | # Others
117 | [Bb]in
118 | [Oo]bj
119 | sql
120 | TestResults
121 | *.Cache
122 | ClientBin
123 | stylecop.*
124 | ~$*
125 | *.dbmdl
126 | Generated_Code #added for RIA/Silverlight projects
127 |
128 | # Backup & report files from converting an old project file to a newer
129 | # Visual Studio version. Backup files are not needed, because we have git ;-)
130 | _UpgradeReport_Files/
131 | Backup*/
132 | UpgradeLog*.XML
133 |
134 |
135 |
136 | ############
137 | ## Windows
138 | ############
139 |
140 | # Windows image file caches
141 | Thumbs.db
142 |
143 | # Folder config file
144 | Desktop.ini
145 |
146 |
147 | #############
148 | ## Python
149 | #############
150 |
151 | *.py[co]
152 |
153 | # Packages
154 | *.egg
155 | *.egg-info
156 | dist
157 | eggs
158 | parts
159 | bin
160 | var
161 | sdist
162 | develop-eggs
163 | .installed.cfg
164 |
165 | # Installer logs
166 | pip-log.txt
167 |
168 | # Unit test / coverage reports
169 | .coverage
170 | .tox
171 |
172 | #Translations
173 | *.mo
174 |
175 | #Mr Developer
176 | .mr.developer.cfg
177 |
178 | # Mac crap
179 | .DS_Store
180 |
--------------------------------------------------------------------------------
/Samples/RenameEntry.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 | // Samples.RenameEntry.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 | using Novell.Directory.Ldap;
33 | using System.Collections;
34 |
35 | namespace Samples
36 | {
37 | class RenameEntry
38 | {
39 |
40 | static void Main(string[] args)
41 | {
42 |
43 | if ( args.Length != 7)
44 | {
45 | Console.WriteLine("Usage: mono RenameEntry " + " ");
46 | Console.WriteLine("Example: mono RenameEntry Acme.com 389" + " \"cn=admin,o=Acme\"" + " secret \"cn=ksmith,o=Acme\" cn=JamesSmith \"o=Products,o=Acme\"");
47 | return;
48 | }
49 |
50 | string ldapHost = args[0];
51 | int ldapPort = System.Convert.ToInt32(args[1]);
52 | String loginDN = args[2];
53 | String password = args[3];
54 | String oldDN = args[4];
55 | String newRDN = args[5];
56 | String parentDN = args[6];
57 |
58 | try
59 | {
60 | Console.WriteLine("Connecting to:" + ldapHost);
61 | LdapConnection conn= new LdapConnection();
62 | conn.Connect(ldapHost,ldapPort);
63 | conn.Bind(loginDN,password);
64 | conn.Rename(oldDN, newRDN, parentDN, true);
65 | Console.WriteLine( "Entry " + oldDN + " has been renamed as " + newRDN + "," + parentDN );
66 | conn.Disconnect();
67 | }
68 | catch(LdapException e)
69 | {
70 | Console.WriteLine("Error:" + e.LdapErrorMessage);
71 | return;
72 | }
73 | catch(Exception e)
74 | {
75 | Console.WriteLine("Error:" + e.Message);
76 | return;
77 | }
78 |
79 |
80 | }
81 | }
82 | }
83 |
84 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Events/Novell.Directory.Ldap.Events.Edir/Novell.Directory.Ldap.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 System.Text;
33 |
34 | using Novell.Directory.Ldap.Asn1;
35 |
36 | namespace Novell.Directory.Ldap.Events.Edir.EventData
37 | {
38 | ///
39 | /// This class represents the data for Network Address Events.
40 | ///
41 | public class NetworkAddressEventData : BaseEdirEventData
42 | {
43 | protected int nType;
44 | public int ValueType
45 | {
46 | get
47 | {
48 | return nType;
49 | }
50 | }
51 |
52 | protected string strData;
53 | public string Data
54 | {
55 | get
56 | {
57 | return strData;
58 | }
59 | }
60 |
61 | public NetworkAddressEventData(EdirEventDataType eventDataType, Asn1Object message)
62 | : base(eventDataType, message)
63 | {
64 | int[] length = new int[1];
65 |
66 | nType = ((Asn1Integer) decoder.decode(decodedData, length)).intValue();
67 | strData = ((Asn1OctetString) decoder.decode(decodedData, length)).stringValue();
68 |
69 | DataInitDone();
70 | }
71 |
72 | ///
73 | /// Returns a string representation of the object.
74 | ///
75 | public override string ToString()
76 | {
77 | StringBuilder buf = new StringBuilder();
78 | buf.Append("[NetworkAddress");
79 | buf.AppendFormat("(type={0})", nType);
80 | buf.AppendFormat("(Data={0})", strData);
81 | buf.Append("]");
82 |
83 | return buf.ToString();
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap.Asn1;
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 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 | using System;
33 |
34 | namespace Novell.Directory.Ldap.Utilclass
35 | {
36 |
37 | /// Encapsulates a qualifier in a Schema definition. Definitions that are not
38 | /// in rfc2252. Begins with 'X-'
39 | ///
40 | public class AttributeQualifier
41 | {
42 | virtual public System.String Name
43 | {
44 | /*
45 | public void addValue( String value )
46 | {
47 | values.add( value );
48 | return;
49 | }
50 | */
51 |
52 | get
53 | {
54 | return name;
55 | }
56 |
57 | }
58 | virtual public System.String[] Values
59 | {
60 | get
61 | {
62 | System.String[] strValues = null;
63 | if (values.Count > 0)
64 | {
65 | strValues = new System.String[values.Count];
66 | for (int i = 0; i < values.Count; i++)
67 | {
68 | strValues[i] = ((System.String) values[i]);
69 | }
70 | }
71 | return strValues;
72 | }
73 |
74 | }
75 | internal System.String name;
76 | internal System.Collections.ArrayList values;
77 |
78 | public AttributeQualifier(System.String name, System.String[] value_Renamed)
79 | {
80 | if ((System.Object) name == null || value_Renamed == null)
81 | {
82 | throw new System.ArgumentException("A null name or value " + "was passed in for a schema definition qualifier");
83 | }
84 | this.name = name;
85 | values = new System.Collections.ArrayList(5);
86 | for (int i = 0; i < value_Renamed.Length; i++)
87 | {
88 | values.Add(value_Renamed[i]);
89 | }
90 | return ;
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap/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 System;
33 | using Novell.Directory.Ldap.Rfc2251;
34 | using Novell.Directory.Ldap.Asn1;
35 |
36 | namespace Novell.Directory.Ldap
37 | {
38 |
39 | ///
40 | /// Encapsulates a continuation reference from an asynchronous search operation.
41 | ///
42 | ///
43 | public class LdapSearchResultReference:LdapMessage
44 | {
45 | /// Returns any URLs in the object.
46 | ///
47 | ///
48 | /// The URLs.
49 | ///
50 | virtual public System.String[] Referrals
51 | {
52 | get
53 | {
54 | Asn1Object[] references = ((RfcSearchResultReference) message.Response).toArray();
55 | srefs = new System.String[references.Length];
56 | for (int i = 0; i < references.Length; i++)
57 | {
58 | srefs[i] = ((Asn1OctetString) (references[i])).stringValue();
59 | }
60 | return (srefs);
61 | }
62 |
63 | }
64 |
65 | private System.String[] srefs;
66 | private static System.Object nameLock; // protect agentNum
67 | private static int refNum = 0; // Debug, LdapConnection number
68 | private System.String name; // String name for debug
69 | /*package*/ /// Constructs an LdapSearchResultReference object.
70 | ///
71 | ///
72 | /// The LdapMessage with a search reference.
73 | ///
74 | internal LdapSearchResultReference(RfcLdapMessage message):base(message)
75 | {
76 | return ;
77 | }
78 | static LdapSearchResultReference()
79 | {
80 | nameLock = new System.Object();
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap.Asn1;
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 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap/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 | using System;
33 | namespace Novell.Directory.Ldap
34 | {
35 |
36 | ///
37 | /// Used to provide credentials for authentication when processing a
38 | /// referral.
39 | ///
40 | /// A programmer desiring to supply authentication credentials
41 | /// to the API when automatically following referrals MUST
42 | /// implement this interface. If LdapAuthHandler or LdapBindHandler are not
43 | /// implemented, automatically followed referrals will use anonymous
44 | /// authentication. Referral URLs of any type other than Ldap (i.e. a
45 | /// referral URL other than ldap://something) are not chased automatically
46 | /// by the API on automatic following.
47 | ///
48 | ///
49 | ///
50 | ///
51 | ///
52 | ///
53 | ///
54 | public interface LdapAuthHandler : LdapReferralHandler
55 | {
56 |
57 | /// Returns an object which can provide credentials for authenticating to
58 | /// a server at the specified host and port.
59 | ///
60 | ///
61 | /// Contains a host name or the IP address (in dotted string
62 | /// format) of a host running an Ldap server.
63 | ///
64 | ///
65 | /// Contains the TCP or UDP port number of the host.
66 | ///
67 | ///
68 | /// An object with authentication credentials to the specified
69 | /// host and port.
70 | ///
71 | LdapAuthProvider getAuthProvider(System.String host, int port);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Samples.Extensions/SplitPartition.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 | // Samples.Extensions.SplitPartition.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 | using Novell.Directory.Ldap;
34 | using Novell.Directory.Ldap.Extensions;
35 |
36 | namespace Samples.Extensions
37 | {
38 |
39 | class SplitPartition
40 | {
41 | static void Main(string[] args)
42 | {
43 |
44 | if ( args.Length != 5)
45 | {
46 | Console.WriteLine("Usage: mono SplitPartition " + " ");
47 | Console.WriteLine("Example: mono SplitPartition Acme.com 389" + " \"cn=admin,o=Acme\"" + " secret \"ou=Sales,o=Acme\"");
48 | return;
49 | }
50 |
51 | string ldapHost = args[0];
52 | int ldapPort = System.Convert.ToInt32(args[1]);
53 | String loginDN = args[2];
54 | String password = args[3];
55 | String partitionRoot = args[4];
56 |
57 | try
58 | {
59 | LdapConnection conn= new LdapConnection();
60 | Console.WriteLine("Connecting to:" + ldapHost);
61 | conn.Connect(ldapHost,ldapPort);
62 | conn.Bind(loginDN,password);
63 | LdapExtendedOperation request = new SplitPartitionRequest( partitionRoot,
64 | ReplicationConstants.Ldap_ENSURE_SERVERS_UP);
65 | LdapExtendedResponse response = conn.ExtendedOperation(request);
66 | if ( response.ResultCode == LdapException.SUCCESS )
67 | {
68 | Console.WriteLine("SplitPartition Request succeeded\n");
69 | }
70 | conn.Disconnect();
71 | }
72 | catch(LdapException e)
73 | {
74 | Console.WriteLine("Error:" + e.LdapErrorMessage);
75 | return;
76 | }
77 | catch(Exception e)
78 | {
79 | Console.WriteLine("Error:" + e.Message);
80 | return;
81 | }
82 | }
83 | }
84 | }
85 |
86 |
--------------------------------------------------------------------------------
/Samples.Extensions/MergePartitions.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 | // Samples.Extensions.MergePartitions.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 | using Novell.Directory.Ldap;
34 | using Novell.Directory.Ldap.Extensions;
35 |
36 | namespace Samples.Extensions
37 | {
38 | class MergePartitions
39 | {
40 | static void Main(string[] args)
41 | {
42 |
43 | if ( args.Length != 5)
44 | {
45 | Console.WriteLine("Usage: mono MergePartitions " + " ");
46 | Console.WriteLine("Example: mono MergePartitions Acme.com 389" + " \"cn=admin,o=Acme\"" + " secret \"ou=Sales,o=Acme\"");
47 | return;
48 | }
49 |
50 | string ldapHost = args[0];
51 | int ldapPort = System.Convert.ToInt32(args[1]);
52 | String loginDN = args[2];
53 | String password = args[3];
54 | String partitionRoot = args[4];
55 |
56 | try
57 | {
58 | LdapConnection conn= new LdapConnection();
59 | Console.WriteLine("Connecting to:" + ldapHost);
60 | conn.Connect(ldapHost,ldapPort);
61 | conn.Bind(loginDN,password);
62 | LdapExtendedOperation request = new MergePartitionsRequest( partitionRoot,
63 | ReplicationConstants.Ldap_ENSURE_SERVERS_UP);
64 | LdapExtendedResponse response = conn.ExtendedOperation(request);
65 | if ( response.ResultCode == LdapException.SUCCESS )
66 | {
67 | Console.WriteLine("MergePartitions Request succeeded\n");
68 | }
69 | conn.Disconnect();
70 | }
71 | catch(LdapException e)
72 | {
73 | Console.WriteLine("Error:" + e.LdapErrorMessage);
74 | return;
75 | }
76 | catch(Exception e)
77 | {
78 | Console.WriteLine("Error:" + e.Message);
79 | return;
80 | }
81 | }
82 | }
83 | }
84 |
85 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Events/Novell.Directory.Ldap.Events.Edir/Novell.Directory.Ldap.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 System.Text;
33 | using Novell.Directory.Ldap.Asn1;
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 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap/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 | using System;
33 |
34 | namespace Novell.Directory.Ldap
35 | {
36 |
37 | /// A mechanism for processing asynchronous messages received from a server.
38 | /// It represents the message queue associated with a particular asynchronous
39 | /// Ldap operation or operations.
40 | ///
41 | public class LdapResponseQueue:LdapMessageQueue
42 | {
43 | /// Constructs a response queue using the specified message agent
44 | ///
45 | ///
46 | /// The message agent to associate with this queue
47 | ///
48 | /* package */
49 | internal LdapResponseQueue(MessageAgent agent):base("LdapResponseQueue", agent)
50 | {
51 | return ;
52 | }
53 |
54 | /// Merges two message queues. It appends the current and
55 | /// future contents from another queue to this one.
56 | ///
57 | /// After the operation, queue2.getMessageIDs()
58 | /// returns an empty array, and its outstanding responses
59 | /// have been removed and appended to this queue.
60 | ///
61 | ///
62 | /// The queue that is merged from. Following
63 | /// the merge, this queue object will no
64 | /// longer receive any data, and calls made
65 | /// to its methods will fail with a RuntimeException.
66 | /// The queue can be reactivated by using it in an
67 | /// Ldap request, after which it will receive responses
68 | /// for that request..
69 | ///
70 | public virtual void merge(LdapMessageQueue queue2)
71 | {
72 | LdapResponseQueue q = (LdapResponseQueue) queue2;
73 | agent.merge(q.MessageAgent);
74 |
75 | return ;
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 | using System;
33 |
34 | namespace Novell.Directory.Ldap.Utilclass
35 | {
36 | /// wrappers a class of type Iterator and makes it act as an Enumerator. This
37 | /// is used when the API requires enumerations be used but we may be using
38 | /// JDK1.2 collections, which return iterators instead of enumerators. Used by
39 | /// LdapSchema and LdapSchemaElement
40 | ///
41 | ///
42 | ///
43 | ///
44 | ///
45 | ///
46 |
47 | public class EnumeratedIterator : System.Collections.IEnumerator
48 | {
49 | private System.Object tempAuxObj;
50 | public virtual bool MoveNext()
51 | {
52 | bool result = hasMoreElements();
53 | if (result)
54 | {
55 | tempAuxObj = nextElement();
56 | }
57 | return result;
58 | }
59 | public virtual void Reset()
60 | {
61 | tempAuxObj = null;
62 | }
63 | public virtual System.Object Current
64 | {
65 | get
66 | {
67 | return tempAuxObj;
68 | }
69 |
70 | }
71 | private System.Collections.IEnumerator i;
72 |
73 | public EnumeratedIterator(System.Collections.IEnumerator iterator)
74 | {
75 | i = iterator;
76 | return ;
77 | }
78 |
79 | /// Enumeration method that maps to Iterator.hasNext()
80 | public bool hasMoreElements()
81 | {
82 | return i.MoveNext();
83 | }
84 |
85 | /// Enumeration method that maps to Iterator.next()
86 | public System.Object nextElement()
87 | {
88 | return i.Current;
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Utilclass/ExtResponseFactory.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using Novell.Directory.Ldap;
4 | using Novell.Directory.Ldap.Extensions;
5 | using Novell.Directory.Ldap.Rfc2251;
6 |
7 |
8 | namespace Novell.Directory.Ldap.Utilclass
9 | {
10 |
11 | ///
12 | /// Takes an LdapExtendedResponse and returns an object
13 | /// (that implements the base class ParsedExtendedResponse)
14 | /// based on the OID.
15 | ///
16 | /// You can then call methods defined in the child
17 | /// class to parse the contents of the response. The methods available
18 | /// depend on the child class. All child classes inherit from the
19 | /// ParsedExtendedResponse.
20 | ///
21 | ///
22 | public class ExtResponseFactory
23 | {
24 |
25 | /// Used to Convert an RfcLdapMessage object to the appropriate
26 | /// LdapExtendedResponse object depending on the operation being performed.
27 | ///
28 | ///
29 | /// The LdapExtendedReponse object as returned by the
30 | /// extendedOperation method in the LdapConnection object.
31 | ///
32 | /// An object of base class LdapExtendedResponse. The actual child
33 | /// class of this returned object depends on the operation being
34 | /// performed.
35 | ///
36 |
37 | static public LdapExtendedResponse convertToExtendedResponse(RfcLdapMessage inResponse)
38 | {
39 |
40 | LdapExtendedResponse tempResponse = new LdapExtendedResponse(inResponse);
41 | // Get the oid stored in the Extended response
42 | System.String inOID = tempResponse.ID;
43 |
44 | RespExtensionSet regExtResponses = LdapExtendedResponse.RegisteredResponses;
45 | try
46 | {
47 | System.Type extRespClass = regExtResponses.findResponseExtension(inOID);
48 | if (extRespClass == null)
49 | {
50 | return tempResponse;
51 | }
52 | System.Type[] argsClass = new System.Type[]{typeof(RfcLdapMessage)};
53 | System.Object[] args = new System.Object[]{inResponse};
54 | System.Exception ex;
55 | try
56 | {
57 | System.Reflection.ConstructorInfo extConstructor = extRespClass.GetConstructor(argsClass);
58 | try
59 | {
60 | System.Object resp = null;
61 | resp = extConstructor.Invoke(args);
62 | return (LdapExtendedResponse) resp;
63 | }
64 | catch (System.UnauthorizedAccessException e)
65 | {
66 | ex = e;
67 | }
68 | catch (System.Reflection.TargetInvocationException e)
69 | {
70 | ex = e;
71 | }
72 | catch (System.Exception e)
73 | {
74 | // Could not create the ResponseControl object
75 | // All possible exceptions are ignored. We fall through
76 | // and create a default LdapControl object
77 | ex = e;
78 | }
79 | }
80 | catch (System.MethodAccessException e)
81 | {
82 | // bad class was specified, fall through and return a
83 | // default LdapExtendedResponse object
84 | ex = e;
85 | }
86 | }
87 | catch (System.FieldAccessException e)
88 | {
89 | }
90 | // If we get here we did not have a registered extendedresponse
91 | // for this oid. Return a default LdapExtendedResponse object.
92 | return tempResponse;
93 | }
94 | }
95 | }
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap/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 | using System;
33 |
34 | namespace Novell.Directory.Ldap
35 | {
36 |
37 | /// A mechanism for queuing asynchronous search results
38 | /// received from a server.
39 | ///
40 | ///
41 | ///
42 | ///
43 | ///
44 | ///
45 | public class LdapSearchQueue:LdapMessageQueue
46 | {
47 | /// Constructs a response queue using a specific client queue
48 | ///
49 | ///
50 | /// The message agent to associate with this queue
51 | ///
52 | /* package */
53 | internal LdapSearchQueue(MessageAgent agent):base("LdapSearchQueue", agent)
54 | {
55 | return ;
56 | }
57 | /// Merges two message queues. It appends the current and
58 | /// future contents from another queue to this one.
59 | ///
60 | /// After the operation, queue2.getMessageIDs()
61 | /// returns an empty array, and its outstanding responses
62 | /// have been removed and appended to this queue.
63 | ///
64 | ///
65 | /// The queue that is merged from. Following
66 | /// the merge, this queue object will no
67 | /// longer receive any data, and calls made
68 | /// to its methods will fail with a RuntimeException.
69 | /// The queue can be reactivated by using it in an
70 | /// Ldap request, after which it will receive responses
71 | /// for that request..
72 | ///
73 | public virtual void merge(LdapMessageQueue queue2)
74 | {
75 |
76 | LdapSearchQueue q = (LdapSearchQueue) queue2;
77 | agent.merge(q.MessageAgent);
78 |
79 | return ;
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap.Asn1;
34 | using Novell.Directory.Ldap;
35 | using Novell.Directory.Ldap.Utilclass;
36 |
37 | namespace Novell.Directory.Ldap.Rfc2251
38 | {
39 |
40 | /// Represents the Ldap Unbind request.
41 | ///
42 | ///
43 | /// UnbindRequest ::= [APPLICATION 2] NULL
44 | ///
45 | ///
46 | public class RfcUnbindRequest:Asn1Null, RfcRequest
47 | {
48 |
49 | //*************************************************************************
50 | // Constructor for UnbindRequest
51 | //*************************************************************************
52 |
53 | /// Construct an RfCUnbind Request
54 | public RfcUnbindRequest():base()
55 | {
56 | return ;
57 | }
58 |
59 | //*************************************************************************
60 | // Accessors
61 | //*************************************************************************
62 |
63 | /// Override getIdentifier to return an application-wide id.
64 | ///
65 | /// ID = CLASS: APPLICATION, FORM: PRIMITIVE, TAG: 2. (0x42)
66 | ///
67 | ///
68 | public override Asn1Identifier getIdentifier()
69 | {
70 | return new Asn1Identifier(Asn1Identifier.APPLICATION, false, LdapMessage.UNBIND_REQUEST);
71 | }
72 |
73 | public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request)
74 | {
75 | throw new LdapException(ExceptionMessages.NO_DUP_REQUEST, new System.Object[]{"unbind"}, LdapException.Ldap_NOT_SUPPORTED, (System.String) null);
76 | }
77 |
78 | public System.String getRequestDN()
79 | {
80 | return null;
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap.Asn1;
34 | using Novell.Directory.Ldap;
35 | using Novell.Directory.Ldap.Utilclass;
36 |
37 | namespace Novell.Directory.Ldap.Rfc2251
38 | {
39 |
40 | /// Represents the Ldap Abandon Request.
41 | ///
42 | ///
43 | /// AbandonRequest ::= [APPLICATION 16] MessageID
44 | ///
45 | ///
46 | class RfcAbandonRequest:RfcMessageID, RfcRequest
47 | {
48 |
49 | //*************************************************************************
50 | // Constructor for AbandonRequest
51 | //*************************************************************************
52 |
53 | /// Constructs an RfcAbandonRequest
54 | public RfcAbandonRequest(int msgId):base(msgId)
55 | {
56 | return ;
57 | }
58 |
59 | //*************************************************************************
60 | // Accessors
61 | //*************************************************************************
62 |
63 | /// Override getIdentifier to return an application-wide id.
64 | ///
65 | /// ID = CLASS: APPLICATION, FORM: CONSTRUCTED, TAG: 16. (0x50)
66 | ///
67 | ///
68 | public override Asn1Identifier getIdentifier()
69 | {
70 | return new Asn1Identifier(Asn1Identifier.APPLICATION, false, LdapMessage.ABANDON_REQUEST);
71 | }
72 |
73 | public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool reference)
74 | {
75 | throw new LdapException(ExceptionMessages.NO_DUP_REQUEST, new System.Object[]{"Abandon"}, LdapException.Ldap_NOT_SUPPORTED, (System.String) null);
76 | }
77 | public System.String getRequestDN()
78 | {
79 | return null;
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/Samples.Extensions/AddReplica.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 | // Samples.Extensions.AddReplica.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 | using Novell.Directory.Ldap;
34 | using Novell.Directory.Ldap.Extensions;
35 |
36 | namespace Samples.Extensions
37 | {
38 | class AddReplica
39 | {
40 | static void Main(string[] args)
41 | {
42 |
43 | if ( args.Length != 7)
44 | {
45 | Console.WriteLine("Usage: mono AddReplica " + " ");
46 | Console.WriteLine("Example: mono AddReplica Acme.com 389" + " \"cn=admin,o=Acme\"" + " secret \"ou=Sales,o=Acme\" 1 \"cn=myServer,o=Acme\"");
47 | return;
48 | }
49 |
50 | string ldapHost = args[0];
51 | int ldapPort = System.Convert.ToInt32(args[1]);
52 | String loginDN = args[2];
53 | String password = args[3];
54 | String replicaDN = args[4];
55 | int replicaType = System.Convert.ToInt32(args[5]);
56 | String serverDN = args[6];
57 | try
58 | {
59 | LdapConnection conn= new LdapConnection();
60 | Console.WriteLine("Connecting to:" + ldapHost);
61 | conn.Connect(ldapHost,ldapPort);
62 | conn.Bind(loginDN,password);
63 | LdapExtendedOperation request = new AddReplicaRequest( replicaDN,
64 | serverDN,
65 | replicaType,
66 | ReplicationConstants.Ldap_ENSURE_SERVERS_UP);
67 |
68 | LdapExtendedResponse response = conn.ExtendedOperation(request);
69 | if ( response.ResultCode == LdapException.SUCCESS )
70 | {
71 | Console.WriteLine("Add Replica Request succeeded\n");
72 | }
73 | conn.Disconnect();
74 | }
75 | catch(LdapException e)
76 | {
77 | Console.WriteLine("Error:" + e.LdapErrorMessage);
78 | return;
79 | }
80 | catch(Exception e)
81 | {
82 | Console.WriteLine("Error:" + e.Message);
83 | return;
84 | }
85 | }
86 | }
87 | }
88 |
89 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.Events/Novell.Directory.Ldap.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.Rfc2251;
33 | using Novell.Directory.Ldap.Asn1;
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 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap.Asn1;
34 |
35 | namespace Novell.Directory.Ldap.Rfc2251
36 | {
37 |
38 | /// Represents an Ldap Message ID.
39 | ///
40 | ///
41 | /// MessageID ::= INTEGER (0 .. maxInt)
42 | ///
43 | /// maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
44 | ///
45 | /// Note: The creation of a MessageID should be hidden within the creation of
46 | /// an RfcLdapMessage. The MessageID needs to be in sequence, and has an
47 | /// upper and lower limit. There is never a case when a user should be
48 | /// able to specify the MessageID for an RfcLdapMessage. The MessageID()
49 | /// class should be package protected. (So the MessageID value isn't
50 | /// arbitrarily run up.)
51 | ///
52 | ///
53 | class RfcMessageID:Asn1Integer
54 | {
55 | /// Increments the message number atomically
56 | ///
57 | ///
58 | /// the new message number
59 | ///
60 | private static int MessageID
61 | {
62 | get
63 | {
64 | lock (lock_Renamed)
65 | {
66 | return (messageID < System.Int32.MaxValue)?++messageID:(messageID = 1);
67 | }
68 | }
69 |
70 | }
71 |
72 | private static int messageID = 0;
73 | private static System.Object lock_Renamed;
74 |
75 | /// Creates a MessageID with an auto incremented Asn1Integer value.
76 | ///
77 | /// Bounds: (0 .. 2,147,483,647) (2^^31 - 1 or Integer.MAX_VALUE)
78 | ///
79 | /// MessageID zero is never used in this implementation. Always
80 | /// start the messages with one.
81 | ///
82 | protected internal RfcMessageID():base(MessageID)
83 | {
84 | }
85 |
86 | /// Creates a MessageID with a specified int value.
87 | protected internal RfcMessageID(int i):base(i)
88 | {
89 | }
90 | static RfcMessageID()
91 | {
92 | lock_Renamed = new System.Object();
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 | using System;
33 | using Novell.Directory.Ldap;
34 | using Novell.Directory.Ldap.Asn1;
35 | using Novell.Directory.Ldap.Utilclass;
36 |
37 | namespace Novell.Directory.Ldap.Extensions
38 | {
39 |
40 | /// Returns the distingusihed name of the object your are logged in as.
41 | ///
42 | /// To use this class, you must create an instance of the
43 | /// class and then call the extendedOperation method with this
44 | /// object as the required LdapExtendedOperation parameter.
45 | ///
46 | /// The returned LdapExtendedResponse object can then be converted to
47 | /// a GetBindDNResponse object with the ExtendedREsponseFactory
48 | /// class. This object contains methods for retrieving the distinguished
49 | /// name.
50 | ///
51 | /// The GetBindDNRequest extension uses the following OID:
52 | /// 2.16.840.1.113719.1.27.100.31
53 | ///
54 | /// The request value has a value of null.
55 | ///
56 | ///
57 | public class GetBindDNRequest:LdapExtendedOperation
58 | {
59 |
60 | static GetBindDNRequest()
61 | {
62 | /*
63 | * Register the extendedresponse class which is returned by the
64 | * server in response to a ListReplicasRequest
65 | */
66 | try
67 | {
68 | LdapExtendedResponse.register(ReplicationConstants.GET_IDENTITY_NAME_RES, System.Type.GetType("Novell.Directory.Ldap.Extensions.GetBindDNResponse"));
69 | }
70 | catch (System.Exception e)
71 | {
72 | System.Console.Error.WriteLine("Could not register Extended Response -" + " Class not found");
73 | }
74 | }
75 |
76 | /// Constructs an extended operation object for retrieving the bind dn.
77 | ///
78 | ///
79 | /// LdapException A general exception which includes an error
80 | /// message and an Ldap error code.
81 | ///
82 |
83 | public GetBindDNRequest():base(ReplicationConstants.GET_IDENTITY_NAME_REQ, null)
84 | {
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 |
32 | using System;
33 | using Novell.Directory.Ldap;
34 | using LdapUrl = Novell.Directory.Ldap.LdapUrl;
35 |
36 | namespace Novell.Directory.Ldap.Utilclass
37 | {
38 |
39 | /// This class encapsulates the combination of LdapReferral URL and
40 | /// the connection opened to service this URL
41 | ///
42 | public class ReferralInfo
43 | {
44 | /// Returns the referral URL
45 | ///
46 | ///
47 | /// the Referral URL
48 | ///
49 | virtual public LdapUrl ReferralUrl
50 | {
51 | get
52 | {
53 | return referralUrl;
54 | }
55 |
56 | }
57 | /// Returns the referral Connection
58 | ///
59 | ///
60 | /// the Referral Connection
61 | ///
62 | virtual public LdapConnection ReferralConnection
63 | {
64 | get
65 | {
66 | return conn;
67 | }
68 |
69 | }
70 | /// Returns the referral list
71 | ///
72 | ///
73 | /// the Referral list
74 | ///
75 | virtual public System.String[] ReferralList
76 | {
77 | get
78 | {
79 | return referralList;
80 | }
81 |
82 | }
83 | // private DirectoryEntry conn;
84 | private LdapConnection conn;
85 | private LdapUrl referralUrl;
86 | private System.String[] referralList;
87 |
88 | /// Construct the ReferralInfo class
89 | ///
90 | ///
91 | /// The DirectoryEntry opened to process this referral
92 | ///
93 | ///
94 | /// The URL string associated with this connection
95 | ///
96 | public ReferralInfo(LdapConnection lc, System.String[] refList, LdapUrl refUrl)
97 | {
98 | conn = lc;
99 | referralUrl = refUrl;
100 | referralList = refList;
101 | return ;
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/Samples/ModifyEntry.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 | // Samples.ModifyEntry.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 | using Novell.Directory.Ldap;
33 | using System.Collections;
34 |
35 | namespace Samples
36 | {
37 | class ModifyEntry
38 | {
39 |
40 | static void Main(string[] args)
41 | {
42 |
43 | if ( args.Length != 5)
44 | {
45 | Console.WriteLine("Usage: mono ModifyEntry " + " ");
46 | Console.WriteLine("Example: mono ModifyEntry Acme.com 389" + " \"cn=admin,o=Acme\"" + " secret \"cn=ksmith,o=Acme\"");
47 | return;
48 | }
49 |
50 | string ldapHost = args[0];
51 | int ldapPort = System.Convert.ToInt32(args[1]);
52 | String loginDN = args[2];
53 | String password = args[3];
54 | String dn = args[4];
55 |
56 | try
57 | {
58 | Console.WriteLine("Connecting to:" + ldapHost);
59 | LdapConnection conn= new LdapConnection();
60 | ArrayList modList = new ArrayList();
61 | String desc = "This object belongs to test user";
62 | // Add a new value to the description attribute
63 | LdapAttribute attribute = new LdapAttribute( "description", desc);
64 | modList.Add( new LdapModification(LdapModification.ADD, attribute));
65 |
66 | String email = "James_Smith@Acme.com";
67 | attribute = new LdapAttribute( "mail", email);
68 | modList.Add( new LdapModification(LdapModification.REPLACE, attribute));
69 | LdapModification[] mods = new LdapModification[modList.Count];
70 | mods = (LdapModification[])modList.ToArray(typeof(LdapModification));
71 |
72 | conn.Connect(ldapHost,ldapPort);
73 | conn.Bind(loginDN,password);
74 | conn.Modify(dn,mods);
75 | Console.WriteLine(" Entry: " + dn + "Modified Successfully");
76 | conn.Disconnect();
77 |
78 | }
79 | catch(LdapException e)
80 | {
81 | Console.WriteLine("Error:" + e.LdapErrorMessage);
82 | return;
83 | }
84 | catch(Exception e)
85 | {
86 | Console.WriteLine("Error:" + e.Message);
87 | return;
88 | }
89 | }
90 | }
91 | }
92 |
93 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap.Asn1;
34 | using Novell.Directory.Ldap;
35 |
36 | namespace Novell.Directory.Ldap.Rfc2251
37 | {
38 |
39 | /// Represents an Ldap Modify DN Request.
40 | ///
41 | ///
42 | /// ModifyDNResponse ::= [APPLICATION 13] LdapResult
43 | ///
44 | ///
45 | public class RfcModifyDNResponse:RfcLdapResult
46 | {
47 |
48 | //*************************************************************************
49 | // Constructor for ModifyDNResponse
50 | //*************************************************************************
51 |
52 | /// Create a ModifyDNResponse by decoding it from an InputStream
53 | [CLSCompliantAttribute(false)]
54 | public RfcModifyDNResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
55 | {
56 | }
57 |
58 | /// Constructs an RfcModifyDNResponse 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 RfcModifyDNResponse(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.MODIFY_RDN_RESPONSE);
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap;
34 | using Novell.Directory.Ldap.Asn1;
35 |
36 | namespace Novell.Directory.Ldap.Rfc2251
37 | {
38 |
39 | /// Represents the Ldap Add Response.
40 | ///
41 | ///
42 | /// AddResponse ::= [APPLICATION 9] LdapResult
43 | ///
44 | ///
45 | public class RfcAddResponse:RfcLdapResult
46 | {
47 |
48 | //*************************************************************************
49 | // Constructors for AddResponse
50 | //*************************************************************************
51 |
52 | /// The only time a client will create a AddResponse is when it is
53 | /// decoding it from an InputStream
54 | ///
55 | [CLSCompliantAttribute(false)]
56 | public RfcAddResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
57 | {
58 | }
59 |
60 | /// Constructs an RfcAddResponse from parameters.
61 | ///
62 | ///
63 | /// the result code of the operation
64 | ///
65 | ///
66 | /// the matched DN returned from the server
67 | ///
68 | ///
69 | /// the diagnostic message returned from the server
70 | ///
71 | ///
72 | /// the referral(s) returned by the server
73 | ///
74 | public RfcAddResponse(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral):base(resultCode, matchedDN, errorMessage, referral)
75 | {
76 | return ;
77 | }
78 |
79 | //*************************************************************************
80 | // Accessors
81 | //*************************************************************************
82 |
83 | /// Override getIdentifier to return an application-wide id.
84 | public override Asn1Identifier getIdentifier()
85 | {
86 | return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.ADD_RESPONSE);
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap;
34 | using Novell.Directory.Ldap.Asn1;
35 |
36 | namespace Novell.Directory.Ldap.Rfc2251
37 | {
38 |
39 | /// Represents and Ldap Delete Response.
40 | ///
41 | ///
42 | /// DelResponse ::= [APPLICATION 11] LdapResult
43 | ///
44 | ///
45 | public class RfcDelResponse:RfcLdapResult
46 | {
47 |
48 | //*************************************************************************
49 | // Constructors for DelResponse
50 | //*************************************************************************
51 |
52 | /// The only time a client will create a DelResponse is when it is
53 | /// decoding it from an InputStream
54 | ///
55 | [CLSCompliantAttribute(false)]
56 | public RfcDelResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
57 | {
58 | }
59 |
60 | /// Constructs an RfcDelResponse from parameters.
61 | ///
62 | ///
63 | /// the result code of the operation
64 | ///
65 | ///
66 | /// the matched DN returned from the server
67 | ///
68 | ///
69 | /// the diagnostic message returned from the server
70 | ///
71 | ///
72 | /// the referral(s) returned by the server
73 | ///
74 | public RfcDelResponse(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral):base(resultCode, matchedDN, errorMessage, referral)
75 | {
76 | return ;
77 | }
78 |
79 | //*************************************************************************
80 | // Accessors
81 | //*************************************************************************
82 |
83 | /// Override getIdentifier to return an application-wide id.
84 | public override Asn1Identifier getIdentifier()
85 | {
86 | return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.DEL_RESPONSE);
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap;
34 | using Novell.Directory.Ldap.Asn1;
35 |
36 | namespace Novell.Directory.Ldap.Rfc2251
37 | {
38 |
39 | /// Represents an Ldap Search Result Done Response.
40 | ///
41 | ///
42 | /// SearchResultDone ::= [APPLICATION 5] LdapResult
43 | ///
44 | ///
45 | public class RfcSearchResultDone:RfcLdapResult
46 | {
47 |
48 | //*************************************************************************
49 | // Constructors for SearchResultDone
50 | //*************************************************************************
51 |
52 | /// Decode a search result done from the input stream.
53 | [CLSCompliantAttribute(false)]
54 | public RfcSearchResultDone(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
55 | {
56 | return ;
57 | }
58 |
59 | /// Constructs an RfcSearchResultDone 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 RfcSearchResultDone(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.SEARCH_RESULT);
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap.Asn1;
34 | using Novell.Directory.Ldap;
35 |
36 | namespace Novell.Directory.Ldap.Rfc2251
37 | {
38 |
39 | /// Represents an Ldap Delete Request.
40 | ///
41 | ///
42 | /// DelRequest ::= [APPLICATION 10] LdapDN
43 | ///
44 | ///
45 | public class RfcDelRequest:RfcLdapDN, RfcRequest
46 | {
47 |
48 | //*************************************************************************
49 | // Constructor for DelRequest
50 | //*************************************************************************
51 |
52 | /// Constructs an Ldapv3 delete request protocol operation.
53 | ///
54 | ///
55 | /// The Distinguished Name of the entry to delete.
56 | ///
57 | public RfcDelRequest(System.String dn):base(dn)
58 | {
59 | }
60 |
61 | /// Constructs an Ldapv3 delete request protocol operation.
62 | ///
63 | ///
64 | /// The Distinguished Name of the entry to delete.
65 | ///
66 | [CLSCompliantAttribute(false)]
67 | public RfcDelRequest(sbyte[] dn):base(dn)
68 | {
69 | }
70 |
71 | /// Override getIdentifier() to return the appropriate application-wide id
72 | /// representing this delete request. The getIdentifier() method is called
73 | /// when this object is encoded.
74 | ///
75 | /// Identifier = CLASS: APPLICATION, FORM: CONSTRUCTED, TAG: 10
76 | ///
77 | public override Asn1Identifier getIdentifier()
78 | {
79 | return new Asn1Identifier(Asn1Identifier.APPLICATION, false, LdapMessage.DEL_REQUEST);
80 | }
81 |
82 | public RfcRequest dupRequest(System.String base_Renamed, System.String filter, bool request)
83 | {
84 | if ((System.Object) base_Renamed == null)
85 | {
86 | return new RfcDelRequest(byteValue());
87 | }
88 | else
89 | {
90 | return new RfcDelRequest(base_Renamed);
91 | }
92 | }
93 | public System.String getRequestDN()
94 | {
95 | return base.stringValue();
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap/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 |
--------------------------------------------------------------------------------
/Novell.Directory.LDAP/Novell.Directory.Ldap.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 System;
33 | using Novell.Directory.Ldap.Asn1;
34 | using Novell.Directory.Ldap;
35 |
36 | namespace Novell.Directory.Ldap.Rfc2251
37 | {
38 |
39 | /// Represents an Ldap Modify Response.
40 | ///
41 | ///
42 | /// ModifyResponse ::= [APPLICATION 7] LdapResult
43 | ///
44 | ///
45 | public class RfcModifyResponse:RfcLdapResult
46 | {
47 |
48 | //*************************************************************************
49 | // Constructor for ModifyResponse
50 | //*************************************************************************
51 |
52 | /// The only time a client will create a ModifyResponse is when it is
53 | /// decoding it from an InputStream
54 | ///
55 | [CLSCompliantAttribute(false)]
56 | public RfcModifyResponse(Asn1Decoder dec, System.IO.Stream in_Renamed, int len):base(dec, in_Renamed, len)
57 | {
58 | }
59 |
60 | /// Constructs an RfcModifyResponse from parameters.
61 | ///
62 | ///
63 | /// the result code of the operation
64 | ///
65 | ///
66 | /// the matched DN returned from the server
67 | ///
68 | ///
69 | /// the diagnostic message returned from the server
70 | ///
71 | ///
72 | /// the referral(s) returned by the server
73 | ///
74 | public RfcModifyResponse(Asn1Enumerated resultCode, RfcLdapDN matchedDN, RfcLdapString errorMessage, RfcReferral referral):base(resultCode, matchedDN, errorMessage, referral)
75 | {
76 | return ;
77 | }
78 |
79 | //*************************************************************************
80 | // Accessors
81 | //*************************************************************************
82 |
83 | /// Override getIdentifier to return an application-wide id.
84 | public override Asn1Identifier getIdentifier()
85 | {
86 | return new Asn1Identifier(Asn1Identifier.APPLICATION, true, LdapMessage.MODIFY_RESPONSE);
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------