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

List:       webmin-l
Subject:    [webmin-l] ReadMeail Module Problem and possible fix
From:       "Len Kawamoto" <len_webmin () riverbook ! net>
Date:       2006-01-31 19:50:15
Message-ID: 1138737015.29639 () r2d2 ! riverbook ! net
[Download RAW message or body]

Jamie,

I've noticed a problem with the ReadMail module.  If you have "treat mailbox \
subdirectories as" set to "subdirectories" and a user, say in order to keep forwarded \
email messages from other servers organized, has the following folder structure:  \
Inbox  Sentmail
   Drafts
   Yahoo\inbox
   Yahoo\savedmail
   Hotmail\inbox
   Hotmail\savedmail

when the user switches from "Yahoo\inbox" to "Hotmail\inbox" (ie: an actual mailbox \
file with the same name, different path) the index listing for one or the other \
folder gets corrupted.  I noticed that the routine called user_index_file() (found in \
file boxes-lib.pl) returns an index file name to be used by the ReadMail module for \
the index caching information.  This routine produces identical filenames for the \
above scenario.

A possible fix, which I've implemented in my install is to change the subroutine to \
the following:

# user_index_file(user|file)
sub user_index_file
{
local $us = $_[0];
$us =~ s/\//_/g;
local $subpath = ((length($_[0]) > length($folders_dir)) && (index($_[0], \
$folders_dir) == 0)) ? substr($_[0], length($folders_dir)+1) : ""; if \
(length($subpath)) {
        $subpath =~ s/\//\./g;
}
local $f = $_[0] =~ /^\/.*\/([^\/]+)$/ ?
        ($user_module_config_directory ?
                (length($subpath) ?
                "$user_module_config_directory/$subpath.findex" :
                "$user_module_config_directory/$1.findex") :
                "$module_config_directory/$us.findex") :
       $user_module_config_directory ?
        "$user_module_config_directory/$_[0].index" :
        "$module_config_directory/$_[0].index";
local $hn = &get_system_hostname();
return -r $f && !-r "$f.$hn" ? $f : "$f.$hn";
}

The generated index file name now includes the subpath (below the users mailbox_dir) \
as part of the name.  I haven't tested the scenario which fails the REGEXP in the \
ternary operator, so I'm not 100% sure if this is safe, but it looks safe to me.


Opinions? Corrections?



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
-
Forwarded by the Webmin mailing list at webadmin-list@lists.sourceforge.net
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-list


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

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