diff options
author | Sandro Santilli <strk@kbt.io> | 2016-11-07 17:38:43 +0100 |
---|---|---|
committer | Sandro Santilli <strk@kbt.io> | 2016-11-07 17:38:43 +0100 |
commit | 05fd9d3f096e53bcf80b73345d6fa567fbf017e6 (patch) | |
tree | f8626767c0759491625a9c8eb215cef3d2855163 /modules/auth/ldap | |
parent | 7612b5ec40955a5a0b4d281645e33a86d1632f70 (diff) | |
download | gitea-05fd9d3f096e53bcf80b73345d6fa567fbf017e6.tar.gz gitea-05fd9d3f096e53bcf80b73345d6fa567fbf017e6.zip |
Security protocols
Diffstat (limited to 'modules/auth/ldap')
-rw-r--r-- | modules/auth/ldap/ldap.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/auth/ldap/ldap.go b/modules/auth/ldap/ldap.go index b110fe6234..361ca5817f 100644 --- a/modules/auth/ldap/ldap.go +++ b/modules/auth/ldap/ldap.go @@ -20,9 +20,9 @@ type SecurityProtocol int // Note: new type must be added at the end of list to maintain compatibility. const ( - SECURITY_PROTOCOL_UNENCRYPTED SecurityProtocol = iota - SECURITY_PROTOCOL_LDAPS - SECURITY_PROTOCOL_START_TLS + SecurityProtocolUnencrypted SecurityProtocol = iota + SecurityProtocolLdaps + SecurityProtocolStartTls ) // Basic LDAP authentication service @@ -118,7 +118,7 @@ func dial(ls *Source) (*ldap.Conn, error) { ServerName: ls.Host, InsecureSkipVerify: ls.SkipVerify, } - if ls.SecurityProtocol == SECURITY_PROTOCOL_LDAPS { + if ls.SecurityProtocol == SecurityProtocolLdaps { return ldap.DialTLS("tcp", fmt.Sprintf("%s:%d", ls.Host, ls.Port), tlsCfg) } @@ -127,7 +127,7 @@ func dial(ls *Source) (*ldap.Conn, error) { return nil, fmt.Errorf("Dial: %v", err) } - if ls.SecurityProtocol == SECURITY_PROTOCOL_START_TLS { + if ls.SecurityProtocol == SecurityProtocolStartTls { if err = conn.StartTLS(tlsCfg); err != nil { conn.Close() return nil, fmt.Errorf("StartTLS: %v", err) |