GithubHelp home page GithubHelp logo

Comments (13)

mcavage avatar mcavage commented on June 4, 2024

Howdy,

Yeah, this was already on my list. Generally binary attributes are annotated by name as foo;binary. I was thinking of at least solving that and returning a buffer - would that work?

from node-ldapjs.

nrogers avatar nrogers commented on June 4, 2024

I don't think the AD binary attributes follow a naming convention. For example, logonHours and objectGUID are both binary attributes.

So, I think the solution would have to work for all attributes.

from node-ldapjs.

mcavage avatar mcavage commented on June 4, 2024

Ok, I'll think about it some and work something in; like I said, it was already on the list.

from node-ldapjs.

mcavage avatar mcavage commented on June 4, 2024

Hi Nathan,

If you git pull the latest changes, anything touching an Attribute now has the following semantics:

  • vals is actually an overload. Everything internally is kept as a Buffer
  • If the attribute name ends in ;binary, then vals will return an array of base64 encoded strings, otherwise, it's the "old" behavior, of being handed as utf8
  • If, like AD, you have things like objectGUID that are actually binary, but not tagged with a ';binary, you can now access .buffers as opposed to .vals and get an array of raw node Buffer objects. The length and order will be the same as .vals.

I think that should cover everything you need. Before I go publish - let me know if that covers (ideally, if you can test it that would rock :) ).

m

from node-ldapjs.

nrogers avatar nrogers commented on June 4, 2024

Great, it looks like receiving binary attributes is working now in my tests.

It still seems to convert them to strings when I try to send them in a response, though.

-Nathan

-----Original Message-----
From: Mark Cavage [mailto:[email protected]]
Sent: Tuesday, October 11, 2011 4:02 PM
To: Rogers, Nathan
Subject: Re: [node-ldapjs] support binary attribute values (#21)

Hi Nathan,

If you git pull the latest changes, anything touching an Attribute now has the following semantics:

  • vals is actually an overload. Everything internally is kept as a Buffer
  • If the attribute name ends in ;binary, then vals will return an array of base64 encoded strings, otherwise, it's the "old" behavior, of being handed as utf8
  • If, like AD, you have things like objectGUID that are actually binary, but not tagged with a ';binary, you can now access .buffers as opposed to .vals and get an array of raw node Buffer objects. The length and order will be the same as .vals.

I think that should cover everything you need. Before I go publish - let me know if that covers (ideally, if you can test it that would rock :) ).

m

Reply to this email directly or view it on GitHub:
#21 (comment)

from node-ldapjs.

mcavage avatar mcavage commented on June 4, 2024

D'oh! I fixed everything except .toBer(), which was still writing them as a string. Try again :)

from node-ldapjs.

nrogers avatar nrogers commented on June 4, 2024

Thanks, that looks good to me.

from node-ldapjs.

mcavage avatar mcavage commented on June 4, 2024

Great. in npm as 0.2

from node-ldapjs.

DenysVuika avatar DenysVuika commented on June 4, 2024

Has anyone managed to get it working with AD? like jpegPhoto attribute?

from node-ldapjs.

mstllc avatar mstllc commented on June 4, 2024

Hey. I was struggling with this exact same thing and still can't quite figure it out. Specifically, I want to get objectGUID as a string, but it keeps coming all weird like. I'm not totally sure how to access the .buffer or .vals properties you mention above. I'm accessing everything in my search callback like entry.object.objectGUID and I see there is entry.attributes array which also contains all the attributes and their buffers, but is the only way to access them looping through that array and stopping at the item with the "type" key that matches the attribute I am looking for?

Thanks for any help.

from node-ldapjs.

gdw2 avatar gdw2 commented on June 4, 2024

Something like entry.raw.objectGUID might work.

from node-ldapjs.

pfmooney avatar pfmooney commented on June 4, 2024

@gdw2 is correct, the entry.raw getter allows access to buffer objects which should fit your need.

from node-ldapjs.

tstiemerling avatar tstiemerling commented on June 4, 2024

It seems AD needs objectGUID encoded in binary when using in a filter. We are currently explicitly converting the guid from string to binary for this, but would like to remove this if its not necessary. Any suggestions?

from node-ldapjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.