X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fprefs.php;h=517beddad66f254c914870fcfb1899c5935eb06e;hb=5ce1ef683e48c352cc9c25c21542371a99d5401a;hp=3f8f9974792ec217208a9e75896fd68adcb651bb;hpb=6c99d1de81366bceab6c9d6cf12179eedc81f9bc;p=squirrelmail.git
diff --git a/functions/prefs.php b/functions/prefs.php
index 3f8f9974..517bedda 100644
--- a/functions/prefs.php
+++ b/functions/prefs.php
@@ -5,7 +5,7 @@
*
* This contains functions for filebased user prefs locations
*
- * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @copyright © 1999-2009 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
@@ -95,10 +95,11 @@ function getHashedDir($username, $dir, $hash_dirs = '') {
for ($h = 0; $h < $dir_hash_level; ++$h) {
$real_hash_dir .= '/' . $hash_dirs[$h];
if (!@is_dir($real_hash_dir)) {
+//FIXME: When safe_mode is turned on, the error suppression below makes debugging safe_mode UID/GID restrictions tricky... for now, I will add a check in configtest
if (!@mkdir($real_hash_dir, 0770)) {
- echo sprintf(_("Error creating directory %s."), $real_hash_dir) . '
' .
- _("Could not create hashed directory structure!") . "
\n" .
- _("Please contact your system administrator and report this error.") . "
\n";
+ error_box ( sprintf(_("Error creating directory %s."), $real_hash_dir) . "\n" .
+ _("Could not create hashed directory structure!") . "\n" .
+ _("Please contact your system administrator and report this error.") );
exit;
}
}
@@ -116,8 +117,15 @@ function getHashedDir($username, $dir, $hash_dirs = '') {
* @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);