Documentation
¶
Overview ¶
Package ldif contains utilities for working with ldif data
Package ldif contains an LDIF parser and marshaller (RFC 2849).
Index ¶
- Variables
- func Dump(fh io.Writer, fw int, entries ...interface{}) error
- func Marshal(l *LDIF) (data string, err error)
- func MarshalBuffer(l *LDIF, output io.Writer) (err error)
- func Unmarshal(r io.Reader, l *LDIF) error
- func UnmarshalBuffer(r io.Reader, l *LDIF) (error, chan *Entry)
- type Entry
- type LDIF
- type ParseError
Constants ¶
This section is empty.
Variables ¶
var ErrMixed = errors.New("cannot mix change records and content records")
ErrMixed is the error, that we cannot mix change records and content records in one LDIF
Functions ¶
func Dump ¶
Dump writes the given entries to the io.Writer.
The entries argument can be *ldap.Entry or a mix of *ldap.AddRequest, *ldap.DelRequest, *ldap.ModifyRequest and *ldap.ModifyDNRequest or slices of any of those.
See Marshal() for the fw argument.
func MarshalBuffer ¶
Marshal writes LDIF string to the specified Buffer.
The default line lenght is 76 characters. This can be changed by setting the fw parameter to something else than 0. For a fold width < 0, no folding will be done, with 0, the default is used.
Types ¶
type Entry ¶
type Entry struct { Entry *ldap.Entry Add *ldap.AddRequest Del *ldap.DelRequest Modify *ldap.ModifyRequest Err *ParseError }
Entry is one entry in the LDIF
type LDIF ¶
type LDIF struct { Entries []*Entry Version int FoldWidth int Controls bool // contains filtered or unexported fields }
The LDIF struct is used for parsing an LDIF. The Controls is used to tell the parser to ignore any controls found when parsing (default: false to ignore the controls). FoldWidth is used for the line lenght when marshalling.
func ParseWithControls ¶
ParseWithControls wraps Unmarshal to parse an LDIF from a string, controls are added to change records
func ToLDIF ¶
ToLDIF puts the given arguments in an LDIF struct and returns it.
The entries argument can be *ldap.Entry or a mix of *ldap.AddRequest, *ldap.DelRequest, *ldap.ModifyRequest and *ldap.ModifyDNRequest or slices of any of those.
func (*LDIF) AllEntries ¶
func (l *LDIF) AllEntries() (entries []*ldap.Entry)
AllEntries returns all *ldap.Entries in the LDIF
func (*LDIF) Apply ¶
Apply sends the LDIF entries to the server and does the changes as given by the entries.
All *ldap.Entry are converted to an *ldap.AddRequest.
By default, it returns on the first error. To continue with applying the LDIF, set the continueOnErr argument to true - in this case the errors are logged with log.Printf()
type ParseError ¶
The ParseError holds the error message and the line in the ldif where the error occurred.