[7184] in Athena Bugs
kerberos changes for PS/2
daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Mon Feb 25 14:57:53 1991
To: bugs@ATHENA.MIT.EDU
Date: Mon, 25 Feb 91 14:57:11 EST
From: John Carr <jfc@ATHENA.MIT.EDU>
*** /source/athena/athena.lib/kerberos/util/imake.includes/config.Imakefile Mon Feb 25 05:37:46 1991
--- config.Imakefile Mon Feb 25 14:40:54 1991
***************
*** 18,23 ****
--- 18,24 ----
* ATHENA - Athena-local modifications to r-commands (rlogin, rsh, rcp)
* KERBEROS - should ALWAYS be turned on
* VFS - Virtual File System (for most Sun NFS machines)
+ * OQUOTA - if defined, use the quota system call
* SYSLOG42 - if defined, use 4.2BSD-style syslog routines
* POSIX - if defined, conform to POSIX library calls and data structures.
* ULTRIX022 - if you are running on pre-3.0 Ultrix.
***************
*** 40,47 ****
/*
* Operating specific definitions
*/
! #if defined(_AIX)
! OSFLAGS= -DBSD42 -DVFS -DNO_GETUSERSHELL -D_BSD -D_BSD_INCLUDES
#endif
#if defined(vax) || defined(ibm032)
OSFLAGS= -DBSD42 -DVFS
--- 41,48 ----
/*
* Operating specific definitions
*/
! #if defined(_AIX) && defined(_IBMR2)
! OSFLAGS= -DBSD42 -DVFS -DNO_GETUSERSHELL -D_BSD -D_BSD_INCLUDES -DPOSIX
#endif
#if defined(vax) || defined(ibm032)
OSFLAGS= -DBSD42 -DVFS
***************
*** 49,60 ****
#if defined(ultrix)
OSFLAGS= -DBSD42 -DVFS -DPOSIX -DNO_GETUSERSHELL
#endif
OSDEFS= $(OSFLAGS) $(DBMFLAG) $(SHMFLAG) $(TIMEHFLAG)
/* SRCTOP is the root of the Kerberos source tree */
! SRCTOP=/mit/kerberos/src
/* DESTDIR is the root of the tree to install into.
* If null, install into the running system.
--- 50,64 ----
#if defined(ultrix)
OSFLAGS= -DBSD42 -DVFS -DPOSIX -DNO_GETUSERSHELL
#endif
+ #if defined(i386) && defined(aix)
+ OSFLAGS= -DBSD42 -DPOSIX -D_BSD
+ #endif
OSDEFS= $(OSFLAGS) $(DBMFLAG) $(SHMFLAG) $(TIMEHFLAG)
/* SRCTOP is the root of the Kerberos source tree */
! SRCTOP=/src/kerberos
/* DESTDIR is the root of the tree to install into.
* If null, install into the running system.
***************
*** 152,164 ****
/*
* The Imake command line
! * If you need to build Imake, define LOCAL_IMAKE
*/
! #ifdef LOCAL_IMAKE
! IMAKE=$(BUILDTOP)/util/imake/imake -I$(BUILDTOP)/util/imake.includes
! #else
IMAKE=imake -I$(BUILDTOP)/util/imake.includes -TImake.template
- #endif
/*
* Set ORGANIZATION to be the desired organization string printed
--- 156,166 ----
/*
* The Imake command line
! * If you wish to use an alternate version of Imake, define OTHER_IMAKE
! * and change the IMAKE variable.
*/
! #define OTHER_IMAKE
IMAKE=imake -I$(BUILDTOP)/util/imake.includes -TImake.template
/*
* Set ORGANIZATION to be the desired organization string printed
***************
*** 181,187 ****
* Define NEED_SETENV if you don't have setenv() in your libc.
* (likely for older 4.3 systems and pre-4.3 systems)
*/
! #if defined(_AIX)
#define NEED_SETENV
#endif
--- 183,189 ----
* Define NEED_SETENV if you don't have setenv() in your libc.
* (likely for older 4.3 systems and pre-4.3 systems)
*/
! #if defined(_AIX) || defined(aix)
#define NEED_SETENV
#endif
***************
*** 189,195 ****
* Define NEED_STRCASECMP if you don't have strcasecmp() in your libc.
* (likely for older 4.3 systems and pre-4.3 systems)
*/
! /* #define NEED_STRCASECMP */
/*
* Define NEED_GETOPT if you don't have getopt() in your libc.
--- 191,199 ----
* Define NEED_STRCASECMP if you don't have strcasecmp() in your libc.
* (likely for older 4.3 systems and pre-4.3 systems)
*/
! #if defined(aix) && defined(i386)
! #define NEED_STRCASECMP
! #endif
/*
* Define NEED_GETOPT if you don't have getopt() in your libc.
***************
*** 200,206 ****
* Define TKT_SHMEM if you want to use shared memory for the session
* keys in your ticket caches.
*/
! #if defined(_AIX)
#define TKT_SHMEM
#endif
--- 204,210 ----
* Define TKT_SHMEM if you want to use shared memory for the session
* keys in your ticket caches.
*/
! #if defined(_AIX) || defined(aix)
#define TKT_SHMEM
#endif
***************
*** 340,354 ****
CPP=$(CC) -E /* A command which invokes the C preprocessor */
! #if defined(_AIX)
! #if AIXV > 30
CC=cc -qro -L/usr/athena/lib
! #else
CC=cc -L/usr/athena/lib
- #endif
CCRO=$(CC)
! OSLIBS=-lbsd
! #endif /* _AIX */
DBG=-O /* Debug or optimize? */
--- 344,358 ----
CPP=$(CC) -E /* A command which invokes the C preprocessor */
! #if defined(_AIX) && AIXV > 30
CC=cc -qro -L/usr/athena/lib
! CCRO=$(CC) /* AIX CC doesn't support this */
! OSLIBS= -lbsd
! #endif /* _AIX */
! #if defined(aix) && defined(i386)
CC=cc -L/usr/athena/lib
CCRO=$(CC)
! #endif
DBG=-O /* Debug or optimize? */
*** /source/athena/athena.lib/kerberos/util/imake.includes/Imake.rules Thu Feb 21 20:39:13 1991
--- Imake.rules Sun Feb 24 19:06:33 1991
***************
*** 22,28 ****
* Rule for building objects in libraries.
*/
! #ifdef mips
/*
* The MIPS loader doesn't have the -X flag or its functionality.
*/
--- 22,28 ----
* Rule for building objects in libraries.
*/
! #if defined(mips) || defined(aix)
/*
* The MIPS loader doesn't have the -X flag or its functionality.
*/
***************
*** 50,56 ****
#define library_ro_object(cfile) @@\
concat(cfile,.o): concat(cfile,.c) @@\
$(CC) PROF_FLAG -c $(CFLAGS) concat(cfile,.c) @@\
! -$(LD) -X -r -o profiled/$*.o $*.o @@\
$(CCRO) -c $(CFLAGS) concat(cfile,.c) @@\
-$(LD) -x -r -o a.out $*.o @@\
$(MV) a.out $*.o
--- 50,56 ----
#define library_ro_object(cfile) @@\
concat(cfile,.o): concat(cfile,.c) @@\
$(CC) PROF_FLAG -c $(CFLAGS) concat(cfile,.c) @@\
! $(MV) $*.o profiled/$*.o @@\
$(CCRO) -c $(CFLAGS) concat(cfile,.c) @@\
-$(LD) -x -r -o a.out $*.o @@\
$(MV) a.out $*.o
***************
*** 59,65 ****
ofile: sfile @@\
$(CP) sfile x.c @@\
$(CPP) -DPROF x.c | $(AS) - @@\
! -$(LD) -X -r -o profiled/$*.o a.out @@\
$(CPP) x.c | $(AS) - @@\
-$(LD) -x -r -o $*.o a.out @@\
$(RM) a.out x.c
--- 59,65 ----
ofile: sfile @@\
$(CP) sfile x.c @@\
$(CPP) -DPROF x.c | $(AS) - @@\
! $(MV) a.out profiled/$*.o @@\
$(CPP) x.c | $(AS) - @@\
-$(LD) -x -r -o $*.o a.out @@\
$(RM) a.out x.c
*** des/make_e.c.orig Tue Nov 15 16:29:23 1988
--- des/make_e.c Sun Feb 24 21:04:26 1991
***************
*** 18,24 ****
void gen(stream)
FILE *stream;
{
! register i;
/* clear the output */
fprintf(stream, " L2 = 0; R2 = 0;\n");
--- 18,24 ----
void gen(stream)
FILE *stream;
{
! register int i;
/* clear the output */
fprintf(stream, " L2 = 0; R2 = 0;\n");
*** des/make_fp.c.orig Tue Nov 15 16:29:30 1988
--- des/make_fp.c Sun Feb 24 21:04:46 1991
***************
*** 24,30 ****
void gen (stream)
FILE * stream;
{
! register i;
/* clear the output */
fprintf(stream," L2 = 0; R2 = 0;\n");
--- 24,30 ----
void gen (stream)
FILE * stream;
{
! register int i;
/* clear the output */
fprintf(stream," L2 = 0; R2 = 0;\n");
*** des/make_ip.c.orig Tue Nov 15 16:29:39 1988
--- des/make_ip.c Sun Feb 24 21:05:09 1991
***************
*** 24,30 ****
void gen(stream)
FILE *stream;
{
! register i;
/* clear the output */
fprintf(stream," L2 = 0; R2 = 0;\n");
--- 24,30 ----
void gen(stream)
FILE *stream;
{
! register int i;
/* clear the output */
fprintf(stream," L2 = 0; R2 = 0;\n");
*** des/make_key_perm.c.orig Tue Nov 15 16:29:50 1988
--- des/make_key_perm.c Sun Feb 24 21:05:29 1991
***************
*** 97,103 ****
FILE *stream;
{
/* Local Declarations */
! register i, j, iter;
/*
* initialize the key_position array s.t. key_position[i] = i;
--- 97,103 ----
FILE *stream;
{
/* Local Declarations */
! register int i, j, iter;
/*
* initialize the key_position array s.t. key_position[i] = i;
*** des/make_odd.c.orig Wed Nov 09 15:12:04 1988
--- des/make_odd.c Sun Feb 24 21:05:54 1991
***************
*** 20,26 ****
* map a byte into its equivalent with odd parity, where odd
* parity is in the least significant bit
*/
! register i, j, k, odd;
fprintf(stream,
"static unsigned char const odd_parity[256] = {\n");
--- 20,26 ----
* map a byte into its equivalent with odd parity, where odd
* parity is in the least significant bit
*/
! register int i, j, k, odd;
fprintf(stream,
"static unsigned char const odd_parity[256] = {\n");
*** des/make_p.c.orig Tue Nov 15 16:29:58 1988
--- des/make_p.c Sun Feb 24 21:06:22 1991
***************
*** 16,22 ****
#include "tables.h"
void gen(stream)
! FILE *stream;
{
/* P permutes 32 bit input R1 into 32 bit output R2 */
--- 16,22 ----
#include "tables.h"
void gen(stream)
! register FILE *stream;
{
/* P permutes 32 bit input R1 into 32 bit output R2 */
*** des/make_p_table.c.orig Tue Nov 15 16:30:08 1988
--- des/make_p_table.c Sun Feb 24 21:11:41 1991
***************
*** 22,31 ****
void gen(stream)
FILE *stream;
{
! register i,j,k,m;
/* P permutes 32 bit input R1 into 32 bit output R2 */
- #ifdef BIG
/* flip p into p_temp */
for (i = 0; i<32; i++)
P_temp[P[rev_swap_bit_pos_0(i)]] = rev_swap_bit_pos_0(i);
--- 22,31 ----
void gen(stream)
FILE *stream;
{
! #ifdef BIG
! register int i,j,k,m;
/* P permutes 32 bit input R1 into 32 bit output R2 */
/* flip p into p_temp */
for (i = 0; i<32; i++)
P_temp[P[rev_swap_bit_pos_0(i)]] = rev_swap_bit_pos_0(i);
*** des/misc.c.orig Wed Feb 20 16:15:08 1991
--- des/misc.c Sun Feb 24 21:09:16 1991
***************
*** 24,85 ****
* MSBFIRST order.
*/
- #if 0 /* These don't seem to get used anywhere.... */
- void swap_bits(array)
- char *array;
- {
- #ifdef MSBFIRST
- /* just return */
- return;
- #else /* LSBFIRST */
- register old,new,i,j;
- /* for an eight byte block-- */
- /* flips the bit order within each byte from 0 lsb to 0 msb */
- for (i = 0; i<=7; i++) {
- old = *array;
- new = 0;
- for (j = 0; j<=7; j++) {
- new |= old & 01; /* copy a bit */
- if (j < 7) {
- /* rotate in opposite directions */
- old = old >> 1;
- new = new << 1;
- }
- }
- *array++ = new;
- }
- #endif /* MSBFIRST */
- }
-
- unsigned long long_swap_bits(x)
- unsigned long x;
- {
- #ifdef MSBFIRST
- return x;
- #else
- char *array = (char *) &x;
- register old,new,i,j;
-
- /* flips the bit order within each byte from 0 lsb to 0 msb */
- for (i = 0; i <= (sizeof(long)-1); i++) {
- old = *array;
- new = 0;
- for (j = 0; j<=7; j++) {
- if (old & 01)
- new = new | 01;
- if (j < 7) {
- old = old >> 1;
- new = new << 1;
- }
- }
- *array++ = new;
- }
- return x;
- #endif /* LSBFIRST */
- }
- #endif /* 0 */
-
unsigned long swap_six_bits_to_ansi(old)
unsigned long old;
{
--- 24,30 ----
***************
*** 125,139 ****
* given the number of a bit position, >=1, flips the bit order
* each byte. e.g. bit 3 --> bit 6, bit 13 --> bit 12
*/
! register y,z;
/* always do it, only used by des_make_key_perm.c so far */
y = (x-1)/8;
z = (x-1)%8;
! x = (8-z) + (y*8);
!
! return x;
}
unsigned long swap_bit_pos_0(x)
--- 70,82 ----
* given the number of a bit position, >=1, flips the bit order
* each byte. e.g. bit 3 --> bit 6, bit 13 --> bit 12
*/
! register int y,z;
/* always do it, only used by des_make_key_perm.c so far */
y = (x-1)/8;
z = (x-1)%8;
! return (8-z) + (y*8);
}
unsigned long swap_bit_pos_0(x)
***************
*** 149,155 ****
#ifdef MSBFIRST
return x;
#else /* LSBFIRST */
! register y,z;
/*
* given the number of a bit position, >=0, flips the bit order
--- 92,98 ----
#ifdef MSBFIRST
return x;
#else /* LSBFIRST */
! register int y,z;
/*
* given the number of a bit position, >=0, flips the bit order
***************
*** 158,166 ****
y = x/8;
z = x%8;
! x = (7-z) + (y*8);
!
! return x;
#endif /* LSBFIRST */
}
--- 101,107 ----
y = x/8;
z = x%8;
! return (7-z) + (y*8);
#endif /* LSBFIRST */
}
***************
*** 174,180 ****
* bit 0 ==> msb, bit 7 lsb.
*/
! register y,z;
/*
* given the number of a bit position, >=0, flips the bit order each
* byte. e.g. bit 3 --> bit 6, bit 13 --> bit 12
--- 115,121 ----
* bit 0 ==> msb, bit 7 lsb.
*/
! register int y,z;
/*
* given the number of a bit position, >=0, flips the bit order each
* byte. e.g. bit 3 --> bit 6, bit 13 --> bit 12
***************
*** 182,190 ****
y = x/8;
z = x%8;
! x = (7-z) + (y*8);
!
! return x;
}
unsigned long rev_swap_bit_pos_0(x)
--- 123,129 ----
y = x/8;
z = x%8;
! return (7-z) + (y*8);
}
unsigned long rev_swap_bit_pos_0(x)
***************
*** 203,209 ****
return x;
#else /* MSBFIRST */
! register y,z;
/*
* given the number of a bit position, >=0, flips the bit order each
--- 142,148 ----
return x;
#else /* MSBFIRST */
! register int y,z;
/*
* given the number of a bit position, >=0, flips the bit order each
***************
*** 212,220 ****
y = x/8;
z = x%8;
! x = (7-z) + (y*8);
!
! return x;
#endif /* MSBFIRST */
}
--- 151,157 ----
y = x/8;
z = x%8;
! return (7-z) + (y*8);
#endif /* MSBFIRST */
}
***************
*** 252,264 ****
#ifdef LSBFIRST
return x;
#else /* MSBFIRST */
! unsigned long y,z;
y = x/8; /* initial byte component */
z = x%8; /* bit within byte */
! x = (3-y)*8 +z;
! return x;
#endif /* MSBFIRST */
}
--- 189,200 ----
#ifdef LSBFIRST
return x;
#else /* MSBFIRST */
! register unsigned long y,z;
y = x/8; /* initial byte component */
z = x%8; /* bit within byte */
! return (3-y)*8 +z;
#endif /* MSBFIRST */
}
***************
*** 295,301 ****
{
char *filename;
char *arg;
! FILE * stream;
whoami = argv[0];
filename = (char *)NULL;
--- 231,237 ----
{
char *filename;
char *arg;
! register FILE * stream;
whoami = argv[0];
filename = (char *)NULL;
*** kadm/kadm_cli_wrap.c.orig Tue Apr 24 20:40:39 1990
--- kadm/kadm_cli_wrap.c Sun Feb 24 20:51:46 1991
***************
*** 42,49 ****
static des_cblock sess_key; /* to be filled in by kadm_cli_keyd */
static Key_schedule sess_sched;
- extern int init_kadm_err_tbl(), init_krb_err_tbl();
-
static
clear_secrets()
{
--- 42,47 ----
*** kdb/krb_dbm.c.orig Tue Apr 18 20:16:44 1989
--- kdb/krb_dbm.c Mon Feb 25 13:13:54 1991
***************
*** 34,39 ****
--- 34,43 ----
#include <krb.h>
#include <krb_db.h>
+ #ifdef POSIX
+ #include <sys/fcntl.h>
+ #endif
+
#define KERB_DB_MAX_RETRY 5
#ifdef DEBUG
***************
*** 684,690 ****
--- 688,699 ----
static int kerb_dbl_lock(mode)
int mode;
{
+ #ifdef POSIX
+ struct flock f;
+ int rv;
+ #else
int flock_mode;
+ #endif
if (!inited)
kerb_dbl_init();
***************
*** 694,699 ****
--- 703,721 ----
fflush(stderr);
exit(1);
}
+ #ifdef POSIX
+ bzero(&f, sizeof (f));
+ if (mode == KERB_DBL_EXCLUSIVE)
+ f.l_type = F_WRLCK;
+ else
+ f.l_type = F_RDLCK;
+ if (non_blocking)
+ rv = fcntl (dblfd, F_SETLK, &f);
+ else
+ rv = fcntl (dblfd, F_SETLKW, &f);
+ if (rv == -1)
+ return errno;
+ #else
switch (mode) {
case KERB_DBL_EXCLUSIVE:
flock_mode = LOCK_EX;
***************
*** 710,715 ****
--- 732,738 ----
if (flock(dblfd, flock_mode) < 0)
return errno;
+ #endif
mylock++;
return 0;
}
***************
*** 716,732 ****
static void kerb_dbl_unlock()
{
if (!mylock) { /* lock already unlocked */
fprintf(stderr, "Kerberos database lock not locked when unlocking.\n");
fflush(stderr);
exit(1);
}
! if (flock(dblfd, LOCK_UN) < 0) {
fprintf(stderr, "Kerberos database lock error. (unlocking)\n");
! fflush(stderr);
perror("flock");
exit(1);
}
mylock = 0;
}
--- 739,766 ----
static void kerb_dbl_unlock()
{
+ #ifdef POSIX
+ struct flock f;
+ #endif
if (!mylock) { /* lock already unlocked */
fprintf(stderr, "Kerberos database lock not locked when unlocking.\n");
fflush(stderr);
exit(1);
}
! #ifdef POSIX
! bzero(&f, sizeof (f));
! if (fcntl(dblfd, F_SETLK, &f) < 0) {
! perror ("fcntl");
fprintf(stderr, "Kerberos database lock error. (unlocking)\n");
! exit(1);
! }
! #else
! if (flock(dblfd, LOCK_UN) < 0) {
perror("flock");
+ fprintf(stderr, "Kerberos database lock error. (unlocking)\n");
exit(1);
}
+ #endif
mylock = 0;
}
*** krb/tf_util.c.orig Tue Apr 24 20:41:34 1990
--- krb/tf_util.c Mon Feb 25 13:23:44 1991
***************
*** 32,38 ****
#define TF_LCK_RETRY ((unsigned)2) /* seconds to sleep before
* retry if ticket file is
* locked */
! extern errno;
extern int krb_debug;
#ifdef TKT_SHMEM
--- 32,38 ----
#define TF_LCK_RETRY ((unsigned)2) /* seconds to sleep before
* retry if ticket file is
* locked */
! extern int errno;
extern int krb_debug;
#ifdef TKT_SHMEM
***************
*** 43,48 ****
--- 43,73 ----
char *shmat();
#endif /* TKT_SHMEM */
+ #ifdef POSIX
+
+ #include <fcntl.h>
+
+ /* This function emulates a subset of flock */
+ static int emul_flock(fd, cmd)
+ int fd, cmd;
+ {
+ struct flock f;
+
+ bzero(&f, sizeof (f));
+
+ if (cmd == LOCK_UN)
+ f.l_type = F_UNLCK;
+ else if (cmd & LOCK_SH)
+ f.l_type = F_RDLCK;
+ else
+ f.l_type = F_WRLCK;
+ /* other fields of f are 0 */
+ return fcntl (fd, F_SETLK, &f);
+ }
+
+ #define flock(f,c) emul_flock(f,c)
+ #endif
+
/*
* fd must be initialized to something that won't ever occur as a real
* file descriptor. Since open(2) returns only non-negative numbers as
***************
*** 56,64 ****
* c. In tf_close, be sure it gets reinitialized to a negative
* number.
*/
! static fd = -1;
! static curpos; /* Position in tfbfr */
! static lastpos; /* End of tfbfr */
static char tfbfr[BUFSIZ]; /* Buffer for ticket data */
static tf_gets(), tf_read();
--- 81,89 ----
* c. In tf_close, be sure it gets reinitialized to a negative
* number.
*/
! static int fd = -1;
! static int curpos; /* Position in tfbfr */
! static int lastpos; /* End of tfbfr */
static char tfbfr[BUFSIZ]; /* Buffer for ticket data */
static tf_gets(), tf_read();
***************
*** 415,421 ****
tf_gets(s, n)
register char *s;
{
! register count;
if (fd < 0) {
if (krb_debug)
--- 440,446 ----
tf_gets(s, n)
register char *s;
{
! register int count;
if (fd < 0) {
if (krb_debug)
***************
*** 457,463 ****
register char *s;
register n;
{
! register count;
for (count = n; count > 0; --count) {
if (curpos >= sizeof(tfbfr)) {
--- 482,488 ----
register char *s;
register n;
{
! register int count;
for (count = n; count > 0; --count) {
if (curpos >= sizeof(tfbfr)) {
*** bsd/rlogin.c.orig Tue Feb 19 20:58:29 1991
--- bsd/rlogin.c Mon Feb 25 13:57:15 1991
***************
*** 59,66 ****
--- 59,70 ----
#ifdef KERBEROS
#include <krb.h>
#endif KERBEROS
+ #include <string.h>
#ifdef _AIX
+ #ifdef i386
+ #include <termios.h>
+ #endif
#include <termio.h>
/* AIX messed up with <fcntl.h> */
***************
*** 78,84 ****
# define SIGUSR1 30
# endif SIGUSR1
! char *index(), *rindex(), *malloc(), *getenv(), *strcat(), *strcpy();
struct passwd *getpwuid();
char *name;
int rem;
--- 82,89 ----
# define SIGUSR1 30
# endif SIGUSR1
! extern char *rindex();
! char *malloc(), *getenv();
struct passwd *getpwuid();
char *name;
int rem;
***************
*** 151,157 ****
int
get_window_size(fd, wp)
int fd;
! struct winsize *wp;
{
struct ttysize ts;
int error;
--- 156,162 ----
int
get_window_size(fd, wp)
int fd;
! register struct winsize *wp;
{
struct ttysize ts;
int error;
***************
*** 167,180 ****
#endif /* TIOCGWINSZ */
main(argc, argv)
! int argc;
! char **argv;
{
#ifdef ATHENA
char *cp = (char *) NULL;
#else
char *host, *cp;
! #endif ATHENA
struct sgttyb ttyb;
struct passwd *pwd;
struct servent *sp;
--- 172,185 ----
#endif /* TIOCGWINSZ */
main(argc, argv)
! register int argc;
! register char **argv;
{
#ifdef ATHENA
char *cp = (char *) NULL;
#else
char *host, *cp;
! #endif
struct sgttyb ttyb;
struct passwd *pwd;
struct servent *sp;
***************
*** 186,192 ****
char **orig_argv = argv;
int sock;
long authopts;
! #endif KERBEROS
host = rindex(argv[0], '/');
if (host)
--- 191,197 ----
char **orig_argv = argv;
int sock;
long authopts;
! #endif
host = rindex(argv[0], '/');
if (host)
***************
*** 196,207 ****
argv++, --argc;
#ifdef KERBEROS
krb_realm[0] = '\0';
! #endif KERBEROS
if (!strcmp(host, "rlogin"))
host = *argv++, --argc;
#ifdef KERBEROS
strcpy(phost,krb_get_phost(host));
! #endif KERBEROS
another:
if (argc > 0 && !strcmp(*argv, "-d")) {
argv++, argc--;
--- 201,212 ----
argv++, --argc;
#ifdef KERBEROS
krb_realm[0] = '\0';
! #endif
if (!strcmp(host, "rlogin"))
host = *argv++, --argc;
#ifdef KERBEROS
strcpy(phost,krb_get_phost(host));
! #endif
another:
if (argc > 0 && !strcmp(*argv, "-d")) {
argv++, argc--;
***************
*** 241,247 ****
argv++, argc--;
goto another;
}
! #endif ATHENA
if (argc > 0 && !strcmp(*argv, "-l")) {
argv++, argc--;
if (argc == 0)
--- 246,252 ----
argv++, argc--;
goto another;
}
! #endif /* ATHENA */
if (argc > 0 && !strcmp(*argv, "-l")) {
argv++, argc--;
if (argc == 0)
***************
*** 282,288 ****
goto another;
}
#endif
! #endif KERBEROS
if (host == 0)
goto usage;
if (argc > 0)
--- 287,293 ----
goto another;
}
#endif
! #endif /* KERBEROS */
if (host == 0)
goto usage;
if (argc > 0)
***************
*** 320,331 ****
fprintf(stderr, "rlogin: login/tcp: unknown service\n");
exit(2);
}
! #endif KERBEROS
#ifdef ATHENA
if (cp == (char *) NULL) cp = getenv("TERM");
#else
cp = getenv("TERM");
! #endif ATHENA
if (cp)
(void) strcpy(term, cp);
if (ioctl(0, TIOCGETP, &ttyb) == 0) {
--- 325,336 ----
fprintf(stderr, "rlogin: login/tcp: unknown service\n");
exit(2);
}
! #endif /* KERBEROS */
#ifdef ATHENA
if (cp == (char *) NULL) cp = getenv("TERM");
#else
cp = getenv("TERM");
! #endif /* ATHENA */
if (cp)
(void) strcpy(term, cp);
if (ioctl(0, TIOCGETP, &ttyb) == 0) {
***************
*** 349,355 ****
authopts = KOPT_DO_OLDSTYLE;
#else
authopts = 0L;
! #endif ATHENA_COMPAT
}
rem = kcmd(&sock, &host, sp->s_port,
#ifdef ATHENA
--- 354,360 ----
authopts = KOPT_DO_OLDSTYLE;
#else
authopts = 0L;
! #endif
}
rem = kcmd(&sock, &host, sp->s_port,
#ifdef ATHENA
***************
*** 356,362 ****
null_local_username ? NULL : pwd->pw_name,
#else
pwd->pw_name,
! #endif ATHENA
name ? name : pwd->pw_name, term,
0, &ticket, "rcmd", krb_realm,
&cred, schedule, &msg_data, &local, &foreign,
--- 361,367 ----
null_local_username ? NULL : pwd->pw_name,
#else
pwd->pw_name,
! #endif
name ? name : pwd->pw_name, term,
0, &ticket, "rcmd", krb_realm,
&cred, schedule, &msg_data, &local, &foreign,
***************
*** 383,393 ****
null_local_username ? NULL : pwd->pw_name,
#else
pwd->pw_name,
! #endif ATHENA
name ? name : pwd->pw_name, term, 0);
if (rem < 0)
exit(1);
! #endif KERBEROS
/* we need to do the SETOWN here so that we get the SIGURG
registered if the URG data come in early, before the reader() gets
to do this for real (otherwise, the signal is never generated
--- 388,398 ----
null_local_username ? NULL : pwd->pw_name,
#else
pwd->pw_name,
! #endif
name ? name : pwd->pw_name, term, 0);
if (rem < 0)
exit(1);
! #endif /* KERBEROS */
/* we need to do the SETOWN here so that we get the SIGURG
registered if the URG data come in early, before the reader() gets
to do this for real (otherwise, the signal is never generated
***************
*** 409,415 ****
}
#ifdef ATHENA
flowcontrol = flow; /* Set up really correct non-volatile variable */
! #endif ATHENA
doit(oldmask);
/*NOTREACHED*/
usage:
--- 414,420 ----
}
#ifdef ATHENA
flowcontrol = flow; /* Set up really correct non-volatile variable */
! #endif
doit(oldmask);
/*NOTREACHED*/
usage:
***************
*** 419,428 ****
"usage: rlogin host [-option] [-option...] [-k realm ] [-t ttytype] [-l username]\n");
#ifdef NOENCRYPTION
fprintf (stderr, " where option is e, 7, 8, noflow, n, a, or c\n");
! #else /* !NOENCRYPTION */
fprintf (stderr, " where option is e, 7, 8, noflow, n, a, x, or c\n");
! #endif /* NOENCRYPTION */
! #else !ATHENA
#ifdef NOENCRYPTION
fprintf (stderr,
"usage: rlogin host [ -ex ] [-k realm ] [-l username] [ -8 ] [ -L ]\n");
--- 424,433 ----
"usage: rlogin host [-option] [-option...] [-k realm ] [-t ttytype] [-l username]\n");
#ifdef NOENCRYPTION
fprintf (stderr, " where option is e, 7, 8, noflow, n, a, or c\n");
! #else
fprintf (stderr, " where option is e, 7, 8, noflow, n, a, x, or c\n");
! #endif
! #else /* ATHENA */
#ifdef NOENCRYPTION
fprintf (stderr,
"usage: rlogin host [ -ex ] [-k realm ] [-l username] [ -8 ] [ -L ]\n");
***************
*** 430,446 ****
fprintf (stderr,
"usage: rlogin host [ -ex ] [ -x ] [-k realm ] [-l username] [ -8 ] [ -L ]\n");
#endif /* NOENCRYPTION */
! #endif ATHENA
! #else !KERBEROS
#ifdef ATHENA
fprintf (stderr,
"usage: rlogin host [-option] [-option...] [-t ttytype] [-l username]\n");
fprintf (stderr, " where option is e, 7, 8, noflow, n, a, or c\n");
! #else !ATHENA
fprintf(stderr,
"usage: rlogin host [ -ex ] [ -l username ] [ -8 ] [ -L ]\n");
! #endif ATHENA
! #endif KERBEROS
exit(1);
}
--- 435,451 ----
fprintf (stderr,
"usage: rlogin host [ -ex ] [ -x ] [-k realm ] [-l username] [ -8 ] [ -L ]\n");
#endif /* NOENCRYPTION */
! #endif /* ATHENA */
! #else /* KERBEROS */
#ifdef ATHENA
fprintf (stderr,
"usage: rlogin host [-option] [-option...] [-t ttytype] [-l username]\n");
fprintf (stderr, " where option is e, 7, 8, noflow, n, a, or c\n");
! #else
fprintf(stderr,
"usage: rlogin host [ -ex ] [ -l username ] [ -8 ] [ -L ]\n");
! #endif
! #endif /* KERBEROS */
exit(1);
}
***************
*** 470,476 ****
return (answer == 'y' || answer == 'Y' || answer == EOF ||
answer == 4); /* control-D */
}
! #endif ATHENA
#define CRLF "\r\n"
--- 475,481 ----
return (answer == 'y' || answer == 'Y' || answer == EOF ||
answer == 4); /* control-D */
}
! #endif
#define CRLF "\r\n"
***************
*** 614,622 ****
writer()
{
char c;
! register n;
! register bol = 1; /* beginning of line */
! register local = 0;
#ifdef ultrix
fd_set waitread;
--- 619,627 ----
writer()
{
char c;
! register int n;
! register int bol = 1; /* beginning of line */
! register int local = 0;
#ifdef ultrix
fd_set waitread;
***************
*** 667,678 ****
if (c == '.' || c == deftc.t_eofc) {
#ifdef ATHENA
if (confirm_death()) {
! #endif ATHENA
echo(c);
break;
#ifdef ATHENA
}
! #endif ATHENA
}
if ((c == defltc.t_suspc || c == defltc.t_dsuspc)
#ifdef ATHENA
--- 672,683 ----
if (c == '.' || c == deftc.t_eofc) {
#ifdef ATHENA
if (confirm_death()) {
! #endif
echo(c);
break;
#ifdef ATHENA
}
! #endif
}
if ((c == defltc.t_suspc || c == defltc.t_dsuspc)
#ifdef ATHENA
***************
*** 679,685 ****
&& !no_local_escape) {
#else
) {
! #endif ATHENA
bol = 1;
echo(c);
stop(c);
--- 684,690 ----
&& !no_local_escape) {
#else
) {
! #endif
bol = 1;
echo(c);
stop(c);
***************
*** 747,753 ****
sendwindow()
{
char obuf[4 + sizeof (struct winsize)];
! struct winsize *wp = (struct winsize *)(obuf+4);
obuf[0] = 0377;
obuf[1] = 0377;
--- 752,758 ----
sendwindow()
{
char obuf[4 + sizeof (struct winsize)];
! register struct winsize *wp = (struct winsize *)(obuf+4);
obuf[0] = 0377;
obuf[1] = 0377;
***************
*** 878,884 ****
int pid = -getpid();
#endif
int n, remaining;
! char *bufp = rcvbuf;
(void) signal(SIGTTOU, SIG_IGN);
(void) signal(SIGURG, oob);
--- 883,889 ----
int pid = -getpid();
#endif
int n, remaining;
! register char *bufp = rcvbuf;
(void) signal(SIGTTOU, SIG_IGN);
(void) signal(SIGURG, oob);
***************
*** 913,918 ****
--- 918,924 ----
}
mode(f)
+ int f;
{
struct tchars *tc;
struct ltchars *ltc;
***************
*** 938,945 ****
case 1:
#ifdef ATHENA
! sb.sg_flags &= ~(CBREAK|RAW);
! sb.sg_flags |= (!flow ? RAW : CBREAK);
#else
sb.sg_flags |= (eight ? RAW : CBREAK);
#endif ATHENA
--- 944,951 ----
case 1:
#ifdef ATHENA
! sb.sg_flags &= ~(CBREAK|RAW);
! sb.sg_flags |= (!flow ? RAW : CBREAK);
#else
sb.sg_flags |= (eight ? RAW : CBREAK);
#endif ATHENA
*** bsd/rlogind.c.orig Tue Feb 19 19:57:32 1991
--- bsd/rlogind.c Mon Feb 25 19:01:23 1991
***************
*** 183,189 ****
int f;
struct sockaddr_in *fromp;
{
! int i, p, t, pid, on = 1;
register struct hostent *hp;
struct hostent hostent;
char c;
--- 183,190 ----
int f;
struct sockaddr_in *fromp;
{
! register int p;
! int i, t, pid, on = 1;
register struct hostent *hp;
struct hostent hostent;
char c;
***************
*** 222,227 ****
--- 223,229 ----
fromp->sin_port < IPPORT_RESERVED/2)
#endif KERBEROS
fatal(f, "Permission denied");
+
#if defined(KERBEROS) && !defined(NOENCRYPTION)
/*
* If encrypting, we need to respond here, since we have to send
***************
*** 230,235 ****
--- 232,240 ----
if (eklogin)
do_krb_login(hp->h_name);
#endif KERBEROS
+ #ifdef POSIX
+ setsid();
+ #endif
write(f, "", 1);
for (c = 'p'; c <= 's'; c++) {
struct stat stb;
***************
*** 250,288 ****
gotpty:
(void) ioctl(p, TIOCSWINSZ, &win);
netf = f;
! line[strlen("/dev/")] = 't';
t = open(line, O_RDWR);
! if (t < 0)
fatalperror(f, line);
! if (fchmod(t, 0))
! fatalperror(f, line);
! (void)signal(SIGHUP, SIG_IGN);
vhangup();
! (void)signal(SIGHUP, SIG_DFL);
! t = open(line, O_RDWR);
! if (t < 0)
! fatalperror(f, line);
! {
struct sgttyb b;
! (void)ioctl(t, TIOCGETP, &b);
! b.sg_flags = RAW|ANYP;
! (void)ioctl(t, TIOCSETP, &b);
}
#ifdef DEBUG
{
! int tt = open("/dev/tty", O_RDWR);
! if (tt > 0) {
! (void) ioctl(tt, TIOCNOTTY, 0);
! (void) close(tt);
! }
}
#endif
t = open(line, 2);
if (t < 0)
fatalperror(f, line, errno);
! { struct sgttyb b;
! gtty(t, &b); b.sg_flags = RAW|ANYP; stty(t, &b);
}
pid = fork();
if (pid < 0)
--- 255,302 ----
gotpty:
(void) ioctl(p, TIOCSWINSZ, &win);
netf = f;
! /* "/dev/" is 5 chars */
! line[5] = 't';
t = open(line, O_RDWR);
! if (t < 0)
fatalperror(f, line);
! if (fchmod(t, 0))
! fatalperror(f, line);
! (void)signal(SIGHUP, SIG_IGN);
! #if defined(_AIX) && defined(i386)
! _vhangup();
! #else
vhangup();
! #endif
! (void)signal(SIGHUP, SIG_DFL);
! t = open(line, O_RDWR);
! if (t < 0)
! fatalperror(f, line);
! {
struct sgttyb b;
! (void)ioctl(t, TIOCGETP, &b);
! b.sg_flags = RAW|ANYP;
! (void)ioctl(t, TIOCSETP, &b);
}
#ifdef DEBUG
{
! int tt = open("/dev/tty", O_RDWR);
! if (tt > 0)
! {
! (void) ioctl(tt, TIOCNOTTY, 0);
! (void) close(tt);
! }
}
#endif
t = open(line, 2);
if (t < 0)
fatalperror(f, line, errno);
! {
! struct sgttyb b;
! gtty(t, &b);
! b.sg_flags = RAW|ANYP;
! stty(t, &b);
}
pid = fork();
if (pid < 0)
***************
*** 299,305 ****
It seems to work fine on 4.3BSD with this code enabled.
*/
pid = getpgrp(getpid());
! ioctl(0, TIOCSPGRP, &pid);
#ifdef KERBEROS
if (klogin) {
execl(LOGIN_PROGRAM, "login", "-k", hp->h_name, 0);
--- 313,320 ----
It seems to work fine on 4.3BSD with this code enabled.
*/
pid = getpgrp(getpid());
! if (ioctl(0, TIOCSPGRP, &pid) < 0)
! perror("ioctl(TIOCSPGRP)");
#ifdef KERBEROS
if (klogin) {
execl(LOGIN_PROGRAM, "login", "-k", hp->h_name, 0);
***************
*** 341,347 ****
--- 356,366 ----
ioctl(p, TIOCPKT, &on);
signal(SIGTSTP, SIG_IGN);
signal(SIGCHLD, cleanup);
+ #ifdef POSIX
+ setpgrp();
+ #else
setpgrp(0, 0);
+ #endif
#ifdef KERBEROS
if (eklogin)
(void) write(p, term, strlen(term)+1); /* stuff term info down
*** erlogin/login.c.orig Thu Jan 05 20:46:14 1989
--- erlogin/login.c Mon Feb 25 18:44:21 1991
***************
*** 23,31 ****
*/
#include <sys/param.h>
! #ifndef VFS
#include <sys/quota.h>
! #endif !VFS
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
--- 23,31 ----
*/
#include <sys/param.h>
! #ifdef OQUOTA
#include <sys/quota.h>
! #endif
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
***************
*** 58,68 ****
--- 58,72 ----
char qlog[] = ".hushlogin";
char maildir[30] = "/usr/spool/mail/";
char lastlog[] = "/usr/adm/lastlog";
+ #ifdef _AIX
+ struct passwd nouser = {"", "nope", -1, -1, "", 0, "", "", "", ""};
+ #else
#ifdef POSIX
struct passwd nouser = {"", "nope", -1, 0, -1, 0, -1, "", "", "", "" };
#else
struct passwd nouser = {"", "nope", -1, -1, -1, "", "", "", "" };
#endif /*POSIX*/
+ #endif
struct sgttyb ttyb;
struct utmp utmp;
char minusnam[16] = "-";
***************
*** 130,138 ****
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, SIG_IGN);
setpriority(PRIO_PROCESS, 0, 0);
! #ifndef VFS
quota(Q_SETUID, 0, 0, 0);
! #endif !VFS
/*
* -p is used by getty to tell login not to destroy the environment
* -r is used by rlogind to cause the autologin protocol;
--- 134,142 ----
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, SIG_IGN);
setpriority(PRIO_PROCESS, 0, 0);
! #ifdef OQUOTA
quota(Q_SETUID, 0, 0, 0);
! #endif
/*
* -p is used by getty to tell login not to destroy the environment
* -r is used by rlogind to cause the autologin protocol;
***************
*** 337,343 ****
/* committed to login turn off timeout */
alarm(0);
! #ifndef VFS
if (quota(Q_SETUID, pwd->pw_uid, 0, 0) < 0 && errno != EINVAL) {
if (errno == EUSERS)
printf("%s.\n%s.\n",
--- 341,347 ----
/* committed to login turn off timeout */
alarm(0);
! #ifdef OQUOTA
if (quota(Q_SETUID, pwd->pw_uid, 0, 0) < 0 && errno != EINVAL) {
if (errno == EUSERS)
printf("%s.\n%s.\n",
***************
*** 350,356 ****
sleep(5);
exit(0);
}
! #endif !VFS
time(&utmp.ut_time);
t = ttyslot();
--- 354,360 ----
sleep(5);
exit(0);
}
! #endif
time(&utmp.ut_time);
t = ttyslot();
***************
*** 395,403 ****
strncpy(name, utmp.ut_name, NMAX);
name[NMAX] = '\0';
initgroups(name, pwd->pw_gid);
! #ifndef VFS
quota(Q_DOWARN, pwd->pw_uid, (dev_t)-1, 0);
! #endif !VFS
setuid(pwd->pw_uid);
/* destroy environment unless user has asked to preserve it */
--- 399,407 ----
strncpy(name, utmp.ut_name, NMAX);
name[NMAX] = '\0';
initgroups(name, pwd->pw_gid);
! #ifdef OQUOTA
quota(Q_DOWARN, pwd->pw_uid, (dev_t)-1, 0);
! #endif
setuid(pwd->pw_uid);
/* destroy environment unless user has asked to preserve it */
*** erlogin/rlogind.c.orig Thu Jan 05 20:43:38 1989
--- erlogin/rlogind.c Mon Feb 25 18:38:20 1991
***************
*** 300,306 ****
{
DBG_FCLOSE (dbg);
rmut();
! vhangup(); /* XXX */
shutdown(netf, 2);
exit(1);
}
--- 300,310 ----
{
DBG_FCLOSE (dbg);
rmut();
! #if defined(_AIX) && defined(i386)
! _vhangup(); /* XXX */
! #else
! vhangup();
! #endif
shutdown(netf, 2);
exit(1);
}
***************
*** 315,323 ****
rmut()
{
! register f;
int found = 0;
! struct utmp *u, *utmp;
int nutmp;
struct stat statbf;
--- 319,328 ----
rmut()
{
! register int f;
int found = 0;
! register struct utmp *u;
! struct utmp *utmp;
int nutmp;
struct stat statbf;
***************
*** 358,364 ****
}
chmod(line, 0666);
chown(line, 0, 0);
! line[strlen("/dev/")] = 'p';
chmod(line, 0666);
chown(line, 0, 0);
}
--- 363,369 ----
}
chmod(line, 0666);
chown(line, 0, 0);
! line[5] = 'p';
chmod(line, 0666);
chown(line, 0, 0);
}