Skip to content

Commit e8f06e7

Browse files
ryanc-merven
authored andcommitted
[IMP] auth_ldaps: Allow disabling LDAP ref-chasing
1 parent 4710036 commit e8f06e7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

auth_ldaps/models/res_company_ldap.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import ldap
99

1010
from odoo import fields, models
11+
from odoo.tools.misc import str2bool
1112

1213
_logger = logging.getLogger(__name__)
1314

@@ -32,6 +33,9 @@ def _connect(self, conf):
3233
if conf["is_ssl"]:
3334
uri = "ldaps://%s:%d" % (conf["ldap_server"], conf["ldap_server_port"])
3435
connection = ldap.initialize(uri)
36+
ldap_chase_ref_disabled = self.env['ir.config_parameter'].sudo().get_param('auth_ldap.disable_chase_ref')
37+
if str2bool(ldap_chase_ref_disabled):
38+
connection.set_option(ldap.OPT_REFERRALS, ldap.OPT_OFF)
3539
if conf["skip_cert_validation"]:
3640
connection.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW)
3741
# this creates a new tls context, which is required to apply

0 commit comments

Comments
 (0)