[comp.sys.sun] /etc/inetd is sensitive to ordering of lines in /etc/inetd.conf

arnold@emoryu2.cc.emory.edu (Arnold D. Robbins) (03/21/89)

- workstation model and serial number
	Sun 4/280,	# 824E0970
- your name
	Arnold Robbins
- electronic mail address (sendmail doesn't always get it right)
	arnold@emoryu1.cc.emory.edu
- company or organization name & address
	Emory University Computing Center
	Uppergate House
	Emory University
	Atlanta, Georgia 30322
- Sun software release number (e.g., 1.4, 2.0).
	SunOS 4.0
- Any information which may help us diagnose your problem,

Inetd is sensitive to the order of entries in /etc/inetd.conf. In
particualar, putting a non-rpc or non-internal type of entry in the file
after the rpc or internal entries does not work. If the new entry is after
the rpc entries, the portmapper and NFS fail.  If it is after the internal
entries, then the new entry does not work.

We discovered this while trying to implement the 4.3 BSD version of talk.
We used this line:

  ntalk	dgram	udp	wait	root	/usr/local/etc/in.ntalkd in.ntalkd

It must come before the internal and RPC entries in inetd.conf for talk to
work at all.

This behavior is very non-intuitive, to say the least!

Thanks,

Arnold Robbins -- Emory University Computing Center
DOMAIN: arnold@unix.cc.emory.edu
UUCP: gatech!emoryu1!arnold  PHONE: +1 404 727-7636
BITNET: arnold@emoryu1	     FAX:   +1 404 727-2599

nesheim@think.com (03/31/89)

arnold@emoryu2.cc.emory.edu (Arnold D. Robbins):
> ... 
> Inetd is sensitive to the order of entries in /etc/inetd.conf. In
> particualar, putting a non-rpc or non-internal type of entry in the file
> after the rpc or internal entries does not work. If the new entry is after
> the rpc entries, the portmapper and NFS fail.  If it is after the internal
> entries, then the new entry does not work....

I'd suspect a different problem.  My inetd.conf follows, and it includes
three entries after the internal and RPC entries, which all work just
fine..  Look for a missing argument to one of the RPC or internal entries
preceeding your local entries.

# @(#)inetd.conf 1.17 88/02/07 SMI
ftp	stream	tcp	nowait	root	/usr/etc/in.ftpd	in.ftpd
#telnet	stream	tcp	nowait	root	/usr/etc/in.telnetd	in.telnetd
shell	stream	tcp	nowait	root	/usr/etc/in.rshd	in.rshd
login	stream	tcp	nowait	root	/usr/etc/in.rlogind	in.rlogind
exec	stream	tcp	nowait	root	/usr/etc/in.rexecd	in.rexecd
#finger	stream  tcp	nowait  root    /usr/etc/in.fingerd	in.fingerd
#tftp    dgram   udp     wait    root    /usr/etc/in.tftpd	 in.tftpd -s /tftpboot
comsat	dgram	udp	wait	root	/usr/etc/in.comsat	in.comsat
talk	dgram	udp	wait	root	/usr/etc/in.talkd	in.talkd
name	dgram	udp	wait	root	/usr/etc/in.tnamed	in.tnamed
daytime	stream	tcp	nowait	root	internal
time	stream	tcp	nowait	root	internal
echo	dgram	udp	wait	root	internal
discard	dgram	udp	wait	root	internal
time	dgram	udp	wait	root	internal
#
#@mountd/1	dgram	rpc/udp	wait root /usr/etc/rpc.mountd	rpc.mountd
rexd/1		stream	rpc/tcp	wait root /usr/etc/rpc.rexd	rpc.rexd
#ypupdated/1	stream	rpc/tcp	wait root /usr/etc/rpc.ypupdated rpc.ypupdated
rquotad/1	dgram	rpc/udp	wait root /usr/etc/rpc.rquotad	rpc.rquotad
rstatd/1-3	dgram	rpc/udp	wait root /usr/etc/rpc.rstatd	rpc.rstatd
rusersd/1-2	dgram	rpc/udp	wait root /usr/etc/rpc.rusersd	rpc.rusersd
sprayd/1	dgram	rpc/udp	wait root /usr/etc/rpc.sprayd	rpc.sprayd
walld/1		dgram	rpc/udp	wait root /usr/etc/rpc.rwalld	rpc.rwalld
#
# TMC additions/changes
finger	stream  tcp	nowait  nobody  /usr/local/etc/fingerd	fingerd
supdup	stream	tcp	nowait	root	/usr/local/etc/supdupd	supdupd
telnet	stream	tcp	nowait	root	/usr/local/etc/telnetd	telnetd

-- Bill Nesheim; Thinking Machines Corporation, Cambridge, MA +1 617-876-1111
   nesheim@think.com, {ames,bloom-beacon,mit-eddit}!think!nesheim

timr@uunet.uu.net (Tim Roper) (04/26/89)

I think the attached diff of the 4.3bsd and 4.3bsd-tahoe inetd.c may be of
interest.  The se_bi flag in the data structure that holds /etc/inetd.conf
was not being reset when a non-internal entry was encountered after an
internal entry.  Hence the problem described in
<8903061946.AA20555@emoryu1.cc.emory.edu>

I have no idea how SunOS versions relates to these.  We encountered the
problem with a System V implementation derived from bsd (for which a fix
was issued by the TCP supplier well before tahoe was announced).

-Tim.

***************
*** 593,622 ****
  	if (strcmp(sep->se_server, "internal") == 0) {
  		register struct biltin *bi;

  		for (bi = biltins; bi->bi_service; bi++)
  			if (bi->bi_socktype == sep->se_socktype &&
  			    strcmp(bi->bi_service, sep->se_service) == 0)
  				break;
  		if (bi->bi_service == 0) {
  			syslog(LOG_ERR, "internal service %s unknown\n",
  				sep->se_service);
  			goto more;
  		}
  		sep->se_bi = bi;
  		sep->se_wait = bi->bi_wait;
! 	} else
! 		sep->se_bi = NULL;
  	argc = 0;
  	for (arg = skip(&cp); cp; arg = skip(&cp))
  		if (argc < MAXARGV)
  			sep->se_argv[argc++] = strdup(arg);
  	while (argc <= MAXARGV)
  		sep->se_argv[argc++] = NULL;
  	return (sep);
  }

  freeconfig(cp)
  	register struct servtab *cp;
  {
  	int i;