From f58127d0248811c0ce246317af8f9e058a7aafed Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Wed, 15 May 2019 15:55:00 -0700 Subject: [PATCH] selftest: Add test for case-preserving in 'net [rpc] conf showshare' Add a test to verify that 'net [rpc] conf showshare' returns the correct upper/lower case. Signed-off-by: Christof Schmitt Reviewed-by: Jeremy Allison --- selftest/knownfail | 1 + source3/script/tests/test_net_conf.sh | 42 +++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/selftest/knownfail b/selftest/knownfail index 2c31bf91619..b414e5b1367 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -370,3 +370,4 @@ ^samba.tests.ntlmdisabled.python\(ktest\).python2.ntlmdisabled.NtlmDisabledTests.test_samr_change_password\(ktest\) ^samba.tests.ntlmdisabled.python\(ad_dc_no_ntlm\).python3.ntlmdisabled.NtlmDisabledTests.test_ntlm_connection\(ad_dc_no_ntlm\) ^samba.tests.ntlmdisabled.python\(ad_dc_no_ntlm\).python2.ntlmdisabled.NtlmDisabledTests.test_ntlm_connection\(ad_dc_no_ntlm\) +^samba3.blackbox.net.rpc.conf.test_conf_showshare_case\(nt4_dc\) diff --git a/source3/script/tests/test_net_conf.sh b/source3/script/tests/test_net_conf.sh index a81b21e5332..1b9a4be019a 100755 --- a/source3/script/tests/test_net_conf.sh +++ b/source3/script/tests/test_net_conf.sh @@ -254,6 +254,44 @@ test_conf_delshare_usage() fi } +test_conf_showshare_case() +{ + echo '\nChecking case in net conf shareshare' >>$LOG + + echo '\nDropping existing configuration' >> $LOG + $NETCMD conf drop + log_print $NETCMD conf drop + test "x$?" = "x0" || { + echo 'ERROR: RC does not match, expected: 0' | tee -a $LOG + return 1 + } + + for share in UPPERCASE lowercase; do + + log_print $NETCMD conf addshare $share /tmp + $NETCMD conf addshare $share /tmp \ + >>$DIR/case_addshare_exp \ + 2>>$DIR/case_addshare_exp + + # Lookup share in different case, check that output has + # share name in correct case. + switch_case=$(echo $share | tr 'A-Za-z' 'a-zA-Z') + log_print $NETCMD conf showshare $switch_case + $NETCMD conf showshare $switch_case > $DIR/showshare_out + test "x$?" = "x0" || { + echo 'ERROR: net conf showshare failed.' | tee -a $LOG + return 1 + } + + grep "\[$share\]" $DIR/showshare_out >/dev/null 2>>$LOG + if [ "$?" = "1" ]; then + echo "ERROR: share not found" | tee -a $LOG + return 1 + fi + done + +} + test_conf_drop() { @@ -922,6 +960,10 @@ CONF_FILES=$SERVERCONFFILE test_conf_delshare_usage \ || failed=`expr $failed + 1` + testit "test_conf_showshare_case" \ + test_conf_showshare_case \ + || failed=`expr $failed + 1` + testit "conf_setparm" \ test_conf_setparm \ || failed=`expr $failed + 1` -- 2.47.3