diff options
author | Andrew G. Morgan <morgan@kernel.org> | 2021-09-01 06:52:31 -0700 |
---|---|---|
committer | Andrew G. Morgan <morgan@kernel.org> | 2021-09-01 06:52:31 -0700 |
commit | 2d776b10dc9f4b33ec3778f6d4fddc51f9b9dcde (patch) | |
tree | 71b5e8a699c8b9c821bb430706980b9ab610b532 | |
parent | 15a3d49bf12b24c0a353525acb93e188f67e7581 (diff) | |
download | libcap2-2d776b10dc9f4b33ec3778f6d4fddc51f9b9dcde.tar.gz |
Permit root to run test_pam_cap without arguments.
This fixes a bug preventing 'make test' from working when invoked by root.
Bug reported by David Seifert:
https://bugzilla.kernel.org/show_bug.cgi?id=214257
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
-rw-r--r-- | pam_cap/test_pam_cap.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pam_cap/test_pam_cap.c b/pam_cap/test_pam_cap.c index 4c09a5d..4c67cad 100644 --- a/pam_cap/test_pam_cap.c +++ b/pam_cap/test_pam_cap.c @@ -223,7 +223,8 @@ int main(int argc, char *argv[]) { exit(1); } if (read_capabilities_for_user("morgan", "/dev/null") != NULL) { - printf("/dev/null is not a valid config file\n"); + printf("/dev/null should return no capabilities\n"); + exit(1); } /* @@ -238,6 +239,10 @@ int main(int argc, char *argv[]) { printf("test_pam_cap: OK! (Skipping privileged tests (uid!=0))\n"); exit(0); } + if (argc == 1) { + printf("test_pam_cap: OK (kick the tires test)\n"); + exit(0); + } change[A] = strtoul(argv[2], NULL, 0); change[B] = strtoul(argv[3], NULL, 0); |