* Re: [CFT] mlmmj-1.2.9-RC1
2005-10-09 15:12 [CFT] mlmmj-1.2.9-RC1 Mads Martin Joergensen
@ 2005-10-09 19:11 ` Jakob Hirsch
2005-10-09 22:56 ` Patrick Bennett
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Jakob Hirsch @ 2005-10-09 19:11 UTC (permalink / raw)
To: mlmmj
Mads Martin Joergensen wrote:
> Also those who are running patched versions, please please download this
> tar-ball and make sure your patches are folded in.
Um, you didn't like my footer-mime patch? I didn't get any comments, so
I wonder what's wrong about it.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [CFT] mlmmj-1.2.9-RC1
2005-10-09 15:12 [CFT] mlmmj-1.2.9-RC1 Mads Martin Joergensen
2005-10-09 19:11 ` Jakob Hirsch
@ 2005-10-09 22:56 ` Patrick Bennett
2005-10-10 5:33 ` Mads Martin Joergensen
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Patrick Bennett @ 2005-10-09 22:56 UTC (permalink / raw)
To: mlmmj
Jakob Hirsch wrote:
>Mads Martin Joergensen wrote:
>
>
>
>>Also those who are running patched versions, please please download this
>>tar-ball and make sure your patches are folded in.
>>
>>
>
>Um, you didn't like my footer-mime patch? I didn't get any comments, so
>I wonder what's wrong about it.
>
>
Also, I wonder about the issue of handling the "From:" header in an
RFC-compliant way... is the code Neale found related to this helpful
enough to consider modifying mlmmj? I personally have a few users left
out in the cold.
-Patrick
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [CFT] mlmmj-1.2.9-RC1
2005-10-09 15:12 [CFT] mlmmj-1.2.9-RC1 Mads Martin Joergensen
2005-10-09 19:11 ` Jakob Hirsch
2005-10-09 22:56 ` Patrick Bennett
@ 2005-10-10 5:33 ` Mads Martin Joergensen
2005-10-10 19:20 ` Neale Pickett
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Mads Martin Joergensen @ 2005-10-10 5:33 UTC (permalink / raw)
To: mlmmj
* Patrick Bennett <patrick@pebcomputing.com> [Oct 10. 2005 00:56]:
> Also, I wonder about the issue of handling the "From:" header in an
> RFC-compliant way... is the code Neale found related to this helpful
> enough to consider modifying mlmmj? I personally have a few users
> left out in the cold.
I'm sure the code Neale found is exactly what's needed, it's only a
matter of someone finding the time to integrate it, and send me a patch.
Or wait until I find the time to do it, which might be a while.
--
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.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [CFT] mlmmj-1.2.9-RC1
2005-10-09 15:12 [CFT] mlmmj-1.2.9-RC1 Mads Martin Joergensen
` (2 preceding siblings ...)
2005-10-10 5:33 ` Mads Martin Joergensen
@ 2005-10-10 19:20 ` Neale Pickett
2005-10-10 19:31 ` Neale Pickett
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Neale Pickett @ 2005-10-10 19:20 UTC (permalink / raw)
To: mlmmj
[-- Attachment #1: Type: text/plain, Size: 773 bytes --]
On Sunday 09 October 2005 11:33 pm, Mads Martin Joergensen wrote:
> * Patrick Bennett <patrick@pebcomputing.com> [Oct 10. 2005 00:56]:
> > Also, I wonder about the issue of handling the "From:" header in an
> > RFC-compliant way
>
> I'm sure the code Neale found is exactly what's needed, it's only a
> matter of someone finding the time to integrate it, and send me a patch.
You made it too easy on me, Mads! I only had to change one function!
This isn't a patch, because I rewrote the entire file. Just drop it into your
src directory and try it out. And please do, if you have the stomach for it.
I'm not convinced this will work for all situations.
Please consider this an "alpha" version. My mail lists aren't terribly active
so I need help testing.
Neale
[-- Attachment #2: find_email_adr.c --]
[-- Type: text/x-csrc, Size: 5264 bytes --]
/* Some crap from BSD mail to parse email addresses.
*
* Neale Pickett <neale@woozle.org> stole these functions from FreeBSD
* ports, and reformatted them to use mlmmj's coding style. The
* original functions (skip_comment and skin) had the following
* copyright notice:
*/
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "find_email_adr.h"
#include "memory.h"
/*
* Start of a "comment".
* Ignore it.
*/
static char *
skip_comment(char *cp)
{
int nesting = 1;
for (; nesting > 0 && *cp; cp++) {
switch (*cp) {
case '\\':
if (cp[1])
cp++;
break;
case '(':
nesting++;
break;
case ')':
nesting--;
break;
}
}
return (cp);
}
/*
* Skin an arpa net address according to the RFC 822 interpretation
* of "host-phrase."
*/
static char *skin(char *name)
{
char *nbuf, *bufend, *cp, *cp2;
int c, gotlt, lastsp;
if (name == NULL)
return (NULL);
if (strchr(name, '(') == NULL && strchr(name, '<') == NULL
&& strchr(name, ' ') == NULL)
return (name);
/* We assume that length(input) <= length(output) */
nbuf = mymalloc(strlen(name) + 1);
gotlt = 0;
lastsp = 0;
bufend = nbuf;
for (cp = name, cp2 = bufend; (c = *cp++) != '\0'; ) {
switch (c) {
case '(':
cp = skip_comment(cp);
lastsp = 0;
break;
case '"':
/*
* Start of a "quoted-string".
* Copy it in its entirety.
*/
while ((c = *cp) != '\0') {
cp++;
if (c == '"')
break;
if (c != '\\')
*cp2++ = c;
else if ((c = *cp) != '\0') {
*cp2++ = c;
cp++;
}
}
lastsp = 0;
break;
case ' ':
if (cp[0] == 'a' && cp[1] == 't' && cp[2] == ' ')
cp += 3, *cp2++ = '@';
else
if (cp[0] == '@' && cp[1] == ' ')
cp += 2, *cp2++ = '@';
else
lastsp = 1;
break;
case '<':
cp2 = bufend;
gotlt++;
lastsp = 0;
break;
case '>':
if (gotlt) {
gotlt = 0;
while ((c = *cp) != '\0' && c != ',') {
cp++;
if (c == '(')
cp = skip_comment(cp);
else if (c == '"')
while ((c = *cp) != '\0') {
cp++;
if (c == '"')
break;
if (c == '\\' && *cp != '\0')
cp++;
}
}
lastsp = 0;
break;
}
/* FALLTHROUGH */
default:
if (lastsp) {
lastsp = 0;
*cp2++ = ' ';
}
*cp2++ = c;
if (c == ',' && *cp == ' ' && !gotlt) {
*cp2++ = ' ';
while (*++cp == ' ')
;
lastsp = 0;
bufend = cp2;
}
}
}
*cp2 = '\0';
nbuf = (char *)myrealloc(nbuf, strlen(nbuf) + 1);
return (nbuf);
}
struct email_container *find_email_adr(const char *str,
struct email_container *retstruct)
{
char *p;
char *s;
s = (char *)mymalloc(strlen(str) + 1);
strcpy(s, str);
p = s;
while(p) {
char *adr;
char *cur;
cur = p;
p = strchr(p, ',');
if (p) {
/* If there's a comma, replace it with a NUL, so
* cur will only have one address in it. */
*p = '\0';
p += 1;
}
printf("cur: %s\n", cur);
while(cur && ((' ' == *cur) ||
('\t' == *cur) ||
('\r' == *cur) ||
('\n' == *cur))) {
cur += 1;
}
if ('\0' == *cur) {
continue;
}
adr = skin(cur);
if (adr) {
printf("adr: %s\n", adr);
retstruct->emailcount++;
retstruct->emaillist = (char **)myrealloc(retstruct->emaillist,
sizeof(char *) * retstruct->emailcount);
retstruct->emaillist[retstruct->emailcount-1] = adr;
}
}
myfree(s);
return retstruct;
}
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [CFT] mlmmj-1.2.9-RC1
2005-10-09 15:12 [CFT] mlmmj-1.2.9-RC1 Mads Martin Joergensen
` (3 preceding siblings ...)
2005-10-10 19:20 ` Neale Pickett
@ 2005-10-10 19:31 ` Neale Pickett
2005-10-11 0:17 ` Mads Martin Joergensen
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Neale Pickett @ 2005-10-10 19:31 UTC (permalink / raw)
To: mlmmj
Here's a little thing I found, which I guess could cause segfaults in
low-memory situations:
--- old-mlmmj-1/src/strgen.c 2005-10-10 13:30:29.565420691 -0600
+++ new-mlmmj-1/src/strgen.c 2005-10-10 10:50:22.000000000 -0600
@@ -245,7 +245,7 @@
const char *weekday = NULL, *month = NULL;
/* 6 + 26 + ' ' + timezone which is 5 + '\n\0' = 40 */
- timestr = (char *)malloc(40);
+ timestr = (char *)mymalloc(40);
t = time(NULL);
localtime_r(&t, <tm);
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [CFT] mlmmj-1.2.9-RC1
2005-10-09 15:12 [CFT] mlmmj-1.2.9-RC1 Mads Martin Joergensen
` (4 preceding siblings ...)
2005-10-10 19:31 ` Neale Pickett
@ 2005-10-11 0:17 ` Mads Martin Joergensen
2005-10-11 3:03 ` Neale Pickett
2005-10-11 8:55 ` Mads Martin Joergensen
7 siblings, 0 replies; 9+ messages in thread
From: Mads Martin Joergensen @ 2005-10-11 0:17 UTC (permalink / raw)
To: mlmmj
* Neale Pickett <neale@woozle.org> [Oct 10. 2005 21:21]:
> On Sunday 09 October 2005 11:33 pm, Mads Martin Joergensen wrote:
> > * Patrick Bennett <patrick@pebcomputing.com> [Oct 10. 2005 00:56]:
> > > Also, I wonder about the issue of handling the "From:" header in an
> > > RFC-compliant way
> >
> > I'm sure the code Neale found is exactly what's needed, it's only a
> > matter of someone finding the time to integrate it, and send me a patch.
>
> You made it too easy on me, Mads! I only had to change one function!
>
> This isn't a patch, because I rewrote the entire file. Just drop it
> into your src directory and try it out. And please do, if you have
> the stomach for it. I'm not convinced this will work for all
> situations.
You apparantly haven't looked at the current version. Predates
mlmmj-0.3.0....
> Please consider this an "alpha" version. My mail lists aren't
> terribly active so I need help testing.
I'll review and merge before 1.2.9 if it's doable.
Thanks a bunch!
--
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.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [CFT] mlmmj-1.2.9-RC1
2005-10-09 15:12 [CFT] mlmmj-1.2.9-RC1 Mads Martin Joergensen
` (5 preceding siblings ...)
2005-10-11 0:17 ` Mads Martin Joergensen
@ 2005-10-11 3:03 ` Neale Pickett
2005-10-11 8:55 ` Mads Martin Joergensen
7 siblings, 0 replies; 9+ messages in thread
From: Neale Pickett @ 2005-10-11 3:03 UTC (permalink / raw)
To: mlmmj
On Monday 10 October 2005 06:17 pm, Mads Martin Joergensen wrote:
> You apparantly haven't looked at the current version. Predates
> mlmmj-0.3.0....
I made the changes against the newest source I could find (1.2.9-RC1) and ran
a couple of tests with some debugging printfs that displayed. Maybe I don't
understand what you're saying. :)
Anyway, I'd be happy to bring the patch even more up to date if there's a
bleeding-edge source repository or something. Just point me at it and I'll
do all the heavy lifting.
Neale
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [CFT] mlmmj-1.2.9-RC1
2005-10-09 15:12 [CFT] mlmmj-1.2.9-RC1 Mads Martin Joergensen
` (6 preceding siblings ...)
2005-10-11 3:03 ` Neale Pickett
@ 2005-10-11 8:55 ` Mads Martin Joergensen
7 siblings, 0 replies; 9+ messages in thread
From: Mads Martin Joergensen @ 2005-10-11 8:55 UTC (permalink / raw)
To: mlmmj
* Neale Pickett <neale@woozle.org> [Oct 11. 2005 05:03]:
> On Monday 10 October 2005 06:17 pm, Mads Martin Joergensen wrote:
> > You apparantly haven't looked at the current version. Predates
> > mlmmj-0.3.0....
>
> I made the changes against the newest source I could find (1.2.9-RC1)
> and ran a couple of tests with some debugging printfs that displayed.
> Maybe I don't understand what you're saying. :)
What I'm saying is that it can _only_ be better than what we have now.
> Anyway, I'd be happy to bring the patch even more up to date if
> there's a bleeding-edge source repository or something. Just point me
> at it and I'll do all the heavy lifting.
Oh, this haven't changed since a loooong time, so that file seems to do
the trick. Thanks.
--
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.
^ permalink raw reply [flat|nested] 9+ messages in thread