99
1010# logger = logging.getLogger(__name__)
1111
12+ # potential users in the Zope acl_users
13+ RESERVED_LOGINS = ["root" , "admin" , "adminrt" ]
14+ RESERVED_IDS = ["root" , "admin" , "adminrt" ]
15+
16+ # [node.ext.ldap:511][MainThread] LDAP search with filter: (&(objectClass=person)(sAMAccountName=root))
17+
18+ # [redturtle.pasldap:58][MainThread] func=pas.plugins.ldap.plugin.enumerateUsers info=None args=(<LDAPPlugin at /.../acl_users/pasldap>,) kwargs={'id': None, 'login': None, 'exact_match': False, 'sort_by': None, 'max_results': None, 'fullname': 'mario'} elapsed=32ms threshold=-1ms 🤔
19+
20+ # [redturtle.pasldap:58][MainThread] func=pas.plugins.ldap.plugin.enumerateUsers info=None args=(<LDAPPlugin at /.../acl_users/pasldap>,) kwargs={'id': None, 'login': None, 'exact_match': False, 'sort_by': None, 'max_results': None, 'email': 'mario'} elapsed=38ms threshold=-1ms 🤔
21+
22+ # [redturtle.pasldap:58][MainThread] func=pas.plugins.ldap.plugin.enumerateUsers info=None args=(<LDAPPlugin at /.../acl_users/pasldap>,) kwargs={'id': '...', 'login': None, 'exact_match': False, 'sort_by': None, 'max_results': None} elapsed=30ms threshold=-1ms 🤔
23+
24+ # XXX: se si fa una ricerca sul pannello di controllo, ad esempio con "mario" vengono comunque interrogati (almeno una volta)
25+ # tutti gli utenti dell'ldap ( !?)
26+
1227
1328# OPIONINATED
1429def resilient_enumerate_users (orig ):
@@ -30,8 +45,12 @@ def _wrapper(
3045 cache_key = None
3146 if login is not None and exact_match :
3247 cache_key = "login:%s" % login
48+ if login in RESERVED_LOGINS :
49+ return []
3350 elif id is not None and exact_match :
3451 cache_key = "id:%s" % id
52+ if id in RESERVED_IDS :
53+ return []
3554 if (
3655 cache_key
3756 and hasattr (self , "_cache_users" )
0 commit comments