Skip to contentSkip to conversation

recipdelim patch

DISCUSSION [email protected] 3 participants 6 messages Jul 18, 2005 – Jul 20, 2005

lore
Share & tools
lore
#0 lore raw

I have removed the FFF comments. I have corrected the memory leak. Here you can find the recipdelim patch.

Keep in touch

-Filippo

#1 lore raw
Quoted 2 lines · * [email protected] <[email protected]> [Jul 19. 2005 00:43]:

I have removed the FFF comments. I have corrected the memory leak. Here you can find the recipdelim patch.

@@ -512,14 +512,17 @@ int main(int argc, char **argv)

        else
                whichto = NULL;

·
- if(whichto && whichto->emaillist && whichto->emaillist[0])
- recipdelim = strchr(whichto->emaillist[0], RECIPDELIM);
- else
- recipdelim = NULL;
+ if(toemails.emaillist && toemails.emaillist[0])
+ recipdelim = strstr(toemails.emaillist[0], RECIPDELIM);
+ else
+ recipdelim = NULL;
+

This is bad, since this stop reacting to the Delivered-To: header, and instead startsa only using the To: header. But the whichto will point to the To: header in case there's no Delivered-To:. And in case someone sends a subscribe request with the sendmail command, there's no To:
header on qmail.

Why not just change it to use strstr()? Now we're talking about strstr, why not just use strchr, but do it on RECIPDELIM[0]. Since it can only be one character big, it should have the same effect, no?

All the hunks in mlmmj-sub.c have different indentation. BTW, you can make vi use tabs instead of spaces when pressing tab, by doing

:set noet

I see you're doing:

    tmpstr = mystrdup(concatstr(2, RECIPDELIM, "confunsub-digest-"));

You don't need the mystrdup there, since concatstr will return an allocated string already.

Thanks,

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.
#2 lore raw
In reply to [email protected]
Quoted 2 lines · On Tue, Jul 19, 2005 at 12:43:04AM +0200, [email protected] wrote:

I have removed the FFF comments. I have corrected the memory leak. Here you can find the recipdelim patch.

Please don't change the default:

include/delimiter.h +25 -0
diff -urpN mlmmj-1.2.8/include/delimiter.h mlmmj-1.2.9/include/delimiter.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 2002, 2003, 2004 Mads Martin Joergensen <mmj at mmj.dk>
+ * Created by Filippo Fadda <filippo at fadda.ws>
+ *
+ * $Id: mlmmj.h,v 1.31 2005/01/15 10:53:52 mmj Exp $
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#define RECIPDELIM "-"  /* Change this value to modify delimiter */
include/mlmmj.h +1 -1
diff -urpN mlmmj-1.2.8/include/mlmmj.h mlmmj-1.2.9/include/mlmmj.h
@@ -25,10 +25,10 @@
 #define MLMMJ_GENERIC_INCLUDES
 
 #include "../config.h"
+#include "delimiter.h"
 
 #define RELAYHOST "127.0.0.1"
 #define READ_BUFSIZE 2048
-#define RECIPDELIM '+'  /* XXX Warning: not changable at the moment */
 #define MODREQLIFE 604800 /* How long time will moderation requests be kept?
 			   * 604800s is 7 days */
 #define DISCARDEDLIFE 604800 /* How long time will discarded mails be kept?

Also, note that it needs to read "Subject:", e.g.:

listtexts/it/access +12 -0
diff -urpN mlmmj-1.2.8/listtexts/it/access mlmmj-1.2.9/listtexts/it/access
@@ -0,0 +1,12 @@
+Subject: messaggio alla lista $listaddr$ non inoltrato
+
+Ciao, sono mlmmj, il programma che gestisce la mailing list
+
+$listaddr$
+
+Sono spiacente di informarti che il tuo messaggio non puo' essere mandato
+alla lista. La tua mail e' stata rifiutata perche' non segue le regole
+impostate dall'amministratore della lista.
+
+Grazie.
+

and I must be missing something, but this:

src/mlmmj-bounce.c +1 -1
diff -urpN mlmmj-1.2.8/src/mlmmj-bounce.c mlmmj-1.2.9/src/mlmmj-bounce.c
@@ -112,7 +112,7 @@ void do_probe(const char *listdir, const
 	listname = genlistname(listaddr);
 	listfqdn = genlistfqdn(listaddr);
 
-	from = concatstr(5, listname, "+bounces-probe-", myaddr, "@", listfqdn);
+    from = concatstr(6, listname, RECIPDELIM, "bounces-probe-", myaddr, "@", listfqdn);
 
 	myfree(listaddr);
 	myfree(listfqdn);

doesn't make it configurable at runtime, does it? I notice some RECIPDELIMs have been changed to recipdelim but other haven't. This one looks funny to me:

@@ -512,14 +512,17 @@ int main(int argc, char **argv)
else
whichto = NULL;

- if(whichto && whichto->emaillist && whichto->emaillist[0])
- recipdelim = strchr(whichto->emaillist[0], RECIPDELIM);
- else
- recipdelim = NULL;
+ if(toemails.emaillist && toemails.emaillist[0])
+ recipdelim = strstr(toemails.emaillist[0], RECIPDELIM);
+ else
+ recipdelim = NULL;
+

if(recipdelim) {
owner = concatstr(2, listdir, "/control/owner");
- if(owner && strncmp(recipdelim, "+owner@", 7) = 0) {
+ char *temp = concatstr(2, RECIPDELIM, "owner@");
+
+ if(owner && strncmp(recipdelim, temp, 7) = 0) {
/* strip envelope from before resending */ delheaders->count = 0; delheaders->strs = NULL;

notice how it's using RECIPDELIM on one line and recipdelim on the next. Is that really ok that way?

Cheers,

Marcelo

#3 lore raw
In reply to [email protected]
Quoted 16 lines
(quoted diff) +5 -4
-       if(whichto && whichto->emaillist && whichto->emaillist[0])
-               recipdelim = strchr(whichto->emaillist[0], RECIPDELIM);
-       else
-               recipdelim = NULL;
+        if(toemails.emaillist && toemails.emaillist[0])
+                recipdelim = strstr(toemails.emaillist[0], RECIPDELIM);
+        else
+                recipdelim = NULL;
+

This is bad, since this stop reacting to the Delivered-To: header, and instead startsa only using the To: header. But the whichto will point to the To: header in case there's no Delivered-To:. And in case someone sends a subscribe request with the sendmail command, there's no To:
header on qmail.

Quoted 3 lines

Why not just change it to use strstr()? Now we're talking about strstr, why not just use strchr, but do it on RECIPDELIM[0]. Since it can only be one character big, it should have the same effect, no?

It's not a problem related strstr here. Let me to explain you. I have used toemails.emaillist[0] because qmail places before the domain name, the address list, as you can see in this example (I have deleted the unusefull headers to make it more simple):

From [email protected] Sat Jul 16 18:12:01 2005
Return-Path: <[email protected]>
Delivered-To: [email protected]
Received: (qmail 22421 invoked by uid 530); 16 Jul 2005 20:12:01 +0200
Date: Sat, 16 Jul 2005 20:24:52 +0200
To: [email protected]
From: Filippo Fadda <[email protected]>

As you can see "Delivered-To" contains my domain name just before the list name. So the original code does not work. We need some hack here. Perhaps we have to use "To" as default header, and "Delivered-To" only if "To" is not present.

Quoted 2 lines

You don't need the mystrdup there, since concatstr will return an allocated string already.

It's a cut and paste error that I have brought forward, sorry.

Ok I'm waiting your feedback and then I will send the patch with all the corrections.

Bye

-Filippo

#4 lore raw
In reply to [email protected]
Quoted 23 lines · * [email protected] <[email protected]> [Jul 19. 2005 18:08]:
Quoted 9 lines

This is bad, since this stop reacting to the Delivered-To: header, and instead startsa only using the To: header. But the whichto will point to the To: header in case there's no Delivered-To:. And in case someone sends a subscribe request with the sendmail command, there's no To: header on qmail.

Why not just change it to use strstr()? Now we're talking about strstr, why not just use strchr, but do it on RECIPDELIM[0]. Since it can only be one character big, it should have the same effect, no?

It's not a problem related strstr here. Let me to explain you. I have used toemails.emaillist[0] because qmail places before the domain name, the address list, as you can see in this example (I have deleted the unusefull headers to make it more simple):

Quoted 1 line

From [email protected] Sat Jul 16 18:12:01 2005

Return-Path: <[email protected]>
Delivered-To: [email protected]
Received: (qmail 22421 invoked by uid 530); 16 Jul 2005 20:12:01 +0200
Date: Sat, 16 Jul 2005 20:24:52 +0200
To: [email protected]
From: Filippo Fadda <[email protected]>

Quoted 4 lines

As you can see "Delivered-To" contains my domain name just before the list name. So the original code does not work. We need some hack here. Perhaps we have to use "To" as default header, and "Delivered-To" only if "To" is not present.

Do you use a patched qmail? The qmail installation I can test on, has a proper Delivered-To:.

Did you try doing: sendmail [email protected] < /dev/null on your qmail machine? This sends a mail with no To: header. And I know of people who have done sendmail [email protected] < /dev/null in the past.

Quoted 4 lines
Quoted 2 lines

You don't need the mystrdup there, since concatstr will return an allocated string already.

It's a cut and paste error that I have brought forward, sorry.

No problem.

--
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.
#5 lore raw
In reply to [email protected]
Quoted 2 lines

Do you use a patched qmail? The qmail installation I can test on, has a proper Delivered-To:.

Yes, my qmail is patched, but the domain name is placed before the list address by vpopmail, perhaps, because I'm using it with qmail. I'm not sure of it but it's probable.

Quoted 3 lines

Did you try doing: sendmail [email protected] < /dev/null on your qmail machine? This sends a mail with no To: header. And I know of people who have done sendmail [email protected] < /dev/null in the past.

No, I didn't. I have sent a message from a mail client.

-Filippo