Skip to contentSkip to conversation

mlmmj maxmailsize patch

DISCUSSION Morten K. Poulsen 4 participants 21 messages Jan 9, 2007 – Mar 3, 2007

lore
Share & tools
lore
#0 lore raw

Hi Dan,

Quoted 5 lines · Daniel Walrond
Quoted 2 lines

The patch looks very clean and simple. I just didn't know it existed. I will merge it for mlmmj-1.2.13.

Did you add the following patch to mlmmj 1.2.13?
http://mlmmj.mmj.dk/archive/0794.html

S##t, I forgot about that. Sorry. It will be in 1.2.14.

Morten

Signature · 2 lines
Morten K. Poulsen <[email protected]>
http://www.afdelingp.dk/
#1 lore raw

Hej!

Quoted 4 lines · Morten K. Poulsen

Hi Dan,

Daniel Walrond <[email protected]> wrote:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

The patch looks very clean and simple. I just didn't know it existed.
I will merge it for mlmmj-1.2.13.

Did you add the following patch to mlmmj 1.2.13?
http://mlmmj.mmj.dk/archive/0794.html

S##t, I forgot about that. Sorry. It will be in 1.2.14.

I updated the patch to match version 1.2.13-RC1.

There is one issue I didn't fixed yet (no time):
If a mail hits the limit, it bounces - no problem here. But the temporary mailfile created in the incoming directory isn't deleted.
Maybe someone can have a look on this? :)

Quoted 2 lines

Morten

Ciao
Chris

listtexts/de/maxmailsize +10 -0
diff -Nru mlmmj-1.2.13-RC1-orig/listtexts/de/maxmailsize mlmmj-1.2.13-RC1/listtexts/de/maxmailsize
@@ -0,0 +1,10 @@
+Subject: Beitrag zur Liste $listaddr$ wegen Gr��en�berschreitung abgelehnt
+
+Hallo, dies ist das mlmmj Programm das die Mailingliste
+
+$listaddr$
+
+verwaltet.
+
+Tut mir leid aber Ihre Mail konnte nicht versandt werden. Die von
+Ihnen verschickte Mail �berschreitet das bestehende Gr��enlimit.
listtexts/maxmailsize +11 -0
diff -Nru mlmmj-1.2.13-RC1-orig/listtexts/maxmailsize mlmmj-1.2.13-RC1/listtexts/maxmailsize
@@ -0,0 +1,11 @@
+Subject: Post to $listaddr$ denied due to size limit [was: "$oldsubject$"]
+
+Hi, this is the mlmmj program managing the mailinglist
+
+$listaddr$
+
+I'm sorry to inform you that your message could not be delivered to the
+list. Your mail was rejected due to the size limit of $maxmailsize$.
+
+Thanks.
+
src/mlmmj-process.c +73 -1

100 lines not on this page · raw message

TUNABLES +10 -0
diff -Nru mlmmj-1.2.13-RC1-orig/TUNABLES mlmmj-1.2.13-RC1/TUNABLES
@@ -183,3 +183,13 @@
    If this file exists, subscription to the nomail version of the mailinglist
    will be denied. (Useful if you don't want to allow nomail and notify users
    about it).
+
+
+ � maxmailsize                        (normal)
+
+   With this option the maximal allowed size of incoming mails can be specified.
+
+ � nomaxmailsizedenymails     (boolean)
+
+   If this is set, no reject notifications caused by violation of maxmailsize
+   will be sent.
#2 lore raw
In reply to Morten K. Poulsen

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there,

today we had a bigger mail to a list which results in many bounces since most of the subscribers have a lower limit. So i want to limit per list. I remembered the patch about this and then saw that its not yet included... ;-)

Quoted 5 lines · Christoph Wilke

There is one issue I didn't fixed yet (no time):
If a mail hits the limit, it bounces - no problem here. But the temporary mailfile created in the incoming directory isn't deleted.
Maybe someone can have a look on this? :)

Well, i'm not a coder, but isn't this just a missing unlink(mailfile); after the unlink(donemailname);?

Would be nice if someone can confirm this, i'd like to test it soon ;-)

Regards,
Darkman
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFFtRAOQoCguWUBzBwRAsyPAKCizZUxdogEnNKIbkbDagRQyNCAnQCeO6WJ zikqeSnkvbQCVD5gpAiTs1o=Mz6q
-----END PGP SIGNATURE-----

#3 lore raw
In reply to Morten K. Poulsen

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi myself,

Quoted 2 lines · Sven 'Darkman' Michels

Would be nice if someone can confirm this, i'd like to test it soon ;-)

well, i just added two unlinks and it seems to work "so far", but:
the bounce mail generated by mlmmj isn't parsed properly. The reason is, that your patch uses "new" macros which are not implemented anyway. New is: $oldsubject$, $maxmailsize$
Anyone knows where to add it? ;) Didn't found something helpfull (maybe this is again over my skills ;)

Regards,
Darkman
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFFtRvZQoCguWUBzBwRAifgAKCWD6KgZRyXfdBKilQu+j/H8X6VDwCdGamG cFssNyHv4O1UuF92rejXxcY=3PlQ
-----END PGP SIGNATURE-----

#4 lore raw
In reply to Morten K. Poulsen

Hej,

Quoted 11 lines · Sven 'Darkman' Michels

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi myself,

Quoted 2 lines · Sven 'Darkman' Michels

Would be nice if someone can confirm this, i'd like to test it soon ;-)

well, i just added two unlinks and it seems to work "so far", but:
the bounce mail generated by mlmmj isn't parsed properly. The reason

Nice. ;)

Quoted 3 lines

is, that your patch uses "new" macros which are not implemented anyway.
New is: $oldsubject$, $maxmailsize$

Hmm. I Introduced them, but only $maxmailsize$ is used. Just kick the other one out, I just forgot to remove it, sorry.

Quoted 3 lines

Anyone knows where to add it? ;) Didn't found something helpfull (maybe
this is again over my skills ;)

Hopefully I can fix this this afternoon, and send a new patch tomorrow.

Quoted 3 lines

Regards,
Darkman

Ciao
Chris

Quoted 8 lines

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFFtRvZQoCguWUBzBwRAifgAKCWD6KgZRyXfdBKilQu+j/H8X6VDwCdGamG cFssNyHv4O1UuF92rejXxcY=
=3PlQ
-----END PGP SIGNATURE-----

#5 lore raw
In reply to Morten K. Poulsen

Hej,

On Tue, January 23, 2007 12:06, Christoph Wilke wrote:

[...]

Quoted 3 lines

Hopefully I can fix this this afternoon, and send a new patch tomorrow.

Sorry, I helped my girlfriend to TeX some work..
This needs more time than I expected, but I will
work on this patch next week(end).

Ciao
Chris

#6 lore raw
In reply to Morten K. Poulsen
Quoted 5 lines · Christoph Wilke
Quoted 2 lines · Christoph Wilke

Hopefully I can fix this this afternoon, and send a new patch tomorrow.

Sorry, I helped my girlfriend to TeX some work..

Priorities! ;)

No hurry. I don't plan on a 1.2.14 any time soon.

Morten

Signature · 2 lines
Morten K. Poulsen <[email protected]>
http://www.afdelingp.dk/
#7 lore raw
In reply to Morten K. Poulsen

Hej!

Quoted 6 lines · Sven 'Darkman' Michels

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi myself,

Sven 'Darkman' Michels wrote:

Quoted 8 lines
Quoted 2 lines

Would be nice if someone can confirm this, i'd like to test it soon ;-)

well, i just added two unlinks and it seems to work "so far", but:
the bounce mail generated by mlmmj isn't parsed properly. The reason is, that your patch uses "new" macros which are not implemented anyway.
New is: $oldsubject$, $maxmailsize$

I fixed now (at last) the missing macro ($maxmailsize$). Patch attached.

Ciao
Chris

ps. Sorry for the long delay, but all the time I thought I had some spare time, I had to do some other work first...

listtexts/de/maxmailsize +11 -0
diff -Nru mlmmj-1.2.13.orig/listtexts/de/maxmailsize mlmmj-1.2.13-maxmailsize/listtexts/de/maxmailsize
@@ -0,0 +1,11 @@
+Subject: Beitrag zur Liste $listaddr$ wegen Gr��en�berschreitung abgelehnt
+
+Hallo, dies ist das mlmmj Programm das die Mailingliste
+
+$listaddr$
+
+verwaltet.
+
+Tut mir leid aber Ihre Mail konnte nicht versandt werden. Die von
+Ihnen verschickte Mail �berschreitet das bestehende Gr��enlimit
+von $maxmailsize$.
listtexts/maxmailsize +11 -0
diff -Nru mlmmj-1.2.13.orig/listtexts/maxmailsize mlmmj-1.2.13-maxmailsize/listtexts/maxmailsize
@@ -0,0 +1,11 @@
+Subject: Post to $listaddr$ denied due to size limit
+
+Hi, this is the mlmmj program managing the mailinglist
+
+$listaddr$
+
+I'm sorry to inform you that your message could not be delivered to the
+list. Your mail was rejected due to the size limit of $maxmailsize$.
+
+Thanks.
+
src/mlmmj-process.c +80 -2

108 lines not on this page · raw message

TUNABLES +10 -0
diff -Nru mlmmj-1.2.13.orig/TUNABLES mlmmj-1.2.13-maxmailsize/TUNABLES
@@ -183,3 +183,13 @@
    If this file exists, subscription to the nomail version of the mailinglist
    will be denied. (Useful if you don't want to allow nomail and notify users
    about it).
+
+
+ � maxmailsize                        (normal)
+
+   With this option the maximal allowed size of incoming mails can be specified.
+
+ � nomaxmailsizedenymails     (boolean)
+
+   If this is set, no reject notifications caused by violation of maxmailsize
+   will be sent.
#8 lore raw
In reply to Morten K. Poulsen

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 4 lines · Christoph Wilke

Hej!

I fixed now (at last) the missing macro ($maxmailsize$). Patch attached.

Whatever you did, the patch doesn't work anymore for me. Maybe i have some time to check but atm not. The mail just got discarded, no error mail, nothing in the logs (not in mail log nor in mlmmjs log). But i see the bounce mail in queue dir - without parsed macro - horray.

Any ideas?

Thanks!
Sven
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFF0wPJQoCguWUBzBwRAusaAJ0djczDwsqlSxJmkBi9B2EMwfEEIwCfTwTw PXedShxst2VHNpGgQTA3K7A=5/J5
-----END PGP SIGNATURE-----

#9 lore raw
In reply to Morten K. Poulsen

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi me, again ;-)

Quoted 2 lines · Sven 'Darkman' Michels

Any ideas?

I got another timeslot to get this sorted. It seems now to work and i fixed the parse of $maxmailsize$, too. So if anyone is interested, here is a cleaned patch:
http://www.darkman.de/~sven/mlmmj-1.2.13-maxmailsize-darkman.patch

I still get nothing in the logs, but that may some other problem...

What i changed:

- - char *maildata[4] = { "posteraddr", NULL, "maildata", NULL };
+ char *maildata[4] = { "posteraddr", NULL, "maxmailsize", NULL };

and removed two free's:
myfree(donemailname);
myfree(mailfile);
after the unlink and moved the free of maxmailsizestr befor the unlink.

Please, someone with more mlmmj knowhow or even more c code knowhow, take a look if thats okay.

Thanks and regards,
Sven
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFF0yepQoCguWUBzBwRAh+sAKCYaMdB2ZLZDvhZXQZ/Z91iZOiPWwCgkiLz wS9z2IxRd9jK6iha9/pAh5w JK
-----END PGP SIGNATURE-----

#10 lore raw
In reply to Morten K. Poulsen
Quoted 1 line · Sven 'Darkman' Michels

I still get nothing in the logs, but that may some other problem...

[snip]

Quoted 2 lines

Please, someone with more mlmmj knowhow or even more c code knowhow, take a look if thats okay.

+ if((st.st_size > maxmailsize)) {
+#if 0
+ log_error(LOG_ARGS, "%s is %d bytes too big.\n",
+ donemailname,
+ (st.st_size - maxmailsize));
+#endif

The missing log entry might be because of the "#if 0" ;-)

Otherwise, it looks ok. I will review it in depth and commit it "soon."

Morten

Signature · 2 lines
Morten K. Poulsen <[email protected]>
http://www.afdelingp.dk/
#11 lore raw
In reply to Morten K. Poulsen

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hej,

Quoted 8 lines · Morten K. Poulsen
(quoted diff) +6 -0
+           if((st.st_size > maxmailsize)) {
+#if 0
+               log_error(LOG_ARGS, "%s is %d bytes too big.\n",
+                       donemailname,
+                       (st.st_size - maxmailsize));
+#endif

The missing log entry might be because of the "#if 0" ;-)

DAMN! ;-) I can't belive i overlooked this for hours... ;)

Thanks for the light...

Quoted 1 line

Otherwise, it looks ok. I will review it in depth and commit it "soon."

Thanks again :)

Regards,
Sven
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFF05agQoCguWUBzBwRAnoQAJ4g+V5VpIQPL8zeDxfHcwUDbkOc2QCfWu8V A12kjqCNsphwpu4eqYZVPXs¶3I
-----END PGP SIGNATURE-----

#12 lore raw
In reply to Morten K. Poulsen
Quoted 4 lines · Sven 'Darkman' Michels

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi me, again ;-)

Hej.

Quoted 10 lines
Quoted 2 lines · Sven 'Darkman' Michels

Any ideas?

I got another timeslot to get this sorted. It seems now to work and i fixed the parse of $maxmailsize$, too. So if anyone is interested, here is a cleaned patch:
http://www.darkman.de/~sven/mlmmj-1.2.13-maxmailsize-darkman.patch

Quoted 6 lines

I still get nothing in the logs, but that may some other problem...

What i changed:

- - char *maildata[4] = { "posteraddr", NULL, "maildata", NULL };
+ char *maildata[4] = { "posteraddr", NULL, "maxmailsize", NULL };

*doi*
Sorry for this inconvenience.

Quoted 6 lines

and removed two free's:
myfree(donemailname);
myfree(mailfile);
after the unlink and moved the free of maxmailsizestr befor the unlink.

Why do you free maxmailsizestr but mailfile and donemailname not?
Did I miss something?

Quoted 6 lines

Please, someone with more mlmmj knowhow or even more c code knowhow, take a look if thats okay.

Thanks and regards,
Sven

Ciao
Chris

#13 lore raw
In reply to Morten K. Poulsen

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey,

Quoted 5 lines · Christoph Wilke
Quoted 2 lines

- - char *maildata[4] = { "posteraddr", NULL, "maildata", NULL };
+ char *maildata[4] = { "posteraddr", NULL, "maxmailsize", NULL };

*doi*
Sorry for this inconvenience.

No Problem, for me as a no-coder it just takes a little longer to understand such patches, but at least i got this fixed ;)

Quoted 9 lines
Quoted 5 lines

and removed two free's:
myfree(donemailname);
myfree(mailfile);
after the unlink and moved the free of maxmailsizestr befor the unlink.

Why do you free maxmailsizestr but mailfile and donemailname not?
Did I miss something?

well, simple: if i free them, it doesn't work anymore. When i leave them as you posted them, the reject mail isn't send to the user anymore. I get a file in queue which *should* go to the user, but they never get sent out. After removing the two frees, it works. Thats why i asked for a review ;)

Regards,
Sven

PS: your mailaddress was bouncing, got this fixed? ;) -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFF1RrZQoCguWUBzBwRAjGVAJ9NbP4s+s2bixPesBcNVYEAVj9NiACfdvfP YskITftEQwlX+pg1XE3NEbE’cT
-----END PGP SIGNATURE-----

#14 lore raw
In reply to Morten K. Poulsen
Quoted 26 lines · Sven 'Darkman' Michels

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey,

Quoted 5 lines · Christoph Wilke
Quoted 2 lines

- - char *maildata[4] = { "posteraddr", NULL, "maildata", NULL };
+ char *maildata[4] = { "posteraddr", NULL, "maxmailsize", NULL };

*doi*
Sorry for this inconvenience.

No Problem, for me as a no-coder it just takes a little longer to understand such patches, but at least i got this fixed ;)

Quoted 9 lines
Quoted 5 lines

and removed two free's:
myfree(donemailname);
myfree(mailfile);
after the unlink and moved the free of maxmailsizestr befor the unlink.

Why do you free maxmailsizestr but mailfile and donemailname not?
Did I miss something?

Quoted 5 lines

well, simple: if i free them, it doesn't work anymore. When i leave them as you posted them, the reject mail isn't send to the user anymore. I get a file in queue which *should* go to the user, but they never get sent out. After removing the two frees, it works. Thats why i asked for a review ;)

Interesting.
In my understanding prepstdreply() creates a real file and return its descriptor. Mlmmjsend() only operates on this existing fd (queuefilename) and shouldn't care about donemailname and mailfile.
So the variables could be freed (the associated files are already removed (unlinked)).

-- Or not??

Quoted 5 lines

Regards,
Sven

PS: your mailaddress was bouncing, got this fixed? ;)

Ciao
Chris

ps. I know. Forgot to save the config before restarting the router... *doiagain*

Quoted 8 lines

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFF1RrZQoCguWUBzBwRAjGVAJ9NbP4s+s2bixPesBcNVYEAVj9NiACfdvfP YskITftEQwlX+pg1XE3NEbE=
=92cT
-----END PGP SIGNATURE-----

#15 lore raw
In reply to Morten K. Poulsen
Quoted 14 lines · Morten K. Poulsen
Quoted 1 line · Sven 'Darkman' Michels

I still get nothing in the logs, but that may some other problem...

[snip]

Quoted 2 lines

Please, someone with more mlmmj knowhow or even more c code knowhow, take a look if thats okay.

(quoted diff) +6 -0
+           if((st.st_size > maxmailsize)) {
+#if 0
+               log_error(LOG_ARGS, "%s is %d bytes too big.\n",
+                       donemailname,
+                       (st.st_size - maxmailsize));
+#endif
Quoted 4 lines

The missing log entry might be because of the "#if 0" ;-)

Otherwise, it looks ok. I will review it in depth and commit it "soon."

Maybe it's better to change this log_error() to an log_oper() as Henne suggested for the access rules?

Quoted 2 lines

Morten

Ciao
Chris

#16 lore raw
In reply to Morten K. Poulsen
Quoted 4 lines · Christoph Wilke

In my understanding prepstdreply() creates a real file and return its descriptor. Mlmmjsend() only operates on this existing fd (queuefilename) and shouldn't care about donemailname and mailfile.

It doesn't return a fd, but a char* with the filename for sending. Just returning the fd, would leave the caller without knowing what the filename is, and in many cases the user of prepstdreply() don't have to open the file again--just pass the filename on to mlmmj-send.

Signature · 4 lines
Mads Martin Joergensen, http://mmj.dk
"Why make things difficult, when it is possible to make them cryptic
 and totally illogical, with just a little bit more effort?"
                                 -- A. P. J.
#17 lore raw
In reply to Morten K. Poulsen
Quoted 11 lines · Mads Martin Joergensen
Quoted 4 lines · Christoph Wilke

In my understanding prepstdreply() creates a real file and return its descriptor. Mlmmjsend() only operates on this existing fd (queuefilename) and shouldn't care about donemailname and mailfile.

It doesn't return a fd, but a char* with the filename for sending. Just returning the fd, would leave the caller without knowing what the filename is, and in many cases the user of prepstdreply() don't have to open the file again--just pass the filename on to mlmmj-send.

so i was "right" with removing the two free's?

Regards,
Sven

#18 lore raw
In reply to Morten K. Poulsen
Quoted 16 lines · Sven 'Darkman' Michels
Quoted 7 lines · Mads Martin Joergensen

* Christoph Wilke <[email protected]> [Feb 16. 2007 20:21]:

Quoted 4 lines

In my understanding prepstdreply() creates a real file and return its descriptor. Mlmmjsend() only operates on this existing fd (queuefilename) and shouldn't care about donemailname and mailfile.

Quoted 7 lines

It doesn't return a fd, but a char* with the filename for sending. Just
returning the fd, would leave the caller without knowing what the filename is, and in many cases the user of prepstdreply() don't have to
open the file again--just pass the filename on to mlmmj-send.

Quoted 1 line

so i was "right" with removing the two free's?

You were. But I don't have an idea why.
And if it is correct to have no myfree()s there.
Maybe someone can clarify this, please?

Quoted 3 lines

Regards,
Sven

Ciao
Chris

#19 lore raw
In reply to Morten K. Poulsen

Hi,

Quoted 6 lines · Christoph Wilke
Quoted 1 line · Sven 'Darkman' Michels

so i was "right" with removing the two free's?

You were. But I don't have an idea why.
And if it is correct to have no myfree()s there.
Maybe someone can clarify this, please?

The myfree()s should be there. And having them there should not cause any kind of problems. If it does, could you try to debug it? We might have some other memory bug, which is triggered by the myfree()s.

Morten

Signature · 2 lines
Morten K. Poulsen <[email protected]>
http://www.afdelingp.dk/
#20 lore raw
In reply to Morten K. Poulsen

Hi all,

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

so i was "right" with removing the two free's?

You were. But I don't have an idea why.

[snip]

Quoted 1 line
Quoted 1 line

The myfree()s should be there.

So... I found the problem: I was wrong, mailfile should not be myfree()d - it's a pointer to an argument (which is on the stack, not the heap).

I removed the statctrl() call as ctrlvalue() returns NULL for a non- exsisting tunable, and rearranged a few of the code lines.

The patch I committed is available here:

http://mlmmj.mmj.dk/~mortenp/patch-mlmmj-1.2.13-maxmailsize.diff

Christoph has written an English and a German version of the new maxmailsize list text. Everybody who maintains a translation, please translate this new file:

http://mlmmj.mmj.dk/~mortenp/maxmailsize

Have fun,
Morten

Signature · 2 lines
Morten K. Poulsen <[email protected]>
http://www.afdelingp.dk/