From 35fc74edd5b4c86095926b63a2e984e7df33a367 Mon Sep 17 00:00:00 2001 From: dtucker Date: Fri, 27 May 2005 11:13:40 +0000 Subject: [PATCH] - (dtucker) [acconfig.h configure.ac defines.h includes.h sshpty.c openbsd-compat/bsd-misc.c] Add support for Ultrix. No, that's not a typo. Required changes from Bernhard Simon, integrated by me. ok djm@ --- ChangeLog | 3 +++ acconfig.h | 3 --- configure.ac | 12 +++++++++--- defines.h | 8 ++++++++ includes.h | 4 ++++ openbsd-compat/bsd-misc.c | 18 ++++++++++++++++++ sshpty.c | 4 ++-- 7 files changed, 44 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9e947d6..168c4624 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 20050527 - (djm) [defines.h] Use our realpath if we have to define PATH_MAX, spotted by David Leach; ok dtucker@ + - (dtucker) [acconfig.h configure.ac defines.h includes.h sshpty.c + openbsd-compat/bsd-misc.c] Add support for Ultrix. No, that's not a typo. + Required changes from Bernhard Simon, integrated by me. ok djm@ 20050525 - (djm) [mpaux.c mpaux.h Makefile.in] Remove old mpaux.[ch] code, it has not diff --git a/acconfig.h b/acconfig.h index 6a3d65d7..e303dc02 100644 --- a/acconfig.h +++ b/acconfig.h @@ -119,9 +119,6 @@ /* Define if you are on NeXT */ #undef HAVE_NEXT -/* Define if you are on NEWS-OS */ -#undef HAVE_NEWS4 - /* Define if you want to enable PAM support */ #undef USE_PAM diff --git a/configure.ac b/configure.ac index f9621d1b..3ac47496 100644 --- a/configure.ac +++ b/configure.ac @@ -278,7 +278,7 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) esac ;; mips-sony-bsd|mips-sony-newsos4) - AC_DEFINE(HAVE_NEWS4) + AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty]) SONY=1 ;; *-*-netbsd*) @@ -477,6 +477,12 @@ mips-sony-bsd|mips-sony-newsos4) AC_DEFINE(MISSING_HOWMANY) AC_DEFINE(MISSING_FD_MASK) ;; + +*-*-ultrix*) + AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1]) + AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files]) + AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty]) + AC_CHECK_HEADERS(sys/syslog.h) esac # Allow user to specify flags @@ -929,8 +935,8 @@ AC_CHECK_FUNCS(\ mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \ pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \ setdtablesize setegid setenv seteuid setgroups setlogin setpcred \ - setproctitle setregid setreuid setrlimit \ - setsid setvbuf sigaction sigvec snprintf socketpair strerror \ + setproctitle setregid setreuid setrlimit setsid setvbuf \ + sigaction sigvec snprintf socketpair strdup strerror \ strlcat strlcpy strmode strnvis strtonum strtoul sysconf tcgetpgrp \ truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \ ) diff --git a/defines.h b/defines.h index e88f4420..081ccd29 100644 --- a/defines.h +++ b/defines.h @@ -668,4 +668,12 @@ struct winsize { /** end of login recorder definitions */ +#ifdef BROKEN_GETGROUPS +# define getgroups(a,b) ((a)==0 && (b)==NULL ? NGROUPS_MAX : getgroups((a),(b))) +#endif + +#if defined(HAVE_MMAP) && defined(BROKEN_MMAP) +# undef HAVE_MMAP +#endif + #endif /* _DEFINES_H */ diff --git a/includes.h b/includes.h index 1625f8e3..89ae26d0 100644 --- a/includes.h +++ b/includes.h @@ -181,6 +181,10 @@ static /**/const char *const rcsid[] = { (const char *)rcsid, "\100(#)" msg } # include #endif +#if defined(HAVE_SYS_SYSLOG_H) +# include +#endif + /* * On HP-UX 11.11, shadow.h and prot.h provide conflicting declarations * of getspnam when _INCLUDE__STDC__ is defined, so we unset it here. diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index 8e49321b..56afa097 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c @@ -212,3 +212,21 @@ mysignal(int sig, mysig_t act) return (signal(sig, act)); #endif } + +#ifndef HAVE_STRDUP +char * +strdup(const char *str) +{ + size_t len; + char *cp; + + len = strlen(str) + 1; + cp = malloc(len); + if (cp != NULL) + if (strlcpy(cp, str, len) != len) { + free(cp); + return NULL; + } + return cp; +} +#endif diff --git a/sshpty.c b/sshpty.c index efd1dfef..36788c4d 100644 --- a/sshpty.c +++ b/sshpty.c @@ -128,10 +128,10 @@ pty_make_controlling_tty(int *ttyfd, const char *tty) if (ioctl(*ttyfd, TIOCSCTTY, NULL) < 0) error("ioctl(TIOCSCTTY): %.100s", strerror(errno)); #endif /* TIOCSCTTY */ -#ifdef HAVE_NEWS4 +#ifdef NEED_SETPGRP if (setpgrp(0,0) < 0) error("SETPGRP %s",strerror(errno)); -#endif /* HAVE_NEWS4 */ +#endif /* NEED_SETPGRP */ #ifdef USE_VHANGUP old = signal(SIGHUP, SIG_IGN); vhangup(); -- 2.45.1