Skip to content

Strange behavior when running go-ldap #1275

Closed
@wiltonsr

Description

@wiltonsr

The following program sample.go triggers an unexpected result

package main

import (
	"fmt"

	"github.com/go-ldap/ldap/v3"
)

func main() {
	conn, err := ldap.Dial("tcp", fmt.Sprintf("%s:%d", "ldap.forumsys.com", 389))
	fmt.Println(err)
	defer conn.Close()
	conn.Debug = true
	conn.Bind("uid=tesla,dc=example,dc=com", "password")
}

Expected result

<nil>
LDAP Request: (Universal, Constructed, Sequence and Sequence of) Len=47 "<nil>"
 MessageID: (Universal, Primitive, Integer) Len=1 "1"
 Bind Request: (Application, Constructed, 0x00) Len=42 "<nil>"
  Version: (Universal, Primitive, Integer) Len=1 "3"
  User Name: (Universal, Primitive, Octet String) Len=27 "uid=tesla,dc=example,dc=com"
  Password: (Context, Primitive, 0x00) Len=8 "password"
2021/09/30 12:49:22 flags&startTLS = 0
2021/09/30 12:49:22 1: returning
2021/09/30 12:49:22 1: waiting for response
2021/09/30 12:49:22 Sending message 1
2021/09/30 12:49:22 Receiving message 1
2021/09/30 12:49:22 1: got response 0xc0001b0000
LDAP Response: (Universal, Constructed, Sequence and Sequence of) Len=12 "<nil>"
 Message ID: (Universal, Primitive, Integer) Len=1 "1"
 Bind Response: (Application, Constructed, 0x01) Len=7 "<nil>"
  Result Code (Success): (Universal, Primitive, Enumerated) Len=1 "0"
  Matched DN (): (Universal, Primitive, Octet String) Len=0 ""
  Success: (Universal, Primitive, Octet String) Len=0 ""
2021/09/30 12:49:22 Sending quit message and waiting for confirmation
2021/09/30 12:49:22 Finished message 1
2021/09/30 12:49:22 Shutting down - quit message received
2021/09/30 12:49:22 Closing network connection

Got

<nil>
LDAP Request: (Universal, Constructed, 0x10) Len=47 "<nil>"
 MessageID: (Universal, Primitive, 0x02) Len=1 "1"
 Bind Request: (Application, Constructed, EOC (End-of-Content)) Len=42 "<nil>"
  Version: (Universal, Primitive, 0x02) Len=1 "3"
  User Name: (Universal, Primitive, 0x04) Len=27 "uid=tesla,dc=example,dc=com"
  Password: (Context, Primitive, EOC (End-of-Content)) Len=8 "password"
2021/09/30 12:49:53 flags&startTLS = 0
2021/09/30 12:49:53 1: returning
2021/09/30 12:49:53 1: waiting for response
2021/09/30 12:49:53 Sending message 1
2021/09/30 12:49:53 descriptions error: LDAP Result Code 203 "Debugging Error": ldap: cannot process packet to add descriptions: reflect: slice index out of range
2021/09/30 12:49:53 Received bad ldap packet


* The execution don't finish *

Yaegi Version

devel

Additional Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions