-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
sdk/ldap: update interface to use DialURL #20200
Conversation
sdk/helper/ldaputil/ldap.go
Outdated
@@ -16,16 +14,11 @@ func NewLDAP() LDAP { | |||
// LDAP provides ldap functionality, but through an interface | |||
// rather than statically. This allows faking it for tests. | |||
type LDAP interface { | |||
Dial(network, addr string) (Connection, error) | |||
DialTLS(network, addr string, config *tls.Config) (Connection, error) | |||
Dial(addr string, opts ...ldap.DialOpt) (Connection, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this change will have consequences for both vault-plugin-secrets-openldap and vault-plugin-secrets-ad. I think that is ok though? From what I can see these are only used in tests and it should be easy enough to update the tests if/when we update the sdk/ldaputil dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will, the mocks need updating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly had concerns about the missing URL scheme.
Also, do any tests need to be updated?
The tests use the client DialLDAP method, so they shouldn't need updating. |
* sdk/ldap: update interface to use DialURL * Fix scheme * Fix race condition * Add tls config dialopt
* sdk/ldap: update interface to use DialURL * Fix scheme * Fix race condition * Add tls config dialopt
I recently merged #20144 which adds connection timeout configuration, however, this was causing race tests to fail since it was changing a package variable. To fix this, I've changed the LDAP interface to use the suggested
ldap.DialURL
function instead of the deprecatedldap.Dial
andldap.DialTLS
functions.