[Pkg-shadow-commits] r774 - in trunk/debian: . patches

Alexander Gattin xrgtn-guest at costa.debian.org
Sat Jan 7 19:31:57 UTC 2006


Author: xrgtn-guest
Date: 2006-01-07 19:31:56 +0000 (Sat, 07 Jan 2006)
New Revision: 774

Added:
   trunk/debian/patches/479_chowntty_debug
Modified:
   trunk/debian/changelog
   trunk/debian/patches/series
Log:
produce more helpful syslog message when is_my_tty() fails

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2006-01-07 18:26:05 UTC (rev 773)
+++ trunk/debian/changelog	2006-01-07 19:31:56 UTC (rev 774)
@@ -1,6 +1,8 @@
 shadow (1:4.0.14-3) UNRELEASED; urgency=low
 
   * The "Pont-L'Évêque" release
+  * 479_chowntty_debug: produce more helpful syslog message[s]
+    when is_my_tty() fails (see bug #332198).
 
  -- Christian Perrier <bubulle at debian.org>  Sat,  7 Jan 2006 19:24:37 +0100
 

Added: trunk/debian/patches/479_chowntty_debug
===================================================================
--- trunk/debian/patches/479_chowntty_debug	2006-01-07 18:26:05 UTC (rev 773)
+++ trunk/debian/patches/479_chowntty_debug	2006-01-07 19:31:56 UTC (rev 774)
@@ -0,0 +1,62 @@
+Goal: Provide more info when chown_tty() phase of login fails (see #332198).
+
+Related: #332198 (helps to debug)
+
+Status wrt upstream: Not forwarded (dunno if there's any point in this).
+
+This patch increases verbosity of is_my_tty() routine which is called
+from chown_tty() which in turn is part of login sequence. Submitter of
+the bug #332198 sometimes gets telnet session refused, but message in
+syslog is not at all helpful:
+> ... login[453]: unable to determine TTY name, got /dev/pts/1
+and in fact it's misleading, because tty name is detected OK, it's
+is_my_tty() which is failing for a reason yet unknown (I suspect
+corruption of utmp file).
+
+Index: shadow-4.0.14/libmisc/chowntty.c
+===================================================================
+--- shadow-4.0.14.orig/libmisc/chowntty.c	2005-08-31 20:24:57.000000000 +0300
++++ shadow-4.0.14/libmisc/chowntty.c	2006-01-07 21:13:17.000000000 +0200
+@@ -40,6 +40,7 @@
+ #include "defines.h"
+ #include <pwd.h>
+ #include "getdef.h"
++#include <sys/sysmacros.h>
+ /*
+  * is_my_tty -- determine if "tty" is the same as TTY stdin is using
+  */
+@@ -47,12 +48,31 @@
+ {
+ 	struct stat by_name, by_fd;
+ 
+-	if (stat (tty, &by_name) || fstat (0, &by_fd))
++	if (stat (tty, &by_name)) {
++		/* Can use neither strerror() nor "%m" sequence -- first
++		 * is locale-dependent (while SYSLOG isn't) and for second
++		 * the SYSLOG macro isn't errno-transparent.  --xrgtn */
++		int e = errno;
++		SYSLOG ((LOG_WARN, "can't stat(`%s'): errno %i\n", tty, e));
+ 		return 0;
++	}
+ 
+-	if (by_name.st_rdev != by_fd.st_rdev)
++	if (fstat (0, &by_fd)) {
++		int e = errno;
++		SYSLOG ((LOG_WARN, "can't fstat(stdin): errno %i\n", e));
+ 		return 0;
+-	else
++	}
++
++	if (by_name.st_rdev != by_fd.st_rdev) {
++		SYSLOG ((LOG_WARN,
++			 "`%s'.st_rdev(%u,%u) != stdin.st_rdev(%u,%u)\n",
++			 tty,
++			 /* XXX: dev_t is 64bit, gnu_dev_mXXor are used
++			  * which are GNU extn */
++			 major(by_name.st_rdev), minor(by_name.st_rdev),
++			 major(by_fd.st_rdev), minor(by_fd.st_rdev)));
++		return 0;
++	} else
+ 		return 1;
+ }
+ 

Modified: trunk/debian/patches/series
===================================================================
--- trunk/debian/patches/series	2006-01-07 18:26:05 UTC (rev 773)
+++ trunk/debian/patches/series	2006-01-07 19:31:56 UTC (rev 774)
@@ -42,6 +42,7 @@
 437_su_-c_option
 423_su_arguments_are_concatenated
 478_nologin.8.xml
+479_chowntty_debug
 # 999-2 is about using cdbs. It does not patch upstream files
 # so shouldn't be here, but we keep it for the future
 # 999-2_build_using_cdbs




More information about the Pkg-shadow-commits mailing list