{
const char *p;
size_t len;
+ short q = 0;
- /* looks like we got the return-path, so extract it */
- if (*s == '"')
+ for (p = s; *p && (q || !ISSPACE (*p)); p++)
{
- /* sometimes we see bogus addresses like
- * From "/foo/bar baz/"@dumbdar.com Sat Nov 22 15:29:32 PST 1997
- */
- p = s;
- p++; /* skip over the quote */
- do
+ if (*p == '\\')
{
- if (!(p = strpbrk (p, "\\\"")))
+ if (*++p == '\0')
return 0;
- if (*p == '\\')
- p += 2;
}
- while (*p != '"');
- while (*p && !ISSPACE (*p))
- p++;
- }
- else
- {
- if ((p = strchr (s, ' ')) == NULL)
- return 0;
+ else if (*p == '"')
+ {
+ q = !q;
+ }
}
+
+ if (q || !*p) return 0;
+
if (path)
{
len = (size_t) (p - s);
len = pathlen - 1;
memcpy (path, s, len);
path[len] = 0;
+ dprint (3, (debugfile, "is_from(): got return path: %s\n", path));
}
-
+
s = p + 1;
SKIPWS (s);
if (!*s)