Documentation
¶
Index ¶
- Variables
- func CheckPacket(p *ber.Packet, cl ber.Class, ty ber.Type, ta ber.Tag) error
- func ExtractMessageId(p *ber.Packet) (int64, error)
- func ForceInt64(v interface{}) int64
- func IsUnbindRequest(p *ber.Packet) bool
- func LDAPListenTLS(listenAddr, certFile, keyFile string) (net.Listener, error)
- func MakeLDAPSearchResultDonePacket(msgid int64) *ber.Packet
- func MakeLDAPSearchResultNoSuchObjectPacket(msgid int64) *ber.Packet
- type LDAPBindFunc
- type LDAPBindFuncHandler
- type LDAPRequestHandler
- type LDAPResultCodeHandler
- type LDAPServer
- type LDAPSession
- type LDAPSimpleSearchFunc
- type LDAPSimpleSearchFuncHandler
- type LDAPSimpleSearchRequest
- type LDAPSimpleSearchResultEntry
Constants ¶
This section is empty.
Variables ¶
var ErrNotASearchRequest = fmt.Errorf("not a search request")
var ErrSearchRequestTooComplex = fmt.Errorf("this search request is too complex to be parsed as a 'simple search'")
var LDAPDebug = false
lame, but simple - set to true when you want log output
Functions ¶
func CheckPacket ¶
func CheckPacket(p *ber.Packet, cl ber.Class, ty ber.Type, ta ber.Tag) error
func ExtractMessageId ¶
func ForceInt64 ¶
func ForceInt64(v interface{}) int64
func MakeLDAPSearchResultDonePacket ¶
func MakeLDAPSearchResultDonePacket(msgid int64) *ber.Packet
func MakeLDAPSearchResultNoSuchObjectPacket ¶
func MakeLDAPSearchResultNoSuchObjectPacket(msgid int64) *ber.Packet
Types ¶
type LDAPBindFunc ¶
function that checks simple auth credentials (username/password style)
type LDAPBindFuncHandler ¶
type LDAPBindFuncHandler struct {
LDAPBindFunc LDAPBindFunc
}
responds to bind requests
func (*LDAPBindFuncHandler) ServeLDAP ¶
func (h *LDAPBindFuncHandler) ServeLDAP(ssn *LDAPSession, p *ber.Packet) []*ber.Packet
type LDAPRequestHandler ¶
type LDAPRequestHandler interface { // read a packet and return one or more packets as a response // or nil/empty to indicate we don't want to handle this packet ServeLDAP(*LDAPSession, *ber.Packet) []*ber.Packet }
processes a request, or not
type LDAPResultCodeHandler ¶
type LDAPResultCodeHandler struct { ReplyTypeId int64 // the overall type of the response, e.g. 1 is BindResponse - it must be a response that is just a result code ResultCode int64 // the result code, i.e. 0 is success, 49 is invalid credentials, etc. }
func (*LDAPResultCodeHandler) ServeLDAP ¶
func (h *LDAPResultCodeHandler) ServeLDAP(ssn *LDAPSession, p *ber.Packet) []*ber.Packet
type LDAPServer ¶
type LDAPServer struct { Listener net.Listener Handlers []LDAPRequestHandler }
Handles socket interaction and a chain of handlers
func (*LDAPServer) ListenAndServe ¶
func (s *LDAPServer) ListenAndServe(addr string) error
listens and runs a plain (non-TLS) LDAP server on the address:port specified
func (*LDAPServer) Serve ¶
func (s *LDAPServer) Serve() error
serves an ldap server on the listener specified in the LDAPServer struct
type LDAPSession ¶
type LDAPSession struct {
Attributes map[string]interface{}
}
something that the handlers can use to keep track of stuff across multiple requests in the same connection/session
type LDAPSimpleSearchFunc ¶
type LDAPSimpleSearchFunc func(*LDAPSimpleSearchRequest) []*LDAPSimpleSearchResultEntry
a callback function to produce search results; should return nil to mean we chose not to attempt to search (i.e. this request is not for us); or return empty slice to mean 0 results (or slice with data for results)
type LDAPSimpleSearchFuncHandler ¶
type LDAPSimpleSearchFuncHandler struct {
LDAPSimpleSearchFunc LDAPSimpleSearchFunc
}
func (*LDAPSimpleSearchFuncHandler) ServeLDAP ¶
func (h *LDAPSimpleSearchFuncHandler) ServeLDAP(ssn *LDAPSession, p *ber.Packet) []*ber.Packet
type LDAPSimpleSearchRequest ¶
type LDAPSimpleSearchRequest struct { Packet *ber.Packet BaseDN string // DN under which to start searching Scope int64 // baseObject(0), singleLevel(1), wholeSubtree(2) DerefAliases int64 // neverDerefAliases(0),derefInSearching(1),derefFindingBaseObj(2),derefAlways(3) SizeLimit int64 // max number of results to return TimeLimit int64 // max time in seconds to spend processing TypesOnly bool // if true client is expecting only type info FilterAttr string // filter attribute name (assumed to be an equality match with just this one attribute) FilterValue string // filter attribute value }
a simplified ldap search request
func ParseLDAPSimpleSearchRequestPacket ¶
func ParseLDAPSimpleSearchRequestPacket(p *ber.Packet) (*LDAPSimpleSearchRequest, error)
type LDAPSimpleSearchResultEntry ¶
type LDAPSimpleSearchResultEntry struct { DN string // DN of this search result Attrs map[string]interface{} // map of attributes }
a simplified ldap search response
func (*LDAPSimpleSearchResultEntry) MakePacket ¶
func (e *LDAPSimpleSearchResultEntry) MakePacket(msgid int64) *ber.Packet