fakeldap 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/README.md +2 -0
  2. data/lib/fakeldap.rb +20 -0
  3. data/lib/fakeldap/version.rb +1 -1
  4. data/vendor/ruby-ldapserver/doc/LDAP.html +104 -0
  5. data/vendor/ruby-ldapserver/doc/LDAP/Abandon.html +112 -0
  6. data/vendor/ruby-ldapserver/doc/LDAP/Error.html +115 -0
  7. data/vendor/ruby-ldapserver/doc/LDAP/ResultError.html +241 -0
  8. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AdminLimitExceeded.html +158 -0
  9. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AffectsMultipleDSAs.html +158 -0
  10. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AliasDereferencingProblem.html +158 -0
  11. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AliasProblem.html +158 -0
  12. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AttributeOrValueExists.html +158 -0
  13. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/AuthMethodNotSupported.html +158 -0
  14. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Busy.html +158 -0
  15. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/CompareFalse.html +158 -0
  16. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/CompareTrue.html +158 -0
  17. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ConfidentialityRequired.html +158 -0
  18. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ConstraintViolation.html +158 -0
  19. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/EntryAlreadyExists.html +158 -0
  20. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InappropriateAuthentication.html +158 -0
  21. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InappropriateMatching.html +158 -0
  22. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InsufficientAccessRights.html +158 -0
  23. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InvalidAttributeSyntax.html +158 -0
  24. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InvalidCredentials.html +158 -0
  25. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/InvalidDNSyntax.html +158 -0
  26. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/IsLeaf.html +158 -0
  27. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/LoopDetect.html +158 -0
  28. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NamingViolation.html +158 -0
  29. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NoSuchAttribute.html +158 -0
  30. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NoSuchObject.html +158 -0
  31. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NotAllowedOnNonLeaf.html +158 -0
  32. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/NotAllowedOnRDN.html +158 -0
  33. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ObjectClassModsProhibited.html +158 -0
  34. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ObjectClassViolation.html +158 -0
  35. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/OperationsError.html +158 -0
  36. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Other.html +158 -0
  37. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/ProtocolError.html +158 -0
  38. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Referral.html +158 -0
  39. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/SaslBindInProgress.html +158 -0
  40. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/SizeLimitExceeded.html +158 -0
  41. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/StrongAuthRequired.html +158 -0
  42. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Success.html +158 -0
  43. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/TimeLimitExceeded.html +158 -0
  44. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/Unavailable.html +158 -0
  45. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/UnavailableCriticalExtension.html +158 -0
  46. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/UndefinedAttributeType.html +158 -0
  47. data/vendor/ruby-ldapserver/doc/LDAP/ResultError/UnwillingToPerform.html +158 -0
  48. data/vendor/ruby-ldapserver/doc/LDAP/Server.html +1056 -0
  49. data/vendor/ruby-ldapserver/doc/LDAP/Server/Connection.html +1353 -0
  50. data/vendor/ruby-ldapserver/doc/LDAP/Server/Filter.html +634 -0
  51. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule.html +1132 -0
  52. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/DefaultMatchingClass.html +219 -0
  53. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Equality.html +170 -0
  54. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/IA5Downcase.html +143 -0
  55. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/IA5Trim.html +155 -0
  56. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Integer.html +143 -0
  57. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Ordering.html +212 -0
  58. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/StringDowncase.html +143 -0
  59. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/StringTrim.html +154 -0
  60. data/vendor/ruby-ldapserver/doc/LDAP/Server/MatchingRule/Substrings.html +177 -0
  61. data/vendor/ruby-ldapserver/doc/LDAP/Server/Operation.html +2994 -0
  62. data/vendor/ruby-ldapserver/doc/LDAP/Server/Schema.html +2024 -0
  63. data/vendor/ruby-ldapserver/doc/LDAP/Server/Schema/AttributeType.html +1462 -0
  64. data/vendor/ruby-ldapserver/doc/LDAP/Server/Schema/ObjectClass.html +1097 -0
  65. data/vendor/ruby-ldapserver/doc/LDAP/Server/Syntax.html +1254 -0
  66. data/vendor/ruby-ldapserver/doc/LDAP/Server/VERSION.html +134 -0
  67. data/vendor/ruby-ldapserver/doc/_index.html +662 -0
  68. data/vendor/ruby-ldapserver/doc/class_list.html +36 -0
  69. data/vendor/ruby-ldapserver/doc/css/common.css +1 -0
  70. data/vendor/ruby-ldapserver/doc/css/full_list.css +50 -0
  71. data/vendor/ruby-ldapserver/doc/css/style.css +303 -0
  72. data/vendor/ruby-ldapserver/doc/file.README.html +399 -0
  73. data/vendor/ruby-ldapserver/doc/file_list.html +38 -0
  74. data/vendor/ruby-ldapserver/doc/frames.html +13 -0
  75. data/vendor/ruby-ldapserver/doc/index.html +399 -0
  76. data/vendor/ruby-ldapserver/doc/js/app.js +204 -0
  77. data/vendor/ruby-ldapserver/doc/js/full_list.js +112 -0
  78. data/vendor/ruby-ldapserver/doc/js/jquery.js +154 -0
  79. data/vendor/ruby-ldapserver/doc/method_list.html +1571 -0
  80. data/vendor/ruby-ldapserver/doc/top-level-namespace.html +88 -0
  81. metadata +99 -10
@@ -0,0 +1,158 @@
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>Class: LDAP::ResultError::UnwillingToPerform</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">Index (U)</a> &raquo;
27
+ <span class='title'><span class='object_link'><a href="../../LDAP.html" title="LDAP (module)">LDAP</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../ResultError.html" title="LDAP::ResultError (class)">ResultError</a></span></span>
28
+ &raquo;
29
+ <span class="title">UnwillingToPerform</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Class: LDAP::ResultError::UnwillingToPerform
47
+
48
+
49
+
50
+ </h1>
51
+
52
+ <dl class="box">
53
+
54
+ <dt class="r1">Inherits:</dt>
55
+ <dd class="r1">
56
+ <span class="inheritName">Object</span>
57
+
58
+ <ul class="fullTree">
59
+ <li>Object</li>
60
+
61
+ <li class="next">LDAP::ResultError::UnwillingToPerform</li>
62
+
63
+ </ul>
64
+ <a href="#" class="inheritanceTree">show all</a>
65
+
66
+ </dd>
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+ <dt class="r2 last">Defined in:</dt>
77
+ <dd class="r2 last">lib/ldap/server/result.rb</dd>
78
+
79
+ </dl>
80
+ <div class="clear"></div>
81
+
82
+
83
+
84
+
85
+
86
+ <h2>
87
+ Instance Method Summary
88
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
89
+ </h2>
90
+
91
+ <ul class="summary">
92
+
93
+ <li class="public ">
94
+ <span class="summary_signature">
95
+
96
+ <a href="#to_i-instance_method" title="#to_i (instance method)">- (Object) <strong>to_i</strong> </a>
97
+
98
+
99
+
100
+ </span>
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+ <span class="summary_desc"><div class='inline'></div></span>
110
+
111
+ </li>
112
+
113
+
114
+ </ul>
115
+
116
+
117
+
118
+
119
+ <div id="instance_method_details" class="method_details_list">
120
+ <h2>Instance Method Details</h2>
121
+
122
+
123
+ <div class="method_details first">
124
+ <p class="signature first" id="to_i-instance_method">
125
+
126
+ - (<tt>Object</tt>) <strong>to_i</strong>
127
+
128
+
129
+
130
+ </p><table class="source_code">
131
+ <tr>
132
+ <td>
133
+ <pre class="lines">
134
+
135
+
136
+ 49</pre>
137
+ </td>
138
+ <td>
139
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/result.rb', line 49</span>
140
+
141
+ <span class='kw'>def</span> <span class='id to_i'>to_i</span><span class='semicolon'>;</span> <span class='int'>53</span><span class='semicolon'>;</span> <span class='kw'>end</span></pre>
142
+ </td>
143
+ </tr>
144
+ </table>
145
+ </div>
146
+
147
+ </div>
148
+
149
+ </div>
150
+
151
+ <div id="footer">
152
+ Generated on Mon Sep 13 13:27:17 2010 by
153
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
154
+ 0.6.0 (ruby-1.9.2).
155
+ </div>
156
+
157
+ </body>
158
+ </html>
@@ -0,0 +1,1056 @@
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>Class: LDAP::Server</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">Index (S)</a> &raquo;
27
+ <span class='title'><span class='object_link'><a href="../LDAP.html" title="LDAP (module)">LDAP</a></span></span>
28
+ &raquo;
29
+ <span class="title">Server</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Class: LDAP::Server
47
+
48
+
49
+
50
+ </h1>
51
+
52
+ <dl class="box">
53
+
54
+ <dt class="r1">Inherits:</dt>
55
+ <dd class="r1">
56
+ <span class="inheritName">Object</span>
57
+
58
+ <ul class="fullTree">
59
+ <li>Object</li>
60
+
61
+ <li class="next">LDAP::Server</li>
62
+
63
+ </ul>
64
+ <a href="#" class="inheritanceTree">show all</a>
65
+
66
+ </dd>
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+ <dt class="r2 last">Defined in:</dt>
77
+ <dd class="r2 last">lib/ldap/server/version.rb<span class="defines">,<br />
78
+ lib/ldap/server/util.rb,<br /> lib/ldap/server/match.rb,<br /> lib/ldap/server/syntax.rb,<br /> lib/ldap/server/filter.rb,<br /> lib/ldap/server/server.rb,<br /> lib/ldap/server/schema.rb,<br /> lib/ldap/server/tcpserver.rb,<br /> lib/ldap/server/operation.rb,<br /> lib/ldap/server/connection.rb,<br /> lib/ldap/server/preforkserver.rb</span>
79
+ </dd>
80
+
81
+ </dl>
82
+ <div class="clear"></div>
83
+
84
+ <h2>Overview</h2><div class="docstring">
85
+ <div class="discussion">
86
+ <p>
87
+ :nodoc:
88
+ </p>
89
+
90
+
91
+ </div>
92
+ </div>
93
+ <div class="tags">
94
+
95
+ </div><h2>Defined Under Namespace</h2>
96
+ <p class="children">
97
+
98
+
99
+
100
+
101
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Server/Connection.html" title="LDAP::Server::Connection (class)">Connection</a></span>, <span class='object_link'><a href="Server/Filter.html" title="LDAP::Server::Filter (class)">Filter</a></span>, <span class='object_link'><a href="Server/MatchingRule.html" title="LDAP::Server::MatchingRule (class)">MatchingRule</a></span>, <span class='object_link'><a href="Server/Operation.html" title="LDAP::Server::Operation (class)">Operation</a></span>, <span class='object_link'><a href="Server/Schema.html" title="LDAP::Server::Schema (class)">Schema</a></span>, <span class='object_link'><a href="Server/Syntax.html" title="LDAP::Server::Syntax (class)">Syntax</a></span>, <span class='object_link'><a href="Server/VERSION.html" title="LDAP::Server::VERSION (class)">VERSION</a></span>
102
+
103
+
104
+ </p>
105
+
106
+ <h2>Constant Summary</h2>
107
+
108
+ <dl class="constants">
109
+
110
+ <dt id="DEFAULT_OPT-constant" class="">DEFAULT_OPT =
111
+
112
+ </dt>
113
+ <dd><pre class="code"><span class='lbrace'>{</span>
114
+ <span class='symbol'>:port</span><span class='op'>=&gt;</span><span class='int'>389</span><span class='comma'>,</span>
115
+ <span class='symbol'>:nodelay</span><span class='op'>=&gt;</span><span class='kw'>true</span><span class='comma'>,</span>
116
+ <span class='rbrace'>}</span></pre></dd>
117
+
118
+ <dt id="BaseObject-constant" class="">BaseObject =
119
+ <div class="docstring">
120
+ <div class="discussion">
121
+ <p>
122
+ Scope
123
+ </p>
124
+
125
+
126
+ </div>
127
+ </div>
128
+ <div class="tags">
129
+
130
+ </div>
131
+ </dt>
132
+ <dd><pre class="code"><span class='int'>0</span></pre></dd>
133
+
134
+ <dt id="SingleLevel-constant" class="">SingleLevel =
135
+
136
+ </dt>
137
+ <dd><pre class="code"><span class='int'>1</span></pre></dd>
138
+
139
+ <dt id="WholeSubtree-constant" class="">WholeSubtree =
140
+
141
+ </dt>
142
+ <dd><pre class="code"><span class='int'>2</span></pre></dd>
143
+
144
+ <dt id="NeverDerefAliases-constant" class="">NeverDerefAliases =
145
+ <div class="docstring">
146
+ <div class="discussion">
147
+ <p>
148
+ DerefAliases
149
+ </p>
150
+
151
+
152
+ </div>
153
+ </div>
154
+ <div class="tags">
155
+
156
+ </div>
157
+ </dt>
158
+ <dd><pre class="code"><span class='int'>0</span></pre></dd>
159
+
160
+ <dt id="DerefInSearching-constant" class="">DerefInSearching =
161
+
162
+ </dt>
163
+ <dd><pre class="code"><span class='int'>1</span></pre></dd>
164
+
165
+ <dt id="DerefFindingBaseObj-constant" class="">DerefFindingBaseObj =
166
+
167
+ </dt>
168
+ <dd><pre class="code"><span class='int'>2</span></pre></dd>
169
+
170
+ <dt id="DerefAlways-constant" class="">DerefAlways =
171
+
172
+ </dt>
173
+ <dd><pre class="code"><span class='int'>3</span></pre></dd>
174
+
175
+ </dl>
176
+
177
+
178
+
179
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
180
+ <ul class="summary">
181
+
182
+ <li class="public ">
183
+ <span class="summary_signature">
184
+
185
+ <a href="#root_dse-instance_method" title="#root_dse (instance method)">- (Object) <strong>root_dse</strong> </a>
186
+
187
+
188
+
189
+ </span>
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+ <span class="summary_desc"><div class='inline'><p>
202
+ Returns the value of attribute root_dse.
203
+ </p>
204
+ </div></span>
205
+
206
+ </li>
207
+
208
+
209
+ </ul>
210
+
211
+
212
+
213
+ <h2>
214
+ Class Method Summary
215
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
216
+ </h2>
217
+
218
+ <ul class="summary">
219
+
220
+ <li class="public ">
221
+ <span class="summary_signature">
222
+
223
+ <a href="#preforkserver-class_method" title="preforkserver (class method)">+ (Object) <strong>preforkserver</strong>(opt, &amp;blk) </a>
224
+
225
+
226
+
227
+ </span>
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+ <span class="summary_desc"><div class='inline'><p>
237
+ Accept connections on a port, and for each one run the given block in one
238
+ of N pre-forked children.
239
+ </p>
240
+ </div></span>
241
+
242
+ </li>
243
+
244
+
245
+ <li class="public ">
246
+ <span class="summary_signature">
247
+
248
+ <a href="#ssl_prepare-class_method" title="ssl_prepare (class method)">+ (Object) <strong>ssl_prepare</strong>(opt) </a>
249
+
250
+
251
+
252
+ </span>
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+ <span class="summary_desc"><div class='inline'><p>
262
+ create opt[:ssl_ctx] from the other ssl options.
263
+ </p>
264
+ </div></span>
265
+
266
+ </li>
267
+
268
+
269
+ <li class="public ">
270
+ <span class="summary_signature">
271
+
272
+ <a href="#tcpserver-class_method" title="tcpserver (class method)">+ (Object) <strong>tcpserver</strong>(opt, &amp;blk) </a>
273
+
274
+
275
+
276
+ </span>
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+ <span class="summary_desc"><div class='inline'><p>
286
+ Accept connections on a port, and for each one start a new thread and run
287
+ the given block.
288
+ </p>
289
+ </div></span>
290
+
291
+ </li>
292
+
293
+
294
+ </ul>
295
+
296
+ <h2>
297
+ Instance Method Summary
298
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
299
+ </h2>
300
+
301
+ <ul class="summary">
302
+
303
+ <li class="public ">
304
+ <span class="summary_signature">
305
+
306
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Server) <strong>initialize</strong>(opt = DEFAULT_OPT) </a>
307
+
308
+
309
+
310
+ </span>
311
+
312
+ <span class="note title constructor">constructor</span>
313
+
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+ <span class="summary_desc"><div class='inline'><p>
322
+ Create a new server.
323
+ </p>
324
+ </div></span>
325
+
326
+ </li>
327
+
328
+
329
+ <li class="public ">
330
+ <span class="summary_signature">
331
+
332
+ <a href="#join-instance_method" title="#join (instance method)">- (Object) <strong>join</strong> </a>
333
+
334
+
335
+
336
+ </span>
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+ <span class="summary_desc"><div class='inline'></div></span>
346
+
347
+ </li>
348
+
349
+
350
+ <li class="public ">
351
+ <span class="summary_signature">
352
+
353
+ <a href="#run_prefork-instance_method" title="#run_prefork (instance method)">- (Object) <strong>run_prefork</strong> </a>
354
+
355
+
356
+
357
+ </span>
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+ <span class="summary_desc"><div class='inline'></div></span>
367
+
368
+ </li>
369
+
370
+
371
+ <li class="public ">
372
+ <span class="summary_signature">
373
+
374
+ <a href="#run_tcpserver-instance_method" title="#run_tcpserver (instance method)">- (Object) <strong>run_tcpserver</strong> </a>
375
+
376
+
377
+
378
+ </span>
379
+
380
+
381
+
382
+
383
+
384
+
385
+
386
+
387
+ <span class="summary_desc"><div class='inline'></div></span>
388
+
389
+ </li>
390
+
391
+
392
+ <li class="public ">
393
+ <span class="summary_signature">
394
+
395
+ <a href="#stop-instance_method" title="#stop (instance method)">- (Object) <strong>stop</strong> </a>
396
+
397
+
398
+
399
+ </span>
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+ <span class="summary_desc"><div class='inline'></div></span>
409
+
410
+ </li>
411
+
412
+
413
+ </ul>
414
+
415
+
416
+ <div id="constructor_details" class="method_details_list">
417
+ <h2>Constructor Details</h2>
418
+
419
+ <div class="method_details first">
420
+ <p class="signature first" id="initialize-instance_method">
421
+
422
+ - (<tt><span class='object_link'><a href="" title="LDAP::Server (class)">Server</a></span></tt>) <strong>initialize</strong>(opt = DEFAULT_OPT)
423
+
424
+
425
+
426
+ </p><div class="docstring">
427
+ <div class="discussion">
428
+ <p>
429
+ Create a new server. Options include all those to tcpserver/preforkserver
430
+ plus:
431
+ </p>
432
+ <pre class="code">
433
+ :operation_class=&gt;Class - set Operation handler class
434
+ :operation_args=&gt;[...] - args to Operation.new
435
+ :ssl_key_file=&gt;pem, :ssl_cert_file=&gt;pem - enable SSL
436
+ :ssl_ca_path=&gt;directory - verify peer certificates
437
+ :schema=&gt;Schema - Schema object
438
+ :namingContexts=&gt;[dn, ...] - base DN(s) we answer</pre>
439
+
440
+
441
+ </div>
442
+ </div>
443
+ <div class="tags">
444
+
445
+ </div><table class="source_code">
446
+ <tr>
447
+ <td>
448
+ <pre class="lines">
449
+
450
+
451
+ 24
452
+ 25
453
+ 26
454
+ 27
455
+ 28
456
+ 29
457
+ 30
458
+ 31
459
+ 32
460
+ 33
461
+ 34
462
+ 35
463
+ 36
464
+ 37
465
+ 38
466
+ 39
467
+ 40
468
+ 41</pre>
469
+ </td>
470
+ <td>
471
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/server.rb', line 24</span>
472
+
473
+ <span class='kw'>def</span> <span class='id initialize'>initialize</span><span class='lparen'>(</span><span class='id opt'>opt</span> <span class='op'>=</span> <span class='const'>DEFAULT_OPT</span><span class='rparen'>)</span>
474
+ <span class='ivar'>@opt</span> <span class='op'>=</span> <span class='id opt'>opt</span>
475
+ <span class='ivar'>@opt</span><span class='lbracket'>[</span><span class='symbol'>:server</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span>
476
+ <span class='ivar'>@opt</span><span class='lbracket'>[</span><span class='symbol'>:operation_class</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='op'>::</span><span class='const'>Operation</span>
477
+ <span class='ivar'>@opt</span><span class='lbracket'>[</span><span class='symbol'>:operation_args</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
478
+ <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='period'>.</span><span class='id ssl_prepare'>ssl_prepare</span><span class='lparen'>(</span><span class='ivar'>@opt</span><span class='rparen'>)</span>
479
+ <span class='ivar'>@schema</span> <span class='op'>=</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:schema</span><span class='rbracket'>]</span> <span class='comment'># may be nil
480
+ </span> <span class='ivar'>@root_dse</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id new'>new</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id h'>h</span><span class='comma'>,</span><span class='id k'>k</span><span class='op'>|</span> <span class='id h'>h</span><span class='lbracket'>[</span><span class='id k'>k</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id merge'>merge</span><span class='lparen'>(</span><span class='lbrace'>{</span>
481
+ <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>objectClass</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>top</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>openLDAProotDSE</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>extensibleObject</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
482
+ <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>supportedLDAPVersion</span><span class='tstring_end'>'</span></span> <span class='op'>=&gt;</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>3</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span>
483
+ <span class='comment'>#'altServer' =&gt;
484
+ </span> <span class='comment'>#'supportedExtension' =&gt;
485
+ </span> <span class='comment'>#'supportedControl' =&gt;
486
+ </span> <span class='comment'>#'supportedSASLMechanisms' =&gt;
487
+ </span> <span class='rbrace'>}</span><span class='rparen'>)</span>
488
+ <span class='ivar'>@root_dse</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>subschemaSubentry</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='ivar'>@schema</span><span class='period'>.</span><span class='id subschema_dn'>subschema_dn</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='ivar'>@schema</span>
489
+ <span class='ivar'>@root_dse</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>namingContexts</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:namingContexts</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:namingContexts</span><span class='rbracket'>]</span>
490
+ <span class='kw'>end</span></pre>
491
+ </td>
492
+ </tr>
493
+ </table>
494
+ </div>
495
+
496
+ </div>
497
+
498
+ <div id="instance_attr_details" class="attr_details">
499
+ <h2>Instance Attribute Details</h2>
500
+
501
+
502
+ <span id="root_dse=-instance_method"></span>
503
+ <span id="root_dse-instance_method"></span>
504
+ <div class="method_details first">
505
+ <p class="signature first" id="root_dse-instance_method">
506
+
507
+ - (<tt>Object</tt>) <strong>root_dse</strong>
508
+
509
+
510
+
511
+ </p><div class="docstring">
512
+ <div class="discussion">
513
+ <p>
514
+ Returns the value of attribute root_dse
515
+ </p>
516
+
517
+
518
+ </div>
519
+ </div>
520
+ <div class="tags">
521
+
522
+ </div><table class="source_code">
523
+ <tr>
524
+ <td>
525
+ <pre class="lines">
526
+
527
+
528
+ 8
529
+ 9
530
+ 10</pre>
531
+ </td>
532
+ <td>
533
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/server.rb', line 8</span>
534
+
535
+ <span class='kw'>def</span> <span class='id root_dse'>root_dse</span>
536
+ <span class='ivar'>@root_dse</span>
537
+ <span class='kw'>end</span></pre>
538
+ </td>
539
+ </tr>
540
+ </table>
541
+ </div>
542
+
543
+ </div>
544
+
545
+
546
+ <div id="class_method_details" class="method_details_list">
547
+ <h2>Class Method Details</h2>
548
+
549
+
550
+ <div class="method_details first">
551
+ <p class="signature first" id="preforkserver-class_method">
552
+
553
+ + (<tt>Object</tt>) <strong>preforkserver</strong>(opt, &amp;blk)
554
+
555
+
556
+
557
+ </p><div class="docstring">
558
+ <div class="discussion">
559
+ <p>
560
+ Accept connections on a port, and for each one run the given block in one
561
+ of N pre-forked children. Returns a Thread object for the listener.
562
+ </p>
563
+ <p>
564
+ Options:
565
+ </p>
566
+ <pre class="code">
567
+ :port=&gt;port number [required]
568
+ :bindaddr=&gt;&quot;IP address&quot;
569
+ :user=&gt;&quot;username&quot; - drop privileges after bind
570
+ :group=&gt;&quot;groupname&quot; - ditto
571
+ :logger=&gt;object - implements &lt;&lt; method
572
+ :listen=&gt;number - listen queue depth
573
+ :nodelay=&gt;true - set TCP_NODELAY option
574
+ :min_servers=&gt;N - prefork parameters
575
+ :max_servers=&gt;N
576
+ :max_requests_per_child=&gt;N
577
+ :max_idle=&gt;N - seconds</pre>
578
+
579
+
580
+ </div>
581
+ </div>
582
+ <div class="tags">
583
+
584
+ </div><table class="source_code">
585
+ <tr>
586
+ <td>
587
+ <pre class="lines">
588
+
589
+
590
+ 24
591
+ 25
592
+ 26
593
+ 27
594
+ 28
595
+ 29
596
+ 30
597
+ 31
598
+ 32
599
+ 33
600
+ 34
601
+ 35
602
+ 36
603
+ 37
604
+ 38
605
+ 39
606
+ 40
607
+ 41
608
+ 42
609
+ 43
610
+ 44
611
+ 45
612
+ 46
613
+ 47
614
+ 48
615
+ 49
616
+ 50
617
+ 51
618
+ 52
619
+ 53
620
+ 54
621
+ 55
622
+ 56
623
+ 57
624
+ 58
625
+ 59
626
+ 60
627
+ 61
628
+ 62
629
+ 63
630
+ 64
631
+ 65
632
+ 66
633
+ 67
634
+ 68
635
+ 69</pre>
636
+ </td>
637
+ <td>
638
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/preforkserver.rb', line 24</span>
639
+
640
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id preforkserver'>preforkserver</span><span class='lparen'>(</span><span class='id opt'>opt</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id blk'>blk</span><span class='rparen'>)</span>
641
+ <span class='id logger'>logger</span> <span class='op'>=</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:logger</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='gvar'>$stderr</span>
642
+ <span class='id server'>server</span> <span class='op'>=</span> <span class='const'>PreFork</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:bindaddr</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.0.0.0</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:port</span><span class='rbracket'>]</span><span class='rparen'>)</span>
643
+
644
+ <span class='comment'># Drop privileges if requested
645
+ </span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:group</span><span class='rbracket'>]</span> <span class='kw'>or</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:user</span><span class='rbracket'>]</span>
646
+ <span class='id require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>etc</span><span class='tstring_end'>'</span></span>
647
+ <span class='id gid'>gid</span> <span class='op'>=</span> <span class='const'>Etc</span><span class='period'>.</span><span class='id getgrnam'>getgrnam</span><span class='lparen'>(</span><span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:group</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id gid'>gid</span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:group</span><span class='rbracket'>]</span>
648
+ <span class='id uid'>uid</span> <span class='op'>=</span> <span class='const'>Etc</span><span class='period'>.</span><span class='id getpwnam'>getpwnam</span><span class='lparen'>(</span><span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:user</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id uid'>uid</span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:user</span><span class='rbracket'>]</span>
649
+ <span class='const'>File</span><span class='period'>.</span><span class='id chown'>chown</span><span class='lparen'>(</span><span class='id uid'>uid</span><span class='comma'>,</span> <span class='id gid'>gid</span><span class='comma'>,</span> <span class='id server'>server</span><span class='period'>.</span><span class='id instance_eval'>instance_eval</span> <span class='lbrace'>{</span><span class='ivar'>@lockf</span><span class='rbrace'>}</span><span class='rparen'>)</span>
650
+ <span class='const'>Process</span><span class='period'>.</span><span class='id gid'>gid</span> <span class='op'>=</span> <span class='const'>Process</span><span class='period'>.</span><span class='id egid'>egid</span> <span class='op'>=</span> <span class='id gid'>gid</span> <span class='kw'>if</span> <span class='id gid'>gid</span>
651
+ <span class='const'>Process</span><span class='period'>.</span><span class='id uid'>uid</span> <span class='op'>=</span> <span class='const'>Process</span><span class='period'>.</span><span class='id euid'>euid</span> <span class='op'>=</span> <span class='id uid'>uid</span> <span class='kw'>if</span> <span class='id uid'>uid</span>
652
+ <span class='kw'>end</span>
653
+
654
+ <span class='comment'># Typically the O/S will buffer response data for 100ms before sending.
655
+ </span> <span class='comment'># If the response is sent as a single write() then there's no need for it.
656
+ </span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:nodelay</span><span class='rbracket'>]</span>
657
+ <span class='kw'>begin</span>
658
+ <span class='id server'>server</span><span class='period'>.</span><span class='id sock'>sock</span><span class='period'>.</span><span class='id setsockopt'>setsockopt</span><span class='lparen'>(</span><span class='const'>Socket</span><span class='op'>::</span><span class='const'>IPPROTO_TCP</span><span class='comma'>,</span> <span class='const'>Socket</span><span class='op'>::</span><span class='const'>TCP_NODELAY</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span>
659
+ <span class='kw'>rescue</span> <span class='const'>Exception</span>
660
+ <span class='kw'>end</span>
661
+ <span class='kw'>end</span>
662
+ <span class='comment'># set queue size for incoming connections (default is 5)
663
+ </span> <span class='id server'>server</span><span class='period'>.</span><span class='id sock'>sock</span><span class='period'>.</span><span class='id listen'>listen</span><span class='lparen'>(</span><span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:listen</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:listen</span><span class='rbracket'>]</span>
664
+
665
+ <span class='comment'># Set prefork server parameters
666
+ </span> <span class='id server'>server</span><span class='period'>.</span><span class='id min_servers'>min_servers</span> <span class='op'>=</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:min_servers</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:min_servers</span><span class='rbracket'>]</span>
667
+ <span class='id server'>server</span><span class='period'>.</span><span class='id max_servers'>max_servers</span> <span class='op'>=</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:max_servers</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:max_servers</span><span class='rbracket'>]</span>
668
+ <span class='id server'>server</span><span class='period'>.</span><span class='id max_request_per_child'>max_request_per_child</span> <span class='op'>=</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:max_request_per_child</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:max_request_per_child</span><span class='rbracket'>]</span>
669
+ <span class='id server'>server</span><span class='period'>.</span><span class='id max_idle'>max_idle</span> <span class='op'>=</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:max_idle</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:max_idle</span><span class='rbracket'>]</span>
670
+
671
+ <span class='const'>Thread</span><span class='period'>.</span><span class='id new'>new</span> <span class='kw'>do</span>
672
+ <span class='id server'>server</span><span class='period'>.</span><span class='id start'>start</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id s'>s</span><span class='op'>|</span>
673
+ <span class='kw'>begin</span>
674
+ <span class='id s'>s</span><span class='period'>.</span><span class='id instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id blk'>blk</span><span class='rparen'>)</span>
675
+ <span class='kw'>rescue</span> <span class='const'>Interrupt</span>
676
+ <span class='comment'># This exception can be raised to shut the server down
677
+ </span> <span class='id server'>server</span><span class='period'>.</span><span class='id stop'>stop</span>
678
+ <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id e'>e</span>
679
+ <span class='id logger'>logger</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>[</span><span class='embexpr_beg'>#{</span><span class='id s'>s</span><span class='period'>.</span><span class='id peeraddr'>peeraddr</span><span class='lbracket'>[</span><span class='int'>3</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>]: </span><span class='embexpr_beg'>#{</span><span class='id e'>e</span><span class='rbrace'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id e'>e</span><span class='period'>.</span><span class='id backtrace'>backtrace</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span>
680
+ <span class='kw'>ensure</span>
681
+ <span class='id s'>s</span><span class='period'>.</span><span class='id close'>close</span>
682
+ <span class='kw'>end</span>
683
+ <span class='kw'>end</span>
684
+ <span class='kw'>end</span>
685
+ <span class='kw'>end</span></pre>
686
+ </td>
687
+ </tr>
688
+ </table>
689
+ </div>
690
+
691
+ <div class="method_details ">
692
+ <p class="signature " id="ssl_prepare-class_method">
693
+
694
+ + (<tt>Object</tt>) <strong>ssl_prepare</strong>(opt)
695
+
696
+
697
+
698
+ </p><div class="docstring">
699
+ <div class="discussion">
700
+ <p>
701
+ create opt[:ssl_ctx] from the other ssl options
702
+ </p>
703
+
704
+
705
+ </div>
706
+ </div>
707
+ <div class="tags">
708
+
709
+ </div><table class="source_code">
710
+ <tr>
711
+ <td>
712
+ <pre class="lines">
713
+
714
+
715
+ 45
716
+ 46
717
+ 47
718
+ 48
719
+ 49
720
+ 50
721
+ 51
722
+ 52
723
+ 53
724
+ 54
725
+ 55
726
+ 56
727
+ 57
728
+ 58
729
+ 59</pre>
730
+ </td>
731
+ <td>
732
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/server.rb', line 45</span>
733
+
734
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id ssl_prepare'>ssl_prepare</span><span class='lparen'>(</span><span class='id opt'>opt</span><span class='rparen'>)</span> <span class='comment'># :nodoc:
735
+ </span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:ssl_key_file</span><span class='rbracket'>]</span> <span class='kw'>and</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:ssl_cert_file</span><span class='rbracket'>]</span>
736
+ <span class='id ctx'>ctx</span> <span class='op'>=</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>SSL</span><span class='op'>::</span><span class='const'>SSLContext</span><span class='period'>.</span><span class='id new'>new</span>
737
+ <span class='id ctx'>ctx</span><span class='period'>.</span><span class='id key'>key</span> <span class='op'>=</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>PKey</span><span class='op'>::</span><span class='const'>RSA</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='const'>File</span><span class='op'>::</span><span class='id read'>read</span><span class='lparen'>(</span><span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:ssl_key_file</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
738
+ <span class='id ctx'>ctx</span><span class='period'>.</span><span class='id cert'>cert</span> <span class='op'>=</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>X509</span><span class='op'>::</span><span class='const'>Certificate</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='const'>File</span><span class='op'>::</span><span class='id read'>read</span><span class='lparen'>(</span><span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:ssl_cert_file</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
739
+ <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:ssl_ca_path</span><span class='rbracket'>]</span>
740
+ <span class='id ctx'>ctx</span><span class='period'>.</span><span class='id ca_path'>ca_path</span> <span class='op'>=</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:ssl_ca_path</span><span class='rbracket'>]</span>
741
+ <span class='id ctx'>ctx</span><span class='period'>.</span><span class='id verify_mode'>verify_mode</span> <span class='op'>=</span>
742
+ <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>SSL</span><span class='op'>::</span><span class='const'>VERIFY_PEER</span><span class='op'>|</span><span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>SSL</span><span class='op'>::</span><span class='const'>VERIFY_FAIL_IF_NO_PEER_CERT</span>
743
+ <span class='kw'>else</span>
744
+ <span class='gvar'>$stderr</span><span class='period'>.</span><span class='id puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Warning: SSL peer certificate won't be verified</span><span class='tstring_end'>&quot;</span></span>
745
+ <span class='kw'>end</span>
746
+ <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:ssl_ctx</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id ctx'>ctx</span>
747
+ <span class='kw'>end</span>
748
+ <span class='kw'>end</span></pre>
749
+ </td>
750
+ </tr>
751
+ </table>
752
+ </div>
753
+
754
+ <div class="method_details ">
755
+ <p class="signature " id="tcpserver-class_method">
756
+
757
+ + (<tt>Object</tt>) <strong>tcpserver</strong>(opt, &amp;blk)
758
+
759
+
760
+
761
+ </p><div class="docstring">
762
+ <div class="discussion">
763
+ <p>
764
+ Accept connections on a port, and for each one start a new thread and run
765
+ the given block. Returns the Thread object for the listener.
766
+ </p>
767
+ <p>
768
+ FIXME:
769
+ </p>
770
+ <ul>
771
+ <li><p>
772
+ have a limit on total number of concurrent connects
773
+ </p>
774
+ </li>
775
+ <li><p>
776
+ have a limit on connections from a single IP, or from a /24 (to avoid the
777
+ trivial DoS that the first limit creates)
778
+ </p>
779
+ </li>
780
+ <li><p>
781
+ ACL using source IP address (or perhaps that belongs in application)
782
+ </p>
783
+ </li>
784
+ </ul>
785
+ <p>
786
+ Options:
787
+ </p>
788
+ <pre class="code">
789
+ :port=&gt;port number [required]
790
+ :bindaddr=&gt;&quot;IP address&quot;
791
+ :user=&gt;&quot;username&quot; - drop privileges after bind
792
+ :group=&gt;&quot;groupname&quot; - ditto
793
+ :logger=&gt;object - implements &lt;&lt; method
794
+ :listen=&gt;number - listen queue depth
795
+ :nodelay=&gt;true - set TCP_NODELAY option</pre>
796
+
797
+
798
+ </div>
799
+ </div>
800
+ <div class="tags">
801
+
802
+ </div><table class="source_code">
803
+ <tr>
804
+ <td>
805
+ <pre class="lines">
806
+
807
+
808
+ 24
809
+ 25
810
+ 26
811
+ 27
812
+ 28
813
+ 29
814
+ 30
815
+ 31
816
+ 32
817
+ 33
818
+ 34
819
+ 35
820
+ 36
821
+ 37
822
+ 38
823
+ 39
824
+ 40
825
+ 41
826
+ 42
827
+ 43
828
+ 44
829
+ 45
830
+ 46
831
+ 47
832
+ 48
833
+ 49
834
+ 50
835
+ 51
836
+ 52
837
+ 53
838
+ 54
839
+ 55
840
+ 56
841
+ 57
842
+ 58
843
+ 59
844
+ 60
845
+ 61
846
+ 62
847
+ 63
848
+ 64
849
+ 65
850
+ 66
851
+ 67</pre>
852
+ </td>
853
+ <td>
854
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/tcpserver.rb', line 24</span>
855
+
856
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id tcpserver'>tcpserver</span><span class='lparen'>(</span><span class='id opt'>opt</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id blk'>blk</span><span class='rparen'>)</span>
857
+ <span class='id logger'>logger</span> <span class='op'>=</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:logger</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='gvar'>$stderr</span>
858
+ <span class='id server'>server</span> <span class='op'>=</span> <span class='const'>TCPServer</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:bindaddr</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.0.0.0</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:port</span><span class='rbracket'>]</span><span class='rparen'>)</span>
859
+
860
+ <span class='comment'># Drop privileges if requested
861
+ </span> <span class='id require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>etc</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:group</span><span class='rbracket'>]</span> <span class='kw'>or</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:user</span><span class='rbracket'>]</span>
862
+ <span class='const'>Process</span><span class='period'>.</span><span class='id gid'>gid</span> <span class='op'>=</span> <span class='const'>Process</span><span class='period'>.</span><span class='id egid'>egid</span> <span class='op'>=</span> <span class='const'>Etc</span><span class='period'>.</span><span class='id getgrnam'>getgrnam</span><span class='lparen'>(</span><span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:group</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id gid'>gid</span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:group</span><span class='rbracket'>]</span>
863
+ <span class='const'>Process</span><span class='period'>.</span><span class='id uid'>uid</span> <span class='op'>=</span> <span class='const'>Process</span><span class='period'>.</span><span class='id euid'>euid</span> <span class='op'>=</span> <span class='const'>Etc</span><span class='period'>.</span><span class='id getpwnam'>getpwnam</span><span class='lparen'>(</span><span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:user</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='period'>.</span><span class='id uid'>uid</span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:user</span><span class='rbracket'>]</span>
864
+
865
+ <span class='comment'># Typically the O/S will buffer response data for 100ms before sending.
866
+ </span> <span class='comment'># If the response is sent as a single write() then there's no need for it.
867
+ </span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:nodelay</span><span class='rbracket'>]</span>
868
+ <span class='kw'>begin</span>
869
+ <span class='id server'>server</span><span class='period'>.</span><span class='id setsockopt'>setsockopt</span><span class='lparen'>(</span><span class='const'>Socket</span><span class='op'>::</span><span class='const'>IPPROTO_TCP</span><span class='comma'>,</span> <span class='const'>Socket</span><span class='op'>::</span><span class='const'>TCP_NODELAY</span><span class='comma'>,</span> <span class='int'>1</span><span class='rparen'>)</span>
870
+ <span class='kw'>rescue</span> <span class='const'>Exception</span>
871
+ <span class='kw'>end</span>
872
+ <span class='kw'>end</span>
873
+ <span class='comment'># set queue size for incoming connections (default is 5)
874
+ </span> <span class='id server'>server</span><span class='period'>.</span><span class='id listen'>listen</span><span class='lparen'>(</span><span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:listen</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id opt'>opt</span><span class='lbracket'>[</span><span class='symbol'>:listen</span><span class='rbracket'>]</span>
875
+
876
+ <span class='const'>Thread</span><span class='period'>.</span><span class='id new'>new</span> <span class='kw'>do</span>
877
+ <span class='kw'>while</span> <span class='kw'>true</span>
878
+ <span class='kw'>begin</span>
879
+ <span class='id session'>session</span> <span class='op'>=</span> <span class='id server'>server</span><span class='period'>.</span><span class='id accept'>accept</span>
880
+ <span class='comment'># subtlety: copy 'session' into a block-local variable because
881
+ </span> <span class='comment'># it will change when the next session is accepted
882
+ </span> <span class='const'>Thread</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id session'>session</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id s'>s</span><span class='op'>|</span>
883
+ <span class='kw'>begin</span>
884
+ <span class='id s'>s</span><span class='period'>.</span><span class='id instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id blk'>blk</span><span class='rparen'>)</span>
885
+ <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id e'>e</span>
886
+ <span class='id logger'>logger</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>[</span><span class='embexpr_beg'>#{</span><span class='id s'>s</span><span class='period'>.</span><span class='id peeraddr'>peeraddr</span><span class='lbracket'>[</span><span class='int'>3</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>]: </span><span class='embexpr_beg'>#{</span><span class='id e'>e</span><span class='rbrace'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='id e'>e</span><span class='period'>.</span><span class='id backtrace'>backtrace</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span>
887
+ <span class='comment'>#logger &lt;&lt; &quot;[#{s.peeraddr[3]}]: #{e}: #{e.backtrace.join(&quot;\n\tfrom &quot;)}\n&quot;
888
+ </span> <span class='kw'>ensure</span>
889
+ <span class='id s'>s</span><span class='period'>.</span><span class='id close'>close</span>
890
+ <span class='kw'>end</span>
891
+ <span class='kw'>end</span>
892
+ <span class='kw'>rescue</span> <span class='const'>Interrupt</span>
893
+ <span class='comment'># This exception can be raised to shut the server down
894
+ </span> <span class='id server'>server</span><span class='period'>.</span><span class='id close'>close</span> <span class='kw'>if</span> <span class='id server'>server</span> <span class='kw'>and</span> <span class='kw'>not</span> <span class='id server'>server</span><span class='period'>.</span><span class='id closed?'>closed?</span>
895
+ <span class='kw'>break</span>
896
+ <span class='kw'>end</span>
897
+ <span class='kw'>end</span>
898
+ <span class='kw'>end</span>
899
+ <span class='kw'>end</span></pre>
900
+ </td>
901
+ </tr>
902
+ </table>
903
+ </div>
904
+
905
+ </div>
906
+
907
+ <div id="instance_method_details" class="method_details_list">
908
+ <h2>Instance Method Details</h2>
909
+
910
+
911
+ <div class="method_details first">
912
+ <p class="signature first" id="join-instance_method">
913
+
914
+ - (<tt>Object</tt>) <strong>join</strong>
915
+
916
+
917
+
918
+ </p><table class="source_code">
919
+ <tr>
920
+ <td>
921
+ <pre class="lines">
922
+
923
+
924
+ 79
925
+ 80
926
+ 81</pre>
927
+ </td>
928
+ <td>
929
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/server.rb', line 79</span>
930
+
931
+ <span class='kw'>def</span> <span class='id join'>join</span>
932
+ <span class='ivar'>@thread</span><span class='period'>.</span><span class='id join'>join</span>
933
+ <span class='kw'>end</span></pre>
934
+ </td>
935
+ </tr>
936
+ </table>
937
+ </div>
938
+
939
+ <div class="method_details ">
940
+ <p class="signature " id="run_prefork-instance_method">
941
+
942
+ - (<tt>Object</tt>) <strong>run_prefork</strong>
943
+
944
+
945
+
946
+ </p><table class="source_code">
947
+ <tr>
948
+ <td>
949
+ <pre class="lines">
950
+
951
+
952
+ 70
953
+ 71
954
+ 72
955
+ 73
956
+ 74
957
+ 75
958
+ 76
959
+ 77</pre>
960
+ </td>
961
+ <td>
962
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/server.rb', line 70</span>
963
+
964
+ <span class='kw'>def</span> <span class='id run_prefork'>run_prefork</span>
965
+ <span class='id require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ldap/server/preforkserver</span><span class='tstring_end'>'</span></span>
966
+
967
+ <span class='id opt'>opt</span> <span class='op'>=</span> <span class='ivar'>@opt</span>
968
+ <span class='ivar'>@thread</span> <span class='op'>=</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='period'>.</span><span class='id preforkserver'>preforkserver</span><span class='lparen'>(</span><span class='ivar'>@opt</span><span class='rparen'>)</span> <span class='kw'>do</span>
969
+ <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='op'>::</span><span class='const'>Connection</span><span class='op'>::</span><span class='id new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span><span class='id opt'>opt</span><span class='rparen'>)</span><span class='period'>.</span><span class='id handle_requests'>handle_requests</span>
970
+ <span class='kw'>end</span>
971
+ <span class='kw'>end</span></pre>
972
+ </td>
973
+ </tr>
974
+ </table>
975
+ </div>
976
+
977
+ <div class="method_details ">
978
+ <p class="signature " id="run_tcpserver-instance_method">
979
+
980
+ - (<tt>Object</tt>) <strong>run_tcpserver</strong>
981
+
982
+
983
+
984
+ </p><table class="source_code">
985
+ <tr>
986
+ <td>
987
+ <pre class="lines">
988
+
989
+
990
+ 61
991
+ 62
992
+ 63
993
+ 64
994
+ 65
995
+ 66
996
+ 67
997
+ 68</pre>
998
+ </td>
999
+ <td>
1000
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/server.rb', line 61</span>
1001
+
1002
+ <span class='kw'>def</span> <span class='id run_tcpserver'>run_tcpserver</span>
1003
+ <span class='id require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>ldap/server/tcpserver</span><span class='tstring_end'>'</span></span>
1004
+
1005
+ <span class='id opt'>opt</span> <span class='op'>=</span> <span class='ivar'>@opt</span>
1006
+ <span class='ivar'>@thread</span> <span class='op'>=</span> <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='period'>.</span><span class='id tcpserver'>tcpserver</span><span class='lparen'>(</span><span class='ivar'>@opt</span><span class='rparen'>)</span> <span class='kw'>do</span>
1007
+ <span class='const'>LDAP</span><span class='op'>::</span><span class='const'>Server</span><span class='op'>::</span><span class='const'>Connection</span><span class='op'>::</span><span class='id new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span><span class='id opt'>opt</span><span class='rparen'>)</span><span class='period'>.</span><span class='id handle_requests'>handle_requests</span>
1008
+ <span class='kw'>end</span>
1009
+ <span class='kw'>end</span></pre>
1010
+ </td>
1011
+ </tr>
1012
+ </table>
1013
+ </div>
1014
+
1015
+ <div class="method_details ">
1016
+ <p class="signature " id="stop-instance_method">
1017
+
1018
+ - (<tt>Object</tt>) <strong>stop</strong>
1019
+
1020
+
1021
+
1022
+ </p><table class="source_code">
1023
+ <tr>
1024
+ <td>
1025
+ <pre class="lines">
1026
+
1027
+
1028
+ 83
1029
+ 84
1030
+ 85
1031
+ 86</pre>
1032
+ </td>
1033
+ <td>
1034
+ <pre class="code"><span class="info file"># File 'lib/ldap/server/server.rb', line 83</span>
1035
+
1036
+ <span class='kw'>def</span> <span class='id stop'>stop</span>
1037
+ <span class='ivar'>@thread</span><span class='period'>.</span><span class='id raise'>raise</span> <span class='const'>Interrupt</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span> <span class='comment'># &lt;= temporary fix for 1.8.6
1038
+ </span> <span class='ivar'>@thread</span><span class='period'>.</span><span class='id join'>join</span>
1039
+ <span class='kw'>end</span></pre>
1040
+ </td>
1041
+ </tr>
1042
+ </table>
1043
+ </div>
1044
+
1045
+ </div>
1046
+
1047
+ </div>
1048
+
1049
+ <div id="footer">
1050
+ Generated on Mon Sep 13 13:27:15 2010 by
1051
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1052
+ 0.6.0 (ruby-1.9.2).
1053
+ </div>
1054
+
1055
+ </body>
1056
+ </html>