Occasionally I sent this in private, although I wanted to send it to the
psst list, so here it is.

----- Forwarded message from Balazs Scheidler <[EMAIL PROTECTED]> -----

Date: Wed, 5 Jan 2000 13:03:37 +0100
From: Balazs Scheidler <[EMAIL PROTECTED]>
To: "Eric J. Schwertfeger" <[EMAIL PROTECTED]>
Subject: Re: lsh-0.1.20 startup sequence

> > It seems the client requested a pty, and crashed when it couldn't get
> > one. In this case, it is supposed to just go on, but not bother trying
> > to do things like setting the tty into raw mode.
> 
> When I edited config.h to fix PTY_BSD_SCHEME_FIRST_CHARS and
> PTY_BSD_SCHEME_SECOND_CHARS by hand, it worked.  So the previously
> mentioned problems are all that have to be overcome before FreeBSD has an
> unencumbered encrypted login method :-) (I know, I've seen the warnings,
> but lsh can't be worse than telnet throwing unencrypted passwords around,
> as long as there's no buffer overflows or other serious problems of that
> nature).

I've checked out FreeBSD, and as it seems this is a bug in its default
/bin/sh. Running configure with bash fixes the problem, or alternatively you
can apply this patch, and rerun autoconf.

--- configure.in~       Fri Dec 31 01:17:45 1999
+++ configure.in        Wed Jan  5 12:50:24 2000
@@ -544,8 +544,10 @@
 AC_MSG_CHECKING(for BSD pty names)
 
 dnl FIXME: What is most portable, tr -d '\n' or tr -d '\012' ?
-AC_DEFINE_UNQUOTED(PTY_BSD_SCHEME_FIRST_CHARS, "`ls /dev/pty* | cut -c 9-9 | uniq | 
tr -d '\n'`")
-AC_DEFINE_UNQUOTED(PTY_BSD_SCHEME_SECOND_CHARS, "`ls /dev/pty* | cut -c 10-10 | sort 
| uniq | tr -d '\n'`")
+first=`ls /dev/pty* | cut -c 9-9 | uniq | tr -d '\n'`
+second=`ls /dev/pty* | cut -c 10-10 | sort | uniq | tr -d '\n'`
+AC_DEFINE_UNQUOTED(PTY_BSD_SCHEME_FIRST_CHARS, "$first")
+AC_DEFINE_UNQUOTED(PTY_BSD_SCHEME_SECOND_CHARS, "$second")
 
 dnl FIXME: How can we test if the bsd scheme is likely to work?
 AC_DEFINE(PTY_BSD_SCHEME)


> 
> I'll look into POLLIN vs POLLRDNORM.

As it seems under Linux, POLLIN roughly equals to POLLRDNORM, checking out
man pages under Solaris:

     POLLIN              Data other than high priority  data  may
                         be  read without blocking.  For STREAMS,
                         this flag is set in revents even if  the
                         message is of zero length.

     POLLRDNORM          Normal data (priority band equals 0) may
                         be  read without blocking.  For STREAMS,
                         this flag is set in revents even if  the
                         message is of zero length.

     POLLRDBAND          Data from a non-zero priority  band  may
                         be  read without blocking.  For STREAMS,
                         this flag is set in revents even if  the
                         message is of zero length.

     POLLPRI             High  priority  data  may  be   received
                         without  blocking.   For  STREAMS,  this
                         flag is  set  in  revents  even  if  the
                         message is of zero length.

     POLLOUT             Normal data (priority band equals 0) may
                         be written without blocking.

     POLLWRNORM          The same as POLLOUT.

     POLLWRBAND          Priority data (priority band > 0) may be
                         written.  This event only examines bands
                         that have been written to at least once.

     POLLERR             An error has occurred on the  device  or
                         stream.  This  flag is only valid in the
                         revents bitmask; it is not used  in  the
                         events member.

     POLLHUP             A hangup has  occurred  on  the  stream.
                         This  event  and  POLLOUT  are  mutually
                         exclusive; a stream can never  be  writ-
                         able if a hangup has occurred.  However,
                         this  event  and   POLLIN,   POLLRDNORM,
                         POLLRDBAND,  or POLLPRI are not mutually
                         exclusive.  This flag is only  valid  in
                         the  revents  bitmask; it is not used in
                         the events member.

     POLLNVAL            The specified fd value does  not  belong
                         to  an  open  file.   This  flag is only
                         valid in the revents member; it  is  not
                         used in the events member.

I think the best solution would be to set both POLLIN and POLLRDNORM when
trying to read, and also accept any of those received events.

> The PTY_BSD_SCHEME_FIRST_CHARS can be fixed either by figuring out what 
> the problem is in the configure script, or by making openpty work, and
> tweaking things so that it uses openpty before the traditional method that
> uses PTY_BSD_SCHEME_(FIRST|SECOND)_CHARS.

This was the intended behaviour, however as it seems openpty() support is
currently broken.

-- 
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
     url: http://www.balabit.hu/pgpkey.txt

----- End forwarded message -----

-- 
Bazsi
PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
     url: http://www.balabit.hu/pgpkey.txt

Reply via email to