Skip to content

Commit a01e3ad

Browse files
author
in dow
authored
Add ldap_support_extended configuration
* Add ldap_support_extended configuration For samba, extended command is not supported. To solve, add configuration to call whoami or not. ``` DEBUG:ldap3:EXTENDED:ldap message received via <ldaps://samba:636 - ssl - user: CN=test2,CN=Users,DC=samba,DC=dom - not lazy - bound - open - <local: 172.18.0.0:33916 - remote: 172.18.0.0:636> - tls not started - listening - SyncStrategy - internal decoder>: <<{'controls': None, << 'messageID': 9, << 'payload': [(0, False, 10, 2), << (0, False, 4, b''), << (0, << False, << 4, << b'Extended Operation(1.3.6.1.4.1.4203.1.11.3) not supported'), << (2, False, 10, b'1.3.6.1.4.1.4203.1.11.3')], << 'protocolOp': 24} DEBUG:ldap3:PROTOCOL:EXTENDED response <[{'result': 2, 'description': 'protocolError', 'dn': '', 'message': 'Extended Operation(1.3.6.1.4.1.4203.1.11.3) not supported', 'referrals': None, 'responseName': '1.3.6.1.4.1.4203.1.11.3', 'responseValue': b'', 'type': 'extendedResp'}]> received via <ldaps://samba:636 - ssl - user: CN=test2,CN=Users,DC=samba,DC=dom - not lazy - bound - open - <local: 172.18.0.0:33916 - remote: 172.18.0.0:636> - tls not started - listening - SyncStrategy - internal decoder> DEBUG:ldap3:BASIC:done EXTENDED operation, result <False> ``` * Update README.md
1 parent aab208e commit a01e3ad

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,8 @@ ldap_password = verysecurepassword
3131
3232
# LDAP scope of the search
3333
ldap_scope = LEVEL
34+
35+
# LDAP extended option
36+
# If the server is samba, ldap_support_extended is should be no
37+
ldap_support_extended = yes
3438
```

radicale_auth_ldap/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def is_authenticated(self, user, password):
4444
BINDDN = self.configuration.get("auth", "ldap_binddn")
4545
PASSWORD = self.configuration.get("auth", "ldap_password")
4646
SCOPE = self.configuration.get("auth", "ldap_scope")
47+
SUPPORT_EXTENDED = self.configuration.getboolean("auth", "ldap_support_extended", fallback=True)
4748

4849
if BINDDN and PASSWORD:
4950
conn = ldap3.Connection(SERVER, BINDDN, PASSWORD)
@@ -80,8 +81,12 @@ def is_authenticated(self, user, password):
8081
conn = ldap3.Connection(SERVER, user_dn, password)
8182
conn.bind()
8283
self.logger.debug(conn.result)
83-
whoami = conn.extend.standard.who_am_i()
84-
self.logger.debug("LDAP whoami: %s" % whoami)
84+
if SUPPORT_EXTENDED:
85+
whoami = conn.extend.standard.who_am_i()
86+
self.logger.debug("LDAP whoami: %s" % whoami)
87+
else:
88+
self.logger.debug("LDAP skip extended: call whoami")
89+
whoami = conn.result['result'] == 0
8590
if whoami:
8691
self.logger.debug("LDAP bind OK")
8792
return True

0 commit comments

Comments
 (0)