Patches for compiling / using portable OpenSSH on FreeMiNT?

Thomas Binder binder at arago.de
Mon Jun 10 19:40:00 EST 2002


Hi!

On Thu, Jun 06, 2002 at 09:27:33AM -0500, Ben Lindstrom wrote:
> Post them, people will comment.  If they are correct and
> acceptable.  We will merge them.  Otherwise we won't. =)

OK, here we go. Attached are 12 patch files:

1. openssh-3.2.3p1-AF_UNIX.patch

This is necessary because FreeMiNT expects 0-terminated path names
in sun_path and does a sanity check on namelen passed to bind().
This sanity check rejects namelen >= sizeof(struct sockaddr_un),
because namelen should not include the trailing 0 of the path
name.

I've solved this by defining AF_UNIX_ADDRLEN in defines.h, to
sizeof(struct sockaddr_un) for all systems expect FreeMiNT, which
will get (sizeof(struct sockaddr_un) - 1)

In the code, connect() and bind() for AF_UNIX sockets will then
pass AF_UNIX_ADDRLEN.

2. openssh-3.2.3p1-configure.patch

FreeMiNT needs USE_PIPES defined, so this patch adds it to both
configure and configure.ac

3. openssh-3.2.3p1-environment.patch

Because FreeMiNT is a hybrid system (it runs TOS software as well
as ported UNIX stuff) that internally works with DOS-style
pathnames, the C library evaluates two environment variables which
control some function's behaviour (UNIXMODE and PCONVERT). These
two need to be passed to sshd's children, this is what the patch
adds.

4. openssh-3.2.3p1-getopt.patch

For some reason, GNU ld chokes on optind being multiply defined,
thus this patch prefixes all global variables in
openbsd-compat/getopt.c with BSD and adds corresponding macros to
defines.h

5. openssh-3.2.3p1-inet_ntop.patch

This patch will most probably no longer be necessary with the next
version of FreeMiNT's C library. The problem is that the header
files define inet_ntop(), but the library is actually missing the
function. Thus, configure correctly does not define
HAVE_INET_NTOP, but the system header's prototype for inet_ntop()
does not match the one in openbsd-compat/inet_ntop.[ch]

6. openssh-3.2.3p1-Makefile.patch

As FreeMiNT needs to maitain TOS compatibility, a program's stack
size needs to be set at runtime. The default stack size created by
the linker is too small for the recursion level of some of
OpenSSH's binaries (especially ssh-keygen), thus one needs to
"inject" a larger default stack size into the binaries using a
special binary utility.

This patch adds the necessary calls to this utility, but
unfortunately, I've no idea on how to add these lines to
Makefile.in in a way that configure will only include them into
the final Makefile for FreeMiNT, not for other systems.

7. openssh-3.2.3p1-ONLCR.patch

FreeMiNT (and it's library) do not know about ONLCR, thus I've
added an additional #ifdef around the section in ttymodes.h that
uses it.

8. openssh-3.2.3p1-path_to_login.patch

Not a really important patch, but nonetheless I think it's better
to assume /bin/login instead of /usr/bin/login if none is found a
configure time.

9. openssh-3.2.3p1-scp.patch

FreeMiNT cannot open() directories, thus this patch will fall back
to stat() if open() fails with EISDIR. Without that, recursive
copying won't work with FreeMiNT.

10. openssh-3.2.3p1-setrlimit.patch

FreeMiNT cannot dump core, thus setrlimit(RLIMIT_CORE) correctly
(IMO) fails with EINVAL ("An invalid resource was specified").
This patch therefore allows setrlimit(RLIMIT_CORE) to fail with
EINVAL (but not with other error codes).

11. openssh-3.2.3p1-ssh_keyscan.patch

When using non-blocking sockets, FreeMiNT sometimes returns
non-ready sockets in select(), causing ssh_keyscan to fail almost
always. This patch adds a special #ifdef'ed workaround for that.

12. openssh-3.2.3p1-xkeys.patch

FreeMiNT treats cursor and function keys specially. They only
return ANSI codes (or whatever you set via a special ioctl() on
the TTY) when IEXTEN is set. As enter_raw_mode() unsets IEXTEN,
the cursor and function keys don't work in outgoing ssh
connections. This patch therefore does not unset IEXTEN if
sshtty.c is built for FreeMiNT.

It also adds a check whether _in_raw_mode is already set when
enter_raw_mode() is called. This is not necessary at all, I just
thought it might be a good idea (but maybe it isn't, then simply
ignore it).

OK, that's all :) I hope some of these patches can be included
into the main distribution (and the logics/reasons behind them
respected for future versions), to be able to compile a working
OpenSSH for FreeMiNT right off the box.

Thanks for your attention!


Ciao

Thomas
-------------- next part --------------
diff -u -r openssh-3.2.3p1.orig/authfd.c openssh-3.2.3p1/authfd.c
--- openssh-3.2.3p1.orig/authfd.c	Fri Mar 22 04:51:06 2002
+++ openssh-3.2.3p1/authfd.c	Sun Jun  9 00:04:32 2002
@@ -86,7 +86,7 @@
 		close(sock);
 		return -1;
 	}
-	if (connect(sock, (struct sockaddr *) &sunaddr, sizeof sunaddr) < 0) {
+	if (connect(sock, (struct sockaddr *) &sunaddr, AF_UNIX_ADDRLEN) < 0) {
 		close(sock);
 		return -1;
 	}
diff -u -r openssh-3.2.3p1.orig/channels.c openssh-3.2.3p1/channels.c
--- openssh-3.2.3p1.orig/channels.c	Tue Apr 23 13:09:46 2002
+++ openssh-3.2.3p1/channels.c	Sun Jun  9 00:04:42 2002
@@ -2439,7 +2439,7 @@
 	memset(&addr, 0, sizeof(addr));
 	addr.sun_family = AF_UNIX;
 	snprintf(addr.sun_path, sizeof addr.sun_path, _PATH_UNIX_X, dnr);
-	if (connect(sock, (struct sockaddr *) & addr, sizeof(addr)) == 0)
+	if (connect(sock, (struct sockaddr *) & addr, AF_UNIX_ADDRLEN) == 0)
 		return sock;
 	close(sock);
 	error("connect %.100s: %.100s", addr.sun_path, strerror(errno));
@@ -2772,7 +2772,7 @@
 	sunaddr.sun_family = AF_UNIX;
 	strlcpy(sunaddr.sun_path, auth_sock_name, sizeof(sunaddr.sun_path));
 
-	if (bind(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0)
+	if (bind(sock, (struct sockaddr *) & sunaddr, AF_UNIX_ADDRLEN) < 0)
 		packet_disconnect("bind: %.100s", strerror(errno));
 
 	/* Restore the privileged uid. */
diff -u -r openssh-3.2.3p1.orig/defines.h openssh-3.2.3p1/defines.h
--- openssh-3.2.3p1.orig/defines.h	Thu Apr 25 19:56:06 2002
+++ openssh-3.2.3p1/defines.h	Sun Jun  9 00:06:06 2002
@@ -262,6 +262,12 @@
 };
 #endif /* HAVE_SYS_UN_H */
 
+#ifndef __MINT__
+# define AF_UNIX_ADDRLEN	sizeof(struct sockaddr_un)
+#else
+# define AF_UNIX_ADDRLEN	(sizeof(struct sockaddr_un) - 1)
+#endif /* __MINT__ */
+
 #if defined(BROKEN_SYS_TERMIO_H) && !defined(_STRUCT_WINSIZE)
 #define _STRUCT_WINSIZE
 struct winsize {
diff -u -r openssh-3.2.3p1.orig/ssh-agent.c openssh-3.2.3p1/ssh-agent.c
--- openssh-3.2.3p1.orig/ssh-agent.c	Fri Apr  5 22:23:36 2002
+++ openssh-3.2.3p1/ssh-agent.c	Sun Jun  9 00:03:44 2002
@@ -916,7 +916,7 @@
 #ifdef HAVE_CYGWIN
 	prev_mask = umask(0177);
 #endif
-	if (bind(sock, (struct sockaddr *) & sunaddr, sizeof(sunaddr)) < 0) {
+	if (bind(sock, (struct sockaddr *) & sunaddr, AF_UNIX_ADDRLEN) < 0) {
 		perror("bind");
 #ifdef HAVE_CYGWIN
 		umask(prev_mask);
-------------- next part --------------
diff -u -r openssh-3.2.3p1.orig/Makefile.in openssh-3.2.3p1/Makefile.in
--- openssh-3.2.3p1.orig/Makefile.in	Mon May 13 06:12:04 2002
+++ openssh-3.2.3p1/Makefile.in	Sun Jun  2 12:23:18 2002
@@ -109,33 +109,43 @@
 
 ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
 	$(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
+	stack --size=256k $@
 
 sshd$(EXEEXT): libssh.a	$(LIBCOMPAT) $(SSHDOBJS)
 	$(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBWRAP) $(LIBPAM) $(LIBS)
+	stack --size=256k $@
 
 scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o
 	$(LD) -o $@ scp.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
+	stack --size=256k $@
 
 ssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o
 	$(LD) -o $@ ssh-add.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) 
+	stack --size=256k $@
 
 ssh-agent$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-agent.o
 	$(LD) -o $@ ssh-agent.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) 
+	stack --size=256k $@
 
 ssh-keygen$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keygen.o
 	$(LD) -o $@ ssh-keygen.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) 
+	stack --size=256k $@
 
 ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o
 	$(LD) -o $@ ssh-keyscan.o $(LDFLAGS) -lssh -lopenbsd-compat -lssh $(LIBS) 
+	stack --size=256k $@
 
 sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o
 	$(LD) -o $@ sftp-server.o sftp-common.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) 
+	stack --size=256k $@
 
 sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-int.o sftp-common.o sftp-glob.o
 	$(LD) -o $@ sftp.o sftp-client.o sftp-common.o sftp-int.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
+	stack --size=256k $@
 
 ssh-rand-helper${EXEEXT}: $(LIBCOMPAT) libssh.a ssh-rand-helper.o
 	$(LD) -o $@ ssh-rand-helper.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
+	stack --size=256k $@
 
 # test driver for the loginrec code - not built by default
 logintest: logintest.o $(LIBCOMPAT) libssh.a loginrec.o
-------------- next part --------------
diff -u -r openssh-3.2.3p1.orig/ttymodes.h openssh-3.2.3p1/ttymodes.h
--- openssh-3.2.3p1.orig/ttymodes.h	Tue Mar  5 02:53:04 2002
+++ openssh-3.2.3p1/ttymodes.h	Sun Jun  2 12:23:20 2002
@@ -156,7 +156,9 @@
 #if defined(OLCUC)
 TTYMODE(OLCUC,	c_oflag, 71)
 #endif
+#ifdef ONLCR
 TTYMODE(ONLCR,	c_oflag, 72)
+#endif
 #ifdef OCRNL
 TTYMODE(OCRNL,	c_oflag, 73)
 #endif
-------------- next part --------------
diff -u -r openssh-3.2.3p1.orig/configure openssh-3.2.3p1/configure
--- openssh-3.2.3p1.orig/configure	Wed May 22 07:11:22 2002
+++ openssh-3.2.3p1/configure	Sun Jun  2 12:23:22 2002
@@ -3903,6 +3903,12 @@
 
 	inet6_default_4in6=yes
 	;;
+*-*-mint*)
+	cat >>confdefs.h <<\_ACEOF
+#define USE_PIPES
+_ACEOF
+
+	;;
 mips-sony-bsd|mips-sony-newsos4)
 	cat >>confdefs.h <<\_ACEOF
 #define HAVE_NEWS4 1
diff -u -r openssh-3.2.3p1.orig/configure.ac openssh-3.2.3p1/configure.ac
--- openssh-3.2.3p1.orig/configure.ac	Wed May 22 03:02:14 2002
+++ openssh-3.2.3p1/configure.ac	Sun Jun  2 12:23:22 2002
@@ -159,6 +159,9 @@
 	AC_DEFINE(PAM_TTY_KLUDGE)
 	inet6_default_4in6=yes
 	;;
+*-*-mint*)
+	AC_DEFINE(USE_PIPES)
+	;;
 mips-sony-bsd|mips-sony-newsos4)
 	AC_DEFINE(HAVE_NEWS4)
 	SONY=1
-------------- next part --------------
diff -u -r openssh-3.2.3p1.orig/session.c openssh-3.2.3p1/session.c
--- openssh-3.2.3p1.orig/session.c	Mon May 13 02:48:58 2002
+++ openssh-3.2.3p1/session.c	Sun Jun  2 12:23:22 2002
@@ -889,6 +889,12 @@
 	}
 	if (getenv("TZ"))
 		child_set_env(&env, &envsize, "TZ", getenv("TZ"));
+#ifdef __MINT__
+	if (getenv("UNIXMODE"))
+		child_set_env(&env, &envsize, "UNIXMODE", getenv("UNIXMODE"));
+	if (getenv("PCONVERT"))
+		child_set_env(&env, &envsize, "PCONVERT", getenv("PCONVERT"));
+#endif
 
 	/* Set custom environment options from RSA authentication. */
 	if (!options.use_login) {
-------------- next part --------------
diff -u -r openssh-3.2.3p1.orig/defines.h openssh-3.2.3p1/defines.h
--- openssh-3.2.3p1.orig/defines.h	Thu Apr 25 19:56:06 2002
+++ openssh-3.2.3p1/defines.h	Sun Jun  2 18:25:20 2002
@@ -417,7 +417,18 @@
 #endif
 
 #ifndef HAVE_GETOPT_OPTRESET
-#define getopt(ac, av, o)  BSDgetopt(ac, av, o)
+# undef getopt
+# undef opterr
+# undef optind
+# undef optopt
+# undef optreset
+# undef optarg
+# define getopt(ac, av, o)  BSDgetopt(ac, av, o)
+# define opterr             BSDopterr
+# define optind             BSDoptind
+# define optopt             BSDoptopt
+# define optreset           BSDoptreset
+# define optarg             BSDoptarg
 #endif
 
 /* In older versions of libpam, pam_strerror takes a single argument */
diff -u -r openssh-3.2.3p1.orig/openbsd-compat/getopt.c openssh-3.2.3p1/openbsd-compat/getopt.c
--- openssh-3.2.3p1.orig/openbsd-compat/getopt.c	Mon Sep 17 23:34:34 2001
+++ openssh-3.2.3p1/openbsd-compat/getopt.c	Sun Jun  2 17:37:10 2002
@@ -42,11 +42,11 @@
 #include <stdlib.h>
 #include <string.h>
 
-int	opterr = 1,		/* if error message should be printed */
-	optind = 1,		/* index into parent argv vector */
-	optopt,			/* character checked for validity */
-	optreset;		/* reset getopt */
-char	*optarg;		/* argument associated with option */
+int	BSDopterr = 1,		/* if error message should be printed */
+	BSDoptind = 1,		/* index into parent argv vector */
+	BSDoptopt,		/* character checked for validity */
+	BSDoptreset;		/* reset getopt */
+char	*BSDoptarg;		/* argument associated with option */
 
 #define	BADCH	(int)'?'
 #define	BADARG	(int)':'
@@ -66,57 +66,57 @@
 	static char *place = EMSG;		/* option letter processing */
 	char *oli;				/* option letter list index */
 
-	if (optreset || !*place) {		/* update scanning pointer */
-		optreset = 0;
-		if (optind >= nargc || *(place = nargv[optind]) != '-') {
+	if (BSDoptreset || !*place) {		/* update scanning pointer */
+		BSDoptreset = 0;
+		if (BSDoptind >= nargc || *(place = nargv[BSDoptind]) != '-') {
 			place = EMSG;
 			return (-1);
 		}
 		if (place[1] && *++place == '-') {	/* found "--" */
-			++optind;
+			++BSDoptind;
 			place = EMSG;
 			return (-1);
 		}
 	}					/* option letter okay? */
-	if ((optopt = (int)*place++) == (int)':' ||
-	    !(oli = strchr(ostr, optopt))) {
+	if ((BSDoptopt = (int)*place++) == (int)':' ||
+	    !(oli = strchr(ostr, BSDoptopt))) {
 		/*
 		 * if the user didn't specify '-' as an option,
 		 * assume it means -1.
 		 */
-		if (optopt == (int)'-')
+		if (BSDoptopt == (int)'-')
 			return (-1);
 		if (!*place)
-			++optind;
-		if (opterr && *ostr != ':')
+			++BSDoptind;
+		if (BSDopterr && *ostr != ':')
 			(void)fprintf(stderr,
-			    "%s: illegal option -- %c\n", __progname, optopt);
+			    "%s: illegal option -- %c\n", __progname, BSDoptopt);
 		return (BADCH);
 	}
 	if (*++oli != ':') {			/* don't need argument */
-		optarg = NULL;
+		BSDoptarg = NULL;
 		if (!*place)
-			++optind;
+			++BSDoptind;
 	}
 	else {					/* need an argument */
 		if (*place)			/* no white space */
-			optarg = place;
-		else if (nargc <= ++optind) {	/* no arg */
+			BSDoptarg = place;
+		else if (nargc <= ++BSDoptind) {	/* no arg */
 			place = EMSG;
 			if (*ostr == ':')
 				return (BADARG);
-			if (opterr)
+			if (BSDopterr)
 				(void)fprintf(stderr,
 				    "%s: option requires an argument -- %c\n",
-				    __progname, optopt);
+				    __progname, BSDoptopt);
 			return (BADCH);
 		}
 	 	else				/* white space */
-			optarg = nargv[optind];
+			BSDoptarg = nargv[BSDoptind];
 		place = EMSG;
-		++optind;
+		++BSDoptind;
 	}
-	return (optopt);			/* dump back option letter */
+	return (BSDoptopt);			/* dump back option letter */
 }
 
 #endif /* !defined(HAVE_GETOPT) || !defined(HAVE_OPTRESET) */
-------------- next part --------------
diff -u -r openssh-3.2.3p1.orig/openbsd-compat/inet_ntop.c openssh-3.2.3p1/openbsd-compat/inet_ntop.c
--- openssh-3.2.3p1.orig/openbsd-compat/inet_ntop.c	Tue Sep 25 14:21:52 2001
+++ openssh-3.2.3p1/openbsd-compat/inet_ntop.c	Sun Jun  2 12:23:24 2002
@@ -54,8 +54,8 @@
  * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
  */
 
-static const char *inet_ntop4 __P((const u_char *src, char *dst, size_t size));
-static const char *inet_ntop6 __P((const u_char *src, char *dst, size_t size));
+static const char *inet_ntop4 __P((const u_char *src, char *dst, socklen_t size));
+static const char *inet_ntop6 __P((const u_char *src, char *dst, socklen_t size));
 
 /* char *
  * inet_ntop(af, src, dst, size)
@@ -70,7 +70,7 @@
 	int af;
 	const void *src;
 	char *dst;
-	size_t size;
+	socklen_t size;
 {
 	switch (af) {
 	case AF_INET:
@@ -99,7 +99,7 @@
 inet_ntop4(src, dst, size)
 	const u_char *src;
 	char *dst;
-	size_t size;
+	socklen_t size;
 {
 	static const char fmt[] = "%u.%u.%u.%u";
 	char tmp[sizeof "255.255.255.255"];
@@ -123,7 +123,7 @@
 inet_ntop6(src, dst, size)
 	const u_char *src;
 	char *dst;
-	size_t size;
+	socklen_t size;
 {
 	/*
 	 * Note that int32_t and int16_t need only be "at least" large enough
diff -u -r openssh-3.2.3p1.orig/openbsd-compat/inet_ntop.h openssh-3.2.3p1/openbsd-compat/inet_ntop.h
--- openssh-3.2.3p1.orig/openbsd-compat/inet_ntop.h	Thu Aug  9 02:56:52 2001
+++ openssh-3.2.3p1/openbsd-compat/inet_ntop.h	Sun Jun  2 12:23:24 2002
@@ -7,7 +7,7 @@
 
 #ifndef HAVE_INET_NTOP
 const char *                 
-inet_ntop(int af, const void *src, char *dst, size_t size);
+inet_ntop(int af, const void *src, char *dst, socklen_t size);
 #endif /* !HAVE_INET_NTOP */
 
 #endif /* _BSD_INET_NTOP_H */
-------------- next part --------------
diff -u -r openssh-3.2.3p1.orig/pathnames.h openssh-3.2.3p1/pathnames.h
--- openssh-3.2.3p1.orig/pathnames.h	Mon May 13 05:15:42 2002
+++ openssh-3.2.3p1/pathnames.h	Sun Jun  2 12:23:24 2002
@@ -154,7 +154,7 @@
 # ifdef LOGIN_PROGRAM_FALLBACK
 #  define LOGIN_PROGRAM         LOGIN_PROGRAM_FALLBACK
 # else
-#  define LOGIN_PROGRAM         "/usr/bin/login"
+#  define LOGIN_PROGRAM         "/bin/login"
 # endif
 #endif /* LOGIN_PROGRAM */
 
-------------- next part --------------
diff -u -r openssh-3.2.3p1.orig/scp.c openssh-3.2.3p1/scp.c
--- openssh-3.2.3p1.orig/scp.c	Sat Apr  6 20:30:00 2002
+++ openssh-3.2.3p1/scp.c	Sun Jun  2 12:23:24 2002
@@ -500,11 +500,15 @@
 			    name);
 			goto next;
 		}
-		if ((fd = open(name, O_RDONLY, 0)) < 0)
-			goto syserr;
-		if (fstat(fd, &stb) < 0) {
-syserr:			run_err("%s: %s", name, strerror(errno));
-			goto next;
+		if ((fd = open(name, O_RDONLY, 0)) < 0) {
+			if ((errno != EISDIR) || (stat(name, &stb) < 0))
+				goto syserr;
+		}
+		else {
+			if (fstat(fd, &stb) < 0) {
+syserr:				run_err("%s: %s", name, strerror(errno));
+				goto next;
+			}
 		}
 		switch (stb.st_mode & S_IFMT) {
 		case S_IFREG:
-------------- next part --------------
diff -u -r openssh-3.2.3p1.orig/ssh-agent.c openssh-3.2.3p1/ssh-agent.c
--- openssh-3.2.3p1.orig/ssh-agent.c	Fri Apr  5 22:23:36 2002
+++ openssh-3.2.3p1/ssh-agent.c	Sun Jun  2 12:23:26 2002
@@ -985,7 +991,7 @@
 #ifdef HAVE_SETRLIMIT
 	/* deny core dumps, since memory contains unencrypted private keys */
 	rlim.rlim_cur = rlim.rlim_max = 0;
-	if (setrlimit(RLIMIT_CORE, &rlim) < 0) {
+ 	if (setrlimit(RLIMIT_CORE, &rlim) < 0 && errno != EINVAL) {
 		error("setrlimit RLIMIT_CORE: %s", strerror(errno));
 		cleanup_exit(1);
 	}
diff -u -r openssh-3.2.3p1.orig/ssh.c openssh-3.2.3p1/ssh.c
--- openssh-3.2.3p1.orig/ssh.c	Tue Apr 23 13:09:46 2002
+++ openssh-3.2.3p1/ssh.c	Sun Jun  2 12:23:24 2002
@@ -277,7 +277,7 @@
 	if (original_real_uid != original_effective_uid) {
 		struct rlimit rlim;
 		rlim.rlim_cur = rlim.rlim_max = 0;
-		if (setrlimit(RLIMIT_CORE, &rlim) < 0)
+		if (setrlimit(RLIMIT_CORE, &rlim) < 0 && errno != EINVAL)
 			fatal("setrlimit failed: %.100s", strerror(errno));
 	}
 #endif
-------------- next part --------------
diff -u -r openssh-3.2.3p1.orig/ssh-keyscan.c openssh-3.2.3p1/ssh-keyscan.c
--- openssh-3.2.3p1.orig/ssh-keyscan.c	Fri Apr  5 22:23:36 2002
+++ openssh-3.2.3p1/ssh-keyscan.c	Sun Jun  2 12:23:26 2002
@@ -501,6 +501,13 @@
 		cp++;
 	}
 	if (n < 0) {
+#ifdef __MINT__
+		/* MiNT seems to return non-ready socket descriptors in
+		 * select() when the corresponding socket is non-blocking
+		 */
+		if ((errno == EAGAIN) || (errno = ENOTCONN))
+			return;
+#endif
 		if (errno != ECONNREFUSED)
 			error("read (%s): %s", c->c_name, strerror(errno));
 		conrecycle(s);
-------------- next part --------------
diff -u -r openssh-3.2.3p1.orig/sshtty.c openssh-3.2.3p1/sshtty.c
--- openssh-3.2.3p1.orig/sshtty.c	Tue Mar  5 02:53:04 2002
+++ openssh-3.2.3p1/sshtty.c	Sun Jun  2 12:23:26 2002
@@ -73,6 +73,8 @@
 {
 	struct termios tio;
 
+	if (_in_raw_mode)
+		return;
 	if (tcgetattr(fileno(stdin), &tio) == -1) {
 		perror("tcgetattr");
 		return;
@@ -81,7 +83,7 @@
 	tio.c_iflag |= IGNPAR;
 	tio.c_iflag &= ~(ISTRIP | INLCR | IGNCR | ICRNL | IXON | IXANY | IXOFF);
 	tio.c_lflag &= ~(ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHONL);
-#ifdef IEXTEN
+#if defined(IEXTEN) && !defined(__MINT__)
 	tio.c_lflag &= ~IEXTEN;
 #endif
 	tio.c_oflag &= ~OPOST;


More information about the openssh-unix-dev mailing list