OpenSSH for OS/390

Darren Tucker dtucker at
Sun Jan 27 22:13:16 EST 2008

On Thu, Jan 24, 2008 at 09:50:22PM -0800, E Pivovarov wrote:
> I have been trying to compile OpenSSH_4.7p1 for OS/390 and got really
> stuck. IBM released a build of v3.8.1p1 several years ago, but I do
> not know whether anyone else has ever managed to compile it for OS/390
> or OS/z.

> The first problem is that the build apparently performs ssh transport
> exchange using EBCDIC character encoding instead of ASCII (which breaks
> RFC 4253) and I am not sure how to do the conversion properly so that
> it will not corrupt truely binary data.

I vaguely recall someone posting about that quite some time back, I would
check the list archive... ah, here we are:

> The second problem is that connection fails even for ssh client and
> deamon that belong to the same build. Here is the output of sshd (the
> client has received SSH2_MSG_SERVICE_ACCEPT and is running dispatch_run):
> It appears that some of the debugging messages are coming from the
> parent thread and some from the child thread. All I can add is that the
> buffer "m" in mm_getpwnamallow() has alloc=32768, offset=52, end=10055 and
> also that buffer_get_string() returns len=7, which is rather different
> from sizeof(*newopts)=9988, indeed. I am really lost here and cannot
> figure out what is wrong.

That looks pretty wrong but I can't think of any reason it would happen.
Does this patch make any difference, what is the output of the XXX lines?

Index: monitor.c
RCS file: /usr/local/src/security/openssh/cvs/openssh/monitor.c,v
retrieving revision 1.126
diff -u -p -r1.126 monitor.c
--- monitor.c	2 Dec 2007 12:02:15 -0000	1.126
+++ monitor.c	27 Jan 2008 11:05:01 -0000
@@ -607,6 +607,7 @@ mm_answer_pwnamallow(int sock, Buffer *m
 	char *username;
 	struct passwd *pwent;
 	int allowed = 0;
+	u_int len;
 	debug3("%s", __func__);
@@ -645,7 +646,9 @@ mm_answer_pwnamallow(int sock, Buffer *m
 	buffer_put_cstring(m, pwent->pw_shell);
-	buffer_put_string(m, &options, sizeof(options));
+	len = sizeof(options);
+	logit("XXX sending option block, size %u", len);
+	buffer_put_string(m, &options, len);
 	if (options.banner != NULL)
 		buffer_put_cstring(m, options.banner);
 	debug3("%s: sending MONITOR_ANS_PWNAM: %d", __func__, allowed);
Index: monitor_wrap.c
RCS file: /usr/local/src/security/openssh/cvs/openssh/monitor_wrap.c,v
retrieving revision 1.76
diff -u -p -r1.76 monitor_wrap.c
--- monitor_wrap.c	2 Dec 2007 12:02:15 -0000	1.76
+++ monitor_wrap.c	27 Jan 2008 11:02:04 -0000
@@ -240,8 +240,10 @@ mm_getpwnamallow(const char *username)
 	/* copy options block as a Match directive may have changed some */
 	newopts = buffer_get_string(&m, &len);
+	logit("XXX got option block size %u", len);
 	if (len != sizeof(*newopts))
-		fatal("%s: option block size mismatch", __func__);
+		fatal("%s: option block size mismatch expected %u got %u",
+		    __func__, sizeof(*newopts), len);
 	if (newopts->banner != NULL)
 		newopts->banner = buffer_get_string(&m, NULL);
 	copy_set_server_options(&options, newopts, 1);

Darren Tucker (dtucker at
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

More information about the openssh-unix-dev mailing list