bugGNU Screen - Bugs: bug #37437, -X option ignores specified user...

 
 

bug #37437: -X option ignores specified user in multiuser environment

Submitter:  Lars Noodén <larsnooden>
Submitted:  Mon 24 Sep 2012 05:40:35 PM UTC
Votes:  50  
 
Category:  Program Logic Severity:  3 - Normal
Priority:  * 5 - Normal Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Release:  4.0.3
Fixed Release:  4.9.0 Planned Release:  None
Work Required:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       No canned response available

 

( Jump to the original submission )

Tue 20 Oct 2020 01:45:12 PM UTC, comment #8: 

Hi Taj,

thanks a lot!
Your patch is in 'screen-v4' branch now:
https://git.savannah.gnu.org/cgit/screen.git/patch/?id=ae27fef9fb9dfe2517f1c333dec848f4df278120

Cheers,
Alex

comment #7:

> Hi Alexander,
>
> I just confirmed that the bug is still present in `screen-v4`, and have generated a new patch that I verified fixes the issue.
>

> diff --git a/src/screen.c b/src/screen.c
> index 7dcb9af..f4e6258 100644
> --- a/src/screen.c
> +++ b/src/screen.c
> @@ -1185,20 +1185,25 @@ int main(int ac, char** av)
>        else
>          exit(9 + (fo || oth ? 1 : 0) + fo);
>      }
>      if (fo == 0)
>        Panic(0, "No Sockets found in %s.\n", SockPath);
>      Msg(0, "%d Socket%s in %s.", fo, fo > 1 ? "s" : "", SockPath);
>      eexit(0);
>    }
>    signal(SIG_BYE, AttacherFinit);      /* prevent races */
>    if (cmdflag) {
> +#ifdef MULTIUSER
> +    if (multi)
> +      real_uid = multi_uid;
> +#endif
> +
>      /* attach_tty is not mandatory */
>      SetTtyname(false, &st);
>      if (!*av)
>        Panic(0, "Please specify a command.");
>      SET_GUID();
>      SendCmdMessage(sty, SockMatch, av, queryflag >= 0);
>      exit(0);
>    }
>    else if (rflag || xflag) {
>      debug("screen -r: - is there anybody out there?\n");

>
> This diff was generated at revision 30c9a2a6c190647e35d1ce7b4758de9081f06d10.
>
> Let me know if there's a more-preferred way to submit patches. :)
> - Taj

Alexander Naumov <anaumov>
Project Administrator
Sun 18 Oct 2020 11:23:50 PM UTC, comment #7: 

Hi Alexander,

I just confirmed that the bug is still present in `screen-v4`, and have generated a new patch that I verified fixes the issue.

diff --git a/src/screen.c b/src/screen.c
index 7dcb9af..f4e6258 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1185,20 +1185,25 @@ int main(int ac, char** av)
       else
         exit(9 + (fo || oth ? 1 : 0) + fo);
     }
     if (fo == 0)
       Panic(0, "No Sockets found in %s.\n", SockPath);
     Msg(0, "%d Socket%s in %s.", fo, fo > 1 ? "s" : "", SockPath);
     eexit(0);
   }
   signal(SIG_BYE, AttacherFinit);      /* prevent races */
   if (cmdflag) {
+#ifdef MULTIUSER
+    if (multi)
+      real_uid = multi_uid;
+#endif
+
     /* attach_tty is not mandatory */
     SetTtyname(false, &st);
     if (!*av)
       Panic(0, "Please specify a command.");
     SET_GUID();
     SendCmdMessage(sty, SockMatch, av, queryflag >= 0);
     exit(0);
   }
   else if (rflag || xflag) {
     debug("screen -r: - is there anybody out there?\n");

This diff was generated at revision 30c9a2a6c190647e35d1ce7b4758de9081f06d10.

Let me know if there's a more-preferred way to submit patches. :)
- Taj

Taj Morton <tajmorton>
Wed 30 Sep 2020 11:06:26 PM UTC, comment #6: 

comment #5:

> And eventually I've found Taj Morton's patch (here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=626526), but I decided to use sudo to circumvent it.


Hello Oskar,

sorry that this problem still there despite the existing solution.
Can you try to test this patch with git version (screen-v4 branch) please? If it solves the problem, I will apply it immediately.

Alexander Naumov <anaumov>
Project Administrator
Wed 30 Sep 2020 10:26:26 AM UTC, comment #5: 

I've run into this bug on screen version 4.08.00 (GNU) 05-Feb-20. While searching for solutions I've found multiple users having the same problem, among others:

https://stackoverflow.com/questions/24095478/php-pass-a-command-to-another-users-screen-session
https://ubuntuforums.org/archive/index.php/t-1589046.html
https://www.spigotmc.org/threads/execute-command-in-another-users-screen.21106/

And eventually I've found Taj Morton's patch (here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=626526), but I decided to use sudo to circumvent it. Others have been switching to tmux because of this.

Oskar <oskark>
Thu 28 Feb 2013 08:45:36 AM UTC, comment #4: 

wfm wheezy on mac-mini and Raspberry pi

$ ssh me@remote-ip -t "screen -x myscreen -X stuff 'flite -t \"connecting you\"'`echo -ne '\015'`"

requires libncurses-dev

Jonathan Chetwynd <peepo>
Wed 27 Feb 2013 07:08:57 PM UTC, comment #3: 

can't help with a patch, but as I just raised this issue on the mailing list as: screen -x myname -X stuff 'mycommand' \n
http://lists.gnu.org/archive/html/screen-users/2013-02/msg00009.html
I'd like to test, and report, please advise when ready

Jonathan Chetwynd <peepo>
Mon 04 Feb 2013 03:58:16 PM UTC, comment #2: 

Oops, formatting fail (no preview button!?). Let's try again:

--- screen.c-orig 2013-02-03 13:44:35.039601124 -0800
+++ screen.c 2013-02-03 13:44:13.463601460 -0800
@@ -1069,6 +1069,10 @@
     {
       char *sty = 0;

+#ifdef MULTIUSER
+      if (multi)
+ real_uid = multi_uid;
+#endif
       /* attach_tty is not mandatory */
       if ((attach_tty = ttyname(0)) == 0)
         attach_tty = "";


Taj Morton <tajmorton>
Mon 04 Feb 2013 03:55:30 PM UTC, comment #1: 

I just ran into this the other day as well. The following patch fixes the bug:


--- screen.c-orig 2013-02-03 13:44:35.039601124 -0800
+++ screen.c 2013-02-03 13:44:13.463601460 -0800
@@ -1069,6 +1069,10 @@
{
char *sty = 0;

+#ifdef MULTIUSER
+ if (multi)
+ real_uid = multi_uid;
+#endif
/* attach_tty is not mandatory */
if ((attach_tty = ttyname(0)) == 0)
attach_tty = "";
-no

Taj Morton <tajmorton>
Mon 24 Sep 2012 05:40:35 PM UTC, original submission:  

In a multiuser environment, it seems that the -X option simply ignores the specified user and looks for the session in the current user's environment. 

Steps:

As user1, start a session and turn on multiuser mode

 screen -S myscrn
 ^A:multiuser on
 ^A:acladd user2

As user2, test the session with ls, then try to use stuff.

 screen -S user1/myscrn -ls
 screen -S user1/myscrn -X stuff "shutdown"

stuff fails to send characters to the screen session specified by -S  What should happen is that user1's screen session receive input from 'stuff'

Lars Noodén <larsnooden>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by anaumov (Posted a comment)
  • -email is unavailable- added by oskark (Posted a comment)
  • -email is unavailable- added by oskark (Voted in favor of this item)
  • -email is unavailable- added by peepo (Posted a comment)
  • -email is unavailable- added by tajmorton (Posted a comment)
  • -email is unavailable- added by larsnooden (Submitted the item)
  •  

    There are 50 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-10-20 anaumov StatusReady For Test Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.9.0
    2020-09-30 anaumov StatusNone Ready For Test
    2020-09-29 oskark Carbon-Copy- Added oskark

    Back to the top


    Powered by Savane 3.9