[31279] in CVS-changelog-for-Kerberos-V5
krb5 commit: Properly mirror child exit status in ksu
daemon@ATHENA.MIT.EDU (ghudson@mit.edu)
Tue Oct 3 15:57:50 2023
From: ghudson@mit.edu
To: <cvs-krb5@mit.edu>
Message-ID: <20231003195736.7C37A101760@krbdev.mit.edu>
Date: Tue, 3 Oct 2023 15:57:36 -0400 (EDT)
MIME-Version: 1.0
Reply-To: krbdev@mit.edu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu
https://github.com/krb5/krb5/commit/03c7df6fc683c68975db46c7afaa24f1a9a05fae
commit 03c7df6fc683c68975db46c7afaa24f1a9a05fae
Author: Greg Hudson <ghudson@mit.edu>
Date: Fri Jul 28 18:07:34 2023 -0400
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.
ticket: 8618
src/clients/ksu/main.c | 2 +-
src/clients/ksu/t_ksu.py | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/clients/ksu/main.c b/src/clients/ksu/main.c
index 729843658..80a9c07db 100644
--- a/src/clients/ksu/main.c
+++ b/src/clients/ksu/main.c
@@ -780,7 +780,7 @@ main(int argc, char ** argv)
com_err(prog_name, errno, _("while calling waitpid"));
}
sweep_up(ksu_context, cc_target);
- exit (statusp);
+ exit (WIFEXITED(statusp) ? WEXITSTATUS(statusp) : 1);
case -1:
com_err(prog_name, errno, _("while trying to fork."));
sweep_up(ksu_context, cc_target);
diff --git a/src/clients/ksu/t_ksu.py b/src/clients/ksu/t_ksu.py
index 9740972ba..ab52b4b2d 100644
--- a/src/clients/ksu/t_ksu.py
+++ b/src/clients/ksu/t_ksu.py
@@ -244,7 +244,7 @@ mark('principal heuristic (no authorization)')
realm.run([ksu, '.', '-e', klist],
expected_msg='Default principal: alice@KRBTEST.COM')
be_root()
-realm.run([ksu, 'ksutest', '-e', klist],
+realm.run([ksu, 'ksutest', '-e', klist], expected_code=1,
expected_msg='No credentials cache found')
be_caller()
realm.kinit('ksutest', 'pwksutest')
@@ -253,7 +253,8 @@ realm.run([ksu, 'ksutest', '-e', klist],
expected_msg='Default principal: ksutest@KRBTEST.COM')
be_caller()
realm.run([kdestroy])
-realm.run([ksu, '.', '-e', klist], expected_msg='No credentials cache found')
+realm.run([ksu, '.', '-e', klist], expected_code=1,
+ expected_msg='No credentials cache found')
mark('authentication without authorization')
realm.run([ksu, '.', '-n', 'ksutest', '-e', klist], input='pwksutest\n',
@@ -266,6 +267,7 @@ realm.kinit(caller_username, 'pwcaller')
realm.run([ksu, '.', '-z', '-e', klist],
expected_msg='Default principal: ' + caller_username)
-realm.run([ksu, '.', '-Z', '-e', klist])
+realm.run([ksu, '.', '-Z', '-e', klist], expected_code=1,
+ expected_msg='No credentials cache found')
success('ksu tests')
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5