Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't configure LDAP backend #18

Open
greenvespa opened this issue Apr 13, 2021 · 2 comments
Open

Can't configure LDAP backend #18

greenvespa opened this issue Apr 13, 2021 · 2 comments

Comments

@greenvespa
Copy link

I can't configure any LDAP backend on Nextcloud 20.0.2:

sudo -u www-data /usr/bin/php occ ldap_contacts:add --interactive $TEST
Address book display name: TEST
An unhandled exception has been thrown:
TypeError: Argument 3 passed to OCA\LDAPContactsBackend\Service\ConnectionImporter::extractTlsMode() must be of the type string, int given, called in /var/www/html/apps/ldap_contacts_backend/lib/Service/ConnectionImporter.php on line 71 and defined in /var/www/html/apps/ldap_contacts_backend/lib/Service/ConnectionImporter.php:84
Stack trace:
#0 /var/www/html/apps/ldap_contacts_backend/lib/Service/ConnectionImporter.php(71): OCA\LDAPContactsBackend\Service\ConnectionImporter->extractTlsMode()
#1 /var/www/html/apps/ldap_contacts_backend/lib/Command/Add.php(322): OCA\LDAPContactsBackend\Service\ConnectionImporter->getAvailableConnections()
#2 /var/www/html/apps/ldap_contacts_backend/lib/Command/Add.php(158): OCA\LDAPContactsBackend\Command\Add->askImport()
#3 /var/www/html/3rdparty/symfony/console/Command/Command.php(240): OCA\LDAPContactsBackend\Command\Add->interact()
#4 /var/www/html/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run()
#5 /var/www/html/3rdparty/symfony/console/Application.php(1000): OC\Core\Command\Base->run()
#6 /var/www/html/3rdparty/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand()
#7 /var/www/html/3rdparty/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun()
#8 /var/www/html/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#9 /var/www/html/console.php(100): OC\Console\Application->run()
#10 /var/www/html/occ(11): require_once('/var/www/html/c...')
@Kunzol
Copy link

Kunzol commented Oct 5, 2021

In file ldap_contacts_backend/lib/Service/ConnectionImporter.php I added two "casts".
Line 51: ... (string) $c->ldapTLS ...
Line 71: ... (string) $c->ldapTLS ...
Which solved the problem.

I am not sure if this is the optimal solution.

I checked server/apps/user_ldap/lib/Configuration.php of the main nextcloud server code.

There it looks for me as if ldap_tls is defined implicit as an int and in function guessPortAndTLS the value is casted to "int".

@Kunzol
Copy link

Kunzol commented Oct 5, 2021

Another solution would be to modify extractTlsMode to work with "int" instead of "string".
Line 84 in ldap_contacts_backend/lib/Service/ConnectionImporter.php:

protected function extractTlsMode(string $host, string $port, int $startTls): string {
                if ($startTls === 1) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants