From d1c9906e5f9291adbc5f52591d8d89acca201adb Mon Sep 17 00:00:00 2001 From: Michael Mitton Date: Fri, 18 Feb 2011 13:18:26 -0500 Subject: Fixed error checking --- bind.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'bind.go') diff --git a/bind.go b/bind.go index 9176eca..b941f0c 100644 --- a/bind.go +++ b/bind.go @@ -35,7 +35,7 @@ func (l *Conn) Bind( username, password string ) *Error { defer l.finishMessage( messageID ) packet = <-channel - if packet != nil { + if packet == nil { return NewError( ErrorNetwork, os.NewError( "Could not retrieve response" ) ) } @@ -46,5 +46,10 @@ func (l *Conn) Bind( username, password string ) *Error { ber.PrintPacket( packet ) } + result_code, result_description := getLDAPResultCode( packet ) + if result_code != 0 { + return NewError( result_code, os.NewError( result_description ) ) + } + return nil } -- cgit v1.2.3