diff options
-rw-r--r-- | examples/modify.go | 2 | ||||
-rw-r--r-- | examples/proxy.go | 9 | ||||
-rw-r--r-- | examples/server.go | 7 |
3 files changed, 12 insertions, 6 deletions
diff --git a/examples/modify.go b/examples/modify.go index 87d1119..74296b4 100644 --- a/examples/modify.go +++ b/examples/modify.go @@ -23,7 +23,7 @@ var ( Filter string = "(cn=kirkj)" ) -func search(l *ldap.Conn, filter string, attributes []string) (*ldap.Entry, *ldap.Error) { +func search(l *ldap.Conn, filter string, attributes []string) (*ldap.Entry, error) { search := ldap.NewSearchRequest( BaseDN, ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false, diff --git a/examples/proxy.go b/examples/proxy.go index d6b01d0..aebdd10 100644 --- a/examples/proxy.go +++ b/examples/proxy.go @@ -1,12 +1,15 @@ +// +build ignore + package main import ( "crypto/sha256" "fmt" - "github.com/nmcclain/ldap" "log" "net" "sync" + + "github.com/nmcclain/ldap" ) type ldapHandler struct { @@ -61,7 +64,7 @@ func (h ldapHandler) getSession(conn net.Conn) (session, error) { } ///////////// -func (h ldapHandler) Bind(bindDN, bindSimplePw string, conn net.Conn) (uint64, error) { +func (h ldapHandler) Bind(bindDN, bindSimplePw string, conn net.Conn) (ldap.LDAPResultCode, error) { s, err := h.getSession(conn) if err != nil { return ldap.LDAPResultOperationsError, err @@ -91,7 +94,7 @@ func (h ldapHandler) Search(boundDN string, searchReq ldap.SearchRequest, conn n //log.Printf("P: Search OK: %s -> num of entries = %d\n", search.Filter, len(sr.Entries)) return ldap.ServerSearchResult{sr.Entries, []string{}, []ldap.Control{}, ldap.LDAPResultSuccess}, nil } -func (h ldapHandler) Close(conn net.Conn) error { +func (h ldapHandler) Close(boundDN string, conn net.Conn) error { conn.Close() // close connection to the server when then client is closed h.lock.Lock() defer h.lock.Unlock() diff --git a/examples/server.go b/examples/server.go index 3341991..b8beeeb 100644 --- a/examples/server.go +++ b/examples/server.go @@ -1,9 +1,12 @@ +// +build ignore + package main import ( - "github.com/nmcclain/ldap" "log" "net" + + "github.com/nmcclain/ldap" ) ///////////// @@ -27,7 +30,7 @@ func main() { listen := "localhost:3389" log.Printf("Starting example LDAP server on %s", listen) if err := s.ListenAndServe(listen); err != nil { - log.Fatal("LDAP Server Failed: %s", err.Error()) + log.Fatalf("LDAP Server Failed: %s", err.Error()) } } |