rlidwka / sinopia-ldap

LDAP auth plugin for sinopia
18 stars 13 forks source link

index.js: ensure memberOf is an array. #5

Closed tcort closed 9 years ago

tcort commented 9 years ago

When ldap_user is only a member of 1 group, the memberOf attribute is a string containing a dn (not an array if dn strings). The for-loop is designed to work with an array of dn strings, so when a user who is a member of just one group is encountered, the module crashes because the for-loop is iterating over each character in the string. This patch adds a check to see if memberOf is an Array. If it isn't an array, it makes it an array.

rlidwka commented 9 years ago

Merged and published as sinopia-ldap@0.4.3. Thanks!