Closed anchan42 closed 1 year ago
Hi @anchan42, thank you for your sponsorship! Much appreciated ā¤ļø
To authenticate with Laravel's Auth
facade, you must also configure the ldap
driver inside of your config/auth.php
file.
You can replace the existing users
entry in the config file with the one below:
Important: This assumes you have a database connection setup, such as SQLite, or MySQL.
// config/auth.php
'providers' => [
// ...
'users' => [
'driver' => 'ldap',
'model' => LdapRecord\Models\ActiveDirectory\User::class,
'rules' => [],
'scopes' => [],
'database' => [
'model' => App\Models\User::class,
'sync_passwords' => false,
'sync_attributes' => [
'name' => 'cn',
'email' => 'userprincipalname',
],
],
],
],
Afterwards, try authenticating again, the same way you've attempted above:
use Illuminate\Support\Facades\Auth;
$credentials = [
'userprincipalname' => 'username@company.com',
'password' => 'password',
];
Auth::attempt($credentials);
I did that and tried many different settings too.
This is my current settings.
'users' => [
'driver' => 'ldap',
'model' => LdapRecord\Models\ActiveDirectory\User::class,
'database' => [
'model' => App\Models\User::class,
'rules' => [],
'scopes' => [],
'sync_passwords' => true,
'sync_attributes' => [
'username' => 'samaccountname',
'email' => 'mail',
'first_name' => 'cn',
],
'sync_existing' => [
'username' => 'samaccountname',
],
],
],
I don't think php artisan ldap:browse use the config. Maybe I should try to fix that first?
Is the exception still being thrown that you've posted in the title of this post? What happens when you call Auth::attempt()
now?
Could you enable LDAP logging inside of your config/ldap.php
or .env
file, attempt logging in again, then view your logs in storage/logs
?
LDAP_LOGGING=true
Once you do that, post your results here (with sensitive details omitted). It should lead to why authentication isn't working.
The exception in the title is when I run php artisan ldap:browse and then choose inspect.
Below is the logI got when I ran Auth::attempt() in Tinker. The tinker console returns false.
[2023-09-24 12:33:43] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Binding - Username:
[2023-09-24 12:33:43] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Bound - Username:
[2023-09-24 12:33:43] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Binding - Username:
[2023-09-24 12:33:43] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Bound - Username:
[2023-09-24 12:33:43] local.ERROR: ldap_search(): Search: Operations error {"exception":"[object] (LdapRecord\\LdapRecordException(code: 2): ldap_search(): Search: Operations error at C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\LdapRecordException.php:19)
[stacktrace]
#0 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\HandlesConnection.php(174): LdapRecord\\LdapRecordException::withDetailedError(Object(ErrorException), Object(LdapRecord\\DetailedError))
#1 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(197): LdapRecord\\Ldap->executeFailableOperation(Object(Closure))
#2 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(574): LdapRecord\\Ldap->search('dc=Triumphmotor...', '(&(objectclass=...', Array, false, 1)
#3 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(350): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}(Object(LdapRecord\\Ldap))
#4 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(418): LdapRecord\\Connection->runOperationCallback(Object(Closure))
#5 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(400): LdapRecord\\Connection->retry(Object(Closure))
#6 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(310): LdapRecord\\Connection->tryAgainIfCausedByLostConnection(Object(LdapRecord\\LdapRecordException), Object(Closure))
#7 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(563): LdapRecord\\Connection->run(Object(Closure))
#8 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(351): LdapRecord\\Query\\Builder->run('(&(objectclass=...')
#9 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(549): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#10 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(353): LdapRecord\\Query\\Builder->getCachedResponse('(&(objectclass=...', Object(Closure))
#11 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(186): LdapRecord\\Query\\Builder->query('(&(objectclass=...')
#12 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(203): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#13 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(185): LdapRecord\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#14 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(639): LdapRecord\\Query\\Builder->get(Array)
#15 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(104): LdapRecord\\Query\\Builder->first(Array)
#16 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord-laravel\\src\\LdapUserRepository.php(91): LdapRecord\\Query\\Model\\Builder->first()
#17 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord-laravel\\src\\Auth\\UserProvider.php(40): LdapRecord\\Laravel\\LdapUserRepository->findByCredentials(Array)
#18 [internal function]: LdapRecord\\Laravel\\Auth\\UserProvider->LdapRecord\\Laravel\\Auth\\{closure}(Array)
#19 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord-laravel\\src\\Auth\\UserProvider.php(62): call_user_func(Object(Closure), Array)
#20 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord-laravel\\src\\Auth\\DatabaseUserProvider.php(139): LdapRecord\\Laravel\\Auth\\UserProvider->fetchLdapUserByCredentials(Array)
#21 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\helpers.php(224): LdapRecord\\Laravel\\Auth\\DatabaseUserProvider->LdapRecord\\Laravel\\Auth\\{closure}()
#22 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord-laravel\\src\\Auth\\DatabaseUserProvider.php(145): value(Object(Closure))
#23 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Auth\\SessionGuard.php(381): LdapRecord\\Laravel\\Auth\\DatabaseUserProvider->retrieveByCredentials(Array)
#24 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Auth\\AuthManager.php(340): Illuminate\\Auth\\SessionGuard->attempt(Array)
#25 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(353): Illuminate\\Auth\\AuthManager->__call('attempt', Array)
#26 C:\\laragon\\www\\TheProject\\vendor\\psy\\psysh\\src\\ExecutionLoopClosure.php(53) : eval()'d code(1): Illuminate\\Support\\Facades\\Facade::__callStatic('attempt', Array)
#27 C:\\laragon\\www\\TheProject\\vendor\\psy\\psysh\\src\\ExecutionLoopClosure.php(53): eval()
#28 C:\\laragon\\www\\TheProject\\vendor\\psy\\psysh\\src\\ExecutionClosure.php(89): Psy\\{closure}()
#29 C:\\laragon\\www\\TheProject\\vendor\\psy\\psysh\\src\\Shell.php(396): Psy\\ExecutionClosure->execute()
#30 C:\\laragon\\www\\TheProject\\vendor\\psy\\psysh\\src\\Shell.php(367): Psy\\Shell->doInteractiveRun()
#31 C:\\laragon\\www\\TheProject\\vendor\\symfony\\console\\Application.php(174): Psy\\Shell->doRun(Object(Symfony\\Component\\Console\\Input\\ArrayInput), Object(Psy\\Output\\ShellOutput))
#32 C:\\laragon\\www\\TheProject\\vendor\\psy\\psysh\\src\\Shell.php(342): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArrayInput), Object(Psy\\Output\\ShellOutput))
#33 C:\\laragon\\www\\TheProject\\vendor\\laravel\\tinker\\src\\Console\\TinkerCommand.php(85): Psy\\Shell->run()
#34 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(36): Laravel\\Tinker\\Console\\TinkerCommand->handle()
#35 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#36 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#37 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#38 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#39 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(211): Illuminate\\Container\\Container->call(Array)
#40 C:\\laragon\\www\\TheProject\\vendor\\symfony\\console\\Command\\Command.php(326): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#41 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(180): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#42 C:\\laragon\\www\\TheProject\\vendor\\symfony\\console\\Application.php(1081): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#43 C:\\laragon\\www\\TheProject\\vendor\\symfony\\console\\Application.php(320): Symfony\\Component\\Console\\Application->doRunCommand(Object(Laravel\\Tinker\\Console\\TinkerCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#44 C:\\laragon\\www\\TheProject\\vendor\\symfony\\console\\Application.php(174): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#45 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(201): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#46 C:\\laragon\\www\\TheProject\\artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#47 {main}
[previous exception] [object] (ErrorException(code: 2): ldap_search(): Search: Operations error at C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php:207)
[stacktrace]
#0 [internal function]: LdapRecord\\Ldap->LdapRecord\\{closure}(2, 'ldap_search(): ...', 'C:\\\\laragon\\\\www\\\\...', 207)
#1 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(207): ldap_search(Object(LDAP\\Connection), 'dc=Triumphmotor...', '(&(objectclass=...', Array, false, 1, 0, 0, NULL)
#2 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\HandlesConnection.php(161): LdapRecord\\Ldap->LdapRecord\\{closure}()
#3 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(197): LdapRecord\\Ldap->executeFailableOperation(Object(Closure))
#4 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(574): LdapRecord\\Ldap->search('dc=Triumphmotor...', '(&(objectclass=...', Array, false, 1)
#5 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(350): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}(Object(LdapRecord\\Ldap))
#6 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(418): LdapRecord\\Connection->runOperationCallback(Object(Closure))
#7 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(400): LdapRecord\\Connection->retry(Object(Closure))
#8 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(310): LdapRecord\\Connection->tryAgainIfCausedByLostConnection(Object(LdapRecord\\LdapRecordException), Object(Closure))
#9 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(563): LdapRecord\\Connection->run(Object(Closure))
#10 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(351): LdapRecord\\Query\\Builder->run('(&(objectclass=...')
#11 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(549): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#12 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(353): LdapRecord\\Query\\Builder->getCachedResponse('(&(objectclass=...', Object(Closure))
#13 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(186): LdapRecord\\Query\\Builder->query('(&(objectclass=...')
#14 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(203): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#15 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(185): LdapRecord\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#16 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(639): LdapRecord\\Query\\Builder->get(Array)
#17 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(104): LdapRecord\\Query\\Builder->first(Array)
#18 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord-laravel\\src\\LdapUserRepository.php(91): LdapRecord\\Query\\Model\\Builder->first()
#19 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord-laravel\\src\\Auth\\UserProvider.php(40): LdapRecord\\Laravel\\LdapUserRepository->findByCredentials(Array)
#20 [internal function]: LdapRecord\\Laravel\\Auth\\UserProvider->LdapRecord\\Laravel\\Auth\\{closure}(Array)
#21 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord-laravel\\src\\Auth\\UserProvider.php(62): call_user_func(Object(Closure), Array)
#22 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord-laravel\\src\\Auth\\DatabaseUserProvider.php(139): LdapRecord\\Laravel\\Auth\\UserProvider->fetchLdapUserByCredentials(Array)
#23 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\helpers.php(224): LdapRecord\\Laravel\\Auth\\DatabaseUserProvider->LdapRecord\\Laravel\\Auth\\{closure}()
#24 C:\\laragon\\www\\TheProject\\vendor\\directorytree\\ldaprecord-laravel\\src\\Auth\\DatabaseUserProvider.php(145): value(Object(Closure))
#25 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Auth\\SessionGuard.php(381): LdapRecord\\Laravel\\Auth\\DatabaseUserProvider->retrieveByCredentials(Array)
#26 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Auth\\AuthManager.php(340): Illuminate\\Auth\\SessionGuard->attempt(Array)
#27 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(353): Illuminate\\Auth\\AuthManager->__call('attempt', Array)
#28 C:\\laragon\\www\\TheProject\\vendor\\psy\\psysh\\src\\ExecutionLoopClosure.php(53) : eval()'d code(1): Illuminate\\Support\\Facades\\Facade::__callStatic('attempt', Array)
#29 C:\\laragon\\www\\TheProject\\vendor\\psy\\psysh\\src\\ExecutionLoopClosure.php(53): eval()
#30 C:\\laragon\\www\\TheProject\\vendor\\psy\\psysh\\src\\ExecutionClosure.php(89): Psy\\{closure}()
#31 C:\\laragon\\www\\TheProject\\vendor\\psy\\psysh\\src\\Shell.php(396): Psy\\ExecutionClosure->execute()
#32 C:\\laragon\\www\\TheProject\\vendor\\psy\\psysh\\src\\Shell.php(367): Psy\\Shell->doInteractiveRun()
#33 C:\\laragon\\www\\TheProject\\vendor\\symfony\\console\\Application.php(174): Psy\\Shell->doRun(Object(Symfony\\Component\\Console\\Input\\ArrayInput), Object(Psy\\Output\\ShellOutput))
#34 C:\\laragon\\www\\TheProject\\vendor\\psy\\psysh\\src\\Shell.php(342): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArrayInput), Object(Psy\\Output\\ShellOutput))
#35 C:\\laragon\\www\\TheProject\\vendor\\laravel\\tinker\\src\\Console\\TinkerCommand.php(85): Psy\\Shell->run()
#36 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(36): Laravel\\Tinker\\Console\\TinkerCommand->handle()
#37 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#38 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#39 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#40 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#41 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(211): Illuminate\\Container\\Container->call(Array)
#42 C:\\laragon\\www\\TheProject\\vendor\\symfony\\console\\Command\\Command.php(326): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#43 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(180): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#44 C:\\laragon\\www\\TheProject\\vendor\\symfony\\console\\Application.php(1081): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#45 C:\\laragon\\www\\TheProject\\vendor\\symfony\\console\\Application.php(320): Symfony\\Component\\Console\\Application->doRunCommand(Object(Laravel\\Tinker\\Console\\TinkerCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#46 C:\\laragon\\www\\TheProject\\vendor\\symfony\\console\\Application.php(174): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#47 C:\\laragon\\www\\TheProject\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(201): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#48 C:\\laragon\\www\\TheProject\\artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#49 {main}
"}
This exception is usually due to an invalid or incorrectly formatted base_dn
in your config/ldap.php
file. Can you post it here?
I haven't published the configuration file and use only .env file. Here are the settings. I think the base dn setting is correct but somehow it wouldn't get read.
LDAP_LOGGING=true
LDAP_CONNECTION=default
LDAP_CONNECTIONS=default
LDAP_DEFAULT_HOSTS=**.**.*.*
LDAP_DEFAULT_USERNAME=null
LDAP_DEFAULT_PASSWORD=null
LDAP_DEFAULT_PORT=389
LDAP_DEFAULT_BASE_DN="dc=thecompany,dc=com"
LDAP_DEFAULT_TIMEOUT=5
LDAP_DEFAULT_SSL=false
LDAP_DEFAULT_TLS=false
LDAP_DEFAULT_SASL=false
I also tried raw php and the same base dn settings worked.
<?php
$username = $_POST['username'];
$password = $_POST['password'];
$ldapconfig['host'] = '*.*.*.*';
$ldapconfig['port'] = '389';
$ldapconfig['basedn'] = 'dc=thecompany,dc=com';
$ldapconfig['usersdn'] = 'ou=Users,ou=Wakanda,ou=Company';
$ds = ldap_connect($ldapconfig['host'], $ldapconfig['port']);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ds, LDAP_OPT_NETWORK_TIMEOUT, 10);
$dn = "cn=FirsName LastName," . $ldapconfig['usersdn'] . "," . $ldapconfig['basedn'];
if (isset($_POST['username'])) {
if ($bind = ldap_bind($ds, $dn, 'password')) {
echo ("Login correct");
} else {
echo "Login Failed: Please check your username or password";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action="" method="post">
<input name="username">
<input type="password" name="password">
<input type="submit" value="Submit">
</form>
</body>
</html>
That's strange, can you try retrieving results from the user model to see if any exception occurs?
use LdapRecord\Models\ActiveDirectory\User;
dd(User::first());
I got: LdapRecord\LdapRecordException ldap_search(): Search: Operations error
And this in the log:
[2023-09-27 15:47:34] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Binding - Username:
[2023-09-27 15:47:34] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Bound - Username:
[2023-09-27 15:47:34] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Binding - Username:
[2023-09-27 15:47:34] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Bound - Username:
[2023-09-27 15:47:34] local.ERROR: ldap_search(): Search: Operations error {"exception":"[object] (LdapRecord\\LdapRecordException(code: 2): ldap_search(): Search: Operations error at C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\LdapRecordException.php:19)
[stacktrace]
#0 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\HandlesConnection.php(174): LdapRecord\\LdapRecordException::withDetailedError(Object(ErrorException), Object(LdapRecord\\DetailedError))
#1 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(197): LdapRecord\\Ldap->executeFailableOperation(Object(Closure))
#2 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(574): LdapRecord\\Ldap->search('dc=TheCompany...', '(&(objectclass=...', Array, false, 1)
#3 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(350): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}(Object(LdapRecord\\Ldap))
#4 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(418): LdapRecord\\Connection->runOperationCallback(Object(Closure))
#5 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(400): LdapRecord\\Connection->retry(Object(Closure))
#6 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(310): LdapRecord\\Connection->tryAgainIfCausedByLostConnection(Object(LdapRecord\\LdapRecordException), Object(Closure))
#7 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(563): LdapRecord\\Connection->run(Object(Closure))
#8 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(351): LdapRecord\\Query\\Builder->run('(&(objectclass=...')
#9 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(549): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#10 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(353): LdapRecord\\Query\\Builder->getCachedResponse('(&(objectclass=...', Object(Closure))
#11 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(186): LdapRecord\\Query\\Builder->query('(&(objectclass=...')
#12 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(203): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#13 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(185): LdapRecord\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#14 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(639): LdapRecord\\Query\\Builder->get(Array)
#15 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(104): LdapRecord\\Query\\Builder->first(Array)
#16 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Models\\Model.php(140): LdapRecord\\Query\\Model\\Builder->first()
#17 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Models\\Model.php(148): LdapRecord\\Models\\Model->__call('first', Array)
#18 C:\\laragon\\www\\TheCompanyOne\\app\\Http\\Controllers\\DebugController.php(15): LdapRecord\\Models\\Model::__callStatic('first', Array)
#19 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php(54): App\\Http\\Controllers\\DebugController->ldap()
#20 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction('ldap', Array)
#21 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(259): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\DebugController), 'ldap')
#22 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(205): Illuminate\\Routing\\Route->runController()
#23 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(799): Illuminate\\Routing\\Route->run()
#24 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#25 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#26 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#29 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\View\\Middleware\\ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#32 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest(Object(Illuminate\\Http\\Request), Object(Illuminate\\Session\\Store), Object(Closure))
#33 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#34 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#35 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#36 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#37 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#38 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#39 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(798): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#40 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(777): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#41 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(741): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#42 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(730): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#43 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(200): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#44 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#45 C:\\laragon\\www\\TheCompanyOne\\vendor\\barryvdh\\laravel-debugbar\\src\\Middleware\\InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#46 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#48 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#50 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#51 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#53 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#54 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#55 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance.php(89): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#56 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#57 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#58 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#59 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#60 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#61 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#62 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#63 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#64 C:\\laragon\\www\\TheCompanyOne\\public\\index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#65 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\resources\\server.php(16): require_once('C:\\\\laragon\\\\www\\\\...')
#66 {main}
[previous exception] [object] (ErrorException(code: 2): ldap_search(): Search: Operations error at C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php:207)
[stacktrace]
#0 [internal function]: LdapRecord\\Ldap->LdapRecord\\{closure}(2, 'ldap_search(): ...', 'C:\\\\laragon\\\\www\\\\...', 207)
#1 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(207): ldap_search(Object(LDAP\\Connection), 'dc=TheCompanymotor...', '(&(objectclass=...', Array, false, 1, 0, 0, NULL)
#2 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\HandlesConnection.php(161): LdapRecord\\Ldap->LdapRecord\\{closure}()
#3 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(197): LdapRecord\\Ldap->executeFailableOperation(Object(Closure))
#4 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(574): LdapRecord\\Ldap->search('dc=TheCompanymotor...', '(&(objectclass=...', Array, false, 1)
#5 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(350): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}(Object(LdapRecord\\Ldap))
#6 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(418): LdapRecord\\Connection->runOperationCallback(Object(Closure))
#7 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(400): LdapRecord\\Connection->retry(Object(Closure))
#8 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(310): LdapRecord\\Connection->tryAgainIfCausedByLostConnection(Object(LdapRecord\\LdapRecordException), Object(Closure))
#9 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(563): LdapRecord\\Connection->run(Object(Closure))
#10 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(351): LdapRecord\\Query\\Builder->run('(&(objectclass=...')
#11 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(549): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#12 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(353): LdapRecord\\Query\\Builder->getCachedResponse('(&(objectclass=...', Object(Closure))
#13 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(186): LdapRecord\\Query\\Builder->query('(&(objectclass=...')
#14 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(203): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#15 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(185): LdapRecord\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#16 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(639): LdapRecord\\Query\\Builder->get(Array)
#17 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(104): LdapRecord\\Query\\Builder->first(Array)
#18 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Models\\Model.php(140): LdapRecord\\Query\\Model\\Builder->first()
#19 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Models\\Model.php(148): LdapRecord\\Models\\Model->__call('first', Array)
#20 C:\\laragon\\www\\TheCompanyOne\\app\\Http\\Controllers\\DebugController.php(15): LdapRecord\\Models\\Model::__callStatic('first', Array)
#21 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php(54): App\\Http\\Controllers\\DebugController->ldap()
#22 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction('ldap', Array)
#23 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(259): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\DebugController), 'ldap')
#24 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(205): Illuminate\\Routing\\Route->runController()
#25 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(799): Illuminate\\Routing\\Route->run()
#26 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#27 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#29 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\View\\Middleware\\ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#32 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#33 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#34 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest(Object(Illuminate\\Http\\Request), Object(Illuminate\\Session\\Store), Object(Closure))
#35 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#36 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#37 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#38 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#39 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#40 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#41 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(798): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#42 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(777): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#43 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(741): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#44 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(730): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#45 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(200): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#46 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#47 C:\\laragon\\www\\TheCompanyOne\\vendor\\barryvdh\\laravel-debugbar\\src\\Middleware\\InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#48 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#50 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#51 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#54 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#55 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#56 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#57 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance.php(89): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#58 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#59 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#60 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#61 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#62 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#63 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#64 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#65 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#66 C:\\laragon\\www\\TheCompanyOne\\public\\index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#67 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\resources\\server.php(16): require_once('C:\\\\laragon\\\\www\\\\...')
#68 {main}
"}
I tried it with a fresh Laravel installation but still have the same error when doing php artisan ldap:browse. I also tried ldap.forumsys.com. Still the same.
Ī» php artisan ldap:browse
Connecting to [default]...
Successfully connected.
Viewing object []
Select operation:
[inspect] View the selected objects attributes
[down ] Navigate down a level
[root ] Navigate to root
[to ] Navigate to specific object
> inspect
inspect
TypeError
LdapRecord\Query\Model\Builder::find(): Argument #1 ($dn) must be of type array|string, null given, called in C:\laragon\www\ldapApp\vendor\directorytree\ldaprecord-laravel\src\Commands\BrowseLdapServer.php on line 142
at vendor\directorytree\ldaprecord\src\Query\Model\Builder.php:126
122ā
123ā /**
124ā * {@inheritDoc}
125ā */
ā 126ā public function find(array|string $dn, array|string $columns = ['*']): Model|Collection|null
127ā {
128ā return $this->afterScopes(fn () => parent::find($dn, $columns));
129ā }
130ā
1 vendor\directorytree\ldaprecord-laravel\src\Commands\BrowseLdapServer.php:142
LdapRecord\Query\Model\Builder::find()
2 vendor\directorytree\ldaprecord-laravel\src\Commands\BrowseLdapServer.php:192
LdapRecord\Laravel\Commands\BrowseLdapServer::displayAttributes()
Thanks @anchan42! With the ldap.forumsys.com
server with the ldap:browse
command, I was able to reproduce this.
I've just made a new release containing a patch to resolve this. Can you run composer update
and try again?
Thank you, Steve! For having a look at this for me.
I was going to upload the project to github for you to have a look but was too drunk to do it š ldap.forumsys.com is working okay now. Just out of interest, what was the problem?
Luck still is not on my side. There is still a problem with my company's LDAP server.
I got this new error.
php artisan ldap:browse
Connecting to [default]...
Successfully connected.
Viewing object [dc=thecompany,dc=com]
Select operation:
[inspect] View the selected objects attributes
[down ] Navigate down a level
[root ] Navigate to root
[to ] Navigate to specific object
> inspect
inspect
LdapRecord\LdapRecordException
ldap_read(): Search: Operations error
at vendor\directorytree\ldaprecord\src\LdapRecordException.php:19
15ā * Create a new Bind Exception with a detailed connection error.
16ā */
17ā public static function withDetailedError(Exception $e, DetailedError $error = null): static
18ā {
ā 19ā return (new static($e->getMessage(), $e->getCode(), $e))->setDetailedError($error);
20ā }
21ā
22ā /**
23ā * Set the detailed error.
1 vendor\directorytree\ldaprecord\src\HandlesConnection.php:174
LdapRecord\LdapRecordException::withDetailedError(Object(ErrorException), Object(LdapRecord\DetailedError))
2 vendor\directorytree\ldaprecord\src\Ldap.php:245
ErrorException::("ldap_read(): Search: Operations error")
This is the log file:
[2023-09-29 09:24:16] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Binding - Username:
[2023-09-29 09:24:16] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Bound - Username:
[2023-09-29 09:24:20] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Binding - Username:
[2023-09-29 09:24:20] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Bound - Username:
[2023-09-29 09:24:20] local.ERROR: ldap_read(): Search: Operations error {"exception":"[object] (LdapRecord\\LdapRecordException(code: 2): ldap_read(): Search: Operations error at C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\LdapRecordException.php:19)
[stacktrace]
#0 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\HandlesConnection.php(174): LdapRecord\\LdapRecordException::withDetailedError(Object(ErrorException), Object(LdapRecord\\DetailedError))
#1 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(235): LdapRecord\\Ldap->executeFailableOperation(Object(Closure))
#2 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(574): LdapRecord\\Ldap->read('dc=TheCompany...', '(objectclass=*)', Array, false, 1)
#3 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(350): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}(Object(LdapRecord\\Ldap))
#4 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(418): LdapRecord\\Connection->runOperationCallback(Object(Closure))
#5 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(400): LdapRecord\\Connection->retry(Object(Closure))
#6 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(310): LdapRecord\\Connection->tryAgainIfCausedByLostConnection(Object(LdapRecord\\LdapRecordException), Object(Closure))
#7 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(563): LdapRecord\\Connection->run(Object(Closure))
#8 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(351): LdapRecord\\Query\\Builder->run('(objectclass=*)')
#9 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(549): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#10 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(353): LdapRecord\\Query\\Builder->getCachedResponse('(objectclass=*)', Object(Closure))
#11 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(186): LdapRecord\\Query\\Builder->query('(objectclass=*)')
#12 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(203): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#13 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(185): LdapRecord\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#14 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(639): LdapRecord\\Query\\Builder->get(Array)
#15 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(104): LdapRecord\\Query\\Builder->first(Array)
#16 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(652): LdapRecord\\Query\\Model\\Builder->first(Array)
#17 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(112): LdapRecord\\Query\\Builder->firstOrFail(Array)
#18 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(810): LdapRecord\\Query\\Model\\Builder->firstOrFail(Array)
#19 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(136): LdapRecord\\Query\\Builder->findOrFail('dc=TheCompany...', Array)
#20 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(792): LdapRecord\\Query\\Model\\Builder->findOrFail('dc=TheCompany...', Array)
#21 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(128): LdapRecord\\Query\\Builder->find('dc=TheCompany...', Array)
#22 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(289): LdapRecord\\Query\\Model\\Builder->LdapRecord\\Query\\Model\\{closure}()
#23 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(128): LdapRecord\\Query\\Model\\Builder->afterScopes(Object(Closure))
#24 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord-laravel\\src\\Commands\\BrowseLdapServer.php(142): LdapRecord\\Query\\Model\\Builder->find('dc=TheCompany...')
#25 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord-laravel\\src\\Commands\\BrowseLdapServer.php(192): LdapRecord\\Laravel\\Commands\\BrowseLdapServer->displayAttributes()
#26 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord-laravel\\src\\Commands\\BrowseLdapServer.php(110): LdapRecord\\Laravel\\Commands\\BrowseLdapServer->LdapRecord\\Laravel\\Commands\\{closure}()
#27 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord-laravel\\src\\Commands\\BrowseLdapServer.php(95): LdapRecord\\Laravel\\Commands\\BrowseLdapServer->performOperation('inspect')
#28 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord-laravel\\src\\Commands\\BrowseLdapServer.php(74): LdapRecord\\Laravel\\Commands\\BrowseLdapServer->askForOperation()
#29 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(36): LdapRecord\\Laravel\\Commands\\BrowseLdapServer->handle()
#30 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#31 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#32 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#33 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#34 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(211): Illuminate\\Container\\Container->call(Array)
#35 C:\\laragon\\www\\TheCompanyOne\\vendor\\symfony\\console\\Command\\Command.php(326): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#36 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(180): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#37 C:\\laragon\\www\\TheCompanyOne\\vendor\\symfony\\console\\Application.php(1081): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#38 C:\\laragon\\www\\TheCompanyOne\\vendor\\symfony\\console\\Application.php(320): Symfony\\Component\\Console\\Application->doRunCommand(Object(LdapRecord\\Laravel\\Commands\\BrowseLdapServer), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#39 C:\\laragon\\www\\TheCompanyOne\\vendor\\symfony\\console\\Application.php(174): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#40 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(201): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#41 C:\\laragon\\www\\TheCompanyOne\\artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#42 {main}
[previous exception] [object] (ErrorException(code: 2): ldap_read(): Search: Operations error at C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php:245)
[stacktrace]
#0 [internal function]: LdapRecord\\Ldap->LdapRecord\\{closure}(2, 'ldap_read(): Se...', 'C:\\\\laragon\\\\www\\\\...', 245)
#1 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(245): ldap_read(Object(LDAP\\Connection), 'dc=TheCompany...', '(objectclass=*)', Array, false, 1, 0, 0, NULL)
#2 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\HandlesConnection.php(161): LdapRecord\\Ldap->LdapRecord\\{closure}()
#3 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(235): LdapRecord\\Ldap->executeFailableOperation(Object(Closure))
#4 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(574): LdapRecord\\Ldap->read('dc=TheCompany...', '(objectclass=*)', Array, false, 1)
#5 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(350): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}(Object(LdapRecord\\Ldap))
#6 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(418): LdapRecord\\Connection->runOperationCallback(Object(Closure))
#7 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(400): LdapRecord\\Connection->retry(Object(Closure))
#8 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(310): LdapRecord\\Connection->tryAgainIfCausedByLostConnection(Object(LdapRecord\\LdapRecordException), Object(Closure))
#9 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(563): LdapRecord\\Connection->run(Object(Closure))
#10 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(351): LdapRecord\\Query\\Builder->run('(objectclass=*)')
#11 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(549): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#12 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(353): LdapRecord\\Query\\Builder->getCachedResponse('(objectclass=*)', Object(Closure))
#13 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(186): LdapRecord\\Query\\Builder->query('(objectclass=*)')
#14 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(203): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#15 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(185): LdapRecord\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#16 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(639): LdapRecord\\Query\\Builder->get(Array)
#17 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(104): LdapRecord\\Query\\Builder->first(Array)
#18 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(652): LdapRecord\\Query\\Model\\Builder->first(Array)
#19 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(112): LdapRecord\\Query\\Builder->firstOrFail(Array)
#20 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(810): LdapRecord\\Query\\Model\\Builder->firstOrFail(Array)
#21 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(136): LdapRecord\\Query\\Builder->findOrFail('dc=TheCompany...', Array)
#22 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(792): LdapRecord\\Query\\Model\\Builder->findOrFail('dc=TheCompany...', Array)
#23 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(128): LdapRecord\\Query\\Builder->find('dc=TheCompany...', Array)
#24 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(289): LdapRecord\\Query\\Model\\Builder->LdapRecord\\Query\\Model\\{closure}()
#25 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(128): LdapRecord\\Query\\Model\\Builder->afterScopes(Object(Closure))
#26 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord-laravel\\src\\Commands\\BrowseLdapServer.php(142): LdapRecord\\Query\\Model\\Builder->find('dc=TheCompany...')
#27 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord-laravel\\src\\Commands\\BrowseLdapServer.php(192): LdapRecord\\Laravel\\Commands\\BrowseLdapServer->displayAttributes()
#28 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord-laravel\\src\\Commands\\BrowseLdapServer.php(110): LdapRecord\\Laravel\\Commands\\BrowseLdapServer->LdapRecord\\Laravel\\Commands\\{closure}()
#29 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord-laravel\\src\\Commands\\BrowseLdapServer.php(95): LdapRecord\\Laravel\\Commands\\BrowseLdapServer->performOperation('inspect')
#30 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord-laravel\\src\\Commands\\BrowseLdapServer.php(74): LdapRecord\\Laravel\\Commands\\BrowseLdapServer->askForOperation()
#31 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(36): LdapRecord\\Laravel\\Commands\\BrowseLdapServer->handle()
#32 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#33 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#34 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#35 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#36 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(211): Illuminate\\Container\\Container->call(Array)
#37 C:\\laragon\\www\\TheCompanyOne\\vendor\\symfony\\console\\Command\\Command.php(326): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#38 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Console\\Command.php(180): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#39 C:\\laragon\\www\\TheCompanyOne\\vendor\\symfony\\console\\Application.php(1081): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#40 C:\\laragon\\www\\TheCompanyOne\\vendor\\symfony\\console\\Application.php(320): Symfony\\Component\\Console\\Application->doRunCommand(Object(LdapRecord\\Laravel\\Commands\\BrowseLdapServer), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#41 C:\\laragon\\www\\TheCompanyOne\\vendor\\symfony\\console\\Application.php(174): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#42 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(201): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#43 C:\\laragon\\www\\TheCompanyOne\\artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#44 {main}
"}
Happy to help @anchan42!
This was the change I made in the release: https://github.com/DirectoryTree/LdapRecord-Laravel/commit/f7c43faa2f61659d141a0ad5f9520599b6349b00
Basically, it was simply not retrieving the correct DN from the query builder to search on.
For your new error, that's strange as I can't replicate this. Are you able to execute a query on a model instead to see if you are able to retrieve results? Ex:
use LdapRecord\Models\ActiveDirectory\User;
dd(User::get());
Also, does the account you've configured LdapRecord with have administrative access? This error may be thrown if the user account does not have permission to view the object in the directory.
I tried that and got ldap_search(): Search: Operations error. Below is the log:
[2023-09-29 14:42:33] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Binding - Username:
[2023-09-29 14:42:33] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Bound - Username:
[2023-09-29 14:42:33] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Binding - Username:
[2023-09-29 14:42:33] local.INFO: LDAP (ldap://10.55.2.1:389) - Operation: Bound - Username:
[2023-09-29 14:42:33] local.ERROR: ldap_search(): Search: Operations error {"exception":"[object] (LdapRecord\\LdapRecordException(code: 2): ldap_search(): Search: Operations error at C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\LdapRecordException.php:19)
[stacktrace]
#0 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\HandlesConnection.php(174): LdapRecord\\LdapRecordException::withDetailedError(Object(ErrorException), Object(LdapRecord\\DetailedError))
#1 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(197): LdapRecord\\Ldap->executeFailableOperation(Object(Closure))
#2 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(574): LdapRecord\\Ldap->search('dc=TheCompanymotor...', '(&(objectclass=...', Array, false, 1)
#3 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(350): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}(Object(LdapRecord\\Ldap))
#4 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(418): LdapRecord\\Connection->runOperationCallback(Object(Closure))
#5 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(400): LdapRecord\\Connection->retry(Object(Closure))
#6 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(310): LdapRecord\\Connection->tryAgainIfCausedByLostConnection(Object(LdapRecord\\LdapRecordException), Object(Closure))
#7 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(563): LdapRecord\\Connection->run(Object(Closure))
#8 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(351): LdapRecord\\Query\\Builder->run('(&(objectclass=...')
#9 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(549): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#10 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(353): LdapRecord\\Query\\Builder->getCachedResponse('(&(objectclass=...', Object(Closure))
#11 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(186): LdapRecord\\Query\\Builder->query('(&(objectclass=...')
#12 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(203): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#13 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(185): LdapRecord\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#14 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(639): LdapRecord\\Query\\Builder->get(Array)
#15 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(104): LdapRecord\\Query\\Builder->first(Array)
#16 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Models\\Model.php(140): LdapRecord\\Query\\Model\\Builder->first()
#17 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Models\\Model.php(148): LdapRecord\\Models\\Model->__call('first', Array)
#18 C:\\laragon\\www\\TheCompanyOne\\app\\Http\\Controllers\\DebugController.php(16): LdapRecord\\Models\\Model::__callStatic('first', Array)
#19 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php(54): App\\Http\\Controllers\\DebugController->ldap()
#20 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction('ldap', Array)
#21 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(259): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\DebugController), 'ldap')
#22 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(205): Illuminate\\Routing\\Route->runController()
#23 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(799): Illuminate\\Routing\\Route->run()
#24 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#25 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#26 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#29 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\View\\Middleware\\ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#32 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest(Object(Illuminate\\Http\\Request), Object(Illuminate\\Session\\Store), Object(Closure))
#33 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#34 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#35 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#36 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#37 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#38 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#39 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(798): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#40 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(777): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#41 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(741): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#42 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(730): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#43 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(200): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#44 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#45 C:\\laragon\\www\\TheCompanyOne\\vendor\\barryvdh\\laravel-debugbar\\src\\Middleware\\InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#46 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#48 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#50 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#51 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#53 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#54 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#55 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#56 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#57 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#58 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#59 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#60 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#61 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#62 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#63 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#64 C:\\laragon\\www\\TheCompanyOne\\public\\index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#65 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\resources\\server.php(16): require_once('C:\\\\laragon\\\\www\\\\...')
#66 {main}
[previous exception] [object] (ErrorException(code: 2): ldap_search(): Search: Operations error at C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php:207)
[stacktrace]
#0 [internal function]: LdapRecord\\Ldap->LdapRecord\\{closure}(2, 'ldap_search(): ...', 'C:\\\\laragon\\\\www\\\\...', 207)
#1 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(207): ldap_search(Object(LDAP\\Connection), 'dc=TheCompanymotor...', '(&(objectclass=...', Array, false, 1, 0, 0, NULL)
#2 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\HandlesConnection.php(161): LdapRecord\\Ldap->LdapRecord\\{closure}()
#3 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(197): LdapRecord\\Ldap->executeFailableOperation(Object(Closure))
#4 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(574): LdapRecord\\Ldap->search('dc=TheCompanymotor...', '(&(objectclass=...', Array, false, 1)
#5 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(350): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}(Object(LdapRecord\\Ldap))
#6 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(418): LdapRecord\\Connection->runOperationCallback(Object(Closure))
#7 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(400): LdapRecord\\Connection->retry(Object(Closure))
#8 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(310): LdapRecord\\Connection->tryAgainIfCausedByLostConnection(Object(LdapRecord\\LdapRecordException), Object(Closure))
#9 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(563): LdapRecord\\Connection->run(Object(Closure))
#10 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(351): LdapRecord\\Query\\Builder->run('(&(objectclass=...')
#11 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(549): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#12 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(353): LdapRecord\\Query\\Builder->getCachedResponse('(&(objectclass=...', Object(Closure))
#13 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(186): LdapRecord\\Query\\Builder->query('(&(objectclass=...')
#14 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(203): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#15 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(185): LdapRecord\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#16 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(639): LdapRecord\\Query\\Builder->get(Array)
#17 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Query\\Model\\Builder.php(104): LdapRecord\\Query\\Builder->first(Array)
#18 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Models\\Model.php(140): LdapRecord\\Query\\Model\\Builder->first()
#19 C:\\laragon\\www\\TheCompanyOne\\vendor\\directorytree\\ldaprecord\\src\\Models\\Model.php(148): LdapRecord\\Models\\Model->__call('first', Array)
#20 C:\\laragon\\www\\TheCompanyOne\\app\\Http\\Controllers\\DebugController.php(16): LdapRecord\\Models\\Model::__callStatic('first', Array)
#21 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php(54): App\\Http\\Controllers\\DebugController->ldap()
#22 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction('ldap', Array)
#23 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(259): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\DebugController), 'ldap')
#24 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(205): Illuminate\\Routing\\Route->runController()
#25 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(799): Illuminate\\Routing\\Route->run()
#26 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#27 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#29 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\View\\Middleware\\ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#32 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#33 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#34 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest(Object(Illuminate\\Http\\Request), Object(Illuminate\\Session\\Store), Object(Closure))
#35 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#36 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#37 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#38 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#39 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#40 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#41 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(798): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#42 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(777): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#43 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(741): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#44 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(730): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#45 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(200): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#46 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#47 C:\\laragon\\www\\TheCompanyOne\\vendor\\barryvdh\\laravel-debugbar\\src\\Middleware\\InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#48 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#50 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#51 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#54 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#55 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#56 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#57 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#58 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#59 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#60 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#61 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#62 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#63 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#64 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#65 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#66 C:\\laragon\\www\\TheCompanyOne\\public\\index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#67 C:\\laragon\\www\\TheCompanyOne\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\resources\\server.php(16): require_once('C:\\\\laragon\\\\www\\\\...')
#68 {main}
"}
I think the problem is in ldap_search() function so I tried it manually and it works fine. Not sure why it would cause a problem in the package.
$ldapconfig['host'] = 'xx.x.xx.xx';
$ldapconfig['port'] = '389';
$ldapconfig['basedn'] = 'dc=theCompany,dc=com';
$ldapconfig['usersdn'] = 'ou=Users,ou=Wakanda,ou=Company';
$ds = ldap_connect($ldapconfig['host'], $ldapconfig['port']);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ds, LDAP_OPT_NETWORK_TIMEOUT, 10);
$filter = "(cn=First Last)";
$justthese = array("ou", "sn", "givenname", "mail");
$dn = $ldapconfig['basedn'];
$sr = ldap_search($ds, $dn, $filter, $justthese);
$info = ldap_get_entries($ds, $sr);
echo $info["count"] . " entries returned\n";
debug_zval_dump($info);
I forgot to answer one of your questions. The LDAP is bound with an anonymous, read-only account. I can use other program to browse all the object ok.
@anchan42 Can you try connecting with an administrator to set if this potentially a permissions based issue?
I'll need to talk to IT on Monday. Not sure if they would give me that. I don't think it is a permission issue though because I can see everything using Active Directory Explorer.
I downloaded that program from here. https://learn.microsoft.com/en-us/sysinternals/downloads/adexplorer
Ok, we can keep debugging then. Can you try a different model to see if you are able to successfully retrieve results? Give the below a shot:
use LdapRecord\Models\Entry;
Entry::list()->select('cn')->get();
OK Thanks :) I got ldap_list(): Search: Operations error.
I think the problem is now at ldap_list in the list function in Ldap.php. It takes the same arg as the ldap_search.
I tried the same arguments in plain PHP and it returned zero results.
The filter is
$filter = "(&(objectclass=\74\6f\70)(objectclass=\70\65\72\73\6f\6e)(objectclass=\6f\72\67\61\6e\69\7a\61\74\69\6f\6e\61\6c\70\65\72\73\6f\6e)(objectclass=\75\73\65\72)(userprincipalname=\77\6f\72\61\77\69\74\2e\6c\40\74\72\69\75\6d\70\68\6d\6f\74\6f\72\63\79\63\6c\65\73\2e\63\6f\6d)(!(objectclass=\63\6f\6d\70\75\74\65\72)))";
It would work if I changed this to plaintext and used only userprincipalname.
Log:
[2023-10-03 10:20:50] local.INFO: LDAP (ldap://s-thvm-dc01.triumphmotorcycles.com:389) - Operation: Binding - Username:
[2023-10-03 10:20:50] local.INFO: LDAP (ldap://s-thvm-dc01.triumphmotorcycles.com:389) - Operation: Bound - Username:
[2023-10-03 10:20:50] local.INFO: LDAP (ldap://s-thvm-dc01.TheCompany motorcycles.com:389) - Operation: Binding - Username:
[2023-10-03 10:20:50] local.INFO: LDAP (ldap://s-thvm-dc01.TheCompany motorcycles.com:389) - Operation: Bound - Username:
[2023-10-03 10:20:50] local.ERROR: ldap_list(): Search: Operations error {"exception":"[object] (LdapRecord\\LdapRecordException(code: 2): ldap_list(): Search: Operations error at C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\LdapRecordException.php:19)
[stacktrace]
#0 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\HandlesConnection.php(174): LdapRecord\\LdapRecordException::withDetailedError(Object(ErrorException), Object(LdapRecord\\DetailedError))
#1 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(216): LdapRecord\\Ldap->executeFailableOperation(Object(Closure))
#2 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(574): LdapRecord\\Ldap->list('dc=TheCompany...', '(objectclass=*)', Array, false, 0)
#3 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(350): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}(Object(LdapRecord\\Ldap))
#4 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(418): LdapRecord\\Connection->runOperationCallback(Object(Closure))
#5 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(400): LdapRecord\\Connection->retry(Object(Closure))
#6 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(310): LdapRecord\\Connection->tryAgainIfCausedByLostConnection(Object(LdapRecord\\LdapRecordException), Object(Closure))
#7 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(563): LdapRecord\\Connection->run(Object(Closure))
#8 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(351): LdapRecord\\Query\\Builder->run('(objectclass=*)')
#9 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(549): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#10 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(353): LdapRecord\\Query\\Builder->getCachedResponse('(objectclass=*)', Object(Closure))
#11 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(186): LdapRecord\\Query\\Builder->query('(objectclass=*)')
#12 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(203): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#13 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(185): LdapRecord\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#14 C:\\laragon\\www\\TheCompany One\\app\\Http\\Controllers\\DebugController.php(18): LdapRecord\\Query\\Builder->get()
#15 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php(54): App\\Http\\Controllers\\DebugController->ldap()
#16 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction('ldap', Array)
#17 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(259): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\DebugController), 'ldap')
#18 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(205): Illuminate\\Routing\\Route->runController()
#19 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(799): Illuminate\\Routing\\Route->run()
#20 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#21 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#22 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#23 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#24 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#25 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\View\\Middleware\\ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#26 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest(Object(Illuminate\\Http\\Request), Object(Illuminate\\Session\\Store), Object(Closure))
#29 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#30 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#31 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#32 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#33 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#34 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#35 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(798): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#36 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(777): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#37 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(741): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#38 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(730): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#39 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(200): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#40 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#41 C:\\laragon\\www\\TheCompany One\\vendor\\barryvdh\\laravel-debugbar\\src\\Middleware\\InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#42 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#43 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#44 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#45 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#46 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#47 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#48 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#50 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#51 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#52 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#53 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#54 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#55 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#56 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#57 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#58 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#59 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#60 C:\\laragon\\www\\TheCompany One\\public\\index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#61 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\resources\\server.php(16): require_once('C:\\\\laragon\\\\www\\\\...')
#62 {main}
[previous exception] [object] (ErrorException(code: 2): ldap_list(): Search: Operations error at C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php:226)
[stacktrace]
#0 [internal function]: LdapRecord\\Ldap->LdapRecord\\{closure}(2, 'ldap_list(): Se...', 'C:\\\\laragon\\\\www\\\\...', 226)
#1 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(226): ldap_list(Object(LDAP\\Connection), 'dc=TheCompany motor...', '(objectclass=*)', Array, false, 0, 0, 0, NULL)
#2 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\HandlesConnection.php(161): LdapRecord\\Ldap->LdapRecord\\{closure}()
#3 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Ldap.php(216): LdapRecord\\Ldap->executeFailableOperation(Object(Closure))
#4 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(574): LdapRecord\\Ldap->list('dc=TheCompany motor...', '(objectclass=*)', Array, false, 0)
#5 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(350): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}(Object(LdapRecord\\Ldap))
#6 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(418): LdapRecord\\Connection->runOperationCallback(Object(Closure))
#7 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(400): LdapRecord\\Connection->retry(Object(Closure))
#8 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Connection.php(310): LdapRecord\\Connection->tryAgainIfCausedByLostConnection(Object(LdapRecord\\LdapRecordException), Object(Closure))
#9 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(563): LdapRecord\\Connection->run(Object(Closure))
#10 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(351): LdapRecord\\Query\\Builder->run('(objectclass=*)')
#11 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(549): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#12 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(353): LdapRecord\\Query\\Builder->getCachedResponse('(objectclass=*)', Object(Closure))
#13 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(186): LdapRecord\\Query\\Builder->query('(objectclass=*)')
#14 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(203): LdapRecord\\Query\\Builder->LdapRecord\\Query\\{closure}()
#15 C:\\laragon\\www\\TheCompany One\\vendor\\directorytree\\ldaprecord\\src\\Query\\Builder.php(185): LdapRecord\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#16 C:\\laragon\\www\\TheCompany One\\app\\Http\\Controllers\\DebugController.php(18): LdapRecord\\Query\\Builder->get()
#17 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php(54): App\\Http\\Controllers\\DebugController->ldap()
#18 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction('ldap', Array)
#19 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(259): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\DebugController), 'ldap')
#20 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(205): Illuminate\\Routing\\Route->runController()
#21 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(799): Illuminate\\Routing\\Route->run()
#22 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#23 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#24 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#25 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#26 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\View\\Middleware\\ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#29 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest(Object(Illuminate\\Http\\Request), Object(Illuminate\\Session\\Store), Object(Closure))
#31 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#32 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#33 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#34 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#35 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#36 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#37 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(798): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#38 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(777): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#39 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(741): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#40 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(730): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#41 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(200): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#42 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#43 C:\\laragon\\www\\TheCompany One\\vendor\\barryvdh\\laravel-debugbar\\src\\Middleware\\InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#44 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#45 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#46 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#48 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#49 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#50 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#51 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#52 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#53 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#54 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#55 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#56 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#57 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#58 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#59 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#60 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#61 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#62 C:\\laragon\\www\\TheCompany One\\public\\index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#63 C:\\laragon\\www\\TheCompany One\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\resources\\server.php(16): require_once('C:\\\\laragon\\\\www\\\\...')
#64 {main}
"}
Thanks for trying that out @anchan42.
I noticed in your comment above that you're using a distinguished name and password to bind to your LDAP server with PHP's core LDAP methods: https://github.com/DirectoryTree/LdapRecord-Laravel/issues/578#issuecomment-1735312342
Can you you test this again binding with null
for the username and password using PHP's core LDAP methods?
Also the query filter that should be generated with the snippet I linked above should only be (objectclass=*)
:
use LdapRecord\Models\Entry;
dd(Entry::list()->select('cn')->getQuery()); // (objectclass=*)
For further debugging information, can you also catch the exception and dump the extended error messages and code?
use LdapRecord\Models\Entry;
use LdapRecord\LdapRecordException;
try {
Entry::list()->select('cn')->get();
} catch (LdapRecordException $e) {
$error = $e->getDetailedError();
echo $error->getErrorCode();
echo $error->getErrorMessage();
echo $error->getDiagnosticMessage();
}
Using null for username and password was ok with ldap PHP function.
For the first code snippet, I got "(objectclass=*)" // app\Http\Controllers\DebugController.php:37 from the dd. For the second, I got:
1
Operations error
000004DC: LdapErr: DSID-0C090AE1, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v3839
So I tried putting my username and password in the .env file and the Auth::attempt worked !! I tested that with my co-worker's credential and it worked too.
That still causes some problems because when I change my password, I have to update the .env file too. Anything else I can try? š
@anchan42 Apologies for the delayed reply!
So I tried putting my username and password in the .env file and the Auth::attempt worked !! I tested that with my co-worker's credential and it worked too.
This is suspiciously sounding like there may be a permission issue reading some attributes (specifically objectclass
) on your ActiveDirectory server when you're bound to the server with an anonymous bind (null username and password)...
The objectclass
attribute is explicitly requested on all LdapRecord searches performed on models, as it is necessary to determine what the object type is.
Can you try with your raw LDAP snippet you've posted above and include the objectclass
attribute with your selected attributes? I.e.:
$ldapconfig['host'] = 'xx.x.xx.xx';
$ldapconfig['port'] = '389';
$ldapconfig['basedn'] = 'dc=theCompany,dc=com';
$ldapconfig['usersdn'] = 'ou=Users,ou=Wakanda,ou=Company';
$ds = ldap_connect($ldapconfig['host'], $ldapconfig['port']);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ds, LDAP_OPT_NETWORK_TIMEOUT, 10);
$filter = "(cn=First Last)";
$justthese = array("ou", "sn", "givenname", "mail", "objectclass"); // <-- objectclass added here
$dn = $ldapconfig['basedn'];
$sr = ldap_search($ds, $dn, $filter, $justthese);
$info = ldap_get_entries($ds, $sr);
echo $info["count"] . " entries returned\n";
debug_zval_dump($info);
Typically with LDAP integrations, administrators create specific service accounts with explicit permissions for binding to the LDAP server, though I totally understand not all environments are the same and administrators like to do things in alternate ways sometimes (whatever the case may be).
EDIT: Also, can you try performing a raw query on the LdapRecord connection with an anonymous bind? Ex:
$results = Container::getConnection()->query()->where('cn', '=', 'John Doe')->get();
dd($results);
After a few poking around, it turns out that the ldap_search core function would not work at all with anonymous binding. I did not share the complete snippet before, sorry about that.
With the code below, binding is ok but ldap_search would return false and a warning . Warning: ldap_search(): Search: Operations error in C:\laragon\www\php\index.php on line 21
If I put the password in it would work.
I asked admin to create a service account for me so we should be ok now.
Thanks a lot for your help :)
<?php
$basedn = 'dc=TheCompany,dc=com';
$usersdn = 'ou=Users,ou=Wakanda,ou=Company';
$password = null;
$ds = ldap_connect('10.55.2.1', '389');
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ds, LDAP_OPT_NETWORK_TIMEOUT, 10);
$dn = "cn=First Last" . "," . $usersdn . "," . $basedn;
if (!ldap_bind($ds, $dn, $password)) {
echo "Binding failed !!";
} else {
echo "Success !!";
$filter = "(cn=Worawit Lalitkiattikool)";
$justthese = array("ou", "sn", "givenname", "mail", "objectclass");
$sr = ldap_search($ds, $basedn, $filter, $justthese);
if ($sr) {
$info = ldap_get_entries($ds, $sr);
echo $info["count"] . " entries returned\n";
echo '<pre>';
var_dump($info);
echo '</pre>';
}
}
Ahh okay, no worries @anchan42! I'm really glad you were able to get to the bottom of it.
Thanks for hanging in there with me while we debugged this š
Environment:
composer.json
I get the error above when I try php artisan ldap:browse and then choose inspect. The php artisan ldap:test command returns OK results.
This works:
but this doesn't:
I have a feeling that I might not have the package installed properly but not sure how to test it. I tried it on a fresh Laravel installation but still the same. I am going to try it on a different laptop next, maybe on a Linux machine.
Do you have any suggestion on what I can try?