gheeres/node-activedirectory — pull request #4 by igorescobar (2014-02-07 15:58:49+00:00)
Title: Bug on findUser with 3 valid arguments.

@gheeres When I execute the method findUser using the opts argument your package are building the wrong filter query.

Here is my code:
```
var opts = {attributes: [
'userPrincipalName', 'sAMAccountName', /*'objectSID',*/ 'mail',
'lockoutTime', 'whenCreated', 'pwdLastSet', 'userAccountControl',
'employeeID', 'sn', 'givenName', 'initials', 'cn', 'displayName',
'comment', 'description', 'extesionName'
]};
activeDirectory.findUser(opts, 'u100613', function(err, user) {
console.log(user);
});
```
Here is the filter which is being executed under the hood:
```filter: '(&(objectCategory=User)(|(sAMAccountName=[object Object])(userPrincipalName=[object Object])))',```

On your method ```ActiveDirectory.prototype.findUser``` you're making a condition which I think it is the source of the problem:
```
if (typeof(includeMembership) === 'function') {
callback = includeMembership;
includeMembership = username;
username = opts;
}
```
In my case... includeMembership it a function... I put a console.log right after the method signature to check those argument types.
```console.log(typeof opts, typeof username, typeof includeMembership, typeof callback)````
Output:
```object string function undefined```

So... on that case... that ```if``` is assigning ```opts``` as my username and the filter query are getting the wrong output.