Commit 5121efbf authored by ale's avatar ale
Browse files

Only trim spaces when bind_pw is read from file

parent ecceb66d
......@@ -203,19 +203,17 @@ func newLDAPBackend(config *Config) (*ldapBackend, error) {
}
// Read the bind password.
var bindPw []byte
if config.LDAPConfig.BindPw != "" {
bindPw = []byte(config.LDAPConfig.BindPw)
} else {
var err error
bindPw, err = ioutil.ReadFile(config.LDAPConfig.BindPwFile)
bindPw := config.LDAPConfig.BindPw
if config.LDAPConfig.BindPwFile != "" {
pwData, err := ioutil.ReadFile(config.LDAPConfig.BindPwFile)
if err != nil {
return nil, err
}
bindPw = strings.TrimSpace(string(pwData))
}
// Initialize the connection pool.
pool, err := ldaputil.NewConnectionPool(config.LDAPConfig.URI, config.LDAPConfig.BindDN, strings.TrimSpace(string(bindPw)), 5)
pool, err := ldaputil.NewConnectionPool(config.LDAPConfig.URI, config.LDAPConfig.BindDN, bindPw, 5)
if err != nil {
return nil, err
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment