Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bind fails when (empty) extensions are sent #22

Open
vetinari opened this issue May 4, 2018 · 0 comments
Open

bind fails when (empty) extensions are sent #22

vetinari opened this issue May 4, 2018 · 0 comments

Comments

@vetinari
Copy link

vetinari commented May 4, 2018

This happens when you use the go-ldap client (https://github.com/go-ldap/ldap), the error is always

2018/05/04 15:11:17 Error reading Message : ReadLDAPMessage:
ReadSubBytes:
readComponents:
readProtocolOp:
readBindRequest:
ReadSubBytes: data too long: 18 more bytes to read at offset 5
        301702010160120201030406636e3d616e798003616e79a000

The difference to e.g. the openldap client can be seen down below, still both messages are valid ASN.1 BER encoded messages and both clients work everywhere else ...
Note: the default go encoding/asn1 package is DER encoding

package main

import (
    "bytes"
    "fmt"

    "gopkg.in/asn1-ber.v1"
)

func main() {
    var msgGo = []byte("0\027\002\001\001`\022\002\001\003\004\006cn=any\200\003any\240\000")
    var msgOLDAP = []byte("0\025\002\001\001`\020\002\001\003\004\006cn=any\200\003any")

    for i, msg := range [][]byte{msgGo, msgOLDAP} {
        buf := bytes.NewBuffer([]byte(msg))
        p, err := ber.ReadPacket(buf)
        if err != nil {
            fmt.Printf("failed to read packet %d: %s\n", i, err)
            continue
        } else {
            ber.PrintPacket(p)
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant