ldap

package
v0.0.0-...-43c2f11 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: PostgreSQL Imports: 23 Imported by: 0

Documentation

Overview

Implement dynamic formatting from LDAP entry.

Implements ldap.conf(5)

Index

Constants

This section is empty.

Variables

View Source
var KnownRDNs = []string{"cn", "l", "st", "o", "ou", "c", "street", "dc", "uid"}

Functions

func CleanFilter

func CleanFilter(filter string) string

Prepare a YAML filter string for compilation by ldapv3.CompileFilter. go-ldap is stricter than openldap when implementing RFC4515 filter. No spaces are allowed around parenthesises.

func IsErrorRecoverable

func IsErrorRecoverable(err error) bool

Implements retry.RetryIfFunc

func LogRetryError

func LogRetryError(n uint, err error)

Implements retry.OnRetryFunc

func NeedsQuote

func NeedsQuote(s string) bool

func ResolveFirstRDN

func ResolveFirstRDN(rawDN, relativeField string) (string, error)

func ShellQuote

func ShellQuote(arg string) string

Types

type Client

type Client struct {
	URI         string
	BindDN      string
	SaslMech    string
	SaslAuthCID string
	Timeout     time.Duration
	Password    string
	Conn        *ldap3.Conn
}

func Connect

func Connect() (client Client, err error)

func (Client) Command

func (c Client) Command(name string, args ...string) string

func (*Client) Search

func (c *Client) Search(base string, scope Scope, filter string, attributes []string) (*ldap3.SearchResult, error)

type Result

type Result struct {
	// Is nil for static generation
	Entry *ldap3.Entry
	// Is empty if no sub-search.
	SubsearchAttribute string
	SubsearchEntries   []*ldap3.Entry
}

Holds a consistent set of entry and sub-search entries.

func (*Result) GenerateCombinations

func (r *Result) GenerateCombinations(attributes, subKeys []string) <-chan map[string]string

func (*Result) GenerateSubsearchValues

func (r *Result) GenerateSubsearchValues(parentExpressions []string) map[string]map[string]string

Return a list of expression -> values for formatting, indexed by a string key.

func (*Result) GenerateValues

func (r *Result) GenerateValues(fmts ...pyfmt.Format) <-chan map[string]string

func (*Result) ResolveExpressions

func (r *Result) ResolveExpressions(expressions []string, attrValues map[string]string, subExprMap map[string]map[string]string) map[string]string

Resolve format expression from entry or pre-resolved expression for sub-entries.

type Scope

type Scope int

func ParseScope

func ParseScope(s string) (Scope, error)

func (Scope) String

func (s Scope) String() string
type Search struct {
	Base        string
	Scope       Scope
	Filter      string
	Attributes  []string
	Subsearches map[string]Subsearch `mapstructure:"joins"`
}

func (Search) SubsearchAttribute

func (s Search) SubsearchAttribute() string

type Subsearch

type Subsearch struct {
	Filter     string
	Scope      Scope
	Attributes []string
}

Jump to

Keyboard shortcuts

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