Execute ttyaction on termination of rlogind/telnetd sessions.

Also, say a little bit about ttyaction in the getty and login manpages.
This commit is contained in:
tsarna 1998-08-29 17:31:55 +00:00
parent 56b9b43fe0
commit c89a574ffa
8 changed files with 57 additions and 21 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: ttyaction.3,v 1.7 1998/02/05 18:52:32 perry Exp $ .\" $NetBSD: ttyaction.3,v 1.8 1998/08/29 17:31:55 tsarna Exp $
.\" .\"
.\" Copyright (c) 1996 The NetBSD Foundation, Inc. .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
.\" All rights reserved. .\" All rights reserved.
@ -50,9 +50,11 @@
The The
.Fn ttyaction .Fn ttyaction
function is used by function is used by
.Xr login 1 .Xr login 1 ,
.Xr getty 8 ,
.Xr telnetd 8
and and
.Xr getty 8 .Xr rlogind 8
to execute site-specific commands to execute site-specific commands
when a login session begins and ends. when a login session begins and ends.
.Pp .Pp

View File

@ -1,4 +1,4 @@
.\" $NetBSD: getty.8,v 1.10 1998/04/29 08:33:11 fair Exp $ .\" $NetBSD: getty.8,v 1.11 1998/08/29 17:31:56 tsarna Exp $
.\" .\"
.\" Copyright (c) 1980, 1991, 1993 .\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -95,6 +95,12 @@ and prompt for a login name.
Usually either the banner or the login prompt will include Usually either the banner or the login prompt will include
the system hostname. the system hostname.
.Pp .Pp
.Nm
uses the
.Xr ttyaction 3
facility with an action of "getty" and user "root"
to execute site-specific commands when it starts.
.Pp
Most of the default actions of Most of the default actions of
.Nm .Nm
can be circumvented, or modified, by a suitable can be circumvented, or modified, by a suitable

View File

@ -1,4 +1,4 @@
.\" $NetBSD: rlogind.8,v 1.8 1998/04/29 19:27:23 fair Exp $ .\" $NetBSD: rlogind.8,v 1.9 1998/08/29 17:31:56 tsarna Exp $
.\" .\"
.\" Copyright (c) 1983, 1989, 1991, 1993 .\" Copyright (c) 1983, 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -143,6 +143,13 @@ Transport-level keepalive messages are enabled unless the
option is present. option is present.
The use of keepalive messages allows sessions to be timed out The use of keepalive messages allows sessions to be timed out
if the client crashes or becomes unreachable. if the client crashes or becomes unreachable.
.Pp
At the end of a login session,
.Nm
invokes the
.Xr ttyaction 3
facility with an action of "rlogind" and user "root"
to execute site-specific commands.
.Sh DIAGNOSTICS .Sh DIAGNOSTICS
All initial diagnostic messages are indicated All initial diagnostic messages are indicated
by a leading byte with a value of 1, by a leading byte with a value of 1,
@ -159,6 +166,7 @@ by the server failed.
.Sh SEE ALSO .Sh SEE ALSO
.Xr login 1 , .Xr login 1 ,
.Xr ruserok 3 , .Xr ruserok 3 ,
.Xr ttyacion 3 ,
.Xr rshd 8 .Xr rshd 8
.Sh BUGS .Sh BUGS
The authentication procedure used here assumes the integrity The authentication procedure used here assumes the integrity

View File

@ -1,4 +1,4 @@
/* $NetBSD: rlogind.c,v 1.17 1998/08/26 00:46:23 perry Exp $ */ /* $NetBSD: rlogind.c,v 1.18 1998/08/29 17:31:56 tsarna Exp $ */
/*- /*-
* Copyright (c) 1983, 1988, 1989, 1993 * Copyright (c) 1983, 1988, 1989, 1993
@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1989, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)rlogind.c 8.2 (Berkeley) 4/28/95"; static char sccsid[] = "@(#)rlogind.c 8.2 (Berkeley) 4/28/95";
#else #else
__RCSID("$NetBSD: rlogind.c,v 1.17 1998/08/26 00:46:23 perry Exp $"); __RCSID("$NetBSD: rlogind.c,v 1.18 1998/08/29 17:31:56 tsarna Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -495,16 +495,19 @@ void
cleanup(signo) cleanup(signo)
int signo; int signo;
{ {
char *p; char *p, c;
p = line + sizeof(_PATH_DEV) - 1; p = line + sizeof(_PATH_DEV) - 1;
if (logout(p)) if (logout(p))
logwtmp(p, "", ""); logwtmp(p, "", "");
(void)chmod(line, 0666); (void)chmod(line, 0666);
(void)chown(line, 0, 0); (void)chown(line, 0, 0);
*p = 'p'; c = *p; *p = 'p';
(void)chmod(line, 0666); (void)chmod(line, 0666);
(void)chown(line, 0, 0); (void)chown(line, 0, 0);
*p = c;
if (ttyaction(line, "rlogind", "root"))
syslog(LOG_ERR, "%s: ttyaction failed", line);
shutdown(netf, 2); shutdown(netf, 2);
exit(1); exit(1);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_term.c,v 1.13 1998/08/05 00:15:25 perry Exp $ */ /* $NetBSD: sys_term.c,v 1.14 1998/08/29 17:31:56 tsarna Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@ -38,7 +38,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95"; static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
#else #else
__RCSID("$NetBSD: sys_term.c,v 1.13 1998/08/05 00:15:25 perry Exp $"); __RCSID("$NetBSD: sys_term.c,v 1.14 1998/08/29 17:31:56 tsarna Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -1902,16 +1902,19 @@ cleanup(sig)
{ {
#ifndef PARENT_DOES_UTMP #ifndef PARENT_DOES_UTMP
# if (BSD > 43) || defined(convex) # if (BSD > 43) || defined(convex)
char *p; char *p, c;
p = line + sizeof("/dev/") - 1; p = line + sizeof("/dev/") - 1;
if (logout(p)) if (logout(p))
logwtmp(p, "", ""); logwtmp(p, "", "");
(void)chmod(line, 0666); (void)chmod(line, 0666);
(void)chown(line, 0, 0); (void)chown(line, 0, 0);
*p = 'p'; c = *p; *p = 'p';
(void)chmod(line, 0666); (void)chmod(line, 0666);
(void)chown(line, 0, 0); (void)chown(line, 0, 0);
*p = c;
if (ttyaction(line, "telnetd", "root"))
syslog(LOG_ERR, "%s: ttyaction failed", line);
(void) shutdown(net, 2); (void) shutdown(net, 2);
exit(1); exit(1);
# else # else

View File

@ -1,4 +1,4 @@
.\" $NetBSD: telnetd.8,v 1.12 1998/04/28 06:00:54 fair Exp $ .\" $NetBSD: telnetd.8,v 1.13 1998/08/29 17:31:56 tsarna Exp $
.\" .\"
.\" Copyright (c) 1983, 1993 .\" Copyright (c) 1983, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -516,6 +516,14 @@ Only sent if
is compiled with support for data encryption, and is compiled with support for data encryption, and
indicates a willingness to decrypt indicates a willingness to decrypt
the data stream. the data stream.
.El
.Pp
At the end of a login session,
.Nm
invokes the
.Xr ttyaction 3
facility with an action of "telnetd" and user "root"
to execute site-specific commands.
.Sh ENVIRONMENT .Sh ENVIRONMENT
.Sh FILES .Sh FILES
.Pa /etc/services .Pa /etc/services
@ -529,6 +537,7 @@ the data stream.
.Sh "SEE ALSO" .Sh "SEE ALSO"
.Xr telnet 1 , .Xr telnet 1 ,
.Xr login 1 , .Xr login 1 ,
.Xr ttyaction 3 .
.Sh STANDARDS .Sh STANDARDS
.Bl -tag -compact -width RFC-1572 .Bl -tag -compact -width RFC-1572
.It Cm RFC-854 .It Cm RFC-854

View File

@ -1,4 +1,4 @@
.\" $NetBSD: ttyaction.5,v 1.2 1997/10/08 22:00:17 jtc Exp $ .\" $NetBSD: ttyaction.5,v 1.3 1998/08/29 17:31:57 tsarna Exp $
.\" .\"
.\" Copyright (c) 1996 The NetBSD Foundation, Inc. .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
.\" All rights reserved. .\" All rights reserved.
@ -58,10 +58,11 @@ directory, similar to how such devices are named in the
file. file.
.It action .It action
Name of the action for which this line should apply. Name of the action for which this line should apply.
The action names currently defined are "login" and "getty" The action names currently defined are "login", "getty",
"telnetd" and "rlogind"
which indicate which program is processing this file. which indicate which program is processing this file.
(Note that "login" begins a login session, and "getty" is (Note that "login" begins a login session, while the other
run after a login session ends.) three are run after a login session ends.)
.It command .It command
What command to run if this record matches. What command to run if this record matches.
.El .El

View File

@ -1,4 +1,4 @@
.\" $NetBSD: login.1,v 1.12 1998/04/10 09:31:55 fair Exp $ .\" $NetBSD: login.1,v 1.13 1998/08/29 17:31:57 tsarna Exp $
.\" .\"
.\" Copyright (c) 1980, 1990, 1993 .\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -110,9 +110,13 @@ then records an entry in the
.Xr wtmp 5 .Xr wtmp 5
and and
.Xr utmp 5 .Xr utmp 5
files and executes the user's command interpreter. files, executes site-specific login commands via the
.Xr ttyaction 3
facilty with an action of "login", and executes the user's command
interpreter.
.Pp .Pp
Login enters information into the environment (see .Nm
enters information into the environment (see
.Xr environ 7 ) .Xr environ 7 )
specifying the user's home directory (HOME), command interpreter (SHELL), specifying the user's home directory (HOME), command interpreter (SHELL),
search path (PATH), terminal type (TERM) and user name (both LOGNAME and search path (PATH), terminal type (TERM) and user name (both LOGNAME and