summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2013-09-21 22:34:31 +0200
committerMichael Adam <obnox@samba.org>2013-09-24 07:44:29 +0200
commit21be539590b7af40ea8af7301cd539f6433a8928 (patch)
treeaceae6cf017c8dbf420e1be2e81860a7691974fc
parentdc222d8b94301272ccdef21516bd6e3fe7df669c (diff)
downloadsamba-21be539590b7af40ea8af7301cd539f6433a8928.tar.gz
samba-21be539590b7af40ea8af7301cd539f6433a8928.tar.bz2
samba-21be539590b7af40ea8af7301cd539f6433a8928.zip
selftest: add regression test for setting invalid parameters in registry config via "net [rpc] conf"
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rwxr-xr-xsource3/script/tests/test_net_conf.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/source3/script/tests/test_net_conf.sh b/source3/script/tests/test_net_conf.sh
index 1a773fa61f..c432c3e183 100755
--- a/source3/script/tests/test_net_conf.sh
+++ b/source3/script/tests/test_net_conf.sh
@@ -422,6 +422,51 @@ test_conf_setparm_existing()
fi
}
+test_conf_setparm_forbidden()
+{
+ FORBIDDEN_PARAMS="lock directory
+lock dir
+config backend
+include"
+
+ echo '\nTrying to set forbidden parameters' >> $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
+ }
+
+ OLD_IFS="$IFS"
+ IFS='
+'
+ for PARAM in $FORBIDDEN_PARAMS ; do
+ IFS="$OLD_IFS"
+ echo "Trying to set parameter '$PARAM'" | tee -a $LOG
+ $NETCMD conf setparm global "$PARAM" "value" > $DIR/setparm_forbidden_out 2>&1
+ log_print $NETCMD conf setparm global \""$PARAM"\" "value"
+ test "x$?" = "x0" && {
+ echo "ERROR: setting forbidden parameter '$PARAM' succeeded" | tee -a $LOG
+ return 1
+ }
+
+ echo "output of net command: " | tee -a $LOG
+ cat $DIR/setparm_forbidden_out | tee -a $LOG
+
+ SEARCH="Parameter '$PARAM' not allowed in registry."
+ grep "$SEARCH" $DIR/setparm_forbidden_out >/dev/null 2>>$LOG
+ test "x$?" = "x0" || {
+ echo "ERROR: expected '$SEARCH'" | tee -a $LOG
+ return 1
+ }
+ done
+
+ IFS="$OLD_IFS"
+ return 0
+}
+
test_conf_setparm_usage()
{
echo '\nChecking usage' >>$LOG
@@ -884,6 +929,10 @@ CONF_FILES=$SERVERCONFFILE
test_conf_setparm_existing \
|| failed=`expr $failed + 1`
+ testit "conf_setparm_forbidden" \
+ test_conf_setparm_forbidden \
+ || failed=`expr $failed + 1`
+
testit "conf_setparm_usage" \
test_conf_setparm_usage \
|| failed=`expr $failed + 1`