Problems/patches for BSD/OS 4.0.1

Larry Jones larry.jones at sdrc.com
Thu Sep 14 08:35:14 EST 2000


I wrote:
> 
> 2) The fixprogs script doesn't reopen the child process's STDIN, STDOUT,
> and STDERR correctly.  This caused all of the ``tail'' commands in
> ssh_prng_cmds to fail because they couldn't write to stdout.  Here's a
> patch:

But the patch was wrong (it redirected STDOUT to /tmp/foo instead of
/dev/null, a leftover from trying to track down the problem).  Here's
the correct patch:

--- fixprogs.orig	Thu May 18 09:12:50 2000
+++ fixprogs	Wed Sep 13 17:20:43 2000
@@ -44,9 +44,9 @@
    if (! ($pid = fork())) {
      # child
      close STDIN; close STDOUT; close STDERR;
-     open STDIN,  "</dev/null";
-     open STDOUT, ">/dev/null";
-     open STDERR, ">/dev/null";
+     open (STDIN,  "</dev/null");
+     open (STDOUT, ">/dev/null");
+     open (STDERR, ">/dev/null");
      exec $path @args;
      exit 1; # shouldn't be here
    }

There's also another problem -- the fake struct sockaddr_storage is not
compatible with struct sockaddr on my system (sockaddr has a byte for
the address family, sockaddr_storage has a short), which leads to all
sorts of interesting, non-obvious failures later.  The simplest solution
is to have sockaddr_storage contain an actual sockaddr and use it. 
Here's the patch:

--- fake-socket.h.orig	Tue May 30 21:20:12 2000
+++ fake-socket.h	Wed Sep 13 17:17:47 2000
@@ -6,17 +6,13 @@
 
 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
 # define	_SS_MAXSIZE	128	/* Implementation specific max size */
-# define	_SS_ALIGNSIZE	(sizeof(int))
-# define	_SS_PAD1SIZE	(_SS_ALIGNSIZE - sizeof(u_short))
-# define	_SS_PAD2SIZE	(_SS_MAXSIZE - (sizeof(u_short) + \
-					_SS_PAD1SIZE + _SS_ALIGNSIZE))
+# define	_SS_PADSIZE	(_SS_MAXSIZE - sizeof (struct sockaddr))
 
 struct sockaddr_storage {
-  u_short	ss_family;
-  char		__ss_pad1[_SS_PAD1SIZE];
-  int			__ss_align;
-  char		__ss_pad2[_SS_PAD2SIZE];
+  struct sockaddr ss_sa;
+  char		__ss_pad2[_SS_PADSIZE];
 };
+# define ss_family ss_sa.sa_family
 #endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */
 
 #ifndef IN6_IS_ADDR_LOOPBACK

-Larry Jones

Just when I thought this junk was beginning to make sense. -- Calvin





More information about the openssh-unix-dev mailing list