From 66d6c27e169199d67979c2a329e87622508bcf39 Mon Sep 17 00:00:00 2001 From: mouring Date: Wed, 18 Oct 2000 00:02:25 +0000 Subject: [PATCH] - (bal) Changed from GNU rx to PCRE on suggestion from djm. - (bal) Integrated Sony NEWS-OS patches from NAKAJI Hirouyuki --- ChangeLog | 3 +++ INSTALL | 4 ++-- acconfig.h | 10 ++++++++-- compat.c | 4 ++-- configure.in | 15 ++++++++++++++- defines.h | 4 ++++ includes.h | 1 + news4-posix.c | 39 +++++++++++++++++++++++++++++++++++++++ news4-posix.h | 35 +++++++++++++++++++++++++++++++++++ pty.c | 4 ++++ 10 files changed, 112 insertions(+), 7 deletions(-) create mode 100644 news4-posix.c create mode 100644 news4-posix.h diff --git a/ChangeLog b/ChangeLog index 2070718c..3d3a04a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ - (djm) Don't rely on atomicio's retval to determine length of askpass supplied passphrase. Problem report from Lutz Jaenicke + - (bal) Changed from GNU rx to PCRE on suggestion from djm. + - (bal) Integrated Sony NEWS-OS patches from NAKAJI Hirouyuki + 20001016 - (djm) Sync with OpenBSD: diff --git a/INSTALL b/INSTALL index b201eccd..9112b92b 100644 --- a/INSTALL +++ b/INSTALL @@ -40,8 +40,8 @@ ftp://ftp.gnu.org/gnu/make/ OpenSSH has only been tested with GNU make. It may work with other 'make' programs, but you are on your own. -GNU rx: -ftp:://ftp.gnu.org/gnu/rx/ +pcre (POSIX Regular Expression library): +ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/ Most platforms do not required this. However older 4.3 BSD do not have a posix regex library. diff --git a/acconfig.h b/acconfig.h index d212b90f..0837eb3f 100644 --- a/acconfig.h +++ b/acconfig.h @@ -52,8 +52,8 @@ /* Define if you are on Cygwin */ #undef HAVE_CYGWIN -/* Define if you lack native POSIX regex and you are using GNU rx library */ -#undef HAVE_LIBRX +/* Define if you lack native POSIX regex and you are using PCRE */ +#undef HAVE_LIBPCRE /* Define if you have a broken realpath. */ #undef BROKEN_REALPATH @@ -61,6 +61,9 @@ /* Define if you are on NeXT */ #undef HAVE_NEXT +/* Define if you are on NEWS-OS */ +#undef HAVE_NEWS4 + /* Define if you want to disable PAM support */ #undef DISABLE_PAM @@ -254,6 +257,9 @@ /* Use IPv4 for connection by default, IPv6 can still if explicity asked */ #undef IPV4_DEFAULT +/* If you have no atexit() but xatexit(), and want to use xatexit() */ +#undef HAVE_XATEXIT + /* getaddrinfo is broken (if present) */ #undef BROKEN_GETADDRINFO diff --git a/compat.c b/compat.c index 0e12b77c..49bc0519 100644 --- a/compat.c +++ b/compat.c @@ -29,8 +29,8 @@ RCSID("$OpenBSD: compat.c,v 1.25 2000/10/14 12:16:56 markus Exp $"); #include "packet.h" #include "xmalloc.h" #include "compat.h" -#ifdef HAVE_LIBRX -# include +#ifdef HAVE_LIBPCRE +# include #else /* Use native regex libraries */ # include #endif /* HAVE_LIBRX */ diff --git a/configure.in b/configure.in index c859b66d..1a57583f 100644 --- a/configure.in +++ b/configure.in @@ -119,6 +119,13 @@ case "$host" in AC_DEFINE(PAM_TTY_KLUDGE) inet6_default_4in6=yes ;; +mips-sony-bsd|mips-sony-newsos4) + AC_DEFINE(HAVE_NEWS4) + SONY=1 + AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT), + AC_MSG_ERROR([*** libiberty missing - please install first ***]) + ) + ;; *-*-netbsd*) need_dash_r=1 ;; @@ -257,7 +264,8 @@ AC_ARG_WITH(libs, # Checks for libraries. AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***])) AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil") -AC_CHECK_LIB(rx, regcomp, AC_DEFINE(HAVE_LIBRX) LIBS="$LIBS -lrx") +AC_CHECK_LIB(pcre, pcre_info, + AC_DEFINE(HAVE_LIBPCRE) LIBS="$LIBS -lpcreposix -lpcre") if test -z "$no_libsocket" ; then AC_CHECK_LIB(nsl, yp_match, , ) @@ -490,6 +498,11 @@ else fi fi +# Cheap hack to ensure NEWS-OS libraries are arranged right. +if test ! -z "$SONY" ; then + LIBS="$LIBS -liberty"; +fi + # Checks for data types AC_CHECK_SIZEOF(char, 1) AC_CHECK_SIZEOF(short int, 2) diff --git a/defines.h b/defines.h index 323ff29b..79d98e2e 100644 --- a/defines.h +++ b/defines.h @@ -354,6 +354,10 @@ struct winsize { #if !defined(HAVE_ATEXIT) && defined(HAVE_ON_EXIT) # define atexit(a) on_exit(a) +#else +# if defined(HAVE_XATEXIT) +# define atexit(a) xatexit(a) +# endif /* defined(HAVE_XATEXIT) */ #endif /* !defined(HAVE_ATEXIT) && defined(HAVE_ON_EXIT) */ #if defined(HAVE_VHANGUP) && !defined(BROKEN_VHANGUP) diff --git a/includes.h b/includes.h index 797c5e85..91606632 100644 --- a/includes.h +++ b/includes.h @@ -20,6 +20,7 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } #include "config.h" #include "next-posix.h" +#include "news4-posix.h" #include #include diff --git a/news4-posix.c b/news4-posix.c new file mode 100644 index 00000000..b1a289f7 --- /dev/null +++ b/news4-posix.c @@ -0,0 +1,39 @@ +#include "config.h" + +#ifdef HAVE_NEWS4 +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "xmalloc.h" +#include "ssh.h" +#include "news4-posix.h" + +int +waitpid(int pid, int *stat_loc, int options) +{ + if (pid <= 0) { + if (pid != -1) { + errno = EINVAL; + return -1; + } + pid = 0; /* wait4() expects pid=0 for indiscriminate wait. */ + } + return wait4(pid, (union wait *)stat_loc, options, NULL); +} + +#endif /* HAVE_NEWS4 */ diff --git a/news4-posix.h b/news4-posix.h new file mode 100644 index 00000000..87406793 --- /dev/null +++ b/news4-posix.h @@ -0,0 +1,35 @@ +/* + * Defines and prototypes specific to News4 system + */ + +#ifndef _NEWS4_POSIX_H +#define _NEWS4_POSIX_H + +#ifdef HAVE_NEWS4 + +#include + +typedef long clock_t; + +/* FILE */ +#define O_NONBLOCK 00004 /* non-blocking open */ + +/* WAITPID */ +#undef WIFEXITED +#undef WIFSTOPPED +#undef WIFSIGNALED + +#define _W_INT(w) (*(int*)&(w)) /* convert union wait to int */ +#define WIFEXITED(w) (!((_W_INT(w)) & 0377)) +#define WIFSTOPPED(w) ((_W_INT(w)) & 0100) +#define WIFSIGNALED(w) (!WIFEXITED(w) && !WIFSTOPPED(w)) +#define WEXITSTATUS(w) (int)(WIFEXITED(w) ? ((_W_INT(w) >> 8) & 0377) : -1) +#define WTERMSIG(w) (int)(WIFSIGNALED(w) ? (_W_INT(w) & 0177) : -1) +#define WCOREFLAG 0x80 +#define WCOREDUMP(w) ((_W_INT(w)) & WCOREFLAG) + +int waitpid(int pid,int *stat_loc,int options); +#define setsid() setpgrp(0, getpid()) + +#endif /* HAVE_NEWS4 */ +#endif /* _NEWS4_POSIX_H */ diff --git a/pty.c b/pty.c index cbbe5845..04004d20 100644 --- a/pty.c +++ b/pty.c @@ -242,6 +242,10 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname) */ ioctl(*ttyfd, TIOCSCTTY, NULL); #endif /* TIOCSCTTY */ +#ifdef HAVE_NEWS4 + if (setpgrp(0,0) < 0) + error("SETPGRP %s",strerror(errno)); +#endif /* HAVE_NEWS4 */ #ifdef USE_VHANGUP old = signal(SIGHUP, SIG_IGN); vhangup(); -- 2.45.1