Documentation
¶
Overview ¶
This package provides LDAP client functions.
Index ¶
- Constants
- Variables
- func AttributeValueAssertion(attr, op, value string) (*ber.Packet, error)
- func CompileFilter(filter string) (*ber.Packet, error)
- func DebugBinaryFile(FileName string) error
- func DecompileFilter(packet *ber.Packet) (ret string, err error)
- func DnReplace(value string) string
- func EscapeFilterValue(filter string) string
- func FilterReplace(value string) string
- func UnescapeFilterValue(filter string) string
- type AddRequest
- type ApplicationCode
- type CompareRequest
- type Connection
- func (l *Connection) Abandon(abandonMessageID int64) error
- func (l *Connection) Add(req *AddRequest) error
- func (l *Connection) Bind(username, password string) error
- func (l *Connection) Close() error
- func (l *Connection) Compare(req *CompareRequest) (bool, error)
- func (l *Connection) Connect() error
- func (l *Connection) Delete(delReq *DeleteRequest) (error error)
- func (l *Connection) ModDn(req *ModDnRequest) error
- func (l *Connection) Modify(modReq *ModifyRequest) error
- func (l *Connection) Passwd(req *PasswordModifyRequest) error
- func (l *Connection) Search(searchRequest *SearchRequest) (*SearchResult, error)
- func (l *Connection) SearchWithHandler(searchRequest *SearchRequest, resultHandler SearchResultHandler, ...) error
- func (l *Connection) SearchWithPaging(searchRequest *SearchRequest, pagingSize uint32) (*SearchResult, error)
- type ConnectionInfo
- type Control
- func FindControl(controls []Control, controlType ControlType) (position int, control Control)
- func NewControlPagingFromPacket(p *ber.Packet) (Control, error)
- func NewControlServerSideSortResponse(p *ber.Packet) (Control, error)
- func NewControlStringFromPacket(p *ber.Packet) (Control, error)
- func NewControlVlvResponse(p *ber.Packet) (Control, error)
- func ReplaceControl(controls []Control, control Control) (oldControl Control)
- type ControlMatchedValuesRequest
- type ControlPaging
- type ControlServerSideSortRequest
- type ControlServerSideSortResponse
- type ControlString
- func NewControlManageDsaITRequest(criticality bool) *ControlString
- func NewControlNoOpRequest() *ControlString
- func NewControlPermissiveModifyRequest(criticality bool) *ControlString
- func NewControlString(ControlType ControlType, Criticality bool, ControlValue string) *ControlString
- func NewControlSubtreeDeleteRequest(criticality bool) *ControlString
- type ControlType
- type ControlVlvRequest
- type ControlVlvResponse
- type DeleteRequest
- type Deref
- type DiscreteSearchResult
- type Entry
- func (e *Entry) AddAttributeValue(attributeName, value string)
- func (e *Entry) AddAttributeValues(attributeName string, values []string)
- func (e *Entry) GetAttributeIndex(attributeName string) int
- func (e *Entry) GetAttributeValue(attributeName string) string
- func (e *Entry) GetAttributeValues(attributeName string) []string
- func (e *Entry) String() string
- type EntryAttribute
- type Error
- type Mod
- type ModDnRequest
- type ModificationCode
- type ModifyRequest
- type PasswordModifyRequest
- type ResultCode
- type Scope
- type SearchRequest
- type SearchResult
- type SearchResultHandler
- type SearchResultType
- type ServerSideSortAttrRuleOrder
- type ValueMismatchError
- type VlvOffSet
Constants ¶
const ( MessageQuit = 0 MessageRequest = 1 MessageResponse = 2 MessageFinish = 3 )
const ( FilterAnd = 0 FilterOr = 1 FilterNot = 2 FilterEqualityMatch = 3 FilterSubstrings = 4 FilterGreaterOrEqual = 5 FilterLessOrEqual = 6 FilterPresent = 7 FilterApproxMatch = 8 FilterExtensibleMatch = 9 )
const ( FilterSubstringsInitial = 0 FilterSubstringsAny = 1 FilterSubstringsFinal = 2 )
const ( TagMatchingRule = 1 TagMatchingType = 2 TagMatchValue = 3 TagMatchDnAttributes = 4 )
const ( DefaultTimeout = 60 * time.Minute ResultChanBufferSize = 5 // buffer items in each chanResults default: 5 )
const ( MatchingRule_numericStringOrderingMatch = "2.5.13.9" // 1.3.6.1.4.1.1466.115.121.1.36 MatchingRule_numericStringMatch = "2.5.13.8" // 1.3.6.1.4.1.1466.115.121.1.36 MatchingRule_caseExactSubstringsMatch = "2.5.13.7" // 1.3.6.1.4.1.1466.115.121.1.58 MatchingRule_caseExactOrderingMatch = "2.5.13.6" // 1.3.6.1.4.1.1466.115.121.1.15 MatchingRule_caseExactMatch = "2.5.13.5" // 1.3.6.1.4.1.1466.115.121.1.15 MatchingRule_caseIgnoreSubstringsMatch = "2.5.13.4" // 1.3.6.1.4.1.1466.115.121.1.58 MatchingRule_keywordMatch = "2.5.13.33" // 1.3.6.1.4.1.1466.115.121.1.15 MatchingRule_wordMatch = "2.5.13.32" // 1.3.6.1.4.1.1466.115.121.1.15 MatchingRule_directoryStringFirstComponentMatch = "2.5.13.31" // 1.3.6.1.4.1.1466.115.121.1.15 MatchingRule_objectIdentifierFirstComponentMatch = "2.5.13.30" // 1.3.6.1.4.1.1466.115.121.1.38 MatchingRule_caseIgnoreOrderingMatch = "2.5.13.3" // 1.3.6.1.4.1.1466.115.121.1.15 MatchingRule_integerFirstComponentMatch = "2.5.13.29" // 1.3.6.1.4.1.1466.115.121.1.27 MatchingRule_generalizedTimeOrderingMatch = "2.5.13.28" // 1.3.6.1.4.1.1466.115.121.1.24 MatchingRule_generalizedTimeMatch = "2.5.13.27" // 1.3.6.1.4.1.1466.115.121.1.24 MatchingRule_protocolInformationMatch = "2.5.13.24" // 1.3.6.1.4.1.1466.115.121.1.42 MatchingRule_uniqueMemberMatch = "2.5.13.23" // 1.3.6.1.4.1.1466.115.121.1.34 MatchingRule_presentationAddressMatch = "2.5.13.22" // 1.3.6.1.4.1.1466.115.121.1.43 MatchingRule_telephoneNumberSubstringsMatch = "2.5.13.21" // 1.3.6.1.4.1.1466.115.121.1.58 MatchingRule_telephoneNumberMatch = "2.5.13.20" // 1.3.6.1.4.1.1466.115.121.1.50 MatchingRule_caseIgnoreMatch = "2.5.13.2" // 1.3.6.1.4.1.1466.115.121.1.15 MatchingRule_octetStringSubstringsMatch = "2.5.13.19" // 1.3.6.1.4.1.1466.115.121.1.58 MatchingRule_octetStringOrderingMatch = "2.5.13.18" // 1.3.6.1.4.1.1466.115.121.1.40 MatchingRule_octetStringMatch = "2.5.13.17" // 1.3.6.1.4.1.1466.115.121.1.40 MatchingRule_bitStringMatch = "2.5.13.16" // 1.3.6.1.4.1.1466.115.121.1.6 MatchingRule_integerOrderingMatch = "2.5.13.15" // 1.3.6.1.4.1.1466.115.121.1.27 MatchingRule_integerMatch = "2.5.13.14" // 1.3.6.1.4.1.1466.115.121.1.27 MatchingRule_booleanMatch = "2.5.13.13" // 1.3.6.1.4.1.1466.115.121.1.7 MatchingRule_caseIgnoreListSubstringsMatch = "2.5.13.12" // 1.3.6.1.4.1.1466.115.121.1.58 MatchingRule_caseIgnoreListMatch = "2.5.13.11" // 1.3.6.1.4.1.1466.115.121.1.41 MatchingRule_numericStringSubstringsMatch = "2.5.13.10" // 1.3.6.1.4.1.1466.115.121.1.58 MatchingRule_distinguishedNameMatch = "2.5.13.1" // 1.3.6.1.4.1.1466.115.121.1.12 MatchingRule_objectIdentifierMatch = "2.5.13.0" // 1.3.6.1.4.1.1466.115.121.1.38 MatchingRule_authPasswordMatch = "1.3.6.1.4.1.4203.1.2.3" // 1.3.6.1.4.1.4203.1.1.2 DESC 'authentication password matching rule' MatchingRule_authPasswordExactMatch = "1.3.6.1.4.1.4203.1.2.2" // 1.3.6.1.4.1.4203.1.1.2 DESC 'authentication password exact matching rule' MatchingRule_caseExactIA5SubstringsMatch = "1.3.6.1.4.1.26027.1.4.902" // 1.3.6.1.4.1.1466.115.121.1.58 MatchingRule_partialDateAndTimeMatchingRule = "1.3.6.1.4.1.26027.1.4.7" // 1.3.6.1.4.1.1466.115.121.1.24 MatchingRule_relativeTimeLTOrderingMatch = "1.3.6.1.4.1.26027.1.4.6" // 1.3.6.1.4.1.1466.115.121.1.24 MatchingRule_relativeTimeGTOrderingMatch = "1.3.6.1.4.1.26027.1.4.5" // 1.3.6.1.4.1.1466.115.121.1.24 MatchingRule_historicalCsnOrderingMatch = "1.3.6.1.4.1.26027.1.4.4" // 1.3.6.1.4.1.1466.115.121.1.40 MatchingRule_ds_mr_user_password_equality = "1.3.6.1.4.1.26027.1.4.3" // 1.3.6.1.4.1.26027.1.3.1 DESC 'user password matching rule' MatchingRule_ds_mr_user_password_exact = "1.3.6.1.4.1.26027.1.4.2" // 1.3.6.1.4.1.26027.1.3.1 DESC 'user password exact matching rule' MatchingRule_ds_mr_double_metaphone_approx = "1.3.6.1.4.1.26027.1.4.1" // 1.3.6.1.4.1.26027.1.3.1 DESC 'Double Metaphone Approximate Match' MatchingRule_caseIgnoreIA5SubstringsMatch = "1.3.6.1.4.1.1466.109.114.3" // 1.3.6.1.4.1.1466.115.121.1.58 MatchingRule_caseIgnoreIA5Match = "1.3.6.1.4.1.1466.109.114.2" // 1.3.6.1.4.1.1466.115.121.1.26 MatchingRule_caseExactIA5Match = "1.3.6.1.4.1.1466.109.114.1" // 1.3.6.1.4.1.1466.115.121.1.26 MatchingRule_uuidOrderingMatch = "1.3.6.1.1.16.3" // 1.3.6.1.1.16.1 MatchingRule_uuidMatch = "1.3.6.1.1.16.2" // 1.3.6.1.1.16.1 )
At the moment just helper values for ServerSideSorting.
const (
FilterItem = 256
)
Variables ¶
var FilterComponent = map[string]uint64{ "&": FilterAnd, "|": FilterOr, "!": FilterNot, "=": FilterEqualityMatch, ">=": FilterGreaterOrEqual, "<=": FilterLessOrEqual, "~=": FilterApproxMatch, }
var FilterDebug bool = false
var FilterMap = map[uint64]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", }
var FilterSubstringsMap = map[uint64]string{ FilterSubstringsInitial: "Substrings Initial", FilterSubstringsAny: "Substrings Any", FilterSubstringsFinal: "Substrings Final", }
var VlvDebug bool
Functions ¶
func AttributeValueAssertion ¶
func CompileFilter ¶
func DebugBinaryFile ¶
func DecompileFilter ¶
func DnReplace ¶
DnReplace replaces runes in AssertionValues as defined in RFC 4514 [https://www.ietf.org/rfc/rfc4514.txt]
func EscapeFilterValue ¶
func FilterReplace ¶
FilterReplace replaces runes in AssertionValues as defined in RFC 4515 [https://www.ietf.org/rfc/rfc4515.txt]
func UnescapeFilterValue ¶
Types ¶
type AddRequest ¶
func NewAddRequest ¶
func NewAddRequest(dn string) (req *AddRequest)
func (*AddRequest) AddAttribute ¶
func (req *AddRequest) AddAttribute(attr *EntryAttribute)
func (*AddRequest) AddAttributes ¶
func (req *AddRequest) AddAttributes(attrs []*EntryAttribute)
func (*AddRequest) AddControl ¶
func (req *AddRequest) AddControl(control Control)
func (*AddRequest) Bytes ¶
func (req *AddRequest) Bytes() []byte
func (*AddRequest) String ¶
func (addReq *AddRequest) String() (dump string)
DumpAddRequest - Basic LDIF "like" dump for testing, no formating, etc
type ApplicationCode ¶
type ApplicationCode ber.Tag
LDAP Application Codes
const ( ApplicationBindRequest ApplicationCode = 0 ApplicationBindResponse ApplicationCode = 1 ApplicationUnbindRequest ApplicationCode = 2 ApplicationSearchRequest ApplicationCode = 3 ApplicationSearchResultEntry ApplicationCode = 4 ApplicationSearchResultDone ApplicationCode = 5 ApplicationModifyRequest ApplicationCode = 6 ApplicationModifyResponse ApplicationCode = 7 ApplicationAddRequest ApplicationCode = 8 ApplicationAddResponse ApplicationCode = 9 ApplicationDelRequest ApplicationCode = 10 ApplicationDelResponse ApplicationCode = 11 ApplicationModifyDNRequest ApplicationCode = 12 ApplicationModifyDNResponse ApplicationCode = 13 ApplicationCompareRequest ApplicationCode = 14 ApplicationCompareResponse ApplicationCode = 15 ApplicationAbandonRequest ApplicationCode = 16 ApplicationSearchResultReference ApplicationCode = 19 ApplicationExtendedRequest ApplicationCode = 23 ApplicationExtendedResponse ApplicationCode = 24 )
func (ApplicationCode) String ¶
func (i ApplicationCode) String() string
type CompareRequest ¶
func NewCompareRequest ¶
func NewCompareRequest(dn, name, value string) (req *CompareRequest)
type Connection ¶
type Connection struct {
IsTLS bool
IsSSL bool
Debug bool
Addr string
NetworkConnectTimeout time.Duration
ReadTimeout time.Duration
AbandonMessageOnReadTimeout bool
TlsConfig *tls.Config
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(address string) *Connection
NewConnection creates a new Connection object. The address is in the same format as used in the net package.
func NewSSLConnection ¶
func NewSSLConnection(address string, tlsConfig *tls.Config) *Connection
Behaves like NewConnection, except that an additional parameter tlsConfig is expected. The resulting connection uses SSL.
func NewTLSConnection ¶
func NewTLSConnection(address string, tlsConfig *tls.Config) *Connection
Behaves like NewConnection, except that an additional parameter tlsConfig is expected. The resulting connection uses TLS.
func (*Connection) Abandon ¶
func (l *Connection) Abandon(abandonMessageID int64) error
Will return an error. Normally due to closed connection.
func (*Connection) Add ¶
func (l *Connection) Add(req *AddRequest) error
func (*Connection) Bind ¶
func (l *Connection) Bind(username, password string) error
Simple bind to the server. If using a timeout you should close the connection on a bind failure.
func (*Connection) Compare ¶
func (l *Connection) Compare(req *CompareRequest) (bool, error)
func (*Connection) Connect ¶
func (l *Connection) Connect() error
Connect connects using information in Connection. Connection should be populated with connection information.
func (*Connection) Delete ¶
func (l *Connection) Delete(delReq *DeleteRequest) (error error)
func (*Connection) Modify ¶
func (l *Connection) Modify(modReq *ModifyRequest) error
func (*Connection) Passwd ¶
func (l *Connection) Passwd(req *PasswordModifyRequest) error
func (*Connection) Search ¶
func (l *Connection) Search(searchRequest *SearchRequest) (*SearchResult, error)
Search is a blocking search. nil error on success.
func (*Connection) SearchWithHandler ¶
func (l *Connection) SearchWithHandler( searchRequest *SearchRequest, resultHandler SearchResultHandler, errorChan chan<- error, ) error
SearchWithHandler is the workhorse. Sends requests, decodes results and passes on to SearchResultHandlers to process.
SearchResultHandler, an interface, implemeneted by SearchResult. Handles the discreteSearchResults. Can provide own implemented to work on a result by result basis. errorChan - if nil then blocking, else error returned via channel upon completion. returns error if blocking.
func (*Connection) SearchWithPaging ¶
func (l *Connection) SearchWithPaging(searchRequest *SearchRequest, pagingSize uint32) (*SearchResult, error)
SearchWithPaging adds a paging control to the the searchRequest, with a size of pagingSize. It combines all the paged results into the returned SearchResult. It is a helper function for use with servers that require paging for certain result sizes (AD?).
It is NOT an efficent way to process huge result sets i.e. it doesn't process on a pageSize number of entries, it returns the combined result.
type ConnectionInfo ¶
type ConnectionInfo struct {
Conn *Connection
MessageID int64
}
type Control ¶
type Control interface {
Encode() (*ber.Packet, error)
GetControlType() ControlType
String() string
}
Control Interface
func FindControl ¶
func FindControl(controls []Control, controlType ControlType) (position int, control Control)
func NewControlServerSideSortResponse ¶
SortResult ::= SEQUENCE {
sortResult ENUMERATED {
success (0), -- results are sorted
operationsError (1), -- server internal failure
timeLimitExceeded (3), -- timelimit reached before
-- sorting was completed
strongAuthRequired (8), -- refused to return sorted
-- results via insecure
-- protocol
adminLimitExceeded (11), -- too many matching entries
-- for the server to sort
noSuchAttribute (16), -- unrecognized attribute
-- type in sort key
inappropriateMatching (18), -- unrecognized or
-- inappropriate matching
-- rule in sort key
insufficientAccessRights (50), -- refused to return sorted
-- results to this client
busy (51), -- too busy to process
unwillingToPerform (53), -- unable to sort
other (80)
},
attributeType [0] AttributeDescription OPTIONAL }
func NewControlVlvResponse ¶
VirtualListViewResponse ::= SEQUENCE {
targetPosition INTEGER (0 .. maxInt),
contentCount INTEGER (0 .. maxInt),
virtualListViewResult ENUMERATED {
success (0),
operationsError (1),
protocolError (3),
unwillingToPerform (53),
insufficientAccessRights (50),
timeLimitExceeded (3),
adminLimitExceeded (11),
innapropriateMatching (18),
sortControlMissing (60),
offsetRangeError (61),
other(80),
... },
contextID OCTET STRING OPTIONAL }
func ReplaceControl ¶
type ControlMatchedValuesRequest ¶
func NewControlMatchedValuesRequest ¶
func NewControlMatchedValuesRequest(criticality bool, filter string) *ControlMatchedValuesRequest
func (*ControlMatchedValuesRequest) Decode ¶
func (c *ControlMatchedValuesRequest) Decode(p *ber.Packet) (*Control, error)
func (*ControlMatchedValuesRequest) Encode ¶
func (c *ControlMatchedValuesRequest) Encode() (p *ber.Packet, err error)
func (*ControlMatchedValuesRequest) GetControlType ¶
func (c *ControlMatchedValuesRequest) GetControlType() ControlType
func (*ControlMatchedValuesRequest) String ¶
func (c *ControlMatchedValuesRequest) String() string
type ControlPaging ¶
func NewControlPaging ¶
func NewControlPaging(PagingSize uint32) *ControlPaging
func (*ControlPaging) Encode ¶
func (c *ControlPaging) Encode() (p *ber.Packet, err error)
func (*ControlPaging) GetControlType ¶
func (c *ControlPaging) GetControlType() ControlType
func (*ControlPaging) SetCookie ¶
func (c *ControlPaging) SetCookie(Cookie []byte)
func (*ControlPaging) String ¶
func (c *ControlPaging) String() string
type ControlServerSideSortRequest ¶
type ControlServerSideSortRequest struct {
SortKeyList []ServerSideSortAttrRuleOrder
Criticality bool
}
func NewControlServerSideSortRequest ¶
func NewControlServerSideSortRequest(sortKeyList []ServerSideSortAttrRuleOrder, criticality bool) *ControlServerSideSortRequest
func (*ControlServerSideSortRequest) Decode ¶
func (c *ControlServerSideSortRequest) Decode(p *ber.Packet) (*Control, error)
func (*ControlServerSideSortRequest) Encode ¶
func (c *ControlServerSideSortRequest) Encode() (p *ber.Packet, err error)
func (*ControlServerSideSortRequest) GetControlType ¶
func (c *ControlServerSideSortRequest) GetControlType() ControlType
func (*ControlServerSideSortRequest) String ¶
func (c *ControlServerSideSortRequest) String() string
type ControlServerSideSortResponse ¶
type ControlServerSideSortResponse struct {
AttributeName string // Optional
Criticality bool
Err error
}
func (*ControlServerSideSortResponse) Encode ¶
func (c *ControlServerSideSortResponse) Encode() (p *ber.Packet, err error)
func (*ControlServerSideSortResponse) GetControlType ¶
func (c *ControlServerSideSortResponse) GetControlType() ControlType
func (*ControlServerSideSortResponse) String ¶
func (c *ControlServerSideSortResponse) String() string
type ControlString ¶
type ControlString struct {
ControlType ControlType
Criticality bool
ControlValue string
}
func NewControlManageDsaITRequest ¶
func NewControlManageDsaITRequest(criticality bool) *ControlString
func NewControlNoOpRequest ¶
func NewControlNoOpRequest() *ControlString
func NewControlPermissiveModifyRequest ¶
func NewControlPermissiveModifyRequest(criticality bool) *ControlString
func NewControlString ¶
func NewControlString(ControlType ControlType, Criticality bool, ControlValue string) *ControlString
func NewControlSubtreeDeleteRequest ¶
func NewControlSubtreeDeleteRequest(criticality bool) *ControlString
func (*ControlString) Encode ¶
func (c *ControlString) Encode() (p *ber.Packet, err error)
func (*ControlString) GetControlType ¶
func (c *ControlString) GetControlType() ControlType
func (*ControlString) String ¶
func (c *ControlString) String() string
type ControlType ¶
type ControlType string
const ( ControlTypeMatchedValuesRequest ControlType = "1.2.826.0.1.3344810.2.3" ControlTypePermissiveModifyRequest ControlType = "1.2.840.113556.1.4.1413" ControlTypePaging ControlType = "1.2.840.113556.1.4.319" ControlTypeManageDsaITRequest ControlType = "2.16.840.1.113730.3.4.2" ControlTypeSubtreeDeleteRequest ControlType = "1.2.840.113556.1.4.805" ControlTypeNoOpRequest ControlType = "1.3.6.1.4.1.4203.1.10.2" ControlTypeServerSideSortRequest ControlType = "1.2.840.113556.1.4.473" ControlTypeServerSideSortResponse ControlType = "1.2.840.113556.1.4.474" ControlTypeVlvRequest ControlType = "2.16.840.1.113730.3.4.9" ControlTypeVlvResponse ControlType = "2.16.840.1.113730.3.4.10" )
func (ControlType) String ¶
func (c ControlType) String() string
type ControlVlvRequest ¶
type ControlVlvRequest struct {
Criticality bool
BeforeCount int32
AfterCount int32
ByOffset *VlvOffSet
GreaterThanOrEqual string
ContextID []byte
}
VirtualListViewRequest ::= SEQUENCE {
beforeCount INTEGER (0..maxInt),
afterCount INTEGER (0..maxInt),
target CHOICE {
byOffset [0] SEQUENCE {
offset INTEGER (1 .. maxInt),
contentCount INTEGER (0 .. maxInt) },
greaterThanOrEqual [1] AssertionValue },
contextID OCTET STRING OPTIONAL }
func (*ControlVlvRequest) Encode ¶
func (c *ControlVlvRequest) Encode() (*ber.Packet, error)
func (*ControlVlvRequest) GetControlType ¶
func (c *ControlVlvRequest) GetControlType() string
func (*ControlVlvRequest) String ¶
func (c *ControlVlvRequest) String() string
type ControlVlvResponse ¶
type ControlVlvResponse struct {
Criticality bool
TargetPosition uint64
ContentCount uint64
Err error // VirtualListViewResult
ContextID string
}
func (*ControlVlvResponse) Encode ¶
func (c *ControlVlvResponse) Encode() (p *ber.Packet, err error)
func (*ControlVlvResponse) GetControlType ¶
func (c *ControlVlvResponse) GetControlType() ControlType
func (*ControlVlvResponse) String ¶
func (c *ControlVlvResponse) String() string
type DeleteRequest ¶
func NewDeleteRequest ¶
func NewDeleteRequest(dn string) (delReq *DeleteRequest)
func (*DeleteRequest) AddControl ¶
func (delReq *DeleteRequest) AddControl(control Control)
TDDO make generic for mod/del/search via interface.
type DiscreteSearchResult ¶
type DiscreteSearchResult struct {
SearchResultType SearchResultType
Entry *Entry
Referrals []string
Controls []Control
}
type Entry ¶
type Entry struct {
DN string
Attributes []*EntryAttribute
}
func (*Entry) AddAttributeValue ¶
AddAttributeValue - Add a single Attr value no check is done for duplicate values.
func (*Entry) AddAttributeValues ¶
AddAttributeValues - Add via a name and slice of values no check is done for duplicate values.
func (*Entry) GetAttributeIndex ¶
func (*Entry) GetAttributeValue ¶
GetAttributeValue - returning an empty string is a bad idea some directory servers will return empty attr values (Sunone). Just asking for trouble.
func (*Entry) GetAttributeValues ¶
type EntryAttribute ¶
type Error ¶
type Error struct {
ResultCode ResultCode
// contains filtered or unexported fields
}
type Mod ¶
type Mod struct {
ModOperation ModificationCode
Modification EntryAttribute
}
type ModDnRequest ¶
type ModificationCode ¶
type ModificationCode uint8
LDAP Modification operation codes
const ( ModAdd ModificationCode = 0 ModDelete ModificationCode = 1 ModReplace ModificationCode = 2 // Modify-Increment Extension [https://tools.ietf.org/html/rfc4525] ModIncrement ModificationCode = 3 )
func (ModificationCode) String ¶
func (i ModificationCode) String() string
type ModifyRequest ¶
type ModifyRequest struct {
// DN of entry that is modified
DN string
// Changes
Mods []Mod
// Server controls
Controls []Control
}
LDAP modify request [https://tools.ietf.org/html/rfc4511#section-4.6]
func NewModifyRequest ¶
func NewModifyRequest(dn string) (req *ModifyRequest)
func (*ModifyRequest) AddControl ¶
func (req *ModifyRequest) AddControl(control Control)
func (*ModifyRequest) AddMod ¶
func (req *ModifyRequest) AddMod(mod *Mod)
func (*ModifyRequest) AddMods ¶
func (req *ModifyRequest) AddMods(mods []Mod)
func (*ModifyRequest) Bytes ¶
func (req *ModifyRequest) Bytes() []byte
func (*ModifyRequest) String ¶
func (req *ModifyRequest) String() (dump string)
Basic LDIF dump, no formating, etc
type PasswordModifyRequest ¶
PasswordModifyRequest implements the payload and encoding specified in https://tools.ietf.org/html/rfc3062
func (*PasswordModifyRequest) Encode ¶
func (r *PasswordModifyRequest) Encode() (*ber.Packet, error)
Encode the PasswordModifyRequest into a ber.Packet
type ResultCode ¶
type ResultCode uint8
LDAP Result Codes
const ( ResultSuccess ResultCode = 0 ResultOperationsError ResultCode = 1 ResultProtocolError ResultCode = 2 ResultTimeLimitExceeded ResultCode = 3 ResultSizeLimitExceeded ResultCode = 4 ResultCompareFalse ResultCode = 5 ResultCompareTrue ResultCode = 6 ResultAuthMethodNotSupported ResultCode = 7 ResultStrongAuthRequired ResultCode = 8 ResultReferral ResultCode = 10 ResultAdminLimitExceeded ResultCode = 11 ResultConfidentialityRequired ResultCode = 13 ResultSaslBindInProgress ResultCode = 14 ResultNoSuchAttribute ResultCode = 16 ResultUndefinedAttributeType ResultCode = 17 ResultInappropriateMatching ResultCode = 18 ResultConstraintViolation ResultCode = 19 ResultAttributeOrValueExists ResultCode = 20 ResultInvalidAttributeSyntax ResultCode = 21 ResultNoSuchObject ResultCode = 32 ResultAliasProblem ResultCode = 33 ResultInvalidDNSyntax ResultCode = 34 ResultAliasDereferencingProblem ResultCode = 36 ResultInappropriateAuthentication ResultCode = 48 ResultInvalidCredentials ResultCode = 49 ResultInsufficientAccessRights ResultCode = 50 ResultBusy ResultCode = 51 ResultUnwillingToPerform ResultCode = 53 ResultLoopDetect ResultCode = 54 ResultNamingViolation ResultCode = 64 ResultObjectClassViolation ResultCode = 65 ResultNotAllowedOnNonLeaf ResultCode = 66 ResultNotAllowedOnRDN ResultCode = 67 ResultEntryAlreadyExists ResultCode = 68 ResultObjectClassModsProhibited ResultCode = 69 ResultAffectsMultipleDSAs ResultCode = 71 ResultOther ResultCode = 80 ErrorNetwork = 201 ErrorFilterCompile = 202 ErrorFilterDecompile = 203 ErrorDebugging = 204 ErrorEncoding = 205 ErrorDecoding = 206 ErrorMissingControl = 207 ErrorInvalidArgument = 208 ErrorLDIFRead = 209 ErrorLDIFWrite = 210 ErrorClosing = 211 ErrorUnknown = 212 )
go:generate stringer -type=ResultCode
func (ResultCode) String ¶
func (i ResultCode) String() string
type SearchRequest ¶
type SearchRequest struct {
BaseDN string
Scope Scope
DerefAliases Deref
SizeLimit int
TimeLimit int
TypesOnly bool
Filter string
Attributes []string
Controls []Control
}
SearchRequest passed to Search functions.
func NewSearchRequest ¶
func NewSimpleSearchRequest ¶
func NewSimpleSearchRequest(BaseDN string, Scope Scope, Filter string, Attributes []string) *SearchRequest
NewSimpleSearchRequest only requires four parameters and defaults the other returned SearchRequest values to typical values...
DerefAliases: NeverDerefAliases SizeLimit: 0 TimeLimit: 0 TypesOnly: false Controls: nil
func (*SearchRequest) AddControl ¶
func (req *SearchRequest) AddControl(control Control)
AddControl adds the provided control to a SearchRequest
type SearchResult ¶
func (*SearchResult) ProcessDiscreteResult ¶
func (sr *SearchResult) ProcessDiscreteResult(dsr *DiscreteSearchResult, connInfo *ConnectionInfo) (stopProcessing bool, err error)
ProcessDiscreteResult handles an individual result from a server. Member of the SearchResultHandler interface. Results are placed into a SearchResult.
func (*SearchResult) String ¶
func (sr *SearchResult) String() (dump string)
type SearchResultHandler ¶
type SearchResultHandler interface {
ProcessDiscreteResult(*DiscreteSearchResult, *ConnectionInfo) (bool, error)
}
type SearchResultType ¶
type SearchResultType uint8
const ( SearchResultEntry SearchResultType = SearchResultType(ApplicationSearchResultEntry) SearchResultReference SearchResultType = SearchResultType(ApplicationSearchResultReference) SearchResultDone SearchResultType = SearchResultType(ApplicationSearchResultDone) )
func (SearchResultType) String ¶
func (i SearchResultType) String() string
type ValueMismatchError ¶
type ValueMismatchError struct {
// contains filtered or unexported fields
}
func NewValueMismatchError ¶
func NewValueMismatchError(got interface{}) *ValueMismatchError
func (*ValueMismatchError) Error ¶
func (v *ValueMismatchError) Error() string
Source Files
¶
- abandon.go
- add.go
- applicationcode.go
- applicationcode_string.go
- bind.go
- compare.go
- conn.go
- control.go
- controltype.go
- delete.go
- deref.go
- deref_string.go
- entry.go
- error.go
- filter.go
- ldap.go
- matchingRule.go
- moddn.go
- modificationcode.go
- modificationcode_string.go
- modify.go
- passwd.go
- replace.go
- request.go
- resultcode.go
- resultcode_string.go
- scope.go
- scope_string.go
- search.go
- searchresulttype.go
- searchresulttype_string.go