[Dovecot] deliver + quota failure

Mark Ruijs mark.ruys at in2sports.net
Sun Oct 29 09:45:09 UTC 2006


I also found the cause of why the Quota Exceeded message won't pass the
spam/virusfilter in some cases. It only happens when the original mail is
MIME. Then the reply mail contains the original mail, but only the headers.
According to the Perl library MIME::Parser, the mail has a "unexpected end
of preamble". It happed to be the following part:

 

--24332/in2sports2.vianetworks.nl-

Content-Type: message/rfc822

 

From: "Mark Ruijs" <test at in2sports.net>

To: <test at ruijs.cc>

Subject: w

Date: Sun, 29 Oct 2006 09:41:56 +0100

Content-Type: multipart/alternative;

  boundary="----=_NextPart_000_0001_01C6FB3E.797DA7A0"

. more headers .

 

 

--24332/in2sports2.vianetworks.nl--

 

This is generated in  deliver/mail-send.c, the function
mail_send_rejection(struct mail *mail, const char *recipient, const char
*reason):

 

    /* original message's headers */

    fprintf(f, "--%s\r\nContent-Type: message/rfc822\r\n\r\n", boundary);

 

    input = mail_get_stream(mail, &hdr_size, NULL);

    if (input != NULL) {

      input = i_stream_create_limit(default_pool, input,

            0, hdr_size.physical_size);

      while ((ret = i_stream_read_data(input, &data, &size, 0)) > 0) {

        fwrite(data, size, 1, f);

        i_stream_skip(input, size);

      }

 

 

My C is a bit rusty. Sure someone here can add a check in the while-loop to
suppress output of the "Content-Type.boundary" part? Otherwise I'll give it
a shot.

 

Mark

 

 

This is how I tested the (in)validity of the notice message:

 

#!/usr/bin/perl

require MIME::Parser;

MIME::Tools->debugging(1);

my $parser = new MIME::Parser;

$parser->ignore_errors(0);

$entity = $parser->parse(\*STDIN);

$entity->dump_skeleton;

 

 

  _____  

Van: dovecot-bounces at dovecot.org [mailto:dovecot-bounces at dovecot.org] Namens
Mark Ruijs
Verzonden: zondag 29 oktober 2006 2:04
Aan: dovecot at dovecot.org
Onderwerp: Re: [Dovecot] deliver + quota failure

 

I investigated the deliver with quota's bug a little more (rc10, mysql,
virtual domains, maildir). My log files reads:

 

deliver(test at ruijs.cc): Info: msgid=<000f01c6fac1$bd4e8670$8801a8c0 at Moskou>:
save failed to INBOX

deliver(test at ruijs.cc): Info: sieve runtime error: Keep: Generic Error

deliver(test at ruijs.cc): Info: msgid=<000f01c6fac1$bd4e8670$8801a8c0 at Moskou>:
save failed to INBOX

deliver(test at ruijs.cc): Error:
open(ruijs.cc/test//.temp.in2sports2.vianetworks.nl.13210.72d247ac698d0019)
failed: No such file or directory

deliver(mark at ruijs.cc): Info:
msgid=<dovecot-1162066721-407295-0 at in2sports2.vianetworks.nl>: saved mail to
Junk

 

Dovecot tries to deliver, but notices quota exceeded. I don't think Sieve is
playing a role here - I added Sieve before I encountered the problem.

 

Two problems:

1)   The .dovecot.lda-dupes can't be written (that's what the open...failed
notice is about).

2)   The Quota Exceed mail seem to contain mal-formed headers (that's why it
the notice-mail ends in my junk-folder).

 

Digging into deliver.c, I noticed that auth_client_put_user_env() changes
the HOME environment from /var/mail (which is ok), to ruijs.cc/test/ (which
is the maildir, relative to /var/mail). And then fopen fails (see the trace
below). So I think that the code

 

    auth_socket = getenv("AUTH_SOCKET_PATH");

    if (auth_socket == NULL)

      auth_socket = DEFAULT_AUTH_SOCKET_PATH;

 

    ret = auth_client_put_user_env(ioloop, auth_socket,

                 destination, process_euid);

    if (ret != 0)

      return ret;

 

    home = getenv("HOME");

    if (home != NULL) {

      /* If possible chdir to home directory so core file

         could be written. If it fails, don't worry. */

      (void)chdir(home);

 

is the key. Should the chdir be done *before* the call to
auth_client_put_user_env()? I'm not familiar with the internal workings of
the Dovecot LDA, so I won't suggest a proper fix. Who will.

 

As for the mal-formed headers, I'll take a look at it later.

 

Mark

 

#0  i_error (format=0x80ac5f7 "open(%s) failed: %m") at failures.c:203

#1  0x0809f900 in dotlock_create (path=0x9ece2c0
"ruijs.cc/test//.dovecot.lda-dupes", dotlock=0x9edfc48, flags=Variable
"flags" is not available.

) at file-dotlock.c:265

#2  0x0809fb71 in file_dotlock_open (set=0x80b9c90, path=0x9ece2c0
"ruijs.cc/test//.dovecot.lda-dupes", flags=0, dotlock_r=0x9ee7920) at
file-dotlock.c:614

#3  0x08056ec5 in duplicate_new (path=0x9ece2c0
"ruijs.cc/test//.dovecot.lda-dupes") at duplicate.c:157

#4  0x080571c6 in duplicate_mark (id=0x9ece270, id_size=55, user=0xbf9edb45
"test at ruijs.cc", time=1162163205) at duplicate.c:195

#5  0x080573c9 in mail_send_rejection (mail=0x9ede7e0, recipient=0xbf9edb45
"test at ruijs.cc", reason=0x9edc218 "Quota exceeded") at mail-send.c:51

#6  0x08056c51 in main (argc=5, argv=0xbf9ec5d4) at deliver.c:595

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dovecot.org/pipermail/dovecot/attachments/20061029/b7645bd5/attachment.html 


More information about the dovecot mailing list