On Thu, Jul 30, 2015 at 1:32 AM, Jan Cholasta <jchol...@redhat.com> wrote:

> Dne 30.7.2015 v 09:23 Jan Cholasta napsal(a):
>
>> Hi,
>>
>> Dne 29.7.2015 v 17:23 Gabe Alford napsal(a):
>>
>>> Hello,
>>>
>>> Fix for https://fedorahosted.org/freeipa/ticket/4023
>>>
>>
>> Actually, 0 means unlimited for size limit, see
>> <
>> http://www.python-ldap.org/doc/html/ldap.html#ldap.LDAPObject.search_ext_s
>> >.
>>
>
> After reading the ticket I think this should be fixed the other way
> around: make 0 mean unlimited for both time and size limit and fix the
> config plugin and LDAPClient to respect that.
>
>
Thanks for the review. Updated patch attached.


> --
> Jan Cholasta
>
From 58e95a7eebe6e333786d9bd6b798490bdae25941 Mon Sep 17 00:00:00 2001
From: Gabe <redhatri...@gmail.com>
Date: Thu, 30 Jul 2015 07:04:06 -0600
Subject: [PATCH] Standardize minvalue for ipasearchrecordlimit and
 ipasesarchsizelimit for unlimited minvalue

https://fedorahosted.org/freeipa/ticket/4023
---
 API.txt                                     |  4 ++--
 VERSION                                     |  4 ++--
 install/ui/test/data/ipa_init_commands.json | 10 +++++-----
 install/ui/test/data/ipa_init_objects.json  | 10 +++++-----
 install/ui/test/data/json_metadata.json     |  8 ++++----
 ipalib/plugins/baseldap.py                  |  4 ++--
 ipalib/plugins/config.py                    | 10 +++++-----
 7 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/API.txt b/API.txt
index 6ab30ddab41715fdbccb4f37aa1852621bca62b4..90e52a686eb73af8af87b6065868d641e7e868ec 100644
--- a/API.txt
+++ b/API.txt
@@ -778,8 +778,8 @@ option: StrEnum('ipakrbauthzdata', attribute=True, autofill=False, cli_name='pac
 option: Int('ipamaxusernamelength', attribute=True, autofill=False, cli_name='maxusername', minvalue=1, multivalue=False, required=False)
 option: Bool('ipamigrationenabled', attribute=True, autofill=False, cli_name='enable_migration', multivalue=False, required=False)
 option: Int('ipapwdexpadvnotify', attribute=True, autofill=False, cli_name='pwdexpnotify', minvalue=0, multivalue=False, required=False)
-option: Int('ipasearchrecordslimit', attribute=True, autofill=False, cli_name='searchrecordslimit', minvalue=-1, multivalue=False, required=False)
-option: Int('ipasearchtimelimit', attribute=True, autofill=False, cli_name='searchtimelimit', minvalue=-1, multivalue=False, required=False)
+option: Int('ipasearchrecordslimit', attribute=True, autofill=False, cli_name='searchrecordslimit', minvalue=0, multivalue=False, required=False)
+option: Int('ipasearchtimelimit', attribute=True, autofill=False, cli_name='searchtimelimit', minvalue=0, multivalue=False, required=False)
 option: Str('ipaselinuxusermapdefault', attribute=True, autofill=False, cli_name='ipaselinuxusermapdefault', multivalue=False, required=False)
 option: Str('ipaselinuxusermaporder', attribute=True, autofill=False, cli_name='ipaselinuxusermaporder', multivalue=False, required=False)
 option: StrEnum('ipauserauthtype', attribute=True, autofill=False, cli_name='user_auth_type', csv=True, multivalue=True, required=False, values=(u'password', u'radius', u'otp', u'disabled'))
diff --git a/VERSION b/VERSION
index 678d1f8a7e588d480b16441e12e4d527d9c1cd98..837ee846f330779bbaa5fa43311a74c13b013690 100644
--- a/VERSION
+++ b/VERSION
@@ -90,5 +90,5 @@ IPA_DATA_VERSION=20100614120000
 #                                                      #
 ########################################################
 IPA_API_VERSION_MAJOR=2
-IPA_API_VERSION_MINOR=147
-# Last change: mbasti - Consolidate DNS RR in API and schema
+IPA_API_VERSION_MINOR=148
+# Last change: galford - Change ipasearchtimelime and ipasearchrecordslimit to 0 for unlimited
diff --git a/install/ui/test/data/ipa_init_commands.json b/install/ui/test/data/ipa_init_commands.json
index 743f508e2a733b766008bdd21838454ef7df8c21..477d7cf75aabd5c23dbf91a6305bfcbb9fbf5b1b 100644
--- a/install/ui/test/data/ipa_init_commands.json
+++ b/install/ui/test/data/ipa_init_commands.json
@@ -2446,13 +2446,13 @@
                         "attribute": true,
                         "class": "Int",
                         "deprecated_cli_aliases": [],
-                        "doc": "Maximum amount of time (seconds) for a search (> 0, or -1 for unlimited)",
+                        "doc": "Maximum amount of time (seconds) for a search (> 0, or 0 for unlimited)",
                         "flags": [
                             "nonempty"
                         ],
                         "label": "Search time limit",
                         "maxvalue": 2147483647,
-                        "minvalue": -1,
+                        "minvalue": 0,
                         "name": "ipasearchtimelimit",
                         "type": "int"
                     },
@@ -2460,13 +2460,13 @@
                         "attribute": true,
                         "class": "Int",
                         "deprecated_cli_aliases": [],
-                        "doc": "Maximum number of records to search (-1 is unlimited)",
+                        "doc": "Maximum number of records to search (0 is unlimited)",
                         "flags": [
                             "nonempty"
                         ],
                         "label": "Search size limit",
                         "maxvalue": 2147483647,
-                        "minvalue": -1,
+                        "minvalue": 0,
                         "name": "ipasearchrecordslimit",
                         "type": "int"
                     },
@@ -24018,4 +24018,4 @@
         "methods": {},
         "objects": {}
     }
-}
\ No newline at end of file
+}
diff --git a/install/ui/test/data/ipa_init_objects.json b/install/ui/test/data/ipa_init_objects.json
index c8c836926d94dd4c1903aa9a62fa91c11a238e75..14b19c40c6af6a6e7ecca14f4ce92c1a9ad69e2c 100644
--- a/install/ui/test/data/ipa_init_objects.json
+++ b/install/ui/test/data/ipa_init_objects.json
@@ -498,11 +498,11 @@
                     {
                         "class": "Int",
                         "deprecated_cli_aliases": [],
-                        "doc": "Maximum amount of time (seconds) for a search (> 0, or -1 for unlimited)",
+                        "doc": "Maximum amount of time (seconds) for a search (> 0, or 0 for unlimited)",
                         "flags": [],
                         "label": "Search time limit",
                         "maxvalue": 2147483647,
-                        "minvalue": -1,
+                        "minvalue": 0,
                         "name": "ipasearchtimelimit",
                         "required": true,
                         "type": "int"
@@ -510,11 +510,11 @@
                     {
                         "class": "Int",
                         "deprecated_cli_aliases": [],
-                        "doc": "Maximum number of records to search (-1 is unlimited)",
+                        "doc": "Maximum number of records to search (0 is unlimited)",
                         "flags": [],
                         "label": "Search size limit",
                         "maxvalue": 2147483647,
-                        "minvalue": -1,
+                        "minvalue": 0,
                         "name": "ipasearchrecordslimit",
                         "required": true,
                         "type": "int"
@@ -9158,4 +9158,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/install/ui/test/data/json_metadata.json b/install/ui/test/data/json_metadata.json
index a9e66230f94875f7da7efa73141e244b8201a5cc..e5ce9fe7754142e0e26883d71e8a867dc496c786 100644
--- a/install/ui/test/data/json_metadata.json
+++ b/install/ui/test/data/json_metadata.json
@@ -2596,14 +2596,14 @@
                         "cli_name": "searchtimelimit",
                         "cli_short_name": null,
                         "default": null,
-                        "doc": "Max. amount of time (sec.) for a search (> 0, or -1 for unlimited)",
+                        "doc": "Max. amount of time (sec.) for a search (> 0, or 0 for unlimited)",
                         "exclude": null,
                         "flags": [],
                         "hint": null,
                         "include": null,
                         "label": "Search time limit",
                         "maxvalue": 2147483647,
-                        "minvalue": -1,
+                        "minvalue": 0,
                         "multivalue": false,
                         "name": "ipasearchtimelimit",
                         "primary_key": false,
@@ -2619,14 +2619,14 @@
                         "cli_name": "searchrecordslimit",
                         "cli_short_name": null,
                         "default": null,
-                        "doc": "Max. number of records to search (-1 is unlimited)",
+                        "doc": "Max. number of records to search (0 is unlimited)",
                         "exclude": null,
                         "flags": [],
                         "hint": null,
                         "include": null,
                         "label": "Search size limit",
                         "maxvalue": 2147483647,
-                        "minvalue": -1,
+                        "minvalue": 0,
                         "multivalue": false,
                         "name": "ipasearchrecordslimit",
                         "primary_key": false,
diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py
index 36a5d5f4918828a97b0b30d4613819f777722de8..231f5036df0db00456752b3356a15e55b85e1b4e 100644
--- a/ipalib/plugins/baseldap.py
+++ b/ipalib/plugins/baseldap.py
@@ -1917,14 +1917,14 @@ class LDAPSearch(BaseLDAPCommand, crud.Search):
     takes_options = (
         Int('timelimit?',
             label=_('Time Limit'),
-            doc=_('Time limit of search in seconds'),
+            doc=_('Time limit of search in seconds (0 is unlimited)'),
             flags=['no_display'],
             minvalue=0,
             autofill=False,
         ),
         Int('sizelimit?',
             label=_('Size Limit'),
-            doc=_('Maximum number of entries returned'),
+            doc=_('Maximum number of entries returned (0 is unlimited)'),
             flags=['no_display'],
             minvalue=0,
             autofill=False,
diff --git a/ipalib/plugins/config.py b/ipalib/plugins/config.py
index 6267313d5e9af2d97f45f987115de143d7aa7915..8b4b873dd4f25216f7ea2a59139a0a93401427c9 100644
--- a/ipalib/plugins/config.py
+++ b/ipalib/plugins/config.py
@@ -80,7 +80,7 @@ register = Registry()
 
 def validate_searchtimelimit(ugettext, limit):
     if limit == 0:
-        raise ValidationError(name='ipasearchtimelimit', error=_('searchtimelimit must be -1 or > 1.'))
+        raise ValidationError(name='ipasearchtimelimit', error=_('searchtimelimit must be 0 or > 1.'))
     return None
 
 @register()
@@ -153,14 +153,14 @@ class config(LDAPObject):
         Int('ipasearchtimelimit', validate_searchtimelimit,
             cli_name='searchtimelimit',
             label=_('Search time limit'),
-            doc=_('Maximum amount of time (seconds) for a search (> 0, or -1 for unlimited)'),
-            minvalue=-1,
+            doc=_('Maximum amount of time (seconds) for a search (> 0, or 0 for unlimited)'),
+            minvalue=0,
         ),
         Int('ipasearchrecordslimit',
             cli_name='searchrecordslimit',
             label=_('Search size limit'),
-            doc=_('Maximum number of records to search (-1 is unlimited)'),
-            minvalue=-1,
+            doc=_('Maximum number of records to search (0 is unlimited)'),
+            minvalue=0,
         ),
         IA5Str('ipausersearchfields',
             cli_name='usersearch',
-- 
1.8.3.1

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to