ldaps

package module
v0.0.0-...-fae8dfa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const (
	LDAPBindAuthSimple = 0
	LDAPBindAuthSASL   = 3
)

Other LDAP constants.

Variables

This section is empty.

Functions

func ApplyFilter

func ApplyFilter(f *ber.Packet, entry *ldap.Entry) (bool, *ldap.Error)

func GetFilterAttribute

func GetFilterAttribute(filter string, attr string) (string, error)

func HandleAbandonRequest

func HandleAbandonRequest(ctx context.Context, req *ber.Packet, boundDN string, fns map[string]Abandoner, conn net.Conn) error

func HandleAddRequest

func HandleAddRequest(ctx context.Context, req *ber.Packet, boundDN string, fns map[string]Adder, conn net.Conn) error

func HandleBindRequest

func HandleBindRequest(ctx context.Context, req *ber.Packet, fns map[string]Binder, conn net.Conn) (boundDN string, res *ldap.SimpleBindResult, resultErr error)

func HandleCompareRequest

func HandleCompareRequest(ctx context.Context, req *ber.Packet, boundDN string, fns map[string]Comparer, conn net.Conn) error

func HandleDeleteRequest

func HandleDeleteRequest(ctx context.Context, req *ber.Packet, boundDN string, fns map[string]Deleter, conn net.Conn) error

func HandleModifyDNRequest

func HandleModifyDNRequest(ctx context.Context, req *ber.Packet, boundDN string, fns map[string]ModifyDNr, conn net.Conn) error

func HandleModifyRequest

func HandleModifyRequest(ctx context.Context, req *ber.Packet, boundDN string, fns map[string]Modifier, conn net.Conn) (*ldap.ModifyResult, error)

func HandleSearchRequest

func HandleSearchRequest(ctx context.Context, req *ber.Packet, controls *[]ldap.Control, messageID uint64, boundDN string, server *Server, conn net.Conn) (resultErr error)

Types

type Abandoner

type Abandoner interface {
	Abandon(ctx context.Context, boundDN string, conn net.Conn) error
}

type Adder

type Adder interface {
	Add(ctx context.Context, boundDN string, req ldap.AddRequest, conn net.Conn) error
}

type Binder

type Binder interface {
	Bind(ctx context.Context, bindDN, bindSimplePw string, conn net.Conn) (*ldap.SimpleBindResult, error)
}

type Closer

type Closer interface {
	Close(ctx context.Context, boundDN string, conn net.Conn)
}

type Comparer

type Comparer interface {
	Compare(ctx context.Context, boundDN string, req ldap.CompareRequest, conn net.Conn) error
}

type ConnectionID

type ConnectionID struct{}

type Deleter

type Deleter interface {
	Delete(ctx context.Context, boundDN, deleteDN string, conn net.Conn) error
}

type Modifier

type Modifier interface {
	Modify(ctx context.Context, boundDN string, req ldap.ModifyRequest, conn net.Conn) (*ldap.ModifyResult, error)
}

type ModifyDNr

type ModifyDNr interface {
	ModifyDN(ctx context.Context, boundDN string, req ldap.ModifyDNRequest, conn net.Conn) error
}

type Searcher

type Searcher interface {
	Search(ctx context.Context, boundDN string, req ldap.SearchRequest, conn net.Conn) (*ldap.SearchResult, error)
}

type Server

type Server struct {
	BindFns     map[string]Binder
	SearchFns   map[string]Searcher
	AddFns      map[string]Adder
	ModifyFns   map[string]Modifier
	DeleteFns   map[string]Deleter
	ModifyDNFns map[string]ModifyDNr
	CompareFns  map[string]Comparer
	AbandonFns  map[string]Abandoner
	CloseFns    map[string]Closer
	Quit        chan bool
	EnforceLDAP bool

	// If set, server will accept StartTLS.
	TLSConfig *tls.Config
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

func (*Server) AbandonFunc

func (server *Server) AbandonFunc(baseDN string, f Abandoner)

func (*Server) AddFunc

func (server *Server) AddFunc(baseDN string, f Adder)

func (*Server) BindFunc

func (server *Server) BindFunc(baseDN string, f Binder)

func (*Server) Close

func (server *Server) Close()

Close closes the underlying net.Listener, and waits for confirmation

func (*Server) CloseFunc

func (server *Server) CloseFunc(baseDN string, f Closer)

func (*Server) CompareFunc

func (server *Server) CompareFunc(baseDN string, f Comparer)

func (*Server) DeleteFunc

func (server *Server) DeleteFunc(baseDN string, f Deleter)

func (*Server) GetStats

func (server *Server) GetStats() Stats

func (*Server) ListenAndServe

func (server *Server) ListenAndServe(listenString string) error

func (*Server) ListenAndServeTLS

func (server *Server) ListenAndServeTLS(listenString string, certFile string, keyFile string) error

func (*Server) ModifyDNFunc

func (server *Server) ModifyDNFunc(baseDN string, f ModifyDNr)

func (*Server) ModifyFunc

func (server *Server) ModifyFunc(baseDN string, f Modifier)

func (*Server) QuitChannel

func (server *Server) QuitChannel(quit chan bool)

func (*Server) SearchFunc

func (server *Server) SearchFunc(baseDN string, f Searcher)

func (*Server) Serve

func (server *Server) Serve(ln net.Listener) error

func (*Server) SetStats

func (server *Server) SetStats(enable bool)

type Stats

type Stats struct {
	Conns          int
	Binds          int
	Unbinds        int
	Searches       int
	NotImplemented int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL