https://github.com/lldap/lldap logo
rowra_ - hey, I'm trying to query (&(uid={})(me...
# troubleshooting
r
hey, I'm trying to query
(&(uid={})(memberOf={}))'˙
(its python,
{}
does g et fileld up) and I get
ldap3.core.exceptions.LDAPAttributeError: invalid attribute memberOf˙
its been working before, any ideas? filter seems alright
a
message has been deleted
n
I'm pretty sure that's a client side error, not an LLDAP error. Or do you see this in the LLDAP logs?
d
Same here, sample code:
Copy code
python
from ldap3 import Server, Connection, AUTO_BIND_NO_TLS
from ldap3.utils.conv import escape_filter_chars

ldap_bind_dn = "admin,ou=people,dc=ldap,dc=local"
ldap_password = "admin"

ldap_base_dn = "ou=people,dc=ldap,dc=local"
ldap_search_filter = "(&(memberof=cn=rclone_user,ou=groups,dc=ldap,dc=local)(|(uid={username})(mail={username})))"


def main():
    server = Server("localhost", port=389)
    connection = Connection(
        server, user=ldap_bind_dn, password=ldap_password, auto_bind=AUTO_BIND_NO_TLS
    )
    username="test@test.com"
    connection.search(
        search_base=ldap_base_dn,
        search_filter=ldap_search_filter.format(username=escape_filter_chars(username)),
        search_scope=SUBTREE,
        attributes=["uid"],
        time_limit=15,
    )
Which indeed seems to fail with
ldap3.core.exceptions.LDAPAttributeError: invalid attribute memberof": exit status 1
on 0.6.2.
n
Can I have the LLDAP logs? (Verbose)
d
One sec, yeah
n
Oh, I think I see
We don't get to the part where the client sends the query (as expected), but I've got a clue why
Are you on 0.6.2?
Yeah, the bug would reproduce on 0.6.2
@T0by another fun one! The schema breaks the query 😬 Because it doesn't contain the "memberOf" attribute, so the client rejects the filter as "not a valid attribute"
By the way, a workaround is to query the groups with that user as "member" and post process that in the script. Or revert to LLDAP from early July (it should be backward compatible), before we introduced the schema
d
Ah, I'll give it a go! Do you want me to open an issue on the tracker?
n
That would be great, thanks
d
t
Not again🥹
Oh lol, is the copilot PR fine?
n
It looks reasonable, can you review it maybe?
t
Will do!