From: <pdo...@us...> - 2009-02-14 07:32:42
|
Revision: 13403 http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=13403&view=rev Author: pdontthink Date: 2009-02-14 07:32:38 +0000 (Sat, 14 Feb 2009) Log Message: ----------- Ensure that hash directory computation is the same on both 32 and 64 bit architectures (#2596879) (Thanks to Mike Sweetser) Modified Paths: -------------- trunk/squirrelmail/ChangeLog trunk/squirrelmail/functions/prefs.php Modified: trunk/squirrelmail/ChangeLog =================================================================== --- trunk/squirrelmail/ChangeLog 2009-02-14 07:30:40 UTC (rev 13402) +++ trunk/squirrelmail/ChangeLog 2009-02-14 07:32:38 UTC (rev 13403) @@ -270,6 +270,8 @@ - Make all submit button names unique on compose screen - Make address book file permissions 0600 - same as preference files - Added compatibility with Dovecot's bigint UIDs + - Ensure that hash directory computation is the same on both 32 and + 64 bit architectures (#2596879). Version 1.5.1 (branched on 2006-02-12) -------------------------------------- Modified: trunk/squirrelmail/functions/prefs.php =================================================================== --- trunk/squirrelmail/functions/prefs.php 2009-02-14 07:30:40 UTC (rev 13402) +++ trunk/squirrelmail/functions/prefs.php 2009-02-14 07:32:38 UTC (rev 13403) @@ -117,8 +117,15 @@ * @since 1.2.0 */ function computeHashDirs($username) { - /* Compute the hash for this user and extract the hash directories. */ - $hash = base_convert(crc32($username), 10, 16); + /* Compute the hash for this user and extract the hash directories. */ + /* Note that the crc32() function result will be different on 32 and */ + /* 64 bit systems, thus the hack below. */ + $crc = crc32($username); + if ($crc & 0x80000000) { + $crc ^= 0xffffffff; + $crc += 1; + } + $hash = base_convert($crc, 10, 16); $hash_dirs = array(); for ($h = 0; $h < 4; ++ $h) { $hash_dirs[] = substr($hash, $h, 1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |