prewikka/master: Fix IDMEFDatabase exception on empty criteria string.

[email protected] Wed, 10 Jun 2009 12:54:04 +0200 (CEST)
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
commit 636fd5f854f30a79f9c3989f33e4bf87b7c603ea
Author: Yoann Vandoorselaere <[email protected]>
Date:   Wed Jun 10 10:59:12 2009 +0200

    Fix IDMEFDatabase exception on empty criteria string.
    
    Providing an empty criteria string as argument to _getMessageIdents used
    to generate a SWIG pointer mismatch exception. Empty criteria string are
    now checked for and converted to None. This fixes #346.


========================================

 prewikka/IDMEFDatabase.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

========================================

diff --git a/prewikka/IDMEFDatabase.py b/prewikka/IDMEFDatabase.py
index 25c6e88..8d1ff57 100644
--- a/prewikka/IDMEFDatabase.py
+++ b/prewikka/IDMEFDatabase.py
@@ -368,11 +368,11 @@ class IDMEFDatabase:
             self._db_destroy(self._db)
 
     def _getMessageIdents(self, get_message_idents, criteria, limit, offset, order_by):
+        if len(criteria) == 0:
+            criteria = None
+
         if type(criteria) is list:
-            if len(criteria) == 0:
-                criteria = None
-            else:
-                criteria = " && ".join(criteria)
+            criteria = " && ".join(criteria)
 
         if criteria:
             criteria = idmef_criteria_new_from_string(criteria)
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog