@@ -403,7 +403,7 @@ the following code in as another handler (you'll need a
403
403
if (!req.dn.rdns[0].attrs.cn)
404
404
return next(new ldap.ConstraintViolationError('cn required'));
405
405
406
- if (req.users[req.dn.rdns[0].attrs.cn])
406
+ if (req.users[req.dn.rdns[0].attrs.cn.value ])
407
407
return next(new ldap.EntryAlreadyExistsError(req.dn.toString()));
408
408
409
409
var entry = req.toObject().attributes;
@@ -490,7 +490,7 @@ As before, here's a breakdown of the code:
490
490
if (!req.dn.rdns[0].attrs.cn)
491
491
return next(new ldap.ConstraintViolationError('cn required'));
492
492
493
- if (req.users[req.dn.rdns[0].attrs.cn])
493
+ if (req.users[req.dn.rdns[0].attrs.cn.value ])
494
494
return next(new ldap.EntryAlreadyExistsError(req.dn.toString()));
495
495
496
496
var entry = req.toObject().attributes;
@@ -532,13 +532,13 @@ RFC, so appending, removing, or replacing a single attribute is pretty natural.
532
532
Go ahead and add the following code into your source file:
533
533
534
534
server.modify('ou=users, o=myhost', pre, function(req, res, next) {
535
- if (!req.dn.rdns[0].attrs.cn || !req.users[req.dn.rdns[0].attrs.cn])
535
+ if (!req.dn.rdns[0].attrs.cn || !req.users[req.dn.rdns[0].attrs.cn.value ])
536
536
return next(new ldap.NoSuchObjectError(req.dn.toString()));
537
537
538
538
if (!req.changes.length)
539
539
return next(new ldap.ProtocolError('changes required'));
540
540
541
- var user = req.users[req.dn.rdns[0].attrs.cn].attributes;
541
+ var user = req.users[req.dn.rdns[0].attrs.cn.value ].attributes;
542
542
var mod;
543
543
544
544
for (var i = 0; i < req.changes.length; i++) {
@@ -594,10 +594,10 @@ Delete is pretty straightforward. The client gives you a dn to delete, and you
594
594
delete it :). Add the following code into your server:
595
595
596
596
server.del('ou=users, o=myhost', pre, function(req, res, next) {
597
- if (!req.dn.rdns[0].attrs.cn || !req.users[req.dn.rdns[0].attrs.cn])
597
+ if (!req.dn.rdns[0].attrs.cn || !req.users[req.dn.rdns[0].attrs.cn.value ])
598
598
return next(new ldap.NoSuchObjectError(req.dn.toString()));
599
599
600
- var userdel = spawn('userdel', ['-f', req.dn.rdns[0].cn ]);
600
+ var userdel = spawn('userdel', ['-f', req.dn.rdns[0].attrs.cn.value ]);
601
601
602
602
var messages = [];
603
603
userdel.stdout.on('data', function(data) {
0 commit comments