From hohmuth@irs201.inf.tu-dresden.de  Wed Sep 27 13:02:23 1995
Received: from irs201.inf.tu-dresden.de ([141.76.16.201])
          by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id NAA12688
          for <FreeBSD-gnats-submit@freebsd.org>; Wed, 27 Sep 1995 13:02:09 -0700
Received: (from hohmuth@localhost) by irs201.inf.tu-dresden.de (8.6.11/8.6.9) id VAA01103; Wed, 27 Sep 1995 21:01:39 +0100
Message-Id: <199509272001.VAA01103@irs201.inf.tu-dresden.de>
Date: Wed, 27 Sep 1995 21:01:39 +0100
From: hohmuth@inf.tu-dresden.de
Reply-To: hohmuth@inf.tu-dresden.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: `talk' forbids talking from write-protected terminal for no good reason
X-Send-Pr-Version: 3.2

>Number:         746
>Category:       bin
>Synopsis:       `talk' forbids talking from write-protected terminal for no good reason
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 27 13:10:03 PDT 1995
>Closed-Date:    Sat Feb 24 06:02:30 PST 1996
>Last-Modified:  Sat Feb 24 06:11:52 PST 1996
>Originator:     Michael Hohmuth
>Release:        FreeBSD 2.0.5-RELEASE i386
>Organization:
Dept. of Computer Science, TU Dresden, Germany
>Environment:

"uname -a" yields:

FreeBSD olymp.inf.tu-dresden.de 2.0.5-RELEASE FreeBSD 2.0.5-RELEASE #0: Wed Jul  5 12:39:10  1995     root@olymp.inf.tu-dresden.de:/usr/src/sys/compile/OLYMP  i386

>Description:

The `talk' program has a misfeature in that it cannot be used except
from a terminal with messages on ("mesg y").  When used from a
write-protected terminal (messages off, "mesg n"), it complains that
``The callee cannot write to this terminal, use "mesg y"''.  While
this is indisputable, there is no good reason to forbid usage of the
`talk' program in this case: It is very well possible to establish a
`talk' session from a write-protected terminal; this can easily be
demonstrated after removing this misfeature.

(One might even argue _for_ write-protecting one's terminal before
initiating a `talk' session that this prevents other talk requests
from arriving in this very terminal.)

>How-To-Repeat:

olymp:~> mesg n
Exit 1
olymp:~> talk hohmuth@irs
talk: The callee cannot write to this terminal, use "mesg y".
Exit 1

>Fix:

diff -u /usr/src/usr.bin/talk/init_disp.c ./init_disp.c
--- /usr/src/usr.bin/talk/init_disp.c	Tue May 30 08:34:33 1995
+++ ./init_disp.c	Wed Sep 27 20:38:23 1995
@@ -51,22 +51,6 @@
 #include "talk.h"
 
 /*
- * Make sure the callee can write to the screen
- */
-void check_writeable()
-{
-	char *tty;
-	struct stat sb;
-
-	if ((tty = ttyname(STDERR_FILENO)) == NULL)
-		err(1, "ttyname");
-	if (stat(tty, &sb) < 0)
-		err(1, "%s", tty);
-	if (!(sb.st_mode & S_IWGRP))
-		errx(1, "The callee cannot write to this terminal, use \"mesg y\".");
-}
-
-/*
  * Set up curses, catch the appropriate signals,
  * and build the various windows.
  */
diff -u /usr/src/usr.bin/talk/talk.c ./talk.c
--- /usr/src/usr.bin/talk/talk.c	Tue May 30 08:34:41 1995
+++ ./talk.c	Wed Sep 27 20:38:56 1995
@@ -63,7 +63,6 @@
 	char *argv[];
 {
 	get_names(argc, argv);
-	check_writeable();
 	init_display();
 	open_ctl();
 	open_sockt();
>Release-Note:
>Audit-Trail:

From: J Wunsch <j@uriah.heep.sax.de>
To: hohmuth@inf.tu-dresden.de
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/746: `talk' forbids talking from write-protected terminal for no good reason
Date: Wed, 27 Sep 1995 22:09:09 +0100 (MET)

 As hohmuth@inf.tu-dresden.de wrote:
 > 
 > The `talk' program has a misfeature in that it cannot be used except
 > from a terminal with messages on ("mesg y").  When used from a
 > write-protected terminal (messages off, "mesg n"), it complains that
 > ``The callee cannot write to this terminal, use "mesg y"''.
 
 This has been discussed before with the conclusion that this feature
 is believed to be okay.  For example, the callee migh want to respond
 to the talk request with a short message via write(1) saying that he's
 going to have the talk later, instead of actually invoking the talk
 right now.
 
 Lest somebody else objects, i'm going to close this report within a
 couple of days.
 
 -- 
 cheers, J"org
 
 joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/
 Never trust an operating system you don't have sources for. ;-)

From: hohmuth@inf.tu-dresden.de (Michael Hohmuth)
To: joerg_wunsch@uriah.heep.sax.de
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/746: `talk' forbids talking from write-protected terminal for no good reason
Date: Thu, 28 Sep 1995 14:53:40 +0100 (MET)

 J Wunsch wrote:
 
 > As hohmuth@inf.tu-dresden.de wrote:
 > > 
 > > The `talk' program has a misfeature in that it cannot be used except
 > > from a terminal with messages on ("mesg y").  When used from a
 > > write-protected terminal (messages off, "mesg n"), it complains that
 > > ``The callee cannot write to this terminal, use "mesg y"''.
 > 
 > This has been discussed before with the conclusion that this feature
 > is believed to be okay.  For example, the callee migh want to respond
 > to the talk request with a short message via write(1) saying that he's
 > going to have the talk later, instead of actually invoking the talk
 > right now.
 
 I believe this is an issue of the user's policy, not of the system's.
 I don't understand why a program should intentionally be crippled in
 order to enforce a policy the user may not want.
 
 Wouldn't it be OK to just print a warning message but allow usage of
 the program anyway?
 
 Michael
 -- 
 Email: hohmuth@inf.tu-dresden.de
 WWW:   http://www.inf.tu-dresden.de/~mh1/
State-Changed-From-To: open->closed 
State-Changed-By: markm 
State-Changed-When: Sat Feb 24 06:02:30 PST 1996 
State-Changed-Why:  
This feature was specifically added. 

if users have a reason to overide it, there are ways, like make 
the talk(1) request followed by a mesg n. 

It is too easy for newbies to bug folk without this. Picture the 
scene ; newbie goes talk foo@bar.baz, and changes to alternate 
screen to await the answer beep. He has mesg n set so this will 
never happen. This irritates the daylights out of the caller. 
>Unformatted:
