From 8b17e99c22602bb4fe529c329ad3c077c35fa7e1 Mon Sep 17 00:00:00 2001 From: Vincent Zanotti Date: Wed, 8 Apr 2009 14:14:05 +0200 Subject: [PATCH] Properly handles the case where an admin search for a good looking IP-address that can't in facts be translated to its 32bits representation. Signed-off-by: Vincent Zanotti --- modules/search/classes.inc.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/search/classes.inc.php b/modules/search/classes.inc.php index af3ee22..8289da5 100644 --- a/modules/search/classes.inc.php +++ b/modules/search/classes.inc.php @@ -308,7 +308,14 @@ class QuickSearch extends SField } if (!empty($this->ip)) { $ip = ip_to_uint($this->ip); - $where[] = "( ls.ip = $ip OR ls.forward_ip = $ip ) AND ls.suid = 0"; + + // If the IP address requested for the search cannot be translated, + // the predicate should always be valued to false. + if ($ip != null) { + $where[] = "( ls.ip = $ip OR ls.forward_ip = $ip ) AND ls.suid = 0"; + } else { + $where[] = "false"; + } } return join(" AND ", $where); -- 2.1.4