[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hook for checking mailbox size quota



Matti,

would you consider adding the following diff to the mailbox program?

Eugene

===============
--- mailbox.c.orig	Mon Mar 23 23:28:46 1998
+++ mailbox.c	Thu Mar 26 21:38:13 1998
@@ -227,6 +227,10 @@
 					      EX_UNAVAILABLE : (E), 0, \
 						(A1), (A2), (A3), (A4))
 
+#ifdef CHECK_MB_SIZE
+extern int checkmbsize(char *,size_t);
+#endif
+
 #if	defined(HAVE_SOCKET)
 /*
  * Biff strategy:
@@ -1178,6 +1182,27 @@
 		     file);
 	  return;
 	}
+
+#ifdef CHECK_MB_SIZE
+	/* external procedure checkmbsize() accepts user name
+	   and current mailbox size.  It should return 0 if it is OK to
+	   write to the mailbox, or non-zero if `mailbox full'
+	   condition encountered.  The procedure itself is not included
+	   in Zmailer distribution; you need to write it yourself and
+	   modify the Makefile to pass -DCHECK_MB_SIZE to the compiler
+	   and to link with the object containing your custom
+	   checkmbsize() procedure. == <crosser@average.org> */
+
+	if (checkmbsize(rp->addr->user,st.st_size)) {
+	  notaryreport(rp->addr->user,"failed",
+		       "4.2.2 (Destination mailbox full)",
+		       "x-local; 500 (Attempting to deliver to full
mailbox)");
+	  DIAGNOSTIC(rp, usernam, EX_UNAVAILABLE,
+		     "size of mailbox \"%s\" exeeds quota for the user",
+		     file);
+	  return;
+	}
+#endif
 	
 	if (st.st_nlink > 1) {
 	  notaryreport(rp->addr->user,"failed",