Skip Menu |
 

From: Todd Lubin <tlubin@janestreet.com>
Date: Wed, 1 Nov 2017 15:29:16 -0400
Subject: ksu doesn't exit nonzero
To: krb5-bugs@mit.edu
There is a bug in ksu where it fails to exit with a nonzero status if it forks a child to run the command and the child exits nonzero.

For example:
$ su user1
$ echo 'user2@REALM *' > ~/.k5users
$ su user2
$ kinit user2
$ ksu user1 -e /file-that-does-not-exist

In the above example, ksu exits with status code 0.

The problem is that ksu calls:

waitpid(child_pid, &statusp, WUNTRACED)
and
exit (statusp);

but should be calling:
exit (WEXITSTATUS(statusp));

Best,
Todd
From: ghudson@mit.edu
Subject: git commit

Properly mirror child exit status in ksu

ksu attempts to exit with the same status as its child process, but
does not do so correctly. Use WEXITSTATUS() to extract the exit code.
Reported by Todd Lubin.

https://github.com/krb5/krb5/commit/03c7df6fc683c68975db46c7afaa24f1a9a05fae
Author: Greg Hudson <ghudson@mit.edu>
Commit: 03c7df6fc683c68975db46c7afaa24f1a9a05fae
Branch: master
src/clients/ksu/main.c | 2 +-
src/clients/ksu/t_ksu.py | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)