From: John Spencer <maillist-scr...@barfooze.de> Date: Tue Sep 24 16:50:49 2013 +0200
Subject: [PATCH] screen: fix breakage when used inside qemu when a rootfs is used in qemu with virtio mount, new files created get the uid of the qemu user, not the uid of the user inside qemu. this is usually no problem since you have full access permissions to everything - however, screen did some uid comparison checks, which only make sense when the screen sockets are stored in a public place such as /var/run or /tmp. in our case, they are stored in $HOME, so any screen there belongs to us and we do not need to compare uids. Signed-off-by: John Spencer <maillist-scr...@barfooze.de> --- screen-4.0.3.org/screen.c 2013-09-24 14:07:50.595849001 +0000 +++ screen-4.0.3/screen.c 2013-09-24 14:36:40.817786893 +0000 @@ -1020,8 +1020,11 @@ else #endif { +#ifdef SOCKDIR /* if SOCKDIR is not defined, the socket is in $HOME. + in that case it does not make sense to compare uids. */ if ((int)st.st_uid != real_uid) Panic(0, "You are not the owner of %s.", SockPath); +#endif } if ((st.st_mode & 0777) != 0700) Panic(0, "Directory %s must have mode 700.", SockPath); --- screen-4.2.1/socket.c +++ screen-4.2.1-patched/socket.c @@ -230,8 +230,11 @@ #endif debug2("st.st_uid = %d, real_uid = %d\n", st.st_uid, real_uid); +#ifdef SOCKDIR /* if SOCKDIR is not defined, the socket is in $HOME. + in that case it does not make sense to compare uids. */ if ((int)st.st_uid != real_uid) continue; +#endif mode = (int)st.st_mode & 0777; debug1(" has mode 0%03o\n", mode); #ifdef MULTIUSER @@ -450,8 +453,11 @@ Msg(0, "There is already a screen running on %s.", Filename(SockPath)); if (stat(SockPath, &st) == -1) Panic(errno, "stat"); +#ifdef SOCKDIR /* if SOCKDIR is not defined, the socket is in $HOME. + in that case it does not make sense to compare uids. */ if ((int)st.st_uid != real_uid) Panic(0, "Unfortunately you are not its owner."); +#endif if ((st.st_mode & 0700) == 0600) Panic(0, "To resume it, use \"screen -r\""); else @@ -542,8 +548,11 @@ Msg(0, "There is already a screen running on %s.", Filename(SockPath)); if (stat(SockPath, &st) == -1) Panic(errno, "stat"); +#ifdef SOCKDIR /* if SOCKDIR is not defined, the socket is in $HOME. + in that case it does not make sense to compare uids. */ if (st.st_uid != real_uid) Panic(0, "Unfortunately you are not its owner."); +#endif if ((st.st_mode & 0700) == 0600) Panic(0, "To resume it, use \"screen -r\""); else
_______________________________________________ screen-users mailing list screen-users@gnu.org https://lists.gnu.org/mailman/listinfo/screen-users