question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Search & Modify with Buffer object

See original GitHub issue

Hi, Superb library!

Is it possible to add a ignore parsing array option on client.modify and client.search to receive the raw buffer instead of the parsed response, ( in SearchEntry.js ) as it converts everything to a string.

{ scope: 'sub', filter: '(&(sAMAccountName=someAccount))', attributes: ['thumbnailPhoto', 'dn', 'name', 'something...'], noparsing: ['thumbnailPhoto'], }

essentially im trying to get the thumbnailPhoto which is usually a binary photo and then save the photo to file, but as it is already converted to string, some characters gets mangled by the encoding and Im unable to get the correct output.

ldapjs lib has the same issue where object.entries are strings but since it pushes the full object back, the data was still accessable at object.attributes[0].buffers[0];

Buffer.from(object.attributes[0].buffers[0], 'hex').toString('binary');

not totally sure how to send a “modify” replace in binary form, clues?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
lennarkivistikcommented, May 17, 2019

hmm, it works for me.

so for example doing a search like this with ldapts towards your Active Directory server will give me a list of all objectGUIDs for users

        const entries = await this.client.search(LDAP_USERS_OU, {
          scope: 'sub',
          filter: LDAP_TREE_FILTER,
          attributes: [
            'objectGUID;binary'
          ],
          sizeLimit: 500,
          paged: true
        });

Then converting it to which ever format I want afterwords like this:

Buffer.from(user['objectGUID;binary'], 'binary').toString('hex')

So if you want to only see the exact name as in your example of objectGUID you could do something like this:

entries.forEach(user => {
   user['objectGUID'] = Buffer.from(user['objectGUID;binary'], 'binary').toString('hex');
  delete(user['objectGUID;binary']);
});

In this instance the hex matches exactly the hex in Active Directory on all users if you go to the user properties --> attribute editor --> find objectGUID --> look at the hex code.

meaning it is indeed the binary response in the original response.

1reaction
jgeurtscommented, Oct 14, 2019

I can take a look at what ldapjs is doing with the raw property, but I won’t be able to test very well it as I don’t have a reproducible ldap server for this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Properly update vertex buffer objects [duplicate] - Stack Overflow
After that my opengl window class creates a unique vertex buffer object for the new mesh and stores it's index in the mesh_ptr.vbo_index...
Read more >
Buffer Object - OpenGL Wiki
Buffer Objects are OpenGL Objects that store an array of unformatted ... will access and modify the contents of the buffer object's storage....
Read more >
Using Buffers in Node.js - DigitalOcean
There are many ways we can modify an existing buffer object. Similar to reading, we can modify buffer bytes individually using the array...
Read more >
Buffers object - IBM
A buffers object is a collection of individual buffer objects. ... Returns the position of the search element or -1 if the element...
Read more >
Create, Update and Delete Records Using Dynamic Buffers
Because the buffer handle is associated to buffer query, when the query is repositioned the buffer object has the pointer to the selected...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found