Skip to content

Instantly share code, notes, and snippets.

@roytam1
Created September 21, 2018 12:38
Show Gist options
  • Save roytam1/013e30869627e3b9e02e53b638a40b7d to your computer and use it in GitHub Desktop.
Save roytam1/013e30869627e3b9e02e53b638a40b7d to your computer and use it in GitHub Desktop.
--- screen-v.4.6.2/src/screen.c.orig 2017-10-23 20:18:26.000000000 +0800
+++ screen-v.4.6.2/src/screen.c 2018-09-21 20:36:34.581125000 +0800
@@ -1106,12 +1106,14 @@
Panic(0, "'%s' must be a directory.", SockDir);
if (eff_uid == 0 && real_uid && (int)st.st_uid != eff_uid)
Panic(0, "Directory '%s' must be owned by root.", SockDir);
n = (eff_uid == 0 && (real_uid || (st.st_mode & 0775) != 0775)) ? 0755 :
(eff_gid == (int)st.st_gid && eff_gid != real_gid) ? 0775 : 0777;
+#if !defined(__CYGWIN__)
if (((int)st.st_mode & 0777) != n)
Panic(0, "Directory '%s' must have mode %03o.", SockDir, n);
+#endif
}
sprintf(SockPath, "%s/S-%s", SockDir, LoginName);
if (access(SockPath, F_OK)) {
if (mkdir(SockPath, 0700) == -1 && errno != EEXIST)
Panic(errno, "Cannot make directory '%s'", SockPath);
@@ -1142,12 +1144,14 @@
if ((int)st.st_uid != real_uid)
Panic(0, "You are not the owner of %s.", SockPath);
#endif
}
+#if !defined(__CYGWIN__)
if ((st.st_mode & 0777) != 0700)
Panic(0, "Directory %s must have mode 700.", SockPath);
+#endif
if (SockMatch && index(SockMatch, '/'))
Panic(0, "Bad session name '%s'", SockMatch);
SockName = SockPath + strlen(SockPath) + 1;
*SockName = 0;
(void) umask(oumask);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment