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

Buffer changes on new ldap.Change #409

Closed
Nevermore696 opened this issue Dec 27, 2016 · 3 comments
Closed

Buffer changes on new ldap.Change #409

Nevermore696 opened this issue Dec 27, 2016 · 3 comments

Comments

@Nevermore696
Copy link

Nevermore696 commented Dec 27, 2016

I'm trying to update thumbnailPhoto on user account, but in ldap.Change this buffer changes to another:

Here is the code:

console.log(modify);
                var change_tmp = new ldap.Change({
                    operation: 'replace',
                    modification: modify
                });
                change_arr.push(change_tmp);
                console.log(change_tmp);
        }

And here is the console lines:

{ thumbnailPhoto: <Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 cc 00 00 00 cc 08 03 00 00 00 08 fc bc c0 00 00 01 29 50 4c 54 45 ff ff ff f6 86 34 a7 52 14 ... > }
Change {
  _modification: 
   Attribute {
     type: 'thumbnailPhoto',
     _vals: [ <Buffer ef bf bd 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 ef bf bd 00 00 00 ef bf bd 08 03 00 00 00 08 ef bf bd ef bf bd ef bf bd 00 00 01 29 50 ... > ],
     vals: [Getter/Setter],
     buffers: [Getter],
     json: [Getter] },
  operation: [Getter/Setter],
  modification: [Getter/Setter],
  json: [Getter],
  _operation: 2 }

Why my buffer have changed during the ldap.Change function?
I understand that 89 = ef bf bd and this is the "REPLACEMENT CHARACTER", but cc also was changed to ef df bd...
How can I put pure untouched buffer to ldap? Because my buffer is correct - I have compared it with powershell results.

@Nevermore696
Copy link
Author

Ok, found it. Thats because you change all values to string.

keys.forEach(function (k) {
var _attr = new Attribute({type: k});
if (Array.isArray(attr[k])) {
attr[k].forEach(function (v) {
_attr.addValue(v.toString());
});
} else {
_attr.addValue(attr[k].toString());
}
self._modification = _attr;
});

Can we change this behaviour in case of binary object?

@jsumners
Copy link
Member

Potentially resolved by #383. If not, feel free to re-open.

@jsumners
Copy link
Member

⚠️ This issue has been locked due to age. If you have encountered a recent
problem that seems to be covered by this issue, please open a new issue.

Please include a minimal reproducible example
when opening a new issue.

@ldapjs ldapjs locked as resolved and limited conversation to collaborators Mar 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants