selftest: Add test for case-preserving in 'net [rpc] conf showshare'
authorChristof Schmitt <cs@samba.org>
Wed, 15 May 2019 22:55:00 +0000 (15:55 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 23 May 2019 23:26:14 +0000 (23:26 +0000)
Add a test to verify that 'net [rpc] conf showshare' returns the correct
upper/lower case.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
selftest/knownfail
source3/script/tests/test_net_conf.sh

index 2c31bf916190c7cc420c9ce145bffb4bcedbe3f5..b414e5b1367f775fec276ad1c914d1d6e6d72c93 100644 (file)
 ^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\)
index a81b21e5332065af454ee27bee1aad35174f9061..1b9a4be019a5f297d41783c8338eac1445db0485 100755 (executable)
@@ -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`