Update vendored deps

This commit is contained in:
Jeff Mitchell
2016-07-22 20:11:47 -04:00
parent 787db812c2
commit 5a454e1afa
105 changed files with 2008 additions and 708 deletions

View File

@@ -16,8 +16,11 @@ import (
"gopkg.in/asn1-ber.v1"
)
// Attribute represents an LDAP attribute
type Attribute struct {
// Type is the name of the LDAP attribute
Type string
// Vals are the LDAP attribute values
Vals []string
}
@@ -32,8 +35,11 @@ func (a *Attribute) encode() *ber.Packet {
return seq
}
// AddRequest represents an LDAP AddRequest operation
type AddRequest struct {
DN string
// DN identifies the entry being added
DN string
// Attributes list the attributes of the new entry
Attributes []Attribute
}
@@ -48,10 +54,12 @@ func (a AddRequest) encode() *ber.Packet {
return request
}
// Attribute adds an attribute with the given type and values
func (a *AddRequest) Attribute(attrType string, attrVals []string) {
a.Attributes = append(a.Attributes, Attribute{Type: attrType, Vals: attrVals})
}
// NewAddRequest returns an AddRequest for the given DN, with no attributes
func NewAddRequest(dn string) *AddRequest {
return &AddRequest{
DN: dn,
@@ -59,6 +67,7 @@ func NewAddRequest(dn string) *AddRequest {
}
// Add performs the given AddRequest
func (l *Conn) Add(addRequest *AddRequest) error {
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "LDAP Request")
packet.AppendChild(ber.NewInteger(ber.ClassUniversal, ber.TypePrimitive, ber.TagInteger, l.nextMessageID(), "MessageID"))