9fans archive / 2000 / 10 / 57 /    prev next

From: Micah Stetson <micah@cnm...>
Subject: [9fans] ssh and sam
Date: Sun, 8 Oct 2000 02:07:27 -0700

In setting up my system so I can ssh into one of my
GNU/Linux systems using RSA authentication, I had scp tell
me that it encountered a divide error.  (Interestingly
enough, it worked anyway.)  On further investigation, I find
that in /sys/src/cmd/ssh/cmd/client_messages.c, cheight and
cwidth are used uninitialized if request_pty() hasn't been
called.  But request_pty() isn't called unless ssh intends
to start a shell or the user gave it the (undocumented) `-p'
command line option.  So it never gets called when you use
scp.  At the bottom of this message, there's a patch that
makes this problem go away.  However, I am certain that this
is not the One True Solution.  It just made the message go
away, which made me happy enough that I didn't look much
further into it.

Incidentally, what is the right way to apply a patch under
Plan 9?  There is no /bin/patch and the only programs in the
``See Also'' section of diff(1) are cmp and ed.  Am I
missing something, or should I use `diff -e' so the output
can be used by ed?

Not that this is something a person would really want to do,
but if I copy /sys/lib/ssh/hostkey.public10 into the
authorized_keys file on a machine running OpenSSH, I can't
connect to that machine.  ssh dies with this message:
	ssh: Unknown message type 7
I don't suppose anyone will care, but I thought I would
mention it anyway.

The real reason that I was dealing with ssh at all is that I
would like to run the terminal part of sam locally and the
host part on a Unix machine.  My Debian system comes with a
version of sam that says that this is possible, but I think
they have the second edition in mind.  I tried just running
'sam -r', but rx can't seem to talk to Debian.  (I suppose
this makes sense as Debian has no clue about Plan 9 style
authentication.)  After that I recompiled sam to use ssh
instead of rx, figuring (perhaps naively) that it should
work just as well so long as ssh didn't ask for a password.
The ssh manual page suggests enabling TIS_Authentication,
but I don't see any mention of that in the OpenSSH
documentation, so I used RSA authentication instead.  On
trying this, samterm draws its window, but then it is
overwritten by several copies of this message:
	?warning: null characters elided
All of sam's normal menus are there, but the menu items are
in parentheses.  What does this mean?  At that point, I
couldn't make sam respond to much of anything, so I just
killed it.  Is there something I can do to make sam work
with a Unix sam?  I just hope the answer is not ``Port the
latest sam to Unix, because it can't talk to an older
version.''

Micah

/sys/src/cmd/ssh/cmd/client_messages.c:507,508 c /usr/micah/src/ssh/cmd/client_messages.c:507,515
< 	putlong(packet, height/cheight);	/* rows */
< 	putlong(packet, width/cwidth);	/* columns */
---
> 	if(!(cheight && cwidth)) {
> 		putlong(packet, lines = int_env("LINES", 24));	/* rows */
> 		putlong(packet, cols = int_env("COLS", 80));	/* columns */
> 		cwidth = width/cols;
> 		cheight = height/lines;
> 	} else {
> 		putlong(packet, height/cheight);	/* rows */
> 		putlong(packet, width/cwidth);	/* columns */
> 	}