File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -686,6 +686,26 @@ private function doConnect($host, $port): bool {
686686 $ this ->ldap ->setOption (null , LDAP_OPT_X_TLS_REQUIRE_CERT , LDAP_OPT_X_TLS_DEMAND );
687687 }
688688
689+ /** @var ICertificateManager $certManager */
690+ $ certManager = Server::get (ICertificateManager::class);
691+ $ defaultCertificatePath = $ certManager ->getDefaultCertificatesBundlePath ();
692+ // We check if default certificate path is actually set to a custom value.
693+ // Otherwise this would be a breaking change and cannot be backported.
694+ if (!empty ($ defaultCertificatePath ) && $ defaultCertificatePath !== \OC ::$ SERVERROOT . '/resources/config/ca-bundle.crt ' ) {
695+ $ absoluteBundlePath = $ certManager ->getAbsoluteBundlePath ();
696+ if ($ this ->ldap ->setOption (null , LDAP_OPT_X_TLS_CACERTFILE , $ absoluteBundlePath )) {
697+ $ this ->logger ->debug (
698+ 'Adjusted the tls certificate file path to ' . $ absoluteBundlePath ,
699+ ['app ' => 'user_ldap ' ]
700+ );
701+ } else {
702+ $ this ->logger ->warning (
703+ 'Could not change the tls certificate file path. ' ,
704+ ['app ' => 'user_ldap ' ]
705+ );
706+ }
707+ }
708+
689709 $ this ->ldapConnectionRes = $ this ->ldap ->connect ($ host , $ port ) ?: null ;
690710
691711 if ($ this ->ldapConnectionRes === null ) {
You can’t perform that action at this time.
0 commit comments