Opened 11 years ago

Last modified 6 years ago

#40872 assigned defect

attach in multiuser mode fails with "Attach attempt with bad pid" message — at Initial Version

Reported by: steve@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.2.0
Keywords: Cc:
Port: screen

Description

Screen has a multiuser sharing capability which is ordinarily enabled by setting the screen executable to setuid root and executing the following commands for a screen: ` multiuser on acladd OTHER_USER_ID ` When screen is working properly, one user can start a screen with screen -S SCREEN_NAME while OTHER_USER_ID joins the same screen with screen -x FIRST_USER_ID/SCREEN_NAME.

However, when attempting to do this on os-X Lion (and probably previously all the way back to Snow Leopard), the second user's attachment fails (hangs) while the first user sees the message "Attach attempt with bad pid" at the bottom of their screen for a few seconds.

The source of the problem is a line that looks like this in socket.c: UserReturn(kill(pid, 0))

Apparently, the kill runs in the context of the real user id instead of the effective user id and thus the attachee process does not have permission to kill 0 the attaching process (the processes are owned by different users) even though screen is setuid root.

For some reason, this is not a problem on many other operating systems such as previous versions of OS-X or any version of Linux I've ever seen.

One workaround that may or may not introduce other problems is to simply presume the attaching process is indeed running and return success instead of returning the result of the kill call.

i.e.: perl -p -i -e 's/UserReturn\(kill\(pid, 0\)\)/return 0/' socket.c

I have tested the patch and it solves the problem although I am not sure what other problems it might create. :)

Change History (0)

Note: See TracTickets for help on using tickets.