fakeldap 0.0.1 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +7 -1
  3. data/lib/fakeldap.rb +133 -10
  4. data/lib/fakeldap/version.rb +1 -1
  5. metadata +50 -191
  6. data/vendor/ruby-ldapserver/COPYING +0 -27
  7. data/vendor/ruby-ldapserver/ChangeLog +0 -83
  8. data/vendor/ruby-ldapserver/Manifest.txt +0 -32
  9. data/vendor/ruby-ldapserver/README +0 -222
  10. data/vendor/ruby-ldapserver/Rakefile +0 -22
  11. data/vendor/ruby-ldapserver/doc/LDAP.html +0 -104
  12. data/vendor/ruby-ldapserver/doc/LDAP/Abandon.html +0 -112
  13. data/vendor/ruby-ldapserver/doc/LDAP/Error.html +0 -115
  14. data/vendor/ruby-ldapserver/doc/LDAP/ResultError.html +0 -241
  15. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AdminLimitExceeded.html +0 -158
  16. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AffectsMultipleDSAs.html +0 -158
  17. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AliasDereferencingProblem.html +0 -158
  18. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AliasProblem.html +0 -158
  19. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AttributeOrValueExists.html +0 -158
  20. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AuthMethodNotSupported.html +0 -158
  21. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Busy.html +0 -158
  22. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/CompareFalse.html +0 -158
  23. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/CompareTrue.html +0 -158
  24. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ConfidentialityRequired.html +0 -158
  25. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ConstraintViolation.html +0 -158
  26. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/EntryAlreadyExists.html +0 -158
  27. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InappropriateAuthentication.html +0 -158
  28. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InappropriateMatching.html +0 -158
  29. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InsufficientAccessRights.html +0 -158
  30. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InvalidAttributeSyntax.html +0 -158
  31. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InvalidCredentials.html +0 -158
  32. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InvalidDNSyntax.html +0 -158
  33. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/IsLeaf.html +0 -158
  34. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/LoopDetect.html +0 -158
  35. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NamingViolation.html +0 -158
  36. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NoSuchAttribute.html +0 -158
  37. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NoSuchObject.html +0 -158
  38. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NotAllowedOnNonLeaf.html +0 -158
  39. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NotAllowedOnRDN.html +0 -158
  40. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ObjectClassModsProhibited.html +0 -158
  41. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ObjectClassViolation.html +0 -158
  42. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/OperationsError.html +0 -158
  43. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Other.html +0 -158
  44. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ProtocolError.html +0 -158
  45. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Referral.html +0 -158
  46. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/SaslBindInProgress.html +0 -158
  47. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/SizeLimitExceeded.html +0 -158
  48. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/StrongAuthRequired.html +0 -158
  49. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Success.html +0 -158
  50. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/TimeLimitExceeded.html +0 -158
  51. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Unavailable.html +0 -158
  52. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/UnavailableCriticalExtension.html +0 -158
  53. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/UndefinedAttributeType.html +0 -158
  54. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/UnwillingToPerform.html +0 -158
  55. data/vendor/ruby-ldapserver/doc/LDAP/Server.html +0 -1056
  56. data/vendor/ruby-ldapserver/doc/LDAP/Server/Connection.html +0 -1353
  57. data/vendor/ruby-ldapserver/doc/LDAP/Server/Filter.html +0 -634
  58. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule.html +0 -1132
  59. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/DefaultMatchingClass.html +0 -219
  60. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Equality.html +0 -170
  61. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/IA5Downcase.html +0 -143
  62. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/IA5Trim.html +0 -155
  63. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Integer.html +0 -143
  64. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Ordering.html +0 -212
  65. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/StringDowncase.html +0 -143
  66. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/StringTrim.html +0 -154
  67. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Substrings.html +0 -177
  68. data/vendor/ruby-ldapserver/doc/LDAP/Server/Operation.html +0 -2994
  69. data/vendor/ruby-ldapserver/doc/LDAP/Server/Schema.html +0 -2024
  70. data/vendor/ruby-ldapserver/doc/LDAP/Server/Schema/AttributeType.html +0 -1462
  71. data/vendor/ruby-ldapserver/doc/LDAP/Server/Schema/ObjectClass.html +0 -1097
  72. data/vendor/ruby-ldapserver/doc/LDAP/Server/Syntax.html +0 -1254
  73. data/vendor/ruby-ldapserver/doc/LDAP/Server/VERSION.html +0 -134
  74. data/vendor/ruby-ldapserver/doc/_index.html +0 -662
  75. data/vendor/ruby-ldapserver/doc/class_list.html +0 -36
  76. data/vendor/ruby-ldapserver/doc/css/common.css +0 -1
  77. data/vendor/ruby-ldapserver/doc/css/full_list.css +0 -50
  78. data/vendor/ruby-ldapserver/doc/css/style.css +0 -303
  79. data/vendor/ruby-ldapserver/doc/file.README.html +0 -399
  80. data/vendor/ruby-ldapserver/doc/file_list.html +0 -38
  81. data/vendor/ruby-ldapserver/doc/frames.html +0 -13
  82. data/vendor/ruby-ldapserver/doc/index.html +0 -399
  83. data/vendor/ruby-ldapserver/doc/js/app.js +0 -204
  84. data/vendor/ruby-ldapserver/doc/js/full_list.js +0 -112
  85. data/vendor/ruby-ldapserver/doc/js/jquery.js +0 -154
  86. data/vendor/ruby-ldapserver/doc/method_list.html +0 -1571
  87. data/vendor/ruby-ldapserver/doc/top-level-namespace.html +0 -88
  88. data/vendor/ruby-ldapserver/examples/README +0 -89
  89. data/vendor/ruby-ldapserver/examples/mkcert.rb +0 -31
  90. data/vendor/ruby-ldapserver/examples/rbslapd1.rb +0 -111
  91. data/vendor/ruby-ldapserver/examples/rbslapd2.rb +0 -161
  92. data/vendor/ruby-ldapserver/examples/rbslapd3.rb +0 -172
  93. data/vendor/ruby-ldapserver/examples/speedtest.rb +0 -37
  94. data/vendor/ruby-ldapserver/lib/ldap/server.rb +0 -4
  95. data/vendor/ruby-ldapserver/lib/ldap/server/connection.rb +0 -276
  96. data/vendor/ruby-ldapserver/lib/ldap/server/filter.rb +0 -223
  97. data/vendor/ruby-ldapserver/lib/ldap/server/match.rb +0 -283
  98. data/vendor/ruby-ldapserver/lib/ldap/server/operation.rb +0 -487
  99. data/vendor/ruby-ldapserver/lib/ldap/server/preforkserver.rb +0 -93
  100. data/vendor/ruby-ldapserver/lib/ldap/server/result.rb +0 -71
  101. data/vendor/ruby-ldapserver/lib/ldap/server/schema.rb +0 -592
  102. data/vendor/ruby-ldapserver/lib/ldap/server/server.rb +0 -89
  103. data/vendor/ruby-ldapserver/lib/ldap/server/syntax.rb +0 -235
  104. data/vendor/ruby-ldapserver/lib/ldap/server/tcpserver.rb +0 -91
  105. data/vendor/ruby-ldapserver/lib/ldap/server/util.rb +0 -88
  106. data/vendor/ruby-ldapserver/lib/ldap/server/version.rb +0 -11
  107. data/vendor/ruby-ldapserver/test/core.schema +0 -582
  108. data/vendor/ruby-ldapserver/test/encoding_test.rb +0 -279
  109. data/vendor/ruby-ldapserver/test/filter_test.rb +0 -107
  110. data/vendor/ruby-ldapserver/test/match_test.rb +0 -59
  111. data/vendor/ruby-ldapserver/test/schema_test.rb +0 -113
  112. data/vendor/ruby-ldapserver/test/syntax_test.rb +0 -40
  113. data/vendor/ruby-ldapserver/test/test_helper.rb +0 -2
  114. data/vendor/ruby-ldapserver/test/util_test.rb +0 -51
@@ -1,38 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html>
4
- <head>
5
- <meta name="Content-Type" content="text/html; charset=utf-8" />
6
- <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
7
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
8
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
9
- <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
10
- <base id="base_target" target="_parent" />
11
- </head>
12
- <body>
13
- <script type="text/javascript" charset="utf-8">
14
- if (window.top.frames.main) {
15
- document.getElementById('base_target').target = 'main';
16
- document.body.className = 'frames';
17
- }
18
- </script>
19
- <div id="content">
20
- <h1 id="full_list_header">File List</h1>
21
- <div id="nav">
22
- <a target="_self" href="class_list.html">Classes</a> |
23
- <a target="_self" href="method_list.html">Methods</a> |
24
- <a target="_self" href="file_list.html">Files</a>
25
- </div>
26
- <div id="search">Search: <input type="text" /></div>
27
-
28
- <ul id="full_list" class="files">
29
-
30
-
31
- <li class="r1"><a href="index.html" title="README">README</a></li>
32
-
33
-
34
- </ul>
35
- </div>
36
- </body>
37
- </html>
38
-
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
3
-
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
- <title>Documentation by YARD 0.6.0</title>
8
- </head>
9
- <frameset cols="20%,*">
10
- <frame name="list" src="class_list.html" />
11
- <frame name="main" src="index.html" />
12
- </frameset>
13
- </html>
@@ -1,399 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta name="Content-Type" content="text/html; charset=utf-8" />
6
- <title>Documentation by YARD 0.6.0</title>
7
- <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
8
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
9
-
10
- <script type="text/javascript" charset="utf-8">
11
- relpath = '';
12
- if (relpath != '') relpath += '/';
13
- </script>
14
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
15
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
16
-
17
- </head>
18
- <body>
19
- <script type="text/javascript" charset="utf-8">
20
- if (window.top.frames.main) document.body.className = 'frames';
21
- </script>
22
-
23
- <div id="header">
24
- <div id="menu">
25
-
26
- <a href="_index.html" title="Index">Index</a> &raquo;
27
- <span class="title">File: README</span>
28
-
29
-
30
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
31
- </div>
32
-
33
- <div id="search">
34
- <a id="class_list_link" href="#">Class List</a>
35
- <a id="method_list_link" href="#">Method List</a>
36
- <a id ="file_list_link" href="#">File List</a>
37
- </div>
38
-
39
- <div class="clear"></div>
40
- </div>
41
-
42
- <iframe id="search_frame"></iframe>
43
-
44
- <div id="content"><div id='filecontents'><p>
45
- CHANGES FROM VERSION 0.2 TO VERSION 0.3
46
- </p>
47
- <hr style="height: 10px"></hr><p>
48
- There have been substantial changes to ruby-ldapserver between version 0.2
49
- and version 0.3. If you have not been using 0.2, you can skip this section.
50
- </p>
51
- <p>
52
- Major API changes:
53
- </p>
54
- <ul>
55
- <li><p>
56
- I have renamed module LDAPServer to module LDAP::Server, This means e.g.
57
- </p>
58
- </li>
59
- </ul>
60
- <p>
61
- require &#8216;ldapserver/connection&#8217; becomes require
62
- &#8216;ldap/server/connection&#8217;
63
- </p>
64
- <ul>
65
- <li><p>
66
- I have moved the result exceptions to be subclasses of LDAP::ResultError,
67
- </p>
68
- </li>
69
- </ul>
70
- <p>
71
- for consistency with ruby-ldap, and named under LDAP::ResultError::<name>
72
- to group them together. Everything else remains under LDAP::Server.
73
- </p>
74
- <ul>
75
- <li><p>
76
- The format of the parsed &#8216;filter&#8217; parameter to Operation#search
77
- has
78
- </p>
79
- </li>
80
- </ul>
81
- <p>
82
- changed. See filter.rb. In particular, the format of a :substrings filter
83
- has been changed (simplified).
84
- </p>
85
- <ul>
86
- <li><p>
87
- The format of the &#8216;modinfo&#8217; parameter to Operation#modify has
88
- changed. See
89
- </p>
90
- </li>
91
- </ul>
92
- <p>
93
- the comment above &#8216;def modify&#8217; in operation.rb
94
- </p>
95
- <ul>
96
- <li><p>
97
- Attribute names are no longer automatically downcased. If you are running
98
- </p>
99
- </li>
100
- </ul>
101
- <p>
102
- with a schema, however, then they will be converted into their preferred
103
- forms. That is, &#8220;OBJECTCLASS&#8221; will become
104
- &#8220;objectClass&#8221;, &#8220;CommonName&#8221; will become
105
- &#8220;cn&#8221;, and so on.
106
- </p>
107
- <p>
108
- Improvements include:
109
- </p>
110
- <ul>
111
- <li><p>
112
- There is now an explicit object representing a server instance:
113
- </p>
114
- </li>
115
- </ul>
116
- <p>
117
- &#8220;LDAP::Server&#8221;. This bundles together the root DSE, the schema
118
- (if used), the subclass of Operation which you wish to use, and various
119
- other parameters such as ssl certificate data. It has methods run_tcpserver
120
- and run_prefork, making it straightforward to start a server. Both support
121
- SSL on connect. You can do require &#8216;ldap/server&#8217; to get all the
122
- essential libraries for a server.
123
- </p>
124
- <ul>
125
- <li><p>
126
- LDAP::Server :user and :group settings let you drop privileges after
127
- </p>
128
- </li>
129
- </ul>
130
- <p>
131
- binding to port 389.
132
- </p>
133
- <ul>
134
- <li><p>
135
- Schema support. Can load schemas in OpenLDAP format, publish them via
136
- </p>
137
- </li>
138
- </ul>
139
- <p>
140
- LDAP, validate add/modify operations, use them to map attribute names to
141
- their &#8216;standard&#8217; versions (e.g. &#8220;commonname&#8221;
142
- becomes &#8220;cn&#8221;), and perform case-insensitive comparisons where
143
- the schema mandates this. See classes LDAP::Server::Schema,
144
- LDAP::Server::ObjectClass, LDAP::Server::AttributeType,
145
- LDAP::Server::Syntax, LDAP::Server::MatchingRule, and examples/rbslapd3.rb.
146
- </p>
147
- <p>
148
- What is it?
149
- </p>
150
- <hr style="height: 9px"></hr><p>
151
- ruby-ldapserver is a lightweight, pure Ruby skeleton for implementing LDAP
152
- server applications. It is intended primarily for when you wish to build a
153
- gateway from LDAP queries into some other protocol or database; it does not
154
- attempt to be a full implementation of the standard LDAP data model itself
155
- (although you could build one using this as a frontend)
156
- </p>
157
- <p>
158
- The Connection class handles incoming connections, decodes ASN1-formatted
159
- LDAP requests, and creates an Operation object for each request. The
160
- Operation object further parses the ASN1 request and invokes methods which
161
- you override to perform useful work. Responses and exceptions are converted
162
- back into ASN1 and returned to the client. Optionally, a collection of
163
- objects can be used to implement a Schema (e.g. normalize attribute names,
164
- validate add and modify operations, perform appropriate matching
165
- operations)
166
- </p>
167
- <p>
168
- Since it&#8217;s written entirely in Ruby, it benefits from Ruby&#8217;s
169
- threading engine.
170
- </p>
171
- <p>
172
- Target audience
173
- </p>
174
- <hr style="height: 10px"></hr><p>
175
- Technically-savvy Ruby applications developers; the sort of people who are
176
- happy to read RFCs and read code to work out what it does :-)
177
- </p>
178
- <p>
179
- The examples/ directory contains a few minimal LDAP servers which you can
180
- use as a starting point.
181
- </p>
182
- <p>
183
- Status
184
- </p>
185
- <hr style="height: 4px"></hr><p>
186
- This is an early release. It works for me as an LDAP protocol convertor;
187
- the Schema stuff has not been heavily tested by me.
188
- </p>
189
- <p>
190
- Libraries
191
- </p>
192
- <hr style="height: 7px"></hr><p>
193
- ASN1 encoding and decoding is done using the &#8216;openssl&#8217;
194
- extension, which is standard in the Ruby 1.8.2 base distribution. To check
195
- you have it, you should be able to run `ruby -ropenssl -e puts` with no
196
- error.
197
- </p>
198
- <p>
199
- However, I&#8217;ve found in the past that Linux machines don&#8217;t
200
- always build the openssl extension when compiling Ruby from source. With
201
- Red Hat 9, the solution for me was, when building Ruby itself:
202
- </p>
203
- <pre class="code">
204
- <span class='comment'># export CPPFLAGS=&quot;-I/usr/kerberos/include&quot;
205
- </span> <span class='comment'># export LDFLAGS=&quot;-L/usr/kerberos/lib&quot;
206
- </span> <span class='comment'># ./configure ...etc
207
- </span></pre>
208
- <p>
209
- If you want to run the test suite then you&#8217;ll need to install the
210
- ruby-ldap client library, and if you want to run examples/rbslapd3.rb then
211
- you&#8217;ll need the prefork library. Both are available from <<a
212
- href="http://raa.ruby-lang.org">raa.ruby-lang.org</a>/>.
213
- </p>
214
- <p>
215
- Protocol implementation
216
- </p>
217
- <hr style="height: 10px"></hr><p>
218
- ruby-ldapserver tries to be a reasonably complete implementation of the
219
- message decoding and encoding components of LDAP. However, it does not
220
- synthesise or directly enforce the LDAP data model. It will advertise a
221
- schema in the root DSE if you configure one, and it provides helper
222
- functions which allow you to validate add and modify operations against a
223
- schema; but it&#8217;s up to you to use them, if you wish. If you&#8217;re
224
- just using LDAP as a convenient query interface into some other database,
225
- you probably don&#8217;t care about schemas.
226
- </p>
227
- <p>
228
- If your clients permit it, you can violate the LDAP specification further,
229
- eliminating some of the gross design flaws of LDAP. For example, you can
230
- ditch the LDAP idea that a Distinguished Name must consist of
231
- attr=val,attr=val,attr=val&#8230; and use whatever is convenient as a
232
- primary key (e.g. &#8220;val1,val2,val3&#8221; or
233
- &#8220;id,table_name&#8221;). The &#8216;add&#8217; operation could
234
- allocate DNs automatically from a sequence. There&#8217;s no need for the
235
- data duplication where an LDAP entry must contain the same attr=val pair
236
- which is also the entry&#8217;s RDN. Violations of the LDAP spec in this
237
- way are at your own risk.
238
- </p>
239
- <p>
240
- Threading issues
241
- </p>
242
- <hr style="height: 10px"></hr><p>
243
- The core of this library is the LDAP::Server::Connection object which
244
- handles communication with a single client, and the LDAP::Server::Operation
245
- object which handles a single request. Because the LDAP protocol allows a
246
- client to send multiple overlapping requests down the same TCP connection,
247
- I start a new Ruby thread for each Operation.
248
- </p>
249
- <p>
250
- If your Operation object deals with any global shared data, then it needs
251
- to do so in a thread-safe way. If this is new to you then see <<a
252
- href="http://www.rubycentral.com/book/tut_threads.html">www.rubycentral.com/book/tut_threads.html</a>>
253
- <<a
254
- href="http://www.rubygarden.org/ruby?MultiThreading">www.rubygarden.org/ruby?MultiThreading</a>>
255
- </p>
256
- <p>
257
- For incoming client connections, I have supplied a simple tcpserver method
258
- which starts a new Ruby thread for each client. This works fine, but in a
259
- multi-CPU system, all LDAP server operations will be processed on one CPU;
260
- also with a very large number of concurrent client connections, you may
261
- find you hit the a max-filedescriptors-per-process limit.
262
- </p>
263
- <p>
264
- I have also provided a preforking server; see examples/rbslapd3.rb. In this
265
- case, your connections are handled in separate processes so they cannot
266
- share data directly in RAM.
267
- </p>
268
- <p>
269
- If you are using the default threading tcpserver, then beware that a number
270
- of Ruby extension libraries block the threading interpreter. In particular,
271
- the client library &#8220;ruby-ldap&#8221; blocks when waiting for a
272
- response from a remote server, since it&#8217;s a wrapper around a C
273
- library which is unaware of Ruby&#8217;s threading engine. This can cause
274
- your application to &#8216;freeze&#8217; periodically. Either choose client
275
- libraries which play well with threading, or make sure each client is
276
- handled in a different process.
277
- </p>
278
- <p>
279
- For example, when talking to a MySQL database, you might want to choose
280
- &#8220;ruby-mysql&#8221; (which is a pure Ruby implementation of the MySQL
281
- protocol) rather than &#8220;mysql-ruby&#8221; (which is a wrapper around
282
- the C API, and blocks while waiting for responses from the server)
283
- </p>
284
- <p>
285
- Even with something like ruby-mysql, beware DNS lookups: resolver libraries
286
- can block too. There is a pure Ruby resolver replacement in the standard
287
- library: if you do
288
- </p>
289
- <pre class="code">
290
- <span class='id require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>resolv-replace</span><span class='tstring_end'>'</span></span>
291
- </pre>
292
- <p>
293
- this changes TCPSocket and friends to use it instead of the default C
294
- resolver. Or you could just hard-code IP addresses, or put entries in
295
- /etc/hosts for the machines you want to contact.
296
- </p>
297
- <p>
298
- Another threading issue to think about is abandoned and timed-out LDAP
299
- operations. The Connection object handles these by raising an
300
- LDAP::Server::Abandon or LDAP::Server::TimeLimitExceeded exception in the
301
- Operation thread, which you can either ignore or rescue. However, if in
302
- rescuing it you end up putting (say) a SQL connection back into a pool, you
303
- should beware that the SQL connection may still be mid-query, so it&#8217;s
304
- probably better to discard it and use a fresh one next time.
305
- </p>
306
- <p>
307
- Performance
308
- </p>
309
- <hr style="height: 9px"></hr><p>
310
- examples/speedtest.rb is a simple client which forks N processes, and in
311
- each process opens an LDAP connection, binds, and sends M search requests
312
- down it.
313
- </p>
314
- <p>
315
- Using speedtest.rb and rbslapd1.rb, running on the <b>same</b> machine
316
- (single-processor AMD Athlon 2500+) I achieve around 800 searches per
317
- second with N=1,M=1000 and 300-400 searches per second with N=10,M=100.
318
- </p>
319
- <p>
320
- To-do list
321
- </p>
322
- <hr style="height: 8px"></hr><ul>
323
- <li><p>
324
- handle and test generation of LDAP referrals properly
325
- </p>
326
- </li>
327
- <li><p>
328
- more cases in test suite: abandon, concurrency, performance tests, error
329
- handling
330
- </p>
331
- </li>
332
- <li><p>
333
- extensible match filters
334
- </p>
335
- </li>
336
- <li><p>
337
- extended operations RFC 2830 - Start TLS RFC 3062 - password modify RFC
338
- 2839 - whoami RFC 3909 - cancel
339
- </p>
340
- </li>
341
- </ul>
342
- <p>
343
- References
344
- </p>
345
- <hr style="height: 8px"></hr><ul>
346
- <li><p>
347
- <a
348
- href="ftp://ftp.isi.edu/in-notes/rfc2251.txt">ftp.isi.edu/in-notes/rfc2251.txt</a>
349
- (base protocol)
350
- </p>
351
- </li>
352
- <li><p>
353
- <a
354
- href="ftp://ftp.isi.edu/in-notes/rfc2252.txt">ftp.isi.edu/in-notes/rfc2252.txt</a>
355
- (schema)
356
- </p>
357
- </li>
358
- <li><p>
359
- <a
360
- href="ftp://ftp.isi.edu/in-notes/rfc2253.txt">ftp.isi.edu/in-notes/rfc2253.txt</a>
361
- (DN encoding)
362
- </p>
363
- </li>
364
- <li><p>
365
- <a
366
- href="http://www.itu.int/ITU-T/studygroups/com17/languages/X.680-0207.pdf">www.itu.int/ITU-T/studygroups/com17/languages/X.680-0207.pdf</a>
367
- </p>
368
- </li>
369
- <li><p>
370
- <a
371
- href="http://www.itu.int/ITU-T/studygroups/com10/languages/X.690_1297.pdf">www.itu.int/ITU-T/studygroups/com10/languages/X.690_1297.pdf</a>
372
- </p>
373
- </li>
374
- </ul>
375
- <p>
376
- Contact
377
- </p>
378
- <hr style="height: 5px"></hr><p>
379
- You are very welcome to E-mail me with bug reports, patches, comments and
380
- suggestions for this software. However, please DON&#8217;T send me any
381
- general questions about LDAP, how LDAP works, how to apply LDAP in your
382
- particular situation, or questions about any other LDAP software. The
383
- `ldap@umich.edu` mailing list is probably the correct place to ask such
384
- questions. See: <<a
385
- href="http://listserver.itd.umich.edu/cgi-bin/lyris.pl?enter=ldap">listserver.itd.umich.edu/cgi-bin/lyris.pl?enter=ldap</a>>
386
- </p>
387
- <p>
388
- Brian Candler <B.Candler@pobox.com>
389
- </p>
390
- </div></div>
391
-
392
- <div id="footer">
393
- Generated on Mon Sep 13 13:27:15 2010 by
394
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
395
- 0.6.0 (ruby-1.9.2).
396
- </div>
397
-
398
- </body>
399
- </html>