-
Notifications
You must be signed in to change notification settings - Fork 7
Description
testcase:
dn: cn=Barbara Jensen, ou=Product Development, dc=airius, dc=com
objectGUID;binary:: x7HAMN/oRNyn4w==
shift() result:
{ type: 'record',
dn: 'cn=Barbara Jensen, ou=Product Development, dc=airius, dc=com',
attributes:
[ { attribute:
{ type: 'attribute',
options: [ 'binary' ],
attribute: 'objectGUID' },
value: { type: 'value', value: 'DZ�0��Dܧ�' } } ] }
toObject doesn't make it any better:
{ dn: 'cn=Barbara Jensen, ou=Product Development, dc=airius, dc=com',
attributes: { 'objectGUID;binary': [ 'DZ�0��Dܧ�' ] } }
The above ldif output format is real life data from running ldapsearch against Microsoft AD, I only changed the dn and objectGUID value to protect the innocent. The ;binary option is not added automatically by AD, more on that below.
Guessing which attributes are truly binary and which can be decoded to string is a hard problem (read - probably no better solution that enumerate binary exceptions, spec doesn't say anything about it). Another product (node-LDAP) solves this by letting application code to "tag" attributes with ";binary" option when searching. AD server doesn't care and returns the same data in both cases, but parser library can use such tag and return the attributes as Buffer. Either Buffer or original base64 string would be fine, but binary data decoded into javascript string is definitely not fine.
Unfortunately I'm not in the position to learn peg and send a PR.
Thanks