mcavage/node-ldapjs — Issue #31: `client.modify` with a "replace" operation doesn't replace all given fields
Author: trentm
Created: 2011-11-06 22:17:31+00:00
State: open

Starting with "data: data1" and "medium: sms1" fields, I attempted to do one "replace" modify to change both to "data2" and "sms2" respectively. Only one of the fields was changed:

```
$ sdc-ldap search -b 'amoncontactname=trent, uuid=7b23ae63-37c9-420e-bb88-8d4bf5e30455, ou=customers, o=smartdc'
dn: amoncontactname=trent, uuid=7b23ae63-37c9-420e-bb88-8d4bf5e30455, ou=customers, o=smartdc
amoncontactname: trent
data: data1
medium: sms1
objectclass: amoncontact

$ node modcontact.js

$ sdc-ldap search -b 'amoncontactname=trent, uuid=7b23ae63-37c9-420e-bb88-8d4bf5e30455, ou=customers, o=smartdc'
dn: amoncontactname=trent, uuid=7b23ae63-37c9-420e-bb88-8d4bf5e30455, ou=customers, o=smartdc
amoncontactname: trent
data: data1
medium: sms2
objectclass: amoncontact
```

where the content of "modcontact.js" is:

```
var ldap = require('ldapjs');
var Change = ldap.Change;

var client = ldap.createClient({
url: 'ldaps://10.88.88.50:636'
});

client.bind('cn=root', 'secret', function(err) {
name = 'trent'
var entry = {
//amoncontactname: name,
data: "data2",
medium: "sms2"
//objectclass: "amoncontact"
};
var change = new Change({
operation: 'replace',
modification: entry
});
var dn = "amoncontactname="+name+", uuid=7b23ae63-37c9-420e-bb88-8d4bf5e30455, ou=customers, o=smartdc"
client.modify(dn, change, function(err) {
if (err) console.warn("client.modify err: %s", err)
client.unbind(function(err) {});
});
});
```