Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Improve BindException "Can't contact LDAP server" #813

Open
@Sebbo94BY

Description

@Sebbo94BY
  • Laravel Version: 6.5 (not relevant; doesn't matter)
  • Adldap2-Laravel Version: 6.0.8
  • PHP Version: 7.2 (not relevant; doesn't matter)
  • LDAP Type: ActiveDirectory (not relevant; doesn't matter)

Description:

When this library is unable to bind to the AD or any other LDAP server, it throws the BindException "Can't contact LDAP server".

Especially when you're trying to get a SSL connection working, this is really hard to debug.

Is it possible to add somehow the real reason (eg. certificate verify failed) for the BindException to the exception message or at least to the logs?

This would help everyone here to debug such issues much more easy in the future.

In best case, those error reasons will be always logged - even when logging is disabled.

I would expect something like this in the exception message or in the logs:

Can't contact LDAP server: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed (unable to get local issuer certificate))

You usually get such error messages when you execute a PHP script from a command line with ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);.

But ldap_error( resource $link_identifier ) should return the same result: https://www.php.net/manual/en/function.ldap-error.php

Steps To Reproduce:

Just configure some wrong LDAP connection settings and try to get any kind of information from the LDAP server.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions