Defect #44526
closed500 error when the LDAP server is unreachable on macOS 26.7
Description
On macOS 26.7, if the LDAP server is unreachable, logging in as an LDAP user or authenticating to the REST API with HTTP Basic authentication results in a 500 error instead of an authentication error.
This is because Socket.tcp with connect_timeout, which net-ldap uses, returns a socket even when the connection is refused, and the subsequent write raises Errno::EPIPE. Since Errno::EPIPE is not included in AuthSourceLdap::NETWORK_EXCEPTIONS, it is not converted to AuthSourceException.
As a result, the following tests also fail on macOS 26.7:
- test/unit/user_test.rb
test_#try_to_login!_using_LDAP_with_existing_user_and_failed_connection_to_the_LDAP_servertest_#try_to_login_using_LDAP_with_existing_user_and_failed_connection_to_the_LDAP_server
- test/integration/api_test/users_test.rb
test_GET_/users/:id.json_should_not_include_auth_source_for_standard_user
The attached patch adds Errno::EPIPE to NETWORK_EXCEPTIONS. This exception can also occur on other platforms when the peer closes the connection, so I think it should be handled in the same way as Errno::ECONNRESET.
Files
Related issues
Updated by Go MAEDA about 6 hours ago
- Related to Patch #21137: Rescue network level errors with LDAP auth added
Updated by Go MAEDA about 6 hours ago
- Status changed from New to Resolved
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the patch in r25142.