From a663e83cb2717ac4cf831261c93c1582f562a07f Mon Sep 17 00:00:00 2001 From: Martin Kosek Date: Tue, 17 Apr 2012 09:56:04 +0200 Subject: Raise proper exception when LDAP limits are exceeded ldap2 plugin returns NotFound error for find_entries/get_entry queries when the server did not manage to return an entry due to time limits. This may be confusing for user when the entry he searches actually exists. This patch fixes the behavior in ldap2 plugin to 1) Return even a zero search results + truncated bool set in ldap2.find_entries 2) Raise LimitsExceeded in ldap2.get_entry and ldap2.find_entry_by_attr instead of NotFound error This changed several assumptions about ldap2.find_entries results. Several calls accross IPA code base had to be amended. https://fedorahosted.org/freeipa/ticket/2606 --- ipalib/plugins/automount.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ipalib/plugins') diff --git a/ipalib/plugins/automount.py b/ipalib/plugins/automount.py index 9df400d2e..366729425 100644 --- a/ipalib/plugins/automount.py +++ b/ipalib/plugins/automount.py @@ -724,6 +724,8 @@ class automountkey(LDAPObject): basedn, _ldap.SCOPE_ONELEVEL) if len(entries) > 1: raise errors.NotFound(reason=_('More than one entry with key %(key)s found, use --info to select specific entry.') % dict(key=pkey)) + if truncated: + raise errors.LimitsExceeded() dn = entries[0][0] return dn -- cgit