There was no default value set even though we were using config.get and it was throwing exceptions if someone deleted one of the related config values.

Pavel
>From 5dfda61f3995f4d5ae5813b7f70f2d2658a687f0 Mon Sep 17 00:00:00 2001
From: Pavel Zuna <pz...@redhat.com>
Date: Thu, 14 Oct 2010 10:54:24 -0400
Subject: [PATCH 2/2] Add fail-safe defaults to time and size limits in ldap2 searches.

---
 ipaserver/plugins/ldap2.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py
index 096d3a3..1d18bbb 100644
--- a/ipaserver/plugins/ldap2.py
+++ b/ipaserver/plugins/ldap2.py
@@ -515,9 +515,9 @@ class ldap2(CrudBackend, Encoder):
         if time_limit is None or size_limit is None:
             (cdn, config) = self.get_ipa_config()
             if time_limit is None:
-                time_limit = config.get('ipasearchtimelimit')[0]
+                time_limit = config.get('ipasearchtimelimit', [-1])[0]
             if size_limit is None:
-                size_limit = config.get('ipasearchrecordslimit')[0]
+                size_limit = config.get('ipasearchrecordslimit', [0])[0]
         if not isinstance(size_limit, int):
             size_limit = int(size_limit)
         if not isinstance(time_limit, float):
-- 
1.7.1.1

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to