Author: colin
Date: 2008-03-07 18:30:03 +0100 (Fri, 07 Mar 2008)
New Revision: 991

Modified:
   trunk/Mix/Src/pool.c
Log:
doallow() check more than one email address in a line


Modified: trunk/Mix/Src/pool.c
===================================================================
--- trunk/Mix/Src/pool.c        2008-03-07 17:22:43 UTC (rev 990)
+++ trunk/Mix/Src/pool.c        2008-03-07 17:30:03 UTC (rev 991)
@@ -617,22 +617,39 @@
 
 int doallow(BUFFER *line, BUFFER *filter)
 /* line is a To, CC or BCC line.
- * problem is: there may be multiple addresses in one header
- * line but we only want to allow if _all_ are allowed
  *
- * So to not send direct if we do not want, we _never_ send
- * direct if there is more than one address: This is
- * assumed to be the case when there is a
- * comma in the header line.
+ * there may be multiple addresses in one header
+ * line but we only allow if _all_ are allowed
  *
- * this should probably be rewritten somehwhen. therefore: FIXME
- *
  * returns: 1 if allowed
  *          0 if message should be send indirectly
  */
 {
-  if (strchr( line->data, ',')) return 0;
-  return doblock(line, filter, 0);
+  BUFFER *newlinelist;
+  BUFFER *addrs;
+  int res = 1;
+
+  newlinelist = buf_new();
+  addrs = buf_new();
+
+  while (buf_getc(line) != ':');       /* find the : */
+  buf_getc(line);                      /* skip the space */
+  buf_rest(addrs, line);               /* and copy the addresses */
+  buf_rewind(line);
+
+  rfc822_addr(addrs, newlinelist);     /* split into one address per line */
+
+  buf_clear(addrs);
+
+  while (buf_getline(newlinelist, addrs) != -1) {
+    if (doblock(addrs, filter, 0) == 0) res = 0;
+    buf_clear(addrs);
+  }
+
+  buf_free(newlinelist);
+  buf_free(addrs);
+
+  return (res);
 }
 
 int filtermsg(BUFFER *in)


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mixmaster-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixmaster-devel

Reply via email to