- (djm) Started merge of Ben Lindstrom's <mouring@pconline.com> NeXT support

This commit is contained in:
Damien Miller 2000-06-18 15:43:25 +10:00
Родитель f6d9e22189
Коммит 0f91b4e3a1
9 изменённых файлов: 306 добавлений и 5 удалений

Просмотреть файл

@ -8,6 +8,7 @@ Andre Lucas <andre.lucas@dial.pipex.com> - new login code, many fixes
Andrew McGill <andrewm@datrix.co.za> - SCO fixes
Andy Sloane <andy@guildsoftware.com> - bugfixes
Arkadiusz Miskiewicz <misiek@pld.org.pl> - IPv6 compat fixes
Ben Lindstrom <mouring@pconline.com> - NeXT support
Ben Taylor <bent@clark.net> - Solaris debugging and fixes
Bratislav ILICH <bilic@zepter.ru> - Configure fix
Chip Salzenberg <chip@valinux.com> - Assorted patches

Просмотреть файл

@ -8,6 +8,7 @@
Martin Petrak <petrak@spsknm.schools.sk>
- (djm) Include sys/types.h when including netinet/in.h in configure tests.
Patch from Jun-ichiro itojun Hagino <itojun@iijlab.net>
- (djm) Started merge of Ben Lindstrom's <mouring@pconline.com> NeXT support
- OpenBSD CVS updates:
- deraadt@cvs.openbsd.org 2000/06/17 09:58:46
[channels.c]

Просмотреть файл

@ -36,7 +36,7 @@ TARGETS=ssh sshd ssh-add ssh-keygen ssh-agent scp $(EXTRA_TARGETS)
LIBSSH_OBJS=atomicio.o authfd.o authfile.o aux.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o dispatch.o dsa.o fingerprint.o hmac.o hostfile.o key.o kex.o log.o match.o mpaux.o nchan.o packet.o radix.o entropy.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o uuencode.o xmalloc.o
LIBOPENBSD_COMPAT_OBJS=bsd-base64.o bsd-bindresvport.o bsd-daemon.o bsd-misc.o bsd-mktemp.o bsd-rresvport.o bsd-setenv.o bsd-snprintf.o bsd-strlcat.o bsd-strlcpy.o fake-getaddrinfo.o fake-getnameinfo.o
LIBOPENBSD_COMPAT_OBJS=bsd-base64.o bsd-bindresvport.o bsd-daemon.o bsd-misc.o bsd-mktemp.o bsd-rresvport.o bsd-setenv.o bsd-snprintf.o bsd-strlcat.o bsd-strlcpy.o fake-getaddrinfo.o fake-getnameinfo.o next-posix.o
SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o log-client.o readconf.o clientloop.o

Просмотреть файл

@ -6,6 +6,9 @@
@TOP@
/* Define if you are on NeXT */
#undef HAVE_NEXT
/* Define if you want to disable PAM support */
#undef DISABLE_PAM
@ -153,6 +156,8 @@
#undef HAVE_SOCKLEN_T
#undef HAVE_SIZE_T
#undef HAVE_SSIZE_T
#undef HAVE_MODE_T
#undef HAVE_PID_T
#undef HAVE_STRUCT_SOCKADDR_STORAGE
#undef HAVE_STRUCT_ADDRINFO
#undef HAVE_STRUCT_IN6_ADDR

Просмотреть файл

@ -102,6 +102,17 @@ case "$host" in
*-*-netbsd*)
need_dash_r=1
;;
*-next-*)
# hardwire lastlog location (can't detect it on some versions)
conf_lastlog_location="/usr/adm/lastlog"
AC_DEFINE(HAVE_NEXT)
CFLAGS="$CFLAGS -I/usr/local/include"
MAIL=/usr/spool/mail
conf_utmp_location=/etc/utmp
AC_MSG_WARN([*** Tested: PA-RISC/m68k Untested: Sparc/Intel])
AC_MSG_WARN([*** Expect 'scp' to fail!])
AC_MSG_WARN([*** Please report any problems, thanks])
;;
*-*-solaris*)
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib"
@ -178,7 +189,7 @@ if test -z "$no_libnsl" ; then
fi
# Checks for header files.
AC_CHECK_HEADERS(bstring.h endian.h lastlog.h limits.h login.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h util.h utmp.h utmpx.h)
AC_CHECK_HEADERS(bstring.h endian.h lastlog.h limits.h login.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h util.h utmp.h utmpx.h)
# Checks for library functions.
AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage innetgr md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid snprintf strlcat strlcpy vsnprintf vhangup _getpty __b64_ntop)
@ -491,6 +502,34 @@ if test "x$ac_cv_have_ssize_t" = "xyes" ; then
AC_DEFINE(HAVE_SSIZE_T)
fi
AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
],
[ pid_t foo; foo = 1235; ],
[ ac_cv_have_pid_t="yes" ],
[ ac_cv_have_pid_t="no" ]
)
])
if test "x$ac_cv_have_pid_t" = "xyes" ; then
AC_DEFINE(HAVE_PID_T)
fi
AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
AC_TRY_COMPILE(
[
#include <sys/types.h>
],
[ mode_t foo; foo = 1235; ],
[ ac_cv_have_mode_t="yes" ],
[ ac_cv_have_mode_t="no" ]
)
])
if test "x$ac_cv_have_mode_t" = "xyes" ; then
AC_DEFINE(HAVE_MODE_T)
fi
AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
AC_TRY_COMPILE(

Просмотреть файл

@ -30,6 +30,11 @@
#ifdef HAVE_SYS_SYSMACROS_H
# include <sys/sysmacros.h> /* For MIN, MAX, etc */
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h> /* For S_* constants and macros */
#endif
#include <unistd.h> /* For STDIN_FILENO, etc */
/* Constants */
@ -61,6 +66,37 @@ enum
# endif /* PATH_MAX */
#endif /* MAXPATHLEN */
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
#endif
#ifndef STDOUT_FILENO
# define STDOUT_FILENO 1
#endif
#ifndef STDERR_FILENO
# define STDERR_FILENO 2
#endif
#ifndef S_ISREG
# define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR))
# define S_ISREG(mode) (((mode) & (_S_IFMT)) == (_S_IFREG))
#endif /* S_ISREG */
#ifndef S_IXUSR
# define S_IXUSR 0000100 /* execute/search permission, */
# define S_IXGRP 0000010 /* execute/search permission, */
# define S_IXOTH 0000001 /* execute/search permission, */
# define _S_IWUSR 0000200 /* write permission, */
# define S_IWUSR _S_IWUSR /* write permission, owner */
# define S_IWGRP 0000020 /* write permission, group */
# define S_IWOTH 0000002 /* write permission, other */
# define S_IRUSR 0000400 /* read permission, owner */
# define S_IRGRP 0000040 /* read permission, group */
# define S_IROTH 0000004 /* read permission, other */
# define S_IRWXU 0000700 /* read, write, execute */
# define S_IRWXG 0000070 /* read, write, execute */
# define S_IRWXO 0000007 /* read, write, execute */
#endif /* S_IXUSR */
/* Types */
/* If sys/types.h does not supply intXX_t, supply them ourselves */
@ -151,6 +187,16 @@ typedef int ssize_t;
# define HAVE_SSIZE_T
#endif /* HAVE_SSIZE_T */
#ifndef HAVE_PID_T
typedef int pid_t;
# define HAVE_PID_T
#endif /* HAVE_PID_T */
#ifndef HAVE_MODE_T
typedef int mode_t;
# define HAVE_MODE_T
#endif /* HAVE_MODE_T */
#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
# define ss_family __ss_family
#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */
@ -327,5 +373,4 @@ typedef int ssize_t;
/** end of login recorder definitions */
#endif /* _DEFINES_H */

Просмотреть файл

@ -21,10 +21,11 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
#include "config.h"
#include "next-posix.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/un.h>
#include <sys/resource.h>
@ -44,7 +45,6 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
#include <stdarg.h>
#include <pwd.h>
#include <grp.h>
#include <unistd.h>
#include <time.h>
#include <dirent.h>

148
next-posix.c Normal file
Просмотреть файл

@ -0,0 +1,148 @@
#include "config.h"
#ifdef HAVE_NEXT
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/file.h>
#include <errno.h>
#include <termios.h>
#include <sys/wait.h>
#ifdef HAVE_STDDEF_H
#include <stddef.h>
#endif
#include "xmalloc.h"
#include "ssh.h"
#include "next-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);
}
pid_t setsid(void)
{
return setpgrp(0, getpid());
}
int
tcgetattr(int fd, struct termios *t)
{
return (ioctl(fd, TIOCGETA, t));
}
int
tcsetattr(int fd, int opt, const struct termios *t)
{
struct termios localterm;
if (opt & TCSASOFT) {
localterm = *t;
localterm.c_cflag |= CIGNORE;
t = &localterm;
}
switch (opt & ~TCSASOFT) {
case TCSANOW:
return (ioctl(fd, TIOCSETA, t));
case TCSADRAIN:
return (ioctl(fd, TIOCSETAW, t));
case TCSAFLUSH:
return (ioctl(fd, TIOCSETAF, t));
default:
errno = EINVAL;
return (-1);
}
}
int tcsetpgrp(int fd, pid_t pgrp)
{
int s;
s = pgrp;
return (ioctl(fd, TIOCSPGRP, &s));
}
speed_t cfgetospeed(const struct termios *t)
{
return (t->c_ospeed);
}
speed_t cfgetispeed(const struct termios *t)
{
return (t->c_ispeed);
}
int
cfsetospeed(struct termios *t,int speed)
{
t->c_ospeed = speed;
return (0);
}
int
cfsetispeed(struct termios *t, speed_t speed)
{
t->c_ispeed = speed;
return (0);
}
#if 0
/*define sigset_t int*/
/* This whole thing is insane. It's purely wrong, but it's a first
go a it. -bl */
int sigemptyset(sigset_t *set)
{
return 0;
}
int sigaddset(sigset_t *set, int signum)
{
*set |= (1 << (signum - 1));
return set;
}
int sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
{
switch(how) {
case SIG_BLOCK:
return 0;
case SIG_UNBLOCK:
return ( 0 & ~ *set);
default:
return 0;
}
}
int sigsuspend(const sigset_t *mask)
{
}
int sigaction(int signum,const struct sigaction *act, struct sigaction *oldact)
{
}
#endif /* 0 */
#endif /* HAVE_NEXT */

62
next-posix.h Normal file
Просмотреть файл

@ -0,0 +1,62 @@
/*
* Defines and prototypes specific to NeXT system
*/
#ifndef _NEXT_POSIX_H
#define _NEXT_POSIX_H
#ifdef HAVE_NEXT
#include <libc.h>
#include <sys/dir.h>
/* 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(x) && !WIFSTOPPED(x))
#define WEXITSTATUS(w) (int)(WIFEXITED(x) ? ((_W_INT(w) >> 8) & 0377) : -1)
#define WTERMSIG(w) (int)(WIFSIGNALED(x) ? (_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 getpgrp() getpgrp(0)
pid_t setsid(void);
/* TC */
int tcgetattr(int fd,struct termios *t);
int tcsetattr(int fd,int opt,const struct termios *t);
int tcsetpgrp(int fd, pid_t pgrp);
speed_t cfgetospeed(const struct termios *t);
speed_t cfgetispeed(const struct termios *t);
int cfsetospeed(struct termios *t,int speed);
/* Sig*() */
typedef sigset_t;
#define SIG_BLOCK 00
#define SIG_UNBLOCK 01
#define SIG_SETMASK 02
#define SA_RESTART 00
struct sigaction {
void (*sa_handler)();
sigset_t sa_mask;
int sa_flags;
};
int sigemptyset(sigset_t *set);
int sigaddset(sigset_t *set, int signum);
int sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
int sigsuspend(const sigset_t *mask);
int sigaction(int signum,const struct sigaction *act, struct sigaction *oldact);
#endif /* HAVE_NEXT */
#endif /* _NEXT_POSIX_H */