Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 May 1996 15:36:19 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        richardc@CSUA.Berkeley.EDU (Veggy Vinny)
Cc:        terry@lambert.org, questions@freebsd.org
Subject:   Re: long motd files - screen pause?
Message-ID:  <199605312236.PAA19005@phaeton.artisoft.com>
In-Reply-To: <Pine.PTX.3.91.960531145117.29367K-100000@soda.CSUA.Berkeley.EDU> from "Veggy Vinny" at May 31, 96 02:54:30 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> > 2)	It may not know the correct number of rows, either because
> > 	it does not have a valid TERM environment variable (which
> > 	makes "more" assume 24 rows, which may be too many, and so
> > 	truncate information by scrolling it off the top), or the
> > 	TERM environment variable may be set, but the stty "rows"
> > 	may be incorrect, or it may not be set at all, in which case,
> > 	it can truncate (via scrolling) or present multiple prompts
> > 	for "more".
> > 
> > 	This will cause the user to lose information in the first
> > 	case, and to not be able to use automated logins in the
> > 	second case.
> 
> 	Hmm, but what if all the terminals were either vt100 or xterm?

If they are vt100, then you have it set in your /etc/ttys for all of
them.

If they are xterm, then you can't set vt100 in /etc/ttys for them.

If all the vt100's are direct connect, and all the xterms are network,
then it'll work.

> > Conclusion #1: the "more" program needs information you can't be
> > guaranteed to be able to give it until *after* you have logged in.
> > Once you have already logged in, it is too late to use "more" to
> > display the /etc/motd because it is a file that is displayed by
> > login.  This is how /etc/motd is *defined*.
> 
> 	Hmmm, okay... is the /etc/motd displayed with cat?

It's displayed with read( fd, ...), write( 1, ...) (basically), since
it doesn't fork a command to do it, it does it itself.  You need to
look at /usr/src/usr.bin/login/login.c:

		while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0)
			(void)write(fileno(stdout), tbuf, nchars);


> > Conclusion #2: don't use the motd for information you want to
> > potentially paginate.  You can not reliably do this; it is simply
> > impossible because you traded this ability for the ability to use
> > terminals of various types and screen lengths on UNIX systems.
> 
> 	Hmmm, I just wonder how it's done because all of the UC Berkeley
> machines in CSUA, OCF have the paging feature in the motd.

It's done with an assumption of 24 lines barring other information,
just like more does it, and they modified /usr/bin/login to make it
happen.  Ask them for the moidifed version.  Know that under some
circumstances, you will screw up automatic logins.  Know under some
circumsatnces, some users won't get all the information.  Just like at
UC Berkeley.  For instance, if someone come in with an 18 line xterm,
you can expect to have 8 lines per page of text that the user won't
see because it scrolled off the top of their terminal.

> > Conclusion #3: in some situations, it would be "safe" for you to
> > run "more" on the /etc/motd.  You have not given us enough information
> > about *exactly* how and what programs you let users use to login
> > for us to be able to tell you if your situation is "safe" or not.
> 
> 	Well, they'll be using rlogin, telnet and then go through their 
> normal shell.

Do you want the motd from login via rlogin paginated, or do you want the
one for the login invoked by telnetd?  Which login?

What rlogin client are you using?  Does it pass the correct TERM
environment variable, according to the protocol extension RFC's?
does the rlogind understand the extensions?  Is the terminal type
a valid terminal type on the machine you are telnetting from?  Does
the telnetd support TERM passing via the extensions?  Does the machine
you are telnetting into know about the terminal type that the user
passed into the first machine from their machine via rlogind into the
user environment?  You realize that the telnet/telnetd can't correctly
communicate the number of rows, so you will need to have absolutely
accurate termcap entries with li# entries for wherever the user is
coming from?  You realize that this is impossible for xterms, which
use li#24 when there is no pty used to set the stty rows via SIGWINCH
(telnet/telnetd doesn't support this)?  What telnet client are you
using -- doe it even pass the TERM data to the telnetd?


These are the questions you must answer for yourself; they are *very*
dependent on you your site is setup and the exact versions of the
software you are using.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199605312236.PAA19005>