-
Notifications
You must be signed in to change notification settings - Fork 276
Abstract common LDAP code to module. #367
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
base: stable
Are you sure you want to change the base?
Conversation
|
Hmm, this makes me wonder what else currently expects localhost to be '127.0.0.1' vs. '::1'. Assuming you ran RTs tests on your IPv6 enabled system, are the LDAP tests the only ones that failed? |
|
I'm running the tests on a dual stack system. The LDAP tests are the only ones that fail for me without this patch. A quick grep on 5.0-trunk shows this: |
|
I can't remember what broke when I tried using ip6-localhost, but switching to that will cause breakage on hosts which don't have IPv6 enabled. |
|
Oh, and given the amount of repeated code, standing up a test LDAP server feels like a good thing to abstract into a module. :) |
Yeah, that's a good thought. We have various helper modules for that reason, like lib/RT/Test.pm, lib/RT/Test/Email.pm, etc. Did you want to take a shot at updating your branch to move the that bit of LDAP server code to a module? |
|
That's what I get for opening my mouth. ;) I'm working on a new lib/RT/Test/LDAP.pm file. Fortunately this is trivial to run tests for! |
|
I've pushed a commit which creates RT::Test::LDAP and changes all the tests for LDAP (ExternalAuth and LDAPImport) to use it. |
|
Correct me if I missed something, I think it's because Debian has net.ipv6.bindv6only set to 1 by default, so IPv4 can't be mapped to IPv6? |
Does it? I'm not seeing that being the default on any of my Debian systems. |
|
I should have also showed... |
|
Hmm, does LDAP tests still fail for you? I thought IPv4 was supported when bindv6only is off via IPv4-mapped addresses. I have both IPv4 and IPv6 addresses and tests work for me. |
|
On my ~20 year old Debian box that has been running Sid for most of that time, net.ipv6.bindv6only is set to 1. My somewhat newer laptop with Debian Bookworm (must upgrade to Trixie now), has it set to 0. This might be lies, but my Sid box has this claim in the sysctl.d file that sets this: I work on packaging and RT on the Debian Sid box. I could try disabling bindv6only, but also, my PR fixes this behaviour no matter what bindv6only is set to, and removes duplicated code. |
|
I'm also open to disabling bindvonly on the basis that it might be a historical quirk of the machine I use to do this work. |
|
Assuming net.ipv6.bindv6only is defaulted to 0 now, I think we can safely skip forcing IPv4. On the other hand, I still think abstracting the duplicated code into RT::Test::LDAP is a great idea. I'd be glad to merge the change once you've updated the code. |
|
Disabling net.ipv6.bindv6only allows the tests to pass for me. I'm getting some interesting errors relating to DBIx::SearchBuilder with RT::Test::LDAP currently, so working on those, when it is ready I'll update this PR. |
091e453 to
5a3d424
Compare
|
Oops, I thought I was trying to merge into 5.0-trunk. I'll retry that rebase. |
5a3d424 to
9b3efc6
Compare
In the interests of not repeating code, let's centralise it. This also forces the use of IPv4 for LDAP test, which solves an issue when the net.ipv6.bindv6only sysctl is set. It turns out this was enabled on my dev box, and is no longer a common setting.
This restores the behaviour before 8a52894 to let Net::LDAP::Server::Test make the socket. The differnt behaviour I was seeing was due to have a non-standard sysctl setting. I have left this commit in the history incase it is useful in the future.
9b3efc6 to
37af5c9
Compare
|
It turns out the issue I was having with DBIx::SearchBuilder was fixed in 5b9c371 and I just hadn't rebased my branch for a while. I'm now passed that, and the tests are passing for me again. |
Net::LDAP::Server::Test binds to IPv6 by default if IPv6 is enabled, but Net::LDAP uses 'localhost' which resolves to an IPv4 address. Even when I switched the call to Net::LDAP->new() to use ip6-localhost it failed elsewhere due to RT using 127.0.0.1.