[openssh-1.2.2] some porting notes for SunOS 4.1.4

Charles Levert charles at comm.polymtl.ca
Mon Feb 14 14:01:52 EST 2000


Hi.

Here are the relevant details about the setup:

	SunOS 4.1.4
	gcc 2.7.2.2
	tcp wrappers 7.5
	egd 0.6 (doesn't really come into play at compile time)

The following only pertains to the compilation (and linking) stage.
Code and patches are SunOS specific.

-- The following functions are missing in SunOS: strerror, atexit,
memmove.  I wrote simple replacements in term of on_exit and bcopy and
linked them without problem when necessary.  (See code at end of
mail.)

-- The mail directory could not be deduced from any header file.  In
addition, the MAIL environment variable was also not defined when
running configure.  As a consequence, MAIL_DIRECTORY was just
#undef'ined in config.h and compilation of sshd.c failed.  I recommend
adding and documenting an explicit --maildir configure option.

-- In packet.c, some IP TOS related constants are undefined.  I
assumed the associated setsockopt calls were optional, but I may be
wrong.  (See patch at end of mail.)

-- In ssh-agent.c, optind needs to be declared explicitly (it is not
in any header file).  (See patch at end of mail.)

-- In scp.c, the SA_RESTART constant is undefined.  SunOS is already
based on BSD signal semantics; do they also apply when using signal
functions from the POSIX interface?  (See patch at end of mail.)

That's it for now.


Charles


========================================================================
==> strerror.c <==
extern int   sys_nerr;
extern char *sys_errlist[];

char *
strerror(e)
	int e;
{
	return (e >= 0 && e < sys_nerr)
		? sys_errlist[e]
		: "unlisted error" ;
}

==> atexit.c <==
#include <sys/types.h>

extern int on_exit(void (*f)(), caddr_t a);

int
atexit(f)
	void (*f)(void);
{
	return on_exit(f, 0) ? 0 : -1;
}

==> memmove.c <==
extern void bcopy(char *b1, char *b2, int l);

void *
memmove(d, s, l)
	char *d;
	char *s;
	int l;
{
	bcopy(s, d, l);
	return d;
}
========================================================================
--- packet.c.orig-1.2.2	Sat Jan 22 17:38:00 2000
+++ packet.c	Sun Feb 13 13:06:04 2000
@@ -796,22 +796,28 @@
 		 * Set IP options for an interactive connection.  Use
 		 * IPTOS_LOWDELAY and TCP_NODELAY.
 		 */
+#ifdef IPTOS_LOWDELAY
 		int lowdelay = IPTOS_LOWDELAY;
 		if (setsockopt(connection_in, IPPROTO_IP, IP_TOS, (void *) &lowdelay,
 		    sizeof(lowdelay)) < 0)
 			error("setsockopt IPTOS_LOWDELAY: %.100s", strerror(errno));
+#endif /* IPTOS_LOWDELAY */
+#ifdef TCP_NODELAY
 		if (setsockopt(connection_in, IPPROTO_TCP, TCP_NODELAY, (void *) &on,
 		    sizeof(on)) < 0)
 			error("setsockopt TCP_NODELAY: %.100s", strerror(errno));
+#endif /* TCP_NODELAY */
 	} else {
 		/*
 		 * Set IP options for a non-interactive connection.  Use
 		 * IPTOS_THROUGHPUT.
 		 */
+#ifdef IPTOS_THROUGHPUT
 		int throughput = IPTOS_THROUGHPUT;
 		if (setsockopt(connection_in, IPPROTO_IP, IP_TOS, (void *) &throughput,
 		    sizeof(throughput)) < 0)
 			error("setsockopt IPTOS_THROUGHPUT: %.100s", strerror(errno));
+#endif /* IPTOS_THROUGHPUT */
 	}
 }
 
========================================================================
--- ssh-agent.c.orig-1.2.2	Mon Jan  3 07:41:05 2000
+++ ssh-agent.c	Sun Feb 13 15:35:23 2000
@@ -507,6 +507,7 @@
 	struct sockaddr_un sunaddr;
 	pid_t pid;
 	char *shell, *format, *pidstr, pidstrbuf[1 + 3 * sizeof pid];
+	extern int optind;
 
 	/* check if RSA support exists */
 	if (rsa_alive() == 0) {
========================================================================
--- scp.c.orig-1.2.2	Thu Jan 13 23:45:51 2000
+++ scp.c	Sun Feb 13 15:58:20 2000
@@ -1229,7 +1229,10 @@
 		struct sigaction sa;
 		sa.sa_handler = updateprogressmeter;
 		sigemptyset(&sa.sa_mask);
-		sa.sa_flags = SA_RESTART;
+		sa.sa_flags = 0;
+#ifdef SA_RESTART
+		sa.sa_flags |= SA_RESTART;
+#endif /* SA_RESTART */
 		sigaction(SIGALRM, &sa, NULL);
 		alarmtimer(1);
 	} else if (flag == 1) {
========================================================================





More information about the openssh-unix-dev mailing list