mirror of
				https://github.com/h44z/wg-portal.git
				synced 2025-11-04 08:06:18 +00:00 
			
		
		
		
	improve ldap logging (#67)
This commit is contained in:
		@@ -157,20 +157,20 @@ func (provider Provider) open() (*ldap.Conn, error) {
 | 
			
		||||
	tlsConfig := &tls.Config{InsecureSkipVerify: !provider.config.CertValidation}
 | 
			
		||||
	conn, err := ldap.DialURL(provider.config.URL, ldap.DialWithTLSConfig(tlsConfig))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
		return nil, errors.WithMessage(err, "failed to connect to LDAP")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if provider.config.StartTLS {
 | 
			
		||||
		// Reconnect with TLS
 | 
			
		||||
		err = conn.StartTLS(tlsConfig)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
			return nil, errors.WithMessage(err, "failed to start TLS session")
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err = conn.Bind(provider.config.BindUser, provider.config.BindPass)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
		return nil, errors.WithMessage(err, "failed to bind user")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return conn, nil
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user