1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
From smail.sbay.org!smail3-maintainers-request Tue Apr 22 18:46:08 1997
Status: RO
X-VM-v5-Data: ([nil nil nil t t nil nil nil nil]
["3081" "Tue" "22" "April" "1997" "22:31:05" "GMT" "Bruce Becker" "bdb@hotlips.gts.net" "<E9297u.BIH.0.hotlips@GTS.Net>" "97" "mailbox size test for appendfile transport" "^Newsgroups:" nil nil "4" nil "mailbox size test for appendfile transport" nil nil]
nil)
Return-Path: <smail3-maintainers-request@smail.sbay.org>
Received: from weird.com(really [204.92.254.5]) by most.weird.com
via sendmail with esmtp
id <m0wJoK3-00076uC@most.weird.com>
for <woods@most.weird.com>; Tue, 22 Apr 1997 18:46:03 -0400 (EDT)
(Smail-3.2.0.94-Pre 1997-Apr-12 #27 built 1997-Apr-21)
Received: from whome.planix.com (whome.planix.com [204.29.161.33]) by weird.com (8.6.5/8.6.5) with ESMTP id SAA13598 for <woods@weird.com>; Tue, 22 Apr 1997 18:45:47 -0400
Received: from zygot.ati.com(really [157.22.243.6]) by whome.planix.com
via sendmail with smtp
id <m0wJoJh-000CECC@whome.planix.com>
for <woods@planix.com>; Tue, 22 Apr 1997 18:45:41 -0400 (EDT)
(Smail-3.2 1996-Jul-4 #2 built 1996-Sep-5)
Received: from thunder.sbay.org by zygot.ati.com with bsmtp
(Smail3.1.29.1 #1) id m0wJoIv-0001KsC; Tue, 22 Apr 97 15:44 PDT
Received: by thunder.sbay.org (Linux Smail3.2 #2)
id m0wJoN4-000836C; Tue, 22 Apr 1997 15:49:10 -0700 (PDT)
Old-Return-Path: <zygot!GTS.ORG!bdb>
Path: not-for-mail
Message-ID: <E9297u.BIH.0.hotlips@GTS.Net>
Followup-To: comp.mail.smail
Organization: G.T.S., Toronto, Ontario
Resent-Message-ID: <"tpk17.A.2WD.kBUXz"@thunder.sbay.org>
X-Mailing-List: <smail3-maintainers@smail.sbay.org> archive/latest/434
Precedence: list
Newsgroups: comp.mail.smail,mlin.smail3.maintainers
X-Newsposter: trn 4.0-test56 (2 Mar 97)
X-Loop: smail3-maintainers@smail.sbay.org
Resent-Date: Tue, 22 Apr 1997 18:45:47 -0400
Resent-From: smail3-maintainers@smail.sbay.org
Resent-Sender: smail3-maintainers-request@smail.sbay.org
From: bdb@hotlips.gts.net (Bruce Becker)
Reply-To: news@gts.org
To: smail3-maintainers@smail.sbay.org
Date: Tue, 22 Apr 1997 22:31:05 GMT
Subject: mailbox size test for appendfile transport
Here's a simple addition to the appendfile transport
driver's private attributes - the attribute is "size",
a long integer object. The newly opened file for
delivery is tested for filesize against the "size"
attribute - if the filesize is > the specification,
the incoming email object is bounced back to sender
with a "mailbox full" message.
This could no doubt be usefully enhanced in a number
of ways, but it's a start...
,u, Bruce Becker Toronto, Ontario 1 416 699 1868
a /i/ Internet: bdb@gts.org Uucp: ...!gts!bdb
`\o\-e O dear, where can the matter be, When converted to energy, There's
_< /_ a slight loss in parity, Johnny's so long at the fair - N. Testicle
--------- 8< --------- 8< --------- 8< --------- 8< --------- 8< ---------
*** appendfile.h~ Mon Feb 26 13:40:44 1996
--- appendfile.h Sun Apr 20 17:40:46 1997
***************
*** 24,29 ****
--- 24,30 ----
char *prefix; /* string prefixed to message */
char *suffix; /* string appended to message */
int mode; /* mode for creation */
+ long size; /* file size limit */
};
/* transport flags private to pipe.c */
*** appendfile.c~ Wed Dec 11 16:10:39 1996
--- appendfile.c Mon Apr 21 04:47:22 1997
***************
*** 42,47 ****
--- 42,48 ----
* suffix (string): a string to be appended after the message
* in the file.
* mode (integer): defines the mode to give newly created files.
+ * size (long): defines the maximum size of the file.
*
* private attribute flags:
* append_as_user: if set, default uid and gid are taken from
***************
*** 130,135 ****
--- 131,137 ----
{ "prefix", t_string, NULL, NULL, OFFSET(appendfile_private, prefix) },
{ "suffix", t_string, NULL, NULL, OFFSET(appendfile_private, suffix) },
{ "mode", t_mode, NULL, NULL, OFFSET(appendfile_private, mode) },
+ { "size", t_long, NULL, NULL, OFFSET(appendfile_private, size) },
{ "append_as_user", t_boolean, NULL, NULL, APPEND_AS_USER },
{ "expand_user", t_boolean, NULL, NULL, APPEND_EXPAND_USER },
{ "check_user", t_boolean, NULL, NULL, APPEND_CHECK_USER },
***************
*** 438,443 ****
--- 440,467 ----
return;
}
+
+ if (priv->size > 0) {
+ int err;
+ struct stat statbuf;
+
+ (void) fstat(fileno(f), &statbuf);
+ if (statbuf.st_size > priv->size) {
+ register struct error *er;
+
+ er = note_error(ERR_NSOWNER|ERR_135,
+ xprintf("transport %s: mailbox full", tp->name));
+ insert_addr_list(addr, fail, er);
+ (void) fclose(f);
+ if (priv->file) {
+ restore_atime(fn, atime_saved);
+ }
+ xfree(temp_fn);
+ xfree(fn);
+ return;
+ }
+ }
+
#ifdef HAVE_COMSAT
msg_offset = lseek(fileno(f), (off_t) 0L, SEEK_END);
#else
***************
*** 578,583 ****
--- 602,608 ----
NULL, /* prefix */
NULL, /* suffix */
0666, /* mode */
+ 0L, /* size */
};
struct appendfile_private *priv; /* new appendfile_private structure */
|