aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEgor Ignatov <egori@altlinux.org>2024-05-30 14:03:20 +0300
committerEgor Ignatov <egori@altlinux.org>2024-05-30 14:30:46 +0300
commitefa6e33b1da594f2a2c4c2c8871416a3d5011015 (patch)
tree144b172fb626db81cecfa55a8add843e4dc1479b /tests
parent8562cb1b951e7bd807af6b43d85c71cedd7b10d7 (diff)
downloadpam-efa6e33b1da594f2a2c4c2c8871416a3d5011015.tar.gz
pam-efa6e33b1da594f2a2c4c2c8871416a3d5011015.tar.bz2
pam-efa6e33b1da594f2a2c4c2c8871416a3d5011015.zip
pam_set_item: disallow setting service to NULL
This also prevents a possible segfault when pam_set_item tries to convert an empty service_name to lower case.
Diffstat (limited to 'tests')
-rw-r--r--tests/tst-pam_set_item.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/tst-pam_set_item.c b/tests/tst-pam_set_item.c
index 3457b49c..607fbf28 100644
--- a/tests/tst-pam_set_item.c
+++ b/tests/tst-pam_set_item.c
@@ -144,6 +144,16 @@ main (void)
}
}
+ /* 5: try to set PAM_SERVICE to NULL */
+ retval = pam_set_item (pamh, PAM_SERVICE, NULL);
+ if (retval != PAM_BAD_ITEM)
+ {
+ fprintf (stderr,
+ "pam_set_item (pamh, PAM_SERVICE, NULL) returned %d\n",
+ retval);
+ return 1;
+ }
+
pam_end (pamh, 0);
return 0;