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

Strange behavior when running go-ldap #1275

Closed
wiltonsr opened this issue Sep 30, 2021 · 3 comments · Fixed by #1516
Closed

Strange behavior when running go-ldap #1275

wiltonsr opened this issue Sep 30, 2021 · 3 comments · Fixed by #1516
Labels
bug Something isn't working

Comments

@wiltonsr
Copy link

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

@mvertes mvertes added the bug Something isn't working label Oct 7, 2021
@wiltonsr
Copy link
Author

wiltonsr commented Oct 28, 2021

First, thanks for this software.

@mvertes any news or some probable date to solve this problem?

@mvertes
Copy link
Member

mvertes commented Nov 3, 2021

I'm looking at it

@wiltonsr
Copy link
Author

Fixed by #1313

@mvertes mvertes reopened this Feb 28, 2023
traefiker pushed a commit that referenced this issue Mar 6, 2023
For methods defined on interfaces (vs concrete methods), the resolution of the method is necessarily delayed at the run time and can not be completed at compile time.

The selectorExpr processing has been changed to correctly identify calls on interface methods which were confused as fields rather than methods (due to the fact that in a interface definition, methods are fields of the interface).

Then at runtime, method lookup has been fixed to correctly recurse in nested valueInterface wrappers and to find embedded interface fields in case of struct or pointer to struct.

Finally, remove receiver processing in `call()`.The receiver is already processed at method resolution and in genFunctionWrapper. Removing redundant processing in call fixes handling of variadic method, simplifies the code and makes it faster.

With those fixes, it is now possible to load and run `go.uber.org/zap` in yaegi. In turn, it makes possible for yaegi to run plugins dependent on zap, such as coraza-waf.

Fixes #1515, 
Fixes #1172,
Fixes #1275,
Fixes #1485.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants