summaryrefslogtreecommitdiffstats
path: root/examples/proxy.go
diff options
context:
space:
mode:
authorHiroki Uchiumi <uchiumi@estrella.co.jp>2019-10-21 22:07:07 +0200
committerNed McClain <nedmcclain@gmail.com>2019-10-21 22:07:07 +0200
commit3b3b69a7e9e3a1fc8b36f6545ae4e0f6e6a63fd2 (patch)
tree17bfbe05c522eb33e679a5fe205bba6b5dd67d75 /examples/proxy.go
parentAdd support for retrieving all user attributes (#5) (diff)
downloadldap-3b3b69a7e9e3a1fc8b36f6545ae4e0f6e6a63fd2.tar
ldap-3b3b69a7e9e3a1fc8b36f6545ae4e0f6e6a63fd2.tar.gz
ldap-3b3b69a7e9e3a1fc8b36f6545ae4e0f6e6a63fd2.tar.bz2
ldap-3b3b69a7e9e3a1fc8b36f6545ae4e0f6e6a63fd2.tar.lz
ldap-3b3b69a7e9e3a1fc8b36f6545ae4e0f6e6a63fd2.tar.xz
ldap-3b3b69a7e9e3a1fc8b36f6545ae4e0f6e6a63fd2.tar.zst
ldap-3b3b69a7e9e3a1fc8b36f6545ae4e0f6e6a63fd2.zip
Diffstat (limited to 'examples/proxy.go')
-rw-r--r--examples/proxy.go9
1 files changed, 6 insertions, 3 deletions
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()