Mailing List Archive

Rejecting large messages (was Re: man page missing something?)
> Talking of this, here's a little thing which you can use in conf-unusual.h
> to bounce large mail. (Of course it'll only work if the user doesn't have a
> .qmail file. Of course it'd be much more resource friendly if this would be
> built into qmail)

It'd only be more "resource friendly" for people that actually want to
use it. For those that don't, it's unnecessary code bloat.

By the way, your program reads the file to find out how large it is.
This isn't necessary: a command run out of a .qmail file will always
have a real file as its stdin, so you can simply stat() it, as in my
version. I called this program `smallerthan', and it can be called from
a .qmail file (or ALIAS_EMPTY) like this.

|/path/to/smallerthan 12345 || { echo Message size limit of 12345 octets to "$RECIPIENT"; exit 100; }
... rest of delivery instructions

Tim.
Re: Rejecting large messages (was Re: man page missing something?) [ In reply to ]
Hi,

Very nice. I didn't know that it's a file. I thought it's piped.
I am looking into adding quota support (for Linux). Hopefully, I'll come up
with something this weekend.

Thanks for the tip,

Andi

At 12:24 28/02/97 +0000, you wrote:
>> Talking of this, here's a little thing which you can use in conf-unusual.h
>> to bounce large mail. (Of course it'll only work if the user doesn't have a
>> .qmail file. Of course it'd be much more resource friendly if this would be
>> built into qmail)
>
>It'd only be more "resource friendly" for people that actually want to
>use it. For those that don't, it's unnecessary code bloat.
>
>By the way, your program reads the file to find out how large it is.
>This isn't necessary: a command run out of a .qmail file will always
>have a real file as its stdin, so you can simply stat() it, as in my
>version. I called this program `smallerthan', and it can be called from
>a .qmail file (or ALIAS_EMPTY) like this.
>
> |/path/to/smallerthan 12345 || { echo Message size limit of 12345
octets to "$RECIPIENT"; exit 100; }
> ... rest of delivery instructions
>
>Tim.
>#include <errno.h>
>#include <stdio.h>
>#include <stdlib.h>
>#include <string.h>
>
>#include <sys/types.h>
>#include <sys/stat.h>
>
>int main(int argc, char **argv) {
> struct stat statbuf;
>
> if (argc != 2) {
> fprintf(stderr, "Usage: %s size\n", *argv);
> return 64;
> }
> if (fstat(0, &statbuf) < 0) {
> fprintf(stderr, "%s: can't stat stdin: %s\n", argv[0], strerror(errno));
> return 69;
> }
> if (statbuf.st_size < atol(argv[1])) {
> return 0;
> } else {
> return 1;
> }
>}
>
,,,
(o o)
==============================oOO==(_)==OOo===============================
Andi Gutmans - Computer Science, Israel Institute of Technology (Technion)

Email: andi@israel.eu.org Web: http://andi.rifkin.technion.ac.il
andi@actcom.co.il

For my PGP public key, finger andi@vipe.technion.ac.il

.oooO Oooo.
==============================( )==( )================================
\ ( ) /
\_) (_/