[comp.unix.wizards] aliases in .rhosts

gamiddleton@orchid.UUCP (11/02/87)

In 4.3bsd, in your .rhosts file, you have to list remote machines by their
real name (rather than any aliases).  Here is a change to rcmd.c in libc to
allow machine aliases.  Can anybody think of a reason not to do this?

*** /tmp/,RCSt1004886	Mon Nov  2 14:38:09 1987
--- rcmd.c	Tue Apr 28 20:00:08 1987
***************
*** 271,276 ****
--- 271,281 ----
  	static char ldomain[MAXHOSTNAMELEN + 1];
  	static char *domainp = NULL;
  	register char *cp;
+ 	register struct hostent *lhostname;
+ 
+ 	if ((lhostname = gethostbyname(lhost)) != (struct hostent *) NULL)
+ 		lhost = lhostname->h_name;	/* use real name, not an alias
+ 						*/
  
  	if (len == -1)
  		return(!strcmp(rhost, lhost));

bostic@ucbvax.BERKELEY.EDU (Keith Bostic) (11/07/87)

In article <11488@orchid.waterloo.edu>, gamiddleton@orchid.UUCP writes:
> In 4.3bsd, in your .rhosts file, you have to list remote machines by their
> real name (rather than any aliases).  Here is a change to rcmd.c in libc to
> allow machine aliases.  Can anybody think of a reason not to do this?

Yes, I can think of a *very* good reason not to make the change that
you proposed!  On hosts using the nameserver, your change results
in a message exchange with the nameserver for each line in the .rhosts
file!  If any of the hosts listed are remote, and the correct servers
aren't reachable, this will result in a 45-second pause while attempting
to canonicalize each such name.  Don't do it!

		Mike C33B
35

gamiddleton@orchid.UUCP (11/11/87)

In article <21654@ucbvax.BERKELEY.EDU> bostic@ucbvax.BERKELEY.EDU (Keith Bostic) writes:
> Yes, I can think of a *very* good reason not to make the change that
> you proposed!  On hosts using the nameserver, your change results
> in a message exchange with the nameserver for each line in the .rhosts
> file!  If any of the hosts listed are remote, and the correct servers
> aren't reachable, this will result in a 45-second pause while attempting
> to canonicalize each such name.  Don't do it!

This should not be a problem for us, since we are not on the Internet (and
even if we were, it is unlikely that people would have distant machines in
their .rhosts files).

That was not the problem, though.  The difficulty is really with the
gethostbyname() function (or perhaps the BIND resolver routines).  Doing
things the old way (lookup in /etc/hosts), gethostbyname() would return a
machine's real name and a list of aliases.  With the new resolver routines,
you don't get any aliases except the name it was called with.  Is there any
way of getting the resolver to return an alias list?  Then I could just
call gethostbyname() once, and compare to that list.

 -Guy

bostic@ucbvax.BERKELEY.EDU (Keith Bostic) (11/17/87)

In article <11660@orchid.waterloo.edu>, gamiddleton@orchid.waterloo.edu (Guy Middleton) writes:
> With the new resolver routines,
> you don't get any aliases except the name it was called with.  Is there any
> way of getting the resolver to return an alias list?  Then I could just
> call gethostbyname() once, and compare to that list.

The resolver cannot return a complete alias list because the information
is no longer available in a single place, e.g. all of the aliases may not
even be present on a single machine.  Aliases are much more important on
the command line; as we're talking about setting up a file, once, it doesn't
seem unreasonable for the user to be required to enter the complete name.

--keith

gamiddleton@orchid.UUCP (11/21/87)

In article <21825@ucbvax.BERKELEY.EDU> bostic@ucbvax.BERKELEY.EDU (Keith Bostic) writes:
> The resolver cannot return a complete alias list because the information
> is no longer available in a single place, e.g. all of the aliases may not
> even be present on a single machine.  Aliases are much more important on
> the command line; as we're talking about setting up a file, once, it doesn't
> seem unreasonable for the user to be required to enter the complete name.

This isn't for users, but for local software maintenance.  We have a single
machine copying software to many other machines.  Each of these other
machines has a /.rhosts entry for the source machine.  Unfortunately, the
source machine has moved once already, and is likely to move again.  Having
an alias would be much easier to manage than going through each machine by
hand.