[comp.protocols.appletalk] Problems with MacTCP hosts file: seems not to be used

mak@cs.nott.ac.uk (Martijn Koster) (10/23/90)

Hello all,

I've got a slight problem: I'm using MacTCP, and have it set up
so it can look-up names. I tested this with the "TCP Example" stack
that came on one of the developer disks. It works fine, but then I
tried adding hostnames in the Hosts file (in the System Folder, and
yes, it's a text only file). This didn't work. I tried the following:

   aa->                   A->   128.243.20.4
   bb.->                  A->   128.243.20.4
   cc.cs.nott.ac.uk->     A->   128.243.20.4
   dd.cs.nott.ac.uk.->    A->   128.243.20.4
   ee.nott.ac.uk->        A->   128.243.20.4
   ff.nott.ac.uk.->       A->   128.243.20.4

The '->' signifies a tab, and lines are nded with a return.
128.243.20.4 does exist, is in fact the machine I'm using now. 
And then I tried all the hostnames, but "TCP Example" returned

   $$$ Couldn't get address $$$

Can somebody explain what I'm doing wrong? I'd love to RTFM, but
somebody has managed to lose it or something.

Also, has someone written a program to convert a /etc/hosts file to a
MacTCP Hosts file?

And lastly, doesn't NCSA Telnet 2.3 use MacTCP name resolver? I ended
up writing a program to convert /etc/hosts to a config.tel file (that
awk script that came with telnet choked on comments).

Thanks very much in advance,

Martijn Koster

Details:
MacPlus, 2.5 Meg RAM, 20 Meg Rodime SCSI HD, System 6.0.5
(MacPlus, 4 Meg RAM, 40 Meg Apple SC HD, System 6.0.3 didn't work either)
The Plus sits on LocalTalk, with a FastPath connected to the ethernet.
MacTCP version 1.0.1, gets its IP Number of a server, DNS information
has one entry "cs.nott.ac.uk".

resnick@cogsci.uiuc.edu (Pete Resnick) (10/24/90)

mak@cs.nott.ac.uk (Martijn Koster) writes:
>   aa->                   A->   128.243.20.4
>   bb.->                  A->   128.243.20.4

I don't think either one of these is valid domain name syntax.

>   dd.cs.nott.ac.uk.->    A->   128.243.20.4
>   ff.nott.ac.uk.->       A->   128.243.20.4

That "." at the end might be screwing you up.

I am also not sure how smart the DNR is. If something in the file is
screwy, it might not be too happy. But the other example you give should
work. I have tabs in my file. You might try without to test it.

>And lastly, doesn't NCSA Telnet 2.3 use MacTCP name resolver? I ended
>up writing a program to convert /etc/hosts to a config.tel file (that
>awk script that came with telnet choked on comments).

Nope. NCSA uses their own resolver. I don't think that will ever change.
(*Sigh*)

pr
--
Pete Resnick             (...so what is a mojo, and why would one be rising?)
Graduate assistant - Philosophy Department, Gregory Hall, UIUC
System manager - Cognitive Science Group, Beckman Institute, UIUC
Internet/ARPAnet/EDUnet  : resnick@cogsci.uiuc.edu
BITNET (if no other way) : FREE0285@UIUCVMD

lefty@TWG.COM (10/25/90)

Martijn Koster <mcsun!ukc!warwick!nott-cs!mak@uunet.uu.net> writes:
>I've got a slight problem: I'm using MacTCP, and have it set up
Message-ID:  <9010241459.aa17312@Mercury.TWG.COM>

>so it can look-up names. I tested this with the "TCP Example" stack
>that came on one of the developer disks. It works fine, but then I
>tried adding hostnames in the Hosts file (in the System Folder, and
>yes, it's a text only file). This didn't work. I tried the following:
>
>   aa->                   A->   128.243.20.4
>   bb.->                  A->   128.243.20.4
>   cc.cs.nott.ac.uk->     A->   128.243.20.4
>   dd.cs.nott.ac.uk.->    A->   128.243.20.4
>   ee.nott.ac.uk->        A->   128.243.20.4
>   ff.nott.ac.uk.->       A->   128.243.20.4
>
>The '->' signifies a tab, and lines are nded with a return.
>128.243.20.4 does exist, is in fact the machine I'm using now. 
>And then I tried all the hostnames, but "TCP Example" returned
>
>   $$$ Couldn't get address $$$
>
>Can somebody explain what I'm doing wrong? I'd love to RTFM, but
>somebody has managed to lose it or something.

I believe that the TCP Stack uses Harry Chesley's sample XCMDs, which are
supplied as the "Hypercard MacTCP Tool Kit".  There is a minor problem with
Harry's code to use the MacTCP Domain Name Resolver functions:
specifically, when Harry's code opens the resolver, if it isn't supplied
with the name of a specific file to open, it passes a pointer to a null
_string_ to the Resolver, rather than a null _pointer_.  The Resolver only
seems to look for a file called "Hosts" in the System Folder if it's passed
a null _pointer_.

You'll need to make a correction to Harry's XCMD to fix the situation
described above--it's a pretty trivial hack.  By the way, Harry's code is
otherwise impeccable...

To make the appropriate fix, find the following lines in the file
TCPNameToAddr.c:

	/* Call open resolver. */
	if ((paramPtr->paramCount < 3) || (paramPtr->params[2] == nil)) *str = 0;
	else strcpy(str,*(paramPtr->params[2])); 
	rc = (*dnr)(OPENRESOLVER, str);

They _should_ read:

	/* Call open resolver. */
	if ((paramPtr->paramCount < 3) || (paramPtr->params[2] == nil))
{
    rc = (*dnr)(OPENRESOLVER, nil);
}
	else
{
    strcpy(str,*(paramPtr->params[2])); 
	    rc = (*dnr)(OPENRESOLVER, str);
}

>Also, has someone written a program to convert a /etc/hosts file to a
>MacTCP Hosts file?

Sorry, not me...

>And lastly, doesn't NCSA Telnet 2.3 use MacTCP name resolver? I ended
>up writing a program to convert /etc/hosts to a config.tel file (that
>awk script that came with telnet choked on comments).

Actually, I don't believe that it does.  It's too bad, too, because it's
easy to implement and it seems to work real well...

Hope this helps...

--
David N. Schlesinger (lefty@twg.com)
Sr. Software Engineer
The Wollongong Group