[aur-dev] [PATCH] rpc: msearch: Give orphans on empty maintainer argument

Johannes Löthberg johannes at kyriasis.com
Sun Aug 9 14:05:39 UTC 2015


Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
---
This is based on the post-4.0.0 branch, though I guess that branch 
should be merged into master with the 4.0.0 release.

 web/lib/aurjson.class.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
index 7d94dab..e102fed 100644
--- a/web/lib/aurjson.class.php
+++ b/web/lib/aurjson.class.php
@@ -437,9 +437,13 @@ class AurJSON {
 	 */
 	private function msearch($http_data) {
 		$maintainer = $http_data['arg'];
-		$maintainer = $this->dbh->quote($maintainer);
 
-		$where_condition = "Users.Username = $maintainer ";
+		if (empty($maintainer)) {
+			$where_condition = "Users.ID is NULL";
+		} else {
+			$maintainer = $this->dbh->quote($maintainer);
+			$where_condition = "Users.Username = $maintainer ";
+		}
 
 		return $this->process_query('msearch', $where_condition);
 	}
-- 
2.5.0


More information about the aur-dev mailing list