Skip to content

Commit 1337793

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

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

auth_ldaps/models/res_company_ldap.py

Lines changed: 8 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,13 @@ 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 = (
37+
self.env["ir.config_parameter"]
38+
.sudo()
39+
.get_param("auth_ldap.disable_chase_ref")
40+
)
41+
if str2bool(ldap_chase_ref_disabled):
42+
connection.set_option(ldap.OPT_REFERRALS, ldap.OPT_OFF)
3543
if conf["skip_cert_validation"]:
3644
connection.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_ALLOW)
3745
# this creates a new tls context, which is required to apply

0 commit comments

Comments
 (0)