[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squirrelmail-cvs
Subject:    [SM-CVS] SF.net SVN: squirrelmail:[13402]
From:       pdontthink () users ! sourceforge ! net
Date:       2009-02-14 7:30:40
Message-ID: E1LYEz2-0007j0-97 () dn4whf1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 13402
          http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=13402&view=rev
Author:   pdontthink
Date:     2009-02-14 07:30:40 +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:
--------------
    branches/SM-1_4-STABLE/squirrelmail/ChangeLog
    branches/SM-1_4-STABLE/squirrelmail/functions/prefs.php

Modified: branches/SM-1_4-STABLE/squirrelmail/ChangeLog
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/ChangeLog	2009-02-09 09:19:29 UTC (rev 13401)
+++ branches/SM-1_4-STABLE/squirrelmail/ChangeLog	2009-02-14 07:30:40 UTC (rev 13402)
@@ -23,6 +23,8 @@
     update some core functionality to allow reusability of code.
   - Make address book file permissions 0600 - same as preference files.
   - Fix for address book nicknames that contain the : character.
+  - Ensure that hash directory computation is the same on both 32 and
+    64 bit architectures (#2596879).
 
 Version 1.4.17 - 03 December 2008
 ---------------------------------

Modified: branches/SM-1_4-STABLE/squirrelmail/functions/prefs.php
===================================================================
--- branches/SM-1_4-STABLE/squirrelmail/functions/prefs.php	2009-02-09 09:19:29 UTC \
                (rev 13401)
+++ branches/SM-1_4-STABLE/squirrelmail/functions/prefs.php	2009-02-14 07:30:40 UTC \
(rev 13402) @@ -144,8 +144,15 @@
  * @return array a list of hash dirs for this username
  */
 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.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
-----
squirrelmail-cvs mailing list
List address: squirrelmail-cvs@lists.sourceforge.net
List info (subscribe/unsubscribe/change options): \
                https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
Repository: http://squirrelmail.org/svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic