From: Vincent Zanotti Date: Wed, 8 Apr 2009 12:14:05 +0000 (+0200) Subject: Properly handles the case where an admin search for a good looking IP-address that... X-Git-Tag: xorg/0.10.1~118 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=8b17e99c22602bb4fe529c329ad3c077c35fa7e1;p=platal.git 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 --- 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);