9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] 9term echo-disabling fix (for ssh, vncviewer)
@ 2004-06-18 13:11 Axel Belinfante
  2004-06-18 15:04 ` boyd, rounin
  0 siblings, 1 reply; 4+ messages in thread
From: Axel Belinfante @ 2004-06-18 13:11 UTC (permalink / raw)
  To: 9fans

I wrote:

> Furthermore I got the impression that the echo-disabling
> code in 9term still/again needs some work: on sunos5.8
> when prompting for a password, telnet succeeds to disable echo
> but ssh and vncviewer fail. I did have an own version where those
> worked too, I'll find time to have a look at the differences.

This seems to be it.

Axel.

Index: SunOS.c
===================================================================
RCS file: /cvs/plan9/src/cmd/9term/SunOS.c,v
retrieving revision 1.6
diff -b -u -w -r1.6 SunOS.c
--- SunOS.c	2004/04/20 02:03:37	1.6
+++ SunOS.c	2004/06/18 12:53:07
@@ -67,7 +67,7 @@
 	if(debug) fprint(2, "israw %c%c\n",
 		ttmode.c_lflag&ICANON ? 'c'cvs : 1 : '-',
 		ttmode.c_lflag&ECHO ? 'e' : '-');
-	return (ttmode.c_lflag&(ICANON|ECHO));
+	return (ttmode.c_lflag&(ICANON) && ttmode.c_lflag&(ECHO));
 }





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] 9term echo-disabling fix (for ssh, vncviewer)
  2004-06-18 13:11 [9fans] 9term echo-disabling fix (for ssh, vncviewer) Axel Belinfante
@ 2004-06-18 15:04 ` boyd, rounin
  2004-06-18 16:06   ` Axel Belinfante
  0 siblings, 1 reply; 4+ messages in thread
From: boyd, rounin @ 2004-06-18 15:04 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> - return (ttmode.c_lflag&(ICANON|ECHO));
> + return (ttmode.c_lflag&(ICANON) && ttmode.c_lflag&(ECHO));

that's weird.  1st returns either:

    ICANON
    ECHO
    ICANON|ECHO

2nd returns 0 [raw | raw and no echo] or 1 [not raw and echo].

this doesn't sound right and i don't want to have to read termio[s].

however, i just remembered i have this (which might help):

    http://www.insultant.net/tmp/mace/tty.c



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] 9term echo-disabling fix (for ssh, vncviewer)
  2004-06-18 15:04 ` boyd, rounin
@ 2004-06-18 16:06   ` Axel Belinfante
  2004-06-18 16:52     ` boyd, rounin
  0 siblings, 1 reply; 4+ messages in thread
From: Axel Belinfante @ 2004-06-18 16:06 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> > - return (ttmode.c_lflag&(ICANON|ECHO));
> > + return (ttmode.c_lflag&(ICANON) && ttmode.c_lflag&(ECHO));
> 
> that's weird.  1st returns either:
> 
>     ICANON
>     ECHO
>     ICANON|ECHO

> 2nd returns 0 [raw | raw and no echo] or 1 [not raw and echo].

the return value is interpreted as boolean,
as in your ttyechoing routine (thanks for the pointer)
(but the != 0 test is omitted here).

for some reason (why? likely because matty's code did. why?)
we are not only looking at ECHO but also at ICANON .
Then, we must be careful to correctly deal with the case
where we have [icanon and no echo] which is what
ssh and vncviewer use when prompting for a password
(shows up as: israw c- in the debug 9term output)

The above seems to do the right thing in that case.
The original would interpret [icanon] as a reason
to echo, which is incorrect (or at least, does not
hide the password that is typed).

However, I guess with the above 9term does the wrong
thing in the case where we have [no icanon and echo],
because also then it does not echo.
However, I'm less concerned about that.

However, I'm the first to admit I know very little about termio(s).

Axel.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] 9term echo-disabling fix (for ssh, vncviewer)
  2004-06-18 16:06   ` Axel Belinfante
@ 2004-06-18 16:52     ` boyd, rounin
  0 siblings, 0 replies; 4+ messages in thread
From: boyd, rounin @ 2004-06-18 16:52 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> Then, we must be careful to correctly deal with the case
> where we have [icanon and no echo] which is what
> ssh and vncviewer use when prompting for a password
> (shows up as: israw c- in the debug 9term output)

yup.  get _all_ the cases right.

> However, I'm the first to admit I know very little about termio(s).

well, it's a mess & i've spent far too much time fighting it.

ahh, turning off ICANON you then have to get VMIN and VTIME right iirc.

VMIN should be 1 and VTIME should be some default to mean infinite to get V7 style RAW mode (but that's not even strictly true).



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-06-18 16:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-18 13:11 [9fans] 9term echo-disabling fix (for ssh, vncviewer) Axel Belinfante
2004-06-18 15:04 ` boyd, rounin
2004-06-18 16:06   ` Axel Belinfante
2004-06-18 16:52     ` boyd, rounin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).