Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 May 1996 14:54:30 -0700 (PDT)
From:      Veggy Vinny <richardc@CSUA.Berkeley.EDU>
To:        Terry Lambert <terry@lambert.org>
Cc:        terry@lambert.org, questions@freebsd.org
Subject:   Re: long motd files - screen pause?
Message-ID:  <Pine.PTX.3.91.960531145117.29367K-100000@soda.CSUA.Berkeley.EDU>
In-Reply-To: <199605312134.OAA18765@phaeton.artisoft.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Fri, 31 May 1996, Terry Lambert wrote:

> > > > 	Hmmm, okay but how do some machines make the motd pause even 
> > > > before it knows the termcap?
> > > 
> > > By assuming 24 lines or by using the telnet/rlogin/sigwinch(pty)
> > > hints as to terminal size (assuming they are set up correctly).
> > > 
> > > On a 50 line diplay, you may get 3 "more" prompts this way.
> > > 
> > > Obviously, the "more" prompts aren't reverse video (unless it hard codes
> > > a terminal type in /etc/ttys).
> > 
> > 	hmmm okay... or maybe their login is modified?
> 
> This is taking too much time. 8-|.  You want to do something, and you
> are bound and determined that you be able to solve it in a way which,
> frankly, it is impossible to make it work reliably.  You need to seek
> alternate soloutions, and pick one.
> 
> 
> ========================================================================
> Terry's cannonical list of when you can and can't reliably use "more"
> during the login process:
> ========================================================================
> 
> 1)	more needs the TERM environment variable.
> 
> 2)	TERM is:
> 
> 	o	set for the console in /etc/ttys
> 	o	NOT set for "network" terminals, as in pty's for:
> 		o	rlogin
> 		o	telnet
> 		o	xterm
> 	o	set by forced inheritance of environment by:
> 		o	xterm (sets the TERMvariable to contain a
> 			correct termcap entry for an xterm
> 	o	set by name in environment (not all clients provide
> 		this information) by:
> 		o	rlogin (remote TERM may not be correct, or
> 			may not be supported on host system).
> 		o	telnet (remote TERM may not be correct, or
> 			may not be supported on host system).
> 
> 
> 3)	more wants (but does not require, if it matches the termcap
> 	entry) stty "rows" and "cols" settings.
> 
> 4)	stty "rows" and "cols" settings are typically:
> 
> 	o	set for the console by the console driver
> 	o	set on SIGWINCH from the master side of a pty
> 	o	set by rlogin (using SIGWINCH); not supported
> 		by all clients
> 	o	set by xterm (using SIGWINCH)
> 	o	NOT set by telnet
> 	o	NOT set for non-console terminals over wire or modem
> 
> 
> If a "rows" setting is present, it overrides the termcap setting.  If
> it is not, the rows are assumed from the TERMCAP entry.  They are set
> in the stty environment only after (if) login exec's a shell *AFTER*
> displaying the MOTD, and the shell runs a startup script, and the
> startup srcipt runs the X program "resize" that comes with xterm, or
> the shell script runs the "tset" program.
> 
> 
> So if login were to run "more" to display the /etc/motd:
> 
> 1)	It may not be able to inverse video the prompt, because it
> 	may or may not have a valid TERM environment variable before
> 	login has exec'ed a shell and the shell has run the startup
> 	script in the system, then the user's, home directory.
> 
> 	This has the effect of changing the expected prompt string,
> 	which may damage the ability to reliably run automated logins.
> 
> 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?

> 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?

> 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.

> 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.

> Conclusion #4: you can use the BSD "news" program ("msgs") to do what
> you want without screwing around with login.  You have control over
> what shells users are allowed to use, and you can force them to use
> shells that use system wide profiles to query the users for a valid
> terminal type and for "msgs" to be run at login time for interactive
> logins.  This is probably the correct way to do what you say you want
> done.

	Actually, this is the best idea yet...

Vince





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.PTX.3.91.960531145117.29367K-100000>