<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Our mailbox.db file recently became corrputed, and
so I wrote a little script to generate a new one, based purely on the contents
of /var/spool/imap/ . The script worked fine, and I could see all the folders in
cyradm, and could log in as a user with no problem. However, my import seems to
have lost all directory permissions, and as such, I could not do either a folder
list of see emails when logged in as an IMAP user (though I was fine as a POP3
user with seeing emails). When I manually added permissions for the user for
each folder, I regained the ability to see emails and folders.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Can anybody tell me what I did wrong?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>What I did:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#!/usr/bin/perl</FONT></DIV>
<DIV> </DIV><FONT face=Arial size=2>
<DIV><BR>listdirs("user");</DIV>
<DIV> </DIV>
<DIV><BR>sub listdirs ($) {<BR> my
$dir = shift;<BR> my @dirs =
();<BR> opendir DIR,
"/var/spool/imap/$dir";<BR> while
($entry = readdir DIR)
{<BR>
next if ($entry =~ /^\./ || ! -d
"/var/spool/imap/$dir/$entry");<BR>
$cyrname =
$dir;<BR>
$cyrname =~ s:/:.:g
;<BR>
if ($dir eq "user")
{<BR>
$username =
$entry;<BR>
} else
{<BR>
$username =
$dir;<BR>
$username =~ s:^user/([^/]+).*:$1:
;<BR>
}<BR>
print
"${cyrname}.${entry}\tdefault\t$username\tlrswipcda\n";<BR>#
print "sam ${cyrname}.${entry} $username
lrswipcda\n";<BR>
push @dirs, $entry;<BR>
}<BR> closedir
DIR;<BR> foreach (@dirs) {
listdirs("$dir/$_") ; }<BR>}</DIV>
<DIV> </DIV>
<DIV>the hashed out line has the command I pasted into cyradm to fix the
permissions problem.</DIV>
<DIV>This generates a file with entries like this:</DIV>
<DIV> </DIV>
<DIV>user.robin default robin
lrswipcda</DIV>
<DIV>user.robin.Abuse default
robin lrswipcda<BR>user.robin.Clients
default robin lrswipcda<BR>user.robin.Sent_Mail
default robin lrswipcda</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>(the white space is all tabs) I then used this as the import source for the
new database (after firast deleting the old one and all files in db)</DIV>
<DIV> </DIV>
<DIV>cat /var/imap/mailboxes.db.import | /usr/cyrus/bin/ctl_mboxlist -u</DIV>
<DIV> </DIV>
<DIV>I also noticed there were one or two folders with white space in their
names, and that cyradm complained about this. Does anyone know how to get it to
accept these?</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>thanks,</DIV>
<DIV> </DIV>
<DIV>Robin</FONT></DIV></BODY></HTML>