Package: login
Version: 1:4.0.15-1
Severity: normal
Tags: patch

If the command executed by su is terminated by a signal which was not 
cautch, the number of that signal is given to the parent process of su. In 
that situation su exists with an exit status 0 and thus does not give any 
indication of the signal.

Thus the command
    # su nobody -c 'kill -s HUP $$'; echo $?
    0
should print 129 (128+1) instead of 0.

The source code lacks the test of WIFEXITED and the use of WTERMSIG for the 
status returned by waitpid.

-- System Information:
Architecture: powerpc (ppc)
Kernel: Linux 2.6.15-1-powerpc
Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8)
--- shadow-4.0.15.orig/src/su.c	2006-03-31 23:32:50.961000000 +0300
+++ shadow-4.0.15/src/su.c	2006-03-31 23:11:08.380000000 +0300
@@ -259,7 +259,9 @@
 		exit (-1);
 	}
 
-	exit (WEXITSTATUS (status));
+	exit (WIFEXITED (status)
+	      ? WEXITSTATUS (status)
+	      : WTERMSIG (status) + 128);
 }
 #endif
 

Reply via email to