summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2016-01-26 13:47:56 +0100
committerMartin Basti <mbasti@redhat.com>2016-01-27 12:54:25 +0100
commit9a945b201eab40dff7781d3240f046b648644779 (patch)
tree13f11b8e095ec4e8aa1daf2c1e6b005c6b206ef5 /ipalib
parent840de9bb48b37508e11fc0514761161e7cd0f9ef (diff)
downloadfreeipa-9a945b201eab40dff7781d3240f046b648644779.tar.gz
freeipa-9a945b201eab40dff7781d3240f046b648644779.tar.xz
freeipa-9a945b201eab40dff7781d3240f046b648644779.zip
Warn user when ipa *-find reach limit
Truncated entries were silently ignored, now a user receives warning. https://fedorahosted.org/freeipa/ticket/4022 Reviewed-By: Petr Spacek <pspacek@redhat.com> Reviewed-By: Gabe Alford <redhatrises@gmail.com>
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/messages.py10
-rw-r--r--ipalib/plugins/baseldap.py8
2 files changed, 17 insertions, 1 deletions
diff --git a/ipalib/messages.py b/ipalib/messages.py
index 078e13f59..e43584b10 100644
--- a/ipalib/messages.py
+++ b/ipalib/messages.py
@@ -331,6 +331,16 @@ class ExternalCommandOutput(PublicMessage):
format = _("%(line)s")
+class SearchResultTruncated(PublicMessage):
+ """
+ **13017** Results of LDAP search has been truncated
+ """
+
+ errno = 13017
+ type = "warning"
+ format = _("Search result has been truncated to configured search limit.")
+
+
def iter_messages(variables, base):
"""Return a tuple with all subclasses
"""
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index 5f7b7fba1..03a255ca1 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -35,6 +35,7 @@ from ipalib import output
from ipalib.text import _
from ipalib.util import json_serialize, validate_hostname
from ipalib.capabilities import client_has_capability
+from ipalib.messages import add_message, SearchResultTruncated
from ipapython.dn import DN
from ipapython.version import API_VERSION
@@ -2101,12 +2102,17 @@ class LDAPSearch(BaseLDAPCommand, crud.Search):
entries[i] = entry_to_dict(e, **options)
entries[i]['dn'] = e.dn
- return dict(
+ result = dict(
result=entries,
count=len(entries),
truncated=truncated,
)
+ if truncated:
+ add_message(options['version'], result, SearchResultTruncated())
+
+ return result
+
def pre_callback(self, ldap, filters, attrs_list, base_dn, scope, *args, **options):
assert isinstance(base_dn, DN)
return (filters, base_dn, scope)