nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] message-external/body and auto-fetching(?)


From: Earl Hood
Subject: Re: [Nmh-workers] message-external/body and auto-fetching(?)
Date: Fri, 8 Feb 2013 15:14:11 -0600

On Fri, Feb 8, 2013 at 2:41 PM, Ken Hornstein wrote:
>>Checking the nmh source code (and the old MH source code), it seems
>>to me that if I show a message, but redirect to a file, MH/nmh will
>>try to auto-fetch a message-external/body part (e.g. anon FTP).
>>
>>Am I correct in my reading of the code?
>
> Hm.  That code is a bit hairy; can you point to me why you think that?
> After a quick look, I'm a bit confused :-/

Agree about the mess.  And it appears I have things a bit confused.
It seems that if stdin is not a terminal, auto-fetching will be done,
so things may not be that bad.

Some details:

Looking at the 1.5 nmh code base, the file uip/mhparse.c has the
following in the openFTP() function:

2573     /*
2574      * Now, check the answer
2575      */
2576     if (!getanswer (buffer))
2577         return NOTOK;

Checking the getanswer() function (sbr/getanswer.c):

 14 int
 15 getanswer (char *prompt)
 16 {
 17     static int interactive = -1;
 18
 19     if (interactive < 0)
 20         interactive = isatty (fileno (stdin)) ? 1 : 0;
 21
 22     return (interactive ? gans (prompt, anoyes) : 1);
 23 }


It appears if stdin is not a terminal, getanswer() will always return 1.

Not sure what happens if authentication is required, have not traced the
code that far, but for anon-ftp external-body, it seems the data will be
auto-fetched.  I am guessing if authentication is required, the user's
.netrc will be consulted.

I figure something like the following on the command-line will cause
auto-fetching:

  show < /dev/null > message.txt

I guess if a user does such a thing, they are willing to live with the
implications of auto-fetching.  I am curious if anyone has ever done
this in practice, but it appears the nmh code base (and MH) allow for
it.

I wondering if back-in-the-day, something like the above could be
done for priming a shared cache on a shared system.

--ewh



reply via email to

[Prev in Thread] Current Thread [Next in Thread]