diff options
Diffstat (limited to '')
-rw-r--r-- | conn.go | 22 | ||||
-rw-r--r-- | filter.go | 2 | ||||
-rw-r--r-- | modify.go | 8 | ||||
-rw-r--r-- | search.go | 16 |
4 files changed, 24 insertions, 24 deletions
@@ -91,12 +91,12 @@ func (l *Conn) Close() { l.isClosing = true l.wgSender.Wait() - l.Debug.Printf("Sending quit message and waiting for confirmation\n") + l.Debug.Printf("Sending quit message and waiting for confirmation") l.chanMessage <- &messagePacket{Op: MessageQuit} <-l.chanConfirm close(l.chanMessage) - l.Debug.Printf("Closing network connection\n") + l.Debug.Printf("Closing network connection") if err := l.conn.Close(); err != nil { log.Print(err) } @@ -197,7 +197,7 @@ func (l *Conn) sendProcessMessage(message *messagePacket) bool { func (l *Conn) processMessages() { defer func() { for messageID, channel := range l.chanResults { - l.Debug.Printf("Closing channel for MessageID %d\n", messageID) + l.Debug.Printf("Closing channel for MessageID %d", messageID) close(channel) delete(l.chanResults, messageID) } @@ -213,23 +213,23 @@ func (l *Conn) processMessages() { messageID++ case messagePacket, ok := <-l.chanMessage: if !ok { - l.Debug.Printf("Shutting down - message channel is closed\n") + l.Debug.Printf("Shutting down - message channel is closed") return } switch messagePacket.Op { case MessageQuit: - l.Debug.Printf("Shutting down - quit message received\n") + l.Debug.Printf("Shutting down - quit message received") return case MessageRequest: // Add to message list and write to network - l.Debug.Printf("Sending message %d\n", messagePacket.MessageID) + l.Debug.Printf("Sending message %d", messagePacket.MessageID) l.chanResults[messagePacket.MessageID] = messagePacket.Channel // go routine buf := messagePacket.Packet.Bytes() for len(buf) > 0 { n, err := l.conn.Write(buf) if err != nil { - l.Debug.Printf("Error Sending Message: %s\n", err.Error()) + l.Debug.Printf("Error Sending Message: %s", err.Error()) break } // nothing else to send @@ -240,16 +240,16 @@ func (l *Conn) processMessages() { buf = buf[n:] } case MessageResponse: - l.Debug.Printf("Receiving message %d\n", messagePacket.MessageID) + l.Debug.Printf("Receiving message %d", messagePacket.MessageID) if chanResult, ok := l.chanResults[messagePacket.MessageID]; ok { chanResult <- messagePacket.Packet } else { - log.Printf("Received unexpected message %d\n", messagePacket.MessageID) + log.Printf("Received unexpected message %d", messagePacket.MessageID) ber.PrintPacket(messagePacket.Packet) } case MessageFinish: // Remove from message list - l.Debug.Printf("Finished message %d\n", messagePacket.MessageID) + l.Debug.Printf("Finished message %d", messagePacket.MessageID) close(l.chanResults[messagePacket.MessageID]) delete(l.chanResults, messagePacket.MessageID) } @@ -265,7 +265,7 @@ func (l *Conn) reader() { for { packet, err := ber.ReadPacket(l.conn) if err != nil { - l.Debug.Printf("reader: %s\n", err.Error()) + l.Debug.Printf("reader: %s", err.Error()) return } addLDAPDescriptions(packet) @@ -58,7 +58,7 @@ func CompileFilter(filter string) (*ber.Packet, *Error) { return nil, err } if pos != len(filter) { - return nil, NewError(ErrorFilterCompile, errors.New("ldap: finished compiling filter with extra at end.\n"+fmt.Sprint(filter[pos:]))) + return nil, NewError(ErrorFilterCompile, errors.New("ldap: finished compiling filter with extra at end: "+fmt.Sprint(filter[pos:]))) } return packet, nil } @@ -128,9 +128,9 @@ func (l *Conn) Modify(modifyRequest *ModifyRequest) *Error { } defer l.finishMessage(messageID) - l.Debug.Printf("%d: waiting for response\n", messageID) + l.Debug.Printf("%d: waiting for response", messageID) packet = <-channel - l.Debug.Printf("%d: got response %p\n", messageID, packet) + l.Debug.Printf("%d: got response %p", messageID, packet) if packet == nil { return NewError(ErrorNetwork, errors.New("ldap: could not retrieve message")) } @@ -148,9 +148,9 @@ func (l *Conn) Modify(modifyRequest *ModifyRequest) *Error { return NewError(resultCode, errors.New(resultDescription)) } } else { - log.Printf("Unexpected Response: %d\n", packet.Children[1].Tag) + log.Printf("Unexpected Response: %d", packet.Children[1].Tag) } - l.Debug.Printf("%d: returning\n", messageID) + l.Debug.Printf("%d: returning", messageID) return nil } @@ -226,7 +226,7 @@ func (l *Conn) SearchWithPaging(searchRequest *SearchRequest, pagingSize uint32) searchResult := new(SearchResult) for { result, err := l.Search(searchRequest) - l.Debug.Printf("Looking for Paging Control...\n") + l.Debug.Printf("Looking for Paging Control...") if err != nil { return searchResult, err } @@ -244,25 +244,25 @@ func (l *Conn) SearchWithPaging(searchRequest *SearchRequest, pagingSize uint32) searchResult.Controls = append(searchResult.Controls, control) } - l.Debug.Printf("Looking for Paging Control...\n") + l.Debug.Printf("Looking for Paging Control...") pagingResult := FindControl(result.Controls, ControlTypePaging) if pagingResult == nil { pagingControl = nil - l.Debug.Printf("Could not find paging control. Breaking...\n") + l.Debug.Printf("Could not find paging control. Breaking...") break } cookie := pagingResult.(*ControlPaging).Cookie if len(cookie) == 0 { pagingControl = nil - l.Debug.Printf("Could not find cookie. Breaking...\n") + l.Debug.Printf("Could not find cookie. Breaking...") break } pagingControl.SetCookie(cookie) } if pagingControl != nil { - l.Debug.Printf("Abandoning Paging...\n") + l.Debug.Printf("Abandoning Paging...") pagingControl.PagingSize = 0 l.Search(searchRequest) } @@ -303,9 +303,9 @@ func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, *Error) { foundSearchResultDone := false for !foundSearchResultDone { - l.Debug.Printf("%d: waiting for response\n", messageID) + l.Debug.Printf("%d: waiting for response", messageID) packet = <-channel - l.Debug.Printf("%d: got response %p\n", messageID, packet) + l.Debug.Printf("%d: got response %p", messageID, packet) if packet == nil { return nil, NewError(ErrorNetwork, errors.New("ldap: could not retrieve message")) } @@ -345,6 +345,6 @@ func (l *Conn) Search(searchRequest *SearchRequest) (*SearchResult, *Error) { result.Referrals = append(result.Referrals, packet.Children[1].Children[0].Value.(string)) } } - l.Debug.Printf("%d: returning\n", messageID) + l.Debug.Printf("%d: returning", messageID) return result, nil } |