Tweak autologin to get it to the point where it appears to work..

Move 'console' to /usr/local/bin rather than /usr/local/sbin since there's
nothing about it that requires superuser access in any way.
This commit is contained in:
Peter Wemm 1998-04-18 20:17:37 +00:00
parent 15cd9fa349
commit 514479cd0e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=10565
5 changed files with 95 additions and 3 deletions

View file

@ -1,3 +1,3 @@
SUBDIR= conserver.cf conserver console
SUBDIR= autologin conserver.cf conserver console
.include <bsd.subdir.mk>

View file

@ -6,7 +6,7 @@
PROG= console
-ETC= ${DESTDIR}/usr/local/etc
-DOC= ${DESTDIR}/usr/local/man
+ETC= ${DESTDIR}/usr/local/sbin
+ETC= ${DESTDIR}/usr/local/bin
+DOC= ${DESTDIR}/usr/local/man/man8
I=/usr/include

View file

@ -0,0 +1,74 @@
--- autologin/autologin.c.orig Sun Apr 19 04:04:45 1998
+++ autologin/autologin.c Sun Apr 19 04:13:14 1998
@@ -22,7 +22,7 @@
#include <errno.h>
-#if !defined IBMR2
+#if !defined IBMR2 && !defined FREEBSD
extern char *sys_errlist[];
#define strerror(Me) (sys_errlist[Me])
#endif
@@ -118,14 +118,16 @@
#if defined(FREEBSD)
#include <sys/time.h>
#include <sys/ioctl.h>
+#include <sys/termios.h>
#include <sys/uio.h>
#include <sys/proc.h>
#include <sys/ioctl_compat.h>
-#define setsid() getpid()
-#define getsid(Mp) (Mp)
-#define USE_IOCTL 1
+#include <sys/ttydefaults.h>
+#define getsid(Mp) (-1)
+#define USE_TC 1
#define USE_OLD_UTENT 1
-#define PATH_SU "/usr/ucb/su"
+#define PATH_SU "/usr/bin/su"
+#define UTMP_PATH "/var/run/utmp"
#else
#include <sys/termios.h>
@@ -348,6 +350,11 @@
dup(0);
dup(0);
}
+#ifdef TIOCSCTTY
+ if (ioctl(0, TIOCSCTTY, NULL) == -1) {
+ (void) fprintf(stderr, "%s: TIOCSCTTY: %s\n", progname, strerror(errno));
+ }
+#endif
/* put the tty in out process group
*/
@@ -439,6 +446,21 @@
/* NOTREACHED */
}
#endif
+#ifdef FREEBSD
+ n_tio.c_iflag = TTYDEF_IFLAG;
+ n_tio.c_oflag = TTYDEF_OFLAG;
+ n_tio.c_lflag = TTYDEF_LFLAG;
+ n_tio.c_cc[VEOF] = CEOF;
+ n_tio.c_cc[VEOL] = CEOL;
+ n_tio.c_cc[VERASE] = CERASE;
+ n_tio.c_cc[VINTR] = CINTR;
+ n_tio.c_cc[VSTATUS] = CSTATUS;
+ n_tio.c_cc[VKILL] = CKILL;
+ n_tio.c_cc[VQUIT] = CQUIT;
+ n_tio.c_cc[VSUSP] = CSUSP;
+ n_tio.c_cc[VSTART] = CSTART;
+ n_tio.c_cc[VSTOP] = CSTOP;
+#else
n_tio.c_iflag &= ~(IGNCR|IUCLC);
n_tio.c_iflag |= ICRNL|IXON|IXANY;
n_tio.c_oflag &= ~(OLCUC|ONOCR|ONLRET|OFILL|NLDLY|CRDLY|TABDLY|BSDLY);
@@ -455,6 +477,7 @@
n_tio.c_cc[VSTART] = '\021'; /* ^Q */
n_tio.c_cc[VSTOP] = '\023'; /* ^S */
n_tio.c_cc[VSUSP] = '\032'; /* ^Z */
+#endif
#if USE_TC
if (0 != tcsetattr(0, TCSANOW, &n_tio)) {
(void) fprintf(stderr, "%s: tcsetattr: %s\n", progname, strerror(errno));

View file

@ -0,0 +1,17 @@
--- autologin/Makefile Sun Apr 19 03:51:53 1998
+++ autologin/Makefile Sun Apr 19 03:54:02 1998
@@ -7,11 +7,11 @@
#
DESTDIR=
-BINDIR= ${DESTDIR}/usr/local/etc
+BINDIR= ${DESTDIR}/usr/local/sbin
INCLUDE=
-DEBUG= -g
-DEFS= -DPUCC -DSUN5
+DEBUG= -O
+DEFS= -DFREEBSD
CFLAGS= ${DEBUG} ${DEFS} ${INCLUDE}
GENC= main.c

View file

@ -1,7 +1,8 @@
bin/console
etc/conserver.cf.eg
etc/rc.d/conserver.sh
man/man5/conserver.cf.5.gz
man/man8/conserver.8.gz
man/man8/console.8.gz
sbin/autologin
sbin/conserver
sbin/console