From 84f84e19d5e7abde72f27b1f0aeac928a4e224fc Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Fri, 19 Apr 1996 06:30:40 +0000 Subject: [PATCH] Add Doug Engert's patches to deal with vendor logins and packet mode on systems that don't support it. Also, clean up spaces in Makefile.in, replacing with tabs. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7844 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/bsd/ChangeLog | 10 ++++++ src/appl/bsd/Makefile.in | 2 +- src/appl/bsd/krlogind.c | 72 +++++++++++++++++++++++++++++----------- 3 files changed, 64 insertions(+), 20 deletions(-) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index ab342cd47..2f3e2b6c2 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,12 @@ +Thu Apr 18 19:48:47 1996 Sam Hartman + + * Makefile.in: Fix spaces by converting to tabs. + + * krlogind.c: Take patches from Doug Engert to + allow login to work with vendor logins. Also, fix packet-mode + bug; we have some hope of working on non-Solaris streams pty code. + + Wed Apr 17 13:46:57 1996 Theodore Y. Ts'o * configure.in (LOGINLIBS): Remove DECLARE_SYS_ERRLIST since it's @@ -27,6 +36,7 @@ Wed Apr 17 13:46:57 1996 Theodore Y. Ts'o * krlogind.c (getpty): Removed dead code. + Tue Apr 16 11:33:33 1996 Sam Hartman * krlogind.c kshd.c (main): Drop support for handling options in diff --git a/src/appl/bsd/Makefile.in b/src/appl/bsd/Makefile.in index 7104beeaa..ffc511081 100644 --- a/src/appl/bsd/Makefile.in +++ b/src/appl/bsd/Makefile.in @@ -23,7 +23,7 @@ BSD= -DUCB_RLOGIN=\"$(UCB_RLOGIN)\" \ -DUCB_RSH=\"$(UCB_RSH)\" -DUCB_RCP=\"$(UCB_RCP)\" DEFINES= $(RSH) $(BSD) $(RPROGS) \ - -DLOGIN_PROGRAM=\"$(SERVER_BINDIR)/login.krb5\" -DKPROGDIR=\"$(CLIENT_BINDIR)\" + -DLOGIN_PROGRAM=\"$(SERVER_BINDIR)/login.krb5\" -DKPROGDIR=\"$(CLIENT_BINDIR)\" all:: rsh rcp rlogin kshd klogind login.krb5 diff --git a/src/appl/bsd/krlogind.c b/src/appl/bsd/krlogind.c index 2b7b0b99c..a08151621 100644 --- a/src/appl/bsd/krlogind.c +++ b/src/appl/bsd/krlogind.c @@ -399,9 +399,7 @@ pty_init(); debug_port = atoi(optarg); break; case 'L': -#ifndef DO_NOT_USE_K_LOGIN login_program = optarg; -#endif break; case '?': default: @@ -605,9 +603,14 @@ int syncpipe[2]; #if defined(POSIX_TERMIOS) && !defined(ultrix) tcgetattr(t,&new_termio); +#if !(defined(DO_NOT_USE_K_LOGIN)&&defined(USE_LOGIN_F)) new_termio.c_lflag &= ~(ICANON|ECHO|ISIG|IEXTEN); - /* so that login can read the authenticator */ - new_termio.c_iflag &= ~(IXON|IXANY|BRKINT|INLCR|ICRNL|ISTRIP); + new_termio.c_iflag &= ~(IXON|IXANY|BRKINT|INLCR|ICRNL); +#else + new_termio.c_lflag |= (ICANON|ECHO|ISIG|IEXTEN); + new_termio.c_iflag|= (IXON|IXANY|BRKINT|INLCR|ICRNL); +#endif /*Do we need binary stream?*/ +new_termio.c_iflag &= ~(ISTRIP); /* new_termio.c_iflag = 0; */ /* new_termio.c_oflag = 0; */ new_termio.c_cc[VMIN] = 1; @@ -692,7 +695,26 @@ int syncpipe[2]; #endif #ifdef DO_NOT_USE_K_LOGIN +#ifdef USE_LOGIN_F +/* use the vendors login, which has -p and -f. Tested on + * AIX 4.1.4 and HPUX 10 + */ + { + char *cp; + if ((cp = strchr(term,'/'))) + *cp = '\0'; + setenv("TERM",term, 1); + } + + if (passwd_req) + execl(login_program, "login", "-p", "-h", rhost_name, + lusername, 0); + else + execl(login_program, "login", "-p", "-h", rhost_name, + "-f", lusername, 0); +#else /* USE_LOGIN_F */ execl(login_program, "login", "-r", rhost_name, 0); +#endif /* USE_LOGIN_F */ #else if (passwd_req) execl(login_program, "login","-h", rhost_name, lusername, 0); @@ -741,11 +763,6 @@ int syncpipe[2]; /* FIONBIO doesn't always work on ptys, use fcntl to set O_NDELAY? */ (void) fcntl(p,F_SETFL,fcntl(p,F_GETFL,0) | O_NDELAY); -/*** XXX -- make this portable ***/ -#if defined(TIOCPKT) && !defined(__svr4__) || defined(solaris20) - ioctl(p, TIOCPKT, &on); -#endif - #ifdef POSIX_SIGNALS sa.sa_handler = SIG_IGN; (void) sigaction(SIGTSTP, &sa, (struct sigaction *)0); @@ -754,11 +771,12 @@ int syncpipe[2]; #endif -#ifdef DO_NOT_USE_K_LOGIN +#if defined(DO_NOT_USE_K_LOGIN)&&!defined(USE_LOGIN_F) /* Pass down rusername and lusername to login. */ (void) write(p, rusername, strlen(rusername) +1); (void) write(p, lusername, strlen(lusername) +1); #endif +#if !defined(DO_NOT_USE_K_LOGIN) || !defined(USE_LOGIN_F) /* stuff term info down to login */ if ((write(p, term, strlen(term)+1) != (int) strlen(term)+1)) { /* @@ -767,6 +785,7 @@ int syncpipe[2]; sprintf(buferror,"Cannot write slave pty %s ",line); fatalperror(f,buferror); } +#endif /* DO_NOT_USE_K_LOGIN && USE_LOGIN_F */ protocol(f, p); signal(SIGCHLD, SIG_IGN); cleanup(); @@ -826,7 +845,20 @@ void protocol(f, p) #ifdef POSIX_SIGNALS struct sigaction sa; #endif +#ifdef TIOCPKT + register tiocpkt_on = 0; + int on = 1; +#endif +#if defined(TIOCPKT) && !defined(__svr4__) || defined(solaris20) + /* if system has TIOCPKT, try to turn it on. Some drivers + * may not support it. Save flag for later. + */ + if ( ioctl(p, TIOCPKT, &on) < 0) + tiocpkt_on = 0; + else tiocpkt_on = 0; +#endif + /* * Must ignore SIGTTOU, otherwise we'll stop * when we try and set slave pty's window shape @@ -922,16 +954,18 @@ void protocol(f, p) pcc = 0; else if (pcc <= 0) break; - else if (pibuf[0] == 0) - pbp++, pcc--; -#ifndef sun - else { - if (pkcontrol(pibuf[0])) { - pibuf[0] |= oobdata[0]; - send(f, &pibuf[0], 1, MSG_OOB); +#ifdef TIOCPKT + else if (tiocpkt_on) { + if (pibuf[0] == 0) + pbp++, pcc--; + else { + if (pkcontrol(pibuf[0])) { + pibuf[0] |= oobdata[0]; + send(f, &pibuf[0], 1, MSG_OOB); + } + pcc = 0; + } } - pcc = 0; - } #endif } if (FD_ISSET(f, &obits) && pcc > 0) { -- 2.26.2