Article View: demon.ip.developers
Article #344Re: KA9Q - From to >From in received mail
From: pete$no$pam
Date: Sat, 27 Dec 1997 00:00
Date: Sat, 27 Dec 1997 00:00
128 lines
4719 bytes
4719 bytes
In article <27938-971227-v2k@holly.demon.co.uk>
mcr@holly.demon.co.uk "Mark Rogers" writes:
[re: patching .exe]
> Indeed, although it needs to be remembered whenever the executable is
> replaced. IMHO the current behaviour is a bug, and from what I can tell
> relatively straightforward to fix, so on that basis a fix would be the
> ideal option.
Agreed, though in theory at least NET.EXE doesn't change that
often - the official (and some would say broken) release is
still 2.16d. As to the current behaviour being a bug, I'm not
sure, though it's certainly IMO not very elegant :-) I could
not find anything in the RFCs I checked, but then from what
Richard Clayton said in an earlier post I wasn't surprised.
ISTM from looking through various ka9q sources that 'smtp
separator' was an afterthought - the definitive Unix "From "
mechanism being the de facto standard at the time.
> However, I am only too aware that I'm not actually planning
> to perform the fix myself, so if those who currently maintain the "active"
> versions of KA9Q disagree with me then that's my tough luck :-)
Well FWIW here's my suggestion to implement the behaviour you
want, though whether it will break other mail systems I don't
know. [This is complicated somewhat by the fact that escaping
the "From " has been moved in the GremNOS build from the
'getmsgtxt()' function into 'copy_data()' (a more logical place
IMO) but the principle remains the same.]
[GremNOS 0.2: SMTPSERV.C]
...
static void
copy_data (FILE *from, FILE *to)
{
char *buf;
int last_had_newline = TRUE;
#if PDLMOD
char *local_sep; /* don't reassign the global var */
int local_sep_len;
/* decide once (per mail) rather than on every line */
if (smtp_separator != NULLCHAR)
local_sep = smtp_separator, sep_len = strlen (smtp_separator);
else
local_sep = "From ", sep_len = 5;
#endif
buf = mallocw (LINELEN);
while (fgets (buf, LINELEN, from) != NULL)
{
#if PDLMOD
if (last_had_newline && strncmp (buf, local_sep, sep_len) == 0)
#else
/* Escape 'From ' at the beginning of a line for unix mail compatibility */
if (last_had_newline && strncmp (buf, "From ", 5) == 0)
#endif
fputc ('>', to);
if (fputs (buf, to) == EOF)
break;
pwait (NULL);
last_had_newline = (strchr (buf, '\n') != NULL);
}
free (buf);
}
Also, on a related topic the coding of 'doseparator()' in
SMTPCLI.C could be improved somewhat: although it is rather
unlikely that one would want change the smtp separator during
a single session, the memory alloc'd to the first one is not
free'd (unless it is explicitly de-assigned by issuing an
intervening smtp separator [nothing] command.)
[SMTPCLI.C]
...
static int
doseparator (argc, argv, p)
int argc;
char *argv[];
void *p;
{
int i;
char *t;
if (argc < 2)
{
if (smtp_separator)
free (smtp_separator);
smtp_separator = NULL;
}
else
{
t = mallocw (81);
... etc.
might be improved with:
static int
doseparator (argc, argv, p)
int argc;
char *argv[];
void *p;
{
int i;
char *t;
if (smtp_separator != NULLCHAR)
{
free (smtp_separator); /* free previous setting regardless */
smtp_separator = NULL;
}
if (argc > 1)
{
t = mallocw (81);
... etc.
Just a thought.
Seeing the way this thread is going, I've set followups to
d.i.d only.
--
Pete
demon.ip.support.pc is for discussion of IP-related issues using plain
DOS software - *not* PC hardware, Windows, Netscape, Turnpike, MSIE...
Read the "Which Group" FAQ:- ftp.demon.co.uk/pub/doc/general/whichgrp.faq
Technical Details
Message-ID:
<883212463snz@pdlmail.demon.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<m4vzFMA$h9n0Iw+v@controlware.demon.co.uk> <27938-971227-v2k@holly.demon.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10bb05,44b5f36dee7313d2 X-Google-Attributes: gid10bb05,public X-Google-Thread: fb525,44b5f36dee7313d2 X-Google-Attributes: gidfb525,public From: pete$no$pam@pdlmail.demon.co.uk Subject: Re: KA9Q - From to >From in received mail Date: 1997/12/27 Message-ID: <883212463snz@pdlmail.demon.co.uk> X-Deja-AN: 310497047 References: <m4vzFMA$h9n0Iw+v@controlware.demon.co.uk> <27938-971227-v2k@holly.demon.co.uk> Followup-To: demon.ip.developers X-Mail2News-Path: pdlmail.demon.co.uk Reply-To: pete$no$pam@pdlmail.demon.co.uk X-Mail2News-User: pete@pdlmail.demon.co.uk X-Complaints-To: abuse@demon.net X-Trace: mail2news.demon.co.uk 883217251 15025 pete pdlmail.demon.co.uk Organization: PDL Newsgroups: demon.ip.developers,demon.ip.support.pc