fakeldap 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/lib/fakeldap.rb +20 -0
- data/lib/fakeldap/version.rb +1 -1
- data/vendor/ruby-ldapserver/doc/LDAP.html +104 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Abandon.html +112 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Error.html +115 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError.html +241 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AdminLimitExceeded.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AffectsMultipleDSAs.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AliasDereferencingProblem.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AliasProblem.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AttributeOrValueExists.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AuthMethodNotSupported.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Busy.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/CompareFalse.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/CompareTrue.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ConfidentialityRequired.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ConstraintViolation.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/EntryAlreadyExists.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InappropriateAuthentication.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InappropriateMatching.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InsufficientAccessRights.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InvalidAttributeSyntax.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InvalidCredentials.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InvalidDNSyntax.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/IsLeaf.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/LoopDetect.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NamingViolation.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NoSuchAttribute.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NoSuchObject.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NotAllowedOnNonLeaf.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NotAllowedOnRDN.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ObjectClassModsProhibited.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ObjectClassViolation.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/OperationsError.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Other.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ProtocolError.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Referral.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/SaslBindInProgress.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/SizeLimitExceeded.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/StrongAuthRequired.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Success.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/TimeLimitExceeded.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Unavailable.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/UnavailableCriticalExtension.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/UndefinedAttributeType.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/ResultError/UnwillingToPerform.html +158 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server.html +1056 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/Connection.html +1353 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/Filter.html +634 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule.html +1132 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/DefaultMatchingClass.html +219 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Equality.html +170 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/IA5Downcase.html +143 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/IA5Trim.html +155 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Integer.html +143 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Ordering.html +212 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/StringDowncase.html +143 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/StringTrim.html +154 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Substrings.html +177 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/Operation.html +2994 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/Schema.html +2024 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/Schema/AttributeType.html +1462 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/Schema/ObjectClass.html +1097 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/Syntax.html +1254 -0
- data/vendor/ruby-ldapserver/doc/LDAP/Server/VERSION.html +134 -0
- data/vendor/ruby-ldapserver/doc/_index.html +662 -0
- data/vendor/ruby-ldapserver/doc/class_list.html +36 -0
- data/vendor/ruby-ldapserver/doc/css/common.css +1 -0
- data/vendor/ruby-ldapserver/doc/css/full_list.css +50 -0
- data/vendor/ruby-ldapserver/doc/css/style.css +303 -0
- data/vendor/ruby-ldapserver/doc/file.README.html +399 -0
- data/vendor/ruby-ldapserver/doc/file_list.html +38 -0
- data/vendor/ruby-ldapserver/doc/frames.html +13 -0
- data/vendor/ruby-ldapserver/doc/index.html +399 -0
- data/vendor/ruby-ldapserver/doc/js/app.js +204 -0
- data/vendor/ruby-ldapserver/doc/js/full_list.js +112 -0
- data/vendor/ruby-ldapserver/doc/js/jquery.js +154 -0
- data/vendor/ruby-ldapserver/doc/method_list.html +1571 -0
- data/vendor/ruby-ldapserver/doc/top-level-namespace.html +88 -0
- metadata +99 -10
@@ -0,0 +1,38 @@
|
|
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
|
+
|
@@ -0,0 +1,13 @@
|
|
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>
|
@@ -0,0 +1,399 @@
|
|
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> »
|
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 ‘ldapserver/connection’ becomes require
|
62
|
+
‘ldap/server/connection’
|
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 ‘filter’ 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 ‘modinfo’ parameter to Operation#modify has
|
88
|
+
changed. See
|
89
|
+
</p>
|
90
|
+
</li>
|
91
|
+
</ul>
|
92
|
+
<p>
|
93
|
+
the comment above ‘def modify’ 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, “OBJECTCLASS” will become
|
104
|
+
“objectClass”, “CommonName” will become
|
105
|
+
“cn”, 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
|
+
“LDAP::Server”. 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 ‘ldap/server’ 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 ‘standard’ versions (e.g. “commonname”
|
142
|
+
becomes “cn”), 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’s written entirely in Ruby, it benefits from Ruby’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 ‘openssl’
|
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’ve found in the past that Linux machines don’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="-I/usr/kerberos/include"
|
205
|
+
</span> <span class='comment'># export LDFLAGS="-L/usr/kerberos/lib"
|
206
|
+
</span> <span class='comment'># ./configure ...etc
|
207
|
+
</span></pre>
|
208
|
+
<p>
|
209
|
+
If you want to run the test suite then you’ll need to install the
|
210
|
+
ruby-ldap client library, and if you want to run examples/rbslapd3.rb then
|
211
|
+
you’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’s up to you to use them, if you wish. If you’re
|
224
|
+
just using LDAP as a convenient query interface into some other database,
|
225
|
+
you probably don’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… and use whatever is convenient as a
|
232
|
+
primary key (e.g. “val1,val2,val3” or
|
233
|
+
“id,table_name”). The ‘add’ operation could
|
234
|
+
allocate DNs automatically from a sequence. There’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’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 “ruby-ldap” blocks when waiting for a
|
272
|
+
response from a remote server, since it’s a wrapper around a C
|
273
|
+
library which is unaware of Ruby’s threading engine. This can cause
|
274
|
+
your application to ‘freeze’ 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
|
+
“ruby-mysql” (which is a pure Ruby implementation of the MySQL
|
281
|
+
protocol) rather than “mysql-ruby” (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’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’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>
|