[941] in Kerberos-V5-bugs
Patches to appl/bsd... (inc. small patch to aclocal.m4)
daemon@ATHENA.MIT.EDU (Richard Basch)
Fri Nov 4 13:49:06 1994
Date: Fri, 4 Nov 1994 13:48:44 -0500
To: krb5-bugs@MIT.EDU
From: "Richard Basch" <basch@MIT.EDU>
* aclocal.m4:
Added POSIX setjmp handling and POSIX signal handling
(CHECK_SETJMP, CHECK_SIGNALS)
* appl/bsd/configure.in:
Moved POSIX signal check to aclocal.m4, and calls it (CHECK_SIGNALS)
Added POSIX setjmp check (CHECK_SETJMP).
Added checks for waitpid and setsid functions.
* appl/bsd/kcmd.c:
Include <signal.h> not <sys/signal.h>.
Don't bother declaring sigmask when POSIX_SIGNALS is set.
* appl/bsd/krcp.c:
Replaced the conditionalized BITS64 code with more portable code.
Use mode_t instead of int, for file modes.
Use waitpid, instead of wait, where available (HAVE_WAITPID).
Added POSIX signal handling (POSIX_SIGNALS).
* appl/bsd/krlogin.c:
Include <unistd.h> and <stdlib.h> if available
Replaced the conditionalized BITS64 code with more portable code.
Use cfgetospeed() if POSIX_TERMIOS is defined. It was already being
used, so there is no need to use two methods.
Use waitpid, instead of wait, where available (HAVE_WAITPID).
Added POSIX setjmp handling (POSIX_SETJMP)
Added POSIX signal handling (POSIX_SIGNALS).
* appl/bsd/krlogind.c:
Added POSIX signal handling (POSIX_SIGNALS).
Corrected an error in the arguments to chmod().
Call setsid() if HAVE_SETSID is defined.
Try not conditionalizing on __alpha; use other #ifdef's.
Replaced the conditionalized BITS64 code with more portable code.
* appl/bsd/krsh.c:
Added POSIX signal handling (POSIX_SIGNALS)
* appl/bsd/krshd.c:
Declare and manipulate the file descriptor arrays properly,
rather than bit shifting and passing them to select as
(long *). Some systems (eg. AIX) declare them to be structs.
Added POSIX signal handling (POSIX_SIGNALS)
* appl/bsd/login.c:
Include <unistd.h> and <stdlib.h> if available
Added POSIX setjmp handling (POSIX_SETJMP)
Added POSIX signal handling (POSIX_SIGNALS)
Use waitpid, instead of wait, where available (HAVE_WAITPID).
* appl/bsd/logutil.c:
Don't redeclare time(); it may conflict with the system header files.
Include <unistd.h> first.
===================================================================
RCS file: /mit/krb5/.cvsroot/src/aclocal.m4,v
retrieving revision 1.34
diff -c -r1.34 aclocal.m4
*** aclocal.m4 1994/11/03 02:03:10 1.34
--- aclocal.m4 1994/11/03 18:43:31
***************
*** 101,108 ****
for i in $(SUBDIRS) ;\
do \
(cd $$i ; echo>>> $1 <<<"in $(CURRENT_DIR)$$i..."; \
! $(MAKE) $(MFLAGS) CC="$(CC)" \
! CPPOPTS="$(CPPOPTS)" CCOPTS="$(CCOPTS)" \
CURRENT_DIR=$(CURRENT_DIR)$$i/ >>>$2<<<); \
done>>>
changequote([,])dnl
--- 101,107 ----
for i in $(SUBDIRS) ;\
do \
(cd $$i ; echo>>> $1 <<<"in $(CURRENT_DIR)$$i..."; \
! $(MAKE) $(MFLAGS) CC="$(CC)" CCOPTS="$(CCOPTS)" \
CURRENT_DIR=$(CURRENT_DIR)$$i/ >>>$2<<<); \
done>>>
changequote([,])dnl
***************
*** 251,256 ****
--- 250,273 ----
AC_COMPILE_CHECK([union wait],
[#include <sys/wait.h>], [union wait i;], , AC_DEFINE(WAIT_USES_INT))])dnl
dnl
+ dnl check for POSIX signal handling -- CHECK_SIGNALS
+ dnl
+ define(CHECK_SIGNALS,[
+ AC_FUNC_CHECK(sigprocmask,
+ AC_COMPILE_CHECK([sigset_t],
+ [#include <signal.h>],
+ [sigset_t x],
+ AC_DEFINE(POSIX_SIGNALS)))])dnl
+ dnl
+ dnl check for POSIX setjmp/longjmp -- CHECK_SETJMP
+ dnl
+ define(CHECK_SETJMP,[
+ AC_FUNC_CHECK(sigsetjmp,
+ AC_COMPILE_CHECK([sigjmp_buf],
+ [#include <setjmp.h>],
+ [sigjmp_buf x],
+ AC_DEFINE(POSIX_SETJMP)))])dnl
+ dnl
dnl set $(KRB5ROOT) from --with-krb5-root=value -- WITH_KRB5ROOT
dnl
define(WITH_KRB5ROOT,[
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/ChangeLog,v
retrieving revision 5.44
diff -c -r5.44 ChangeLog
*** ChangeLog 1994/10/28 00:08:09 5.44
--- ChangeLog 1994/11/04 18:46:02
***************
*** 1,3 ****
--- 1,59 ----
+ Wed Nov 02 22:21:00 1994 Richard Basch (probe@tardis)
+
+ * /aclocal.m4:
+ Added POSIX setjmp handling and POSIX signal handling
+ (CHECK_SETJMP, CHECK_SIGNALS)
+
+ * configure.in:
+ Moved POSIX signal check to aclocal.m4, and calls it (CHECK_SIGNALS)
+ Added POSIX setjmp check (CHECK_SETJMP).
+ Added checks for waitpid and setsid functions.
+
+ * kcmd.c:
+ Include <signal.h> not <sys/signal.h>.
+ Don't bother declaring sigmask when POSIX_SIGNALS is set.
+
+ * krcp.c:
+ Replaced the conditionalized BITS64 code with more portable code.
+ Use mode_t instead of int, for file modes.
+ Use waitpid, instead of wait, where available (HAVE_WAITPID).
+ Added POSIX signal handling (POSIX_SIGNALS).
+
+ * krlogin.c:
+ Include <unistd.h> and <stdlib.h> if available
+ Replaced the conditionalized BITS64 code with more portable code.
+ Use cfgetospeed() if POSIX_TERMIOS is defined. It was already being
+ used, so there is no need to use two methods.
+ Use waitpid, instead of wait, where available (HAVE_WAITPID).
+ Added POSIX setjmp handling (POSIX_SETJMP)
+ Added POSIX signal handling (POSIX_SIGNALS).
+
+ * krlogind.c:
+ Added POSIX signal handling (POSIX_SIGNALS).
+ Corrected an error in the arguments to chmod().
+ Call setsid() if HAVE_SETSID is defined.
+ Try not conditionalizing on __alpha; use other #ifdef's.
+ Replaced the conditionalized BITS64 code with more portable code.
+
+ * krsh.c:
+ Added POSIX signal handling (POSIX_SIGNALS)
+
+ * krshd.c:
+ Declare and manipulate the file descriptor arrays properly,
+ rather than bit shifting and passing them to select as
+ (long *). Some systems (eg. AIX) declare them to be structs.
+ Added POSIX signal handling (POSIX_SIGNALS)
+
+ * login.c:
+ Include <unistd.h> and <stdlib.h> if available
+ Added POSIX setjmp handling (POSIX_SETJMP)
+ Added POSIX signal handling (POSIX_SIGNALS)
+ Use waitpid, instead of wait, where available (HAVE_WAITPID).
+
+ * logutil.c:
+ Don't redeclare time(); it may conflict with the system header files.
+ Include <unistd.h> first.
+
Thu Oct 27 20:07:03 1994 Mark Eichin (eichin@cygnus.com)
* login.c (main): if CSTATUS is missing, don't set c_cc[VSTATUS]
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/configure.in,v
retrieving revision 5.27
diff -c -r5.27 configure.in
*** configure.in 1994/10/27 20:14:56 5.27
--- configure.in 1994/11/04 00:09:40
***************
*** 21,26 ****
--- 21,27 ----
AC_SUBST(LOGINLIBS)
dnl
AC_VFORK
+ AC_TYPE_MODE_T
AC_FUNC_CHECK(strsave,AC_DEFINE(HAS_STRSAVE))
AC_FUNC_CHECK(utimes,AC_DEFINE(HAS_UTIMES))
AC_FUNC_CHECK(getutent,AC_DEFINE(HAVE_GETUTENT))
***************
*** 32,42 ****
AC_FUNC_CHECK(setpriority,AC_DEFINE(HAVE_SETPRIORITY))
AC_FUNC_CHECK(setreuid,AC_DEFINE(HAVE_SETREUID))
AC_FUNC_CHECK(setresuid,AC_DEFINE(HAVE_SETRESUID))
! AC_FUNC_CHECK(sigprocmask,
! AC_COMPILE_CHECK([sigset_t],
! [#include <signal.h>],
! [sigset_t x],
! AC_DEFINE(POSIX_SIGNALS)))
AC_HAVE_HEADERS(sys/filio.h sys/sockio.h unistd.h sys/label.h ttyent.h lastlog.h sys/select.h sys/ptyvar.h)
AC_COMPILE_CHECK([use streams interface],
[#include <sys/tty.h>
--- 33,40 ----
AC_FUNC_CHECK(setpriority,AC_DEFINE(HAVE_SETPRIORITY))
AC_FUNC_CHECK(setreuid,AC_DEFINE(HAVE_SETREUID))
AC_FUNC_CHECK(setresuid,AC_DEFINE(HAVE_SETRESUID))
! AC_FUNC_CHECK(waitpid,AC_DEFINE(HAVE_WAITPID))
! AC_FUNC_CHECK(setsid,AC_DEFINE(HAVE_SETSID))
AC_HAVE_HEADERS(sys/filio.h sys/sockio.h unistd.h sys/label.h ttyent.h lastlog.h sys/select.h sys/ptyvar.h)
AC_COMPILE_CHECK([use streams interface],
[#include <sys/tty.h>
***************
*** 44,53 ****
#include <sys/ptyvar.h>],
[], AC_DEFINE(HAVE_STREAMS))
AC_REPLACE_FUNCS(getdtablesize)
CHECK_DIRENT
CHECK_FCNTL
CHECK_WAIT_TYPE
- AC_WAIT3
AC_HEADER_CHECK(termios.h,AC_FUNC_CHECK([tcsetattr],AC_DEFINE(POSIX_TERMIOS)))
AC_COMPILE_CHECK([F_SETOWN],
[#include <sys/types.h>
--- 42,52 ----
#include <sys/ptyvar.h>],
[], AC_DEFINE(HAVE_STREAMS))
AC_REPLACE_FUNCS(getdtablesize)
+ CHECK_SIGNALS
+ CHECK_SETJMP
CHECK_DIRENT
CHECK_FCNTL
CHECK_WAIT_TYPE
AC_HEADER_CHECK(termios.h,AC_FUNC_CHECK([tcsetattr],AC_DEFINE(POSIX_TERMIOS)))
AC_COMPILE_CHECK([F_SETOWN],
[#include <sys/types.h>
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/kcmd.c,v
retrieving revision 5.12
diff -c -r5.12 kcmd.c
*** kcmd.c 1994/10/24 19:29:08 5.12
--- kcmd.c 1994/11/04 17:39:51
***************
*** 40,54 ****
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
#include <sys/file.h>
! #include <sys/signal.h>
#ifndef POSIX_SIGNALS
#ifndef sigmask
#define sigmask(m) (1 << ((m)-1))
#endif
! #endif /* POSIX_SIGNALS */
! #include <sys/socket.h>
! #include <sys/stat.h>
#include <netinet/in.h>
#include <netdb.h>
--- 40,55 ----
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
+ #include <signal.h>
#include <sys/file.h>
! #include <sys/socket.h>
! #include <sys/stat.h>
!
#ifndef POSIX_SIGNALS
#ifndef sigmask
#define sigmask(m) (1 << ((m)-1))
#endif
! #endif
#include <netinet/in.h>
#include <netdb.h>
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/krcp.c,v
retrieving revision 5.12
diff -c -r5.12 krcp.c
*** krcp.c 1994/10/04 21:41:08 5.12
--- krcp.c 1994/11/04 17:14:17
***************
*** 98,110 ****
int encryptflag = 0;
#define UCB_RCP "/bin/rcp"
-
- #ifdef CRAY
- #ifndef BITS64
- #define BITS64
- #endif
- #endif
-
#else /* !KERBEROS */
#define des_read read
#define des_write write
--- 98,103 ----
***************
*** 146,151 ****
--- 139,147 ----
char buf[BUFSIZ], cmd[16];
struct servent *sp;
static char curhost[256];
+ #ifdef POSIX_SIGNALS
+ struct sigaction sa;
+ #endif
#ifdef KERBEROS
krb5_flags authopts;
krb5_error_code status;
***************
*** 155,164 ****
krb5_init_ets();
desinbuf.data = des_inbuf;
desoutbuf.data = des_outbuf; /* Set up des buffers */
-
#else
sp = getservbyname("shell", "tcp");
#endif /* KERBEROS */
if (sp == NULL) {
#ifdef KERBEROS
fprintf(stderr, "rcp: kshell/tcp: unknown service\n");
--- 151,160 ----
krb5_init_ets();
desinbuf.data = des_inbuf;
desoutbuf.data = des_outbuf; /* Set up des buffers */
#else
sp = getservbyname("shell", "tcp");
#endif /* KERBEROS */
+
if (sp == NULL) {
#ifdef KERBEROS
fprintf(stderr, "rcp: kshell/tcp: unknown service\n");
***************
*** 245,257 ****
encryptflag ? " -x" : "",
targetshouldbedirectory ? " -d" : "");
#else /* !KERBEROS */
-
(void) sprintf(cmd, "rcp%s%s%s",
iamrecursive ? " -r" : "", pflag ? " -p" : "",
targetshouldbedirectory ? " -d" : "");
#endif /* KERBEROS */
(void) signal(SIGPIPE, lostconn);
targ = colon(argv[argc - 1]);
/* Check if target machine is the current machine. */
--- 241,259 ----
encryptflag ? " -x" : "",
targetshouldbedirectory ? " -d" : "");
#else /* !KERBEROS */
(void) sprintf(cmd, "rcp%s%s%s",
iamrecursive ? " -r" : "", pflag ? " -p" : "",
targetshouldbedirectory ? " -d" : "");
#endif /* KERBEROS */
+ #ifdef POSIX_SIGNALS
+ (void) sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = lostconn;
+ (void) sigaction(SIGPIPE, &sa, (struct sigaction *)0);
+ #else
(void) signal(SIGPIPE, lostconn);
+ #endif
targ = colon(argv[argc - 1]);
/* Check if target machine is the current machine. */
***************
*** 548,568 ****
susystem(s)
char *s;
{
! int status, pid, w;
register krb5_sigtype (*istat)(), (*qstat)();
if ((pid = vfork()) == 0) {
execl("/bin/sh", "sh", "-c", s, (char *)0);
_exit(127);
}
istat = signal(SIGINT, SIG_IGN);
qstat = signal(SIGQUIT, SIG_IGN);
! while ((w = wait(&status)) != pid && w != -1)
! ;
! if (w == -1)
status = -1;
(void) signal(SIGINT, istat);
(void) signal(SIGQUIT, qstat);
return (status);
}
--- 550,595 ----
susystem(s)
char *s;
{
! int status;
! pid_t pid, w;
! #ifdef POSIX_SIGNALS
! struct sigaction sa, isa, qsa;
! #else
register krb5_sigtype (*istat)(), (*qstat)();
+ #endif
if ((pid = vfork()) == 0) {
execl("/bin/sh", "sh", "-c", s, (char *)0);
_exit(127);
}
+
+ #ifdef POSIX_SIGNALS
+ (void) sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_IGN;
+ (void) sigaction(SIGINT, &sa, &isa);
+ (void) sigaction(SIGQUIT, &sa, &qsa);
+ #else
istat = signal(SIGINT, SIG_IGN);
qstat = signal(SIGQUIT, SIG_IGN);
! #endif
!
! #ifdef HAVE_WAITPID
! w = waitpid(pid, &status, 0);
! #else
! while ((w = wait(&status)) != pid && w != -1) /*void*/ ;
! #endif
! if (w == (pid_t)-1)
status = -1;
+
+ #ifdef POSIX_SIGNALS
+ (void) sigaction(SIGINT, &isa, (struct sigaction *)0);
+ (void) sigaction(SIGQUIT, &qsa, (struct sigaction *)0);
+ #else
(void) signal(SIGINT, istat);
(void) signal(SIGQUIT, qstat);
+ #endif
+
return (status);
}
***************
*** 787,800 ****
int argc;
char **argv;
{
off_t i, j;
char *targ, *whopp, *cp;
! int of, mode, wrerr, exists, first, count, amt, size;
struct buffer *bp;
static struct buffer buffer;
struct stat stb;
int targisdir = 0;
- int mask = umask(0);
char *myargv[1];
char cmdbuf[BUFSIZ], nambuf[BUFSIZ];
int setimes = 0;
--- 814,828 ----
int argc;
char **argv;
{
+ mode_t mode;
+ mode_t mask = umask(0);
off_t i, j;
char *targ, *whopp, *cp;
! int of, wrerr, exists, first, count, amt, size;
struct buffer *bp;
static struct buffer buffer;
struct stat stb;
int targisdir = 0;
char *myargv[1];
char cmdbuf[BUFSIZ], nambuf[BUFSIZ];
int setimes = 0;
***************
*** 919,930 ****
error("rcp: %s: %s\n", nambuf, sys_errlist[errno]);
continue;
}
! if (exists && pflag)
#ifdef NOFCHMOD
! (void) chmod(nambuf, mode);
#else
! (void) fchmod(of, mode);
#endif
ga();
if ((bp = allocbuf(&buffer, of, BUFSIZ)) == NULLBUF) {
(void) close(of);
--- 947,959 ----
error("rcp: %s: %s\n", nambuf, sys_errlist[errno]);
continue;
}
! if (exists && pflag) {
#ifdef NOFCHMOD
! (void) chmod(nambuf, mode);
#else
! (void) fchmod(of, mode);
#endif
+ }
ga();
if ((bp = allocbuf(&buffer, of, BUFSIZ)) == NULLBUF) {
(void) close(of);
***************
*** 1040,1046 ****
#ifdef KERBEROS
fprintf(stderr,
"Usage: \trcp [-p] [-x] [-k realm] f1 f2; or:\n\trcp [-r] [-p] [-x] [-k realm] f1 ... fn d2\n");
! #else /* !KERBEROS */
fputs("usage: rcp [-p] f1 f2; or: rcp [-rp] f1 ... fn d2\n", stderr);
#endif
exit(1);
--- 1069,1075 ----
#ifdef KERBEROS
fprintf(stderr,
"Usage: \trcp [-p] [-x] [-k realm] f1 f2; or:\n\trcp [-r] [-p] [-x] [-k realm] f1 ... fn d2\n");
! #else
fputs("usage: rcp [-p] f1 f2; or: rcp [-rp] f1 ... fn d2\n", stderr);
#endif
exit(1);
***************
*** 1350,1355 ****
--- 1379,1385 ----
long net_len,rd_len;
int cc;
krb5_error_code status;
+ unsigned char len_buf[4];
if (!encryptflag)
return(read(fd, buf, len));
***************
*** 1367,1387 ****
nstored = 0;
}
! #ifdef BITS64
! /*
! * XXX Ick; this assumes a big-endian word order....
! */
! rd_len = 0;
! if ((cc = krb5_net_read(fd, (char *)&rd_len + 4, 4)) != 4) {
! #else
! if ((cc = krb5_net_read(fd, (char *)&rd_len, sizeof(rd_len))) !=
! sizeof(rd_len)) {
! #endif
! /* XXX can't read enough, pipe
! must have closed */
return(0);
}
! rd_len = ntohl(rd_len);
net_len = krb5_encrypt_size(rd_len,eblock.crypto_entry);
if (net_len <= 0 || net_len > sizeof(des_inbuf)) {
/* preposterous length; assume out-of-sync; only
--- 1397,1408 ----
nstored = 0;
}
! if ((cc = krb5_net_read(fd, (char *)&len_buf, 4)) != 4) {
! /* XXX can't read enough, pipe must have closed */
return(0);
}
! rd_len =
! ((len_buf[0]<<24) | (len_buf[1]<<16) | (len_buf[2]<<8) | len_buf[3]);
net_len = krb5_encrypt_size(rd_len,eblock.crypto_entry);
if (net_len <= 0 || net_len > sizeof(des_inbuf)) {
/* preposterous length; assume out-of-sync; only
***************
*** 1429,1435 ****
char *buf;
int len;
{
! long net_len;
if (!encryptflag)
return(write(fd, buf, len));
--- 1450,1456 ----
char *buf;
int len;
{
! unsigned char len_buf[4];
if (!encryptflag)
return(write(fd, buf, len));
***************
*** 1446,1457 ****
return(-1);
}
! net_len = htonl(len);
! #ifdef BITS64
! (void) write(fd,(char *)&net_len + 4, 4);
! #else
! (void) write(fd, &net_len, sizeof(net_len));
! #endif
if (write(fd, desoutbuf.data,desoutbuf.length) != desoutbuf.length){
return(-1);
}
--- 1467,1477 ----
return(-1);
}
! len_buf[0] = (len & 0xff000000);
! len_buf[1] = (len & 0xff0000);
! len_buf[2] = (len & 0xff00);
! len_buf[3] = (len & 0xff);
! (void) write(fd, len_buf, 4);
if (write(fd, desoutbuf.data,desoutbuf.length) != desoutbuf.length){
return(-1);
}
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/krlogin.c,v
retrieving revision 5.17
diff -c -r5.17 krlogin.c
*** krlogin.c 1994/10/27 20:14:58 5.17
--- krlogin.c 1994/11/04 17:33:23
***************
*** 35,41 ****
#ifdef _AIX
#undef _BSD
#endif
!
#include <sys/types.h>
#include <sys/param.h>
#include <sys/ioctl.h>
--- 35,49 ----
#ifdef _AIX
#undef _BSD
#endif
!
! #ifdef HAVE_UNISTD_H
! #include <unistd.h>
! #endif
! #ifdef HAVE_STDLIB_H
! #include <stdlib.h>
! #endif
!
!
#include <sys/types.h>
#include <sys/param.h>
#include <sys/ioctl.h>
***************
*** 113,121 ****
#include <sys/ioctl_compat.h>
#endif
- struct termios deftty;
-
-
#ifdef POSIX_TERMIOS
#ifdef CRAY
#include <sys/ttold.h>
--- 121,126 ----
***************
*** 156,179 ****
#define UCB_RLOGIN "/usr/ucb/rlogin"
- #ifdef CRAY
- #ifndef BITS64
- #define BITS64
- #endif
- #endif
-
#include "rpaths.h"
#else /* !KERBEROS */
#define des_read read
#define des_write write
#endif /* KERBEROS */
-
# ifndef TIOCPKT_WINDOW
# define TIOCPKT_WINDOW 0x80
# endif /* TIOCPKT_WINDOW */
char *getenv();
char *name;
int rem = -1; /* Remote socket fd */
char cmdchar = '~';
--- 161,183 ----
#define UCB_RLOGIN "/usr/ucb/rlogin"
#include "rpaths.h"
#else /* !KERBEROS */
#define des_read read
#define des_write write
#endif /* KERBEROS */
# ifndef TIOCPKT_WINDOW
# define TIOCPKT_WINDOW 0x80
# endif /* TIOCPKT_WINDOW */
+ #ifdef POSIX_TERMIOS
+ struct termios deftty;
+ #endif
+
+ krb5_sigtype exit();
char *getenv();
+
char *name;
int rem = -1; /* Remote socket fd */
char cmdchar = '~';
***************
*** 201,225 ****
#endif
char term[256] = "network";
extern int errno;
! krb5_sigtype lostpeer();
! int dosigwinch = 0;
#ifndef POSIX_SIGNALS
#ifndef sigmask
#define sigmask(m) (1 << ((m)-1))
#endif
#endif /* POSIX_SIGNALS */
#ifdef NO_WINSIZE
struct winsize {
unsigned short ws_row, ws_col;
unsigned short ws_xpixel, ws_ypixel;
};
#endif /* NO_WINSIZE */
struct winsize winsize;
! krb5_sigtype sigwinch(), oob();
char *host=0; /* external, so it can be
reached from confirm_death() */
!
/*
* The following routine provides compatibility (such as it is)
--- 205,234 ----
#endif
char term[256] = "network";
extern int errno;
!
#ifndef POSIX_SIGNALS
#ifndef sigmask
#define sigmask(m) (1 << ((m)-1))
#endif
#endif /* POSIX_SIGNALS */
+
#ifdef NO_WINSIZE
struct winsize {
unsigned short ws_row, ws_col;
unsigned short ws_xpixel, ws_ypixel;
};
#endif /* NO_WINSIZE */
+ int dosigwinch = 0;
struct winsize winsize;
!
char *host=0; /* external, so it can be
reached from confirm_death() */
! krb5_sigtype sigwinch(), oob();
! krb5_sigtype lostpeer();
! #if __STDC__
! int setsignal(int sig, krb5_sigtype (*act)());
! #endif
/*
* The following routine provides compatibility (such as it is)
***************
*** 304,309 ****
--- 313,319 ----
struct servent *sp;
int uid, options = 0;
#ifdef POSIX_SIGNALS
+ struct sigaction sa;
sigset_t *oldmask, omask, urgmask;
#else
int oldmask;
***************
*** 315,321 ****
krb5_flags authopts;
krb5_error_code status;
int debug_port = 0;
! #endif /* KERBEROS */
if (strrchr(argv[0], '/'))
argv[0] = strrchr(argv[0], '/')+1;
--- 325,331 ----
krb5_flags authopts;
krb5_error_code status;
int debug_port = 0;
! #endif
if (strrchr(argv[0], '/'))
argv[0] = strrchr(argv[0], '/')+1;
***************
*** 485,495 ****
not a table index. */
sprintf (term + strlen (term), "%d", ospeed);
else {
! #ifdef CBAUD
! /* some "posix" systems don't have cfget... so used CBAUD if it's there */
(void) strcat(term, speeds[ttyb.c_cflag & CBAUD]);
- #else
- (void) strcat(term, speeds[cfgetospeed(&ttyb)]);
#endif
}
}
--- 495,508 ----
not a table index. */
sprintf (term + strlen (term), "%d", ospeed);
else {
! (void) strcat(term, speeds[ospeed]);
! #if 0
! /* XXX - Not used, since the above code was
! * not ifdef'd and it relied on cfget... */
!
! /* some "posix" systems don't have cfget...
! * so used CBAUD if it's there */
(void) strcat(term, speeds[ttyb.c_cflag & CBAUD]);
#endif
}
}
***************
*** 509,527 ****
/**** moved before rcmd call so that if get a SIGPIPE in rcmd **/
/**** we will have the defmodes set already. ***/
(void)ioctl(fileno(stdin), TIOCGETP, &defmodes);
! (void)ioctl(fileno(stdin), TIOCGETP,&ixon_state);
#endif
#endif
! (void) signal(SIGPIPE, lostpeer);
!
/* will use SIGUSR1 for window size hack, so hold it off */
#ifdef POSIX_SIGNALS
! sigemptyset(&urgmask);
! sigaddset(&urgmask, SIGURG);
! sigaddset(&urgmask, SIGUSR1);
oldmask = &omask;
! sigprocmask(SIG_BLOCK, &urgmask, oldmask);
#else
#ifdef sgi
oldmask = sigignore(sigmask(SIGURG) | sigmask(SIGUSR1));
#else
--- 522,546 ----
/**** moved before rcmd call so that if get a SIGPIPE in rcmd **/
/**** we will have the defmodes set already. ***/
(void)ioctl(fileno(stdin), TIOCGETP, &defmodes);
! (void)ioctl(fileno(stdin), TIOCGETP, &ixon_state);
#endif
#endif
!
! /* Catch SIGPIPE, as that means we lost the connection */
/* will use SIGUSR1 for window size hack, so hold it off */
#ifdef POSIX_SIGNALS
! (void) sigemptyset(&sa.sa_mask);
! sa.sa_flags = 0;
! sa.sa_handler = lostpeer;
! (void) sigaction(SIGPIPE, &sa, (struct sigaction *)0);
!
! (void) sigemptyset(&urgmask);
! (void) sigaddset(&urgmask, SIGURG);
! (void) sigaddset(&urgmask, SIGUSR1);
oldmask = &omask;
! (void) sigprocmask(SIG_BLOCK, &urgmask, oldmask);
#else
+ (void) signal(SIGPIPE, lostpeer);
#ifdef sgi
oldmask = sigignore(sigmask(SIGURG) | sigmask(SIGUSR1));
#else
***************
*** 701,718 ****
doit(oldmask)
#ifdef POSIX_SIGNALS
! sigset_t *oldmask;
#endif
{
#ifdef POSIX_TERMIOS
! (void) tcgetattr(0, &deftty);
! /* was __svr4__ */
#ifdef VLNEXT
! /* there's a POSIX way of doing this, but do we need it general? */
! deftty.c_cc[VLNEXT] = 0;
#endif
#ifdef TIOCGLTC
! (void) ioctl(0, TIOCGLTC, (char *)&defltc);
#endif
#else
#ifdef USE_TERMIO
--- 720,740 ----
doit(oldmask)
#ifdef POSIX_SIGNALS
! sigset_t *oldmask;
#endif
{
+ #ifdef POSIX_SIGNALS
+ struct sigaction sa;
+ #endif
+
#ifdef POSIX_TERMIOS
! (void) tcgetattr(0, &deftty);
#ifdef VLNEXT
! /* there's a POSIX way of doing this, but do we need it general? */
! deftty.c_cc[VLNEXT] = 0;
#endif
#ifdef TIOCGLTC
! (void) ioctl(0, TIOCGLTC, (char *)&defltc);
#endif
#else
#ifdef USE_TERMIO
***************
*** 749,758 ****
notc.t_startc = deftc.t_startc;
notc.t_stopc = deftc.t_stopc;
(void) ioctl(0, TIOCGLTC, (char *)&defltc);
! #endif
(void) signal(SIGINT, SIG_IGN);
setsignal(SIGHUP, exit);
! setsignal(SIGQUIT,exit);
child = fork();
if (child == -1) {
perror("rlogin: fork");
--- 771,789 ----
notc.t_startc = deftc.t_startc;
notc.t_stopc = deftc.t_stopc;
(void) ioctl(0, TIOCGLTC, (char *)&defltc);
! #endif
! #ifdef POSIX_SIGNALS
! (void) sigemptyset(&sa.sa_mask);
! sa.sa_flags = 0;
! sa.sa_handler = SIG_IGN;
! (void) sigaction(SIGINT, &sa, (struct sigaction *)0);
! #else
(void) signal(SIGINT, SIG_IGN);
+ #endif
+
setsignal(SIGHUP, exit);
! setsignal(SIGQUIT, exit);
!
child = fork();
if (child == -1) {
perror("rlogin: fork");
***************
*** 775,791 ****
* the reader. Set a trap that simply copies such signals to
* the child.
*/
- (void) signal(SIGURG, copytochild);
- (void) signal(SIGUSR1, writeroob);
-
#ifdef POSIX_SIGNALS
sigprocmask(SIG_SETMASK, oldmask, (sigset_t*)0);
#else
#ifndef sgi
(void) sigsetmask(oldmask);
#endif
- #endif /* POSIX_SIGNALS */
(void) signal(SIGCHLD, catchild);
writer();
prf("Closed connection.");
done(0);
--- 806,831 ----
* the reader. Set a trap that simply copies such signals to
* the child.
*/
#ifdef POSIX_SIGNALS
+ /* "sa" has already been initialized above. */
+ sa.sa_handler = copytochild;
+ (void) sigaction(SIGURG, &sa, (struct sigaction *)0);
+
+ sa.sa_handler = writeroob;
+ (void) sigaction(SIGUSR1, &sa, (struct sigaction *)0);
+
sigprocmask(SIG_SETMASK, oldmask, (sigset_t*)0);
+
+ sa.sa_handler = catchild;
+ (void) sigaction(SIGCHLD, &sa, (struct sigaction *)0);
#else
+ (void) signal(SIGURG, copytochild);
+ (void) signal(SIGUSR1, writeroob);
#ifndef sgi
(void) sigsetmask(oldmask);
#endif
(void) signal(SIGCHLD, catchild);
+ #endif /* POSIX_SIGNALS */
writer();
prf("Closed connection.");
done(0);
***************
*** 802,807 ****
--- 842,849 ----
{
#ifdef POSIX_SIGNALS
sigset_t omask, igmask;
+ struct sigaction sa;
+
sigemptyset(&igmask);
sigaddset(&igmask, sig);
sigprocmask(SIG_BLOCK, &igmask, &omask);
***************
*** 813,823 ****
#endif
#endif /* POSIX_SIGNALS */
- if (signal(sig, act) == SIG_IGN)
- (void) signal(sig, SIG_IGN);
#ifdef POSIX_SIGNALS
sigprocmask(SIG_SETMASK, &omask, (sigset_t*)0);
#else
#ifndef sgi
(void) sigsetmask(omask);
#endif
--- 855,872 ----
#endif
#endif /* POSIX_SIGNALS */
#ifdef POSIX_SIGNALS
+ (void) sigaction(sig, (struct sigaction *)0, &sa);
+ if (sa.sa_handler != SIG_IGN) {
+ (void) sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = act;
+ (void) sigaction(sig, &sa, (struct sigaction *)0);
+ }
sigprocmask(SIG_SETMASK, &omask, (sigset_t*)0);
#else
+ if (signal(sig, act) == SIG_IGN)
+ (void) signal(sig, SIG_IGN);
#ifndef sgi
(void) sigsetmask(omask);
#endif
***************
*** 829,843 ****
done(status)
int status;
{
! int w;
mode(0);
if (child > 0) {
/* make sure catchild does not snap it up */
(void) signal(SIGCHLD, SIG_DFL);
! if (kill(child, SIGKILL) >= 0)
! while ((w = wait(0)) > 0 && w != child)
! /*void*/;
}
exit(status);
}
--- 878,910 ----
done(status)
int status;
{
! #ifdef POSIX_SIGNALS
! struct sigaction sa;
! #endif
! #ifndef HAVE_WAITPID
! pid_t w;
! #endif
mode(0);
if (child > 0) {
/* make sure catchild does not snap it up */
+ #ifdef POSIX_SIGNALS
+ (void) sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_DFL;
+ (void) sigaction(SIGCHLD, &sa, (struct sigaction *)0);
+ #else
(void) signal(SIGCHLD, SIG_DFL);
! #endif
!
! if (kill(child, SIGKILL) >= 0) {
! #ifdef HAVE_WAITPID
! (void) waitpid(child, 0, 0);
! #else
! while ((w = wait(0)) > 0 && w != child)
! /*void*/;
! #endif
! }
}
exit(status);
}
***************
*** 850,856 ****
krb5_sigtype
copytochild()
{
-
(void) kill(child, SIGURG);
}
--- 917,922 ----
***************
*** 863,872 ****
--- 929,948 ----
krb5_sigtype
writeroob()
{
+ #ifdef POSIX_SIGNALS
+ struct sigaction sa;
+ #endif
if (dosigwinch == 0) {
sendwindow();
+ #ifdef POSIX_SIGNALS
+ (void) sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = sigwinch;
+ (void) sigaction(SIGWINCH, &sa, (struct sigaction *)0);
+ #else
(void) signal(SIGWINCH, sigwinch);
+ #endif
}
dosigwinch = 1;
}
***************
*** 884,893 ****
int pid;
again:
! #ifdef HAVE_WAIT3
! pid = wait3(&status, WNOHANG|WUNTRACED, (struct rusage *)0);
! #else
pid = waitpid(-1, &status, WNOHANG|WUNTRACED);
#endif
if (pid == 0)
return;
--- 960,969 ----
int pid;
again:
! #ifdef HAVE_WAITPID
pid = waitpid(-1, &status, WNOHANG|WUNTRACED);
+ #else
+ pid = wait3(&status, WNOHANG|WUNTRACED, (struct rusage *)0);
#endif
if (pid == 0)
return;
***************
*** 902,908 ****
/* I think this one is wrong: XXX -- [eichin:19940727.1853EST] */
if ((pid < 0) || ((pid == child) && (!WIFSTOPPED(status.w_stopval))))
#else
! if ((pid < 0) || ((pid == child) && (!WIFSTOPPED( status))))
#endif
done((int)(status.w_termsig | status.w_retcode));
#endif
--- 978,984 ----
/* I think this one is wrong: XXX -- [eichin:19940727.1853EST] */
if ((pid < 0) || ((pid == child) && (!WIFSTOPPED(status.w_stopval))))
#else
! if ((pid < 0) || ((pid == child) && (!WIFSTOPPED(status))))
#endif
done((int)(status.w_termsig | status.w_retcode));
#endif
***************
*** 1056,1063 ****
--- 1132,1152 ----
stop(cmdc)
char cmdc;
{
+ #ifdef POSIX_SIGNALS
+ struct sigaction sa;
+ #endif
+
mode(0);
+
+ #ifdef POSIX_SIGNALS
+ (void) sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_IGN;
+ (void) sigaction(SIGCHLD, &sa, (struct sigaction *)0);
+ #else
(void) signal(SIGCHLD, SIG_IGN);
+ #endif
+
#ifdef TIOCGLTC
(void) kill(cmdc == defltc.t_suspc ? 0 : getpid(), SIGTSTP);
#else
***************
*** 1065,1071 ****
--- 1154,1167 ----
(void) kill(cmdc == deftty.c_cc[VSUSP] ? 0 : getpid(), SIGTSTP);
#endif
#endif
+
+ #ifdef POSIX_SIGNALS
+ sa.sa_handler = catchild;
+ (void) sigaction(SIGCHLD, &sa, (struct sigaction *)0);
+ #else
(void) signal(SIGCHLD, catchild);
+ #endif
+
mode(1);
sigwinch(); /* check for size changes */
}
***************
*** 1117,1123 ****
int rcvcnt;
int rcvstate;
int ppid;
! jmp_buf rcvtop;
krb5_sigtype
oob()
--- 1213,1224 ----
int rcvcnt;
int rcvstate;
int ppid;
!
! #ifdef POSIX_SETJMP
! sigjmp_buf rcvtop;
! #else
! jmp_buf rcvtop;
! #endif
krb5_sigtype
oob()
***************
*** 1240,1246 ****
--- 1341,1351 ----
* restart anyway.
*/
rcvcnt = 0;
+ #ifdef POSIX_SETJMP
+ siglongjmp(rcvtop, 1);
+ #else
longjmp(rcvtop, 1);
+ #endif
}
/*
***************
*** 1252,1259 ****
* longjmp to the top to restart appropriately. Don't abort
* a pending write, however, or we won't know how much was written.
*/
if (rcvd && rcvstate == READING)
! longjmp(rcvtop, 1);
}
--- 1357,1369 ----
* longjmp to the top to restart appropriately. Don't abort
* a pending write, however, or we won't know how much was written.
*/
+ #ifdef POSIX_SETJMP
+ if (rcvd && rcvstate == READING)
+ siglongjmp(rcvtop, 1);
+ #else
if (rcvd && rcvstate == READING)
! longjmp(rcvtop, 1);
! #endif
}
***************
*** 1275,1288 ****
#endif
int n, remaining;
char *bufp = rcvbuf;
!
(void) signal(SIGTTOU, SIG_IGN);
(void) signal(SIGURG, oob);
ppid = getppid();
#ifdef HAVE_SETOWN
(void) fcntl(rem, F_SETOWN, pid);
#endif
(void) setjmp(rcvtop);
#ifdef POSIX_SIGNALS
sigprocmask(SIG_SETMASK, oldmask, (sigset_t*)0);
#else
--- 1385,1415 ----
#endif
int n, remaining;
char *bufp = rcvbuf;
!
! #ifdef POSIX_SIGNALS
! struct sigaction sa;
!
! (void) sigemptyset(&sa.sa_mask);
! sa.sa_flags = 0;
! sa.sa_handler = SIG_IGN;
! (void) sigaction(SIGTTOU, &sa, (struct sigaction *)0);
!
! sa.sa_handler = oob;
! (void) sigaction(SIGURG, &sa, (struct sigaction *)0);
! #else
(void) signal(SIGTTOU, SIG_IGN);
(void) signal(SIGURG, oob);
+ #endif
+
ppid = getppid();
#ifdef HAVE_SETOWN
(void) fcntl(rem, F_SETOWN, pid);
#endif
+ #ifdef POSIX_SETJMP
+ (void) sigsetjmp(rcvtop, 1);
+ #else
(void) setjmp(rcvtop);
+ #endif
#ifdef POSIX_SIGNALS
sigprocmask(SIG_SETMASK, oldmask, (sigset_t*)0);
#else
***************
*** 1533,1538 ****
--- 1660,1666 ----
int nreturned = 0;
long net_len,rd_len;
int cc;
+ unsigned char len_buf[4];
if (!encrypt_flag)
return(read(fd, buf, len));
***************
*** 1550,1572 ****
nstored = 0;
}
! #ifdef BITS64
! /*
! * XXX Ick. This assumes big endian byte order.
! */
! rd_len = 0;
! if ((cc = krb5_net_read(fd, (char *)&rd_len + 4, 4)) != 4) {
! #else
! if ((cc = krb5_net_read(fd, (char *)&rd_len, sizeof(rd_len))) !=
! sizeof(rd_len)) {
! #endif
! /* XXX can't read enough, pipe
! must have closed */
return(0);
}
! rd_len = ntohl(rd_len);
net_len = krb5_encrypt_size(rd_len,eblock.crypto_entry);
! if (net_len <= 0 || net_len > sizeof(des_inbuf)) {
/* preposterous length; assume out-of-sync; only
recourse is to close connection, so return 0 */
fprintf(stderr,"Read size problem.\n");
--- 1678,1691 ----
nstored = 0;
}
! if ((cc = krb5_net_read(fd, (char *)&len_buf, 4)) != 4) {
! /* XXX can't read enough, pipe must have closed */
return(0);
}
! rd_len =
! ((len_buf[0]<<24) | (len_buf[1]<<16) | (len_buf[2]<<8) | len_buf[3]);
net_len = krb5_encrypt_size(rd_len,eblock.crypto_entry);
! if ((net_len <= 0) || (net_len > sizeof(des_inbuf))) {
/* preposterous length; assume out-of-sync; only
recourse is to close connection, so return 0 */
fprintf(stderr,"Read size problem.\n");
***************
*** 1610,1616 ****
char *buf;
int len;
{
! long net_len;
if (!encrypt_flag)
return(write(fd, buf, len));
--- 1729,1735 ----
char *buf;
int len;
{
! unsigned char len_buf[4];
if (!encrypt_flag)
return(write(fd, buf, len));
***************
*** 1629,1640 ****
return(-1);
}
! net_len = htonl(len);
! #ifdef BITS64
! (void) write(fd,(char *)&net_len + 4, 4);
! #else
! (void) write(fd, &net_len, sizeof(net_len));
! #endif
if (write(fd, desoutbuf.data,desoutbuf.length) != desoutbuf.length){
fprintf(stderr,"Could not write out all data.\n");
return(-1);
--- 1748,1758 ----
return(-1);
}
! len_buf[0] = (len & 0xff000000);
! len_buf[1] = (len & 0xff0000);
! len_buf[2] = (len & 0xff00);
! len_buf[3] = (len & 0xff);
! (void) write(fd, len_buf, 4);
if (write(fd, desoutbuf.data,desoutbuf.length) != desoutbuf.length){
fprintf(stderr,"Could not write out all data.\n");
return(-1);
***************
*** 1661,1666 ****
--- 1779,1785 ----
int nreturned = 0;
long net_len, rd_len;
int cc;
+ unsigned char len_buf[4];
if (!encrypt_flag)
return(read(fd, buf, len));
***************
*** 1677,1694 ****
len -= nstored;
nstored = 0;
}
! #ifdef BITS64
! net_len = 0;
! if ((cc = krb5_net_read(fd, (char *)&net_len + 4, 4)) != 4) {
! #else
! if ((cc = krb5_net_read(fd, &net_len, sizeof(net_len))) !=
! sizeof(net_len)) {
! #endif
! /* XXX can't read enough, pipe
! must have closed */
return(0);
}
! net_len = ntohl(net_len);
if (net_len < 0 || net_len > sizeof(des_inbuf)) {
/* XXX preposterous length, probably out of sync.
act as if pipe closed */
--- 1796,1807 ----
len -= nstored;
nstored = 0;
}
! if ((cc = krb5_net_read(fd, len_buf, 4)) != 4) {
! /* XXX can't read enough, pipe must have closed */
return(0);
}
! net_len =
! ((len_buf[0]<<24) | (len_buf[1]<<16) | (len_buf[2]<<8) | len_buf[3]);
if (net_len < 0 || net_len > sizeof(des_inbuf)) {
/* XXX preposterous length, probably out of sync.
act as if pipe closed */
***************
*** 1741,1748 ****
char *buf;
int len;
{
- long net_len;
static char garbage_buf[8];
if (!encrypt_flag)
return(write(fd, buf, len));
--- 1854,1861 ----
char *buf;
int len;
{
static char garbage_buf[8];
+ unsigned char len_buf[4];
if (!encrypt_flag)
return(write(fd, buf, len));
***************
*** 1764,1775 ****
/* tell the other end the real amount, but send an 8-byte padded
packet */
! net_len = htonl(len);
! #ifdef BITS64
! (void) write(fd,(char *)&net_len + 4, 4);
! #else
! (void) write(fd, &net_len, sizeof(net_len));
! #endif
#ifdef NOROUNDUP
(void) write(fd, des_outbuf, ((((len)+((8)-1))/(8))*(8)));
#else
--- 1877,1887 ----
/* tell the other end the real amount, but send an 8-byte padded
packet */
! len_buf[0] = (len & 0xff000000);
! len_buf[1] = (len & 0xff0000);
! len_buf[2] = (len & 0xff00);
! len_buf[3] = (len & 0xff);
! (void) write(fd, len_buf, 4);
#ifdef NOROUNDUP
(void) write(fd, des_outbuf, ((((len)+((8)-1))/(8))*(8)));
#else
***************
*** 1785,1792 ****
krb5_sigtype lostpeer()
{
!
(void) signal(SIGPIPE, SIG_IGN);
prf("\007Connection closed.");
done(1);
}
--- 1897,1913 ----
krb5_sigtype lostpeer()
{
! #ifdef POSIX_SIGNALS
! struct sigaction sa;
!
! (void) sigemptyset(&sa.sa_mask);
! sa.sa_flags = 0;
! sa.sa_handler = SIG_IGN;
! (void) sigaction(SIGPIPE, &sa, (struct sigaction *)0);
! #else
(void) signal(SIGPIPE, SIG_IGN);
+ #endif
+
prf("\007Connection closed.");
done(1);
}
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/krlogind.c,v
retrieving revision 5.29
diff -c -r5.29 krlogind.c
*** krlogind.c 1994/10/27 20:15:00 5.29
--- krlogind.c 1994/11/04 16:59:52
***************
*** 244,255 ****
krb5_authenticator *kdata;
krb5_ticket *ticket = 0;
- #ifdef CRAY
- #ifndef BITS64
- #define BITS64
- #endif
- #endif
-
#define ARGSTR "rRkKeExXpPD:?"
#else /* !KERBEROS */
#define ARGSTR "rRpPD:?"
--- 244,249 ----
***************
*** 303,308 ****
--- 297,303 ----
void fatal(), fatalperror(), doit(), usage(), do_krb_login();
int princ_maps_to_lname(), default_realm();
+ krb5_sigtype cleanup();
int must_pass_rhosts = 0, must_pass_k5 = 0, must_pass_one = 0;
int do_encrypt = 0, passwd_if_fail = 0, passwd_req = 0;
***************
*** 481,487 ****
#endif
int child;
- int cleanup();
int netf;
char line[MAXPATHLEN];
extern char *inet_ntoa();
--- 476,481 ----
***************
*** 501,506 ****
--- 495,503 ----
char c;
char buferror[255];
struct passwd *pwd;
+ #ifdef POSIX_SIGNALS
+ struct sigaction sa;
+ #endif
netf = -1;
alarm(60);
***************
*** 509,516 ****
if (c != 0){
exit(1);
}
!
alarm(0);
fromp->sin_port = ntohs((u_short)fromp->sin_port);
hp = gethostbyaddr(&fromp->sin_addr, sizeof (struct in_addr),
fromp->sin_family);
--- 506,520 ----
if (c != 0){
exit(1);
}
!
alarm(0);
+
+ #ifdef POSIX_SIGNALS
+ /* Initialize "sa" structure. */
+ (void) sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ #endif
+
fromp->sin_port = ntohs((u_short)fromp->sin_port);
hp = gethostbyaddr(&fromp->sin_addr, sizeof (struct in_addr),
fromp->sin_family);
***************
*** 571,600 ****
/* Make sure we can open slave pty, then close it for system 5 so that
the process group is set correctly..... */
- #ifdef __alpha
- /* osf/1 method of losing controlling tty...*/
- setsid();
- #endif
#ifdef VHANG_FIRST
vfd = open(line, O_RDWR);
if (vfd < 0)
fatalperror(f, line);
#ifdef NOFCHMOD
! if (chmod(vfd,0))
#else
if (fchmod(vfd, 0))
- #endif
fatalperror(f, line);
#ifndef SYSV
if (f == 0) { /* if operating standalone, do not reset tty!! */
signal(SIGHUP, SIG_IGN);
vhangup();
signal(SIGHUP, SIG_DFL);
}
#endif
#endif /* VHANG_FIRST */
! #if defined (sun) || defined (POSIX)
! setsid();
#endif
t = open(line, O_RDWR);
--- 575,610 ----
/* Make sure we can open slave pty, then close it for system 5 so that
the process group is set correctly..... */
#ifdef VHANG_FIRST
vfd = open(line, O_RDWR);
if (vfd < 0)
fatalperror(f, line);
#ifdef NOFCHMOD
! if (chmod(line, 0))
! fatalperror(f, line);
#else
if (fchmod(vfd, 0))
fatalperror(f, line);
+ #endif
#ifndef SYSV
if (f == 0) { /* if operating standalone, do not reset tty!! */
+ #ifdef POSIX_SIGNALS
+ sa.sa_handler = SIG_IGN;
+ (void) sigaction(SIGHUP, &sa, (struct sigaction *)0);
+ vhangup();
+ sa.sa_handler = SIG_DFL;
+ (void) sigaction(SIGHUP, &sa, (struct sigaction *)0);
+ #else
signal(SIGHUP, SIG_IGN);
vhangup();
signal(SIGHUP, SIG_DFL);
+ #endif
}
#endif
#endif /* VHANG_FIRST */
!
! #ifdef HAVE_SETSID
! (void) setsid();
#endif
t = open(line, O_RDWR);
***************
*** 605,611 ****
#endif /* VHANG_FIRST */
if (t < 0)
fatalperror(f, line);
! #ifdef __alpha
if(ioctl(t, TIOCSCTTY, 0) < 0) /* set controlling tty */
fatalperror(f, "setting controlling tty");
#endif
--- 615,621 ----
#endif /* VHANG_FIRST */
if (t < 0)
fatalperror(f, line);
! #ifdef TIOCSCTTY
if(ioctl(t, TIOCSCTTY, 0) < 0) /* set controlling tty */
fatalperror(f, "setting controlling tty");
#endif
***************
*** 613,620 ****
--- 623,636 ----
close(t);
#endif
#endif /* sysvimp */
+ #ifdef POSIX_SIGNALS
+ sa.sa_handler = cleanup;
+ (void) sigaction(SIGCHLD, &sa, (struct sigaction *)0);
+ (void) sigaction(SIGTERM, &sa, (struct sigaction *)0);
+ #else
signal(SIGCHLD, cleanup);
signal(SIGTERM, cleanup);
+ #endif
pid = fork();
if (pid < 0)
fatalperror(f, "", errno);
***************
*** 664,683 ****
#else
pid = getpgrp(getpid());
#endif
! #endif
! #ifdef POSIX_TERMIOS /* solaris */
/* we've already done setsid above. Just do tcsetpgrp here. */
tcsetpgrp(0, pid);
#else
- #ifndef hpux
ioctl(0, TIOCSPGRP, &pid);
- #else
- /* we've already done setsid above. Just do tcsetpgrp here. */
- tcsetpgrp(0, pid);
- #endif
#endif /* posix */
pid = 0; /*reset pid incase exec fails*/
! #endif
#ifdef STREAMS
if (line_push(t) < 0)
fatalperror(f, "IPUSH",errno);
--- 680,696 ----
#else
pid = getpgrp(getpid());
#endif
! #endif /* sysvimp */
!
! #ifdef POSIX_TERMIOS
/* we've already done setsid above. Just do tcsetpgrp here. */
tcsetpgrp(0, pid);
#else
ioctl(0, TIOCSPGRP, &pid);
#endif /* posix */
pid = 0; /*reset pid incase exec fails*/
! #endif /* !sysv || sysvimp */
!
#ifdef STREAMS
if (line_push(t) < 0)
fatalperror(f, "IPUSH",errno);
***************
*** 818,824 ****
--- 831,842 ----
#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);
+ #else
signal(SIGTSTP, SIG_IGN);
+ #endif
#ifdef hpux
setpgrp2(0, 0);
#else
***************
*** 895,907 ****
--- 913,935 ----
register pcc = 0, fcc = 0;
int cc;
char cntl;
+ #ifdef POSIX_SIGNALS
+ struct sigaction sa;
+ #endif
/*
* Must ignore SIGTTOU, otherwise we'll stop
* when we try and set slave pty's window shape
* (our controlling tty is the master pty).
*/
+ #ifdef POSIX_SIGNALS
+ (void) sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_IGN;
+ (void) sigaction(SIGTTOU, &sa, (struct sigaction *)0);
+ #else
signal(SIGTTOU, SIG_IGN);
+ #endif
#ifdef TIOCSWINSZ
send(f, oobdata, 1, MSG_OOB); /* indicate new rlogin */
#endif
***************
*** 1015,1021 ****
! int cleanup()
{
char *p;
--- 1043,1049 ----
! krb5_sigtype cleanup()
{
char *p;
***************
*** 1058,1063 ****
--- 1086,1094 ----
{
char buf[512];
int out = 1 ; /* Output queue of f */
+ #ifdef POSIX_SIGNALS
+ struct sigaction sa;
+ #endif
buf[0] = '\01'; /* error indicator */
(void) sprintf(buf + 1, "%s: %s.\r\n",progname, msg);
***************
*** 1067,1073 ****
--- 1098,1111 ----
(void) write(f, buf, strlen(buf));
syslog(LOG_ERR,"%s\n",msg);
if (pid > 0) {
+ #ifdef POSIX_SIGNALS
+ (void) sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_IGN;
+ (void) sigaction(SIGCHLD, &sa, (struct sigaction *)0);
+ #else
signal(SIGCHLD,SIG_IGN);
+ #endif
kill(pid,SIGKILL);
#ifdef TIOCFLUSH
(void) ioctl(f, TIOCFLUSH, (char *)&out);
***************
*** 1223,1228 ****
--- 1261,1267 ----
int nreturned = 0;
long net_len,rd_len;
int cc,retry;
+ unsigned char len_buf[4];
if (!do_encrypt)
return(read(fd, buf, len));
***************
*** 1240,1258 ****
nstored = 0;
}
! #ifdef BITS64
! rd_len = 0;
! if ((cc = krb5_net_read(fd, (char *)&rd_len + 4, 4)) != 4) {
! #else
! if ((cc = krb5_net_read(fd, (char *)&rd_len, sizeof(rd_len))) !=
! sizeof(rd_len)) {
! #endif
if ((cc < 0) && ((errno == EWOULDBLOCK) || (errno == EAGAIN)))
return(cc);
/* XXX can't read enough, pipe must have closed */
return(0);
}
! rd_len = ntohl(rd_len);
net_len = krb5_encrypt_size(rd_len,eblock.crypto_entry);
if (net_len < 0 || net_len > sizeof(des_inbuf)) {
/* XXX preposterous length, probably out of sync.
--- 1279,1292 ----
nstored = 0;
}
! if ((cc = krb5_net_read(fd, (char *)&len_buf, 4)) != 4) {
if ((cc < 0) && ((errno == EWOULDBLOCK) || (errno == EAGAIN)))
return(cc);
/* XXX can't read enough, pipe must have closed */
return(0);
}
! rd_len =
! ((len_buf[0]<<24) | (len_buf[1]<<16) | (len_buf[2]<<8) | len_buf[3]);
net_len = krb5_encrypt_size(rd_len,eblock.crypto_entry);
if (net_len < 0 || net_len > sizeof(des_inbuf)) {
/* XXX preposterous length, probably out of sync.
***************
*** 1263,1270 ****
retry = 0;
datard:
if ((cc = krb5_net_read(fd, desinbuf.data, net_len)) != net_len) {
! /* XXX can't read enough, pipe
! must have closed */
if ((cc < 0) && ((errno == EWOULDBLOCK) || (errno == EAGAIN))) {
retry++;
sleep(1);
--- 1297,1303 ----
retry = 0;
datard:
if ((cc = krb5_net_read(fd, desinbuf.data, net_len)) != net_len) {
! /* XXX can't read enough, pipe must have closed */
if ((cc < 0) && ((errno == EWOULDBLOCK) || (errno == EAGAIN))) {
retry++;
sleep(1);
***************
*** 1311,1317 ****
char *buf;
int len;
{
! long net_len;
if (!do_encrypt)
return(write(fd, buf, len));
--- 1344,1350 ----
char *buf;
int len;
{
! unsigned char len_buf[4];
if (!do_encrypt)
return(write(fd, buf, len));
***************
*** 1330,1342 ****
syslog(LOG_ERR,"Write encrypt problem.");
return(-1);
}
!
! net_len = htonl(len);
! #ifdef BITS64
! (void) write(fd,(char *)&net_len + 4, 4);
! #else
! (void) write(fd, &net_len, sizeof(net_len));
! #endif
if (write(fd, desoutbuf.data,desoutbuf.length) != desoutbuf.length){
syslog(LOG_ERR,"Could not write out all data.");
return(-1);
--- 1363,1374 ----
syslog(LOG_ERR,"Write encrypt problem.");
return(-1);
}
!
! len_buf[0] = (len & 0xff000000);
! len_buf[1] = (len & 0xff0000);
! len_buf[2] = (len & 0xff00);
! len_buf[3] = (len & 0xff);
! (void) write(fd, len_buf, 4);
if (write(fd, desoutbuf.data,desoutbuf.length) != desoutbuf.length){
syslog(LOG_ERR,"Could not write out all data.");
return(-1);
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/krsh.c,v
retrieving revision 5.10
diff -c -r5.10 krsh.c
*** krsh.c 1994/10/26 04:18:54 5.10
--- krsh.c 1994/11/03 00:23:08
***************
*** 101,106 ****
--- 101,107 ----
struct servent *sp;
#ifdef POSIX_SIGNALS
sigset_t omask, igmask;
+ struct sigaction sa, osa;
#else
int omask;
#endif
***************
*** 347,365 ****
sigaddset(&igmask, SIGQUIT);
sigaddset(&igmask, SIGTERM);
sigprocmask(SIG_BLOCK, &igmask, &omask);
#else
#ifdef sgi
omask = sigignore(mask(SIGINT)|mask(SIGQUIT)|mask(SIGTERM));
#else
omask = sigblock(mask(SIGINT)|mask(SIGQUIT)|mask(SIGTERM));
#endif
- #endif /* POSIX_SIGNALS */
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
signal(SIGINT, sendsig);
if (signal(SIGQUIT, SIG_IGN) != SIG_IGN)
signal(SIGQUIT, sendsig);
if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
signal(SIGTERM, sendsig);
if (nflag == 0) {
pid = fork();
if (pid < 0) {
--- 348,382 ----
sigaddset(&igmask, SIGQUIT);
sigaddset(&igmask, SIGTERM);
sigprocmask(SIG_BLOCK, &igmask, &omask);
+
+ (void)sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = sendsig;
+
+ (void)sigaction(SIGINT, (struct sigaction *)0, &osa);
+ if (osa.sa_handler != SIG_IGN)
+ (void)sigaction(SIGINT, &sa, (struct sigaction *)0);
+
+ (void)sigaction(SIGQUIT, (struct sigaction *)0, &osa);
+ if (osa.sa_handler != SIG_IGN)
+ (void)sigaction(SIGQUIT, &sa, (struct sigaction *)0);
+
+ (void)sigaction(SIGTERM, (struct sigaction *)0, &osa);
+ if (osa.sa_handler != SIG_IGN)
+ (void)sigaction(SIGTERM, &sa, (struct sigaction *)0);
#else
#ifdef sgi
omask = sigignore(mask(SIGINT)|mask(SIGQUIT)|mask(SIGTERM));
#else
omask = sigblock(mask(SIGINT)|mask(SIGQUIT)|mask(SIGTERM));
#endif
if (signal(SIGINT, SIG_IGN) != SIG_IGN)
signal(SIGINT, sendsig);
if (signal(SIGQUIT, SIG_IGN) != SIG_IGN)
signal(SIGQUIT, sendsig);
if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
signal(SIGTERM, sendsig);
+ #endif /* POSIX_SIGNALS */
if (nflag == 0) {
pid = fork();
if (pid < 0) {
***************
*** 455,461 ****
krb5_sigtype sendsig(signo)
char signo;
{
-
(void) write(rfd2, &signo, 1);
}
--- 472,477 ----
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/krshd.c,v
retrieving revision 5.13
diff -c -r5.13 krshd.c
*** krshd.c 1994/09/30 21:07:15 5.13
--- krshd.c 1994/11/04 16:59:11
***************
*** 479,491 ****
char *hostname;
short port;
int pv[2], cc;
! long ready, readfrom;
char buf[BUFSIZ], sig;
int one = 1;
krb5_sigtype cleanup();
int fd;
struct sockaddr_in fromaddr;
int non_privileged = 0;
#ifdef IP_TOS
/* solaris has IP_TOS, but only IPTOS_* values */
--- 479,494 ----
char *hostname;
short port;
int pv[2], cc;
! fd_set ready, readfrom;
char buf[BUFSIZ], sig;
int one = 1;
krb5_sigtype cleanup();
int fd;
struct sockaddr_in fromaddr;
int non_privileged = 0;
+ #ifdef POSIX_SIGNALS
+ struct sigaction sa;
+ #endif
#ifdef IP_TOS
/* solaris has IP_TOS, but only IPTOS_* values */
***************
*** 504,512 ****
--- 507,524 ----
fromaddr = *fromp;
+ #ifdef POSIX_SIGNALS
+ (void)sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_DFL;
+ (void)sigaction(SIGINT, &sa, (struct sigaction *)0);
+ (void)sigaction(SIGQUIT, &sa, (struct sigaction *)0);
+ (void)sigaction(SIGTERM, &sa, (struct sigaction *)0);
+ #else
signal(SIGINT, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
+ #endif
#ifdef DEBUG
{ int t = open("/dev/tty", 2);
if (t >= 0) {
***************
*** 1033,1048 ****
goto signout_please;
}
if (pid) {
signal(SIGINT, cleanup);
signal(SIGQUIT, cleanup);
signal(SIGTERM, cleanup);
signal(SIGPIPE, cleanup);
signal(SIGHUP, cleanup);
signal(SIGCHLD,SIG_IGN);
(void) close(0); (void) close(1); (void) close(2);
(void) close(f); (void) close(pv[1]);
! readfrom = (1L<<s) | (1L<<pv[0]);
ioctl(pv[0], FIONBIO, (char *)&one);
/* should set s nbio! */
do {
--- 1045,1074 ----
goto signout_please;
}
if (pid) {
+ #ifdef POSIX_SIGNALS
+ sa.sa_handler = cleanup;
+ (void)sigaction(SIGINT, &sa, (struct sigaction *)0);
+ (void)sigaction(SIGQUIT, &sa, (struct sigaction *)0);
+ (void)sigaction(SIGTERM, &sa, (struct sigaction *)0);
+ (void)sigaction(SIGPIPE, &sa, (struct sigaction *)0);
+ (void)sigaction(SIGHUP, &sa, (struct sigaction *)0);
+
+ sa.sa_handler = SIG_IGN;
+ (void)sigaction(SIGCHLD, &sa, (struct sigaction *)0);
+ #else
signal(SIGINT, cleanup);
signal(SIGQUIT, cleanup);
signal(SIGTERM, cleanup);
signal(SIGPIPE, cleanup);
signal(SIGHUP, cleanup);
signal(SIGCHLD,SIG_IGN);
+ #endif
(void) close(0); (void) close(1); (void) close(2);
(void) close(f); (void) close(pv[1]);
! FD_ZERO(&readfrom);
! FD_SET(s, &readfrom);
! FD_SET(pv[0], &readfrom);
ioctl(pv[0], FIONBIO, (char *)&one);
/* should set s nbio! */
do {
***************
*** 1050,1073 ****
if (select(16, &ready, (fd_set *)0,
(fd_set *)0, (struct timeval *)0) < 0)
break;
! if (ready & (1L<<s)) {
if (read(s, &sig, 1) <= 0)
! readfrom &= ~(1L<<s);
else {
signal(sig, cleanup);
killpg(pid, sig);
}
}
! if (ready & (1L<<pv[0])) {
errno = 0;
cc = read(pv[0], buf, sizeof (buf));
if (cc <= 0) {
shutdown(s, 1+1);
! readfrom &= ~(1L<<pv[0]);
} else
! (void) write(s, buf, cc);
}
! } while (readfrom);
#ifdef KERBEROS
syslog(LOG_INFO ,
"Shell process completed.");
--- 1076,1105 ----
if (select(16, &ready, (fd_set *)0,
(fd_set *)0, (struct timeval *)0) < 0)
break;
! if (FD_ISSET(s, &ready)) {
if (read(s, &sig, 1) <= 0)
! FD_CLR(s, &readfrom);
else {
+ #ifdef POSIX_SIGNALS
+ sa.sa_handler = cleanup;
+ (void)sigaction(sig, &sa, (struct sigaction *)0);
+ kill(-pid, sig);
+ #else
signal(sig, cleanup);
killpg(pid, sig);
+ #endif
}
}
! if (FD_ISSET(pv[0], &ready)) {
errno = 0;
cc = read(pv[0], buf, sizeof (buf));
if (cc <= 0) {
shutdown(s, 1+1);
! FD_CLR(pv[0], &readfrom);
} else
! (void) write(s, buf, cc);
}
! } while (FD_ISSET(s, &readfrom) || FD_ISSET(pv[0], &readfrom));
#ifdef KERBEROS
syslog(LOG_INFO ,
"Shell process completed.");
***************
*** 1173,1178 ****
--- 1205,1224 ----
krb5_sigtype
cleanup()
{
+ #ifdef POSIX_SIGNALS
+ struct sigaction sa;
+
+ (void)sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = SIG_IGN;
+ (void)sigaction(SIGINT, &sa, (struct sigaction *)0);
+ (void)sigaction(SIGQUIT, &sa, (struct sigaction *)0);
+ (void)sigaction(SIGTERM, &sa, (struct sigaction *)0);
+ (void)sigaction(SIGPIPE, &sa, (struct sigaction *)0);
+ (void)sigaction(SIGHUP, &sa, (struct sigaction *)0);
+
+ (void)kill(-pid, SIGTERM);
+ #else
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
signal(SIGTERM, SIG_IGN);
***************
*** 1180,1185 ****
--- 1226,1232 ----
signal(SIGHUP, SIG_IGN);
killpg(pid, SIGTERM);
+ #endif
wait(0);
#ifdef SYSV
***************
*** 1354,1360 ****
return;
}
! #endif CRAY
--- 1401,1407 ----
return;
}
! #endif /* CRAY */
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/login.c,v
retrieving revision 5.17
diff -c -r5.17 login.c
*** login.c 1994/10/28 00:08:14 5.17
--- login.c 1994/11/03 22:32:36
***************
*** 45,50 ****
--- 45,56 ----
* only one of: -r -h -k -K
*/
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+ #ifdef HAVE_STDLIB_H
+ #include <stdlib.h>
+ #endif
#include <sys/types.h>
#include <sys/param.h>
#ifdef OQUOTA
***************
*** 59,67 ****
#ifdef NEED_SYS_FCNTL_H
#include <sys/fcntl.h>
#endif
- #ifdef HAVE_UNISTD_H
- #include <unistd.h>
- #endif
#include <utmp.h>
#include <signal.h>
--- 65,70 ----
***************
*** 98,106 ****
#endif /* KRB4 */
#include "loginpaths.h"
- #ifdef POSIX
- #include <stdlib.h>
- #endif
#ifdef POSIX_TERMIOS
#include <termios.h>
#ifdef _AIX
--- 101,106 ----
***************
*** 212,223 ****
char * strsave();
#endif
! #ifdef POSIX
! typedef void sigtype;
! #else
! typedef int sigtype;
! #endif /* POSIX */
#define EXCL_AUTH_TEST if (rflag || kflag || Kflag || eflag || fflag || Fflag ) { \
fprintf(stderr, \
"login: only one of -r, -k, -K, -e, -F, and -f allowed.\n"); \
--- 212,220 ----
char * strsave();
#endif
! typedef RETSIGTYPE sigtype;
+
#define EXCL_AUTH_TEST if (rflag || kflag || Kflag || eflag || fflag || Fflag ) { \
fprintf(stderr, \
"login: only one of -r, -k, -K, -e, -F, and -f allowed.\n"); \
***************
*** 251,261 ****
--- 248,273 ----
#ifdef POSIX_TERMIOS
struct termios tc;
#endif
+ #ifdef POSIX_SIGNALS
+ struct sigaction sa;
+ #endif
+ #ifdef POSIX_SIGNALS
+ (void)sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = timedout;
+ (void)sigaction(SIGALRM, &sa, (struct sigaction *)0);
+ #else
(void)signal(SIGALRM, timedout);
+ #endif
(void)alarm((u_int)timeout);
+ #ifdef POSIX_SIGNALS
+ sa.sa_handler = SIG_IGN;
+ (void)sigaction(SIGALRM, &sa, (struct sigaction *)0);
+ #else
(void)signal(SIGQUIT, SIG_IGN);
(void)signal(SIGINT, SIG_IGN);
+ #endif
#ifdef HAVE_SETPRIORITY
(void)setpriority(PRIO_PROCESS, 0, 0 + PRIO_OFFSET);
#endif
***************
*** 946,955 ****
--- 958,977 ----
#ifndef OQUOTA
if (! access( QUOTAWARN, X_OK)) (void) system(QUOTAWARN);
#endif
+ #ifdef POSIX_SIGNALS
+ sa.sa_handler = SIG_DFL;
+ (void)sigaction(SIGALRM, &sa, (struct sigaction *)0);
+ (void)sigaction(SIGQUIT, &sa, (struct sigaction *)0);
+ (void)sigaction(SIGINT, &sa, (struct sigaction *)0);
+
+ sa.sa_handler = SIG_IGN;
+ (void)sigaction(SIGTSTP, &sa, (struct sigaction *)0);
+ #else
(void)signal(SIGALRM, SIG_DFL);
(void)signal(SIGQUIT, SIG_DFL);
(void)signal(SIGINT, SIG_DFL);
(void)signal(SIGTSTP, SIG_IGN);
+ #endif
tbuf[0] = '-';
(void) strcpy(tbuf + 1, (p = strrchr(pwd->pw_shell, '/')) ?
***************
*** 1008,1035 ****
#endif /* HAVE_TTYENT_H */
}
jmp_buf motdinterrupt;
motd()
{
register int fd, nchars;
- sigtype (*oldint)(), sigint();
char tbuf[8192];
if ((fd = open(MOTDFILE, O_RDONLY, 0)) < 0)
return;
oldint = signal(SIGINT, sigint);
if (setjmp(motdinterrupt) == 0)
while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0)
(void)write(fileno(stdout), tbuf, nchars);
(void)signal(SIGINT, oldint);
(void)close(fd);
}
sigtype
sigint()
{
longjmp(motdinterrupt, 1);
}
checknologin()
--- 1030,1087 ----
#endif /* HAVE_TTYENT_H */
}
+ #ifdef POSIX_SETJMP
+ sigjmp_buf motdinterrupt;
+ #else
jmp_buf motdinterrupt;
+ #endif
motd()
{
register int fd, nchars;
char tbuf[8192];
+ sigtype sigint();
+ #ifdef POSIX_SIGNALS
+ struct sigaction sa, osa;
+ #else
+ sigtype (*oldint)();
+ #endif
if ((fd = open(MOTDFILE, O_RDONLY, 0)) < 0)
return;
+ #ifdef POSIX_SIGNALS
+ (void)sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sa.sa_handler = sigint;
+ (void)sigaction(SIGINT, &sa, &osa);
+ #else
oldint = signal(SIGINT, sigint);
+ #endif
+ #ifdef POSIX_SETJMP
+ if (sigsetjmp(motdinterrupt, 1) == 0)
+ while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0)
+ (void)write(fileno(stdout), tbuf, nchars);
+ #else
if (setjmp(motdinterrupt) == 0)
while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0)
(void)write(fileno(stdout), tbuf, nchars);
+ #endif
+ #ifdef POSIX_SIGNALS
+ (void)sigaction(SIGINT, &osa, (struct sigaction *)0);
+ #else
(void)signal(SIGINT, oldint);
+ #endif
(void)close(fd);
}
sigtype
sigint()
{
+ #ifdef POSIX_SETJMP
+ siglongjmp(motdinterrupt, 1);
+ #else
longjmp(motdinterrupt, 1);
+ #endif
}
checknologin()
***************
*** 1313,1323 ****
* It exits only in the child process.
*/
#include <sys/wait.h>
- #ifdef WAIT_USES_INT
- #define WAIT_TYPE int
- #else
- #define WAIT_TYPE union wait
- #endif
void
dofork()
{
--- 1365,1370 ----
***************
*** 1333,1341 ****
(void) chdir("/"); /* Let's not keep the fs busy... */
/* If we're the parent, watch the child until it dies */
! while(wait((WAIT_TYPE *)0) != child)
! ;
!
/* Cleanup stuff */
/* Run dest_tkt to destroy tickets */
(void) dest_tkt(); /* If this fails, we lose quietly */
--- 1380,1395 ----
(void) chdir("/"); /* Let's not keep the fs busy... */
/* If we're the parent, watch the child until it dies */
! #ifdef HAVE_WAITPID
! (void)waitpid(child, 0, 0);
! #else
! #ifdef WAIT_USES_INT
! while(wait((int *)0) != child) /*void*/ ;
! #else
! while(wait((union wait *)0) != child) /*void*/ ;
! #endif
! #endif
!
/* Cleanup stuff */
/* Run dest_tkt to destroy tickets */
(void) dest_tkt(); /* If this fails, we lose quietly */
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/logutil.c,v
retrieving revision 5.8
diff -c -r5.8 logutil.c
*** logutil.c 1994/10/03 17:22:44 5.8
--- logutil.c 1994/11/03 19:30:46
***************
*** 15,20 ****
--- 15,23 ----
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
#include <sys/types.h>
#include <sys/file.h>
#include <utmp.h>
***************
*** 25,33 ****
#ifdef NEED_SYS_FCNTL_H
#include <sys/fcntl.h>
#endif
- #ifdef HAVE_UNISTD_H
- #include <unistd.h>
- #endif
#ifndef UTMP_FILE
#define UTMP_FILE "/etc/utmp"
--- 28,33 ----
***************
*** 131,137 ****
{
struct utmp ut;
struct stat buf;
- time_t time();
if (fd < 0 && (fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0)) < 0)
return;
--- 131,136 ----