summaryrefslogtreecommitdiffstats
path: root/ldap.go
diff options
context:
space:
mode:
authorMichael Mitton <mmitton@gmail.com>2011-02-18 19:19:03 +0100
committerMichael Mitton <mmitton@gmail.com>2011-02-18 19:19:03 +0100
commit590a6676fd5851f1b6dd184bb47c5557c2b855d8 (patch)
treeac25dd1b0c3410c2ffc9508aa4cd2bc8d379c10e /ldap.go
parentFixed error checking (diff)
downloadldap-590a6676fd5851f1b6dd184bb47c5557c2b855d8.tar
ldap-590a6676fd5851f1b6dd184bb47c5557c2b855d8.tar.gz
ldap-590a6676fd5851f1b6dd184bb47c5557c2b855d8.tar.bz2
ldap-590a6676fd5851f1b6dd184bb47c5557c2b855d8.tar.lz
ldap-590a6676fd5851f1b6dd184bb47c5557c2b855d8.tar.xz
ldap-590a6676fd5851f1b6dd184bb47c5557c2b855d8.tar.zst
ldap-590a6676fd5851f1b6dd184bb47c5557c2b855d8.zip
Diffstat (limited to '')
-rw-r--r--ldap.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/ldap.go b/ldap.go
index 22605e3..d331c81 100644
--- a/ldap.go
+++ b/ldap.go
@@ -289,3 +289,18 @@ func (e *Error) String() string {
func NewError( ResultCode uint8, Err os.Error ) (* Error) {
return &Error{ ResultCode: ResultCode, Err: Err }
}
+
+func getLDAPResultCode( p *ber.Packet ) ( code uint8, description string ) {
+ if len( p.Children ) >= 2 {
+ response := p.Children[ 1 ]
+ if response.ClassType == ber.ClassApplication && response.TagType == ber.TypeConstructed && len( response.Children ) == 3 {
+ code = uint8(response.Children[ 0 ].Value.(uint64))
+ description = response.Children[ 2 ].Value.(string)
+ return
+ }
+ }
+
+ code = ErrorNetwork
+ description = "Invalid packet format"
+ return
+}