Re: /usr/src/libexec/talkd notification broken on pty's when user is using misc/screen ports in -CURRENT

From: Vincent Poy <vince_at_oahu.WURLDLINK.NET>
Date: Tue, 1 Jul 2003 14:21:36 -1000 (HST)
On Tue, 1 Jul 2003, Cy Schubert wrote:

> Mine configures as follows:
>
> /*
>  * define PTYMODE if you do not like the default of 0622, which allows
>  * public write to your pty.
>  * define PTYGROUP to some numerical group-id if you do not want the
>  * tty to be in "your" group.
>  * Note, screen is unable to change mode or group of the pty if it
>  * is not installed with sufficient privilege. (e.g. set-uid-root)
>  * define PTYROFS if the /dev/pty devices are mounted on a read-only
>  * filesystem so screen should not even attempt to set mode or group
>  * even if running as root (e.g. on TiVo).
>  */
> #define PTYMODE 0620
> #define PTYGROUP 4
> /* #undef PTYROFS */
>
> What does your /etc/group look like?

# $FreeBSD: src/etc/group,v 1.28 2003/04/27 05:49:53 imp Exp $
#
wheel:*:0:root,vince
daemon:*:1:
kmem:*:2:
sys:*:3:
tty:*:4:
operator:*:5:root
mail:*:6:
bin:*:7:
news:*:8:
man:*:9:
games:*:13:
staff:*:20:
sshd:*:22:
smmsp:*:25:
mailnull:*:26:
guest:*:31:
users:*:32:root
bind:*:53:
majordom:*:54:
uucp:*:66:
dialer:*:68:
network:*:69:
pgsql:*:70:
www:*:80:
mysql:*:88:
nogroup:*:65533:
nobody:*:65534:
cyrus:*:60:

> Could send me a copy of /etc/devfs.conf.


#  Copyright (c) 2003 The FreeBSD Project
#  All rights reserved.
#
#  Redistribution and use in source and binary forms, with or without
#  modification, are permitted provided that the following conditions
#  are met:
#  1. Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer.
#  2. Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
#  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
#  ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
#  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL
#  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
#  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
#  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT
#  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY
#  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#  SUCH DAMAGE.
#
#  $FreeBSD: src/etc/devfs.conf,v 1.1 2003/05/06 01:10:33 dougb Exp $

# These are examples of how to configure devices using /etc/rc.d/devfs.
# The first parameter is always the action to take, the second is always
the
# existing device created by devfs, and the last is what you want to
change.
# The name of the action is only significant to the first unique
character.
#
# Examples:

# Historically X depended on this, but version 4.3.0 doesn't seem to
anymore
#link   ttyv0   vga

# Commonly used by many ports
#link   acd0    cdrom

# Allow a user in the wheel group to query the smb0 device
#perm   smb0    0660

# Allow members of group operator to cat things to the speaker
#own    speaker root:operator
#perm   speaker 0660

> I'd like to see an ls -l of /dev too.

root_at_bigbang [5:19pm][/usr/ports/misc/screen] >> /bin/ls -l /dev
total 1
crw-r--r--  1 root   operator  117,   0 Jun 29 00:10 acd0
crw-r--r--  1 root   wheel     152,   0 Jun 29 00:10 acpi
crw-r-----  1 root   operator    4,  10 Jun 29 00:10 ad0
crw-r-----  1 root   operator    4,  11 Jun 29 00:10 ad0s1
crw-r-----  1 root   operator    4,  12 Jun 28 17:10 ad0s1a
crw-r-----  1 root   operator    4,  13 Jun 29 00:10 ad0s1b
crw-r-----  1 root   operator    4,  14 Jun 29 00:10 ad0s1c
crw-r-----  1 root   operator    4,  15 Jun 28 17:10 ad0s1d
crw-------  1 root   wheel     148,   0 Jun 29 00:10 agpgart
crw-rw-r--  1 root   operator   39,   0 Jun 29 00:10 apm
crw-------  1 root   operator  159,   0 Jun 29 00:10 ata
crw-rw-rw-  1 root   wheel      30,   4 Jun 29 00:10 audio0.0
crw-rw-rw-  1 root   wheel      30, 0x00010004 Jun 29 00:10 audio0.1
crw-rw-rw-  1 root   wheel      30, 0x00020004 Jun 29 00:10 audio0.2
crw-rw-rw-  1 root   wheel      21,   0 Jun 29 00:10 bpsm0
crw-------  1 root   wheel       0,   0 Jul  1 17:09 console
crw-------  1 root   wheel      12, 255 Jun 28 17:10 consolectl
crw-rw-rw-  1 root   wheel       1,   0 Jun 29 00:10 ctty
crw-rw----  1 uucp   dialer     28, 128 Jun 29 00:10 cuaa0
crw-rw----  1 uucp   dialer     28, 160 Jun 29 00:10 cuaia0
crw-rw----  1 uucp   dialer     28, 192 Jun 29 00:10 cuala0
crw-------  1 root   wheel     173,   0 Jun 29 00:10 devctl
cr--------  1 root   wheel     250,   0 Jun 29 00:10 devstat
crw-rw-rw-  1 root   wheel      30,   3 Jun 29 00:12 dsp0.0
crw-rw-rw-  1 root   wheel      30, 0x00010003 Jun 29 00:10 dsp0.1
crw-rw-rw-  1 root   wheel      30, 0x00020003 Jun 29 00:10 dsp0.2
crw-rw-rw-  1 root   wheel      30,   5 Jun 29 00:10 dspW0.0
crw-rw-rw-  1 root   wheel      30, 0x00010005 Jun 29 00:10 dspW0.1
crw-rw-rw-  1 root   wheel      30, 0x00020005 Jun 29 00:10 dspW0.2
crw-rw-rw-  1 root   wheel      30,  11 Jun 29 00:10 dspr0.0
crw-rw-rw-  1 root   wheel      30, 0x0001000b Jun 29 00:10 dspr0.1
dr-xr-xr-x  2 root   wheel          512 Jun 28 17:10 fd
crw-r-----  1 root   operator    9,   0 Jun 29 00:10 fd0
crw-rw----  1 root   operator  127,   0 Jun 29 00:10 fw0
crw-rw----  1 root   operator  127,   1 Jun 29 00:10 fw1
crw-rw----  1 root   operator  127,   2 Jun 29 00:10 fw2
crw-rw----  1 root   operator  127,   3 Jun 29 00:10 fw3
crw-rw----  1 root   operator  127, 0x01000000 Jun 29 00:10 fwmem0
crw-r-----  1 root   operator  252,   0 Jun 29 00:10 geom.ctl
crw-------  1 root   wheel       2,  14 Jun 29 00:10 io
crw-------  1 root   wheel     112,   0 Jun 29 00:10 kbd0
crw-------  1 root   wheel       7,   0 Jun 29 00:10 klog
crw-r-----  1 root   kmem        2,   1 Jun 29 00:10 kmem
lrwxr-xr-x  1 root   wheel            3 Jun 29 00:10 log -> /var/run/log
crw-------  1 root   wheel      16,   0 Jun 29 00:10 lpt0
crw-------  1 root   wheel      16, 128 Jun 29 00:10 lpt0.ctl
crw-------  1 root   wheel      95, 0xffff00ff Jun 29 00:10 mdctl
crw-r-----  1 root   kmem        2,   0 Jun 29 00:10 mem
crw-rw-rw-  1 root   wheel      30,   0 Jun 29 00:10 mixer0
dr-xr-xr-x  2 root   wheel          512 Jun 28 17:10 net
lrwxr-xr-x  1 root   wheel            4 Jun 28 17:10 net1 -> net/xl0
lrwxr-xr-x  1 root   wheel            4 Jun 28 17:10 net2 -> net/fwe0
lrwxr-xr-x  1 root   wheel            4 Jun 28 17:10 net3 -> net/lp0
lrwxr-xr-x  1 root   wheel            4 Jun 28 17:10 net4 -> net/lo0
crw-------  1 root   wheel     253,   0 Jun 29 00:10 network
crw-rw-rw-  1 root   wheel       2,   2 Jul  1 17:11 null
crw-rw-rw-  1 root   wheel     180,   0 Jun 29 00:10 nvidia0
crw-rw-rw-  1 root   wheel     180, 255 Jun 29 00:10 nvidiactl
crw-r--r--  1 root   wheel     251,   0 Jun 29 00:10 pci
crw-r-----  1 root   kmem        2,  32 Jun 29 00:10 perfmon
crw-------  1 root   wheel      82,   0 Jun 29 00:10 ppi0
crw-rw-rw-  1 root   wheel      21,   1 Jun 29 00:10 psm0
crw-rw-rw-  1 root   wheel       6, 128 Jul  1 05:39 ptyP0
crw-rw-rw-  1 root   wheel       6, 129 Jul  1 04:26 ptyP1
crw-rw-rw-  1 root   wheel       6, 130 Jul  1 04:26 ptyP2
crw-rw-rw-  1 root   wheel       6,   0 Jul  1 17:19 ptyp0
crw-rw-rw-  1 root   wheel       6,   1 Jul  1 08:28 ptyp1
crw-rw-rw-  1 root   wheel       6,   2 Jul  1 12:06 ptyp2
crw-rw-rw-  1 root   wheel       6,   3 Jun 30 16:18 ptyp3
crw-rw-rw-  1 root   wheel       6,   4 Jun 29 00:35 ptyp4
crw-rw-rw-  1 root   wheel       6,   5 Jun 29 00:35 ptyp5
crw-rw-rw-  1 root   wheel       6,   6 Jun 29 00:35 ptyp6
crw-rw-rw-  1 root   wheel       6,   7 Jun 29 00:35 ptyp7
crw-rw-rw-  1 root   wheel       6,   8 Jun 29 00:35 ptyp8
crw-rw-rw-  1 root   wheel       6,   9 Jul  1 08:43 ptyp9
crw-rw-rw-  1 root   wheel       6,  10 Jul  1 17:19 ptypa
crw-rw-rw-  1 root   wheel       6,  11 Jul  1 12:05 ptypb
crw-rw-rw-  1 root   wheel       6,  12 Jul  1 05:04 ptypc
crw-rw-rw-  1 root   wheel       6,  13 Jul  1 05:02 ptypd
crw-rw-rw-  1 root   wheel       6,  14 Jul  1 05:02 ptype
crw-rw-rw-  1 root   wheel       6,  15 Jul  1 05:02 ptypf
crw-rw-rw-  1 root   wheel       6,  16 Jul  1 05:02 ptypg
crw-rw-rw-  1 root   wheel       2,   3 Jun 28 17:10 random
cr--r--r--  1 root   wheel      30,   6 Jun 29 00:10 sndstat
crw-------  1 root   wheel      26,   0 Jun 29 00:10 speaker
lrwxr-xr-x  1 root   wheel            6 Jun 28 17:10 stderr -> fd/2
lrwxr-xr-x  1 root   wheel            5 Jun 28 17:10 stdin -> fd/0
lrwxr-xr-x  1 root   wheel            6 Jun 28 17:10 stdout -> fd/1
crw-------  1 root   wheel      12, 128 Jun 29 00:10 sysmouse
crw-rw-rw-  1 root   wheel       5, 128 Jul  1 05:39 ttyP0
crw-rw-rw-  1 root   wheel       5, 129 Jul  1 04:26 ttyP1
crw-rw-rw-  1 root   wheel       5, 130 Jul  1 04:26 ttyP2
crw-------  1 root   wheel      28,   0 Jun 29 00:10 ttyd0
crw-------  1 root   wheel      28,  32 Jun 29 00:10 ttyid0
crw-------  1 root   wheel      28,  64 Jun 29 00:10 ttyld0
crw--w----  1 vince  tty         5,   0 Jul  1 17:19 ttyp0
crw--w----  1 vince  tty         5,   1 Jul  1 08:41 ttyp1
crw-------  1 vince  users       5,   2 Jul  1 17:18 ttyp2
crw--w----  1 vincrw--w----  1 vince  users       5,   8 Jun 29 00:35
ttyp8
crw--w----  1 vince  users       5,   9 Jul  1 08:43 ttyp9
crw--w----  1 vince  users       5typa
crw-rw-c--  1 root   wheel      12,  12 Jun 29 00:10 ttyvc
crw-------  1 root   wheel      12, ----  1 root   wheel      12,  15 Jun
29 00:10 ttyvf
lrwxr-xr-x  1 root   wheel            7 Jun 28 rator  108, 255 Jun 29
00:10 usb
crw-rw----  1 root   operator  108,   0 Jun 29 00:10 usb0
crw-rw---29 00:10 xpt0
crw-rw-rw-  1 root   wheel       2,  12 Jun 29 00:10 zero

ttyp1 was chown by me to group tty from users.  ttyp0 is the original ssh
login session and ttyp1-pa are the ones created by screen.

> I'm preparing to host a Canada Day barbecue at my house, so I may not
> have a chance to check for email later on today. Please bear with me.
> Thanks. I'm cc'ing this to current_at_ just in the chance that someone

	Have fun!

> Cheers,
> --
> Cy Schubert <Cy.Schubert_at_komquats.com>        http://www.komquats.com/
> BC Government                     .                       FreeBSD UNIX
> Cy.Schubert_at_osg.gov.bc.ca         .                     cy_at_FreeBSD.org
> http://www.gov.bc.ca/             .            http://www.FreeBSD.org/


Cheers,
Vince - vince_at_WURLDLINK.NET - Vice President             ________   __ ____
Unix Networking Operations - FreeBSD-Real Unix for Free / / / / |  / |[__  ]
WurldLink Corporation                                  / / / /  | /  | __] ]
San Francisco - Honolulu - Hong Kong                  / / / / / |/ / | __] ]
HongKong Stars/Gravis UltraSound Mailing Lists Admin /_/_/_/_/|___/|_|[____]
Almighty1_at_IRC - oahu.DAL.NET Hawaii's DALnet IRC Network Server Admin


> In message <20030701082011.Y3146-100000_at_oahu.WURLDLINK.NET>, Vincent
> Poy writes
> :
> > On Tue, 1 Jul 2003, Cy Schubert wrote:
> >
> > > In message <20030701052615.G3146-100000_at_oahu.WURLDLINK.NET>, Vincent
> > > Poy writes
> > > :
> > > [a bunch of lines edited out for brevity, see archives]
> > > > Hi Cy:
> > > >
> > > > 	I found the problem.  In 5.1-CURRENT and I think 5.1-RELEASE, /dev
> > > > uses the devfs for the devices so it no longer has to be manually
> > > > generated.  I login to the system using /dev/ttyp0 which shows up as:
> > > >
> > > > crw--w----  1 vince  tty    -   5,   0 Jul  1 08:28 /dev/ttyp0
> > > >
> > > > 	However, the 10 tty's that screen uses is ttyp1-pa which has the
> > > > group as users or the same as my login:
> > > >
> > > > crw--w----  1 vince  users    -   5,   1 Jul  1 08:28 /dev/ttyp1
> > > > crw-------  1 vince  users  -   5,   2 Jul  1 08:26 /dev/ttyp2
> > > > crw--w----  1 vince  users  -   5,   3 Jun 30 16:18 /dev/ttyp3
> > > > crw--w----  1 vince  users  -   5,   4 Jun 29 00:35 /dev/ttyp4
> > > > crw--w----  1 vince  users  -   5,   5 Jun 29 00:35 /dev/ttyp5
> > > > crw--w----  1 vince  users  -   5,   6 Jun 29 00:35 /dev/ttyp6
> > > > crw--w----  1 vince  users  -   5,   7 Jun 29 00:35 /dev/ttyp7
> > > > crw--w----  1 vince  users  -   5,   8 Jun 29 00:35 /dev/ttyp8
> > > > crw--w----  1 vince  users  -   5,   9 Jul  1 08:18 /dev/ttyp9
> > > > crw--w----  1 vince  users  -   5,  10 Jul  1 08:28 /dev/ttypa
> > > >
> > > > 	As soon as I changed the ttyp1 to the group tty, everything started
> > > > working correctly.  So it seems that the /dev has the incorrect group whe
> > n
> > > > the tty is from screen.
> > >
> > > No problems here.
> > >
> > > cwsys$ ll ttyp?
> > > crw-rw-rw-  1 root  wheel    5,   0 Jun 26 13:19 ttyp0
> > > crw--w----  1 cy    tty      5,   1 Jul  1 10:05 ttyp1
> > > crw--w----  1 cy    tty      5,   2 Jul  1 10:05 ttyp2
> > > crw--w----  1 cy    tty      5,   3 Jul  1 10:05 ttyp3
> > > crw--w----  1 cy    tty      5,   4 Jul  1 10:05 ttyp4
> > > crw--w----  1 cy    tty      5,   5 Jul  1 10:05 ttyp5
> > > crw--w----  1 cy    tty      5,   6 Jul  1 10:05 ttyp6
> > > crw--w----  1 cy    tty      5,   7 Jul  1 10:05 ttyp7
> > > crw--w----  1 cy    tty      5,   8 Jul  1 10:05 ttyp8
> > > crw--w----  1 cy    tty      5,   9 Jul  1 10:05 ttyp9
> > > crw--w----  1 cy    tty      5,  10 Jul  1 10:05 ttypa
> > > crw--w----  1 cy    tty      5,  11 Jul  1 10:05 ttypb
> > > crw--w----  1 cy    tty      5,  12 Jul  1 10:05 ttypc
> > > crw--w----  1 cy    tty      5,  13 Jul  1 10:05 ttypd
> > > crw--w----  1 cy    tty      5,  14 Jul  1 10:05 ttype
> > > crw--w----  1 cy    tty      5,  15 Jul  1 10:05 ttypf
> > > cwsys$
> > >
> > > I have a locally built package here at http://komquats.com/pkg/screen-3.
> > > 9.15_1.tbz/. It's built from the stock 3.9.15_1. See if it makes a
> > > difference. Other than that it could be a myriad of configuration
> > > things on your system. Anyhow give it a try and let us know your
> > > results.
> >
> > 	I tried your package with the extracted bin/screen binary and
> > yours work correctly.
> >
> > vince_at_bigbang [11:20am][~] >> tty
> > /dev/ttypb
> > vince_at_bigbang [11:20am][~] >> dir /dev/ttypb
> > crw--w----  1 vince  tty  -   5,  11 Jul  1 11:20 /dev/ttypb
> > vince_at_bigbang [11:20am][~] >>
> >
> > Message from Talk_Daemon_at_bigbang.DNALOGIC.NET at 11:20 on 2003/07/01 ...
> > talk: connection requested by vince_at_oahu.wurldlink.net
> > talk: respond with:  talk vince_at_oahu.wurldlink.net
> >
> > vince_at_bigbang [11:20am][~] >>
> >
> > 	So this means that the configure script might have something
> > configured incorrectly.   I just tried to rebuild the port and it's the
> > configure script which generates the config.h with the wrong PTYGROUP.
> >
> > /*
> >  * define PTYMODE if you do not like the default of 0622, which allows
> >  * public write to your pty.
> >  * define PTYGROUP to some numerical group-id if you do not want the
> >  * tty to be in "your" group.
> >  * Note, screen is unable to change mode or group of the pty if it
> >  * is not installed with sufficient privilege. (e.g. set-uid-root)
> >  * define PTYROFS if the /dev/pty devices are mounted on a read-only
> >  * filesystem so screen should not even attempt to set mode or group
> >  * even if running as root (e.g. on TiVo).
> >  */
> > #define PTYMODE 0620
> > #define PTYGROUP 32
> > /* #undef PTYROFS */
> >
> > 	Somehow the autodetection is definining a PTYGROUP instead of
> > leaving it at the default of tty.
> >
> >
> > Cheers,
> > Vince - vince_at_WURLDLINK.NET - Vice President             ________   __ ____
> > Unix Networking Operations - FreeBSD-Real Unix for Free / / / / |  / |[__  ]
> > WurldLink Corporation                                  / / / /  | /  | __] ]
> > San Francisco - Honolulu - Hong Kong                  / / / / / |/ / | __] ]
> > HongKong Stars/Gravis UltraSound Mailing Lists Admin /_/_/_/_/|___/|_|[____]
> > Almighty1_at_IRC - oahu.DAL.NET Hawaii's DALnet IRC Network Server Admin
> >
>
>
>
Received on Tue Jul 01 2003 - 15:22:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:13 UTC