diff options
author | John Spencer <maillist-screen@barfooze.de> | 2014-07-08 14:58:01 +0200 |
---|---|---|
committer | Amadeusz Sławiński <amade@asmblr.net> | 2014-07-08 14:59:10 +0200 |
commit | 370bb3d7152e0f6412674e89676ab9e9d1368f22 (patch) | |
tree | 6046ac90e8db266841bca5adc53abbdad192f6b7 | |
parent | e42f3520a7197b58be5dbd3c7a72c81cbf4d19d4 (diff) | |
download | screen-370bb3d7152e0f6412674e89676ab9e9d1368f22.tar.gz |
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-screen@barfooze.de>
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
-rw-r--r-- | src/screen.c | 3 | ||||
-rw-r--r-- | src/socket.c | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/screen.c b/src/screen.c index 8b36bea..15a1361 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1137,8 +1137,11 @@ char **av; 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); diff --git a/src/socket.c b/src/socket.c index f95f4a9..f1fc091 100644 --- a/src/socket.c +++ b/src/socket.c @@ -233,8 +233,11 @@ char *match; #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 @@ -453,8 +456,11 @@ MakeServerSocket() 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 @@ -545,8 +551,11 @@ MakeServerSocket() 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 |