summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CREDITS1
-rw-r--r--ChangeLog1
-rw-r--r--Makefile.in2
-rw-r--r--acconfig.h5
-rw-r--r--configure.in41
-rw-r--r--defines.h47
-rw-r--r--includes.h4
-rw-r--r--next-posix.c148
-rw-r--r--next-posix.h62
9 files changed, 306 insertions, 5 deletions
diff --git a/CREDITS b/CREDITS
index 8d7014bbf..977129388 100644
--- a/CREDITS
+++ b/CREDITS
@@ -8,6 +8,7 @@ Andre Lucas <andre.lucas@dial.pipex.com> - new login code, many fixes
8Andrew McGill <andrewm@datrix.co.za> - SCO fixes 8Andrew McGill <andrewm@datrix.co.za> - SCO fixes
9Andy Sloane <andy@guildsoftware.com> - bugfixes 9Andy Sloane <andy@guildsoftware.com> - bugfixes
10Arkadiusz Miskiewicz <misiek@pld.org.pl> - IPv6 compat fixes 10Arkadiusz Miskiewicz <misiek@pld.org.pl> - IPv6 compat fixes
11Ben Lindstrom <mouring@pconline.com> - NeXT support
11Ben Taylor <bent@clark.net> - Solaris debugging and fixes 12Ben Taylor <bent@clark.net> - Solaris debugging and fixes
12Bratislav ILICH <bilic@zepter.ru> - Configure fix 13Bratislav ILICH <bilic@zepter.ru> - Configure fix
13Chip Salzenberg <chip@valinux.com> - Assorted patches 14Chip Salzenberg <chip@valinux.com> - Assorted patches
diff --git a/ChangeLog b/ChangeLog
index b367ddc40..aa62aede5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
8 Martin Petrak <petrak@spsknm.schools.sk> 8 Martin Petrak <petrak@spsknm.schools.sk>
9 - (djm) Include sys/types.h when including netinet/in.h in configure tests. 9 - (djm) Include sys/types.h when including netinet/in.h in configure tests.
10 Patch from Jun-ichiro itojun Hagino <itojun@iijlab.net> 10 Patch from Jun-ichiro itojun Hagino <itojun@iijlab.net>
11 - (djm) Started merge of Ben Lindstrom's <mouring@pconline.com> NeXT support
11 - OpenBSD CVS updates: 12 - OpenBSD CVS updates:
12 - deraadt@cvs.openbsd.org 2000/06/17 09:58:46 13 - deraadt@cvs.openbsd.org 2000/06/17 09:58:46
13 [channels.c] 14 [channels.c]
diff --git a/Makefile.in b/Makefile.in
index 4037bfe8a..b18444d3d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -36,7 +36,7 @@ TARGETS=ssh sshd ssh-add ssh-keygen ssh-agent scp $(EXTRA_TARGETS)
36 36
37LIBSSH_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 37LIBSSH_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
38 38
39LIBOPENBSD_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 39LIBOPENBSD_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
40 40
41SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o log-client.o readconf.o clientloop.o 41SSHOBJS= ssh.o sshconnect.o sshconnect1.o sshconnect2.o log-client.o readconf.o clientloop.o
42 42
diff --git a/acconfig.h b/acconfig.h
index 0a08ee6af..6e92e962a 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -6,6 +6,9 @@
6 6
7@TOP@ 7@TOP@
8 8
9/* Define if you are on NeXT */
10#undef HAVE_NEXT
11
9/* Define if you want to disable PAM support */ 12/* Define if you want to disable PAM support */
10#undef DISABLE_PAM 13#undef DISABLE_PAM
11 14
@@ -153,6 +156,8 @@
153#undef HAVE_SOCKLEN_T 156#undef HAVE_SOCKLEN_T
154#undef HAVE_SIZE_T 157#undef HAVE_SIZE_T
155#undef HAVE_SSIZE_T 158#undef HAVE_SSIZE_T
159#undef HAVE_MODE_T
160#undef HAVE_PID_T
156#undef HAVE_STRUCT_SOCKADDR_STORAGE 161#undef HAVE_STRUCT_SOCKADDR_STORAGE
157#undef HAVE_STRUCT_ADDRINFO 162#undef HAVE_STRUCT_ADDRINFO
158#undef HAVE_STRUCT_IN6_ADDR 163#undef HAVE_STRUCT_IN6_ADDR
diff --git a/configure.in b/configure.in
index f0edebacc..3671f50cf 100644
--- a/configure.in
+++ b/configure.in
@@ -102,6 +102,17 @@ case "$host" in
102*-*-netbsd*) 102*-*-netbsd*)
103 need_dash_r=1 103 need_dash_r=1
104 ;; 104 ;;
105*-next-*)
106 # hardwire lastlog location (can't detect it on some versions)
107 conf_lastlog_location="/usr/adm/lastlog"
108 AC_DEFINE(HAVE_NEXT)
109 CFLAGS="$CFLAGS -I/usr/local/include"
110 MAIL=/usr/spool/mail
111 conf_utmp_location=/etc/utmp
112 AC_MSG_WARN([*** Tested: PA-RISC/m68k Untested: Sparc/Intel])
113 AC_MSG_WARN([*** Expect 'scp' to fail!])
114 AC_MSG_WARN([*** Please report any problems, thanks])
115 ;;
105*-*-solaris*) 116*-*-solaris*)
106 CFLAGS="$CFLAGS -I/usr/local/include" 117 CFLAGS="$CFLAGS -I/usr/local/include"
107 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib" 118 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
178fi 189fi
179 190
180# Checks for header files. 191# Checks for header files.
181AC_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) 192AC_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)
182 193
183# Checks for library functions. 194# Checks for library functions.
184AC_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) 195AC_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
491 AC_DEFINE(HAVE_SSIZE_T) 502 AC_DEFINE(HAVE_SSIZE_T)
492fi 503fi
493 504
505AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
506 AC_TRY_COMPILE(
507 [
508#include <sys/types.h>
509 ],
510 [ pid_t foo; foo = 1235; ],
511 [ ac_cv_have_pid_t="yes" ],
512 [ ac_cv_have_pid_t="no" ]
513 )
514])
515if test "x$ac_cv_have_pid_t" = "xyes" ; then
516 AC_DEFINE(HAVE_PID_T)
517fi
518
519AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
520 AC_TRY_COMPILE(
521 [
522#include <sys/types.h>
523 ],
524 [ mode_t foo; foo = 1235; ],
525 [ ac_cv_have_mode_t="yes" ],
526 [ ac_cv_have_mode_t="no" ]
527 )
528])
529if test "x$ac_cv_have_mode_t" = "xyes" ; then
530 AC_DEFINE(HAVE_MODE_T)
531fi
532
494 533
495AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [ 534AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
496 AC_TRY_COMPILE( 535 AC_TRY_COMPILE(
diff --git a/defines.h b/defines.h
index 871adbf4f..974f1bad4 100644
--- a/defines.h
+++ b/defines.h
@@ -30,6 +30,11 @@
30#ifdef HAVE_SYS_SYSMACROS_H 30#ifdef HAVE_SYS_SYSMACROS_H
31# include <sys/sysmacros.h> /* For MIN, MAX, etc */ 31# include <sys/sysmacros.h> /* For MIN, MAX, etc */
32#endif 32#endif
33#ifdef HAVE_SYS_STAT_H
34# include <sys/stat.h> /* For S_* constants and macros */
35#endif
36
37#include <unistd.h> /* For STDIN_FILENO, etc */
33 38
34/* Constants */ 39/* Constants */
35 40
@@ -61,6 +66,37 @@ enum
61# endif /* PATH_MAX */ 66# endif /* PATH_MAX */
62#endif /* MAXPATHLEN */ 67#endif /* MAXPATHLEN */
63 68
69#ifndef STDIN_FILENO
70# define STDIN_FILENO 0
71#endif
72#ifndef STDOUT_FILENO
73# define STDOUT_FILENO 1
74#endif
75#ifndef STDERR_FILENO
76# define STDERR_FILENO 2
77#endif
78
79#ifndef S_ISREG
80# define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR))
81# define S_ISREG(mode) (((mode) & (_S_IFMT)) == (_S_IFREG))
82#endif /* S_ISREG */
83
84#ifndef S_IXUSR
85# define S_IXUSR 0000100 /* execute/search permission, */
86# define S_IXGRP 0000010 /* execute/search permission, */
87# define S_IXOTH 0000001 /* execute/search permission, */
88# define _S_IWUSR 0000200 /* write permission, */
89# define S_IWUSR _S_IWUSR /* write permission, owner */
90# define S_IWGRP 0000020 /* write permission, group */
91# define S_IWOTH 0000002 /* write permission, other */
92# define S_IRUSR 0000400 /* read permission, owner */
93# define S_IRGRP 0000040 /* read permission, group */
94# define S_IROTH 0000004 /* read permission, other */
95# define S_IRWXU 0000700 /* read, write, execute */
96# define S_IRWXG 0000070 /* read, write, execute */
97# define S_IRWXO 0000007 /* read, write, execute */
98#endif /* S_IXUSR */
99
64/* Types */ 100/* Types */
65 101
66/* If sys/types.h does not supply intXX_t, supply them ourselves */ 102/* If sys/types.h does not supply intXX_t, supply them ourselves */
@@ -151,6 +187,16 @@ typedef int ssize_t;
151# define HAVE_SSIZE_T 187# define HAVE_SSIZE_T
152#endif /* HAVE_SSIZE_T */ 188#endif /* HAVE_SSIZE_T */
153 189
190#ifndef HAVE_PID_T
191typedef int pid_t;
192# define HAVE_PID_T
193#endif /* HAVE_PID_T */
194
195#ifndef HAVE_MODE_T
196typedef int mode_t;
197# define HAVE_MODE_T
198#endif /* HAVE_MODE_T */
199
154#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS) 200#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
155# define ss_family __ss_family 201# define ss_family __ss_family
156#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */ 202#endif /* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */
@@ -327,5 +373,4 @@ typedef int ssize_t;
327 373
328/** end of login recorder definitions */ 374/** end of login recorder definitions */
329 375
330
331#endif /* _DEFINES_H */ 376#endif /* _DEFINES_H */
diff --git a/includes.h b/includes.h
index 31b7f349f..716d02f31 100644
--- a/includes.h
+++ b/includes.h
@@ -21,10 +21,11 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
21 21
22#include "config.h" 22#include "config.h"
23 23
24#include "next-posix.h"
25
24#include <sys/types.h> 26#include <sys/types.h>
25#include <sys/socket.h> 27#include <sys/socket.h>
26#include <sys/ioctl.h> 28#include <sys/ioctl.h>
27#include <sys/stat.h>
28#include <sys/wait.h> 29#include <sys/wait.h>
29#include <sys/un.h> 30#include <sys/un.h>
30#include <sys/resource.h> 31#include <sys/resource.h>
@@ -44,7 +45,6 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg }
44#include <stdarg.h> 45#include <stdarg.h>
45#include <pwd.h> 46#include <pwd.h>
46#include <grp.h> 47#include <grp.h>
47#include <unistd.h>
48#include <time.h> 48#include <time.h>
49#include <dirent.h> 49#include <dirent.h>
50 50
diff --git a/next-posix.c b/next-posix.c
new file mode 100644
index 000000000..247ba09a3
--- /dev/null
+++ b/next-posix.c
@@ -0,0 +1,148 @@
1#include "config.h"
2
3#ifdef HAVE_NEXT
4#include <stdio.h>
5#include <stdlib.h>
6#include <string.h>
7#include <errno.h>
8#include <unistd.h>
9
10#include <sys/types.h>
11#include <sys/stat.h>
12#include <fcntl.h>
13
14#include <sys/fcntl.h>
15#include <sys/ioctl.h>
16#include <sys/time.h>
17#include <sys/file.h>
18#include <errno.h>
19#include <termios.h>
20#include <sys/wait.h>
21#ifdef HAVE_STDDEF_H
22#include <stddef.h>
23#endif
24
25#include "xmalloc.h"
26#include "ssh.h"
27#include "next-posix.h"
28
29int
30waitpid(int pid, int *stat_loc, int options)
31{
32 if (pid <= 0) {
33 if (pid != -1) {
34 errno = EINVAL;
35 return -1;
36 }
37 pid = 0; /* wait4() expects pid=0 for indiscriminate wait. */
38 }
39 return wait4(pid, (union wait *)stat_loc, options, NULL);
40}
41
42pid_t setsid(void)
43{
44 return setpgrp(0, getpid());
45}
46
47int
48tcgetattr(int fd, struct termios *t)
49{
50 return (ioctl(fd, TIOCGETA, t));
51}
52
53int
54tcsetattr(int fd, int opt, const struct termios *t)
55{
56 struct termios localterm;
57
58 if (opt & TCSASOFT) {
59 localterm = *t;
60 localterm.c_cflag |= CIGNORE;
61 t = &localterm;
62 }
63 switch (opt & ~TCSASOFT) {
64 case TCSANOW:
65 return (ioctl(fd, TIOCSETA, t));
66 case TCSADRAIN:
67 return (ioctl(fd, TIOCSETAW, t));
68 case TCSAFLUSH:
69 return (ioctl(fd, TIOCSETAF, t));
70 default:
71 errno = EINVAL;
72 return (-1);
73 }
74}
75
76int tcsetpgrp(int fd, pid_t pgrp)
77{
78 int s;
79
80 s = pgrp;
81 return (ioctl(fd, TIOCSPGRP, &s));
82}
83
84speed_t cfgetospeed(const struct termios *t)
85{
86 return (t->c_ospeed);
87}
88
89speed_t cfgetispeed(const struct termios *t)
90{
91 return (t->c_ispeed);
92}
93
94int
95cfsetospeed(struct termios *t,int speed)
96{
97 t->c_ospeed = speed;
98 return (0);
99}
100
101int
102cfsetispeed(struct termios *t, speed_t speed)
103{
104 t->c_ispeed = speed;
105 return (0);
106}
107
108#if 0
109
110/*define sigset_t int*/
111
112/* This whole thing is insane. It's purely wrong, but it's a first
113 go a it. -bl */
114
115int sigemptyset(sigset_t *set)
116{
117 return 0;
118}
119
120int sigaddset(sigset_t *set, int signum)
121{
122 *set |= (1 << (signum - 1));
123 return set;
124}
125
126int sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
127{
128 switch(how) {
129 case SIG_BLOCK:
130 return 0;
131 case SIG_UNBLOCK:
132 return ( 0 & ~ *set);
133 default:
134 return 0;
135 }
136}
137
138int sigsuspend(const sigset_t *mask)
139{
140}
141
142int sigaction(int signum,const struct sigaction *act, struct sigaction *oldact)
143{
144}
145
146#endif /* 0 */
147
148#endif /* HAVE_NEXT */
diff --git a/next-posix.h b/next-posix.h
new file mode 100644
index 000000000..2eb061ac7
--- /dev/null
+++ b/next-posix.h
@@ -0,0 +1,62 @@
1/*
2 * Defines and prototypes specific to NeXT system
3 */
4
5#ifndef _NEXT_POSIX_H
6#define _NEXT_POSIX_H
7
8#ifdef HAVE_NEXT
9
10#include <libc.h>
11#include <sys/dir.h>
12
13/* FILE */
14#define O_NONBLOCK 00004 /* non-blocking open */
15
16/* WAITPID */
17#undef WIFEXITED
18#undef WIFSTOPPED
19#undef WIFSIGNALED
20
21#define _W_INT(w) (*(int*)&(w)) /* convert union wait to int */
22#define WIFEXITED(w) (!((_W_INT(w)) & 0377))
23#define WIFSTOPPED(w) ((_W_INT(w)) & 0100)
24#define WIFSIGNALED(w) (!WIFEXITED(x) && !WIFSTOPPED(x))
25#define WEXITSTATUS(w) (int)(WIFEXITED(x) ? ((_W_INT(w) >> 8) & 0377) : -1)
26#define WTERMSIG(w) (int)(WIFSIGNALED(x) ? (_W_INT(w) & 0177) : -1)
27#define WCOREFLAG 0x80
28#define WCOREDUMP(w) ((_W_INT(w)) & WCOREFLAG)
29
30int waitpid(int pid,int *stat_loc,int options);
31#define getpgrp() getpgrp(0)
32pid_t setsid(void);
33
34/* TC */
35int tcgetattr(int fd,struct termios *t);
36int tcsetattr(int fd,int opt,const struct termios *t);
37int tcsetpgrp(int fd, pid_t pgrp);
38speed_t cfgetospeed(const struct termios *t);
39speed_t cfgetispeed(const struct termios *t);
40int cfsetospeed(struct termios *t,int speed);
41
42/* Sig*() */
43typedef sigset_t;
44#define SIG_BLOCK 00
45#define SIG_UNBLOCK 01
46#define SIG_SETMASK 02
47#define SA_RESTART 00
48struct sigaction {
49 void (*sa_handler)();
50 sigset_t sa_mask;
51 int sa_flags;
52};
53
54int sigemptyset(sigset_t *set);
55int sigaddset(sigset_t *set, int signum);
56int sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
57int sigsuspend(const sigset_t *mask);
58int sigaction(int signum,const struct sigaction *act, struct sigaction *oldact);
59
60#endif /* HAVE_NEXT */
61
62#endif /* _NEXT_POSIX_H */