[Vmail-discuss] Re: vmail-sql and Maildir

Peter McGarvey xaphod at packet.org.uk
Fri, 6 Feb 2004 13:21:58 +0000


--VS++wcV0S1rZb1Fb
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline

* Donovan Craig <donovan@snapfrozen.com> 
* [2004-02-05 23:10:34 GMT]: On Thu, 5 Feb 2004 15:47:37 +0100
>> Deletion scripts would be great, but for creation, we use the
> following options in the vmail Exim transport:
>
> maildir_format 
> create_directory

I also use Exim to create the Maildir directories... only 1 problem...
tpop3d core dumps if the directory does not exist.

Hacking VE-popbox to work with mbox and  maildirs was easy enough.

See the attached diff...  save it as VE-popbox.diff in the same place as
VE-popbox then `patch < VE-popbox.diff`


-- 
TTFN, FNORD

Peter McGarvey
Freelance FreeBSD Hacker
(will work for bandwidth)

--VS++wcV0S1rZb1Fb
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: attachment; filename="VE-popbox.diff"

--- VE-popbox.orig	Wed May 15 19:57:42 2002
+++ VE-popbox	Fri Feb  6 13:15:46 2004
@@ -91,14 +91,17 @@
 
 	# create the maildrop
 	if (-e "$path/$file") { Error("maildrop `$file' already exists"); }
-	open(MBOX, ">$path/$file");
-	close(MBOX);
+	# CHANGE by xaphod
+	# We'll let exim do this just in case we've decided to
+	# use the Maildir format
+	#open(MBOX, ">$path/$file");
+	#close(MBOX);
 
 	# we now need to set this thing's permissions etc
-	($login, $pass, $uid, $gid) = getpwnam($user) or Error("could not find user `$user' in /etc/passwd");
-	chown($uid, $gid, "$path/$file") or Error("could not change ownership of file `$path/$file'", $!);
+	#($login, $pass, $uid, $gid) = getpwnam($user) or Error("could not find user `$user' in /etc/passwd");
+	#chown($uid, $gid, "$path/$file") or Error("could not change ownership of file `$path/$file'", $!);
 
-	chmod(0660, "$path/$file") or Error("could not change permissions of file `$path/$file'", $!);
+	#chmod(0660, "$path/$file") or Error("could not change permissions of file `$path/$file'", $!);
 
 	# now add the appropriate database record
 	$ff = $dbh->quote($file);
@@ -132,7 +135,12 @@
 Will remove POP3 maildrop for `$local\@$domain'
 EOF
 
-	if (-e "$path/$file") { unlink("$path/$file") or Error("could not delete mail spool", $!); }
+	# CHANGE by xaphod
+	# If we end up using the Maildir format an unlink will
+	# fail, so we'll make sure this will remove dirs too
+	#(but it's not very elegant)
+	if (-e "$path/$file") { `/bin/rm -r $path/$file`; }
+	#if (-e "$path/$file") { unlink("$path/$file") or Error("could not delete mail spool", $!); }
 
 	$stmt = <<EOF;
 	DELETE FROM popbox WHERE domain_name = $dd AND local_part = $ll

--VS++wcV0S1rZb1Fb--