uugetty is no more

This commit is contained in:
riastradh 2020-02-26 15:44:57 +00:00
parent ed72789936
commit fcfd803846
2 changed files with 6 additions and 64 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: getty.8,v 1.18 2013/05/29 15:02:12 wiz Exp $
.\" $NetBSD: getty.8,v 1.19 2020/02/26 15:44:57 riastradh Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -33,8 +33,7 @@
.Dt GETTY 8
.Os
.Sh NAME
.Nm getty ,
.Nm uugetty
.Nm getty
.Nd set terminal modes for system access
.Sh SYNOPSIS
.Nm
@ -42,11 +41,6 @@
.Ar type
.Op Ar tty
.Oc
.Nm uugetty
.Oo
.Ar type
.Op Ar tty
.Oc
.Sh DESCRIPTION
The
.Nm
@ -133,20 +127,11 @@ The
program can be set to timeout after some interval,
which will cause dial up lines to hang up
if the login name is not entered reasonably quickly.
.Pp
The
.Nm uugetty
program is the same, except that it uses
.Xr pidlock 3
to respect the locks in
.Pa /var/spool/lock
of processes that dial out on that tty.
.Sh FILES
.Bl -tag -width /var/spool/lock/LCK..ttyXX -compact
.Bl -tag -width /usr/libexec/getty -compact
.It Pa /etc/gettytab
.It Pa /etc/ttys
.It Pa /usr/libexec/getty
.It Pa /var/spool/lock/LCK..ttyXX
.El
.Sh DIAGNOSTICS
.Bl -diag
@ -164,7 +149,6 @@ does not exist.
.Sh SEE ALSO
.Xr login 1 ,
.Xr ioctl 2 ,
.Xr pidlock 3 ,
.Xr ttyaction 3 ,
.Xr tty 4 ,
.Xr gettytab 5 ,

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.66 2017/01/10 21:08:15 christos Exp $ */
/* $NetBSD: main.c,v 1.67 2020/02/26 15:44:57 riastradh Exp $ */
/*-
* Copyright (c) 1980, 1993
@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\
#if 0
static char sccsid[] = "from: @(#)main.c 8.1 (Berkeley) 6/20/93";
#else
__RCSID("$NetBSD: main.c,v 1.66 2017/01/10 21:08:15 christos Exp $");
__RCSID("$NetBSD: main.c,v 1.67 2020/02/26 15:44:57 riastradh Exp $");
#endif
#endif /* not lint */
@ -99,8 +99,7 @@ struct utsname kerninfo;
char name[LOGIN_NAME_MAX];
char dev[] = _PATH_DEV;
char ttyn[32];
char lockfile[512];
uid_t ttyowner;
uid_t ttyowner = 0;
char *rawttyn;
#define OBUFSIZ 128
@ -183,15 +182,12 @@ static void xputs(const char *);
int
main(int argc, char *argv[], char *envp[])
{
const char *progname;
int repcnt = 0, failopenlogged = 0;
volatile int first_time = 1;
struct rlimit limit;
struct passwd *pw;
int rval;
/* this is used past the siglongjmp, so make sure it is not cached
in registers that might become invalid. */
volatile int uugetty = 0;
const char * volatile tname = "default";
(void)signal(SIGINT, SIG_IGN);
@ -202,18 +198,6 @@ main(int argc, char *argv[], char *envp[])
(void)strlcpy(hostname, "Amnesiac", sizeof(hostname));
(void)uname(&kerninfo);
progname = getprogname();
if (progname[0] == 'u' && progname[1] == 'u')
uugetty = 1;
/*
* Find id of uucp login (if present) so we can chown tty properly.
*/
if (uugetty && (pw = getpwnam("uucp")))
ttyowner = pw->pw_uid;
else
ttyowner = 0;
/*
* Limit running time to deal with broken or dead lines.
*/
@ -238,23 +222,6 @@ main(int argc, char *argv[], char *envp[])
rawttyn = argv[2];
(void)strlcpy(ttyn, dev, sizeof(ttyn));
(void)strlcat(ttyn, argv[2], sizeof(ttyn));
if (uugetty) {
(void)chown(ttyn, ttyowner, 0);
(void)strlcpy(lockfile, _PATH_LOCK,
sizeof(lockfile));
(void)strlcat(lockfile, argv[2],
sizeof(lockfile));
/*
* wait for lockfiles to go away before we try
* to open
*/
if (pidlock(lockfile, 0, 0, 0) != 0) {
syslog(LOG_ERR,
"%s: can't create lockfile", ttyn);
exit(1);
}
(void)unlink(lockfile);
}
if (strcmp(argv[0], "+") != 0) {
(void)chown(ttyn, ttyowner, 0);
(void)chmod(ttyn, 0600);
@ -277,13 +244,6 @@ main(int argc, char *argv[], char *envp[])
repcnt++;
(void)sleep(60);
}
if (uugetty && pidlock(lockfile, 0, 0, 0) != 0) {
syslog(LOG_ERR, "%s: can't create lockfile",
ttyn);
exit(1);
}
if (uugetty)
(void)chown(lockfile, ttyowner, 0);
(void)login_tty(i);
}
}
@ -441,8 +401,6 @@ main(int argc, char *argv[], char *envp[])
(void)signal(SIGINT, SIG_IGN);
if (NX && *NX)
tname = NX;
if (uugetty)
(void)unlink(lockfile);
}
}