From b96c9d0a2c6158e607e982d4d795e58e05e2f45b Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Mon, 4 Feb 2013 16:03:06 +0000 Subject: [PATCH] Use md5 hashes as request buffer keys --- src/messenger/webim/install/dbinfo.php | 3 ++- src/messenger/webim/libs/classes/client_side_processor.php | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/messenger/webim/install/dbinfo.php b/src/messenger/webim/install/dbinfo.php index b6197866..0026e364 100644 --- a/src/messenger/webim/install/dbinfo.php +++ b/src/messenger/webim/install/dbinfo.php @@ -59,7 +59,8 @@ $dbtables = array( "${mysqlprefix}requestbuffer" => array( "requestid" => "int NOT NULL auto_increment PRIMARY KEY", - "requestkey" => "varchar(128) NOT NULL", + // Use MD5 hashes as keys + "requestkey" => "char(32) NOT NULL", "request" => "text NOT NULL" ), diff --git a/src/messenger/webim/libs/classes/client_side_processor.php b/src/messenger/webim/libs/classes/client_side_processor.php index b227a7bf..9585e685 100644 --- a/src/messenger/webim/libs/classes/client_side_processor.php +++ b/src/messenger/webim/libs/classes/client_side_processor.php @@ -60,7 +60,7 @@ abstract class ClientSideProcessor extends RequestProcessor { $db = Database::getInstance(); $db->query( "INSERT INTO {requestbuffer} (request, requestkey) VALUES (:request, :key)", - array(':request' => serialize($request), ':key' => $key) + array(':request' => serialize($request), ':key' => md5($key)) ); } @@ -72,6 +72,9 @@ abstract class ClientSideProcessor extends RequestProcessor { */ protected function getRequestsFromBuffer($key) { $db = Database::getInstance(); + + $key = md5($key); + // Get requests from database $requests = $db->query( "SELECT request FROM {requestbuffer} WHERE requestkey = :key",