The default setup for qmail is to give a temporary error from qmail-local
if a file system quota is exceeded while trying to write to a mailbox.
The following patch is a diff against qmail-ldap-1.03-20020801 which will
allow you to define QUOTABOUNCE in your LDAPFLAGS.
i.e.
LDAPFLAGS=-DQLDAP_CLUSTER -DDASH_EXT -DEXTERNAL_TODO -DQUOTABOUNCE
The patch from the qmail.org site from Jeff Hayward won't work due to
modifications for the automatic creation of maildirs so I simply modified
it slighty and made it more user-friendly via a define. This may be nice
for anyone managing disk space by having file system quotas. Your
incoming queue may fill very quickly with the default behavior of a
temporary failure and later retry (still in queue)!
It would be nice to add this into the stock patch in the future. Any
replies feel free to send back directly to me.
diff -c -r qmail-1.03/error.c qmail-test/error.c
*** qmail-1.03/error.c Mon Jun 15 05:53:16 1998
--- qmail-test/error.c Mon Aug 26 17:46:59 2002
***************
*** 93,95 ****
--- 93,102 ----
#else
-13;
#endif
+
+ int error_dquot =
+ #ifdef EDQUOT
+ EDQUOT;
+ #else
+ -14;
+ #endif
diff -c -r qmail-1.03/error.h qmail-test/error.h
*** qmail-1.03/error.h Mon Jun 15 05:53:16 1998
--- qmail-test/error.h Mon Aug 26 17:46:59 2002
***************
*** 16,21 ****
--- 16,22 ----
extern int error_pipe;
extern int error_perm;
extern int error_acces;
+ extern int error_dquot;
extern char *error_str();
extern int error_temp();
diff -c -r qmail-1.03/qmail-local.c qmail-test/qmail-local.c
*** qmail-1.03/qmail-local.c Mon Aug 26 18:26:33 2002
--- qmail-test/qmail-local.c Mon Aug 26 18:01:52 2002
***************
*** 50,55 ****
--- 50,60 ----
void temp_qmail(fn) char *fn;
{ strerr_die5x(111,"Unable to open ",fn,": ",error_str(errno),". (#4.3.0)"); }
+ #ifdef QUOTABOUNCE
+ char *overquota =
+ "Recipient's mailbox is full, message returned to sender. (#5.2.2)";
+ #endif
+
int flagdoit;
int flag99;
***************
*** 161,167 ****
--- 166,181 ----
alarm(86400);
fd = open_excl(fntmptph);
+ #ifdef QUOTABOUNCE
+ if (fd == -1) {
+ if (errno == error_dquot)
+ _exit(8);
+ else
+ _exit(1);
+ }
+ #else
if (fd == -1) _exit(1);
+ #endif
substdio_fdbuf(&ss,read,0,buf,sizeof(buf));
substdio_fdbuf(&ssout,write,fd,outbuf,sizeof(outbuf));
***************
*** 195,201 ****
/* if it was error_exist, almost certainly successful; i hate NFS */
tryunlinktmp(); _exit(0);
! fail: tryunlinktmp(); _exit(1);
}
/* end child process */
--- 209,224 ----
/* if it was error_exist, almost certainly successful; i hate NFS */
tryunlinktmp(); _exit(0);
! fail:
! #ifdef QUOTABOUNCE
! if (errno == error_dquot) {
! tryunlinktmp(); _exit(8);
! } else {
! tryunlinktmp(); _exit(1);
! }
! #else
! tryunlinktmp(); _exit(1);
! #endif
}
/* end child process */
***************
*** 301,306 ****
--- 324,332 ----
case 6: strerr_die3x(111,"Unable to create maildir '", fn, "' (LDAP-ERR #2.5.2)");
case 7: strerr_die3x(111,"The maildir '", fn, "' seems to be corrupted. (LDAP-ERR
#2.5.3)");
#endif
+ #ifdef QUOTABOUNCE
+ case 8: strerr_die1x(100,overquota);
+ #endif
default: strerr_die1x(111,"Temporary error on maildir delivery. (#4.3.0)");
}
}
***************
*** 389,395 ****
return;
writeerrs:
! strerr_warn5("Unable to write ",fn,": ",error_str(errno),". (#4.3.0)",0);
if (flaglocked) seek_trunc(fd,pos);
close(fd);
_exit(111);
--- 415,428 ----
return;
writeerrs:
! #ifdef QUOTABOUNCE
! if (errno == error_dquot) {
! if (flaglocked) seek_trunc(fd,pos);
! close(fd);
! strerr_die1x(100,overquota);
! } else
! #endif
! strerr_warn5("Unable to write ",fn,": ",error_str(errno),". (#4.3.0)",0);
if (flaglocked) seek_trunc(fd,pos);
close(fd);
_exit(111);