Documentation ¶
Index ¶
- Constants
- Variables
- func CompileFilter(filter string) (*ber.Packet, error)
- func DebugBinaryFile(fileName string) error
- func DecompileFilter(packet *ber.Packet) (ret string, err error)
- func GetFilterObjectClass(filter string) (string, error)
- func HandleAbandonRequest(req *ber.Packet, boundDN string, fns map[string]Abandoner, conn net.Conn) error
- func HandleSearchRequest(req *ber.Packet, controls *[]Control, messageID uint64, boundDN string, ...) (resultErr error)
- func NewError(resultCode LDAPResultCode, err error) error
- type Abandoner
- type AddRequest
- type Adder
- type Attribute
- type AttributeValueAssertion
- type Binder
- type Closer
- type CompareRequest
- type Comparer
- type Conn
- func Dial(network, addr string) (*Conn, error)
- func DialTLS(network, addr string, config *tls.Config) (*Conn, error)
- func DialTLSDialer(network, addr string, config *tls.Config, dialer *net.Dialer) (*Conn, error)
- func DialTimeout(network, addr string, timeout time.Duration) (*Conn, error)
- func NewConn(conn net.Conn) *Conn
- func (l *Conn) Bind(username, password string) error
- func (l *Conn) Close()
- func (l *Conn) Modify(modifyRequest *ModifyRequest) error
- func (l *Conn) Ping() error
- func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, error)
- func (l *Conn) SearchWithPaging(searchRequest *SearchRequest, pagingSize uint32) (*SearchResult, error)
- func (l *Conn) StartTLS(config *tls.Config) error
- func (l *Conn) Unbind() error
- type Control
- type ControlPaging
- type ControlString
- type DeleteRequest
- type Deleter
- type Entry
- type EntryAttribute
- type Error
- type ExtendedRequest
- type Extender
- type LDAPResultCode
- func HandleAddRequest(req *ber.Packet, boundDN string, fns map[string]Adder, conn net.Conn) (resultCode LDAPResultCode)
- func HandleBindRequest(req *ber.Packet, fns map[string]Binder, conn net.Conn) (resultCode LDAPResultCode)
- func HandleCompareRequest(req *ber.Packet, boundDN string, fns map[string]Comparer, conn net.Conn) (resultCode LDAPResultCode)
- func HandleDeleteRequest(req *ber.Packet, boundDN string, fns map[string]Deleter, conn net.Conn) (resultCode LDAPResultCode)
- func HandleExtendedRequest(req *ber.Packet, boundDN string, fns map[string]Extender, conn net.Conn) (resultCode LDAPResultCode)
- func HandleModifyDNRequest(req *ber.Packet, boundDN string, fns map[string]ModifyDNr, conn net.Conn) (resultCode LDAPResultCode)
- func HandleModifyRequest(req *ber.Packet, boundDN string, fns map[string]Modifier, conn net.Conn) (resultCode LDAPResultCode)
- func ServerApplyFilter(f *ber.Packet, entry *Entry) (bool, LDAPResultCode)
- type Modifier
- type ModifyDNRequest
- type ModifyDNr
- type ModifyRequest
- type PartialAttribute
- type SearchRequest
- type SearchResult
- type Searcher
- type Server
- func (server *Server) AbandonFunc(baseDN string, f Abandoner)
- func (server *Server) AddFunc(baseDN string, f Adder)
- func (server *Server) BindFunc(baseDN string, f Binder)
- func (server *Server) CloseFunc(baseDN string, f Closer)
- func (server *Server) CompareFunc(baseDN string, f Comparer)
- func (server *Server) DeleteFunc(baseDN string, f Deleter)
- func (server *Server) ExtendedFunc(baseDN string, f Extender)
- func (server *Server) GetStats() Stats
- func (server *Server) ListenAndServe(listenString string) error
- func (server *Server) ListenAndServeTLS(listenString string, certFile string, keyFile string) error
- func (server *Server) ModifyDNFunc(baseDN string, f ModifyDNr)
- func (server *Server) ModifyFunc(baseDN string, f Modifier)
- func (server *Server) QuitChannel(quit chan bool)
- func (server *Server) SearchFunc(baseDN string, f Searcher)
- func (server *Server) Serve(ln net.Listener) error
- func (server *Server) SetStats(enable bool)
- func (server *Server) UnbindFunc(baseDN string, f Unbinder)
- type ServerSearchResult
- type Stats
- type Unbinder
Constants ¶
View Source
const ( MessageQuit = 0 MessageRequest = 1 MessageResponse = 2 MessageFinish = 3 )
View Source
const ( FilterAnd = 0 FilterOr = 1 FilterNot = 2 FilterEqualityMatch = 3 FilterSubstrings = 4 FilterGreaterOrEqual = 5 FilterLessOrEqual = 6 FilterPresent = 7 FilterApproxMatch = 8 FilterExtensibleMatch = 9 )
View Source
const ( FilterSubstringsInitial = 0 FilterSubstringsAny = 1 FilterSubstringsFinal = 2 )
View Source
const ( ApplicationBindRequest = 0 ApplicationBindResponse = 1 ApplicationUnbindRequest = 2 ApplicationSearchRequest = 3 ApplicationSearchResultEntry = 4 ApplicationSearchResultDone = 5 ApplicationModifyRequest = 6 ApplicationModifyResponse = 7 ApplicationAddRequest = 8 ApplicationAddResponse = 9 ApplicationDelRequest = 10 ApplicationDelResponse = 11 ApplicationModifyDNRequest = 12 ApplicationModifyDNResponse = 13 ApplicationCompareRequest = 14 ApplicationCompareResponse = 15 ApplicationAbandonRequest = 16 ApplicationSearchResultReference = 19 ApplicationExtendedRequest = 23 ApplicationExtendedResponse = 24 )
LDAP Application Codes
View Source
const ( LDAPResultSuccess = 0 LDAPResultOperationsError = 1 LDAPResultProtocolError = 2 LDAPResultTimeLimitExceeded = 3 LDAPResultSizeLimitExceeded = 4 LDAPResultCompareFalse = 5 LDAPResultCompareTrue = 6 LDAPResultAuthMethodNotSupported = 7 LDAPResultStrongAuthRequired = 8 LDAPResultReferral = 10 LDAPResultAdminLimitExceeded = 11 LDAPResultConfidentialityRequired = 13 LDAPResultSaslBindInProgress = 14 LDAPResultNoSuchAttribute = 16 LDAPResultUndefinedAttributeType = 17 LDAPResultInappropriateMatching = 18 LDAPResultConstraintViolation = 19 LDAPResultAttributeOrValueExists = 20 LDAPResultInvalidAttributeSyntax = 21 LDAPResultNoSuchObject = 32 LDAPResultAliasProblem = 33 LDAPResultInvalidDNSyntax = 34 LDAPResultAliasDereferencingProblem = 36 LDAPResultInappropriateAuthentication = 48 LDAPResultInvalidCredentials = 49 LDAPResultInsufficientAccessRights = 50 LDAPResultBusy = 51 LDAPResultUnwillingToPerform = 53 LDAPResultLoopDetect = 54 LDAPResultNamingViolation = 64 LDAPResultObjectClassViolation = 65 LDAPResultNotAllowedOnNonLeaf = 66 LDAPResultNotAllowedOnRDN = 67 LDAPResultEntryAlreadyExists = 68 LDAPResultObjectClassModsProhibited = 69 LDAPResultAffectsMultipleDSAs = 71 LDAPResultOther = 80 ErrorNetwork = 200 ErrorFilterCompile = 201 ErrorFilterDecompile = 202 ErrorDebugging = 203 )
LDAP Result Codes
View Source
const ( LDAPBindAuthSimple = 0 LDAPBindAuthSASL = 3 )
Other LDAP constants
View Source
const ( AddAttribute = 0 DeleteAttribute = 1 ReplaceAttribute = 2 )
View Source
const ( ScopeBaseObject = 0 ScopeSingleLevel = 1 ScopeWholeSubtree = 2 )
View Source
const ( NeverDerefAliases = 0 DerefInSearching = 1 DerefFindingBaseObj = 2 DerefAlways = 3 )
View Source
const (
ControlTypePaging = "1.2.840.113556.1.4.319"
)
Variables ¶
View Source
var ApplicationMap = map[uint8]string{ ApplicationBindRequest: "Bind Request", ApplicationBindResponse: "Bind Response", ApplicationUnbindRequest: "Unbind Request", ApplicationSearchRequest: "Search Request", ApplicationSearchResultEntry: "Search Result Entry", ApplicationSearchResultDone: "Search Result Done", ApplicationModifyRequest: "Modify Request", ApplicationModifyResponse: "Modify Response", ApplicationAddRequest: "Add Request", ApplicationAddResponse: "Add Response", ApplicationDelRequest: "Del Request", ApplicationDelResponse: "Del Response", ApplicationModifyDNRequest: "Modify DN Request", ApplicationModifyDNResponse: "Modify DN Response", ApplicationCompareRequest: "Compare Request", ApplicationCompareResponse: "Compare Response", ApplicationAbandonRequest: "Abandon Request", ApplicationSearchResultReference: "Search Result Reference", ApplicationExtendedRequest: "Extended Request", ApplicationExtendedResponse: "Extended Response", }
View Source
var ControlTypeMap = map[string]string{ ControlTypePaging: "Paging", }
View Source
var DerefMap = map[int]string{ NeverDerefAliases: "NeverDerefAliases", DerefInSearching: "DerefInSearching", DerefFindingBaseObj: "DerefFindingBaseObj", DerefAlways: "DerefAlways", }
View Source
var FilterMap = map[uint8]string{ FilterAnd: "And", FilterOr: "Or", FilterNot: "Not", FilterEqualityMatch: "Equality Match", FilterSubstrings: "Substrings", FilterGreaterOrEqual: "Greater Or Equal", FilterLessOrEqual: "Less Or Equal", FilterPresent: "Present", FilterApproxMatch: "Approx Match", FilterExtensibleMatch: "Extensible Match", }
View Source
var LDAPModifyAttributeMap = map[uint64]string{ AddAttribute: "Add", DeleteAttribute: "Delete", ReplaceAttribute: "Replace", }
View Source
var LDAPResultCodeMap = map[LDAPResultCode]string{ LDAPResultSuccess: "Success", LDAPResultOperationsError: "Operations Error", LDAPResultProtocolError: "Protocol Error", LDAPResultTimeLimitExceeded: "Time Limit Exceeded", LDAPResultSizeLimitExceeded: "Size Limit Exceeded", LDAPResultCompareFalse: "Compare False", LDAPResultCompareTrue: "Compare True", LDAPResultAuthMethodNotSupported: "Auth Method Not Supported", LDAPResultStrongAuthRequired: "Strong Auth Required", LDAPResultReferral: "Referral", LDAPResultAdminLimitExceeded: "Admin Limit Exceeded", LDAPResultUnavailableCriticalExtension: "Unavailable Critical Extension", LDAPResultConfidentialityRequired: "Confidentiality Required", LDAPResultSaslBindInProgress: "Sasl Bind In Progress", LDAPResultNoSuchAttribute: "No Such Attribute", LDAPResultUndefinedAttributeType: "Undefined Attribute Type", LDAPResultInappropriateMatching: "Inappropriate Matching", LDAPResultConstraintViolation: "Constraint Violation", LDAPResultAttributeOrValueExists: "Attribute Or Value Exists", LDAPResultInvalidAttributeSyntax: "Invalid Attribute Syntax", LDAPResultNoSuchObject: "No Such Object", LDAPResultAliasProblem: "Alias Problem", LDAPResultInvalidDNSyntax: "Invalid DN Syntax", LDAPResultAliasDereferencingProblem: "Alias Dereferencing Problem", LDAPResultInappropriateAuthentication: "Inappropriate Authentication", LDAPResultInvalidCredentials: "Invalid Credentials", LDAPResultInsufficientAccessRights: "Insufficient Access Rights", LDAPResultBusy: "Busy", LDAPResultUnavailable: "Unavailable", LDAPResultUnwillingToPerform: "Unwilling To Perform", LDAPResultLoopDetect: "Loop Detect", LDAPResultNamingViolation: "Naming Violation", LDAPResultObjectClassViolation: "Object Class Violation", LDAPResultNotAllowedOnNonLeaf: "Not Allowed On Non Leaf", LDAPResultNotAllowedOnRDN: "Not Allowed On RDN", LDAPResultEntryAlreadyExists: "Entry Already Exists", LDAPResultObjectClassModsProhibited: "Object Class Mods Prohibited", LDAPResultAffectsMultipleDSAs: "Affects Multiple DSAs", LDAPResultOther: "Other", }
View Source
var ScopeMap = map[int]string{ ScopeBaseObject: "Base Object", ScopeSingleLevel: "Single Level", ScopeWholeSubtree: "Whole Subtree", }
Functions ¶
func DebugBinaryFile ¶
func GetFilterObjectClass ¶
func HandleAbandonRequest ¶
func HandleSearchRequest ¶
func NewError ¶
func NewError(resultCode LDAPResultCode, err error) error
Types ¶
type AddRequest ¶
type AddRequest struct {
// contains filtered or unexported fields
}
type Adder ¶
type Adder interface {
Add(boundDN string, req AddRequest, conn net.Conn) (LDAPResultCode, error)
}
type AttributeValueAssertion ¶
type AttributeValueAssertion struct {
// contains filtered or unexported fields
}
type Binder ¶
type Binder interface {
Bind(bindDN, bindSimplePw string, conn net.Conn) (LDAPResultCode, error)
}
type CompareRequest ¶
type CompareRequest struct {
// contains filtered or unexported fields
}
type Comparer ¶
type Comparer interface {
Compare(boundDN string, req CompareRequest, conn net.Conn) (LDAPResultCode, error)
}
type Conn ¶
type Conn struct { Debug debugging // contains filtered or unexported fields }
Conn represents an LDAP Connection
func Dial ¶
Dial connects to the given address on the given network using net.Dial and then returns a new Conn for the connection.
func DialTLS ¶
DialTLS connects to the given address on the given network using tls.Dial and then returns a new Conn for the connection.
func DialTLSDialer ¶
DialTLSDialer connects to the given address on the given network using tls.DialWithDialer and then returns a new Conn for the connection.
func DialTimeout ¶
DialTimeout connects to the given address on the given network using net.DialTimeout and then returns a new Conn for the connection. Acts like Dial but takes a timeout.
func (*Conn) Modify ¶
func (l *Conn) Modify(modifyRequest *ModifyRequest) error
func (*Conn) Search ¶
func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, error)
func (*Conn) SearchWithPaging ¶
func (l *Conn) SearchWithPaging(searchRequest *SearchRequest, pagingSize uint32) (*SearchResult, error)
type Control ¶
func DecodeControl ¶
func DecodeControl(packet *ber.Packet) Control
func FindControl ¶
type ControlPaging ¶
func NewControlPaging ¶
func NewControlPaging(pagingSize uint32) *ControlPaging
func (*ControlPaging) Encode ¶
func (c *ControlPaging) Encode() *ber.Packet
func (*ControlPaging) GetControlType ¶
func (c *ControlPaging) GetControlType() string
func (*ControlPaging) SetCookie ¶
func (c *ControlPaging) SetCookie(cookie []byte)
func (*ControlPaging) String ¶
func (c *ControlPaging) String() string
type ControlString ¶
func NewControlString ¶
func NewControlString(controlType string, criticality bool, controlValue string) *ControlString
func (*ControlString) Encode ¶
func (c *ControlString) Encode() *ber.Packet
func (*ControlString) GetControlType ¶
func (c *ControlString) GetControlType() string
func (*ControlString) String ¶
func (c *ControlString) String() string
type DeleteRequest ¶
type DeleteRequest struct {
// contains filtered or unexported fields
}
type Deleter ¶
type Deleter interface {
Delete(boundDN, deleteDN string, conn net.Conn) (LDAPResultCode, error)
}
type Entry ¶
type Entry struct { DN string Attributes []*EntryAttribute }
func (*Entry) GetAttributeValue ¶
func (*Entry) GetAttributeValues ¶
func (*Entry) PrettyPrint ¶
type EntryAttribute ¶
func (*EntryAttribute) PrettyPrint ¶
func (e *EntryAttribute) PrettyPrint(indent int)
func (*EntryAttribute) Print ¶
func (e *EntryAttribute) Print()
type Error ¶
type Error struct { Err error ResultCode LDAPResultCode }
type ExtendedRequest ¶
type ExtendedRequest struct {
// contains filtered or unexported fields
}
type Extender ¶
type Extender interface {
Extended(boundDN string, req ExtendedRequest, conn net.Conn) (LDAPResultCode, error)
}
type LDAPResultCode ¶
type LDAPResultCode uint8
func HandleAddRequest ¶
func HandleBindRequest ¶
func HandleBindRequest(req *ber.Packet, fns map[string]Binder, conn net.Conn) (resultCode LDAPResultCode)
func HandleCompareRequest ¶
func HandleDeleteRequest ¶
func HandleExtendedRequest ¶
func HandleModifyDNRequest ¶
func HandleModifyRequest ¶
func ServerApplyFilter ¶
func ServerApplyFilter(f *ber.Packet, entry *Entry) (bool, LDAPResultCode)
type Modifier ¶
type Modifier interface {
Modify(boundDN string, req ModifyRequest, conn net.Conn) (LDAPResultCode, error)
}
type ModifyDNRequest ¶
type ModifyDNRequest struct {
// contains filtered or unexported fields
}
type ModifyDNr ¶
type ModifyDNr interface {
ModifyDN(boundDN string, req ModifyDNRequest, conn net.Conn) (LDAPResultCode, error)
}
type ModifyRequest ¶
type ModifyRequest struct { Dn string AddAttributes []PartialAttribute DeleteAttributes []PartialAttribute ReplaceAttributes []PartialAttribute }
func NewModifyRequest ¶
func NewModifyRequest( dn string, ) *ModifyRequest
func (*ModifyRequest) Add ¶
func (m *ModifyRequest) Add(attrType string, attrVals []string)
func (*ModifyRequest) Delete ¶
func (m *ModifyRequest) Delete(attrType string, attrVals []string)
func (*ModifyRequest) Replace ¶
func (m *ModifyRequest) Replace(attrType string, attrVals []string)
type PartialAttribute ¶
type SearchRequest ¶
type SearchRequest struct { BaseDN string Scope int DerefAliases int SizeLimit int TimeLimit int TypesOnly bool Filter string Attributes []string Controls []Control }
func NewSearchRequest ¶
type SearchResult ¶
func (*SearchResult) PrettyPrint ¶
func (s *SearchResult) PrettyPrint(indent int)
func (*SearchResult) Print ¶
func (s *SearchResult) Print()
type Searcher ¶
type Searcher interface {
Search(boundDN string, req SearchRequest, conn net.Conn) (ServerSearchResult, 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 ExtendedFns map[string]Extender UnbindFns map[string]Unbinder CloseFns map[string]Closer Quit chan bool EnforceLDAP bool Stats *Stats }
func (*Server) AbandonFunc ¶
func (*Server) CompareFunc ¶
func (*Server) DeleteFunc ¶
func (*Server) ExtendedFunc ¶
func (*Server) ListenAndServe ¶
func (*Server) ListenAndServeTLS ¶
func (*Server) ModifyDNFunc ¶
func (*Server) ModifyFunc ¶
func (*Server) QuitChannel ¶
func (*Server) SearchFunc ¶
func (*Server) UnbindFunc ¶
type ServerSearchResult ¶
type ServerSearchResult struct { Entries []*Entry Referrals []string Controls []Control ResultCode LDAPResultCode }
Click to show internal directories.
Click to hide internal directories.