mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
Fix out of bound access in LDAP results array
This commit is contained in:
parent
1dd0343860
commit
2e087f12f4
|
@ -10,6 +10,7 @@ import { ILdapClient } from "./ILdapClient";
|
||||||
import { ILdapClientFactory } from "./ILdapClientFactory";
|
import { ILdapClientFactory } from "./ILdapClientFactory";
|
||||||
import { LdapConfiguration } from "../configuration/Configuration";
|
import { LdapConfiguration } from "../configuration/Configuration";
|
||||||
import { Winston } from "../../../types/Dependencies";
|
import { Winston } from "../../../types/Dependencies";
|
||||||
|
import Util = require("util");
|
||||||
|
|
||||||
|
|
||||||
export class Client implements IClient {
|
export class Client implements IClient {
|
||||||
|
@ -75,8 +76,12 @@ export class Client implements IClient {
|
||||||
that.logger.debug("LDAP: searching for user dn of %s", username);
|
that.logger.debug("LDAP: searching for user dn of %s", username);
|
||||||
return that.ldapClient.searchAsync(this.options.users_dn, query)
|
return that.ldapClient.searchAsync(this.options.users_dn, query)
|
||||||
.then(function (users: { dn: string }[]) {
|
.then(function (users: { dn: string }[]) {
|
||||||
that.logger.debug("LDAP: retrieved user dn is %s", users[0].dn);
|
if (users.length > 0) {
|
||||||
return BluebirdPromise.resolve(users[0].dn);
|
that.logger.debug("LDAP: retrieved user dn is %s", users[0].dn);
|
||||||
|
return BluebirdPromise.resolve(users[0].dn);
|
||||||
|
}
|
||||||
|
return BluebirdPromise.reject(new Error(
|
||||||
|
Util.format("No user DN found for user '%s'", username)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user