From 156d5c4d9e9822019558600c5f8779bc3e4cb36c Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Fri, 17 Jan 2014 03:38:01 +0000 Subject: [PATCH] Use base32 encoding/decoding for authcodes --- include/class.client.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/class.client.php b/include/class.client.php index 001c94123..0fa312b5e 100644 --- a/include/class.client.php +++ b/include/class.client.php @@ -50,7 +50,7 @@ abstract class TicketUser { $authtoken = sprintf('%s%dx%s', ($this->isOwner() ? 'o' : 'c'), $algo, - base64_encode(pack('VV',$this->getId(), $this->getTicketId()))); + Base32::encode(pack('VV',$this->getId(), $this->getTicketId()))); switch($algo) { case 1: @@ -72,7 +72,8 @@ abstract class TicketUser { return null; //Unpack the user and ticket ids - $matches +=unpack('Vuid/Vtid', base64_decode(substr($matches['hash'], 0, 12))); + $matches +=unpack('Vuid/Vtid', + Base32::decode(strtolower(substr($matches['hash'], 0, 13)))); $user = null; switch ($matches['type']) { -- GitLab