From be82716b662b8b0b7f85c94209a264758f2b7f80 Mon Sep 17 00:00:00 2001
From: Unknown <joe2010xtmf@163.com>
Date: Thu, 15 May 2014 23:03:26 -0400
Subject: [PATCH] Clean old LDAP code

---
 README.md            | 19 ++++++++++---------
 README_ZH.md         |  3 ++-
 gogs.go              |  2 +-
 models/login.go      |  2 +-
 modules/base/conf.go | 34 ----------------------------------
 5 files changed, 14 insertions(+), 46 deletions(-)

diff --git a/README.md b/README.md
index e50af3526f..650946db4d 100644
--- a/README.md
+++ b/README.md
@@ -32,15 +32,16 @@ More importantly, Gogs only needs one binary to setup your own project hosting o
 ## Features
 
 - Activity timeline
-- SSH/HTTP(S) protocol support.
-- Register/delete/rename account.
-- Create/migrate/mirror/delete/watch/rename/transfer public/private repository.
-- Repository viewer/release/issue tracker/webhooks.
-- Add/remove repository collaborators.
-- Gravatar and cache support.
-- Mail service(register, issue).
-- Administration panel.
-- Supports MySQL, PostgreSQL and SQLite3.
+- SSH/HTTP(S) protocol support
+- SMTP authentication support
+- Register/delete/rename account
+- Create/migrate/mirror/delete/watch/rename/transfer public/private repository
+- Repository viewer/release/issue tracker/webhooks
+- Add/remove repository collaborators
+- Gravatar and cache support
+- Mail service(register, issue)
+- Administration panel
+- Supports MySQL, PostgreSQL and SQLite3
 - Social account login(GitHub, Google, QQ, Weibo)
 
 ## System Requirements
diff --git a/README_ZH.md b/README_ZH.md
index 928d43f78a..18fa0acf31 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -23,7 +23,8 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依
 ## 功能特性
 
 - 活动时间线
-- SSH/HTTP(S) 协议支持
+- 支持 SSH/HTTP(S) 协议
+- 支持 SMTP 用户认证
 - 注册/删除/重命名用户
 - 创建/迁移/镜像/删除/关注/重命名/转移 公开/私有 仓库
 - 仓库 浏览器/发布/缺陷管理/Web 钩子
diff --git a/gogs.go b/gogs.go
index 341d82b68c..cb09893929 100644
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
 	"github.com/gogits/gogs/modules/base"
 )
 
-const APP_VER = "0.3.4.0514 Alpha"
+const APP_VER = "0.3.4.0515 Alpha"
 
 func init() {
 	base.AppVer = APP_VER
diff --git a/models/login.go b/models/login.go
index 005a1f5b76..ed5a8425a8 100644
--- a/models/login.go
+++ b/models/login.go
@@ -312,7 +312,7 @@ func SmtpAuth(host string, port int, a smtp.Auth, useTls bool) error {
 				return err
 			}
 		} else {
-			return errors.New("SMTP server unsupported TLS")
+			return errors.New("SMTP server unsupports TLS")
 		}
 	}
 
diff --git a/modules/base/conf.go b/modules/base/conf.go
index 03e453e6d5..d4a004fab0 100644
--- a/modules/base/conf.go
+++ b/modules/base/conf.go
@@ -10,7 +10,6 @@ import (
 	"os/exec"
 	"path"
 	"path/filepath"
-	"regexp"
 	"strings"
 
 	"github.com/Unknwon/com"
@@ -20,7 +19,6 @@ import (
 	"github.com/gogits/cache"
 	"github.com/gogits/session"
 
-	"github.com/gogits/gogs/modules/auth/ldap"
 	"github.com/gogits/gogs/modules/log"
 )
 
@@ -188,37 +186,6 @@ func newLogService() {
 	}
 }
 
-func newLdapService() {
-	Service.LdapAuth = Cfg.MustBool("security", "LDAP_AUTH", false)
-	if !Service.LdapAuth {
-		return
-	}
-
-	nbsrc := 0
-	for _, v := range Cfg.GetSectionList() {
-		if matched, _ := regexp.MatchString("(?i)^LDAPSOURCE.*", v); matched {
-			ldapname := Cfg.MustValue(v, "name", v)
-			ldaphost := Cfg.MustValue(v, "host")
-			ldapport := Cfg.MustInt(v, "port", 389)
-			ldapusessl := Cfg.MustBool(v, "usessl", false)
-			ldapbasedn := Cfg.MustValue(v, "basedn", "dc=*,dc=*")
-			ldapattribute := Cfg.MustValue(v, "attribute", "mail")
-			ldapfilter := Cfg.MustValue(v, "filter", "(*)")
-			ldapmsadsaformat := Cfg.MustValue(v, "MSADSAFORMAT", "%s")
-			ldap.AddSource(ldapname, ldaphost, ldapport, ldapusessl, ldapbasedn, ldapattribute, ldapfilter, ldapmsadsaformat)
-			nbsrc++
-			log.Debug("%s added as LDAP source", ldapname)
-		}
-	}
-	if nbsrc == 0 {
-		log.Warn("No valide LDAP found, LDAP Authentication NOT enabled")
-		Service.LdapAuth = false
-		return
-	}
-
-	log.Info("LDAP Authentication Enabled")
-}
-
 func newCacheService() {
 	CacheAdapter = Cfg.MustValue("cache", "ADAPTER", "memory")
 	if EnableRedis {
@@ -376,7 +343,6 @@ func NewConfigContext() {
 func NewBaseServices() {
 	newService()
 	newLogService()
-	newLdapService()
 	newCacheService()
 	newSessionService()
 	newMailService()