[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

r6791 - in glibc-package/trunk/debian: . patches patches/any



Author: aurel32
Date: 2015-12-10 21:34:04 +0000 (Thu, 10 Dec 2015)
New Revision: 6791

Added:
   glibc-package/trunk/debian/patches/any/cvs-grantpt-pty-owner.diff
Modified:
   glibc-package/trunk/debian/changelog
   glibc-package/trunk/debian/patches/series
Log:
patches/any/cvs-grantpt-pty-owner.diff: new patch from upstream to
improve granpt when /dev/pts is not mounted with the correct options.
Closes: #806882.

Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog	2015-12-09 20:40:15 UTC (rev 6790)
+++ glibc-package/trunk/debian/changelog	2015-12-10 21:34:04 UTC (rev 6791)
@@ -10,6 +10,9 @@
     are not officially supported.
   * debhelper.in/libc.preinst, debhelper.in/libc.templates, po/*: display
     kernel related notes using debconf if available.
+  * patches/any/cvs-grantpt-pty-owner.diff: new patch from upstream to
+    improve granpt when /dev/pts is not mounted with the correct options.
+    Closes: #806882.
 
   [ Samuel Thibault ]
   * patches/hurd-i386/cvs-libpthread-api.diff: New patch, cleans libpthread

Added: glibc-package/trunk/debian/patches/any/cvs-grantpt-pty-owner.diff
===================================================================
--- glibc-package/trunk/debian/patches/any/cvs-grantpt-pty-owner.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/any/cvs-grantpt-pty-owner.diff	2015-12-10 21:34:04 UTC (rev 6791)
@@ -0,0 +1,46 @@
+2015-12-10  Aurelien Jarno  <aurelien@aurel32.net>
+	    Jakub Wilk  <jwilk@debian.org>
+
+	[BZ #19347]
+	* sysdeps/unix/grantpt.c [!HAVE_PT_CHOWN] (grantpt): Do not try
+	to change the group of the device to the tty group.
+
+--- a/sysdeps/unix/grantpt.c
++++ b/sysdeps/unix/grantpt.c
+@@ -155,6 +155,7 @@ grantpt (int fd)
+     }
+   gid_t gid = tty_gid == -1 ? __getgid () : tty_gid;
+ 
++#if HAVE_PT_CHOWN
+   /* Make sure the group of the device is that special group.  */
+   if (st.st_gid != gid)
+     {
+@@ -164,9 +165,26 @@ grantpt (int fd)
+ 
+   /* Make sure the permission mode is set to readable and writable by
+      the owner, and writable by the group.  */
+-  if ((st.st_mode & ACCESSPERMS) != (S_IRUSR|S_IWUSR|S_IWGRP))
++  mode_t mode = S_IRUSR|S_IWUSR|S_IWGRP;
++#else
++  /* When built without pt_chown, we have delegated the creation of the
++     pty node with the right group and permission mode to the kernel, and
++     non-root users are unlikely to be able to change it. Therefore let's
++     consider that POSIX enforcement is the responsibility of the whole
++     system and not only the GNU libc. Thus accept different group or
++     permission mode.  */
++
++  /* Make sure the permission is set to readable and writable by the
++     owner.  For security reasons, make it writable by the group only
++     when originally writable and when the group of the device is that
++     special group.  */
++  mode_t mode = S_IRUSR|S_IWUSR|
++	        ((st.st_gid == gid) ? (st.st_mode & S_IWGRP) : 0);
++#endif
++
++  if ((st.st_mode & ACCESSPERMS) != mode)
+     {
+-      if (__chmod (buf, S_IRUSR|S_IWUSR|S_IWGRP) < 0)
++      if (__chmod (buf, mode) < 0)
+ 	goto helper;
+     }
+ 

Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series	2015-12-09 20:40:15 UTC (rev 6790)
+++ glibc-package/trunk/debian/patches/series	2015-12-10 21:34:04 UTC (rev 6791)
@@ -280,3 +280,4 @@
 any/cvs-tls-dtv.diff
 any/cvs-rfc3542-advanced-api.diff
 any/cvs-check-localplt.diff
+any/cvs-grantpt-pty-owner.diff


Reply to: