Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 57cd921

Browse files
authored
Merge branch 'master' into build-docs
2 parents 3681594 + da2f977 commit 57cd921

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/guide.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,10 @@ the following code in as another handler (you'll need a
403403
`var spawn = require('child_process').spawn;` at the top of your file):
404404

405405
server.add('ou=users, o=myhost', pre, function(req, res, next) {
406-
if (!req.dn.rdns[0].cn)
406+
if (!req.dn.rdns[0].attrs.cn)
407407
return next(new ldap.ConstraintViolationError('cn required'));
408408

409-
if (req.users[req.dn.rdns[0].cn])
409+
if (req.users[req.dn.rdns[0].attrs.cn.value])
410410
return next(new ldap.EntryAlreadyExistsError(req.dn.toString()));
411411

412412
var entry = req.toObject().attributes;
@@ -490,10 +490,10 @@ Let's confirm he got added with an ldapsearch:
490490
As before, here's a breakdown of the code:
491491

492492
server.add('ou=users, o=myhost', pre, function(req, res, next) {
493-
if (!req.dn.rdns[0].cn)
493+
if (!req.dn.rdns[0].attrs.cn)
494494
return next(new ldap.ConstraintViolationError('cn required'));
495495

496-
if (req.users[req.dn.rdns[0].cn])
496+
if (req.users[req.dn.rdns[0].attrs.cn.value])
497497
return next(new ldap.EntryAlreadyExistsError(req.dn.toString()));
498498

499499
var entry = req.toObject().attributes;
@@ -535,13 +535,13 @@ RFC, so appending, removing, or replacing a single attribute is pretty natural.
535535
Go ahead and add the following code into your source file:
536536

537537
server.modify('ou=users, o=myhost', pre, function(req, res, next) {
538-
if (!req.dn.rdns[0].cn || !req.users[req.dn.rdns[0].cn])
538+
if (!req.dn.rdns[0].attrs.cn || !req.users[req.dn.rdns[0].attrs.cn.value])
539539
return next(new ldap.NoSuchObjectError(req.dn.toString()));
540540

541541
if (!req.changes.length)
542542
return next(new ldap.ProtocolError('changes required'));
543543

544-
var user = req.users[req.dn.rdns[0].cn].attributes;
544+
var user = req.users[req.dn.rdns[0].attrs.cn.value].attributes;
545545
var mod;
546546

547547
for (var i = 0; i < req.changes.length; i++) {
@@ -597,10 +597,10 @@ Delete is pretty straightforward. The client gives you a dn to delete, and you
597597
delete it :). Add the following code into your server:
598598

599599
server.del('ou=users, o=myhost', pre, function(req, res, next) {
600-
if (!req.dn.rdns[0].cn || !req.users[req.dn.rdns[0].cn])
600+
if (!req.dn.rdns[0].attrs.cn || !req.users[req.dn.rdns[0].attrs.cn.value])
601601
return next(new ldap.NoSuchObjectError(req.dn.toString()));
602602

603-
var userdel = spawn('userdel', ['-f', req.dn.rdns[0].cn]);
603+
var userdel = spawn('userdel', ['-f', req.dn.rdns[0].attrs.cn.value]);
604604

605605
var messages = [];
606606
userdel.stdout.on('data', function(data) {

0 commit comments

Comments
 (0)