Skip to content

Commit f005144

Browse files
author
ldapjs
committed
1 parent 6799d01 commit f005144

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

examples.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ <h1 id="address-book">Address Book</h1>
585585
});
586586
</code></pre>
587587
<p>To test out this example, try:</p>
588-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:389 -x -D cn=demo,dc=example,dc=com \
588+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:389 -x -D cn=demo,dc=example,dc=com \
589589
-w demo -b <span class="hljs-string">&quot;dc=example,dc=com&quot;</span> objectclass=*</span>
590590
</code></pre>
591591
<h1 id="multi-threaded-server">Multi-threaded Server</h1>

guide.html

+12-12
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ <h2 id="install">Install</h2>
180180
<p>If you don&#39;t already have node.js and npm, clearly you need those, so follow
181181
the steps at <a href="http://nodejs.org">nodejs.org</a> and <a href="http://npmjs.org">npmjs.org</a>,
182182
respectively. After that, run:</p>
183-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">npm install ldapjs</span>
183+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">npm install ldapjs</span>
184184
</code></pre>
185185
<p>Rather than overload you with client-side programming for now, we&#39;ll use
186186
the OpenLDAP CLI to interact with our server. It&#39;s almost certainly already
@@ -198,7 +198,7 @@ <h2 id="install">Install</h2>
198198
</code></pre>
199199
<p>And run that. Doing anything will give you errors (LDAP &quot;No Such Object&quot;)
200200
since we haven&#39;t added any support in yet, but go ahead and try it anyway:</p>
201-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -b <span class="hljs-string">&quot;o=myhost&quot;</span> objectclass=*</span>
201+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -b <span class="hljs-string">&quot;o=myhost&quot;</span> objectclass=*</span>
202202
</code></pre>
203203
<p>Before we go any further, note that the complete code for the server we are
204204
about to build up is on the <a href="examples.html">examples</a> page.</p>
@@ -249,14 +249,14 @@ <h2 id="bind">Bind</h2>
249249
have one handler in the chain, but it&#39;s good habit to always do that, so if you
250250
add another handler in later you won&#39;t get bit by it not being invoked.</p>
251251
<p>Blah blah, let&#39;s try running the ldap client again, first with a bad password:</p>
252-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -D cn=root -w foo -b <span class="hljs-string">&quot;o=myhost&quot;</span> objectclass=*</span>
252+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -D cn=root -w foo -b <span class="hljs-string">&quot;o=myhost&quot;</span> objectclass=*</span>
253253

254254
ldap_bind: Invalid credentials (49)
255255
matched DN: cn=root
256256
additional info: Invalid Credentials
257257
</code></pre>
258258
<p>And again with the correct one:</p>
259-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -D cn=root -w secret -LLL -b <span class="hljs-string">&quot;o=myhost&quot;</span> objectclass=*</span>
259+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -D cn=root -w secret -LLL -b <span class="hljs-string">&quot;o=myhost&quot;</span> objectclass=*</span>
260260

261261
No such object (32)
262262
Additional information: No tree found for: o=myhost
@@ -378,7 +378,7 @@ <h2 id="search">Search</h2>
378378
});
379379
</code></pre>
380380
<p>And try running:</p>
381-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -D cn=root -w secret -LLL -b <span class="hljs-string">&quot;o=myhost&quot;</span> cn=root</span>
381+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -D cn=root -w secret -LLL -b <span class="hljs-string">&quot;o=myhost&quot;</span> cn=root</span>
382382
dn: cn=root, ou=users, o=myhost
383383
cn: root
384384
uid: 0
@@ -389,14 +389,14 @@ <h2 id="search">Search</h2>
389389
objectclass: unixUser
390390
</code></pre>
391391
<p>Sweet! Try this out too:</p>
392-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -D cn=root -w secret -LLL -b <span class="hljs-string">&quot;o=myhost&quot;</span> objectclass=*</span>
392+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -D cn=root -w secret -LLL -b <span class="hljs-string">&quot;o=myhost&quot;</span> objectclass=*</span>
393393
...
394394
</code></pre>
395395
<p>You should have seen an entry for every record in /etc/passwd with the second.
396396
What all did we do here? A lot. Let&#39;s break this down...</p>
397397
<h3 id="what-did-i-just-do-on-the-command-line">What did I just do on the command line?</h3>
398398
<p>Let&#39;s start with looking at what you even asked for:</p>
399-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -D cn=root -w secret -LLL -b <span class="hljs-string">&quot;o=myhost&quot;</span> cn=root</span>
399+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -D cn=root -w secret -LLL -b <span class="hljs-string">&quot;o=myhost&quot;</span> cn=root</span>
400400
</code></pre>
401401
<p>We can throw away <code>ldapsearch -H -x -D -w -LLL</code>, as those just specify the URL
402402
to connect to, the bind credentials and the <code>-LLL</code> just quiets down OpenLDAP.
@@ -447,7 +447,7 @@ <h3 id="the-code">The code</h3>
447447
shell set to <code>/bin/false</code> and whose name starts with <code>p</code> (I&#39;m doing this
448448
on Ubuntu). Then, let&#39;s say we only care about their login name and primary
449449
group id. We&#39;d do this:</p>
450-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -D cn=root -w secret -LLL -b <span class="hljs-string">&quot;o=myhost&quot;</span> <span class="hljs-string">&quot;(&amp;(shell=/bin/false)(cn=p*))&quot;</span> cn gid</span>
450+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -D cn=root -w secret -LLL -b <span class="hljs-string">&quot;o=myhost&quot;</span> <span class="hljs-string">&quot;(&amp;(shell=/bin/false)(cn=p*))&quot;</span> cn gid</span>
451451
dn: cn=proxy, ou=users, o=myhost
452452
cn: proxy
453453
gid: 13
@@ -529,11 +529,11 @@ <h2 id="add">Add</h2>
529529
description: Created via ldapadd
530530
</code></pre>
531531
<p>Now go ahead and invoke with:</p>
532-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">ldapadd -H ldap://localhost:1389 -x -D cn=root -w secret -f ./user.ldif</span>
532+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapadd -H ldap://localhost:1389 -x -D cn=root -w secret -f ./user.ldif</span>
533533
adding new entry &quot;cn=ldapjs, ou=users, o=myhost&quot;
534534
</code></pre>
535535
<p>Let&#39;s confirm he got added with an ldapsearch:</p>
536-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -LLL -x -D cn=root -w secret -b <span class="hljs-string">&quot;ou=users, o=myhost&quot;</span> cn=ldapjs</span>
536+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -LLL -x -D cn=root -w secret -b <span class="hljs-string">&quot;ou=users, o=myhost&quot;</span> cn=ldapjs</span>
537537
dn: cn=ldapjs, ou=users, o=myhost
538538
cn: ldapjs
539539
uid: 1001
@@ -637,7 +637,7 @@ <h2 id="modify">Modify</h2>
637637
-
638638
</code></pre>
639639
<p>And then run the OpenLDAP CLI:</p>
640-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">ldapmodify -H ldap://localhost:1389 -x -D cn=root -w secret -f ./passwd.ldif</span>
640+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapmodify -H ldap://localhost:1389 -x -D cn=root -w secret -f ./passwd.ldif</span>
641641
</code></pre>
642642
<p>You should now be able to login to your box as the ldapjs user. Let&#39;s get
643643
the last &quot;mainline&quot; piece of work out of the way, and delete the user.</p>
@@ -672,7 +672,7 @@ <h2 id="delete">Delete</h2>
672672
});
673673
</code></pre>
674674
<p>And then run the following command:</p>
675-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">ldapdelete -H ldap://localhost:1389 -x -D cn=root -w secret <span class="hljs-string">&quot;cn=ldapjs, ou=users, o=myhost&quot;</span></span>
675+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapdelete -H ldap://localhost:1389 -x -D cn=root -w secret <span class="hljs-string">&quot;cn=ldapjs, ou=users, o=myhost&quot;</span></span>
676676
</code></pre>
677677
<h1 id="where-to-go-from-here">Where to go from here</h1>
678678
<p>The complete source code for this example server is available in

index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ <h1 id="overview">Overview</h1>
9191
});
9292
</code></pre>
9393
<p>Try hitting that with:</p>
94-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -b o=example objectclass=*</span>
94+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -b o=example objectclass=*</span>
9595
</code></pre>
9696
<h1 id="features">Features</h1>
9797
<p>ldapjs implements most of the common operations in the LDAP v3 RFC(s), for
@@ -101,7 +101,7 @@ <h1 id="features">Features</h1>
101101
&quot;intercepting filter&quot; pattern for implementing server(s). It is intended
102102
that you can build LDAP over anything you want, not just traditional databases.</p>
103103
<h1 id="getting-started">Getting started</h1>
104-
<pre><code class="language-shell"><span class="hljs-meta">$ </span><span class="language-bash">npm install ldapjs</span>
104+
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">npm install ldapjs</span>
105105
</code></pre>
106106
<p>If you&#39;re new to LDAP, check out the <a href="guide.html">guide</a>. Otherwise, the
107107
API documentation is:</p>

0 commit comments

Comments
 (0)