Skip to content

Commit

Permalink
update docs, changes needed for go-ldap#57
Browse files Browse the repository at this point in the history
  • Loading branch information
vetinari authored and jamesboswell committed Dec 21, 2017
1 parent 02b37c2 commit 495943b
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions moddn.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,18 @@ type ModifyDNRequest struct {
NewSuperior string
}

// set "newSup" to empty string for just renaming, to move w/o renaming the "rdn" must be the first
// RDN of the given DN
// NewModifyDNRequest creates a new request which can be passed to ModifyDN().
//
// To move an object in the tree, set the "newSup" to the new parent entry DN. Use an
// empty string for just changing the object's RDN.
//
// For moving the object without renaming the "rdn" must be the first
// RDN of the given DN.
//
// A call like
// mdnReq := NewModifyDNRequest("uid=someone,dc=example,dc=org", "uid=newname", true, "")
// will setup the request to just rename uid=someone,dc=example,dc=org to
// uid=newname,dc=example,dc=org.
func NewModifyDNRequest(dn string, rdn string, delOld bool, newSup string) *ModifyDNRequest {
return &ModifyDNRequest{
DN: dn,
Expand Down Expand Up @@ -68,7 +78,11 @@ func (l *Conn) ModifyDN(m *ModifyDNRequest) error {
defer l.finishMessage(messageID)

l.Debug.Printf("%d: waiting for response", messageID)
packet = <-channel
packetResponse, ok := <-channel
if !ok {
return NewError(ErrorNetwork, errors.New("ldap: channel closed"))
}
packet, err = packetResponse.ReadPacket()
l.Debug.Printf("%d: got response %p", messageID, packet)
if packet == nil {
return NewError(ErrorNetwork, errors.New("ldap: could not retrieve message"))
Expand All @@ -93,5 +107,3 @@ func (l *Conn) ModifyDN(m *ModifyDNRequest) error {
l.Debug.Printf("%d: returning", messageID)
return nil
}

// vim: ts=4 sw=4 noexpandtab nolist

0 comments on commit 495943b

Please sign in to comment.