Hello again,

a new observation from my bug chasing.

The assumptions made in "lib/login_tty.c", which are set
on display as inherited from Solaris, these prerequisites
are __NOT__ sufficient for OpenBSD. The reason is clearly
displayed in tty(4) of OpenBSD origin. Only after an ioctl
call with TIOCSCTTY is the controlling terminal established.

The patch below has been successfully applied to OpenBSD 4.6,
and was tested in order to build inetutils-telnetd.

Without my changes the telnet session does not get a
controlling terminal, as ksh complains loudly about,
and in addition the deactivation of echoing fails
during password passing. When the patch is applied,
the echoing stops and the expected ctty is present,
since ksh stops complaining about crippled job-control!

Best regards,
Mats Erik Andersson, fil. dr

_________________________________________________
diff --git a/lib/login_tty.c b/lib/login_tty.c
index 0403391..e06e916 100644
--- a/lib/login_tty.c
+++ b/lib/login_tty.c
@@ -22,6 +22,10 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#if __OpenBSD__
+# include <sys/ioctl.h>
+#endif
+
 int
 login_tty (int slave_fd)
 {
@@ -53,6 +57,11 @@ login_tty (int slave_fd)
     close (dummy_fd);
   }
 
+#if __OpenBSD__
+  /* Needed to activate the controlling terminal, see tty(4).  */
+  ioctl (slave_fd, TIOCSCTTY, NULL);
+#endif
+
   /* Assign fd to the standard input, standard output, and standardd error of
      the current process.  */
   for (i = 0; i < 3; i++)

Attachment: signature.asc
Description: Digital signature

Reply via email to