2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

Test parsing LDIF when a backslash is the last char of the file.

If run with address sanitizer, this test will crash when the fix
in ceaf706ab74b is reverted.
This commit is contained in:
Todd C. Miller 2022-11-09 12:58:41 -07:00
parent 685150586d
commit 8b898b2ca2
5 changed files with 15 additions and 2 deletions

View File

@ -804,6 +804,8 @@ plugins/sudoers/regress/cvtsudoers/test37.out.ok
plugins/sudoers/regress/cvtsudoers/test37.sh
plugins/sudoers/regress/cvtsudoers/test38.out.ok
plugins/sudoers/regress/cvtsudoers/test38.sh
plugins/sudoers/regress/cvtsudoers/test39.out.ok
plugins/sudoers/regress/cvtsudoers/test39.sh
plugins/sudoers/regress/cvtsudoers/test4.out.ok
plugins/sudoers/regress/cvtsudoers/test4.sh
plugins/sudoers/regress/cvtsudoers/test5.out.ok

View File

@ -337,7 +337,7 @@ depend:
cd $(top_builddir) && ./config.status --file plugins/sudoers/Makefile
harness: $(srcdir)/regress/harness.in
cd $(top_builddir) && ./config.status --file plugins/sudoers/regress/harness
cd $(top_builddir) && ./config.status --file plugins/sudoers/regress/harness && chmod +x plugins/sudoers/regress/harness
Makefile: $(srcdir)/Makefile.in
cd $(top_builddir) && ./config.status --file plugins/sudoers/Makefile

View File

@ -0,0 +1,11 @@
#!/bin/sh
#
# Test handling of a backslash at EOF with no trailing newline.
#
# If compiled with address sanitizer, cvtsudoers will crash without
# the fix in ceaf706ab74b.
#
: ${CVTSUDOERS=cvtsudoers}
printf 'dn: cn= Manager\\' | $CVTSUDOERS -c "" -b dc=sudo,dc=ws -i ldif -f sudoers

View File

@ -189,8 +189,8 @@ sudoers)
echo "$group/$test: FAIL"
diff $out $out_ok || true
fi
ntests=`expr $ntests + 1`
if test -s $err_ok; then
ntests=`expr $ntests + 1`
if cmp $err $err_ok >/dev/null; then
if [ $verbose -eq 1 ]; then
echo "$group/$test (stderr): OK"