go fmt
This commit is contained in:
10
ldap.go
10
ldap.go
@@ -24,10 +24,10 @@ type LDAP struct {
|
||||
func (l LDAP) Connect() (*LDAPConn, error) {
|
||||
if l.Ssl {
|
||||
if c, err := ldap.DialTLS("tcp", fmt.Sprintf("%s:%d", l.Host, l.Port), &tls.Config{ServerName: l.Host}); err != nil {
|
||||
return nil, errors.New("unable to establish LDAPS connection to " + fmt.Sprintf("%s:%d", l.Host, l.Port) + ": " + err.Error())
|
||||
return nil, errors.New("unable to establish LDAPS connection to " + fmt.Sprintf("%s:%d", l.Host, l.Port) + ": " + err.Error())
|
||||
} else {
|
||||
return &LDAPConn{
|
||||
LDAP: l,
|
||||
LDAP: l,
|
||||
connection: c,
|
||||
}, nil
|
||||
}
|
||||
@@ -42,13 +42,12 @@ func (l LDAP) Connect() (*LDAPConn, error) {
|
||||
}
|
||||
|
||||
return &LDAPConn{
|
||||
LDAP: l,
|
||||
LDAP: l,
|
||||
connection: c,
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
type LDAPConn struct {
|
||||
LDAP
|
||||
connection *ldap.Conn
|
||||
@@ -117,7 +116,7 @@ func (l LDAPConn) ChangePassword(dn string, rawpassword string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
hashedpasswd, err := crypt.Crypt(rawpassword, "$6$" + salt + "$")
|
||||
hashedpasswd, err := crypt.Crypt(rawpassword, "$6$"+salt+"$")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -125,6 +124,5 @@ func (l LDAPConn) ChangePassword(dn string, rawpassword string) error {
|
||||
modify := ldap.NewModifyRequest(dn)
|
||||
modify.Replace("userPassword", []string{"{CRYPT}" + hashedpasswd})
|
||||
|
||||
|
||||
return l.connection.Modify(modify)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user